예제 #1
0
파일: Log.php 프로젝트: dalinhuang/andyou
 /**
  * 记录日志
  */
 public static function record($paramArr)
 {
     $options = array('appName' => '', 'subId' => 0, 'objId' => 0, 'log' => '', 'userId' => false);
     if (is_array($paramArr)) {
         $options = array_merge($options, $paramArr);
     }
     extract($options);
     $idMap = ZOL_Config::get("Star/InnerApp", "ID");
     #顶级的分类
     if (!isset($idMap[$appName])) {
         return false;
     }
     $subIdMap = ZOL_Config::get("Star/InnerApp", "SUBID");
     #二级的分类
     #将subid从英文形式转换为数字
     if (isset($subIdMap[$appName]) && isset($subIdMap[$appName][$subId])) {
         $subId = $subIdMap[$appName][$subId]["id"];
     }
     $output = ZOL_Registry::get('response');
     #获得output对象
     #用户ID,如果没有传入,就从父类获得而用户ID
     if (!$userId) {
         $userId = $output->userId;
     }
     $item = array("appId" => $idMap[$appName]["id"], "subId" => $subId, "objId" => $objId, "content" => addslashes($log), "tm" => SYSTEM_TIME, "adder" => $userId, "pageType" => $output->pageType);
     Helper_Dao::insertItem(array('addItem' => $item, 'dbName' => "Db_Star", 'tblName' => "log_operations", 'debug' => 0));
     return true;
 }
예제 #2
0
파일: Front.php 프로젝트: dalinhuang/andyou
 public static function run()
 {
     ZOL_Registry::set('request', new ZOL_Request());
     $request = ZOL_Registry::get('request');
     ZOL_Registry::set('response', new ZOL_Response());
     $response = ZOL_Registry::get('response');
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $controller = ZOL_String::toValidVariableName($controller);
     $action = ZOL_String::toValidVariableName($action);
     if (empty($controller)) {
         throw new ZOL_Exception("The controller of '{$controller}' is empty in request!");
     }
     if (empty($action)) {
         throw new ZOL_Exception("The action of '{$action}' is empty in request!");
     }
     $controller = APP_NAME . '_Page_' . ucfirst($controller);
     //var_dump($controller);
     $page = new $controller($request, $response);
     self::$_page = $page;
     self::$_url = empty($_SERVER['SCRIPT_URL']) ? '' : $_SERVER['SCRIPT_URL'];
     self::$_cacheKey = self::getCacheKey();
     if ($page->isCache() && ($html = self::getCache())) {
         die($html);
     }
     if ($page->validate($request, $response)) {
         $actionMap = $page->getActionMapping();
         if (empty($actionMap)) {
             $action = 'do' . ucfirst($action);
             if (method_exists($page, $action)) {
                 $page->{$action}($request, $response);
             } else {
                 throw new ZOL_Exception("The function of '{$action}' does not exist in class '{$controller}'!");
             }
         } else {
             foreach ($actionMap[$action] as $methodName) {
                 $methodName = 'do' . ucfirst($methodName);
                 if (method_exists($page, $methodName)) {
                     $page->{$methodName}($request, $response);
                 } else {
                     throw new ZOL_Exception(' the function dose not exist:' . $methodName);
                 }
             }
         }
     }
     self::$_html = $response->display();
     $page->isCache() && self::setCache();
 }
예제 #3
0
파일: Front.php 프로젝트: dalinhuang/andyou
 /**
  * 显示消息提示页面
  */
 public static function showMsg($paramArr)
 {
     $options = array('message' => '', 'level' => 0, 'jumpSec' => 0, 'showClose' => false, 'jumpUrl' => array(), 'showBLack' => '', 'urlArr' => false, 'footerHtml' => '');
     if (is_array($paramArr)) {
         $options = array_merge($options, $paramArr);
     }
     extract($options);
     $output = ZOL_Registry::get('response');
     #获得output对象
     $output->footerCss = 'footerFixed';
     $output->header = $output->fetchCol("Part/Header");
     $output->footer = $output->fetchCol("Part/Footer");
     $output->message = $message;
     $output->options = $options;
     $output->showClose = $showClose;
     $output->showBLack = $showBLack;
     $output->footerHtml = $footerHtml;
     $output->setTemplate("Base/Prompt");
     #设置消息模板
     $output->display();
     exit;
 }
예제 #4
0
 public static function reset()
 {
     self::$_aProps = null;
 }
예제 #5
0
파일: Pdo.php 프로젝트: dalinhuang/andyou
 /**
  * 获得注释
  */
 public function getSqlComment()
 {
     if (!$this->sqlComment) {
         $typeStr = "WEB";
         $isCli = false;
         switch (ZOL_Request::resolveType()) {
             case ZOL_Request::CLI:
                 $typeStr = "CLI";
                 $isCli = true;
                 break;
             case ZOL_Request::AJAX:
                 $typeStr = "AJAX";
                 break;
             case ZOL_Request::BROWSER:
             default:
                 $typeStr = "WEB";
                 break;
         }
         if (ZOL_Registry::exists('request')) {
             $request = ZOL_Registry::get('request');
             $c = $request->getControllerName();
             $a = $request->getActionName();
         } else {
             $c = $a = "";
             if (!defined('APP_NAME')) {
                 define("APP_NAME", "");
             }
         }
         if ($isCli) {
             #如果是命令行执行
             $this->sqlComment = "/*" . $_SERVER["HOSTNAME"] . ":{$typeStr}:" . APP_NAME . ":c={$c}&a={$a}*/";
         } else {
             $this->sqlComment = "/*" . $_SERVER["HTTP_HOST"] . ":{$typeStr}:" . APP_NAME . ":c={$c}&a={$a}*/";
         }
     }
     return $this->sqlComment;
 }