Example #1
0
 /**
  * Sends the email with the contents of the object (Body etc. set using the parant calls in phpMailer!)
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return boolean 
  */
 public function SendEmail()
 {
     $this->Mailer = ctrl_options::GetSystemOption('mailer_type');
     $this->From = ctrl_options::GetSystemOption('email_from_address');
     $this->FromName = ctrl_options::GetSystemOption('email_from_name');
     if (ctrl_options::GetSystemOption('email_smtp') != 'false') {
         $this->IsSMTP();
         if (ctrl_options::GetSystemOption('smtp_auth') != 'false') {
             $this->SMTPAuth = true;
             $this->Username = ctrl_options::GetSystemOption('smtp_username');
             $this->Password = ctrl_options::GetSystemOption('smtp_password');
         }
         if (ctrl_options::GetSystemOption('smtp_secure') != 'false') {
             $this->SMTPSecure = ctrl_options::GetSystemOption('smtp_secure');
         }
         $this->Host = ctrl_options::GetSystemOption('smtp_server');
         $this->Port = ctrl_options::GetSystemOption('smtp_port');
     }
     ob_start();
     $send_resault = $this->Send();
     $error = ob_get_contents();
     ob_clean();
     if ($send_resault) {
         runtime_hook::Execute('OnSuccessfulSendEmail');
         return true;
     } else {
         $logger = new debug_logger();
         $logger->method = ctrl_options::GetSystemOption('logmode');
         $logger->logcode = "061";
         $logger->detail = 'Error sending email (using sys_email): ' . $error . '';
         $logger->writeLog();
         runtime_hook::Execute('OnFailedSendEmail');
         return false;
     }
 }
 /**
  * Provides very basic way of retrieving a result as a string from a given URL (RAW) this does not need to be a 'true' web service.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $requestURL The URL to the resource.
  * @return mixed If the request was successful it will return the contents of the requested URL otherwise will return 'false'.
  */
 static function ReadURLRequestResult($requestURL)
 {
     ob_start();
     @readfile($requestURL);
     $reqcontent = ob_get_contents();
     ob_clean();
     if ($reqcontent) {
         return $reqcontent;
     }
     $ws_log = new debug_logger();
     $ws_log->logcode = "903";
     $ws_log->detail = "Unable to connect to webservice URL (" . $requestURL . ") as requested in ws_generic::ReadURLRequestResult()";
     $ws_log->writeLog();
     return false;
 }
 /**
  * Executes a hook file at the called position.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $name The name of the hook of which to execute.
  */
 static function Execute($name)
 {
     $hook_log = new debug_logger();
     $mod_folder = "modules/*/hooks/{" . $name . ".hook.php}";
     $hook_log->method = ctrl_options::GetSystemOption('logmode');
     $hook_log->logcode = "861";
     foreach (glob($mod_folder, GLOB_BRACE) as $hook_file) {
         if (file_exists($hook_file)) {
             $hook_log->detail = "Execute hook file (" . $hook_file . ")";
             try {
                 include $hook_file;
             } catch (Exception $e) {
                 $hook_log->detail .= ' -> Exception(' . $e->getMessage() . ') :(';
             }
             $hook_log->writeLog();
         }
     }
 }
Example #4
0
$rawPath = str_replace("\\", "/", dirname(__FILE__));
$rootPath = str_replace("/bin", "/", $rawPath);
chdir($rootPath);
require_once 'dryden/loader.inc.php';
require_once 'cnf/db.php';
require_once 'inc/dbc.inc.php';
$daemonLog = new debug_logger();
$daemonLog->method = "file";
$daemonLog->logcode = "001";
$dateformat = ctrl_options::GetSystemOption('MADmin_df');
if (!runtime_controller::IsCLI()) {
    echo "<pre>";
}
echo "Daemon is now running... (" . date($dateformat) . ")\n";
$daemonLog->detail = "Daemon execution started...";
$daemonLog->writeLog();
runtime_hook::Execute("OnStartDaemonRun");
runtime_hook::Execute("OnDaemonRun");
runtime_hook::Execute("OnEndDaemonRun");
if (time() >= ctrl_options::GetSystemOption('daemon_hourrun') + 3600) {
    ctrl_options::SetSystemOption('daemon_hourrun', time());
    runtime_hook::Execute("OnStartDaemonHour");
    runtime_hook::Execute("OnDaemonHour");
    runtime_hook::Execute("OnEndDaemonHour");
}
if (time() >= ctrl_options::GetSystemOption('daemon_dayrun') + 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_dayrun', time());
    runtime_hook::Execute("OnStartDaemonDay");
    runtime_hook::Execute("OnDaemonDay");
    runtime_hook::Execute("OnEndDaemonDay");
}
 /**
  * Used in hooks to communicate with the modules controller.ext.php
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $module_path The full path to the module.
  */
 static function ModuleControllerCode($module_path)
 {
     $raw_path = str_replace("\\", "/", $module_path);
     $module_path = str_replace("/hooks", "/code/", $raw_path);
     $rawroot_path = str_replace("\\", "/", dirname(__FILE__));
     $root_path = str_replace("/dryden/runtime", "/", $rawroot_path);
     require_once $root_path . 'dryden/loader.inc.php';
     require_once $root_path . 'cnf/db.php';
     require_once $root_path . 'inc/dbc.inc.php';
     if (file_exists($module_path . 'controller.ext.php')) {
         require_once $module_path . 'controller.ext.php';
     } else {
         $hook_log = new debug_logger();
         $hook_log->method = ctrl_options::GetSystemOption('logmode');
         $hook_log->logcode = "611";
         $hook_log->detail = "No hook controller.ext.php avaliable to import in (" . $root_path . 'controller.ext.php' . ")";
         $hook_log->writeLog();
     }
 }