本文整理汇总了PHP中eZAppendWarningItem函数的典型用法代码示例。如果您正苦于以下问题:PHP eZAppendWarningItem函数的具体用法?PHP eZAppendWarningItem怎么用?PHP eZAppendWarningItem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eZAppendWarningItem函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eZMySQLiDB
function eZMySQLiDB($parameters)
{
$this->eZDBInterface($parameters);
if (!extension_loaded('mysqli')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'MySQLi extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('MySQLi extension was not found, the DB handler will not be initialized.', 'eZMySQLiDB');
return;
}
/// Connect to master server
if (!$this->DBWriteConnection) {
$connection = $this->connect($this->Server, $this->DB, $this->User, $this->Password, $this->SocketPath, $this->Charset, $this->Port);
if ($this->IsConnected) {
$this->DBWriteConnection = $connection;
}
}
// Connect to slave
if (!$this->DBConnection) {
if ($this->UseSlaveServer === true) {
$connection = $this->connect($this->SlaveServer, $this->SlaveDB, $this->SlaveUser, $this->SlavePassword, $this->SocketPath, $this->Charset, $this->SlavePort);
} else {
$connection = $this->DBWriteConnection;
}
if ($connection and $this->DBWriteConnection) {
$this->DBConnection = $connection;
$this->IsConnected = true;
}
}
// Initialize TempTableList
$this->TempTableList = array();
eZDebug::createAccumulatorGroup('mysqli_total', 'Mysql Total');
}
示例2: eZMySQLDB
function eZMySQLDB($parameters)
{
$this->eZDBInterface($parameters);
$this->CharsetMapping = array('iso-8859-1' => 'latin1', 'iso-8859-2' => 'latin2', 'iso-8859-8' => 'hebrew', 'iso-8859-7' => 'greek', 'iso-8859-9' => 'latin5', 'iso-8859-13' => 'latin7', 'windows-1250' => 'cp1250', 'windows-1251' => 'cp1251', 'windows-1256' => 'cp1256', 'windows-1257' => 'cp1257', 'utf-8' => 'utf8', 'koi8-r' => 'koi8r', 'koi8-u' => 'koi8u');
if (!extension_loaded('mysql')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'MySQL extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('MySQL extension was not found, the DB handler will not be initialized.', 'eZMySQLDB');
return;
}
/// Connect to master server
if (!$this->DBWriteConnection) {
$connection = $this->connect($this->Server, $this->DB, $this->User, $this->Password, $this->SocketPath, $this->Charset, $this->Port);
if ($this->IsConnected) {
$this->DBWriteConnection = $connection;
}
}
// Connect to slave
if (!$this->DBConnection) {
if ($this->UseSlaveServer === true) {
$connection = $this->connect($this->SlaveServer, $this->SlaveDB, $this->SlaveUser, $this->SlavePassword, $this->SocketPath, $this->Charset, $this->SlavePort);
} else {
$connection = $this->DBWriteConnection;
}
if ($connection and $this->DBWriteConnection) {
$this->DBConnection = $connection;
$this->IsConnected = true;
}
}
// Initialize TempTableList
$this->TempTableList = array();
eZDebug::createAccumulatorGroup('mysql_total', 'Mysql Total');
}
示例3: eZPostgreSQLDB
function eZPostgreSQLDB($parameters)
{
$this->eZDBInterface($parameters);
if (!extension_loaded('pgsql')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'PostgreSQL extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('PostgreSQL extension was not found, the DB handler will not be initialized.', 'eZPostgreSQLDB');
return;
}
eZDebug::createAccumulatorGroup('postgresql_total', 'Postgresql Total');
$ini = eZINI::instance();
$server = $this->Server;
$port = $this->Port;
$db = $this->DB;
$user = $this->User;
$password = $this->Password;
$connectString = self::connectString($this->Server, $this->Port, $this->DB, $this->User, $this->Password);
if ($ini->variable("DatabaseSettings", "UsePersistentConnection") == "enabled" && function_exists("pg_pconnect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', $ini->variable("DatabaseSettings", "UsePersistentConnection"), "using persistent connection");
// avoid automatic SQL errors
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_pconnect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_pconnect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
} else {
throw new eZDBNoConnectionException($server, $this->ErrorMessage, $this->ErrorNumber);
}
} else {
if (function_exists("pg_connect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', "using real connection", "using real connection");
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_connect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_connect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
} else {
$this->setError();
throw new eZDBNoConnectionException($server, $this->ErrorMessage, $this->ErrorNumber);
}
} else {
$this->IsConnected = false;
eZDebug::writeError("PostgreSQL support not compiled into PHP, contact your system administrator", "eZPostgreSQLDB");
}
}
}
示例4: checkFileUploads
function checkFileUploads()
{
$isFileUploadsEnabled = ini_get( 'file_uploads' ) != 0;
if ( !$isFileUploadsEnabled )
{
$isFileWarningAdded = $GLOBALS['eZBinaryFileTypeWarningAdded'];
if ( !isset( $isFileWarningAdded ) or
!$isFileWarningAdded )
{
eZAppendWarningItem( array( 'error' => array( 'type' => 'kernel',
'number' => eZError::KERNEL_NOT_AVAILABLE ),
'text' => ezpI18n::tr( 'kernel/classes/datatypes',
'File uploading is not enabled. Please contact the site administrator to enable it.' ) ) );
$GLOBALS['eZBinaryFileTypeWarningAdded'] = true;
}
}
}
示例5: redirect
/**
* Performs a redirection
*/
protected function redirect()
{
$GLOBALS['eZRedirection'] = true;
$ini = eZINI::instance();
$automaticRedirect = true;
if ($GLOBALS['eZDebugAllowed'] && ($redirUri = $ini->variable('DebugSettings', 'DebugRedirection')) !== 'disabled') {
if ($redirUri == "enabled") {
$automaticRedirect = false;
} else {
$uri = eZURI::instance(eZSys::requestURI());
$uri->toBeginning();
foreach ($ini->variableArray("DebugSettings", "DebugRedirection") as $redirUri) {
$redirUri = new eZURI($redirUri);
if ($redirUri->matchBase($uri)) {
$automaticRedirect = false;
break;
}
}
}
}
$redirectURI = eZSys::indexDir();
$moduleRedirectUri = $this->module->redirectURI();
if ($ini->variable('URLTranslator', 'Translation') === 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
$translatedModuleRedirectUri = $moduleRedirectUri;
if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
$moduleRedirectUri = $translatedModuleRedirectUri;
if (strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] !== '/') {
$moduleRedirectUri = '/' . $moduleRedirectUri;
}
}
}
if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
$redirectURI = $moduleRedirectUri;
} else {
$leftSlash = strlen($redirectURI) > 0 && $redirectURI[strlen($redirectURI) - 1] === '/';
$rightSlash = strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] === '/';
if (!$leftSlash && !$rightSlash) {
// Both are without a slash, so add one
$moduleRedirectUri = '/' . $moduleRedirectUri;
} else {
if ($leftSlash && $rightSlash) {
// Both are with a slash, so we remove one
$moduleRedirectUri = substr($moduleRedirectUri, 1);
}
}
$redirectURI .= $moduleRedirectUri;
}
eZStaticCache::executeActions();
eZDB::checkTransactionCounter();
if ($automaticRedirect) {
eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus());
} else {
// Make sure any errors or warnings are reported
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') {
if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) {
eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
}
if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) {
eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('site', $this->site);
$tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false);
$tpl->setVariable('redirect_uri', eZURI::encodeURL($redirectURI));
$templateResult = $tpl->fetch('design:redirect.tpl');
eZDebug::addTimingPoint("Script end");
eZDisplayResult($templateResult);
}
eZExecution::cleanExit();
}
示例6: eZAppendWarningItem
}
$meta['description'] = $metaDescription;
}
$site['uri'] = $oldURI;
$site['redirect'] = false;
$site['meta'] = $meta;
$site['version'] = eZPublishSDK::version();
$site['page_title'] = $module->title();
$tpl->setVariable("site", $site);
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') == 'enabled') {
// Make sure any errors or warnings are reported
if (isset($GLOBALS['eZDebugError']) and $GLOBALS['eZDebugError']) {
eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
}
if (isset($GLOBALS['eZDebugWarning']) and $GLOBALS['eZDebugWarning']) {
eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
}
}
if ($userObjectRequired) {
$currentUser = eZUser::currentUser();
$tpl->setVariable("current_user", $currentUser);
$tpl->setVariable("anonymous_user_id", $ini->variable('UserSettings', 'AnonymousUserID'));
} else {
$tpl->setVariable("current_user", false);
$tpl->setVariable("anonymous_user_id", false);
}
$tpl->setVariable("access_type", $access);
if (empty($warningList)) {
$warningList = false;
}
$tpl->setVariable('warning_list', $warningList);
示例7: eZOracleTracing50DB
/**
* Creates a new eZOracleDB object and connects to the database.
*/
function eZOracleTracing50DB($parameters)
{
$this->eZDBInterface($parameters);
if (!extension_loaded('oci8')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'Oracle extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('Oracle extension was not found, the DB handler will not be initialized.', 'eZOracleDB');
return;
}
//$server = $this->Server;
$user = $this->User;
$password = $this->Password;
$db = $this->DB;
$this->ErrorMessage = false;
$this->ErrorNumber = false;
$this->IgnoreTriggerErrors = false;
$ini = eZINI::instance();
if (function_exists("oci_connect")) {
$this->Mode = OCI_COMMIT_ON_SUCCESS;
// translate chosen charset to its Oracle analogue
$oraCharset = null;
if (isset($this->Charset) && $this->Charset !== '') {
if (array_key_exists($this->Charset, $this->CharsetsMap)) {
$oraCharset = $this->CharsetsMap[$this->Charset];
}
}
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
if ($ini->variable("DatabaseSettings", "UsePersistentConnection") == "enabled") {
eZDebugSetting::writeDebug('kernel-db-oracle', $ini->variable("DatabaseSettings", "UsePersistentConnection"), "using persistent connection");
eZPerfLogger::accumulatorStart('oracle_connection', 'oracle_total', 'Database connection');
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
try {
$this->DBConnection = oci_pconnect($user, $password, $db, $oraCharset);
} catch (ErrorException $e) {
}
eZPerfLogger::accumulatorStop('oracle_connection');
eZDebug::setHandleType($oldHandling);
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
eZPerfLogger::accumulatorStart('oracle_connection', 'oracle_total', 'Database connection');
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
try {
$this->DBConnection = oci_pconnect($user, $password, $db, $oraCharset);
} catch (ErrorException $e) {
}
eZPerfLogger::accumulatorStop('oracle_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
} else {
eZDebugSetting::writeDebug('kernel-db-oracle', "using real connection", "using real connection");
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZPerfLogger::accumulatorStart('oracle_connection', 'oracle_total', 'Database connection');
try {
$this->DBConnection = oci_connect($user, $password, $db, $oraCharset);
} catch (ErrorException $e) {
}
eZPerfLogger::accumulatorStop('oracle_connection');
eZDebug::setHandleType($oldHandling);
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZPerfLogger::accumulatorStart('oracle_connection', 'oracle_total', 'Database connection');
try {
$this->DBConnection = @oci_connect($user, $password, $db, $oraCharset);
} catch (ErrorException $e) {
}
eZPerfLogger::accumulatorStop('oracle_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
}
// OCIInternalDebug(1);
if ($this->DBConnection === false) {
$this->IsConnected = false;
} else {
$this->IsConnected = true;
// make sure the decimal separator is the dot
$this->query("ALTER SESSION SET NLS_NUMERIC_CHARACTERS='. '");
}
if ($this->DBConnection === false) {
$error = oci_error();
// workaround for bug in PHP oci8 extension
if ($error === false && !getenv("ORACLE_HOME")) {
$error = array('code' => -1, 'message' => 'ORACLE_HOME environment variable is not set');
}
if ($error['code'] != 0) {
if ($error['code'] == 12541) {
$error['message'] = 'No listener (probably the server is down).';
}
$this->ErrorMessage = $error['message'];
$this->ErrorNumber = $error['code'];
eZDebug::writeError("Connection error(" . $error["code"] . "):\n" . $error["message"] . " ", "eZOracleDB");
//.........这里部分代码省略.........
示例8: eZPostgreSQLDB
function eZPostgreSQLDB($parameters)
{
$this->eZDBInterface($parameters);
if (!extension_loaded('pgsql')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'PostgreSQL extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('PostgreSQL extension was not found, the DB handler will not be initialized.', 'eZPostgreSQLDB');
return;
}
$ini = eZINI::instance();
$server = $this->Server;
$port = $this->Port;
$db = $this->DB;
$user = $this->User;
$password = $this->Password;
$connectParams = array();
if ($server !== false and $server !== null) {
$connectParams[] = "host='{$server}'";
}
if ($db !== false and $db !== null) {
$connectParams[] = "dbname='{$db}'";
}
if ($user !== false and $user !== null) {
$connectParams[] = "user='{$user}'";
}
if ($password !== false and $password !== null) {
$connectParams[] = "password='{$password}'";
}
if ($port) {
$connectParams[] = "port='{$port}'";
}
$connectString = implode(" ", $connectParams);
if ($ini->variable("DatabaseSettings", "UsePersistentConnection") == "enabled" && function_exists("pg_pconnect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', $ini->variable("DatabaseSettings", "UsePersistentConnection"), "using persistent connection");
$this->DBConnection = pg_pconnect($connectString);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$this->DBConnection = pg_pconnect($connectString);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
}
// add error checking
// eZDebug::writeError( "Error: could not connect to database." . pg_last_error( $this->DBConnection ), "eZPostgreSQLDB" );
} else {
if (function_exists("pg_connect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', "using real connection", "using real connection");
$this->DBConnection = pg_connect($connectString);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$this->DBConnection = pg_connect($connectString);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
} else {
throw new eZDBNoConnectionException($server);
}
} else {
$this->IsConnected = false;
eZDebug::writeError("PostgreSQL support not compiled into PHP, contact your system administrator", "eZPostgreSQLDB");
}
}
}