Пример #1
0
 static function emailAdmin($message = '', $subject = '', $from = '', $rcpt = '')
 {
     $message = DevValue::isNotNull($message) ? $message : "If you have recieved this email, then the admnistrative alert system on your website has been activated with no status message. Please check your log files.\n";
     $subject = DevValue::isNotNull($subject) ? $subject : "Automated Email Alert From Your Site!";
     $from = DevValue::isNotNull($from) ? $from : "admin@" . HTTP::domain();
     $rcpt = DevValue::isNotNull($rcpt) ? $rcpt : "admin@" . HTTP::domain();
     $email = Email($rcpt, $from, $subject, $message);
     $status = $email->send();
     return $status;
 }
Пример #2
0
 public function write()
 {
     $value = HTTP::jsonEncode($this->_data ? $this->_data : $this->_contents);
     $label = $this->_source;
     $path = $this->config('location');
     $expire = (int) $this->config('expire');
     $cookiesecure = $this->config('secure');
     $path = $path ? $path : HTTP::domain();
     $cookiedie = DevNumber::isValid($expire) ? time() + (int) $expire : (int) $expire;
     //expire in one hour
     $cookiesecure = (bool) $secure;
     $status = HTTP::cookie($label, $value, $cookiedie, $path = null, $cookiesecure) ? self::STATUS_SUCCESS : self::STATUS_FAILED;
     $this->status($status);
 }
Пример #3
0
 public function open()
 {
     $target = $this->config('target') ? $this->config('target') : HTTP::domain();
     $method = $this->config('method');
     $header = $this->config('header');
     $wrapper = $this->config('wrapper');
     if (HTTP::urlExists($target)) {
         $options = array($wrapper => array('header' => $header, 'method' => $method));
         $this->_connection = stream_context_create($options);
         $status = $this->_connection ? self::STATUS_CONNECTED : self::STATUS_NOTCONNECTED;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }
Пример #4
0
 public function open()
 {
     if (HTTP::urlExists($this->config('target'))) {
         $target = parse_url($this->config('target'));
         $status = '';
         $this->_host = $target['host'] ? $target['host'] : HTTP::domain();
         $this->_url = $target['path'];
         $port = $target['port'] ? $target['port'] : $this->config('port');
         $this->_connection = fsockopen($host, $port, $error_number, $error_string, 30);
         $status($this->_connection) ? self::STATUS_CONNECTED : $error_string . ': ' . $error_number;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }
Пример #5
0
 public function open()
 {
     $status = '';
     $target = $this->config('target') ? $this->config('target') : HTTP::domain();
     $refresh = (bool) $this->config('refresh');
     if (!$this->config('validate_host') || HTTP::urlExists($target)) {
         $data = $this->_data;
         //open connection
         $this->_connection = curl_init();
         curl_setopt($this->_connection, CURLOPT_URL, $target);
         curl_setopt($this->_connection, CURLOPT_COOKIESESSION, $refresh);
         if ($this->config('username') && $this->config('password')) {
             curl_setopt($this->_connection, CURLOPT_USERPWD, $this->config('username') . ':' . $this->config('password'));
         }
         $status = $this->_connection ? self::STATUS_CONNECTED : self::STATUS_NOTCONNECTED;
     } else {
         $status = self::STATUS_NOTCONNECTED;
     }
     $this->status($status);
 }
Пример #6
0
 static function session($var, $value = null, $expire = null, $path = null, $secure = false)
 {
     if (DevValue::isNull($value)) {
         return isset($_SESSION[$var]) ? $_SESSION[$var] : null;
     }
     if (session_id() == '') {
         $domain = $path ? substr($path, 0, strpos($path, '/')) : HTTP::domain();
         $dir = $path ? substr($path, strpos($path, '/'), strlen($path)) : '/';
         $cookiedie = DevNumber::isValid($expire) ? time() + (int) $expire : (int) $expire;
         //expire in one hour
         $cookiesecure = (bool) $secure;
         session_set_cookie_params($cookiedie, $dir, $domain, $cookiesecure);
         session_start();
     }
     $status = ($_SESSION[$var] = $value) ? true : false;
     return $status;
 }