public static function start($auto_create = true)
 {
     $modeler = static::$modeler;
     $ip_address = explode(',', !empty($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"])[0];
     if ($modeler::exists(self::getCookieValue()) && $modeler::model()->ip_address == $ip_address) {
         self::load();
     } elseif ($auto_create == true && $_SERVER['HTTP_HOST'] == Configuration::model()->sessions->create_domain) {
         self::create($ip_address);
         self::setCookie();
     }
 }
 public static function model()
 {
     static $model;
     if (!is_object($model)) {
         $model = (object) null;
         if (isset(Configuration::model()->database)) {
             foreach (Configuration::model()->database as $member => $database) {
                 $model->{$member . '_database'} = new MySQL($database->host, $database->user, $database->password, $database->name);
             }
         }
     }
     return $model;
 }
 public static function render($template, $hooks)
 {
     $default_hooks = array("#WEBSITENAME#", "#WEBSITEURL#", "#DATE#");
     $default_replace = array(Configuration::model()->site->display_name, Configuration::model()->site->domain, date("l \\t\\h jS"));
     $message = file_get_contents('/opts/includes/mail-templates/' . $template);
     $message = str_replace($default_hooks, $default_replace, $message);
     $message = str_replace($hooks["searchStrs"], $hooks["subjectStrs"], $message);
     if (strpos($message, "#INC-FOOTER#") !== FALSE) {
         $footer = file_get_contents('/opts/includes/mail-templates/email-footer.txt');
         if ($footer && !empty($footer)) {
             $message .= str_replace($default_hooks, $default_replace, $footer);
         }
         $message = str_replace("#INC-FOOTER#", "", $message);
     }
     return $message;
 }
Esempio n. 4
0
 public static function systemSend($to, $subject, $body, $attachments = array())
 {
     self::send($to, Configuration::model()->email->system->reply_email, Configuration::model()->email->system->reply_name, Configuration::model()->email->system->from_email, Configuration::model()->email->system->from_name, $subject, $body);
 }
 public static function setCookie($name = '', $value = '', $expire = 0)
 {
     setcookie($name, $value, $expire, Configuration::model()->sessions->path, Configuration::model()->sessions->domain);
 }
 public static function getCookieValue()
 {
     return !empty($_COOKIE[Configuration::model()->sessions->cookie]) ? $_COOKIE[Configuration::model()->sessions->cookie] : false;
 }
Esempio n. 7
0
 public static function isCookieValid()
 {
     return isset($_COOKIE[Configuration::model()->sessions->cookie]) ? true : false;
 }