Example #1
0
 public function sendmail($to_name, $to_email, $from_name = '', $from_email = '', $subject, $body, $altbody = '')
 {
     if ($from_name == '') {
         $from_name = APPLICATION_NAME;
     }
     if ($from_email == '') {
         $from_email = APPLICATION_EMAIL;
     }
     if (!$subject) {
         display_system("The subject has not been set");
     } else {
         if (!$body) {
             display_system("The body has not been set");
         } else {
             $this->mailer->From = $from_email;
             $this->mailer->FromName = $from_name;
             $this->mailer->AddAddress($to_email, $to_name);
             $this->mailer->AddBCC($from_email, $from_name);
             $this->mailer->IsHTML(true);
             if ($body == '') {
                 $this->mailer->IsHTML(false);
             }
             $this->mailer->Subject = $subject;
             $this->mailer->Body = $body;
             $this->mailer->AltBody = $altbody;
             if (!$this->mailer->Send()) {
                 display_error("The email from " . $from_name . " (" . $from_email . ") to " . $to_name . " (" . $to_email . ") could not be sent. The mailer replied with the following error :: " . $this->mailer->ErrorInfo . ".<br />The contents of the email were as follows :<br /><b>" . $subject . "</b><br />" . $body . "");
                 return false;
             }
             // Need to do this, otherwise recipients will keep adding up
             $this->mailer->ClearAllRecipients();
             return true;
         }
     }
 }
Example #2
0
 public function setUserCookie($path)
 {
     if (!file_exists(path($path))) {
         $file = new File();
         if (perms('/app/cache/') != '777') {
             display_system('The path to the file ' . path($path) . ' is not writable.<br />Please enter chmod -R 777 ' . path('/app/cache/') . ' on your terminal to fix this.');
         } else {
             $file->write($path, ' ');
             chmod(path($path), 0755);
         }
     }
     $this->user_cookie = path($path);
 }
Example #3
0
function checkMinimumPHPVersion()
{
    $status = false;
    if (function_exists('version_compare') && version_compare(phpversion(), MIN_PHP_VERSION, '>=')) {
    } else {
        // Show an error
        display_system("The <strong>version of PHP</strong> (" . phpversion() . ") is not greater than the minimum version supported [" . MIN_PHP_VERSION . "]");
    }
}
Example #4
0
 private function addJavascript($file)
 {
     if (file_exists(path($file))) {
         return '<script type="text/javascript" src="' . href($file) . '"></script>';
     } else {
         display_system('The file <strong>' . path($file) . '</strong> does not exist');
     }
 }
Example #5
0
 private function getResults($sql, $query_type)
 {
     // Get the results in an array
     $start_time = 0;
     $end_time = 0;
     $cached_query = false;
     // If debugger is on, start the clock for the query
     if ($this->debug) {
         $start_time = microtime(true);
     }
     $results;
     $results = $this->createArray($query_type, mysql_query($sql));
     // If debugging is one, display the time required in the query string
     if ($this->debug) {
         $end_time = microtime(true);
         if ($cached_query) {
             display_system("[" . round(1000 * ($end_time - $start_time), 2) . " ms][cached] {$sql}");
         } else {
             display_system("[" . round(1000 * ($end_time - $start_time), 2) . " ms] {$sql}");
         }
     }
     return $results;
 }
Example #6
0
function location($path)
{
    $file_name = '';
    $line_number = '';
    if (!headers_sent($file_name, $line_number)) {
        header("Location: " . href($path));
        exit;
    } else {
        display_system('Cannot redirect the page to <strong>' . href($path) . '</strong> because headers have already been sent. The headers were started by <strong>' . $file_name . ' [ Line Number : ' . $line_number . ']</strong>');
    }
}