當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。