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?!? ;)
20 * DB_DataObject*:*toEventString (for logging - this is generically prefixed to all database operations.)
21 * - any data object where this method exists, the result will get prefixed to the log remarks
24 require_once 'Pman/Core/AssetTrait.php';
26 class Pman extends HTML_FlexyFramework_Page
28 use Pman_Core_AssetTrait;
29 //outputJavascriptDir()
34 var $appShortName= "";
35 var $appVersion = "1.8";
42 var $appDisabled = array(); // array of disabled modules..
43 // (based on config option disable)
45 var $authUser; // always contains the authenticated user..
47 var $disable_jstemplate = false; /// disable inclusion of jstemplate code..
51 * ------------- Standard getAuth/get/post methods of framework.
56 function getAuth() // everyone allowed in!!!!!
58 $this->loadOwnerCompany();
66 if (isset($this->_hasInit)) {
69 $this->_hasInit = true;
70 // move away from doing this ... you can access bootLoader.XXXXXX in the master template..
71 $boot = HTML_FlexyFramework::get();
72 // echo'<PRE>';print_R($boot);exit;
73 $this->appName= $boot->appName;
74 $this->appNameShort= $boot->appNameShort;
77 $this->appModules= $boot->enable;
79 // echo $this->arrayToJsInclude($files);
80 $this->isDev = empty($boot->Pman['isDev']) ? false : $boot->Pman['isDev'];
82 $this->appDisable = $boot->disable;
83 $this->appDisabled = explode(',', $boot->disable);
84 $this->version = $boot->version;
85 $this->uiConfig = empty($boot->Pman['uiConfig']) ? false : $boot->Pman['uiConfig'];
87 if (!empty($ff->Pman['local_autoauth']) &&
88 ($_SERVER['SERVER_ADDR'] == '127.0.0.1') &&
89 ($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
94 // if a file Pman_{module}_Pman exists.. and it has an init function... - call that..
96 //var_dump($this->appModules);
102 * module init is only loaded on main page call, and includes checks for configuration settings.
104 function initModules()
106 foreach(explode(',',$this->appModules) as $m) {
107 $cls = 'Pman_'. $m . '_Pman';
109 //echo $this->rootDir . '/'.str_replace('_','/', $cls). '.php';
111 if (!file_exists($this->rootDir . '/'.str_replace('_','/', $cls). '.php')) {
114 require_once str_replace('_','/', $cls). '.php';
116 if (method_exists($c,'init')) {
128 $this->initModules();
131 //$this->allowSignup= empty($opts['allowSignup']) ? 0 : 1;
132 $bits = explode('/', $base);
134 if ($bits[0] == 'Link') {
135 $this->linkFail = $this->linkAuth(@$bits[1],@$bits[2]);
136 header('Content-type: text/html; charset=utf-8');
140 // should really be moved to Login...
142 if ($bits[0] == 'PasswordReset') {
143 $this->linkFail = $this->resetPassword(@$bits[1],@$bits[2],@$bits[3]);
144 header('Content-type: text/html; charset=utf-8');
148 $au = $this->getAuthUser();
150 $ff= HTML_FlexyFramework::get();
152 if (!empty($ff->Pman['auth_comptype']) && $au->id > 0 &&
153 ( !$au->company_id || ($ff->Pman['auth_comptype'] != $au->company()->comptype))) {
157 $this->jerr("Login not permited to outside companies - please reload");
159 $this->addEvent("RELOAD");
164 $this->addEvent("BADURL", false, $base);
165 $this->jerr("invalid url");
168 if (isset($_GET['onloadTrack'])) {
169 $this->onloadTrack = (int)$_GET['onloadTrack'];
171 // getting this to work with xhtml is a nightmare
172 // = nbsp / <img> issues screw everyting up.
173 //var_dump($this->isDev);
174 // force regeneration on load for development enviroments..
176 HTML_FlexyFramework::get()->generateDataobjectsCache($this->isDev);
178 //header('Content-type: application/xhtml+xml; charset=utf-8');
182 if ($this->company && $this->company->logo_id) {
183 $im = DB_DataObject::Factory('Images');
184 $im->get($this->company->logo_id);
185 $this->appLogo = $this->baseURL . '/Images/Thumb/300x100/'. $this->company->logo_id .'/' . $im->filename;
188 header('Content-type: text/html; charset=utf-8');
191 function post($base) {
192 return $this->get($base);
196 // --------------- AUTHENTICATION or system information
199 * finds the compay with comptype=='OWNER'
201 * @return {Pman_Core_DataObjects_Companies} the owner company
203 function loadOwnerCompany()
205 // only applies if authtable is person..
206 $ff = HTML_FlexyFramework::get();
207 if (!empty($ff->Pman['authTable']) && $ff->Pman['authTable'] != 'Person') {
211 $this->company = DB_DataObject::Factory('Companies');
212 if (!is_a($this->company, 'DB_DataObject')) { // non-core pman projects
215 $this->company->get('comptype', 'OWNER');
216 return $this->company;
222 * getAuthUser: - get the authenticated user..
224 * @return {DB_DataObject} of type Pman[authTable] if authenticated.
227 function getAuthUser()
229 if (!empty($this->authUser)) {
230 return $this->authUser;
232 $ff = HTML_FlexyFramework::get();
233 $tbl = empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable'];
235 $u = DB_DataObject::factory( $tbl );
239 $this->authUser =$u->getAuthUser();
240 return $this->authUser ;
244 * wrapper arround authuser->hasPerm
245 * @see Pman_Core_DataObjects_User::hasPerm
247 * @param {String} $name The permission name (eg. Projects.List)
248 * @param {String} $lvl eg. (C)reate (E)dit (D)elete ... etc.
251 function hasPerm($name, $lvl) // do we have a permission
253 static $pcache = array();
254 $au = $this->getAuthUser();
255 return $au && $au->hasPerm($name,$lvl);
260 * modulesList: List the modules in the application
262 * @return {Array} list of modules
264 function modulesList()
266 $boot = HTML_FlexyFramework::get();
267 // echo'<PRE>';print_R($boot);exit;
270 $mods = explode(',', $boot->enable);
271 if (in_array('Core',$mods)) { // core has to be the first modules loaded as it contains Pman.js
272 array_unshift($mods, 'Core');
275 if (in_array($boot->appNameShort,$mods)) { // Project has to be the last modules loaded as it contains Pman.js
276 unset($mods[array_search($boot->appNameShort, $mods)]);
277 $mods[] = $boot->appNameShort;
280 $mods = array_unique($mods);
282 $disabled = explode(',', $boot->disable ? $boot->disable : '');
284 foreach($mods as $mod) {
285 // add the css file..
286 if (in_array($mod, $disabled)) {
297 function hasModule($name)
300 if (!strpos( $name,'.') ) {
301 // use enable / disable..
302 return in_array($name, $this->modules());
305 $x = DB_DataObject::factory('Group_Rights');
306 $ar = $x->defaultPermData();
307 if (empty($ar[$name]) || empty($ar[$name][0])) {
322 * ---------------- Global Tools ---------------
324 function checkFileUploadError() // check for file upload errors.
327 empty($_FILES['File'])
328 || empty($_FILES['File']['name'])
329 || empty($_FILES['File']['tmp_name'])
330 || empty($_FILES['File']['type'])
331 || !empty($_FILES['File']['error'])
332 || empty($_FILES['File']['size'])
334 $this->jerr("File upload error: <PRE>" . print_r($_FILES,true) . print_r($_POST,true) . "</PRE>");
340 * generate a tempory file with an extension (dont forget to delete it)
343 function tempName($ext)
345 $x = tempnam(ini_get('session.save_path'), HTML_FlexyFramework::get()->appNameShort.'TMP');
347 return $x .'.'. $ext;
350 * ------------- Authentication testing ------ ??? MOVEME?
354 function linkAuth($trid, $trkey)
356 $tr = DB_DataObject::factory('Documents_Tracking');
357 if (!$tr->get($trid)) {
358 return "Invalid URL";
360 if (strtolower($tr->authkey) != strtolower($trkey)) {
361 $this->AddEvent("ERROR-L", false, "Invalid Key");
362 return "Invalid KEY";
365 $this->onloadTrack = (int) $tr->doc_id;
366 if (strtotime($tr->date_sent) < strtotime("NOW - 14 DAYS")) {
367 $this->AddEvent("ERROR-L", false, "Key Expired");
368 return "Key Expired";
370 // user logged in and not
371 $au = $this->getAuthUser();
372 if ($au && $au->id && $au->id != $tr->person_id) {
375 return "Logged Out existing Session\n - reload to log in with correct key";
377 if ($au) { // logged in anyway..
378 $this->AddEvent("LOGIN", false, "With Key (ALREADY)");
379 header('Location: ' . $this->baseURL.'?onloadTrack='.$this->onloadTrack);
384 // authenticate the user...
386 $u = DB_DataObject::factory('Person');
388 $u->get($tr->person_id);
390 $this->AddEvent("LOGIN", false, "With Key");
392 // we need to redirect out - otherwise refererer url will include key!
393 header('Location: ' . $this->baseURL.'?onloadTrack='.$this->onloadTrack);
405 * ------------- Authentication password reset ------ ??? MOVEME?
411 function resetPassword($id,$t, $key)
414 $au = $this->getAuthUser();
416 return "Already Logged in - no need to use Password Reset";
419 $u = DB_DataObject::factory('Person');
420 //$u->company_id = $this->company->id;
422 if (!$u->get($id) || !strlen($u->passwd)) {
427 if ($key != $u->genPassKey($t)) {
428 return "invalid key";
431 $u->no_reset_sent = 0;
434 if ($t < strtotime("NOW - 1 DAY")) {
437 $this->showNewPass = implode("/", array($id,$t,$key));
442 * jerrAuth: standard auth failure - with data that let's the UI know..
446 $au = $this->authUser();
448 // is it an authfailure?
449 $this->jerr("Permission denied to view this resource", array('authFailure' => true));
451 $this->jerr("Not authenticated", array('authFailure' => true));
457 * ---------------- Standard JSON outputers. - used everywhere
460 * ---------------- Standard JSON outputers. - used everywhere
461 * JSON error - simple error with logging.
465 function jerr($str, $errors=array(), $content_type = false) // standard error reporting..
467 return $this->jerror('ERROR', $str,$errors,$content_type);
470 * Recomended JSON error indicator
473 * @param string $type - normally 'ERROR' - you can use this to track error types.
474 * @param string $message - error message displayed to user.
475 * @param array $errors - optioanl data to pass to front end.
476 * @param string $content_type - use text/plain to return plan text - ?? not sure why...
480 function jerror($type, $str, $errors=array(), $content_type = false) // standard error reporting..
482 if ($type !== false) {
483 $this->addEvent($type, false, $str);
486 $cli = HTML_FlexyFramework::get()->cli;
488 echo "ERROR: " .$str . "\n";
493 if ($content_type == 'text/plain') {
494 header('Content-Disposition: attachment; filename="error.txt"');
495 header('Content-type: '. $content_type);
496 echo "ERROR: " .$str . "\n";
502 require_once 'Services/JSON.php';
503 $json = new Services_JSON();
508 if (!empty($_REQUEST['returnHTML']) ||
509 (isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
511 header('Content-type: text/html');
512 echo "<HTML><HEAD></HEAD><BODY>";
513 echo $json->encodeUnsafe(array(
516 'message' => $str, // compate with exeption / loadexception.
518 'errors' => $errors ? $errors : true, // used by forms to flag errors.
519 'authFailure' => !empty($errors['authFailure']),
521 echo "</BODY></HTML>";
525 if (isset($_REQUEST['_debug'])) {
526 echo '<PRE>'.htmlspecialchars(print_r(array(
530 'message' => $str, // compate with exeption / loadexception.
531 'errors' => $errors ? $errors : true, // used by forms to flag errors.
532 'authFailure' => !empty($errors['authFailure']),
538 echo $json->encode(array(
542 'message' => $str, // compate with exeption / loadexception.
543 'errors' => $errors ? $errors : true, // used by forms to flag errors.
544 'authFailure' => !empty($errors['authFailure']),
553 $cli = HTML_FlexyFramework::get()->cli;
555 echo "OK: " .$str . "\n";
558 require_once 'Services/JSON.php';
559 $json = new Services_JSON();
561 if (!empty($_REQUEST['returnHTML']) ||
562 (isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
565 header('Content-type: text/html');
566 echo "<HTML><HEAD></HEAD><BODY>";
567 // encode html characters so they can be read..
568 echo str_replace(array('<','>'), array('\u003c','\u003e'),
569 $json->encodeUnsafe(array('success'=> true, 'data' => $str)));
570 echo "</BODY></HTML>";
575 echo $json->encode(array('success'=> true, 'data' => $str));
581 * output data for grids or tree
582 * @ar {Array} ar Array of data
583 * @total {Number|false} total number of records (or false to return count(ar)
584 * @extra {Array} extra key value list of data to pass as extra data.
587 function jdata($ar,$total=false, $extra=array(), $cachekey = false)
589 // should do mobile checking???
590 if ($total == false) {
593 $extra= $extra ? $extra : array();
594 require_once 'Services/JSON.php';
595 $json = new Services_JSON();
597 $retHTML = isset($_SERVER['CONTENT_TYPE']) &&
598 preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']);
601 if (isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] == 'NO') {
605 $retHTML = isset($_REQUEST['returnHTML']) && $_REQUEST['returnHTML'] !='NO';
612 header('Content-type: text/html');
613 echo "<HTML><HEAD></HEAD><BODY>";
614 // encode html characters so they can be read..
615 echo str_replace(array('<','>'), array('\u003c','\u003e'),
616 $json->encodeUnsafe(array('success' => true, 'total'=> $total, 'data' => $ar) + $extra));
617 echo "</BODY></HTML>";
622 // see if trimming will help...
623 if (!empty($_REQUEST['_pman_short'])) {
626 foreach($ar as $as) {
628 foreach($as as $k=>$v) {
629 if (is_string($v) && !strlen(trim($v))) {
641 $ret = $json->encode(array('success' => true, 'total'=> $total, 'data' => $ar) + $extra);
643 if (!empty($cachekey)) {
645 $fn = ini_get('session.save_path') . '/json-cache'.date('/Y/m/d').'.'. $cachekey . '.cache.json';
646 if (!file_exists(dirname($fn))) {
647 mkdir(dirname($fn), 0777,true);
649 file_put_contents($fn, $ret);
657 /** a daily cache **/
658 function jdataCache($cachekey)
660 $fn = ini_get('session.save_path') . '/json-cache'.date('/Y/m/d').'.'. $cachekey . '.cache.json';
661 if (file_exists($fn)) {
662 header('Content-type: application/json');
663 echo file_get_contents($fn);
673 * ---------------- OUTPUT
675 function hasBg($fn) // used on front page to check if logos exist..
677 return file_exists($this->rootDir.'/Pman/'.$this->appNameShort.'/templates/images/'. $fn);
680 * outputJavascriptIncludes:
682 * output <script....> for all the modules in the applcaiton
685 function outputJavascriptIncludes()
688 $mods = $this->modulesList();
690 foreach($mods as $mod) {
691 // add the css file..
693 $this->outputJavascriptDir("Pman/$mod/widgets", "*.js");
694 $this->outputJavascriptDir("Pman/$mod", "*.js");
698 if (empty($this->disable_jstemplate)) {
699 // and finally the JsTemplate...
700 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
708 * output <link rel=stylesheet......> for all the modules in the applcaiton
711 * This could css minify as well.
713 function outputCSSIncludes() // includes on CSS links.
716 $mods = $this->modulesList();
719 foreach($mods as $mod) {
720 // add the css file..
721 $this->outputCSSDir("Pman/$mod","*.css");
744 // --- OLD CODE - in for BC on MO project.... - needs removing...
746 // used on old versions.....
747 function outputJavascriptIncludesBC()
750 $mods = $this->modulesList();
752 foreach($mods as $mod) {
753 // add the css file..
756 $files = $this->moduleJavascriptList($mod.'/widgets');
757 foreach($files as $f) {
758 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
761 $files = $this->moduleJavascriptList($mod);
762 foreach($files as $f) {
763 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
767 if (empty($this->disable_jstemplate)) {
768 // and finally the JsTemplate...
769 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
774 * Gather infor for javascript files..
776 * @param {String} $mod the module to get info about.
777 * @return {StdClass} details about module.
779 function moduleJavascriptFilesInfo($mod)
782 static $cache = array();
784 if (isset($cache[$mod])) {
789 $ff = HTML_FlexyFramework::get();
791 $base = dirname($_SERVER['SCRIPT_FILENAME']);
792 $dir = $this->rootDir.'/Pman/'. $mod;
793 $path = $this->rootURL ."/Pman/$mod/";
795 $ar = glob($dir . '/*.js');
801 foreach($ar as $fn) {
803 // got the 'module file..'
804 $mtime = filemtime($dir . '/'. $f);
805 $maxtime = max($mtime, $maxtime);
806 $arfiles[$fn] = $mtime;
807 $files[] = $path . $f . '?ts='.$mtime;
810 ksort($arfiles); // just sort by name so it's consistant for serialize..
812 $compile = empty($ff->Pman['public_cache_dir']) ? 0 : 1;
813 $basedir = $compile ? $ff->Pman['public_cache_dir'] : false;
814 $baseurl = $compile ? $ff->Pman['public_cache_url'] : false;
816 $lsort = create_function('$a,$b','return strlen($a) > strlen($b) ? 1 : -1;');
817 usort($files, $lsort);
819 $smod = str_replace('/','.',$mod);
821 $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize($arfiles)) .'.js';
824 // why are translations done like this - we just build them on the fly frmo the database..
825 $tmtime = file_exists($this->rootDir.'/_translations_/'. $smod.'.js')
826 ? filemtime($this->rootDir.'/_translations_/'. $smod.'.js') : 0;
828 $cache[$mod] = (object) array(
829 'smod' => $smod, // module name without '/'
830 'files' => $files, // list of all files.
831 'filesmtime' => $arfiles, // map of mtime=>file
832 'maxtime' => $maxtime, // max mtime
833 'compile' => $this->isDev ? false : $compile,
834 'translation_file' => $base .'/_translations_/' . $smod . '.js',
835 'translation_mtime' => $tmtime,
837 'translation_data' => preg_replace('/\.js$/', '.__translation__.js', $output),
838 'translation_base' => $dir .'/', //prefix of filename (without moudle name))
839 'basedir' => $basedir,
840 'baseurl' => $baseurl,
841 'module_dir' => $dir,
848 * moduleJavascriptList: list the javascript files in a module
850 * The original version of this.. still needs more thought...
852 * Compiled is in Pman/_compiled_/{$mod}/{LATEST...}.js
853 * Translations are in Pman/_translations_/{$mod}.js
855 * if that stuff does not exist just list files in Pman/{$mod}/*.js
857 * Compiled could be done on the fly..
861 * @param {String} $mod the module to look at - eg. Pman/{$mod}/*.js
862 * @return {Array} list of include paths (either compiled or raw)
868 function moduleJavascriptList($mod)
872 $dir = $this->rootDir.'/Pman/'. $mod;
875 if (!file_exists($dir)) {
876 echo '<!-- missing directory '. htmlspecialchars($dir) .' -->';
880 $info = $this->moduleJavascriptFilesInfo($mod);
884 if (empty($info->files)) {
887 // finally sort the files, so they are in the right order..
889 // only compile this stuff if public_cache is set..
893 // public_cache_dir = /var/www/myproject_cache
894 // public_cache_url = /myproject_cache (with Alias apache /myproject_cache/ /var/www/myproject_cache/)
897 if (!$info->compile) {
898 echo "<!-- Javascript compile turned off (isDev on, or public_cache_dir not set) -->\n";
902 // where are we going to write all of this..
903 // This has to be done via a
904 if (!file_exists($info->basedir.'/'.$info->output) || !filesize($info->basedir.'/'.$info->output)) {
905 require_once 'Pman/Core/JsCompile.php';
906 $x = new Pman_Core_JsCompile();
908 $x->pack($info->filesmtime,$info->basedir.'/'.$info->output, $info->translation_base);
910 echo "<!-- file exists not exist: {$info->basedir}/{$info->output} -->\n";
913 if (file_exists($info->basedir.'/'.$info->output) &&
914 filesize($info->basedir.'/'.$info->output)) {
917 $info->baseurl.'/'. $info->output,
920 // output all the ava
921 // fixme - this needs the max datetime for the translation file..
922 $ret[] = $this->baseURL."/Admin/InterfaceTranslations/".$mod.".js"; //?ts=".$info->translation_mtime;
924 //if ($info->translation_mtime) {
925 // $ret[] = $this->rootURL."/_translations_/". $info->smod.".js?ts=".$info->translation_mtime;
932 // give up and output original files...
942 * PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
945 static $permitError = false;
947 function onPearError($err)
949 static $reported = false;
954 if (Pman::$permitError) {
962 $out = $err->toString();
965 //print_R($bt); exit;
968 foreach($err->backtrace as $b) {
969 $ret[] = @$b['file'] . '(' . @$b['line'] . ')@' . @$b['class'] . '::' . @$b['function'];
975 //convert the huge backtrace into something that is readable..
976 $out .= "\n" . implode("\n", $ret);
988 * ---------------- Logging ---------------
993 * Log an action (only if it has not been logged already.
995 * @param {String} action - group/name of event
996 * @param {DataObject|false} obj - dataobject action occured on.
997 * @param {String} any remarks
998 * @return {false|DB_DataObject} Event object.,
1001 function addEventOnce($act, $obj = false, $remarks = '')
1003 if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) {
1006 $e = DB_DataObject::factory('Events');
1007 $e->init($act,$obj,$remarks);
1008 if ($e->find(true)) {
1011 return $this->addEvent($act, $obj, $remarks);
1017 * @param {String} action - group/name of event
1018 * @param {DataObject|false} obj - dataobject action occured on.
1019 * @param {String} any remarks
1020 * @return {DB_DataObject} Event object.,
1023 function addEvent($act, $obj = false, $remarks = '')
1026 if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) {
1029 $au = $this->getAuthUser();
1031 $e = DB_DataObject::factory('Events');
1032 $e->init($act,$obj,$remarks);
1034 $e->event_when = date('Y-m-d H:i:s');
1036 $eid = $e->insert();
1038 // fixme - this should be in onInsert..
1039 $wa = DB_DataObject::factory('core_watch');
1040 if (method_exists($wa,'notifyEvent')) {
1041 $wa->notifyEvent($e); // trigger any actions..
1045 $e->onInsert(isset($_REQUEST) ? $_REQUEST : array() , $this);
1051 // ------------------ DEPERCIATED ----------------------------
1053 // DEPRECITAED - use moduleslist
1054 function modules() { return $this->modulesList(); }
1056 // DEPRECIATED.. - use getAuthUser...
1057 function staticGetAuthUser() { $x = new Pman(); return $x->getAuthUser(); }
1060 // DEPRICATED USE Pman_Core_Mailer
1062 function emailTemplate($templateFile, $args)
1065 require_once 'Pman/Core/Mailer.php';
1066 $r = new Pman_Core_Mailer(array(
1067 'template'=>$templateFile,
1068 'contents' => $args,
1071 return $r->toData();
1074 // DEPRICATED - USE Pman_Core_Mailer
1075 // WHAT Part about DEPRICATED Does no one understand??
1076 function sendTemplate($templateFile, $args)
1078 require_once 'Pman/Core/Mailer.php';
1079 $r = new Pman_Core_Mailer(array(
1080 'template'=>$templateFile,
1081 'contents' => array(),