in /home/canholyt/khonggianlytuong.com/main/phim/vendor/yiisoft/yii2/db/Connection.php at line 579
$token = 'Opening DB connection: ' . $this->dsn; try { Yii::info($token, __METHOD__); Yii::beginProfile($token, __METHOD__); $this->pdo = $this->createPdoInstance(); $this->initConnection(); Yii::endProfile($token, __METHOD__); } catch (\PDOException $e) { Yii::endProfile($token, __METHOD__); throw new Exception($e->getMessage(), $e->errorInfo, (int) $e->getCode(), $e); } } /** * Closes the currently active DB connection. * It does nothing if the connection is already closed. */ public function close() {
* Returns the PDO instance for the currently active master connection. * This method will open the master DB connection and then return [[pdo]]. * @return PDO the PDO instance for the currently active master connection. */ public function getMasterPdo() { $this->open(); return $this->pdo; } /** * Returns the currently active slave connection. * If this method is called the first time, it will try to open a slave connection when [[enableSlaves]] is true.
* is available and `$fallbackToMaster` is false. */ public function getSlavePdo($fallbackToMaster = true) { $db = $this->getSlave(false); if ($db === null) { return $fallbackToMaster ? $this->getMasterPdo() : null; } else { return $db->pdo; } } /**
public function quoteValue($str) { if (!is_string($str)) { return $str; } if (($value = $this->db->getSlavePdo()->quote($str)) !== false) { return $value; } else { // the driver doesn't support quote (e.g. oci) return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'"; } }
* @param string $value string to be quoted * @return string the properly quoted string * @see http://www.php.net/manual/en/function.PDO-quote.php */ public function quoteValue($value) { return $this->getSchema()->quoteValue($value); } /** * Quotes a table name for use in a query. * If the table name contains schema prefix, the prefix will also be properly quoted. * If the table name is already quoted or contains special characters including '(', '[[' and '{{',
$params = []; foreach ($this->params as $name => $value) { if (is_string($name) && strncmp(':', $name, 1)) { $name = ':' . $name; } if (is_string($value)) { $params[$name] = $this->db->quoteValue($value); } elseif ($value === null) { $params[$name] = 'NULL'; } elseif (!is_object($value) && !is_resource($value)) { $params[$name] = $value; } }
* @return mixed the method execution result * @throws Exception if the query causes any problem * @since 2.0.1 this method is protected (was private before). */ protected function queryInternal($method, $fetchMode = null) { $rawSql = $this->getRawSql(); Yii::info($rawSql, 'yii\db\Command::query'); if ($method !== '') { $info = $this->db->getQueryCacheInfo($this->queryCacheDuration, $this->queryCacheDependency); if (is_array($info)) {
* @return array|boolean the first row (in terms of an array) of the query result. False is returned if the query * results in nothing. * @throws Exception execution failed */ public function queryOne($fetchMode = null) { return $this->queryInternal('fetch', $fetchMode); } /** * Executes the SQL statement and returns the value of the first column in the first row of data. * This method is best used when only a single value is needed for a query. * @return string|null|boolean the value of the first column in the first row of the query result.
* If this parameter is not given, the `db` application component will be used. * @return array|boolean the first row (in terms of an array) of the query result. False is returned if the query * results in nothing. */ public function one($db = null) { return $this->createCommand($db)->queryOne(); } /** * Returns the query result as a scalar value. * The value returned will be the first column in the first row of the query results. * @param Connection $db the database connection used to generate the SQL statement.
* @return ActiveRecord|array|null a single row of query result. Depending on the setting of [[asArray]], * the query result may be either an array or an ActiveRecord object. Null will be returned * if the query results in nothing. */ public function one($db = null) { $row = parent::one($db); if ($row !== false) { $models = $this->populate([$row]); return reset($models) ?: null; } else { return null; }
return $category ? new CategoryObject($category) : null; } private function findItem($id_slug) { if(!($item = Item::find()->where(['or', 'item_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id_slug])->status(Item::STATUS_ON)->one())){ return null; } return new ItemObject($item); } }
} public function api_get($id_slug) { if(!isset($this->_item[$id_slug])) { $this->_item[$id_slug] = $this->findItem($id_slug); } return $this->_item[$id_slug]; } public function api_pagination() {
public static function __callStatic($method, $params) { $name = (new \ReflectionClass(self::className()))->getShortName(); if (!isset(self::$classes[$name])) { self::$classes[$name] = new static(); } return call_user_func_array([self::$classes[$name], 'api_' . $method], $params); } /** * Wrap text with liveEdit tags, which later will fetched by jquery widget * @param $text * @param $path
'text' => $text, 'items' => Catalog::items($array_items_get) ]); } public function actionChitiet($slug) { $item = Catalog::get($slug); if(!$item){ throw new NotFoundHttpException('Item not found.'); } $item_update = Item::find()->where('item_id = '.$item->id)->one(); $item_update->views = $item_update->views + 1; if(empty($item_update->data->thumbnail) and $item_update->image == ''){
'text' => $text, 'items' => Catalog::items($array_items_get) ]); } public function actionChitiet($slug) { $item = Catalog::get($slug); if(!$item){ throw new NotFoundHttpException('Item not found.'); } $item_update = Item::find()->where('item_id = '.$item->id)->one(); $item_update->views = $item_update->views + 1; if(empty($item_update->data->thumbnail) and $item_update->image == ''){
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$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); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
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(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/app/config/web.php'); (new yii\web\Application($config))->run();
$_GET = [ 'slug' => 'phim-hoat-hinh-hay-nhat-2018-ke-huy-diet-binh-doan-nguoi-may-t-buster-phim-hoat-hinh-3d', ]; $_SERVER = [ 'CONTEXT_DOCUMENT_ROOT' => '/home/canholyt/khonggianlytuong.com/main', 'CONTEXT_PREFIX' => '', 'DOCUMENT_ROOT' => '/home/canholyt/khonggianlytuong.com/main', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'HTTPS' => 'on', 'HTTP_ACCEPT' => '*/*', 'HTTP_HOST' => 'khonggianlytuong.com', 'HTTP_USER_AGENT' => 'claudebot', 'PATH' => '/bin:/usr/bin:/usr/local/php/bin', 'PHPRC' => '/home/canholyt', 'QUERY_STRING' => '', 'REDIRECT_HTTPS' => 'on', 'REDIRECT_SSL_TLS_SNI' => 'khonggianlytuong.com', 'REDIRECT_STATUS' => '200', 'REDIRECT_UNIQUE_ID' => 'ZgbcqEKK7P6Alpbkq_kWLQAAAI0', 'REDIRECT_URL' => '/phim/phim-hoat-hinh-hay-nhat-2018-ke-huy-diet-binh-doan-nguoi-may-t-buster-phim-hoat-hinh-3d', 'REMOTE_ADDR' => '54.86.180.90', 'REMOTE_HOST' => 'ec2-54-86-180-90.compute-1.amazonaws.com', 'REMOTE_PORT' => '49712', 'REQUEST_METHOD' => 'GET', 'REQUEST_SCHEME' => 'https', 'REQUEST_URI' => '/phim/phim-hoat-hinh-hay-nhat-2018-ke-huy-diet-binh-doan-nguoi-may-t-buster-phim-hoat-hinh-3d', 'SCRIPT_FILENAME' => '/home/canholyt/khonggianlytuong.com/main/phim/index.php', 'SCRIPT_NAME' => '/phim/index.php', 'SERVER_ADDR' => '128.199.252.51', 'SERVER_ADMIN' => 'webmaster@khonggianlytuong.com', 'SERVER_NAME' => 'khonggianlytuong.com', 'SERVER_PORT' => '443', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.4.48 (Unix) OpenSSL/1.0.2k-fips', 'SSL_TLS_SNI' => 'khonggianlytuong.com', 'UNIQUE_ID' => 'ZgbcqEKK7P6Alpbkq_kWLQAAAI0', 'PHP_SELF' => '/phim/index.php', 'REQUEST_TIME_FLOAT' => 1711725737.1214759, 'REQUEST_TIME' => 1711725737, ];