I'm probably doing something very simple wrong, since I'm a PHP novice. Tell you what - I'll trade an answer to my problem for a quick bash script or Java help, both of which I'm a master of.
My problem is this - I'm trying to create an observer of the "NOTIFY_DOWNLOAD_VIA_SYMLINK___BEGINS" event. I followed the tutorial, but just cant get my class to run when the event fires.
First, I had to change the includes/modules/pages/download/header_php.php file like so:
Notice the "$zco_notifier" line? Originally, the notify method was only passing the event name 'NOTIFY_DOWNLOAD_VIA_SYMLINK___BEGINS' as an argument. I added the array of the paths I needed from the download process.Code:if ($link_create_status==true) { $zco_notifier->notify('NOTIFY_DOWNLOAD_VIA_SYMLINK___BEGINS', array(DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $download_link,DIR_FS_DOWNLOAD . $origin_filename) ); header("RPGBOMB: Crap"); header("HTTP/1.1 303 See Other"); zen_redirect(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $download_link); }
Next. I created the file config.rpgbomb.php in the includes/auto_loaders directory:
I figure the numbers in there for the load order are ok, as I'm not going to be relying on anything other than what gets passed in through the array.Code:<?php $autoLoadConfig[10][] = array('autoType'=>'class', 'loadFile'=>'observers/class.checkoutpdf.php'); $autoLoadConfig[10][] = array('autoType'=>'classInstantiate', 'className'=>'checkoutpdf', 'objectName'=>'checkoutpdf'); ?>
Last, my class:
I tried to set a header to see if it would appear in the browser response. No dice, but I have no idea if that should work - I just assumed because it's technically procedural code...Code:<?php class checkoutpdf extends base { function myObserver() { global $zco_notifier; $zco_notifier->attach($this, array('NOTIFY_DOWNLOAD_VIA_SYMLINK___BEGINS')); } function update(&$callingClass, $notifier, $paramsArray) { #$linkName = $paramsArray[0]; #header("linkname: " . $linkName); #$origName = $paramsArray[1]; #header("origname: " . $origName); header("FACETS: Crap!"); } } ?>
So what I need is just a little help over the hump - maybe a way to show that my the class is actually getting notified. I'm figuring once I can see that, my next move is to use the exec backticks to run a bash script I wrote to process the pdf files before the download happens. That brings up a good question - if I try to run a shell script from PHP - what directory am I in? I mean, if I did something like this:
...where would the file appear?PHP Code:$output=`touch hereiam.txt`;
Details of my installation are below:
Zen Cart 1.3.8a
Database Patch Level: 1.3.8
v1.3.8 [2009-05-25 19:03:46] (Fresh Installation)
v1.3.8 [2009-05-25 19:03:46] (Fresh Installation)
PHP Version 5.2.6



