6 * - base application setup (variables etc to javascript)
8 * - authentication and permission info about user / application
9 * - json output methods.
10 * - file upload error checking - checkFileUploadError
11 * - logging to event table
12 * - sendTemplate code (normally use the Person version for sending to specific people..)
14 * - doc managment code?? - remarks and tracking??? - MOVEME
15 * - authentication link checking?? MOVEME?
16 * - authentication reset password ?? MOVEME?
17 * ?? arrayClean.. what's it doing here?!? ;)
21 * Pman['local_autoauth'] // who to login as when using localhost
22 * Pman['isDev'] // can the site show develpment info.?
23 * Pman['uiConfig'] // extra variable to export to front end..
24 * Pman['auth_comptype'] // -- if set to 'OWNER' then only users with company=OWNER can log in
25 * Pman['authTable'] // the authentication table (default 'person')
29 * DB_DataObject*:*toEventString (for logging - this is generically prefixed to all database operations.)
30 * - any data object where this method exists, the result will get prefixed to the log remarks
37 require_once 'Pman/Core/AssetTrait.php';
39 class Pman extends HTML_FlexyFramework_Page
41 use Pman_Core_AssetTrait;
42 //outputJavascriptDir()
47 var $appShortName= "";
48 var $appVersion = "1.8";
55 var $appDisabled = array(); // array of disabled modules..
56 // (based on config option disable)
58 var $authUser; // always contains the authenticated user..
60 var $disable_jstemplate = false; /// disable inclusion of jstemplate code..
63 var $css_path = ''; // can inject a specific path into the base HTML page.
66 * ------------- Standard getAuth/get/post methods of framework.
71 function getAuth() // everyone allowed in!!!!!
73 $this->loadOwnerCompany();
80 if (isset($this->_hasInit)) {
83 $this->_hasInit = true;
84 // move away from doing this ... you can access bootLoader.XXXXXX in the master template..
85 $boot = HTML_FlexyFramework::get();
86 // echo'<PRE>';print_R($boot);exit;
87 $this->appName= $boot->appName;
88 $this->appNameShort= $boot->appNameShort;
91 $this->appModules= $boot->enable;
93 // echo $this->arrayToJsInclude($files);
94 $this->isDev = empty($boot->Pman['isDev']) ? false : $boot->Pman['isDev'];
96 $this->css_path = empty($boot->Pman['css_path']) ? '' : $boot->Pman['css_path'];
98 $this->appDisable = $boot->disable;
99 $this->appDisabled = explode(',', $boot->disable);
100 $this->version = $boot->version;
101 $this->uiConfig = empty($boot->Pman['uiConfig']) ? false : $boot->Pman['uiConfig'];
103 if (!empty($ff->Pman['local_autoauth']) &&
104 ($_SERVER['SERVER_ADDR'] == '127.0.0.1') &&
105 ($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
110 // if a file Pman_{module}_Pman exists.. and it has an init function... - call that..
112 //var_dump($this->appModules);
118 * module init is only loaded on main page call, and includes checks for configuration settings.
120 function initModules()
122 foreach(explode(',',$this->appModules) as $m) {
123 $cls = 'Pman_'. $m . '_Pman';
125 //echo $this->rootDir . '/'.str_replace('_','/', $cls). '.php';
127 if (!file_exists($this->rootDir . '/'.str_replace('_','/', $cls). '.php')) {
130 require_once str_replace('_','/', $cls). '.php';
132 if (method_exists($c,'init')) {
140 function get($base, $opts=array())
144 $this->initModules();
147 //$this->allowSignup= empty($opts['allowSignup']) ? 0 : 1;
148 $bits = explode('/', $base);
151 // should really be moved to Login...
153 if ($bits[0] == 'PasswordReset') {
154 $this->linkFail = $this->resetPassword(@$bits[1],@$bits[2],@$bits[3]);
155 header('Content-type: text/html; charset=utf-8');
159 $au = $this->getAuthUser();
161 $ff= HTML_FlexyFramework::get();
163 if (!empty($ff->Pman['auth_comptype']) && $au->id > 0 &&
164 ( !$au->company_id || ($ff->Pman['auth_comptype'] != $au->company()->comptype))) {
168 $this->jerr("Login not permited to outside companies - please reload");
170 $this->addEvent("RELOAD");
175 $this->jerror("BADURL","invalid url: $base");
178 if (isset($_GET['onloadTrack'])) {
179 $this->onloadTrack = (int)$_GET['onloadTrack'];
181 // getting this to work with xhtml is a nightmare
182 // = nbsp / <img> issues screw everyting up.
183 //var_dump($this->isDev);
184 // force regeneration on load for development enviroments..
186 HTML_FlexyFramework::get()->generateDataobjectsCache(!empty($_REQUEST['isDev']) && $this->isDev);
188 //header('Content-type: application/xhtml+xml; charset=utf-8');
192 if ($this->company && $this->company->logo_id) {
193 $im = DB_DataObject::Factory('Images');
194 $im->get($this->company->logo_id);
195 $this->appLogo = $this->baseURL . '/Images/Thumb/x100/'. $this->company->logo_id .'/' . $im->filename;
198 header('Content-type: text/html; charset=utf-8');
201 function post($base) {
202 return $this->get($base);
206 // --------------- AUTHENTICATION or system information
209 * finds the compay with comptype=='OWNER'
210 * ?? what about comptype_id-name ?????
212 * @return {Pman_Core_DataObjects_Companies} the owner company
214 function loadOwnerCompany()
216 // only applies if authtable is person..
217 $ff = HTML_FlexyFramework::get();
218 if (!empty($ff->Pman['authTable']) && !in_array($ff->Pman['authTable'] , [ 'core_person', 'Person' ])) {
222 $this->company = DB_DataObject::Factory('core_company');
223 if (!is_a($this->company, 'DB_DataObject')) { // non-core pman projects
226 $this->company->get('comptype', 'OWNER');
227 return $this->company;
233 * getAuthUser: - get the authenticated user..
235 * @return {DB_DataObject} of type Pman[authTable] if authenticated.
238 function getAuthUser()
240 if (!empty($this->authUser)) {
241 return $this->authUser;
243 $ff = HTML_FlexyFramework::get();
244 $tbl = empty($ff->Pman['authTable']) ? 'core_person' : $ff->Pman['authTable'];
246 $u = DB_DataObject::factory( $tbl );
248 if (is_a($u,'PEAR_Error') || !$u->isAuth()) {
251 $this->authUser =$u->getAuthUser();
252 return $this->authUser ;
256 * wrapper arround authuser->hasPerm
257 * @see Pman_Core_DataObject_Core_person::hasPerm
259 * @param {String} $name The permission name (eg. Projects.List)
260 * @param {String} $lvl eg. (C)reate (E)dit (D)elete ... etc.
263 function hasPerm($name, $lvl) // do we have a permission
265 static $pcache = array();
266 $au = $this->getAuthUser();
267 return $au && $au->hasPerm($name,$lvl);
272 * modulesList: List the modules in the application
274 * @return {Array} list of modules
276 function modulesList()
278 $boot = HTML_FlexyFramework::get();
279 // echo'<PRE>';print_R($boot);exit;
282 $mods = explode(',', $boot->enable);
283 if (in_array('Core',$mods)) { // core has to be the first modules loaded as it contains Pman.js
284 array_unshift($mods, 'Core');
287 if (in_array($boot->appNameShort,$mods)) { // Project has to be the last modules loaded as it contains Pman.js
288 unset($mods[array_search($boot->appNameShort, $mods)]);
289 $mods[] = $boot->appNameShort;
292 $mods = array_unique($mods);
294 $disabled = explode(',', $boot->disable ? $boot->disable : '');
296 foreach($mods as $mod) {
297 // add the css file..
298 if (in_array($mod, $disabled)) {
309 function hasModule($name)
312 if (!strpos( $name,'.') ) {
313 // use enable / disable..
314 return in_array($name, $this->modules());
317 $x = DB_DataObject::factory('core_group_right');
318 $ar = $x->defaultPermData();
319 if (empty($ar[$name]) || empty($ar[$name][0])) {
334 * ---------------- Global Tools ---------------
336 function checkFileUploadError() // check for file upload errors.
339 empty($_FILES['File'])
340 || empty($_FILES['File']['name'])
341 || empty($_FILES['File']['tmp_name'])
342 || empty($_FILES['File']['type'])
343 || !empty($_FILES['File']['error'])
344 || empty($_FILES['File']['size'])
346 $this->jerr("File upload error: <PRE>" . print_r($_FILES,true) . print_r($_POST,true) . "</PRE>");
352 * generate a tempory file with an extension (dont forget to delete it)
355 function tempName($ext)
357 $x = tempnam(ini_get('session.save_path'), HTML_FlexyFramework::get()->appNameShort.'TMP');
359 return $x .'.'. $ext;
364 * ------------- Authentication password reset ------ ??? MOVEME?
370 function resetPassword($id,$t, $key)
373 $au = $this->getAuthUser();
375 return "Already Logged in - no need to use Password Reset";
378 $u = DB_DataObject::factory('core_person');
379 //$u->company_id = $this->company->id;
381 if (!$u->get($id) || !strlen($u->passwd)) {
386 if ($key != $u->genPassKey($t)) {
387 return "invalid key";
390 $u->no_reset_sent = 0;
393 if ($t < strtotime("NOW - 1 DAY")) {
396 $this->showNewPass = implode("/", array($id,$t,$key));
401 * jerrAuth: standard auth failure - with data that let's the UI know..
405 $au = $this->authUser();
407 // is it an authfailure?
408 $this->jerr("Permission denied to view this resource", array('authFailure' => true));
410 $this->jerr("Not authenticated", array('authFailure' => true));
416 * ---------------- Standard JSON outputers. - used everywhere
419 * ---------------- Standard JSON outputers. - used everywhere
420 * JSON error - simple error with logging.
424 function jerr($str, $errors=array(), $content_type = false) // standard error reporting..
426 return $this->jerror('ERROR', $str,$errors,$content_type);
429 * Recomended JSON error indicator
432 * @param string $type - normally 'ERROR' - you can use this to track error types.
433 * @param string $message - error message displayed to user.
434 * @param array $errors - optioanl data to pass to front end.
435 * @param string $content_type - use text/plain to return plan text - ?? not sure why...
439 function jerror($type, $str, $errors=array(), $content_type = false) // standard error reporting..
441 if ($type !== false) {
442 $this->addEvent($type, false, $str);
445 $cli = HTML_FlexyFramework::get()->cli;
447 echo "ERROR: " .$str . "\n";
448 exit(1); // cli --- exit code to stop shell execution if necessary.
452 if ($content_type == 'text/plain') {
453 header('Content-Disposition: attachment; filename="error.txt"');
454 header('Content-type: '. $content_type);
455 echo "ERROR: " .$str . "\n";
461 require_once 'Services/JSON.php';
462 $json = new Services_JSON();
466 $retHTML = isset($_SERVER['CONTENT_TYPE']) &&
467 preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']);
470 if (isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] == 'NO') {
474 $retHTML = isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] !='NO';
479 header('Content-type: text/html');
480 echo "<HTML><HEAD></HEAD><BODY>";
481 echo $json->encodeUnsafe(array(
484 'message' => $str, // compate with exeption / loadexception.
486 'errors' => $errors ? $errors : true, // used by forms to flag errors.
487 'authFailure' => !empty($errors['authFailure']),
489 echo "</BODY></HTML>";
493 if (isset($_REQUEST['_debug'])) {
494 echo '<PRE>'.htmlspecialchars(print_r(array(
498 'message' => $str, // compate with exeption / loadexception.
499 'errors' => $errors ? $errors : true, // used by forms to flag errors.
500 'authFailure' => !empty($errors['authFailure']),
506 echo $json->encode(array(
510 'message' => $str, // compate with exeption / loadexception.
511 'errors' => $errors ? $errors : true, // used by forms to flag errors.
512 'authFailure' => !empty($errors['authFailure']),
521 $cli = HTML_FlexyFramework::get()->cli;
523 echo "OK: " .$str . "\n";
526 require_once 'Services/JSON.php';
527 $json = new Services_JSON();
529 $retHTML = isset($_SERVER['CONTENT_TYPE']) &&
530 preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']);
533 if (isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] == 'NO') {
537 $retHTML = isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] !='NO';
541 header('Content-type: text/html');
542 echo "<HTML><HEAD></HEAD><BODY>";
543 // encode html characters so they can be read..
544 echo str_replace(array('<','>'), array('\u003c','\u003e'),
545 $json->encodeUnsafe(array('success'=> true, 'data' => $str)));
546 echo "</BODY></HTML>";
551 echo $json->encode(array('success'=> true, 'data' => $str));
557 * output data for grids or tree
558 * @ar {Array} ar Array of data
559 * @total {Number|false} total number of records (or false to return count(ar)
560 * @extra {Array} extra key value list of data to pass as extra data.
563 function jdata($ar,$total=false, $extra=array(), $cachekey = false)
565 // should do mobile checking???
566 if ($total == false) {
569 $extra= $extra ? $extra : array();
570 require_once 'Services/JSON.php';
571 $json = new Services_JSON();
573 $retHTML = isset($_SERVER['CONTENT_TYPE']) &&
574 preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']);
577 if (isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] == 'NO') {
581 $retHTML = isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] !='NO';
586 header('Content-type: text/html');
587 echo "<HTML><HEAD></HEAD><BODY>";
588 // encode html characters so they can be read..
589 echo str_replace(array('<','>'), array('\u003c','\u003e'),
590 $json->encodeUnsafe(array('success' => true, 'total'=> $total, 'data' => $ar) + $extra));
591 echo "</BODY></HTML>";
596 // see if trimming will help...
597 if (!empty($_REQUEST['_pman_short'])) {
600 foreach($ar as $as) {
602 foreach($as as $k=>$v) {
603 if (is_string($v) && !strlen(trim($v))) {
615 $ret = $json->encode(array('success' => true, 'total'=> $total, 'data' => $ar) + $extra);
617 if (!empty($cachekey)) {
619 $fn = ini_get('session.save_path') . '/json-cache'.date('/Y/m/d').'.'. $cachekey . '.cache.json';
620 if (!file_exists(dirname($fn))) {
621 mkdir(dirname($fn), 0777,true);
623 file_put_contents($fn, $ret);
631 /** a daily cache **/
632 function jdataCache($cachekey)
634 $fn = ini_get('session.save_path') . '/json-cache'.date('/Y/m/d').'.'. $cachekey . '.cache.json';
635 if (file_exists($fn)) {
636 header('Content-type: application/json');
637 echo file_get_contents($fn);
647 * ---------------- OUTPUT
649 function hasBg($fn) // used on front page to check if logos exist..
651 return file_exists($this->rootDir.'/Pman/'.$this->appNameShort.'/templates/images/'. $fn);
654 * outputJavascriptIncludes:
656 * output <script....> for all the modules in the applcaiton
659 function outputJavascriptIncludes()
661 // BC support - currently 1 project still relies on this.. (MO portal)
662 $o = HTML_FlexyFramework::get()->Pman_Core;
663 if (isset($o['packseed'])) {
664 return $this->outputJavascriptIncludesBC();
668 $mods = $this->modulesList();
670 $is_bootstrap = in_array('BAdmin', $mods);
672 foreach($mods as $mod) {
673 // add the css file..
676 if (!file_exists($this->rootDir."/Pman/$mod/is_bootstrap")) {
677 echo '<!-- missing '. $this->rootDir."/Pman/$mod/is_bootstrap - skipping -->";
683 $this->outputJavascriptDir("Pman/$mod/widgets", "*.js");
684 $this->outputJavascriptDir("Pman/$mod", "*.js");
688 if (empty($this->disable_jstemplate)) {
689 // and finally the JsTemplate...
690 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
698 * output <link rel=stylesheet......> for all the modules in the applcaiton
701 * This could css minify as well.
703 function outputCSSIncludes() // includes on CSS links.
706 $mods = $this->modulesList();
709 foreach($mods as $mod) {
710 // add the css file..
711 $this->outputCSSDir("Pman/$mod","*.css");
734 // --- OLD CODE - in for BC on MO project.... - needs removing...
736 // used on old versions.....
737 function outputJavascriptIncludesBC()
740 $mods = $this->modulesList();
742 foreach($mods as $mod) {
743 // add the css file..
746 $files = $this->moduleJavascriptList($mod.'/widgets');
747 foreach($files as $f) {
748 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
751 $files = $this->moduleJavascriptList($mod);
752 foreach($files as $f) {
753 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
757 if (empty($this->disable_jstemplate)) {
758 // and finally the JsTemplate...
759 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
764 * Gather infor for javascript files..
766 * @param {String} $mod the module to get info about.
767 * @return {StdClass} details about module.
769 function moduleJavascriptFilesInfo($mod)
772 static $cache = array();
774 if (isset($cache[$mod])) {
779 $ff = HTML_FlexyFramework::get();
781 $base = dirname($_SERVER['SCRIPT_FILENAME']);
782 $dir = $this->rootDir.'/Pman/'. $mod;
783 $path = $this->rootURL ."/Pman/$mod/";
785 $ar = glob($dir . '/*.js');
791 foreach($ar as $fn) {
793 // got the 'module file..'
794 $mtime = filemtime($dir . '/'. $f);
795 $maxtime = max($mtime, $maxtime);
796 $arfiles[$fn] = $mtime;
797 $files[] = $path . $f . '?ts='.$mtime;
800 ksort($arfiles); // just sort by name so it's consistant for serialize..
802 $compile = empty($ff->Pman['public_cache_dir']) ? 0 : 1;
803 $basedir = $compile ? $ff->Pman['public_cache_dir'] : false;
804 $baseurl = $compile ? $ff->Pman['public_cache_url'] : false;
809 $lsort = create_function('$a,$b','return strlen($a) > strlen($b) ? 1 : -1;');
810 usort($files, $lsort);
812 $smod = str_replace('/','.',$mod);
814 $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize($arfiles)) .'.js';
817 // why are translations done like this - we just build them on the fly frmo the database..
818 $tmtime = file_exists($this->rootDir.'/_translations_/'. $smod.'.js')
819 ? filemtime($this->rootDir.'/_translations_/'. $smod.'.js') : 0;
821 $cache[$mod] = (object) array(
822 'smod' => $smod, // module name without '/'
823 'files' => $files, // list of all files.
824 'filesmtime' => $arfiles, // map of mtime=>file
825 'maxtime' => $maxtime, // max mtime
826 'compile' => $this->isDev ? false : $compile,
827 'translation_file' => $base .'/_translations_/' . $smod . '.js',
828 'translation_mtime' => $tmtime,
830 'translation_data' => preg_replace('/\.js$/', '.__translation__.js', $output),
831 'translation_base' => $dir .'/', //prefix of filename (without moudle name))
832 'basedir' => $basedir,
833 'baseurl' => $baseurl,
834 'module_dir' => $dir,
841 * moduleJavascriptList: list the javascript files in a module
843 * The original version of this.. still needs more thought...
845 * Compiled is in Pman/_compiled_/{$mod}/{LATEST...}.js
846 * Translations are in Pman/_translations_/{$mod}.js
848 * if that stuff does not exist just list files in Pman/{$mod}/*.js
850 * Compiled could be done on the fly..
854 * @param {String} $mod the module to look at - eg. Pman/{$mod}/*.js
855 * @return {Array} list of include paths (either compiled or raw)
861 function moduleJavascriptList($mod)
865 $dir = $this->rootDir.'/Pman/'. $mod;
868 if (!file_exists($dir)) {
869 echo '<!-- missing directory '. htmlspecialchars($dir) .' -->';
873 $info = $this->moduleJavascriptFilesInfo($mod);
877 if (empty($info->files)) {
880 // finally sort the files, so they are in the right order..
882 // only compile this stuff if public_cache is set..
886 // public_cache_dir = /var/www/myproject_cache
887 // public_cache_url = /myproject_cache (with Alias apache /myproject_cache/ /var/www/myproject_cache/)
890 if (!$info->compile) {
891 echo "<!-- Javascript compile turned off (isDev on, or public_cache_dir not set) -->\n";
895 // where are we going to write all of this..
896 // This has to be done via a
897 if (!file_exists($info->basedir.'/'.$info->output) || !filesize($info->basedir.'/'.$info->output)) {
898 require_once 'Pman/Core/JsCompile.php';
899 $x = new Pman_Core_JsCompile();
901 $x->pack($info->filesmtime,$info->basedir.'/'.$info->output, $info->translation_base);
903 echo "<!-- file exists not exist: {$info->basedir}/{$info->output} -->\n";
906 if (file_exists($info->basedir.'/'.$info->output) &&
907 filesize($info->basedir.'/'.$info->output)) {
910 $info->baseurl.'/'. $info->output,
913 // output all the ava
914 // fixme - this needs the max datetime for the translation file..
915 $ret[] = $this->baseURL."/Admin/InterfaceTranslations/".$mod.".js"; //?ts=".$info->translation_mtime;
917 //if ($info->translation_mtime) {
918 // $ret[] = $this->rootURL."/_translations_/". $info->smod.".js?ts=".$info->translation_mtime;
925 // give up and output original files...
935 * PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
937 function initErrorHandling()
939 if (!class_exists('HTML_FlexyFramework2')) {
940 // what about older code that still users PEAR?
941 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
943 set_exception_handler(array($this,'onException'));
948 static $permitError = false; // static why?
950 var $showErrorToUser = true;
952 function onPearError($err)
954 return $this->onException($err);
959 function onException($ex)
962 static $reported = false;
967 if (Pman::$permitError) {
973 $out = is_a($ex,'Exception') ? $ex->getMessage() : $ex->toString();
976 //print_R($bt); exit;
979 $bt = is_a($ex,'Exception') ? $ex->getTrace() : $ex->backtrace;
980 foreach( $bt as $b) {
981 $ret[] = @$b['file'] . '(' . @$b['line'] . ')@' . @$b['class'] . '::' . @$b['function'];
987 //convert the huge backtrace into something that is readable..
988 $out .= "\n" . implode("\n", $ret);
990 $this->addEvent("EXCEPTION", false, $out);
992 if ($this->showErrorToUser) {
995 // not sure why this is here... - perhaps doing a jerr() was actually caught by the UI, and hidden from the user..?
996 $this->jerror(false,"An error Occured, please contact the website owner");
1005 * ---------------- Logging ---------------
1010 * Log an action (only if it has not been logged already.
1012 * @param {String} action - group/name of event
1013 * @param {DataObject|false} obj - dataobject action occured on.
1014 * @param {String} any remarks
1015 * @return {false|DB_DataObject} Event object.,
1018 function addEventOnce($act, $obj = false, $remarks = '')
1020 if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) {
1023 $e = DB_DataObject::factory('Events');
1024 $e->init($act,$obj,$remarks);
1025 if ($e->find(true)) {
1028 return $this->addEvent($act, $obj, $remarks);
1034 * @param {String} action - group/name of event
1035 * @param {DataObject|false} obj - dataobject action occured on.
1036 * @param {String} any remarks
1037 * @return {DB_DataObject} Event object.,
1040 function addEvent($act, $obj = false, $remarks = '')
1043 if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) {
1046 $au = $this->getAuthUser();
1048 $e = DB_DataObject::factory('Events');
1049 $e->init($act,$obj,$remarks);
1051 $e->event_when = $e->sqlValue('NOW()');
1053 $eid = $e->insert();
1055 // fixme - this should be in onInsert..
1056 $wa = DB_DataObject::factory('core_watch');
1057 if (method_exists($wa,'notifyEvent')) {
1058 $wa->notifyEvent($e); // trigger any actions..
1062 $e->onInsert(isset($_REQUEST) ? $_REQUEST : array() , $this);
1069 function addEventNotifyOnly($act, $obj = false, $remarks = '')
1071 $au = $this->getAuthUser();
1073 $e = DB_DataObject::factory('Events');
1074 $e->init($act,$obj,$remarks);
1076 $e->event_when = $e->sqlValue('NOW()');
1077 $wa = DB_DataObject::factory('core_watch');
1078 if (method_exists($wa,'notifyEvent')) {
1079 $wa->notifyEvent($e); // trigger any actions..
1084 // ------------------ DEPERCIATED ----------------------------
1086 // DEPRECITAED - use moduleslist
1087 function modules() { return $this->modulesList(); }
1089 // DEPRECIATED.. - use getAuthUser...
1090 function staticGetAuthUser() { $x = new Pman(); return $x->getAuthUser(); }
1093 // DEPRICATED USE Pman_Core_Mailer
1095 function emailTemplate($templateFile, $args)
1098 require_once 'Pman/Core/Mailer.php';
1099 $r = new Pman_Core_Mailer(array(
1100 'template'=>$templateFile,
1101 'contents' => $args,
1104 return $r->toData();
1107 // DEPRICATED - USE Pman_Core_Mailer
1108 // WHAT Part about DEPRICATED Does no one understand??
1109 function sendTemplate($templateFile, $args)
1111 require_once 'Pman/Core/Mailer.php';
1112 $r = new Pman_Core_Mailer(array(
1113 'template'=>$templateFile,
1114 'contents' => array(),