Phalcon Framework 3.3.2

Phalcon\Exception: Không tìm thấy tin đăng phù hợp

/home/vetinh/app/themes/blog/modules/ShopMbn/Controller/IndexController.php (114)
#0ShopMbn\Controller\IndexController->detailAction(ghe-tinh-yeu-khach-san-ghe-tinh-nhan, 4340)
#1Phalcon\Dispatcher->callActionMethod(Object(ShopMbn\Controller\IndexController), detailAction, Array([slug] => ghe-tinh-yeu-khach-san-ghe-tinh-nhan, [id] => 4340))
#2Phalcon\Dispatcher->dispatch()
/home/vetinh/app/Bootstrap.php (344)
<?php
 
namespace YonaCMS;
use Application\Cache\Manager as CacheManager;
use Cms\Model\Configuration;
 
/**
 * Bootstrap
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
 * @author Aleksandr Torosh <webtorua@gmail.com>
 */
 
if (APPLICATION_ENV == 'development') {
    date_default_timezone_set('Asia/Bangkok');
    ini_set('display_errors', true);
    error_reporting(E_ALL);
}
define('ROOT_APP', __DIR__);
 
class Bootstrap
{
 
    public function run()
    {
        $di = new \Phalcon\DI\FactoryDefault();
 
        // Config
        require_once LIBRARY_PATH . '/modules/Cms/ConfigApp.php';
        $config = \Cms\Config::get();
        $di->set('config', $config);
 
        // Registry
        $registry = new \Phalcon\Registry();
        $di->set('registry', $registry);
 
        // Loader
        $loader = new \Phalcon\Loader();
        $loader->registerNamespaces($config->loader->namespaces->toArray());
        $loader->registerDirs([LIBRARY_PATH . "/plugins/"]);
        $loader->registerFiles([APPLICATION_PATH . '/../vendor/autoload.php']);
        $loader->register();
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql([
            "host"     => DBHOST,
            "username" => DBUSERNAME,
            "password" => DBPASSWORD,
            "dbname"   => DBNAME,
            "charset"  => $config->database->charset,
        ]);
        $di->set('db', $db);
 
        // Get Option setting
        $di->set('options', new \YonaCMS\Plugin\Options());
        // Get Option setting
 
        // View
        $this->initView($di);
        $this->initSimpleView($di);
 
        // URL
        $url = new \Phalcon\Mvc\Url();
        $url->setBasePath($config->base_path);
        $url->setBaseUri($config->base_path);
        $di->set('url', $url);
 
        // Cache
        $this->initCache($di);
 
        // CMS
        $cmsModel = new \Cms\Model\Configuration();
        $registry->cms = $cmsModel->getConfig(); // Отправляем в Registry
 
        // Application
        $application = new \Phalcon\Mvc\Application();
        $application->registerModules($config->modules->toArray());
 
        // Events Manager, Dispatcher
        $this->initEventManager($di);
 
        // Session
        $session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        $di->set('session', $session);
 
        $acl = new \Application\Acl\DefaultAcl();
        $di->set('acl', $acl);
 
        // JS Assets
        $this->initAssetsManager($di);
 
        // Flash helper
        $flash = new \Phalcon\Flash\Session([
            'error'   => 'alert alert-danger',
            'success' => 'alert alert-success',
            'notice'  => 'alert alert-info',
            'warning' => 'alert alert-warning',
        ]);
        $flash->setAutoescape(false);
        $di->set('flash', $flash);
 
        $di->set('helper', new \Application\Mvc\Helper());
 
        // Routing
        $this->initRouting($application, $di);
 
        $application->setDI($di);
 
        // Main dispatching process
        $response = $this->dispatch($di);
        $response->send();
 
    }
 
    private function initRouting($application, $di)
    {
        $router = new \Application\Mvc\Router\DefaultRouter();
        $router->setDi($di);
        foreach ($application->getModules() as $module) {
            $routesClassName = str_replace('Module', 'Routes', $module['className']);
            if (class_exists($routesClassName)) {
                $routesClass = new $routesClassName();
                $router = $routesClass->init($router);
            }
            $initClassName = str_replace('Module', 'Init', $module['className']);
            if (class_exists($initClassName)) {
                new $initClassName();
            }
        }
        $di->set('router', $router);
    }
 
    private function initAssetsManager($di)
    {
        $config = $di->get('config');
        $assetsManager = new \Application\Assets\Manager();
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        // Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        // Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new \Application\Assets\Filter\Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . '/modules/Admin/assets/admin.less');
 
        $di->set('assets', $assetsManager);
    }
 
    private function initEventManager($di)
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher = new \Phalcon\Mvc\Dispatcher();
 
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \YonaCMS\Plugin\CheckPoint($di->get('request'));
            new \YonaCMS\Plugin\Localization($dispatcher);
            new \YonaCMS\Plugin\AdminLocalization($di->get('config'));
            new \YonaCMS\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            new \YonaCMS\Plugin\MobileDetect($di->get('session'), $di->get('view'), $di->get('request'));
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \YonaCMS\Plugin\Title($di);
        });
 
        // Profiler
        $registry = $di->get('registry');
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    private function initView($di)
    {
        $view = new \Phalcon\Mvc\View();
        $theme = THEME;
        define('MAIN_VIEW_PATH', ROOT_APP . "/themes/{$theme}/views/");
 
        /*$view->setViewsDir(MAIN_VIEW_PATH);
        $view->setPartialsDir(MAIN_VIEW_PATH . "/partials/");
        $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);*/
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions([
            'compiledPath' => APPLICATION_PATH . '/../data/cache/volt/',
            'compileAlways'     => (APPLICATION_ENV == 'development'),
        ]);
        $volt->initCompiler();
 
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
 
        return $view;
    }
 
    private function initSimpleView($di)
    {
        $view = new \Phalcon\Mvc\View\Simple();
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
        $di->set('simpleView', $view);
 
        return $view;
    }
 
    private function initCache($di)
    {
        $config = $di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 60,
            "prefix"   => HOST_HASH,
        ]);
 
        $cache = null;
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcache':
                $cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);
                break;
            case 'memcached':
                $cache = new \Phalcon\Cache\Backend\Libmemcached(
                    $cacheFrontend, [
                    "host" => $config->memcached->host,
                    "port" => $config->memcached->port,
                ]);
                break;
        }
        $di->set('cache', $cache, true);
        $di->set('modelsCache', $cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $di->set('modelsMetadata', $modelsMetadata);
 
        $di->set('cacheManager', new CacheManager());
    }
 
    private function dispatch($di)
    {
        $router = $di['router'];
 
        $router->handle();
 
        $view = $di['view'];
 
        $dispatcher = $di['dispatcher'];
 
        $response = $di['response'];
 
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
 
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        $ModuleClassName = $moduleName . '\Module';
        
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
 
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                // Errors catching
 
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
 
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setStatusCode(404, 'Not Found');
                    $view->partial('error/error404');
                } else {
                    $response->setStatusCode(503, 'Service Unavailable');
                    $view->partial('error/error503');
                }
 
                return $response;
            }
        }
 
        $view->render(
            $dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
 
        // AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
        if ($_ajax) {
            $contents = $view->getContent();
 
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
 
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
 
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
 
        return $response;
    }
 
}
#3YonaCMS\Bootstrap->dispatch(Object(Phalcon\Di\FactoryDefault))
/home/vetinh/app/Bootstrap.php (110)
<?php
 
namespace YonaCMS;
use Application\Cache\Manager as CacheManager;
use Cms\Model\Configuration;
 
/**
 * Bootstrap
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
 * @author Aleksandr Torosh <webtorua@gmail.com>
 */
 
if (APPLICATION_ENV == 'development') {
    date_default_timezone_set('Asia/Bangkok');
    ini_set('display_errors', true);
    error_reporting(E_ALL);
}
define('ROOT_APP', __DIR__);
 
class Bootstrap
{
 
    public function run()
    {
        $di = new \Phalcon\DI\FactoryDefault();
 
        // Config
        require_once LIBRARY_PATH . '/modules/Cms/ConfigApp.php';
        $config = \Cms\Config::get();
        $di->set('config', $config);
 
        // Registry
        $registry = new \Phalcon\Registry();
        $di->set('registry', $registry);
 
        // Loader
        $loader = new \Phalcon\Loader();
        $loader->registerNamespaces($config->loader->namespaces->toArray());
        $loader->registerDirs([LIBRARY_PATH . "/plugins/"]);
        $loader->registerFiles([APPLICATION_PATH . '/../vendor/autoload.php']);
        $loader->register();
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql([
            "host"     => DBHOST,
            "username" => DBUSERNAME,
            "password" => DBPASSWORD,
            "dbname"   => DBNAME,
            "charset"  => $config->database->charset,
        ]);
        $di->set('db', $db);
 
        // Get Option setting
        $di->set('options', new \YonaCMS\Plugin\Options());
        // Get Option setting
 
        // View
        $this->initView($di);
        $this->initSimpleView($di);
 
        // URL
        $url = new \Phalcon\Mvc\Url();
        $url->setBasePath($config->base_path);
        $url->setBaseUri($config->base_path);
        $di->set('url', $url);
 
        // Cache
        $this->initCache($di);
 
        // CMS
        $cmsModel = new \Cms\Model\Configuration();
        $registry->cms = $cmsModel->getConfig(); // Отправляем в Registry
 
        // Application
        $application = new \Phalcon\Mvc\Application();
        $application->registerModules($config->modules->toArray());
 
        // Events Manager, Dispatcher
        $this->initEventManager($di);
 
        // Session
        $session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        $di->set('session', $session);
 
        $acl = new \Application\Acl\DefaultAcl();
        $di->set('acl', $acl);
 
        // JS Assets
        $this->initAssetsManager($di);
 
        // Flash helper
        $flash = new \Phalcon\Flash\Session([
            'error'   => 'alert alert-danger',
            'success' => 'alert alert-success',
            'notice'  => 'alert alert-info',
            'warning' => 'alert alert-warning',
        ]);
        $flash->setAutoescape(false);
        $di->set('flash', $flash);
 
        $di->set('helper', new \Application\Mvc\Helper());
 
        // Routing
        $this->initRouting($application, $di);
 
        $application->setDI($di);
 
        // Main dispatching process
        $response = $this->dispatch($di);
        $response->send();
 
    }
 
    private function initRouting($application, $di)
    {
        $router = new \Application\Mvc\Router\DefaultRouter();
        $router->setDi($di);
        foreach ($application->getModules() as $module) {
            $routesClassName = str_replace('Module', 'Routes', $module['className']);
            if (class_exists($routesClassName)) {
                $routesClass = new $routesClassName();
                $router = $routesClass->init($router);
            }
            $initClassName = str_replace('Module', 'Init', $module['className']);
            if (class_exists($initClassName)) {
                new $initClassName();
            }
        }
        $di->set('router', $router);
    }
 
    private function initAssetsManager($di)
    {
        $config = $di->get('config');
        $assetsManager = new \Application\Assets\Manager();
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        // Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        // Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new \Application\Assets\Filter\Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . '/modules/Admin/assets/admin.less');
 
        $di->set('assets', $assetsManager);
    }
 
    private function initEventManager($di)
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher = new \Phalcon\Mvc\Dispatcher();
 
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \YonaCMS\Plugin\CheckPoint($di->get('request'));
            new \YonaCMS\Plugin\Localization($dispatcher);
            new \YonaCMS\Plugin\AdminLocalization($di->get('config'));
            new \YonaCMS\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            new \YonaCMS\Plugin\MobileDetect($di->get('session'), $di->get('view'), $di->get('request'));
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \YonaCMS\Plugin\Title($di);
        });
 
        // Profiler
        $registry = $di->get('registry');
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    private function initView($di)
    {
        $view = new \Phalcon\Mvc\View();
        $theme = THEME;
        define('MAIN_VIEW_PATH', ROOT_APP . "/themes/{$theme}/views/");
 
        /*$view->setViewsDir(MAIN_VIEW_PATH);
        $view->setPartialsDir(MAIN_VIEW_PATH . "/partials/");
        $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);*/
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions([
            'compiledPath' => APPLICATION_PATH . '/../data/cache/volt/',
            'compileAlways'     => (APPLICATION_ENV == 'development'),
        ]);
        $volt->initCompiler();
 
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
 
        return $view;
    }
 
    private function initSimpleView($di)
    {
        $view = new \Phalcon\Mvc\View\Simple();
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
        $di->set('simpleView', $view);
 
        return $view;
    }
 
    private function initCache($di)
    {
        $config = $di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 60,
            "prefix"   => HOST_HASH,
        ]);
 
        $cache = null;
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcache':
                $cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);
                break;
            case 'memcached':
                $cache = new \Phalcon\Cache\Backend\Libmemcached(
                    $cacheFrontend, [
                    "host" => $config->memcached->host,
                    "port" => $config->memcached->port,
                ]);
                break;
        }
        $di->set('cache', $cache, true);
        $di->set('modelsCache', $cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $di->set('modelsMetadata', $modelsMetadata);
 
        $di->set('cacheManager', new CacheManager());
    }
 
    private function dispatch($di)
    {
        $router = $di['router'];
 
        $router->handle();
 
        $view = $di['view'];
 
        $dispatcher = $di['dispatcher'];
 
        $response = $di['response'];
 
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
 
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        $ModuleClassName = $moduleName . '\Module';
        
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
 
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                // Errors catching
 
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
 
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setStatusCode(404, 'Not Found');
                    $view->partial('error/error404');
                } else {
                    $response->setStatusCode(503, 'Service Unavailable');
                    $view->partial('error/error503');
                }
 
                return $response;
            }
        }
 
        $view->render(
            $dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
 
        // AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
        if ($_ajax) {
            $contents = $view->getContent();
 
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
 
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
 
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
 
        return $response;
    }
 
}
#4YonaCMS\Bootstrap->run()
/home/vetinh/public/index.php (190)
<?php
 
chdir(dirname(__DIR__));
 
define('ROOT', __DIR__);
define('HOST_HASH', substr(md5($_SERVER['HTTP_HOST']), 0, 12));
 
if (isset($_SERVER['APPLICATION_ENV'])) {
    $applicationEnv = ($_SERVER['APPLICATION_ENV'] ? $_SERVER['APPLICATION_ENV'] : 'production');
} else {
    $applicationEnv = (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
}
 
define('APPLICATION_ENV', $applicationEnv);
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
define('BASE_URL', (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]");
$parts = parse_url($actual_link);
$admin = '/administrator';
$check = substr($parts['path'], 0, 14);
 
$theme = 'blog';
$vipPage = explode(".", $_SERVER['HTTP_HOST'])[0];
$dbname = 'vt_' . substr($vipPage, 0, 11);
 
if (APPLICATION_ENV != 'production') {
    define('DBHOST', 'localhost');
    define('DBUSERNAME', 'root');
    define('VIPPAGE', $vipPage);
    define('DBPASSWORD', '');
} else {
    define('DBHOST', 'localhost');
    define('DBUSERNAME', 'vt');
    define('VIPPAGE', $vipPage);
    define('DBPASSWORD', 'Vhb84WTtMR4RTx9C');
}
 
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql([
    "host"     => DBHOST,
    "username" => DBUSERNAME,
    "password" => DBPASSWORD,
    "dbname"   => 'vt_all',
    "charset"  => 'utf8',
     "port"     => 3306,
]);
 
$result = $connection->fetchOne(
    "SELECT * FROM vip_page WHERE vip_page = '"  . $vipPage . "'"
);
 
$connectDB = true;
if ($result){
    try {
        $con = new \Phalcon\Db\Adapter\Pdo\Mysql([
            "host"     => DBHOST,
            "username" => DBUSERNAME,
            "password" => DBPASSWORD,
            "dbname"   => $result['db_name'],
            "charset"  => 'utf8',
             "port"     => 3306,
        ]);
        define('DBNAME', $result['db_name']);
        $result = $con->fetchOne(
            "SELECT * FROM `cms_configuration` WHERE `key` = 'THEME'"
        );
        $theme = $result['value'];
        $con->close();
    } catch (Exception $e) {
       $connectDB = false;
    }
}
 
if(!$result || !$connectDB) {
 
    $url = 'https://api.muabannhanh.com/v2/page/detail';
    $params = array(
        'token' => '446659fe2aca2f692391efe011b6bf9c',
        'session_token' => 'cb2663ce82a9f4ba448ba435091e27bb',
        'vip_name' => $vipPage,
    );
    $url .= '?' . http_build_query($params);
    $defaults = array(
        CURLOPT_URL => $url,
        CURLOPT_HEADER => false,
        CURLOPT_TIMEOUT => 10,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_SSL_VERIFYHOST => false
    );
 
    $ch = curl_init();
    curl_setopt_array($ch, $defaults);
 
    $r = curl_exec($ch);
    curl_close($ch);
 
    $response = json_decode($r, true);
    if (!isset($response['status']) || $response['status'] == 400 || !isset($response['result'])) {
            http_response_code(404);
            include('web404/index.html'); // provide your own HTML for the error page
            die();
    }
    $pageDetail = $response['result'];
    
    $result = $connection->fetchAll(
        "SELECT * FROM vip_page WHERE db_name LIKE '"  . $dbname . "%'"
    );
    if (count($result) > 0) {
        $number = count($result) + 1;
        $dbname = $dbname . $number;
    }
  
    $re = $connection->query("CREATE DATABASE IF NOT EXISTS `" . $dbname . "`");
  if (!$re) {
     echo 'COULD NOT CREATE DATABASE';
    die;
  }
 
    $insert = $connection->insert(
        "vip_page",
        [$vipPage, $dbname],
        ["vip_page", "db_name"]
    );
 
    if (!$insert) {
        echo 'Cant add vip page'; die;
    }
    $connection->close();
    $command = 'mysql -uvt -pVhb84WTtMR4RTx9C ' . $dbname . ' < ' . __DIR__ . '/vt_default.sql';
    exec($command);
 
  // UPDATE PAGE DETAIL
  
 
    $config = array (
      'logo' => $pageDetail["avatar_url"],
      'sologan' => $pageDetail['name'],
      'desc' => $pageDetail['intro'],
      'keywords' => $pageDetail['intro'],
      'bg_search' => $pageDetail["cover_url"],
      'logo_footer' => $pageDetail["avatar_url"],
      'company_name' => $pageDetail['name'],
      'company_email' => $pageDetail['email'],
      'branch_1' => '',
      'branch_2' => '',
      'branch_3' => '',
      'facebook_link' => $pageDetail['url_facebook_page'],
      'MBN_link' => '',
      'twitter_link' => '',
      'pinterest_link' => '',
      'linkedin_link' => '',
      'gplus_link' => $pageDetail['url_google_plus'],
    );
    $config = serialize($config);
 
    $conn = new \Phalcon\Db\Adapter\Pdo\Mysql([
      "host"     => DBHOST,
      "username" => DBUSERNAME,
      "password" => DBPASSWORD,
      "dbname"   => $dbname,
      "charset"  => 'utf8',
       "port"     => 3306,
  ]);
 
     $sql = "UPDATE `cms_configuration` 
    SET `value` = '{$config}' 
    WHERE `cms_configuration`.`key` = 'global_option';";
     $conn->query($sql);
    $conn->close();
    define('FIRST_TIME', true);
    define('DBNAME', $dbname);
    file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/replace_db.php');
} else {
    define('FIRST_TIME', false);
}
 
define('THEME', $theme);
if ($check != $admin) {
    define('IS_ADMIN', false);
    define('APPLICATION_PATH', __DIR__ . '/../app');
    define('THEME_PATH', __DIR__ . '/../app/themes/' . $theme);
    require_once APPLICATION_PATH . '/Bootstrap.php';
} else {
    define('IS_ADMIN', true);
    define('APPLICATION_PATH', __DIR__ . '/../administrator');
    define('ADMINISTRATOR_PATH', __DIR__ . '/../administrator');
  require_once ADMINISTRATOR_PATH . '/Bootstrap.php';
}
define('LIBRARY_PATH', __DIR__ . '/../library');
$bootstrap = new YonaCMS\Bootstrap();
$bootstrap->run();
 
 
 
KeyValue
_url/shop/ghe-tinh-yeu-khach-san-ghe-tinh-nhan-id-4340.html
KeyValue
USERwww-data
HOME/var/www
HTTP_CONNECTIONKeep-Alive
HTTP_HOSTgiuongngucodiengiare.chatnhanh.com
HTTP_ACCEPT_ENCODINGbr,gzip
HTTP_IF_MODIFIED_SINCEFri, 20 Sep 2019 11:54:25 GMT
HTTP_ACCEPT_LANGUAGEen-US,en;q=0.5
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
PATH_INFO
GEOIP_LONGITUDE-71.1028
GEOIP_LATITUDE42.3646
GEOIP_CITY_CONTINENT_CODENA
GEOIP_POSTAL_CODE02139
GEOIP_CITYCambridge
GEOIP_REGIONMA
GEOIP_CITY_COUNTRY_NAMEUnited States
GEOIP_CITY_COUNTRY_CODE3USA
GEOIP_CITY_COUNTRY_CODEUS
REDIRECT_STATUS200
APPLICATION_ENVproduction
HTTPSon
SERVER_NAME~[a-z].chatnhanh.com
SERVER_PORT443
SERVER_ADDR192.168.200.83
REMOTE_PORT39180
REMOTE_ADDR18.207.254.88
SERVER_SOFTWAREnginx/1.9.14
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
DOCUMENT_ROOT/home/vetinh/public
DOCUMENT_URI/index.php
REQUEST_URI/shop/ghe-tinh-yeu-khach-san-ghe-tinh-nhan-id-4340.html
SCRIPT_NAME/index.php
SCRIPT_FILENAME/home/vetinh/public/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRING_url=/shop/ghe-tinh-yeu-khach-san-ghe-tinh-nhan-id-4340.html
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1590523515.5403
REQUEST_TIME1590523515
#Path
0/home/vetinh/public/index.php
1/home/vetinh/app/Bootstrap.php
2/home/vetinh/library/modules/Cms/ConfigApp.php
3/home/vetinh/app/config/environment/production.php
4/home/vetinh/app/config/global.php
5/home/vetinh/app/config/modules.php
6/home/vetinh/library/modules/Application/Loader/Modules.php
7/home/vetinh/library/config/modules.php
8/home/vetinh/vendor/autoload.php
9/home/vetinh/vendor/composer/autoload_real.php
10/home/vetinh/vendor/composer/ClassLoader.php
11/home/vetinh/vendor/composer/autoload_static.php
12/home/vetinh/vendor/symfony/polyfill-mbstring/bootstrap.php
13/home/vetinh/library/plugins/Options.php
14/home/vetinh/library/modules/Cms/Model/Configuration.php
15/home/vetinh/library/modules/Application/Mvc/View/Engine/Volt.php
16/home/vetinh/library/modules/Application/Widget/Proxy.php
17/home/vetinh/library/modules/Application/Cache/Manager.php
18/home/vetinh/library/modules/Application/Acl/DefaultAcl.php
19/home/vetinh/app/config/acl.php
20/home/vetinh/library/modules/Application/Assets/Manager.php
21/home/vetinh/library/modules/Application/Assets/Filter/Less.php
22/home/vetinh/library/modules/Application/Mvc/Helper.php
23/home/vetinh/library/modules/MenuBase/Helper/Menu.php
24/home/vetinh/library/modules/Application/Mvc/Router/DefaultRouter.php
25/home/vetinh/app/themes/blog/modules/Index/Routes.php
26/home/vetinh/library/modules/Application/Mvc/Helper/CmsCache.php
27/home/vetinh/app/themes/blog/modules/Seo/Routes.php
28/home/vetinh/app/themes/blog/modules/Admin/Routes.php
29/home/vetinh/app/themes/blog/modules/Post/Routes.php
30/home/vetinh/app/themes/blog/modules/ShopMbn/Routes.php
31/home/vetinh/app/themes/blog/modules/Search/Routes.php
32/home/vetinh/app/themes/blog/modules/Contact/Routes.php
33/home/vetinh/app/themes/blog/modules/Sitemap/Routes.php
34/home/vetinh/library/modules/Application/Utils/ModuleName.php
35/home/vetinh/app/themes/blog/modules/ShopMbn/Module.php
36/home/vetinh/library/plugins/CheckPoint.php
37/home/vetinh/library/plugins/Localization.php
38/home/vetinh/library/modules/Cms/Model/Translate.php
39/home/vetinh/library/plugins/AdminLocalization.php
40/home/vetinh/data/translations/admin/en.php
41/home/vetinh/library/plugins/Acl.php
42/home/vetinh/library/plugins/MobileDetect.php
43/home/vetinh/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php
44/home/vetinh/app/themes/blog/modules/ShopMbn/Controller/IndexController.php
45/home/vetinh/library/modules/FrontEnd/Controller/LoaderController.php
46/home/vetinh/library/modules/Application/Mvc/Controller.php
47/home/vetinh/library/modules/MenuBase/Model/Menu.php
48/home/vetinh/library/modules/Application/Mvc/Model/Model.php
49/home/vetinh/library/modules/ThemeBase/Model/Theme.php
50/home/vetinh/library/modules/Application/Mvc/Helper/Meta.php
Memory
Usage2097152