Phalcon Framework 3.4.4

ArgumentCountError: Too few arguments to function Application\Mvc\Helper\Breadcrumbs::add(), 1 passed in /home/picture/public_html/app/modules/Photo/Controller/IndexController.php on line 209 and exactly 2 expected

/home/picture/public_html/app/modules/Application/Mvc/Helper/Breadcrumbs.php (24)
#0Application\Mvc\Helper\Breadcrumbs->add(Thông tin liên hệ)
/home/picture/public_html/app/modules/Photo/Controller/IndexController.php (209)
<?php
 
namespace Photo\Controller;
 
use Application\Mvc\Controller;
use Photo\Model\Photo360;
use Photo\Model\Album;
use Google_Client;
use Google_Service_Drive;
use Google_Service_Exception;
use Phalcon\Mvc\View;
 
class IndexController extends Controller {
 
    private static $album_slug_session = 'view_album_slug';
 
    public function initialize() {
        $moduleName = $this->helper->translate('Photo');
        $this->helper->title($moduleName);
        $this->helper->bc()->add($moduleName, '#');
    }
 
    public function indexAction() {
        
    }
 
    public function photo360Action() {
        $slug = $this->dispatcher->getParam('uri');
        $model = Photo360::findFirst(["uri='$slug'"]);
        if (!$model || $model->getStatus() == Photo360::$DISABLE) {
            $this->flash->warning($this->helper->translate("Data not found"));
            return $this->response->redirect($this->url->get());
        }
        $this->helper->title()->prepend($model->getName());
        $this->view->setMainView(MAIN_VIEW_PATH . 'photo360');
        $this->view->setLayout("");
        $this->view->bodyClass = "photo360-page photo360-page-{$model->getId()}";
        if ($model->getNavbar() == 'none') {
            $this->view->extra_style = ".psv-navbar{display:none;}";
        }
        $this->view->photo360_data = $model->buildScript();
    }
 
    public function albumAction() {
        $slug = $this->dispatcher->getParam('uri');
        $model = Album::findFirst(["uri='$slug'"]);
        if (!$model || $model->getStatus() == Album::$DISABLE) {
            $this->flash->warning($this->helper->translate("Data not found"));
            return $this->response->redirect($this->url->get());
        }
 
        if ($model->getRequiredSession()) {
            if (!$this->auth->isViewer()) {
                $this->session->set(self::$album_slug_session, $model->getUri());
                return $this->response->redirect($this->url->get(['for' => 'album_view_required']));
            }
        }
        $this->helper->title()->prepend($model->getName());
        $this->helper->bc()->add($model->getNamePath(), true);
        /* $key = 'album-' . $slug;
          $exists = $this->view->getCache()->exists($key);
          if (!$exists) { */
 
        $albumcachekey = HOST_HASH . md5("Album::find(parent={$model->getId()})");
        $album_childs = $this->cache->get($albumcachekey);
        if ($album_childs === null) {
            $album_child = Album::find([
                        "status=:status: AND parent=:parent:",
                        "bind" => [
                            "status" => Album::$ACTIVE,
                            "parent" => $model->getId()
                        ],
                        "order" => "sticky DESC"
            ]);
            $album_childs = array();
            foreach($album_child as $al){
                $image = $this->helper->iTool()->resize($al->getFeatureImage(), 500, 310);
                $al->setFeatureImage($image);
                $album_childs[] = $al;
            }
            $this->cache->save($albumcachekey, $album_childs);
        }
 
        if (count($album_childs)) {
            $this->view->album_child = $album_childs;
        }
 
        if ($model->getParent()) {
            $parentAlbum = Album::findFirst($model->getParent());
            $this->view->album_parent = $parentAlbum;
        }
 
        if ($model->getDriveId()) {
 
            $client = $this->getGoogleClient();
            $service = new Google_Service_Drive($client);
            $optParams = array(
                'q' => "'{$model->getDriveId()}' in parents AND mimeType contains 'image/'",
                'pageSize' => $this->registry->cms['PAGE_SIZE'],
                'fields' => 'nextPageToken, files(id, name, spaces, hasThumbnail,thumbnailLink)'
            );
            try {
                $results = $service->files->listFiles($optParams);
            } catch (Google_Service_Exception $exc) {
                $errors = json_decode($exc->getMessage());
                foreach ($errors as $e) {
                    $this->flash->error("{$e->code} - {$e->message}");
                    break;
                }
            }
            $this->view->results = $results;
        }
        $this->view->album = $model;
        /* }
          $this->view->cache(array("key" => $key)); */
    }
 
    public function loadmoreAction() {
        $this->view->disable();
        $data = array(
            "status" => 0,
            "data" => "",
        );
        if ($this->request->isPost()) {
            $album_id = $this->request->getPost("album_id");
            $pageToken = $this->request->getPost("next_page_token");
            $model = Album::findFirst("id={$album_id}");
            if ($model) {
                $client = $this->getGoogleClient();
                $service = new Google_Service_Drive($client);
                $optParams = array(
                    'q' => "'{$model->getDriveId()}' in parents AND mimeType contains 'image/'",
                    'pageSize' => $this->registry->cms['PAGE_SIZE'],
                    'fields' => 'nextPageToken, files(id, name, spaces, hasThumbnail,thumbnailLink)',
                    'pageToken' => $pageToken
                );
                try {
                    $results = $service->files->listFiles($optParams);
                    $this->view->setPartialsDir("");
                    $imageContainer = \Application\Utils\Hash::generateHash(8);
                    $this->view->partial("index/loadmore", ['results' => $results, 'album' => $model, 'imageContainer' => $imageContainer]);
                    $html = ob_get_contents();
                    $this->view->finish();
                    $data = array(
                        'status' => 1,
                        'data' => $html,
                        'imageContainer' => $imageContainer,
                        'nextPageToken' => $results->nextPageToken
                    );
                } catch (Google_Service_Exception $exc) {
                    $errors = json_decode($exc->getMessage());
                    foreach ($errors as $e) {
                        $data["data"] = "{$e->code} - {$e->message}";
                        break;
                    }
                }
            }
        }
        echo json_encode($data);
    }
 
    public function photoAction() {
        $this->flash->warning("Tạm thời bạn không thể xem được ảnh trực tiếp. Vui lòng bấm đường link dưới đây để tải ảnh!");
        $file_id = $this->dispatcher->getParam('id');
        if (!$file_id) {
            $this->flash->warning($this->helper->translate("Data not found"));
            return $this->response->redirect($this->url->get());
        }
        $key = 'photo-' . $file_id;
        $exists = $this->view->getCache()->exists($key);
        /* Check cache */
        if (!$exists) {
            $client = $this->getGoogleClient();
            $service = new Google_Service_Drive($client);
            $optParams = array(
                'fields' => "*",
            );
            try {
                $file = $service->files->get($file_id, $optParams);
            } catch (Google_Service_Exception $exc) {
                $errors = json_decode($exc->getMessage());
                foreach ($errors as $e) {
                    $this->flash->error("{$e->code} - {$e->message}");
                    break;
                }
            }
            $this->view->result = $file;
            $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        }
        /* Store cache for 2 days */
        $this->view->cache(array(
            "key" => $key,
            'lifetime' => 86400,
            'level' => View::LEVEL_ACTION_VIEW
        ));
    }
 
    private function getGoogleClient() {
        $client = new Google_Client();
        $client->setAuthConfig(CREDENTIALS_FILE_PATH);
        $client->setScopes([
            Google_Service_Drive::DRIVE,
            Google_Service_Drive::DRIVE_PHOTOS_READONLY
        ]);
        return $client;
    }
 
    public function contactAction() {
        $this->helper->bc()->add("Thông tin liên hệ");
        $album_slug = $this->session->get(self::$album_slug_session);
        $album = Album::findFirst(["uri='$album_slug'"]);
        $url_redirect = $this->url->get();
        if (!$album || $album->getStatus() == Album::$DISABLE) {
            $this->flash->warning($this->helper->translate("Data not found"));
            return $this->response->redirect($this->url->get());
        } else {
            $url_redirect = $album->viewLink();
        }
        if ($this->auth->isViewer()) {
            return $this->response->redirect($url_redirect);
        }
        $form = new \User\Form\ContactForm();
        $form->initAdd();
        if ($this->request->isPost()) {
            $data = $this->request->getPost();
            $contact = new \User\Model\ContactInfo();
            $form->bind($data, $contact);
            $contact->setAlbumId($album->getId());
            if ($contact->save()) {
                $this->auth->setAlbumSession($contact->getId());
                return $this->response->redirect($url_redirect);
            } else {
                $this->flash->error("Không thể lưu thông tin");
            }
        }
        $this->view->form = $form;
    }
 
}
#1Photo\Controller\IndexController->contactAction()
#2Phalcon\Dispatcher->callActionMethod(Object(Photo\Controller\IndexController), contactAction, Array())
#3Phalcon\Dispatcher->dispatch()
/home/picture/public_html/app/Bootstrap.php (351)
<?php
 
namespace TLMC;
 
use Application\Cache\Manager as CacheManager;
 
/**
 * Bootstrap
 */
class Bootstrap {
 
    public function run() {
        $di = new \Phalcon\DI\FactoryDefault();
 
        // Config
        require_once APPLICATION_PATH . '/modules/Cms/Config.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([APPLICATION_PATH . "/plugins/"]);
        //$loader->registerFiles([APPLICATION_PATH . '/../vendor/autoload.php']);
        $loader->register();
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql([
            "host" => $config->database->host,
            "username" => $config->database->username,
            "password" => $config->database->password,
            "dbname" => $config->database->dbname,
            "charset" => $config->database->charset,
        ]);
        $di->set('db', $db);
 
        //Connect Social Network
        //$this->initRecaptcha($di);
        // View
        $this->initView($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-error',
            'success' => 'alert alert-success',
            'notice' => 'alert alert-notice',
            'warning' => 'alert alert-warning',
        ]);
        $di->set('flash', $flash);
 
        $di->set('helper', new \Application\Mvc\Helper());
 
        /* Mailing */
        $di->set('mail', new Plugin\Mail());
        /* Auth */
        $di->set('auth', new Plugin\AuthInjection());
        /* Queue */
        /* $di->set('queue', new \Phalcon\Queue\Beanstalk([
          "host" => $config->queue->host,
          "port" => $config->queue->port
          ])); */
        // Routing
        $this->initRouting($application, $di);
        
        //Check site maintenance
        $this->checkSiteMaintain($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 \TLMC\Plugin\Auth($dispatcher);
            new \TLMC\Plugin\CheckPoint($di->get('request'));
            new \TLMC\Plugin\Localization($di->get('config'));
            new \TLMC\Plugin\AdminLocalization($di->get('config'));
            new \TLMC\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            //new \TLMC\Plugin\AccessLog($di);
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            //new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \TLMC\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();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        // 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);
 
 
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
 
        return $view;
    }
 
    private function initCache($di) {
        $config = $di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 120,
            "prefix" => HOST_HASH,
        ]);
 
        $viewCacheFrontend = new \Phalcon\Cache\Frontend\Output([
            'lifetime' => 120,
        ]);
 
        $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);
 
        $viewCache = new \Phalcon\Cache\Backend\File($viewCacheFrontend, [
            "cacheDir" => APPLICATION_PATH . "/../data/cache/frontend/"
        ]);
        $di->set('viewCache', $viewCache, 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 initRecaptcha($di) {
        $config = $di->get('config');
        $recaptcha = new \ReCaptcha\ReCaptcha($config->recaptcha->private_key);
        $di->set('recaptcha', $recaptcha);
    }
    
    private function checkSiteMaintain($di) {
        $auth = $di->get('auth');
        if ($auth && $auth->getUsername()) {
            return;
        }
        $request = $di->get('request');
        $uri = $request->getURI();
        if (in_array($uri, ["/admin", "/dang-nhap"])) {
            return;
        }
        $registry = $di->get('registry');
        if ($registry->cms['TECHNICAL_WORKS']) {
            $view = $di->get('view');
            $view->setViewsDir(__DIR__ . '/modules/Index/views/');
            $view->setPartialsDir(__DIR__ . '/views/partials/');
            $view->start();
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
            $view->message_contact = $registry->cms['ADMIN_EMAIL']." / ".$registry->cms['PHONE_NUMBER'];
            $view->render('index', 'maintain');
            $view->finish();
            echo $view->getContent();
            exit;
        }
    }
 
    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(__DIR__ . '/views/partials/');
                $view->e = $e;
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setStatusCode(404, 'Not Found');
                    $view->render('error', 'error404');
                } else {
                    $response->setStatusCode(503, 'Service Unavailable');
                    $view->render('error', 'error503');
                }
                $view->finish();
                echo $view->getContent();
                exit;
 
                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;
    }
 
}
#4TLMC\Bootstrap->dispatch(Object(Phalcon\Di\FactoryDefault))
/home/picture/public_html/app/Bootstrap.php (106)
<?php
 
namespace TLMC;
 
use Application\Cache\Manager as CacheManager;
 
/**
 * Bootstrap
 */
class Bootstrap {
 
    public function run() {
        $di = new \Phalcon\DI\FactoryDefault();
 
        // Config
        require_once APPLICATION_PATH . '/modules/Cms/Config.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([APPLICATION_PATH . "/plugins/"]);
        //$loader->registerFiles([APPLICATION_PATH . '/../vendor/autoload.php']);
        $loader->register();
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql([
            "host" => $config->database->host,
            "username" => $config->database->username,
            "password" => $config->database->password,
            "dbname" => $config->database->dbname,
            "charset" => $config->database->charset,
        ]);
        $di->set('db', $db);
 
        //Connect Social Network
        //$this->initRecaptcha($di);
        // View
        $this->initView($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-error',
            'success' => 'alert alert-success',
            'notice' => 'alert alert-notice',
            'warning' => 'alert alert-warning',
        ]);
        $di->set('flash', $flash);
 
        $di->set('helper', new \Application\Mvc\Helper());
 
        /* Mailing */
        $di->set('mail', new Plugin\Mail());
        /* Auth */
        $di->set('auth', new Plugin\AuthInjection());
        /* Queue */
        /* $di->set('queue', new \Phalcon\Queue\Beanstalk([
          "host" => $config->queue->host,
          "port" => $config->queue->port
          ])); */
        // Routing
        $this->initRouting($application, $di);
        
        //Check site maintenance
        $this->checkSiteMaintain($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 \TLMC\Plugin\Auth($dispatcher);
            new \TLMC\Plugin\CheckPoint($di->get('request'));
            new \TLMC\Plugin\Localization($di->get('config'));
            new \TLMC\Plugin\AdminLocalization($di->get('config'));
            new \TLMC\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            //new \TLMC\Plugin\AccessLog($di);
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            //new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \TLMC\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();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        // 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);
 
 
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
 
        return $view;
    }
 
    private function initCache($di) {
        $config = $di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 120,
            "prefix" => HOST_HASH,
        ]);
 
        $viewCacheFrontend = new \Phalcon\Cache\Frontend\Output([
            'lifetime' => 120,
        ]);
 
        $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);
 
        $viewCache = new \Phalcon\Cache\Backend\File($viewCacheFrontend, [
            "cacheDir" => APPLICATION_PATH . "/../data/cache/frontend/"
        ]);
        $di->set('viewCache', $viewCache, 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 initRecaptcha($di) {
        $config = $di->get('config');
        $recaptcha = new \ReCaptcha\ReCaptcha($config->recaptcha->private_key);
        $di->set('recaptcha', $recaptcha);
    }
    
    private function checkSiteMaintain($di) {
        $auth = $di->get('auth');
        if ($auth && $auth->getUsername()) {
            return;
        }
        $request = $di->get('request');
        $uri = $request->getURI();
        if (in_array($uri, ["/admin", "/dang-nhap"])) {
            return;
        }
        $registry = $di->get('registry');
        if ($registry->cms['TECHNICAL_WORKS']) {
            $view = $di->get('view');
            $view->setViewsDir(__DIR__ . '/modules/Index/views/');
            $view->setPartialsDir(__DIR__ . '/views/partials/');
            $view->start();
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
            $view->message_contact = $registry->cms['ADMIN_EMAIL']." / ".$registry->cms['PHONE_NUMBER'];
            $view->render('index', 'maintain');
            $view->finish();
            echo $view->getContent();
            exit;
        }
    }
 
    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(__DIR__ . '/views/partials/');
                $view->e = $e;
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setStatusCode(404, 'Not Found');
                    $view->render('error', 'error404');
                } else {
                    $response->setStatusCode(503, 'Service Unavailable');
                    $view->render('error', 'error503');
                }
                $view->finish();
                echo $view->getContent();
                exit;
 
                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;
    }
 
}
#5TLMC\Bootstrap->run()
/home/picture/public_html/public/index.php (28)
<?php
 
chdir(dirname(__DIR__));
 
define('ROOT', __DIR__);
define('HOST_HASH', substr(md5($_SERVER['HTTP_HOST']), 0, 12));
 
define('DIR_PATH', dirname(__FILE__). '/');
define('DIR_IMAGE', DIR_PATH . 'static/files/');
define('DIR_CACHE_IMAGE', DIR_PATH . 'img/');
define('DIR_TEMP_FILE', DIR_PATH . 'temp/');
define('DIR_DATA_FILE', DIR_PATH.'../data/files/');
define('CREDENTIALS_FILE_PATH', DIR_PATH . '../hou-image-8dba1fc7ea6a.json');
 
date_default_timezone_set('Asia/Ho_Chi_Minh');
 
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);
 
define('APPLICATION_PATH', __DIR__ . '/../app');
 
require_once APPLICATION_PATH . '/Bootstrap.php';
$bootstrap = new TLMC\Bootstrap();
$bootstrap->run();
KeyValue
_url/xac-nhan-xem.html
KeyValue
APPLICATION_ENVdevelopment
CONTEXT_DOCUMENT_ROOT/home/picture/public_html
CONTEXT_PREFIX
DOCUMENT_ROOT/home/picture/public_html
GATEWAY_INTERFACECGI/1.1
HTTP_ACCEPT*/*
HTTP_CONNECTIONclose
HTTP_HOSTpicture.hou.edu.vn
HTTP_REFERERhttp://picture.hou.edu.vn/album/trao-bang-tot-nghiep-tai-quang-ninh-2372022-VQVnnlQZkX6u.html
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_X_FORWARDED_FOR18.222.22.244
HTTP_X_FORWARDED_HOSTpicture.hou.edu.vn
HTTP_X_FORWARDED_PROTOhttp
HTTP_X_FORWARDED_SERVERpicture.hou.edu.vn
HTTP_X_REAL_IP18.222.22.244
PATH/bin:/usr/bin:/usr/local/php/bin
PHPRC/home/picture
QUERY_STRING_url=/xac-nhan-xem.html
REDIRECT_APPLICATION_ENVdevelopment
REDIRECT_QUERY_STRING_url=/xac-nhan-xem.html
REDIRECT_REDIRECT_APPLICATION_ENVdevelopment
REDIRECT_REDIRECT_STATUS200
REDIRECT_REDIRECT_UNIQUE_IDZiPfoh3xgfGIixATfNWQHAAAAJM
REDIRECT_STATUS200
REDIRECT_UNIQUE_IDZiPfoh3xgfGIixATfNWQHAAAAJM
REDIRECT_URL/public/xac-nhan-xem.html
REMOTE_ADDR18.222.22.244
REMOTE_PORT55510
REQUEST_METHODGET
REQUEST_SCHEMEhttp
REQUEST_URI/xac-nhan-xem.html
SCRIPT_FILENAME/home/picture/public_html/public/index.php
SCRIPT_NAME/public/index.php
SERVER_ADDR118.70.222.138
SERVER_ADMINwebmaster@picture.hou.edu.vn
SERVER_NAMEpicture.hou.edu.vn
SERVER_PORT80
SERVER_PROTOCOLHTTP/1.0
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2.4.56 (Unix) OpenSSL/1.0.2k-fips
UNIQUE_IDZiPfoh3xgfGIixATfNWQHAAAAJM
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1713627042.7543
REQUEST_TIME1713627042
#Path
0/home/picture/public_html/public/index.php
1/home/picture/public_html/app/Bootstrap.php
2/home/picture/public_html/app/modules/Cms/Config.php
3/home/picture/public_html/app/config/environment/development.php
4/home/picture/public_html/app/config/global.php
5/home/picture/public_html/app/config/modules.php
6/home/picture/public_html/app/modules/Application/Loader/Modules.php
7/home/picture/public_html/vendor/autoload.php
8/home/picture/public_html/vendor/composer/autoload_real.php
9/home/picture/public_html/vendor/composer/ClassLoader.php
10/home/picture/public_html/vendor/composer/autoload_static.php
11/home/picture/public_html/vendor/ralouphie/getallheaders/src/getallheaders.php
12/home/picture/public_html/vendor/guzzlehttp/psr7/src/functions_include.php
13/home/picture/public_html/vendor/guzzlehttp/psr7/src/functions.php
14/home/picture/public_html/vendor/guzzlehttp/promises/src/functions_include.php
15/home/picture/public_html/vendor/guzzlehttp/promises/src/functions.php
16/home/picture/public_html/vendor/guzzlehttp/guzzle/src/functions_include.php
17/home/picture/public_html/vendor/guzzlehttp/guzzle/src/functions.php
18/home/picture/public_html/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php
19/home/picture/public_html/vendor/swiftmailer/swiftmailer/lib/swift_required.php
20/home/picture/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
21/home/picture/public_html/vendor/symfony/polyfill-ctype/bootstrap.php
22/home/picture/public_html/vendor/khanamiryan/qrcode-detector-decoder/lib/common/customFunctions.php
23/home/picture/public_html/app/modules/Application/Mvc/View/Engine/Volt.php
24/home/picture/public_html/app/modules/Application/Widget/Proxy.php
25/home/picture/public_html/app/modules/Application/Cache/Manager.php
26/home/picture/public_html/app/modules/Cms/Model/Configuration.php
27/home/picture/public_html/app/modules/Application/Acl/DefaultAcl.php
28/home/picture/public_html/app/config/acl.php
29/home/picture/public_html/app/modules/Application/Assets/Manager.php
30/home/picture/public_html/app/modules/Application/Mvc/Helper.php
31/home/picture/public_html/app/modules/Menu/Helper/Menu.php
32/home/picture/public_html/app/plugins/Mail.php
33/home/picture/public_html/app/plugins/AuthInjection.php
34/home/picture/public_html/app/plugins/Auth.php
35/home/picture/public_html/app/modules/Application/Mvc/Router/DefaultRouter.php
36/home/picture/public_html/app/modules/Index/Routes.php
37/home/picture/public_html/app/modules/Application/Mvc/Helper/CmsCache.php
38/home/picture/public_html/app/modules/Admin/Routes.php
39/home/picture/public_html/app/modules/Auth/Routes.php
40/home/picture/public_html/app/modules/Api/Routes.php
41/home/picture/public_html/app/modules/User/Routes.php
42/home/picture/public_html/app/modules/SystemAdministration/Routes.php
43/home/picture/public_html/app/modules/Page/Routes.php
44/home/picture/public_html/app/modules/Task/Routes.php
45/home/picture/public_html/app/modules/Photo/Routes.php
46/home/picture/public_html/app/modules/Publication/Routes.php
47/home/picture/public_html/app/modules/Application/Utils/ModuleName.php
48/home/picture/public_html/app/modules/Photo/Module.php
49/home/picture/public_html/app/plugins/CheckPoint.php
50/home/picture/public_html/app/plugins/Localization.php
51/home/picture/public_html/data/translations/frontend/vi.php
52/home/picture/public_html/app/plugins/AdminLocalization.php
53/home/picture/public_html/data/translations/admin/vi.php
54/home/picture/public_html/app/plugins/Acl.php
55/home/picture/public_html/app/modules/Photo/Controller/IndexController.php
56/home/picture/public_html/app/modules/Application/Mvc/Controller.php
57/home/picture/public_html/app/modules/Application/Mvc/Helper/Title.php
58/home/picture/public_html/app/modules/Application/Mvc/Helper/Breadcrumbs.php
Memory
Usage2097152