'UP.Browser' => 'Windows CE', 'NetAnts' => 'Windows', ]; // https://github.com/ahmad-sa3d/php-useragent/blob/master/core/user_agent.php $arch_regex = '/\b(x86_64|x86-64|Win64|WOW64|x64|ia64|amd64|ppc64|sparc64|IRIX64)\b/ix'; $arch = preg_match($arch_regex, $user_agent) ? '64' : '32'; foreach ($os_array as $regex => $value) { if (preg_match('{\b(' . $regex . ')\b}i', $user_agent)) { return $value; // . ' x' . $arch } } return 'Unknown'; } public static function Convertnumber2persian($str) { return str_replace(range(0, 9), ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'], $str); }
// https://github.com/ahmad-sa3d/php-useragent/blob/master/core/user_agent.php $arch_regex = '/\b(x86_64|x86-64|Win64|WOW64|x64|ia64|amd64|ppc64|sparc64|IRIX64)\b/ix'; $arch = preg_match($arch_regex, $user_agent) ? '64' : '32'; foreach ($os_array as $regex => $value) { if (preg_match('{\b(' . $regex . ')\b}i', $user_agent)) { return $value; // . ' x' . $arch } } return 'Unknown'; }
$controller = Yii::$app->controller->id; $action = Yii::$app->controller->action->id; if ("$controller/$action" != 'site/error') { $ip = common\components\functions::IP(); $browser = \common\components\functions::getBrowser(); $os = \common\components\functions::getOS(); $hit = new \common\models\TblHits(); $hit->ip = $ip; $hit->page = Yii::$app->request->absoluteUrl; $hit->os = $os; $hit->osPhone = '-'; $hit->browser = $browser;
$event->sender = $this; } $event->handled = false; $event->name = $name; foreach ($eventHandlers as $handler) { $event->data = $handler[1]; call_user_func($handler[0], $event); // stop further handling if the event is handled if ($event->handled) { return; } } }
* @param Action $action the action to be executed. * @return bool whether the action should continue to be executed. */ public function beforeAction($action) { $event = new ActionEvent($action); $this->trigger(self::EVENT_BEFORE_ACTION, $event); return $event->isValid; } /** * This method is invoked right after an action within this module is executed. *
$modules = []; $runAction = true; // call beforeAction on modules foreach ($this->getModules() as $module) { if ($module->beforeAction($action)) { array_unshift($modules, $module); } else { $runAction = false; break; } }
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require 'source/common/config/main.php', require 'source/common/config/main-local.php', require 'source/frontend/config/main.php', require 'source/frontend/config/main-local.php' ); (new yii\web\Application($config))->run(); // Yii2Framework
$_SESSION = [ '__flash' => [], ];