本文整理汇总了PHP中Preferences::site_prefs方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::site_prefs方法的具体用法?PHP Preferences::site_prefs怎么用?PHP Preferences::site_prefs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::site_prefs方法的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;
}
示例2: DB
$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;
$REGX = new Regex();
// ----------------------------------------------
// Set Site Preferences class - Needs DB Connection and Regex
// ----------------------------------------------
$PREFS->site_prefs($site_name);
unset($site_name);
$DB->show_queries = $PREFS->ini('show_queries') == 'y' ? TRUE : FALSE;
$DB->enable_cache = $PREFS->ini('enable_db_caching') == 'y' ? TRUE : FALSE;
$DB->debug = $PREFS->ini('debug') != 0 ? 1 : 0;
// Turn off caching if it's a CP or ACTION request
if (REQ == 'CP' or REQ == 'ACTION') {
$DB->enable_cache = FALSE;
}
// ----------------------------------------------
// Fetch input data: GET, POST, COOKIE, SERVER
// ----------------------------------------------
require PATH_CORE . 'core.input' . EXT;
$IN = new Input();
$IN->trim_input = isset($uri) ? TRUE : FALSE;
if (isset($global_vars) and is_array($global_vars)) {