本文整理汇总了PHP中osc_die函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_die函数的具体用法?PHP osc_die怎么用?PHP osc_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_die函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: osc_dbConnect
/**
* Establish a connection to the MySQL database.
*
* @param string server ip or name
* @param string database user
* @param string database password
* @param string datatabase name
*/
function osc_dbConnect()
{
$this->db = @new mysqli($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName);
if ($this->db->connect_error) {
if (!defined('OSC_INSTALLING')) {
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
$title = 'Osclass » Error connecting to database';
$message = 'Cannot connect to database. Check your configuration in <code>config.php</code> file.';
osc_die($title, $message);
}
$this->debug('Error connecting to \'' . $this->dbName . '\' (' . $this->db->connect_errno . ': ' . $this->db->connect_error . ')', false);
}
$this->db_errno = $this->db->connect_errno;
$this->debug('Connected to \'' . $this->dbName . '\': [DBHOST] = ' . $this->dbHost . ' | [DBUSER] = ' . $this->dbUser);
$this->db->set_charset('utf8');
}
示例2: file_get_contents
if (!defined('AUTO_UPGRADE')) {
if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
$sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
$conn = DBConnectionClass::newInstance();
$c_db = $conn->getOsclassDb();
$comm = new DBCommandClass($c_db);
$error_queries = $comm->updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
}
if (Params::getParam('skipdb') == '') {
if (!$error_queries[0]) {
$skip_db_link = osc_admin_base_url(true) . "?page=upgrade&action=upgrade-funcs&skipdb=true";
$title = __('Osclass » Has some errors');
$message = __("We've encountered some problems while updating the database structure. The following queries failed:");
$message .= "<br/><br/>" . implode("<br>", $error_queries[2]);
$message .= "<br/><br/>" . sprintf(__("These errors could be false-positive errors. If you're sure that is the case, you can <a href=\"%s\">continue with the upgrade</a>, or <a href=\"http://forums.osclass.org/\">ask in our forums</a>."), $skip_db_link);
osc_die($title, $message);
}
}
}
$aMessages = array();
osc_set_preference('last_version_check', time());
$conn = DBConnectionClass::newInstance();
$c_db = $conn->getOsclassDb();
$comm = new DBCommandClass($c_db);
if (osc_version() < 210) {
$comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'save_latest_searches', '0', 'BOOLEAN')", DB_TABLE_PREFIX));
$comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'purge_latest_searches', '1000', 'STRING')", DB_TABLE_PREFIX));
$comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'selectable_parent_categories', '1', 'BOOLEAN')", DB_TABLE_PREFIX));
$comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'ping_search_engines', '1', 'BOOLEAN')", DB_TABLE_PREFIX));
$comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'numImages@items', '0', 'BOOLEAN')", DB_TABLE_PREFIX));
$enableItemValidation = getBoolPreference('enabled_item_validation') ? 0 : -1;
示例3: define
define('CONTENT_PATH', ABS_PATH . 'oc-content/');
define('TRANSLATIONS_PATH', CONTENT_PATH . 'languages/');
require_once LIB_PATH . 'osclass/db.php';
require_once LIB_PATH . 'osclass/classes/DAO.php';
require_once LIB_PATH . 'osclass/model/Preference.php';
require_once LIB_PATH . 'osclass/helpers/hPreference.php';
require_once LIB_PATH . 'osclass/helpers/hDatabaseInfo.php';
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
require_once LIB_PATH . 'osclass/core/Session.php';
require_once LIB_PATH . 'osclass/helpers/hDefines.php';
require_once LIB_PATH . 'osclass/helpers/hLocale.php';
require_once LIB_PATH . 'osclass/install-functions.php';
isset($_REQUEST['step']) ? $step = (int) $_REQUEST['step'] : ($step = '1');
if (is_osclass_installed()) {
$message = 'You appear to have already installed OSClass. To reinstall please clear your old database tables first.';
osc_die('OSClass » Error', $message);
}
switch ($step) {
case 1:
$requirements = get_requirements();
$error = check_requirements($requirements);
break;
case 2:
if (isset($_REQUEST['save_stats'])) {
setcookie('osclass_save_stats', 1);
header('Location: ' . get_absolute_url() . 'oc-includes/osclass/install.php?step=2');
}
break;
case 3:
if (isset($_POST['dbname'])) {
$error = oc_install();
示例4: key
if (isset($locales['en_US'])) {
$current_locale = 'en_US';
} else {
$current_locale = key($locales);
}
}
Session::newInstance()->_set('userLocale', $current_locale);
Session::newInstance()->_set('adminLocale', $current_locale);
$translation = Translation::newInstance(true);
$step = Params::getParam('step');
if (!is_numeric($step)) {
$step = '1';
}
if (is_osclass_installed()) {
$message = __("Похоже у вас уже установлен OSClass. Для повторной установки очистите таблицы базы данных.");
osc_die('Ошибка » OSClass', $message);
}
switch ($step) {
case 1:
$requirements = get_requirements();
$error = check_requirements($requirements);
break;
case 2:
if (Params::getParam('save_stats') == '1' || isset($_COOKIE['osclass_save_stats'])) {
setcookie('osclass_save_stats', 1, time() + 24 * 60 * 60);
} else {
setcookie('osclass_save_stats', 0, time() + 24 * 60 * 60);
}
if (Params::getParam('ping_engines') == '1' || isset($_COOKIE['osclass_ping_engines'])) {
setcookie('osclass_ping_engines', 1, time() + 24 * 60 * 60);
} else {
示例5: connectToOsclassDb
/**
* Connect to Osclass database
*
* @access public
* @since 2.3
* @return boolean It returns true if the connection has been successful or false if not
*/
function connectToOsclassDb()
{
$conn = $this->_connectToDb($this->dbHost, $this->dbUser, $this->dbPassword, $this->db);
if ($conn == false) {
$this->errorConnection();
$this->releaseOsclassDb();
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
$title = 'Osclass » Error';
$message = 'Osclass database server is not available. <a href="http://forums.osclass.org/">Need more help?</a></p>';
osc_die($title, $message);
}
$this->_setCharset('utf8', $this->db);
if ($this->dbName == '') {
return true;
}
$selectDb = $this->selectOsclassDb();
if ($selectDb == false) {
$this->errorReport();
$this->releaseOsclassDb();
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
$title = 'Osclass » Error';
$message = 'Osclass database is not available. <a href="http://forums.osclass.org/">Need more help?</a></p>';
osc_die($title, $message);
}
return true;
}