Example #1
0
 public static function getModuleViewCached($division, $module, $method)
 {
     $params = func_get_args();
     if (Config::application('useCache') && !DEBUG) {
         $key = self::getCacheKeyForCall($params);
         $retValue = Memcache::remember($key, function () use($params) {
             return call_user_func_array(array('self', 'getModuleView'), $params);
         });
     } else {
         // [TODO]: cache 2 file
         //call_user_func_array(array(self,'getModuleView'),$params);
         $retValue = call_user_func_array(array('self', 'getModuleView'), $params);
     }
     return $retValue;
 }
Example #2
0
        if (Config::application('debug')) {
            echo '<tt>' . nl2br(htmlspecialchars("\n" . 'DEBUG Info: ' . $screenMsg)) . '</tt><br/>';
        } else {
            header('HTTP/1.1 500 Internal Server Error');
            include HTTPERRORS . '500.php';
        }
    }
    Log::add($message, 'core.module');
} catch (\Exception $exc) {
    $message = "\n" . 'error [' . $exc->getCode() . ']: ' . $exc->getMessage() . "\n\n" . $exc->getTraceAsString();
    $screenMsg = $message . "\n\n" . '$_GET: ' . print_r($_GET, true) . "\n" . '$_POST: ' . print_r($_POST, true);
    if ($mEngine !== null && $mEngine->responseType == ResponseType::rpc) {
        header('Content-type: text/xml; charset=' . Config::application('encoding'));
        echo XmlRpcResponse::fault($exc->getCode(), DEBUG ? $screenMsg : 'Internal Server Error.');
    } else {
        if (Config::application('debug')) {
            $error = htmlspecialchars($screenMsg);
        }
        if ($exc->getCode() == 1242 || $exc->getCode() == 1222) {
            header('HTTP/1.1 404 Not Found');
            include HTTPERRORS . '404.php';
        } else {
            header('HTTP/1.1 500 Internal Server Error');
            include HTTPERRORS . '500.php';
        }
    }
    if ($exc->getCode() == 1242) {
        Log::warning(' Request: ' . $_SERVER['REQUEST_URI'] . ' Referer: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 'core.notFound');
    } else {
        Log::add($message, 'core.module');
    }