Пример #1
0
<?php

require dirname(__FILE__) . '/init.php';
## log page runtime
define('SLOWPAGELOG', true);
define('SLOWPAGELOGPATH', '/alidata1/www/logs/');
define('SLOWPAGELOGTIME', '0.5');
Runtime::logRunTime();
register_shutdown_function(array('Runtime', 'logRunTime'));
abstract class controller
{
    protected $actionData = array();
    ## xhprof
    protected $xhprofRandNum = 0;
    public function __construct()
    {
        $this->xhprofRandNum = mt_rand(1, 1000);
        $this->getActionData();
        $this->checkFilters();
        $this->getAppVertion();
        $this->getLanguage();
        //$this->startXhprof();
        $this->action();
        //$this->endXhprof();
    }
    protected function getAppVertion()
    {
        $userAgent = @$_SERVER['HTTP_USER_AGENT'];
        if ($userAgent != "") {
            $agentArr = explode('/', $userAgent);
            $version = str_pad(str_replace('.', '', @$agentArr[1]), 9, 0) + 0;