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


PHP Preferences::ini方法代码示例

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


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

示例1: INT

 function do_update()
 {
     global $DB, $UD, $conf, $REGX;
     $Q[] = "ALTER TABLE `exp_search` CHANGE `query` `query` MEDIUMTEXT NULL DEFAULT NULL";
     $Q[] = "ALTER TABLE `exp_search` CHANGE `custom_fields` `custom_fields` MEDIUMTEXT NULL DEFAULT NULL";
     $Q[] = "ALTER TABLE `exp_templates` ADD `last_author_id` INT(10) UNSIGNED NOT NULL AFTER `edit_date`";
     $Q[] = "ALTER TABLE `exp_revision_tracker` ADD `item_author_id` INT(10) UNSIGNED NOT NULL AFTER `item_date`";
     $query = $DB->query('SHOW FIELDS FROM exp_weblog_data');
     foreach ($query->result as $row) {
         if (strncmp($row['Field'], 'field_ft', 8) == 0) {
             $Q[] = "ALTER TABLE `exp_weblog_data` CHANGE `{$row['Field']}` `{$row['Field']}` TINYTEXT NULL";
         }
     }
     // run our queries
     foreach ($Q as $sql) {
         $DB->query($sql);
     }
     // for the benefit of Mr Kite! Okay, for the benefit of the Prefs class.
     if (!defined('REQ')) {
         define('REQ', 'UPDATE');
     }
     require PATH_CORE . 'core.regex' . EXT;
     $REGX = new Regex();
     require PATH_CORE . 'core.prefs' . EXT;
     // We need to add a new template preference, so we'll fetch the existing site template prefs
     $query = $DB->query("SELECT site_name, site_id, site_template_preferences FROM exp_sites");
     foreach ($query->result as $row) {
         $PREFS = new Preferences();
         $PREFS->site_prefs($row['site_name'], $row['site_id']);
         $prefs = $this->array_stripslashes(unserialize($row['site_template_preferences']));
         // Add our new pref to the array
         $prefs['strict_urls'] = $PREFS->ini('site_404') == FALSE ? 'n' : 'y';
         // Update the DB
         $DB->query($DB->update_string('exp_sites', array('site_template_preferences' => addslashes(serialize($prefs))), "site_id = '" . $row['site_id'] . "'"));
     }
     return TRUE;
 }
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:37,代码来源:ud_165.php

示例2: Preferences

// ----------------------------------------------
//  Instantiate the Preferences class
// ----------------------------------------------
require PATH_CORE . 'core.prefs' . EXT;
$PREFS = new Preferences();
// Assign the config file array to the preferences
// class so we can transport it as an object
$PREFS->core_ini = $conf;
$PREFS->default_ini = $conf;
$PREFS->exceptions = $exceptions;
unset($conf);
unset($exceptions);
// ----------------------------------------------
//  Connect to the database
// ----------------------------------------------
if (!in_array($PREFS->ini('db_type'), array('mysql'))) {
    return FALSE;
}
require PATH_DB . 'db.' . $PREFS->ini('db_type') . EXT;
$db_config = array('hostname' => $PREFS->ini('db_hostname'), 'username' => $PREFS->ini('db_username'), 'password' => $PREFS->ini('db_password'), 'database' => $PREFS->ini('db_name'), 'prefix' => $PREFS->ini('db_prefix'), 'conntype' => $PREFS->ini('db_conntype'), 'debug' => $PREFS->ini('debug') != 0 ? 1 : 0, 'show_queries' => TRUE, 'enable_cache' => FALSE);
$DB = new DB($db_config);
if (!$DB->db_connect(0)) {
    exit("Database Error:  Unable to connect to your database. Your database appears to be turned off or the database connection settings in your config file are not correct. Please contact your hosting provider if the problem persists.");
}
if (!$DB->select_db()) {
    exit("Database Error:  Unable to select your database");
}
// ----------------------------------------------
//  Instantiate the regular expressions class
// ----------------------------------------------
require PATH_CORE . 'core.regex' . EXT;
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:31,代码来源:core.system.php


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