当前位置: 首页>>代码示例>>PHP>>正文


PHP Pommo::_hostname方法代码示例

本文整理汇总了PHP中Pommo::_hostname方法的典型用法代码示例。如果您正苦于以下问题:PHP Pommo::_hostname方法的具体用法?PHP Pommo::_hostname怎么用?PHP Pommo::_hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pommo的用法示例。


在下文中一共展示了Pommo::_hostname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preInit

 public static function preInit($baseDir)
 {
     //	Remove quotes added by magic_quotes
     if (get_magic_quotes_gpc()) {
         $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
         while (list($key, $val) = each($process)) {
             foreach ($val as $k => $v) {
                 unset($process[$key][$k]);
                 if (is_array($v)) {
                     $process[$key][stripslashes($k)] = $v;
                     $process[] =& $process[$key][stripslashes($k)];
                 } else {
                     $process[$key][stripslashes($k)] = stripslashes($v);
                 }
             }
         }
         unset($process);
     }
     self::$_baseDir = $baseDir;
     self::$_config = array();
     self::$_auth = null;
     self::$_escaping = false;
     require_once self::$_baseDir . 'classes/Pommo_Log.php';
     require_once self::$_baseDir . 'lib/SafeSQL.class.php';
     require_once self::$_baseDir . 'classes/Pommo_Db.php';
     require_once self::$_baseDir . 'classes/Pommo_Auth.php';
     // 	initialize logger
     //	Check where this config variable comes from
     self::$_logger = new Pommo_Log();
     self::$_workDir = empty($config['workDir']) ? self::$_baseDir . 'cache' : $config['workDir'];
     self::$_debug = strtolower($config['debug']) != 'on' ? false : true;
     self::$_default_subscriber_sort = empty($config['default_subscriber_sort']) ? 'email' : $config['default_subscriber_sort'];
     self::$_verbosity = empty($config['verbosity']) ? 3 : $config['verbosity'];
     self::$_logger->_verbosity = self::$_verbosity;
     self::$_dateformat = $config['date_format'] >= 1 && $cofig['date_format'] <= 3 ? intval($config['date_format']) : 1;
     //	set base URL (e.g. http://mysite.com/news/pommo => 'news/pommo/')
     if (isset($config['baseURL'])) {
         self::$_baseUrl = $config['baseURL'];
     } else {
         // 	If we're called from an embedded script, read baseURL from
         //	"last known good". Else, set it based off of REQUEST.
         if (defined('_poMMo_embed')) {
             require_once self::$_baseDir . 'classes/Pommo_Helper_Maintenance.php';
             self::$_baseUrl = Pommo_Helper_Maintenance::rememberBaseURL();
         } else {
             $regex = '@/(ajax|inc|setup|user|install|support(/tests|/util)?|' . 'admin(/subscribers|/user|/mailings|/setup)?' . '(/ajax|/mailing|/config)?)$@i';
             // This is to fix backslashes on windows systems
             $dirname = str_replace('\\', '/', dirname($_SERVER['PHP_SELF']));
             $baseUrl = preg_replace($regex, '', $dirname);
             self::$_baseUrl = $baseUrl == '/' ? $baseUrl : $baseUrl . '/';
         }
     }
     // read in config.php (configured by user)
     $config = Pommo_Helper::parseConfig(self::$_baseDir . 'config.php');
     //	check to see if config.php was "properly" loaded
     if (count($config) < 5) {
         self::$_hasConfigFile = false;
         return self::$_hasConfigFile;
     }
     self::$_hasConfigFile = true;
     //	the regex strips port info from hostname
     self::$_hostname = empty($config['hostname']) ? preg_replace('/:\\d+$/i', '', $_SERVER['HTTP_HOST']) : $config['hostname'];
     self::$_hostport = empty($config['hostport']) ? $_SERVER['SERVER_PORT'] : $config['hostport'];
     self::$_ssl = !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ? false : true;
     self::$_http = (self::$_ssl ? 'https://' : 'http://') . self::$_hostname;
     if (self::$_hostport != 80 && self::$_hostport != 443) {
         self::$_http .= ':' . self::$_hostport;
     }
     self::$_language = empty($config['lang']) ? 'en' : strtolower($config['lang']);
     self::$_slanguage = defined('_poMMo_lang') ? _poMMo_lang : false;
     //	include translation (l10n) methods if language is not English
     self::$_l10n = FALSE;
     if (self::$_language != 'en') {
         self::$_l10n = TRUE;
         require_once self::$_baseDir . 'classes/Pommo_Helper_L10n.php';
         Pommo_Helper_L10n::init(self::$_language, self::$_baseDir);
     }
     //	set the current "section" -- should be "user" for /user/* files,
     //	"mailings" for /admin/mailings/* files, etc. etc.
     self::$_section = preg_replace('@^admin/?@i', '', str_replace(self::$_baseUrl, '', dirname($_SERVER['PHP_SELF'])));
     $db_conn_compress = strtolower($config['db_conn_compress']) != 'on' ? 0 : MYSQL_CLIENT_COMPRESS;
     $db_conn_secure = strtolower($config['db_conn_secure']) != 'on' ? 0 : MYSQL_CLIENT_SSL;
     // 	initialize database link
     self::$_dbo = @new Pommo_Db($config['db_username'], $config['db_password'], $config['db_database'], $config['db_hostname'], $config['db_prefix'], $db_conn_compress, $db_conn_secure);
     // 	turn off debugging if in user area
     if (self::$_section == 'user') {
         self::$_debug = false;
         self::$_dbo->debug(FALSE);
     }
     // if debugging is set in config.php, enable debugging on the database.
     if (self::$_debug) {
         // don't enable debugging in ajax requests unless verbosity is < 3
         if (Pommo_Helper::isAjax() && self::$_verbosity > 2) {
             self::$_debug = false;
         } else {
             self::$_dbo->debug(TRUE);
         }
     }
     return true;
 }
开发者ID:soonick,项目名称:poMMo,代码行数:100,代码来源:Pommo.php

示例2: preInit

    public static function preInit($baseDir)
    {
        self::$_baseDir = $baseDir;
        self::$_config = array();
        self::$_auth = null;
        self::$_escaping = false;
        require_once self::$_baseDir . 'classes/Pommo_Log.php';
        require_once self::$_baseDir . 'lib/SafeSQL.class.php';
        require_once self::$_baseDir . 'classes/Pommo_Db.php';
        require_once self::$_baseDir . 'classes/Pommo_Auth.php';
        // 	initialize logger
        //	Check where this config variable comes from
        self::$_logger = new Pommo_Log();
        self::$_workDir = empty($config['workDir']) ? self::$_baseDir . 'cache' : $config['workDir'];
        self::$_debug = strtolower($config['debug']) != 'on' ? false : true;
        self::$_default_subscriber_sort = empty($config['default_subscriber_sort']) ? 'email' : $config['default_subscriber_sort'];
        self::$_verbosity = empty($config['verbosity']) ? 3 : $config['verbosity'];
        self::$_logger->_verbosity = self::$_verbosity;
        self::$_dateformat = $config['date_format'] >= 1 && $cofig['date_format'] <= 3 ? intval($config['date_format']) : 1;
        //	set base URL (e.g. http://mysite.com/news/pommo => 'news/pommo/')
        if (isset($config['baseURL'])) {
            self::$_baseUrl = $config['baseURL'];
        } else {
            // 	If we're called from an embedded script, read baseURL from
            //	"last known good". Else, set it based off of REQUEST.
            if (defined('_poMMo_embed')) {
                require_once self::$_baseDir . 'classes/Pommo_Helper_Maintenance.php';
                self::$_baseUrl = Pommo_Helper_Maintenance::rememberBaseURL();
            } else {
                $regex = '@/(ajax|inc|setup|user|install|support(/tests|/util)?|' . 'admin(/subscribers|/user|/mailings|/setup)?' . '(/ajax|/mailing|/config)?)$@i';
                $baseUrl = preg_replace($regex, '', dirname($_SERVER['PHP_SELF']));
                self::$_baseUrl = $baseUrl == '/' ? $baseUrl : $baseUrl . '/';
            }
        }
        // read in config.php (configured by user)
        $config = Pommo_Helper::parseConfig(self::$_baseDir . 'config.php');
        //	check to see if config.php was "properly" loaded
        if (count($config) < 5) {
            self::$_hasConfigFile = false;
            return self::$_hasConfigFile;
        }
        self::$_hasConfigFile = true;
        //	the regex strips port info from hostname
        self::$_hostname = empty($config['hostname']) ? preg_replace('/:\\d+$/i', '', $_SERVER['HTTP_HOST']) : $config['hostname'];
        self::$_hostport = empty($config['hostport']) ? $_SERVER['SERVER_PORT'] : $config['hostport'];
        self::$_ssl = !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ? false : true;
        self::$_http = (self::$_ssl ? 'https://' : 'http://') . self::$_hostname;
        if (self::$_hostport != 80 && self::$_hostport != 443) {
            self::$_http .= ':' . self::$_hostport;
        }
        self::$_language = empty($config['lang']) ? 'en' : strtolower($config['lang']);
        self::$_slanguage = defined('_poMMo_lang') ? _poMMo_lang : false;
        //	include translation (l10n) methods if language is not English
        self::$_l10n = FALSE;
        if (self::$_language != 'en') {
            self::$_l10n = TRUE;
            require_once self::$_baseDir . 'classes/Pommo_Helper_L10n.php';
            Pommo_Helper_L10n::init(self::$_language, self::$_baseDir);
        }
        //	make sure workDir is writable
        if (!is_dir(self::$_workDir . '/pommo/smarty')) {
            $wd = self::$_workDir;
            self::$_workDir = null;
            if (!is_dir($wd)) {
                Pommo::kill(sprintf(Pommo::_T('Work Directory (%s) not found!
						Make sure it exists and the webserver can write to it.
						You can change its location from the config.php file.'), $wd));
            }
            if (!is_writable($wd)) {
                Pommo::kill(sprintf(Pommo::_T('Cannot write to Work Directory
						(%s). Make sure it has the proper permissions.'), $wd));
            }
            if ('1' == ini_get('safe_mode')) {
                Pommo::kill(sprintf(Pommo::_T('Working Directory (%s) cannot be
						created under PHP SAFE MODE. See Documentation, or
						disable SAFE MODE.'), $wd));
            }
            if (!is_dir($wd . '/pommo')) {
                if (!mkdir($wd . '/pommo')) {
                    Pommo::kill(Pommo::_T('Could not create directory') . ' ' . $wd . '/pommo');
                }
            }
            if (!mkdir($wd . '/pommo/smarty')) {
                Pommo::kill(Pommo::_T('Could not create directory') . ' ' . $wd . '/pommo/smarty');
            }
            self::$_workdir = $wd;
        }
        //	set the current "section" -- should be "user" for /user/* files,
        //	"mailings" for /admin/mailings/* files, etc. etc.
        self::$_section = preg_replace('@^admin/?@i', '', str_replace(self::$_baseUrl, '', dirname($_SERVER['PHP_SELF'])));
        // 	initialize database link
        self::$_dbo = @new Pommo_Db($config['db_username'], $config['db_password'], $config['db_database'], $config['db_hostname'], $config['db_prefix']);
        // 	turn off debugging if in user area
        if (self::$_section == 'user') {
            self::$_debug = false;
            self::$_dbo->debug(FALSE);
        }
        // if debugging is set in config.php, enable debugging on the database.
        if (self::$_debug) {
            // don't enable debugging in ajax requests unless verbosity is < 3
//.........这里部分代码省略.........
开发者ID:systemfirez,项目名称:poMMo,代码行数:101,代码来源:Pommo.php


注:本文中的Pommo::_hostname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。