當前位置: 首頁>>代碼示例>>PHP>>正文


PHP I2CE::siteInitialized方法代碼示例

本文整理匯總了PHP中I2CE::siteInitialized方法的典型用法代碼示例。如果您正苦於以下問題:PHP I2CE::siteInitialized方法的具體用法?PHP I2CE::siteInitialized怎麽用?PHP I2CE::siteInitialized使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在I2CE的用法示例。


在下文中一共展示了I2CE::siteInitialized方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateSite

 /**
  * Controls the site update
  * @param string $site_module_file
  * @param boolean $verbose_errors.  Defaults to true
  */
 public static function updateSite($site_module_file, $verbose_errors = true)
 {
     if (!self::isAuthorizedToUpdate()) {
         return false;
     }
     I2CE::longExecution();
     $site_module_file = I2CE_FileSearch::absolut($site_module_file, 1);
     I2CE::siteInitialized(false);
     if (self::_updateSite($site_module_file, $verbose_errors)) {
         $config = I2CE::getConfig();
         $config->__set("/config/site/installation", 'done');
         if (array_key_exists('HTTP_HOST', $_SERVER)) {
             if (array_key_exists('request', $_GET)) {
                 $url = $_GET['request'];
             } else {
                 $url = I2CE::getAccessedBaseURL();
             }
             echo "<br/><span style='color:#993300'>Site was succesully updated.  Continue on to your <a href='{$url}'>site</a>?</span>";
             $msg = "Site was succesully updated.  Continue on to your site?";
             echo "<script type='text/javascript'>if (confirm('{$msg}')) {setTimeout(function() {window.location= '{$url}';},500)}</script>";
             //reload the requested page after 5 seconds
             flush();
             exit;
         } else {
             echo "Site was succesully updated\n";
             $enable = preg_split('/,/', I2CE::getRuntimeVariable('enable', ''), -1, PREG_SPLIT_NO_EMPTY);
             $disable = preg_split('/,/', I2CE::getRuntimeVariable('disable', ''), -1, PREG_SPLIT_NO_EMPTY);
             if (count($enable) + count($disable) > 0) {
                 $succ = self::updateModules($enable, $disable);
                 I2CE::siteInitialized(false);
                 return $succ;
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
 }
開發者ID:apelon-ohie,項目名稱:ihris-site,代碼行數:44,代碼來源:I2CE_Updater.php

示例2: raiseError

 /**
  * Raise an error and redirect the user for any critical errors.
  * 
  * The default redirect will go to the home page for the site.
  * @param string/mixed $message The error message.
  * @param integer $type The error type.
  * @param string $redirect The page to redirect to for critical errors.
  * @global array
  */
 public static function raiseError($message = null, $type = E_USER_NOTICE, $redirect = "")
 {
     if ($message === null) {
         if (!is_null($e = error_get_last())) {
             if (substr($e['message'], 0, 19) == "Allowed memory size") {
                 // Memory limit has been reached so display
                 // something if we still can.
                 print_r($e);
             }
             foreach (self::$ignoreErrors as $part) {
                 if (strpos($e['message'], $part) !== false) {
                     return;
                 }
             }
             foreach (self::$ignoreErrorsFromFilesMatching as $part) {
                 if (strpos($e['file'], $part) !== false) {
                     return;
                 }
             }
             $message = "Fatal Error:" . print_r($e, true);
         } else {
             return;
         }
         if (array_key_exists('HTTP_HOST', $_SERVER)) {
             $contents = preg_replace('/{{ERRORMESSAGE}}/', htmlentities($message), self::$badness);
             if (is_array(self::$stored_messages)) {
                 $trace = array();
                 foreach (self::$stored_messages as $i => $m) {
                     if (!is_array($m) || !array_key_exists('msg', $m) || !$m['msg']) {
                         continue;
                     }
                     $trace[] = $m['trace'] . "\n" . $m['msg'] . "\n";
                 }
                 $trace = htmlentities(print_r($trace, true));
             } else {
                 $trace = '';
             }
             $contents = preg_replace('/{{ERRORTRACE}}/', $trace, $contents);
             if (is_string(I2CE::$email) && strlen(I2CE::$email) > 0) {
                 $email = I2CE::$email;
             } else {
                 $email = 'hris@capacityplus.org';
             }
             $contents = preg_replace('/{{EMAIL}}/', htmlentities($email), $contents);
             $contents = preg_replace('/{{REQUESTURI}}/', htmlentities($_SERVER['REQUEST_URI']), $contents);
             echo $contents;
             echo self::$errorImage;
             flush();
         }
     }
     $num = self::$error_num++;
     $warning_level = 'Warning';
     if (array_key_exists($type, self::$errorType)) {
         $warning_level = self::$errorType[$type];
     }
     if (self::$trace_depth == 0) {
         $trace = 'I2CE: ';
     } else {
         $debug = debug_backtrace();
         $trace = 'I2CE: ' . self::getPrevMethod($debug, 1, self::$trace_depth) . ':';
     }
     if (count(self::$errorHandler) > 0) {
         call_user_func(self::$errorHandler[0], $trace, $message, $type);
     } else {
         if (array_key_exists('HTTP_HOST', $_SERVER)) {
             error_log($trace . $message . "\nError Type=" . $type, 0);
             if (in_array($type, self::$noticeErrors)) {
                 $msg_level = '<b style="display:block;">' . $warning_level . '</b>';
             } else {
                 self::$site_warnings++;
                 $msg_level = '<b style="display:block;color:red">' . $warning_level . '</b>';
             }
             $js_message = '<script type="text/javascript">addMessage("' . str_replace("\n", '<br/>', addcslashes($msg_level . $message, '"\\')) . '","' . str_replace("\n", '<br/>', addcslashes(rtrim($trace, "\n\t :"), '"\\')) . '");</script>' . "\n";
             if (in_array($type, self::$noticeErrors)) {
                 //a notice error
                 if (I2CE::siteInitialized()) {
                     self::$stored_messages[] = array('msg' => $message, 'trace' => $trace, 'level' => $msg_level);
                 } else {
                     if (!self::$started_errors) {
                         echo self::$errorStart;
                         echo self::$errorImage;
                         self::$started_errors = true;
                     }
                     echo $js_message;
                     flush();
                 }
             } else {
                 if (!I2CE::siteInitialized()) {
                     //we have a non notice error
                     //show any stored messages or warnings to give the user a clue as to what is going on
                     if (!self::$started_errors) {
//.........這裏部分代碼省略.........
開發者ID:apelon-ohie,項目名稱:ihris-site,代碼行數:101,代碼來源:I2CE_Error_5_2.php


注:本文中的I2CE::siteInitialized方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。