当前位置: 首页>>代码示例>>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;未经允许,请勿转载。