function get_class_constructor($classname)
{
    // Caching
    static $constructors = array();
    if (!class_exists($classname)) {
        return false;
    }
    // Tests indicate this doesn't hurt even in PHP5.
    $classname = strtolower($classname);
    // Return cached value, if exists
    if (isset($constructors[$classname])) {
        return $constructors[$classname];
    }
    // Get a list of methods. After examining several different ways of
    // doing the check, (is_callable, method_exists, function_exists etc)
    // it seems that this is the most reliable one.
    $methods = get_class_methods($classname);
    // PHP5 constructor?
    if (phpversion() >= '5') {
        if (in_array('__construct', $methods)) {
            return $constructors[$classname] = '__construct';
        }
    }
    // If we have PHP5 but no magic constructor, we have to lowercase the methods
    $methods = array_map('strtolower', $methods);
    if (in_array($classname, $methods)) {
        return $constructors[$classname] = $classname;
    }
    return $constructors[$classname] = NULL;
}
Example #2
0
 protected function getEnvironment()
 {
     if (version_compare(phpversion(), '5.3.0', '>=')) {
         return include 'PHP53/TestInclude.php';
     }
     return parent::getEnvironment();
 }
Example #3
0
 /**
  * Generates the fingerprint for request.
  *
  * @param string $merchantApiLoginId
  * @param string $merchantTransactionKey
  * @param string $amount
  * @param string $fpSequence An invoice number or random number.
  * @param string $fpTimestamp
  * @return string The fingerprint.
  */
 public function generateRequestSign($merchantApiLoginId, $merchantTransactionKey, $amount, $currencyCode, $fpSequence, $fpTimestamp)
 {
     if (phpversion() >= '5.1.2') {
         return hash_hmac("md5", $merchantApiLoginId . "^" . $fpSequence . "^" . $fpTimestamp . "^" . $amount . "^" . $currencyCode, $merchantTransactionKey);
     }
     return bin2hex(mhash(MHASH_MD5, $merchantApiLoginId . "^" . $fpSequence . "^" . $fpTimestamp . "^" . $amount . "^" . $currencyCode, $merchantTransactionKey));
 }
Example #4
0
 public function __construct($config, $transFunc, $transFuncArgs = array())
 {
     $this->config = array('x2_version' => '', 'php_version' => phpversion(), 'GD_support' => function_exists('gd_info') ? 1 : 0, 'db_type' => 'MySQL', 'db_version' => '', 'unique_id' => 'none', 'formId' => '', 'submitButtonId' => '', 'statusId' => '', 'themeUrl' => '', 'titleWrap' => array('<h2>', '</h2>'), 'receiveUpdates' => 1, 'serverInfo' => False, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'registered' => 0, 'edition' => 'opensource', 'isUpgrade' => False);
     foreach ($config as $key => $value) {
         $this->config[$key] = $value;
     }
     // Is it OS edition?
     $this->os = $config['edition'] == 'opensource' && !$this->config['isUpgrade'];
     // Empty the unique_id field; user will fill it.
     if (!$this->os) {
         if ($this->config['unique_id'] == 'none') {
             $this->config['unique_id'] = '';
         }
     }
     // $this->config['unique_id'] = 'something'; // To test what the form looks like when unique_id is filled
     // Translate all messages for the updates form:
     foreach (array('label', 'message', 'leadSources') as $attr) {
         $attrArr = $this->{$attr};
         foreach (array_keys($this->{$attr}) as $key) {
             $attrArr[$key] = call_user_func_array($transFunc, array_merge($transFuncArgs, array($attrArr[$key])));
         }
         $this->{$attr} = $attrArr;
     }
     $this->message['connectionNOsMessage'] .= ': <a href="http://www.x2crm.com/contact/">x2crm.com</a>.';
 }
Example #5
0
 public function check()
 {
     if (phpversion() < '5.0.0') {
         return Response::json(FAIL, array('您的php版本过低,不能安装本软件,请升级到5.0.0或更高版本再安装,谢谢!'));
     }
     if (!extension_loaded('PDO')) {
         return Response::json(FAIL, array('请加载PHP的PDO模块,谢谢!'));
     }
     if (!function_exists('session_start')) {
         return Response::json(FAIL, array('请开启session,谢谢!'));
     }
     if (!is_writable(ROOT_PATH)) {
         return Response::json(FAIL, array('请保证代码目录有写权限,谢谢!'));
     }
     $config = (require CONFIG_PATH . 'mysql.php');
     try {
         $mysql = new PDO('mysql:host=' . $config['master']['host'] . ';port=' . $config['master']['port'], $config['master']['user'], $config['master']['pwd']);
     } catch (Exception $e) {
         return Response::json(FAIL, array('请正确输入信息连接mysql,保证启动mysql,谢谢!'));
     }
     $mysql->exec('CREATE DATABASE ' . $config['master']['dbname']);
     $mysql = null;
     unset($config);
     return Response::json(SUCC, array('检测通过'));
 }
Example #6
0
function getparam($name)
{
    $param = '';
    $curver = (int) str_replace('.', '', phpversion());
    if ($curver >= 410) {
        // superglobals available from ver. 4.1.0
        if (@$_POST["{$name}"]) {
            // POST before GET
            $param = $_POST["{$name}"];
        } elseif (@$_GET["{$name}"]) {
            $param = $_GET["{$name}"];
        }
    } else {
        // superglobals aren't available
        global $HTTP_POST_VARS, $HTTP_GET_VARS;
        if (@$HTTP_POST_VARS["{$name}"]) {
            $param = $HTTP_POST_VARS["{$name}"];
        } elseif (@$HTTP_GET_VARS["{$name}"]) {
            $param = $HTTP_GET_VARS["{$name}"];
        }
    }
    if (is_array($param)) {
        foreach ($param as $element) {
            $element = addslashes($element);
        }
    } else {
        $param = addslashes($param);
    }
    return $param;
}
Example #7
0
 /**
  * Construct the Google Client.
  *
  * @param $config Google_Config or string for the ini file to load
  */
 public function __construct($config = null)
 {
     if (is_string($config) && strlen($config)) {
         $config = new Google_Config($config);
     } else {
         if (!$config instanceof Google_Config) {
             $config = new Google_Config();
             if ($this->isAppEngine()) {
                 // Automatically use Memcache if we're in AppEngine.
                 $config->setCacheClass('Google_Cache_Memcache');
             }
             if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
                 // Automatically disable compress.zlib, as currently unsupported.
                 $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
             }
         }
     }
     if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
         if (function_exists('curl_version') && function_exists('curl_exec') && !$this->isAppEngine()) {
             $config->setIoClass("Google_IO_Curl");
         } else {
             $config->setIoClass("Google_IO_Stream");
         }
     }
     $this->config = $config;
 }
 /**
  *  Create new Openstack Object
  */
 function __construct($custom_settings = null, $oc_version = null)
 {
     // Set opencloud version to use
     $this->opencloud_version = version_compare(phpversion(), '5.3.3') >= 0 ? '1.10.0' : '1.5.10';
     $this->opencloud_version = !is_null($oc_version) ? $oc_version : $this->opencloud_version;
     // Get settings, if they exist
     (object) ($custom_settings = !is_null($custom_settings) ? $custom_settings : get_option(RS_CDN_OPTIONS));
     // Set settings
     $settings = new stdClass();
     $settings->username = isset($custom_settings->username) ? $custom_settings->username : '******';
     $settings->apiKey = isset($custom_settings->apiKey) ? $custom_settings->apiKey : 'API Key';
     $settings->use_ssl = isset($custom_settings->use_ssl) ? $custom_settings->use_ssl : false;
     $settings->container = isset($custom_settings->container) ? $custom_settings->container : 'default';
     $settings->cdn_url = null;
     $settings->files_to_ignore = null;
     $settings->remove_local_files = isset($custom_settings->remove_local_files) ? $custom_settings->remove_local_files : false;
     $settings->verified = false;
     $settings->custom_cname = null;
     $settings->region = isset($custom_settings->region) ? $custom_settings->region : 'ORD';
     $settings->url = isset($custom_settings->url) ? $custom_settings->url : 'https://identity.api.rackspacecloud.com/v2.0/';
     // Set API settings
     $this->api_settings = (object) $settings;
     // Return client OR set settings
     if ($this->opencloud_version == '1.10.0') {
         // Set Rackspace CDN settings
         $this->oc_client = $this->opencloud_client();
         $this->oc_service = $this->oc_client->objectStoreService('cloudFiles', $settings->region);
     }
     // Set container object
     $this->oc_container = $this->container_object();
 }
Example #9
0
 /**
  * Automatically generate a variety of files
  *
  */
 function main()
 {
     if (!empty($this->digestPath) && file_exists($this->digestPath) && $this->hasExpectedFiles()) {
         if ($this->getDigest() === file_get_contents($this->digestPath)) {
             echo "GenCode has previously executed. To force execution, please (a) omit CIVICRM_GENCODE_DIGEST\n";
             echo "or (b) remove {$this->digestPath} or (c) call GenCode with new parameters.\n";
             exit;
         }
         // Once we start GenCode, the old build is invalid
         unlink($this->digestPath);
     }
     echo "\ncivicrm_domain.version := " . $this->db_version . "\n\n";
     if ($this->buildVersion < 1.1) {
         echo "The Database is not compatible for this version";
         exit;
     }
     if (substr(phpversion(), 0, 1) != 5) {
         echo phpversion() . ', ' . substr(phpversion(), 0, 1) . "\n";
         echo "\nCiviCRM requires a PHP Version >= 5\nPlease upgrade your php / webserver configuration\nAlternatively you can get a version of CiviCRM that matches your PHP version\n";
         exit;
     }
     $specification = new CRM_Core_CodeGen_Specification();
     $specification->parse($this->schemaPath, $this->buildVersion);
     # cheese:
     $this->database = $specification->database;
     $this->tables = $specification->tables;
     $this->runAllTasks();
     if (!empty($this->digestPath)) {
         file_put_contents($this->digestPath, $this->getDigest());
     }
 }
Example #10
0
 /**
  * @brief 服务器的php版本比对
  * @param string 要比对的php版本号 例如:5.1.0
  * @return bool 值: true:达到版本标准; false:未达到版本标准;
  */
 public static function isGeVersion($version)
 {
     //获取当前php版本号
     $locVersion = phpversion();
     $result = version_compare($locVersion, $version);
     return $result >= 0 ? true : false;
 }
Example #11
0
 /**
  * A human readable textual representation of the problem's reasons
  *
  * @param array $installedMap A map of all installed packages
  */
 public function getPrettyString(array $installedMap = array())
 {
     $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
     if (count($reasons) === 1) {
         reset($reasons);
         $reason = current($reasons);
         $rule = $reason['rule'];
         $job = $reason['job'];
         if ($job && $job['cmd'] === 'install' && empty($job['packages'])) {
             // handle php extensions
             if (0 === stripos($job['packageName'], 'ext-')) {
                 $ext = substr($job['packageName'], 4);
                 $error = extension_loaded($ext) ? 'has the wrong version (' . phpversion($ext) . ') installed' : 'is missing from your system';
                 return 'The requested PHP extension ' . $job['packageName'] . $this->constraintToText($job['constraint']) . ' ' . $error . '.';
             }
             return 'The requested package ' . $job['packageName'] . $this->constraintToText($job['constraint']) . ' could not be found.';
         }
     }
     $messages = array();
     foreach ($reasons as $reason) {
         $rule = $reason['rule'];
         $job = $reason['job'];
         if ($job) {
             $messages[] = $this->jobToText($job);
         } elseif ($rule) {
             if ($rule instanceof Rule) {
                 $messages[] = $rule->getPrettyString($installedMap);
             }
         }
     }
     return "\n    - " . implode("\n    - ", $messages);
 }
Example #12
0
function run_self_tests()
{
    global $MYSITE;
    global $LAST_UPDATED, $sqlite, $mirror_stats, $md5_ok;
    //$MYSITE = "http://sg.php.net/";
    $content = fetch_contents($MYSITE . "manual/noalias.txt");
    if (is_array($content) || trim($content) !== 'manual-noalias') {
        return array("name" => "Apache manual alias", "see" => $MYSITE . "mirroring-troubles.php#manual-redirect", "got" => $content);
    }
    $ctype = fetch_header($MYSITE . "manual/en/faq.html.php", "content-type");
    if (strpos($ctype, "text/html") === false) {
        return array("name" => "Header weirdness. Pages named '.html.php' are returning wrong status headers", "see" => $MYSITE . "mirroring-troubles.php#content-type", "got" => var_export($ctype, true));
    }
    $ctype = fetch_header($MYSITE . "functions", "content-type");
    if (is_array($ctype)) {
        $ctype = current($ctype);
    }
    if (strpos($ctype, "text/html") === false) {
        return array("name" => "MultiViews on", "see" => $MYSITE . "mirroring-troubles.php#multiviews", "got" => var_export($ctype, true));
    }
    $header = fetch_header($MYSITE . "manual/en/ref.var.php", 0);
    list($ver, $status, $msg) = explode(" ", $header, 3);
    if ($status != 200) {
        return array("name" => "Var Handler", "see" => $MYSITE . "mirroring-troubles.php#var", "got" => var_export($header, true));
    }
    return array("servername" => $MYSITE, "version" => phpversion(), "updated" => $LAST_UPDATED, "sqlite" => $sqlite, "stats" => $mirror_stats, "language" => default_language(), "rsync" => $md5_ok);
}
Example #13
0
 function set($properties, $desc = '')
 {
     if (!isset($properties)) {
         return;
     }
     if (is_array($properties)) {
         foreach ($properties as $k => $v) {
             $key = strtolower($k);
             if (floatval(phpversion()) > 5.3) {
                 if (property_exists($this, $key)) {
                     $this->{$key} = $v;
                 }
             } else {
                 if (array_key_exists($key, $this)) {
                     $this->{$key} = $v;
                 }
             }
         }
     } else {
         $this->value = $properties;
         if (!empty($desc)) {
             $this->desc = $desc;
         }
     }
 }
Example #14
0
 /**
  * Compropago Client Constructor
  * @param array $params
  * @throws Exception
  */
 public function __construct($params = array())
 {
     if (!array_key_exists('publickey', $params) || !array_key_exists('privatekey', $params) || empty($params['publickey']) || empty($params['privatekey'])) {
         $error = "Se requieren las llaves del API de Compropago";
         throw new Exception($error);
     } else {
         $this->auth = [$params['privatekey'], $params['publickey']];
         ///////////cambiar a formato curl?
         //Modo Activo o Pruebas
         if ($params['live'] == false) {
             $this->deployUri = self::API_SANDBOX_URI;
             $this->deployMode = true;
         } else {
             $this->deployUri = self::API_LIVE_URI;
             $this->deployMode = false;
         }
         if (isset($params['contained']) && !empty($params['contained'])) {
             $extra = $params['contained'];
         } else {
             $extra = 'SDK; PHP ' . phpversion() . ';';
         }
         $http = new Request($this->deployUri);
         $http->setUserAgent(self::USER_AGENT_SUFFIX, $this->getVersion(), $extra);
         $http->setAuth($this->auth);
         $this->http = $http;
     }
 }
Example #15
0
 /**
  * Checks PHP version and other parameters of the environment
  *
  * @return mixed
  */
 protected function ensureRequiredEnvironment()
 {
     if (version_compare(phpversion(), \Neos\Flow\Core\Bootstrap::MINIMUM_PHP_VERSION, '<')) {
         return new Error('Flow requires PHP version %s or higher but your installed version is currently %s.', 1172215790, [\Neos\Flow\Core\Bootstrap::MINIMUM_PHP_VERSION, phpversion()]);
     }
     if (!extension_loaded('mbstring')) {
         return new Error('Flow requires the PHP extension "mbstring" to be available', 1207148809);
     }
     if (DIRECTORY_SEPARATOR !== '/' && PHP_WINDOWS_VERSION_MAJOR < 6) {
         return new Error('Flow does not support Windows versions older than Windows Vista or Windows Server 2008, because they lack proper support for symbolic links.', 1312463704);
     }
     foreach ($this->requiredExtensions as $extension => $errorKey) {
         if (!extension_loaded($extension)) {
             return new Error('Flow requires the PHP extension "%s" to be available.', $errorKey, [$extension]);
         }
     }
     foreach ($this->requiredFunctions as $function => $errorKey) {
         if (!function_exists($function)) {
             return new Error('Flow requires the PHP function "%s" to be available.', $errorKey, [$function]);
         }
     }
     // TODO: Check for database drivers? PDO::getAvailableDrivers()
     $method = new \ReflectionMethod(__CLASS__, __FUNCTION__);
     $docComment = $method->getDocComment();
     if ($docComment === false || $docComment === '') {
         return new Error('Reflection of doc comments is not supported by your PHP setup. Please check if you have installed an accelerator which removes doc comments.', 1329405326);
     }
     set_time_limit(0);
     if (ini_get('session.auto_start')) {
         return new Error('Flow requires the PHP setting "session.auto_start" set to off.', 1224003190);
     }
     return null;
 }
Example #16
0
 /**
  * Constructor
  *
  * @param KObjectConfig $config  An optional ObjectConfig object with configuration options
  */
 public function __construct(KObjectConfig $config)
 {
     parent::__construct($config);
     //Session write and close handlers are called after destructing objects since PHP 5.0.5.
     if (version_compare(phpversion(), '5.4.0', '>=')) {
         session_register_shutdown();
     } else {
         register_shutdown_function('session_write_close');
     }
     //Only configure the session if it's not active yet
     if (!$this->isActive()) {
         //Set the session options
         $this->setOptions($config->options);
         //Set the session name
         if (!empty($config->name)) {
             $this->setName($config->name);
         }
         //Set the session identifier
         if (!empty($config->id)) {
             $this->setId($config->id);
         }
         //Set the session handler
         $this->setHandler($config->handler, KObjectConfig::unbox($config));
     }
     //Set the session namespace
     $this->setNamespace($config->namespace);
     //Set lifetime time
     $this->getContainer('metadata')->setLifetime($config->lifetime);
 }
Example #17
0
/**
 * This function calibrefx_update_check is to ...
 */
function calibrefx_update_check()
{
    global $wp_version;
    /** Get time of last update check */
    $calibrefx_update = get_transient('calibrefx-update');
    /** If it has expired, do an update check */
    if (!$calibrefx_update) {
        $url = 'http://api.calibrefx.com/themes-update/';
        $options = apply_filters('calibrefx_update_remote_post_options', array('body' => array('theme_name' => 'calibrefx', 'theme_version' => FRAMEWORK_VERSION, 'url' => home_url(), 'wp_version' => $wp_version, 'php_version' => phpversion(), 'user-agent' => "WordPress/{$wp_version};")));
        $response = wp_remote_post($url, $options);
        $calibrefx_update = wp_remote_retrieve_body($response);
        /** If an error occurred, return FALSE, store for 48 hour */
        if ('error' == $calibrefx_update || is_wp_error($calibrefx_update) || !is_serialized($calibrefx_update)) {
            set_transient('calibrefx-update', array('new_version' => FRAMEWORK_VERSION), 60 * 60 * 48);
            return false;
        }
        /** Else, unserialize */
        $calibrefx_update = maybe_unserialize($calibrefx_update);
        /** And store in transient for 48 hours */
        set_transient('calibrefx-update', $calibrefx_update, 60 * 60 * 48);
    }
    /** If we're already using the latest version, return false */
    if (version_compare(FRAMEWORK_VERSION, $calibrefx_update['new_version'], '>=')) {
        return false;
    }
    return $calibrefx_update;
}
Example #18
0
 /**
  * Setup a database connection (to a table)
  * @param string an optional table name, optional only in PHP <= 5.3.0
  */
 public function __construct($tableName = NULL)
 {
     // db connection
     $this->db = Fari_DbPdo::getConnection();
     // table name exists?
     if (isset($tableName)) {
         $this->tableName = $tableName;
     } else {
         if (isset($this->tableName)) {
             assert('!empty($this->tableName); // table name needs to be provided');
         } else {
             // are we using high enough version of PHP for late static binding?
             try {
                 if (version_compare(phpversion(), '5.3.0', '<=') == TRUE) {
                     throw new Fari_Exception('Table name can automatically only be resolved in PHP 5.3.0.');
                 }
             } catch (Fari_Exception $exception) {
                 $exception->fire();
             }
             // ... yes, get the name of the class as the name of the table
             $this->tableName = get_called_class();
         }
     }
     // attach observers
     $this->logger = new Fari_DbLogger();
     $this->logger->attach(new Fari_ApplicationLogger());
     // attach validator
     $this->validator = $this->attachValidator();
     // prep relationships
     $this->relationships = new Fari_DbTableRelationships();
 }
 /**
  * Method for parsing ini files
  *
  * @param		string	$filename Path and name of the ini file to parse
  *
  * @return	array		Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
  *
  * @since		2.5
  */
 public static function parseFile($filename)
 {
     jimport('joomla.filesystem.file');
     if (!JFile::exists($filename)) {
         return array();
     }
     // Capture hidden PHP errors from the parsing
     $version = phpversion();
     $php_errormsg = null;
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     if ($version >= '5.3.1') {
         $contents = file_get_contents($filename);
         $contents = str_replace('_QQ_', '"\\""', $contents);
         $strings = @parse_ini_string($contents);
         if ($strings === false) {
             return array();
         }
     } else {
         $strings = @parse_ini_file($filename);
         if ($strings === false) {
             return array();
         }
         if ($version == '5.3.0' && is_array($strings)) {
             foreach ($strings as $key => $string) {
                 $strings[$key] = str_replace('_QQ_', '"', $string);
             }
         }
     }
     return $strings;
 }
Example #20
0
function webLoginSendNewPassword($email, $uid, $pwd, $ufn)
{
    global $modx, $site_url;
    $mailto = $modx->config['mailto'];
    $websignupemail_message = $modx->config['websignupemail_message'];
    $emailsubject = $modx->config['emailsubject'];
    $emailsubject = $modx->config['emailsubject'];
    $emailsender = $modx->config['emailsender'];
    $site_name = $modx->config['site_name'];
    $site_start = $modx->config['site_start'];
    $message = sprintf($websignupemail_message, $uid, $pwd);
    // use old method
    // replace placeholders
    $message = str_replace("[+uid+]", $uid, $message);
    $message = str_replace("[+pwd+]", $pwd, $message);
    $message = str_replace("[+ufn+]", $ufn, $message);
    $message = str_replace("[+sname+]", $site_name, $message);
    $message = str_replace("[+semail+]", $emailsender, $message);
    $message = str_replace("[+surl+]", $site_url, $message);
    $headers = "From: " . $emailsender . "\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "MIME-Version: 1.0\r\n" . "Content-Transfer-Encoding: 8bit \r\n" . "X-Mailer: MODx Content Manager - PHP/" . phpversion() . "\r\n";
    $emailsubject = "=?UTF-8?B?" . base64_encode($emailsubject) . "?=\r\n";
    //<-работает мать его
    if (!ini_get('safe_mode')) {
        $sent = mail($email, $emailsubject, $message, $headers);
    } else {
        $sent = mail($email, $emailsubject, $message, $headers);
    }
    if (!$sent) {
        "<div class=\"error\">�звините, но произошла ошибка во время отправки сообщения на {$mailto}</div>";
    }
    return true;
}
Example #21
0
 /**
  * @param string xml content
  * @return true|PEAR_Error
  */
 function parse($data)
 {
     if (!extension_loaded('xml')) {
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Extension not found", 1);
     }
     $this->_dataStack = $this->_valStack = array();
     $this->_depth = 0;
     if (strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'")) {
         $this->encoding = 'UTF-8';
     }
     if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
         $data = utf8_decode($data);
         $this->encoding = 'ISO-8859-1';
     }
     $xp = xml_parser_create($this->encoding);
     xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
     xml_set_object($xp, $this);
     xml_set_element_handler($xp, 'startHandler', 'endHandler');
     xml_set_character_data_handler($xp, 'cdataHandler');
     if (!xml_parse($xp, $data)) {
         $msg = xml_error_string(xml_get_error_code($xp));
         $line = xml_get_current_line_number($xp);
         xml_parser_free($xp);
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Error: '{$msg}' on line '{$line}'", 2);
     }
     xml_parser_free($xp);
     return true;
 }
 /**
  * Constructor
  *
  * Sets the path to the view files and gets the initial output buffering level
  *
  * @access	public
  */
 function CI_Loader()
 {
     $this->_ci_is_php5 = floor(phpversion()) >= 5 ? TRUE : FALSE;
     $this->_ci_view_path = APPPATH . 'views/';
     $this->_ci_ob_level = ob_get_level();
     log_message('debug', "Loader Class Initialized");
 }
 /**
  * opening of the session - mandatory arguments won't be needed
  *
  * @param string $savePath
  * @param string $sessionName
  * @return bool
  */
 public function open($savePath, $sessionName)
 {
     if (!isset($this->_lifeTime)) {
         $this->_lifeTime = intval(ini_get("session.gc_maxlifetime"));
     }
     if (!isset($this->_refreshTime)) {
         $this->_refreshTime = ceil($this->_lifeTime / 3);
     }
     $this->_initSessionData = null;
     $this->_memcache = new Memcache();
     if (Kwf_Config::getValue('aws.simpleCacheCluster')) {
         $servers = Kwf_Util_Aws_ElastiCache_CacheClusterEndpoints::getCached(Kwf_Config::getValue('aws.simpleCacheCluster'));
     } else {
         if (Kwf_Cache_Simple::$memcacheHost) {
             $servers = array(array('host' => Kwf_Cache_Simple::$memcacheHost, 'port' => Kwf_Cache_Simple::$memcachePort));
         } else {
             throw new Kwf_Exception("no memcache configured");
         }
     }
     foreach ($servers as $s) {
         if (version_compare(phpversion('memcache'), '2.1.0') == -1 || phpversion('memcache') == '2.2.4') {
             // < 2.1.0
             $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
         } else {
             if (version_compare(phpversion('memcache'), '3.0.0') == -1) {
                 // < 3.0.0
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1, true, null, 10000);
             } else {
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
             }
         }
     }
     return true;
 }
	function escape($string) {
		return addslashes( $string ); // Disable rest for now, causing problems
		if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
			return mysql_escape_string( $string );
		else
			return mysql_real_escape_string( $string, $this->dbh );
	}
Example #25
0
function onSubmit($formValues)
{
    // Concatenate the name
    if (!empty($formValues->name->middleInitial)) {
        $name = $formValues->name->firstName . ' ' . $formValues->name->middleInitial . ' ' . $formValues->name->lastName;
    } else {
        $name = $formValues->name->firstName . ' ' . $formValues->name->lastName;
    }
    // Prepare the variables for sending the mail
    $toAddress = '*****@*****.**';
    $fromAddress = $formValues->email;
    $fromName = $name;
    $subject = $formValues->subject . ' from ' . $fromName;
    $message = $formValues->message;
    // Use the PHP mail function
    $mail = mail($toAddress, $subject, $message, 'From: ' . $fromAddress . "\r\n" . 'Reply-To: ' . $fromAddress . "\r\n" . 'X-Mailer: PHP/' . phpversion());
    // Send the message
    if ($mail) {
        $response['successPageHtml'] = '
            <h1>Thanks for Contacting Us</h1>
            <p>Your message has been successfully sent.</p>
        ';
    } else {
        $response['failureNoticeHtml'] = '
            There was a problem sending your message.
        ';
    }
    return $response;
}
Example #26
0
 public function indexAction(Request $request)
 {
     $name = $request->request->get('name');
     $phone = $request->request->get('phone');
     $time = $request->request->get('time');
     $type = $request->request->get('type');
     switch ($type) {
         case 'group':
             $typeInfo = "в группе";
             break;
         case 'individ':
             $typeInfo = "индивидуально";
             break;
         case 'company':
             $typeInfo = "корпоративно";
             break;
         default:
             $typeInfo = "";
             break;
     }
     $to = '*****@*****.**';
     $subject = 'Запрос с сайта';
     $message = "Имя: {$name}, Номер: {$phone}, Время: {$time}, Тип занятий:{$typeInfo}";
     $headers = 'From: irk@e-a-s-y.ru' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     //var_dump(mail($to, $subject, $message, $headers));die();
     if (mail($to, $subject, $message, $headers)) {
         echo "sended";
         die;
     } else {
         echo "not sended";
         die;
     }
 }
Example #27
0
function __aws_sdk_ua_callback()
{
    $ua_append = '';
    $extensions = get_loaded_extensions();
    $sorted_extensions = array();
    if ($extensions) {
        foreach ($extensions as $extension) {
            if ($extension === 'curl' && function_exists('curl_version')) {
                $curl_version = curl_version();
                $sorted_extensions[strtolower($extension)] = $curl_version['version'];
            } elseif ($extension === 'pcre' && defined('PCRE_VERSION')) {
                $pcre_version = explode(' ', PCRE_VERSION);
                $sorted_extensions[strtolower($extension)] = $pcre_version[0];
            } elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT')) {
                $openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
                $sorted_extensions[strtolower($extension)] = $openssl_version[1];
            } else {
                $sorted_extensions[strtolower($extension)] = phpversion($extension);
            }
        }
    }
    foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext) {
        if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext]) {
            $ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
        } elseif (isset($sorted_extensions[$ua_ext])) {
            $ua_append .= ' ' . $ua_ext . '/0';
        }
    }
    return $ua_append;
}
 protected function getVariableGetter($name)
 {
     if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
         return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
     }
     return sprintf('$this->getContext($context, "%s")', $name);
 }
Example #29
0
 function _Set_Timeout(&$res, $s, $m = 0)
 {
     if (version_compare(phpversion(), '4.3.0', '<')) {
         return socket_set_timeout($res, $s, $m);
     }
     return stream_set_timeout($res, $s, $m);
 }
Example #30
0
function check_php_version()
{
    if (floatval(phpversion()) < 5.3) {
        return false;
    }
    return true;
}