コード例 #1
0
ファイル: env_model.php プロジェクト: Git-Host/dotachuanqi
 /**
  * 初始化环境
  */
 public function init_env()
 {
     if (PHP_VERSION < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('EXT_OBGZIP', function_exists('ob_gzhandler'));
     define('TIMESTAMP', time());
     $this->_timezone_set();
     define('SITE_URL', site_url());
     define('BASE_URL', base_url());
     define('CURRENT_URL', current_url());
     define('PAGESIZE', 10);
     //页码大小
     define('DATETIMEFROMAT', 'Y/m/d H:i:s');
     // 常用的日期格式
     // authkey
     $authkey = trim(config_item('auth_key'));
     define('AUTHKEY', $authkey ? $authkey : 'vxcfhwqpordhfadvs');
     $site_name = trim(strip_tags(config_item('site_name')));
     define('SITENAME', $site_name ? $site_name : '老虎游戏');
     if (!defined('CHARSET')) {
         $charset = strtoupper(config_item('charset'));
         define('CHARSET', $charset);
     }
     define('IMGDIR', 'http://img.laohu.com/ls/images/');
 }
コード例 #2
0
 public function index()
 {
     //note 普通的 http 通知方式
     if (!defined('IN_UC')) {
         error_reporting(0);
         set_magic_quotes_runtime(0);
         defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
         service("Passport");
         $_DCACHE = $get = $post = array();
         $code = @$_GET['code'];
         parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
         if (MAGIC_QUOTES_GPC) {
             $get = _stripslashes($get);
         }
         $timestamp = time();
         if ($timestamp - $get['time'] > 3600) {
             exit('Authracation has expiried');
         }
         if (empty($get)) {
             exit('Invalid Request');
         }
         $action = $get['action'];
         require_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
         $post = xml_unserialize(file_get_contents('php://input'));
         if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
             exit($this->{$get}['action']($get, $post));
         } else {
             exit(API_RETURN_FAILED);
         }
     }
 }
コード例 #3
0
function session($configfile)
{
    if (get_magic_quotes_runtime()) {
        set_magic_quotes_runtime(0);
    }
    $ini = readINIfile("" . $configfile . "", ";");
    // dabei ist ; das zeichen für einen kommentar. kann geändert werden.
    for ($i = 0; $i <= 7; $i++) {
        $_SESSION["color_ch" . $i] = $ini['plotter']['color_ch' . $i];
        $_SESSION["temp_min" . $i] = $ini['temp_min']['temp_min' . $i];
        $_SESSION["temp_max" . $i] = $ini['temp_max']['temp_max' . $i];
        $_SESSION["ch_name" . $i] = $ini['ch_name']['ch_name' . $i];
        $_SESSION["alert" . $i] = $ini['web_alert']['ch' . $i];
        $_SESSION["ch_show" . $i] = $ini['ch_show']['ch' . $i];
    }
    $_SESSION["plot_start"] = $ini['ToDo']['plot_start'];
    $_SESSION["plotname"] = $ini['plotter']['plotname'];
    $_SESSION["plotsize"] = $ini['plotter']['plotsize'];
    $_SESSION["plotbereich_min"] = $ini['plotter']['plotbereich_min'];
    $_SESSION["plotbereich_max"] = $ini['plotter']['plotbereich_max'];
    $_SESSION["keybox"] = $ini['plotter']['keybox'];
    $_SESSION["keyboxframe"] = $ini['plotter']['keyboxframe'];
    $_SESSION["pit_on"] = $ini['ToDo']['pit_on'];
    $_SESSION["pit_ch"] = $ini['Pitmaster']['pit_ch'];
    $_SESSION["webcam_start"] = $ini['webcam']['webcam_start'];
    $_SESSION["current_temp"] = $ini['filepath']['current_temp'];
    $_SESSION["pitmaster"] = $ini['filepath']['pitmaster'];
    if (!isset($_SESSION["websoundalert"])) {
        $_SESSION["websoundalert"] = "True";
    }
}
コード例 #4
0
ファイル: class_core.php プロジェクト: Kingson4Wu/php_demo
 function _init_env()
 {
     error_reporting(E_ERROR);
     if (phpversion() < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     define('DISCUZ_ROOT', substr(dirname(__FILE__), 0, -12));
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('EXT_OBGZIP', function_exists('ob_gzhandler'));
     define('TIMESTAMP', time());
     discuz_core::timezone_set();
     if (!defined('DISCUZ_CORE_FUNCTION') && !@(include DISCUZ_ROOT . './source/function/function_core.php')) {
         $this->error('function_core.php is missing');
     }
     define('IS_ROBOT', checkrobot());
     foreach ($GLOBALS as $key => $value) {
         if (!isset($this->superglobal[$key])) {
             $GLOBALS[$key] = null;
             unset($GLOBALS[$key]);
         }
     }
     global $_G;
     $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => dmicrotime(), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0));
     $_G['PHP_SELF'] = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
     $_G['basescript'] = CURSCRIPT;
     $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'))) . '/');
     $uri = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
     $_G['siteroot'] = substr($_G['PHP_SELF'], 0, -strlen(basename($_G['PHP_SELF'])));
     $this->var =& $_G;
 }
コード例 #5
0
ファイル: framework.php プロジェクト: ohjack/newErp
 private function __construct()
 {
     //-----------需要页面显示调试信息,	注释掉下面两行即可---
     //-------------------------------------------------------
     set_error_handler(array("Core", 'appError'));
     set_exception_handler(array("Core", 'appException'));
     date_default_timezone_set("Asia/Shanghai");
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         @set_magic_quotes_runtime(0);
         define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False);
     }
     if (!defined('WEB_PATH')) {
         //define("WEB_PATH","D:/wamp/www/pc2.valsun.cn/");
         define("WEB_PATH", "/data/web/erpNew/pc.valsun.cn/");
     }
     include WEB_PATH . "lib/common.php";
     //加载全局配置信息
     C(include WEB_PATH . 'conf/common.php');
     include WEB_PATH . "lib/auth.php";
     //鉴权
     include WEB_PATH . "lib/authuser.class.php";
     //新鉴权
     //Auth::setAccess(include WEB_PATH.'conf/access.php');
     include WEB_PATH . "lib/log.php";
     //加载数据接口层及所需支撑
     include WEB_PATH . "lib/service/http.php";
     //网络接口
     include WEB_PATH . "lib/functions.php";
     include WEB_PATH . "lib/page.php";
     include WEB_PATH . "lib/template.php";
     //PHPLIB 的模板类
     include WEB_PATH . "lib/cache/cache.php";
     //memcache
     include WEB_PATH . "lib/PHPExcel.php";
     //PHPExcel
     //include WEB_PATH."lib/rabbitmq/rabbitmq.class.php";
     //加载语言包
     //$lang	=	WEB_PATH."lang/".C("LANG").".php";		//memcache
     if (file_exists($lang)) {
         //echo $lang;
         //C(include $lang);
     }
     if (C("DATAGATE") == "db") {
         $db = C("DB_TYPE");
         include WEB_PATH . "lib/db/" . $db . ".php";
         //db直连
         if ($db == "mysql") {
             global $dbConn;
             $db_config = C("DB_CONFIG");
             $dbConn = new mysql();
             $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]);
             $dbConn->select_db($db_config["master1"][4]);
         }
         if (DB_TYPE == "mongodb") {
             //.......
         }
     }
     //自动加载类
     spl_autoload_register(array('Core', 'autoload'));
 }
コード例 #6
0
ファイル: Base.class.php プロジェクト: 43431655/qizhongbao
 public function __construct()
 {
     if (get_magic_quotes_runtime()) {
         @set_magic_quotes_runtime(0);
     }
     if (get_magic_quotes_gpc()) {
         $_POST = $this->strip_slashes($_POST);
         $_GET = $this->strip_slashes($_GET);
         $_SESSION = $this->strip_slashes($_SESSION);
         $_COOKIE = $this->strip_slashes($_COOKIE);
     }
     if (defined('XIAOCMS_ADMIN') || defined('XIAOCMS_MEMBER')) {
         define('SITE_PATH', self::get_a_url());
     } else {
         define('SITE_PATH', self::get_base_url());
     }
     if (!is_file(XIAOCMS_PATH . 'data/install.lock')) {
         self::redirect(url('install/index'));
     }
     if (is_file(XIAOCMS_PATH . 'member' . DIRECTORY_SEPARATOR . 'index.php')) {
         define('XIAOCMS_MEMBER', XIAOCMS_PATH . 'member' . DIRECTORY_SEPARATOR);
     }
     $this->db = xiaocms::load_class('Model');
     $this->view = xiaocms::load_class('view');
     $this->cookie = xiaocms::load_class('cookie');
     $this->session = xiaocms::load_class('session');
     $this->site_config = xiaocms::load_config('config');
     $this->category_cache = get_cache('category');
     $this->content_model = get_cache('content_model');
     $this->member_info = self::get_member_info();
     $this->view->assign(array('cats' => $this->category_cache, 'member' => $this->member_info, 'site_url' => self::get_http_host() . SITE_PATH, 'site_name' => $this->site_config['site_name'], 'page' => (int) self::get('page') ? (int) self::get('page') : 1, 'site_template' => SITE_PATH . basename(TEMPLATE_DIR) . '/' . basename(SYS_THEME_DIR) . '/'));
 }
コード例 #7
0
function MagicQuotesRuntimeSetting()
{
    @ini_set("magic_quotes_runtime", 0);
    if (version_compare('5.4', PHP_VERSION, '>') && function_exists('set_magic_quotes_runtime') && get_magic_quotes_runtime()) {
        @set_magic_quotes_runtime(false);
    }
}
コード例 #8
0
ファイル: Pommo_Db.php プロジェクト: systemfirez/poMMo
 function Pommo_Db($username = NULL, $password = NULL, $database = NULL, $hostname = NULL, $tablePrefix = NULL)
 {
     // turn off magic quotes runtime
     if (get_magic_quotes_runtime()) {
         if (!set_magic_quotes_runtime(0)) {
             Pommo::kill('Could not turn off PHP\'s magic_quotes_runtime');
         }
     }
     $this->_prefix = $tablePrefix;
     $this->_database = $database;
     $this->table = array('config' => '`' . $tablePrefix . 'config`', 'fields' => '`' . $tablePrefix . 'fields`', 'group_rules' => '`' . $tablePrefix . 'group_rules`', 'groups' => '`' . $tablePrefix . 'groups`', 'mailing_notices' => '`' . $tablePrefix . 'mailing_notices`', 'mailing_current' => '`' . $tablePrefix . 'mailing_current`', 'mailings' => '`' . $tablePrefix . 'mailings`', 'scratch' => '`' . $tablePrefix . 'scratch`', 'subscriber_data' => '`' . $tablePrefix . 'subscriber_data`', 'subscriber_pending' => '`' . $tablePrefix . 'subscriber_pending`', 'subscriber_update' => '`' . $tablePrefix . 'subscriber_update`', 'subscribers' => '`' . $tablePrefix . 'subscribers`', 'templates' => '`' . $tablePrefix . 'templates`', 'queue' => '`' . $tablePrefix . 'queue`', 'updates' => '`' . $tablePrefix . 'updates`');
     $this->_dieOnQuery = TRUE;
     $this->_debug = FALSE;
     $this->_results = array();
     // connect to mysql database using config variables from poMMo class (set in setup/config.php).
     // supress errors to hide login information...
     $this->_link = mysql_connect($hostname, $username, $password);
     if (!$this->_link) {
         Pommo::kill(Pommo::_T('Could not establish database connection.') . ' ' . Pommo::_T('Verify your settings in config.php'));
     }
     if (!@mysql_select_db($database, $this->_link)) {
         Pommo::kill(sprintf(Pommo::_T('Connected to database server but could not select database (%s). Does it exist?'), $database) . ' ' . Pommo::_T('Verify your settings in config.php'));
     }
     // Make sure any results we retrieve or commands we send use the same charset and collation as the database:
     //  code taken from Juliette Reinders Folmer; http://www.adviesenzo.nl/examples/php_mysql_charset_fix/
     //  TODO: Cache the charset?
     $db_charset = mysql_query("SHOW VARIABLES LIKE 'character_set_database'", $this->_link);
     $charset_row = mysql_fetch_assoc($db_charset);
     mysql_query("SET NAMES '" . $charset_row['Value'] . "'", $this->_link);
     unset($db_charset, $charset_row);
     // setup safeSQL class
     $this->_safeSQL = new SafeSQL_MySQL($this->_link);
 }
コード例 #9
0
 function get_entries($process_comment_func = NULL)
 {
     if (function_exists('set_magic_quotes_runtime')) {
         set_magic_quotes_runtime(0);
     }
     $xml = simplexml_load_file('compress.zlib://' . $this->file);
     // simple "are we a disqus export?" check
     if (!$xml || $xml->getName() !== 'disqus') {
         return false;
     }
     foreach ($xml->thread as $thread) {
         $attributes = $thread->attributes('dsq', true);
         $threadid = (int) $attributes['id'];
         $link = (string) $thread->link;
         if (empty($this->thread_to_post_id[$threadid])) {
             if (trailingslashit($link) == trailingslashit(get_option('siteurl'))) {
                 $this->thread_to_post_id[$threadid] = (int) get_option('page_on_front');
             } else {
                 $this->thread_to_post_id[$threadid] = url_to_postid($link);
                 // echo "<li>URL to postid: <code>", $link, "</code> - <code>", $this->thread_to_post_id[$threadid], "</code></li>";
             }
         }
     }
     if ($process_comment_func) {
         foreach ($xml->post as $comment) {
             call_user_func($process_comment_func, $comment);
         }
     }
     return true;
 }
コード例 #10
0
ファイル: init.php プロジェクト: bramverstraten/fogproject
 /** startInit() initiates the environment
  * @return void
  */
 public static function startInit()
 {
     @set_time_limit(0);
     @error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
     @ini_set('session.save_handler', 'mm');
     @ini_set('session.cookie_httponly', true);
     @ob_start('sanitize_output');
     @session_start();
     @session_cache_limiter('no-cache');
     @session_set_cookie_params(0, null, null, true, true);
     @set_magic_quotes_runtime(0);
     self::verCheck();
     self::extCheck();
     foreach ($_REQUEST as $key => $val) {
         $_REQUEST[$key] = is_array($val) ? filter_var_array($val, FILTER_SANITIZE_STRING) : filter_var($val, FILTER_SANITIZE_STRING);
     }
     foreach ($_GET as $key => $val) {
         $_GET[$key] = is_array($val) ? filter_var_array($val, FILTER_SANITIZE_STRING) : filter_var($val, FILTER_SANITIZE_STRING);
     }
     foreach ($_POST as $key => $val) {
         $_POST[$key] = is_array($val) ? filter_var_array($val, FILTER_SANITIZE_STRING) : filter_var($val, FILTER_SANITIZE_STRING);
     }
     foreach (array('node', 'sub', 'printertype', 'id', 'sub', 'crit', 'sort', 'confirm', 'tab') as $x) {
         global ${$x};
         ${$x} = isset($_REQUEST[$x]) ? filter_var($_REQUEST[$x], FILTER_SANITIZE_STRING) : '';
     }
     unset($x);
     new System();
     new Config();
 }
コード例 #11
0
ファイル: install.php プロジェクト: joshuaadickerson/Elkarte
/**
 * Initialization step. Called at each request.
 * It either sets up variables for other steps, or handle a few requests on its own.
 */
function initialize_inputs()
{
    // Turn off magic quotes runtime and enable error reporting.
    if (function_exists('set_magic_quotes_runtime')) {
        @set_magic_quotes_runtime(0);
    }
    error_reporting(E_ALL);
    // This is the test for support of compression
    if (isset($_GET['obgz'])) {
        ob_start('ob_gzhandler');
        if (ini_get('session.save_handler') == 'user') {
            @ini_set('session.save_handler', 'files');
        }
        session_start();
        if (!headers_sent()) {
            echo '<!DOCTYPE html>
<html>
	<head>
		<title>', htmlspecialchars($_GET['pass_string'], ENT_COMPAT, 'UTF-8'), '</title>
	</head>
	<body style="background: #d4d4d4; margin-top: 16%; font-size: 16pt;">
		<strong>', htmlspecialchars($_GET['pass_string'], ENT_COMPAT, 'UTF-8'), '</strong>
	</body>
</html>';
        }
        exit;
    } else {
        ob_start();
        if (ini_get('session.save_handler') == 'user') {
            @ini_set('session.save_handler', 'files');
        }
        if (function_exists('session_start')) {
            @session_start();
        }
    }
    // Reject magic_quotes_sybase='on'.
    if (ini_get('magic_quotes_sybase') || strtolower(ini_get('magic_quotes_sybase')) == 'on') {
        die('magic_quotes_sybase=on was detected: your host is using an unsecure PHP configuration, deprecated and removed in current versions. Please upgrade PHP.');
    }
    if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() != 0) {
        die('magic_quotes_gpc=on was detected: your host is using an unsecure PHP configuration, deprecated and removed in current versions. Please upgrade PHP.');
    }
    // Add slashes, as long as they aren't already being added.
    foreach ($_POST as $k => $v) {
        if (strpos($k, 'password') === false && strpos($k, 'passwd') === false) {
            $_POST[$k] = addslashes($v);
        } else {
            $_POST[$k] = addcslashes($v, '\'');
        }
    }
    // This is really quite simple; if ?delete is on the URL, delete the installer...
    if (isset($_GET['delete'])) {
        action_deleteInstaller();
    }
    // PHP 5 might cry if we don't do this now.
    $server_offset = @mktime(0, 0, 0, 1, 1, 1970);
    date_default_timezone_set('Etc/GMT' . ($server_offset > 0 ? '+' : '') . $server_offset / 3600);
    // Force an integer step, defaulting to 0.
    $_GET['step'] = isset($_GET['step']) ? (int) $_GET['step'] : 0;
}
コード例 #12
0
ファイル: functions.php プロジェクト: blazersix/satispress
/**
 * Send a download.
 *
 * @since 0.1.0
 *
 * @param string $file An absolute file path.
 */
function satispress_send_file($file)
{
    @session_write_close();
    if (function_exists('apache_setenv')) {
        @apache_setenv('no-gzip', 1);
    }
    if (get_magic_quotes_runtime()) {
        @set_magic_quotes_runtime(0);
    }
    @ini_set('zlib.output_compression', 'Off');
    @set_time_limit(0);
    @ob_end_clean();
    if (ob_get_level()) {
        @ob_end_clean();
        // Zip corruption fix.
    }
    nocache_headers();
    header('Robots: none');
    header('Content-Type: application/force-download');
    header('Content-Description: File Transfer');
    header('Content-Disposition: attachment; filename="' . basename($file) . '";');
    header('Content-Transfer-Encoding: binary');
    if ($size = @filesize($file)) {
        header('Content-Length: ' . $size);
    }
    @readfile_chunked($file) or wp_die(__('File not found', 'satispress'));
    exit;
}
コード例 #13
0
ファイル: Bootstrap.php プロジェクト: sebasalons/eyeos-u1db
 public static function init()
 {
     // Get rid of magic_quotes
     if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() || ini_get('magic_quotes_sybase')) {
         $_POST = Bootstrap::multidimensionalArrayMap('stripslashes', $_POST);
         $_REQUEST = Bootstrap::multidimensionalArrayMap('stripslashes', $_REQUEST);
         $_GET = Bootstrap::multidimensionalArrayMap('stripslashes', $_GET);
         $_COOKIE = Bootstrap::multidimensionalArrayMap('stripslashes', $_COOKIE);
     }
     if (ini_get('magic_quotes_runtime') && function_exists('set_magic_quotes_runtime')) {
         @set_magic_quotes_runtime(0);
     }
     // This is needed to encode json correctly, because of the floating point
     setlocale(LC_ALL, 'en_US.utf8');
     // Each MMap plugin should decide waht type of response needs.
     //ob_start('mb_output_handler');
     // The environment is safe now, start the system
     Bootstrap::load(EYE_ROOT . '/' . SYSTEM_DIR . '/' . KERNEL_DIR . '/Kernel.php');
     //get the priority
     $priorities = Bootstrap::loadPriorities();
     // Load all libraries
     Bootstrap::loadLibraries($priorities);
     // Initialize self::$Logger for next steps
     self::$Logger = Logger::getLogger('bootstrap.Bootstrap');
     // Load all services
     Bootstrap::loadServices($priorities);
     // Load all frameworks
     Bootstrap::loadFrameworks($priorities);
 }
コード例 #14
0
ファイル: brand.class.php プロジェクト: pan289091315/Discuz
 function _init_env()
 {
     error_reporting(E_ERROR);
     if (phpversion() < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('FORMHASH', formhash());
     define('TIMESTAMP', time());
     $_SERVER['HTTP_USER_AGENT'] = empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'];
     foreach ($GLOBALS as $key => $value) {
         if (!isset($this->superglobal[$key])) {
             $GLOBALS[$key] = null;
             unset($GLOBALS[$key]);
         }
     }
     global $_G;
     $_G = array('uid' => 0, 'username' => 'Guest', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => array_sum(explode(' ', microtime())), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'timenow' => array(), 'cookiepre' => '', 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'authkey' => '', 'config' => array(), 'setting' => array('sitetheme' => 'default'), 'member' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array());
     $_G['PHP_SELF'] = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
     $_G['basescript'] = CURSCRIPT;
     $_G['basefilename'] = basename($_G['PHP_SELF']);
     $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'))) . '/');
     $_G['siteroot'] = substr($_G['PHP_SELF'], 0, -strlen($_G['basefilename']));
 }
コード例 #15
0
ファイル: class_core.php プロジェクト: v998/discuzx-en
 function _init_env()
 {
     error_reporting(E_ERROR);
     if (PHP_VERSION < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     /*vot*/
     if (!defined('DISCUZ_ROOT')) {
         /*vot*/
         define('DISCUZ_ROOT', preg_replace("/^\\w\\:/i", '', str_replace("\\", '/', substr(dirname(__FILE__), 0, -12))));
         /*vot*/
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('EXT_OBGZIP', function_exists('ob_gzhandler'));
     define('TIMESTAMP', time());
     $this->timezone_set();
     /*vot*/
     if (!defined('DISCUZ_CORE_FUNCTION') && !@(include_once DISCUZ_ROOT . './source/function/function_core.php')) {
         exit('function_core.php is missing');
     }
     if (function_exists('ini_get')) {
         $memorylimit = @ini_get('memory_limit');
         if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) {
             ini_set('memory_limit', '128m');
         }
     }
     define('IS_ROBOT', checkrobot());
     foreach ($GLOBALS as $key => $value) {
         if (!isset($this->superglobal[$key])) {
             $GLOBALS[$key] = null;
             unset($GLOBALS[$key]);
         }
     }
     global $_G;
     $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => dmicrotime(), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'thread' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0), 'mobile' => '');
     $_G['PHP_SELF'] = htmlspecialchars($this->_get_script_url());
     $_G['basescript'] = CURSCRIPT;
     $_G['basefilename'] = basename($_G['PHP_SELF']);
     $sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'));
     if (defined('IN_API')) {
         $sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath);
     } elseif (defined('IN_ARCHIVER')) {
         $sitepath = preg_replace("/\\/archiver/i", '', $sitepath);
     }
     $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
     $url = parse_url($_G['siteurl']);
     $_G['siteroot'] = isset($url['path']) ? $url['path'] : '';
     $_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
     if (defined('SUB_DIR')) {
         $_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']);
         $_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']);
     }
     /*vot*/
     $_G['siteurl'] = str_replace("\\", '/', $_G['siteurl']);
     /*vot*/
     $_G['siteroot'] = str_replace("\\", '/', $_G['siteroot']);
     $this->var =& $_G;
 }
コード例 #16
0
ファイル: Request.php プロジェクト: dautushenka/car-market
 /**
  * Initialization variables and constant
  *
  */
 public static function init()
 {
     if (function_exists('get_magic_quotes_gpc') and get_magic_quotes_gpc()) {
         self::stripslashes_deep($_REQUEST);
         // needed for some reason (at least on php5 - not tested on php4)
         self::stripslashes_deep($_GET);
         self::stripslashes_deep($_POST);
         self::stripslashes_deep($_COOKIE);
         if (is_array($_FILES)) {
             foreach ($_FILES as $key => $val) {
                 $_FILES["{$key}"]['tmp_name'] = str_replace('\\', '\\\\', $val['tmp_name']);
             }
             self::stripslashes_deep($_FILES);
         }
     }
     set_magic_quotes_runtime(0);
     @ini_set('magic_quotes_sybase', 0);
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || !empty($_REQUEST['rndval'])) {
         self::$AJAX = true;
         // объ¤вим константу дл¤ старый версий модулей
         define('AJAX', true);
     } else {
         // объ¤вим константу дл¤ старый версий модулей
         define('AJAX', false);
     }
     foreach ($_COOKIE as $key => $val) {
         unset($_REQUEST[$key]);
     }
     self::$IP = $_SERVER['REMOTE_ADDR'];
 }
コード例 #17
0
ファイル: uc.app.php プロジェクト: woolh/Online
 function index()
 {
     /* 只提供普通的http通知方式 */
     error_reporting(0);
     set_magic_quotes_runtime(0);
     $_DCACHE = $get = $post = array();
     $code = @$_GET['code'];
     parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
     $get = _stripslashes($get);
     $timestamp = time();
     if ($timestamp - $get['time'] > 3600) {
         exit('Authracation has expiried');
     }
     if (empty($get)) {
         exit('Invalid Request');
     }
     $action = $get['action'];
     include ROOT_PATH . '/uc_client/lib/xml.class.php';
     $post = xml_unserialize(file_get_contents('php://input'));
     if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
         exit($this->{$get}['action']($get, $post));
     } else {
         exit(API_RETURN_FAILED);
     }
 }
コード例 #18
0
ファイル: Input.php プロジェクト: jinshana/tangocms
 /**
  * Constructor function
  * Sets the class properties that will be used later on in the class.
  *
  * @return object
  */
 public function __construct()
 {
     if (function_exists('set_magic_quotes_runtime')) {
         // Yes yes I know it is deprecated, that is why we shut it up.
         @set_magic_quotes_runtime(false);
     }
 }
コード例 #19
0
ファイル: class.apexx.php プロジェクト: bigfraggle/open-apexx
 function prepare_vars()
 {
     if (isset($_REQUEST) && is_array($_REQUEST)) {
         $_REQUEST = $this->strpsl($_REQUEST);
     }
     if (isset($_POST) && is_array($_POST)) {
         $_POST = $this->strpsl($_POST);
     }
     if (isset($_GET) && is_array($_GET)) {
         $_GET = $this->strpsl($_GET);
     }
     if (isset($_COOKIE) && is_array($_COOKIE)) {
         $_COOKIE = $this->strpsl($_COOKIE);
     }
     if (isset($_SESSION) && is_array($_SESSION)) {
         $_SESSION = $this->strpsl($_SESSION);
     }
     @set_magic_quotes_runtime(0);
     //Fehlendes REQUEST_URI auf IIS-Server fixen
     if (!isset($_SERVER['REQUEST_URI'])) {
         $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
         if ($_SERVER['QUERY_STRING']) {
             $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
         } elseif ($_SERVER['argv'][0] != '') {
             $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['argv'][0];
         }
     }
 }
コード例 #20
0
ファイル: framework.php プロジェクト: ohjack/newErp
 private function __construct()
 {
     //-----------需要页面显示调试信息,	注释掉下面两行即可---
     //-------------------------------------------------------
     //set_error_handler(array("Core",'appError'));
     //set_exception_handler(array("Core",'appException'));
     date_default_timezone_set("Asia/Shanghai");
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         @set_magic_quotes_runtime(0);
         define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False);
     }
     if (!defined('WEB_PATH')) {
         define("WEB_PATH", "/data/web/purchase.valsun.cn/");
     }
     include WEB_PATH . "lib/common.php";
     //加载全局配置信息
     C(include WEB_PATH . 'conf/common.php');
     include WEB_PATH . "lib/authuser.class.php";
     //新鉴权
     include WEB_PATH . "lib/log.php";
     include WEB_PATH . "lib/page.php";
     //分页类
     include WEB_PATH . "lib/rabbitmq/rabbitmq.class.php";
     //消息队列
     //加载数据接口层及所需支撑
     include WEB_PATH . "lib/service/http.php";
     //网络接口
     include WEB_PATH . "lib/functions.php";
     //公共方法
     include WEB_PATH . "lib/opensys_functions.php";
     //开放系统方法
     include WEB_PATH . "lib/cache/cache.php";
     //memcache
     include WEB_PATH . "lib/memcachemodel.class.php";
     //memcache
     include WEB_PATH . "lib/class.curl.php";
     //memcache
     if (C("DATAGATE") == "db") {
         $db = C("DB_TYPE");
         include WEB_PATH . "lib/db/" . $db . ".php";
         //db直连
         if ($db == "mysql") {
             global $dbConn, $dbconn, $rmqObj;
             $db_config = C("DB_CONFIG");
             $rmq_config = C("RMQ_CONFIG");
             $dbConn = new mysql();
             $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]);
             $dbConn->select_db($db_config["master1"][4]);
             $dbconn = $dbConn;
             $rmqObj = new RabbitMQClass($rmq_config['user'], $rmq_config['passwd'], $rmq_config['vhost'], $rmq_config['ip']);
             //队列对象
         }
         if ($db == "mongodb") {
             //.......
         }
     }
     //自动加载类
     spl_autoload_register(array('Core', 'autoload'));
 }
コード例 #21
0
ファイル: repair_settings.php プロジェクト: ahrasis/tools
/**
 * Start things up
 *
 * - It sets up variables for other steps
 * - It makes the initial connection to the db
 */
function initialize_inputs()
{
    global $db_connection, $sourcedir, $boarddir, $languagedir, $extdir, $cachedir;
    global $db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_type;
    // Turn off magic quotes runtime and enable error reporting.
    if (function_exists('set_magic_quotes_runtime')) {
        @set_magic_quotes_runtime(0);
    }
    error_reporting(E_ALL);
    ob_start();
    if (ini_get('session.save_handler') == 'user') {
        @ini_set('session.save_handler', 'files');
    }
    if (function_exists('session_start')) {
        @session_start();
    }
    // Reject magic_quotes_sybase='on'.
    if (ini_get('magic_quotes_sybase') || strtolower(ini_get('magic_quotes_sybase')) == 'on') {
        die('magic_quotes_sybase=on was detected: your host is using an unsecure PHP configuration, deprecated and removed in current versions. Please upgrade PHP.');
    }
    if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() != 0) {
        die('magic_quotes_gpc=on was detected: your host is using an unsecure PHP configuration, deprecated and removed in current versions. Please upgrade PHP.');
    }
    // Add slashes, as long as they aren't already being added.
    foreach ($_POST as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $k2 => $v2) {
                $_POST[$k][$k2] = addcslashes($v2, '\\\'');
            }
        } else {
            $_POST[$k] = addcslashes($v, '\\\'');
        }
    }
    // PHP 5 might complain if we don't do this now.
    $server_offset = @mktime(0, 0, 0, 1, 1, 1970);
    date_default_timezone_set('Etc/GMT' . ($server_offset > 0 ? '+' : '') . $server_offset / 3600);
    $db_connection = false;
    if (isset($sourcedir) && file_exists($sourcedir)) {
        define('ELK', 1);
        // Time to set some constants
        DEFINE('BOARDDIR', $boarddir);
        DEFINE('CACHEDIR', $cachedir);
        DEFINE('EXTDIR', $extdir);
        DEFINE('LANGUAGEDIR', $languagedir);
        DEFINE('SOURCEDIR', $sourcedir);
        DEFINE('ADMINDIR', $sourcedir . '/admin');
        DEFINE('CONTROLLERDIR', $sourcedir . '/controllers');
        DEFINE('SUBSDIR', $sourcedir . '/subs');
        unset($boarddir, $cachedir, $sourcedir, $languagedir, $extdir);
        // Default the database type to MySQL if its not set in settings
        if (empty($db_type) || !file_exists(SOURCEDIR . '/database/Db-' . $db_type . '.subs.php')) {
            $db_type = 'mysql';
        }
        // Lets make a connection to the db
        require_once SOURCEDIR . '/Load.php';
        require_once SOURCEDIR . '/database/Database.subs.php';
        $db_connection = elk_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, array('non_fatal' => true));
    }
}
コード例 #22
0
ファイル: Security.php プロジェクト: jhonbendar/framework
 /**
  * Check magic quote and disable it
  */
 private function checkMagicQuoteRuntime()
 {
     // Check for magic quotes
     if (get_magic_quotes_runtime()) {
         // Oh god! Danger. Magic quote deprecated. Sort it out.
         @set_magic_quotes_runtime(0);
     }
 }
コード例 #23
0
 function socket_read($byte_count)
 {
     $mqr = get_magic_quotes_runtime();
     set_magic_quotes_runtime(0);
     $buffer = fread($this->socket, $byte_count);
     set_magic_quotes_runtime($mqr);
     return $buffer;
 }
コード例 #24
0
ファイル: skinie.php プロジェクト: hatone/Nucleus-v3.64
 /**
  * constructor initializes data structures
  */
 function SKINIMPORT()
 {
     // disable magic_quotes_runtime if it's turned on
     set_magic_quotes_runtime(0);
     // debugging mode?
     $this->debug = 0;
     $this->reset();
 }
コード例 #25
0
	function get_entries() {
		set_magic_quotes_runtime(0);
		$importdata = file($this->file); // Read the file into an array
		$importdata = implode('', $importdata); // squish it
		$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
		$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
		$this->posts = explode("--MT-ENTRY--", $importdata);
	}
コード例 #26
0
 /**
  * Constructor. Sanitizes global data GET, POST and COOKIE data.
  * Also makes sure those pesty magic quotes and register globals
  * don't bother us. This is protected because it really only needs
  * to be run once.
  *
  * @return void
  */
 protected function __construct()
 {
     if (self::$instance === NULL) {
         // Check for magic quotes
         if (get_magic_quotes_runtime()) {
             // Dear lord!! This is bad and deprected. Sort it out ;)
             set_magic_quotes_runtime(0);
         }
         if (get_magic_quotes_gpc()) {
             // This is also bad and deprected. See http://php.net/magic_quotes for more information.
             $this->magic_quotes_gpc = TRUE;
         }
         // Check for register globals and prevent security issues from arising.
         if (ini_get('register_globals')) {
             if (isset($_REQUEST['GLOBALS'])) {
                 // No no no.. just kill the script here and now
                 exit('Illegal attack on global variable.');
             }
             // Get rid of REQUEST
             $_REQUEST = array();
             // The following globals are standard and shouldn't really be removed
             $preserve = array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION');
             // Same effect as disabling register_globals
             foreach ($GLOBALS as $key => $value) {
                 if (!in_array($key, $preserve)) {
                     global ${$key};
                     ${$key} = NULL;
                     unset($GLOBALS[$key], ${$key});
                 }
             }
         }
         // Sanitize global data
         if (is_array($_POST)) {
             foreach ($_POST as $key => $value) {
                 $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($value);
             }
         } else {
             $_POST = array();
         }
         if (is_array($_GET)) {
             foreach ($_GET as $key => $value) {
                 $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($value);
             }
         } else {
             $_GET = array();
         }
         if (is_array($_COOKIE)) {
             foreach ($_COOKIE as $key => $value) {
                 $_COOKIE[$this->clean_input_keys($key)] = $this->clean_input_data($value);
             }
         } else {
             $_COOKIE = array();
         }
         // Just make REQUEST a merge of POST and GET. Who really wants cookies in it anyway?
         $_REQUEST = array_merge($_GET, $_POST);
         self::$instance = $this;
     }
 }
コード例 #27
0
 /**
  * Set the file headers and force the download of a given file
  *
  * @return void
  */
 public function download()
 {
     if (isset($_GET['download']) && isset($_GET['payment_id'])) {
         $transaction_id = urldecode($_GET['download']);
         $payment_id = urldecode($_GET['payment_id']);
         $product_id = urldecode($_GET['product_id']);
         // Old download links might not have attachment_id set.
         // This means they were purchased before we added support
         // for multiple attachments. So, we just grab the first
         // attachment_id saved in post meta.
         $attachment_id = !empty($_GET['attachment_id']) ? urldecode($_GET['attachment_id']) : sell_media_get_attachment_id($product_id);
         $size_id = !empty($_GET['size_id']) ? urldecode($_GET['size_id']) : null;
         $verified = apply_filters('sell_media_verify_download', $this->verify($transaction_id, $payment_id), $product_id);
         if ($verified) {
             $file = Sell_Media()->products->get_protected_file($product_id, $attachment_id);
             if (!file_exists($file)) {
                 wp_die(__('The original high resolution file doesn\'t exist here: %1$s', 'sell_media'), $file);
                 exit;
             }
             $file_type = wp_check_filetype($file);
             if (!ini_get('safe_mode')) {
                 set_time_limit(0);
             }
             if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) {
                 set_magic_quotes_runtime(0);
             }
             if (function_exists('apache_setenv')) {
                 @apache_setenv('no-gzip', 1);
             }
             @ini_set('zlib.output_compression', 'Off');
             nocache_headers();
             header("Robots: none");
             header("Content-Type: " . $file_type['type'] . "");
             header("Content-Description: File Transfer");
             header("Content-Disposition: attachment; filename=\"" . basename($file) . "\"");
             header("Content-Transfer-Encoding: binary");
             // If image, generate the image sizes purchased and create a download
             if (wp_attachment_is_image($attachment_id)) {
                 $this->download_image($product_id, $attachment_id, $size_id);
             } else {
                 $this->download_file($file);
             }
             do_action('sell_media_after_successful_download', $product_id);
             exit;
         } else {
             do_action('sell_media_before_failed_download', $product_id, $attachment_id);
             wp_die(__('You do not have permission to download this file', 'sell_media'), __('Purchase Verification Failed', 'sell_media'));
         }
         exit;
     }
     // Rend purchase receipt?
     if (isset($_GET['resend_email']) && isset($_GET['payment_id'])) {
         $payment_id = $_GET['payment_id'];
         $payment_email = get_meta_key($payment_id, 'email');
         Sell_Media()->payments->email_receipt($payment_id, $payment_email);
     }
 }
コード例 #28
0
 public static function DisableMagicQuotesRuntime()
 {
     if (function_exists('set_magic_quotes_runtime')) {
         try {
             set_magic_quotes_runtime(false);
         } catch (Exception $e) {
         }
     }
 }
コード例 #29
0
ファイル: Input.php プロジェクト: assad2012/gallery3-appfog
 /**
  * Sanitizes global GET, POST and COOKIE data. Also takes care of
  * magic_quotes and register_globals, if they have been enabled.
  *
  * @return  void
  */
 public function __construct()
 {
     // Convert all global variables to Kohana charset
     $_GET = Input::clean($_GET);
     $_POST = Input::clean($_POST);
     $_COOKIE = Input::clean($_COOKIE);
     $_SERVER = Input::clean($_SERVER);
     if (Kohana::$server_api === 'cli') {
         // Convert command line arguments
         $_SERVER['argv'] = Input::clean($_SERVER['argv']);
     }
     // Use XSS clean?
     $this->use_xss_clean = (bool) Kohana::config('core.global_xss_filtering');
     if (Input::$instance === NULL) {
         // magic_quotes_runtime is enabled
         if (get_magic_quotes_runtime()) {
             @set_magic_quotes_runtime(0);
             Kohana_Log::add('debug', 'Disable magic_quotes_runtime! It is evil and deprecated: http://php.net/magic_quotes');
         }
         // magic_quotes_gpc is enabled
         if (get_magic_quotes_gpc()) {
             $this->magic_quotes_gpc = TRUE;
             Kohana_Log::add('debug', 'Disable magic_quotes_gpc! It is evil and deprecated: http://php.net/magic_quotes');
         }
         if (is_array($_GET)) {
             foreach ($_GET as $key => $val) {
                 // Sanitize $_GET
                 $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($val);
             }
         } else {
             $_GET = array();
         }
         if (is_array($_POST)) {
             foreach ($_POST as $key => $val) {
                 // Sanitize $_POST
                 $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($val);
             }
         } else {
             $_POST = array();
         }
         if (is_array($_COOKIE)) {
             foreach ($_COOKIE as $key => $val) {
                 // Ignore special attributes in RFC2109 compliant cookies
                 if ($key == '$Version' or $key == '$Path' or $key == '$Domain') {
                     continue;
                 }
                 // Sanitize $_COOKIE
                 $_COOKIE[$this->clean_input_keys($key)] = $this->clean_input_data($val);
             }
         } else {
             $_COOKIE = array();
         }
         // Create a singleton
         Input::$instance = $this;
         Kohana_Log::add('debug', 'Global GET, POST and COOKIE data sanitized');
     }
 }
コード例 #30
0
ファイル: core.php プロジェクト: huiwei19/oursustc-php
 function init_env()
 {
     global $_G;
     $_G = array('starttime' => microtime(true), 'setting' => array('dateformat' => 'Y-m-d', 'timeformat' => 'H:i', 'timeoffset' => 8, 'dateconvert' => true), 'member' => array('timeoffset' => 8));
     if (PHP_VERSION < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     init_utf_tools();
 }