#1 | call_user_func(Array([0] => Object(RNTForest\cms\controllers\ContentElementRdbController), [1] => renderIndividualRanking), Object(RNTForest\cms\models\ContentElementRdb: ))
/srv/www/chroot/site05/web/vendor/rnt-forest/cms/controllers/CmsPageDefaultController.php (43) <?php
/**
* @copyright Copyright (c) ARONET GmbH (https://aronet.swiss)
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace RNTForest\cms\controllers;
use \RNTForest\cms\models\PageTree;
class CmsPageDefaultController extends \RNTForest\cms\controllers\CmsPageControllerBase
{
/**
* Render the Page
*
* @param \RNTForest\cms\models\CmsPageTreeBase $page
*/
public function render($page){
// first generate page content because there is only one simple view available
$pageContent = '';
/* @var RNTForest\cms\models\CmsContentElementsBase $contentElement */
foreach($page->getContentElements() as $contentElement){
if(!$contentElement->isVisible()) continue;
$controllerName = '\\RNTForest\\cms\\controllers\\'.$contentElement->getType()."Controller";
$controller = new $controllerName();
$this->simpleview->contentElement = $contentElement;
if(!empty($contentElement->getFunction())){
$this->simpleview->contentElementContent = call_user_func([$controller, $contentElement->function],$contentElement);
} else {
$this->simpleview->contentElementContent = "Error: no function in content element ".$contentElement->type." declared!";
}
$pageContent .= $this->simpleview->render("partials/cms/cms_content_elements/contentElement.volt");
}
$this->simpleview->pageTitle = $page->getTitle();
$this->simpleview->showPageTitle = $page->getShowPageTitle();
$pageRowsCount = \RNTForest\cms\models\CmsContentElementsBase::find('cms_page_tree_id = '.$page->id.' AND type = "ContentElementRow" AND hidden = 0')->count();
$this->simpleview->pageRowsCount = $pageRowsCount;
$this->simpleview->pageContent = $pageContent;
$this->simpleview->pageId = $page->getId();
if($this->view->exists("cms_pages/page")){
return $this->simpleview->render("cms_pages/page");
}else{
return $this->simpleview->render("partials/cms/cms_pages/page");
}
}
} |
#2 | RNTForest\cms\controllers\CmsPageDefaultController->render(Object(RNTForest\cms\models\CmsPageTree: [tree_lft] => 46, [tree_rgt] => 47, [tree_level] => 4))
/srv/www/chroot/site05/web/app/cms/phalcon_scripts/BaseScript.php (51) <?php
/**
* @copyright Copyright (c) ARONET GmbH (https://aronet.swiss)
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace RNTForest\cms\phalcon_scripts;
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\DispatcherInterface;
use Phalcon\DI\FactoryDefault as PhDi;
use \RNTForest\cms\models\CmsPageTree;
class BaseScript extends Controller
{
protected $acitvePage;
public function initialize(){
// global config
$di = PhDi::getDefault();
$config = $di['config'];
}
public function run($page){
// get active page object
$this->activePage = CmsPageTree::findFirst($this->session->get('CmsControllerBase')['activePage']);
// generate the menu
$menu = array();
foreach(CmsPageTree::find(['tree_level = 3 AND active = 1 AND hidden = 0','order'=>'tree_lft']) as $menuPage){
$menu[] = $this->buildMenu($menuPage);
}
// render page and get the content
$controllerName = '\\RNTForest\\cms\\controllers\\'.$page->getType()."Controller";
$controller = new $controllerName();
$content = $controller->render($page);
$this->view->menu = $menu;
$this->view->page = $page;
$this->view->content = $content;
// get images for carousel
//todo: get images
$image_urls = array();
$path=BASE_PATH.$this->config->fileadmin->path.'Karussell/';
$images = scandir($path);
foreach($images AS $image){
if($image == '.' || $image == '..')continue;
$image_urls[] ='/fileadmin/Karussell/'.$image;
}
$this->view->carouselImages = $image_urls;
// todo: assign footer menus
$this->view->footerMenuLeft = [0 => ['title'=>'left-menu']];
$this->view->footerMenuMiddle = [0 => ['title'=>'middle-menu']];
$this->view->footerMenuRight = [0 => ['title'=>'right-menu']];
}
/**
* build menu
*
* @param \RNTForest\cms\models\CmsPageTreeBase $page
*/
protected function buildMenu($page){
$menu = array();
// prepare page array
$pageArray = array();
$pageArray['title'] = $page->title;
$pageArray['id'] = $page->id;
$pageArray['type'] = $page->type;
$pageArray['target'] = "_self";
if(($page->type == 'CmsPageLink' || $page->type == 'CmsPageSwfeManualLink') && $page->getConfig()['extern'] == 1){
$pageArray['target'] = "_blank";
}
$pageArray['href'] = $page->href;
$pageArray['active'] = false;
$pageArray['toggled'] = false;
if($this->activePage->id == $page->id){
$pageArray['active'] = true;
$pageArray['toggled'] = true;
}
if($this->activePage->isDescendantOf($page)){
$pageArray['toggled'] = true;
}
// get children of this page
foreach($page->children() as $child){
if(!$child->isVisible()) continue;
$children = $this->buildMenu($child);
$pageArray['children'][] = $children;
}
$menu = $pageArray;
return $menu;
}
} |
#3 | RNTForest\cms\phalcon_scripts\BaseScript->run(Object(RNTForest\cms\models\CmsPageTree: [tree_lft] => 46, [tree_rgt] => 47, [tree_level] => 4))
/srv/www/chroot/site05/web/vendor/rnt-forest/cms/controllers/CmsControllerBase.php (65) <?php
/**
* @copyright Copyright (c) ARONET GmbH (https://aronet.swiss)
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace RNTForest\cms\controllers;
use \RNTForest\cms\models\CmsPageTree;
class CmsControllerBase extends \Phalcon\Mvc\Controller
{
public function initialize(){
// global config
$di = \Phalcon\DI::getDefault();
$config = $di['config'];
// default page title icon
$this->view->pageTitleIcon = '<i class="fa-fw fa fa-home"></i>';
// application name
$this->view->appTitle = $config->application['appTitle'];
// base URL
$this->view->baseUrl = $config->application['baseUrl'];
}
public function renderAction($pageIdUrl){
// presave the query string for further use (just a test!)
$query = $this->request->getQuery();
if(is_numeric($pageIdUrl)){
// try to find the page with this id
$pageIdUrl = $this->filter->sanitize($pageIdUrl,'int');
$page = CmsPageTree::findFirst($pageIdUrl);
}else{
// try to find a matching url
$pageIdUrl = $this->filter->sanitize($pageIdUrl,['trim','string','striptags']);
$page = CmsPageTree::findFirst("url = '".$pageIdUrl."'");
}
// no page found or inactive
if(!$page || !$page->active) return $this->forwardTo404();
// save current page to session
$this->session->set('CmsControllerBase',['activePage' => $page->getId()]);
// execute given script from page to pass everything to the view
$scriptName = $page->getActiveScript();
$script = new $scriptName();
$script->run($page);
// set layout depending on page
$layout = $page->getActiveLayout();
$this->view->setLayoutsDir($this->config->cms['layoutDir']);
$this->view->setLayout($layout);
}
public function redirectTo($path){
$this->response->redirect($path);
$this->view->disable();
}
public function forwardTo401(){
return $this->dispatcher->forward(array(
"controller" => "errors",
"action" => "show401"
));
}
public function forwardTo404(){
return $this->dispatcher->forward(array(
"controller" => "errors",
"action" => "show404"
));
}
}
|
#7 | Phalcon\Mvc\Application->handle(null)
/srv/www/chroot/site05/web/public/index.php (87) <?php
/**
* @copyright Copyright (c) ARONET GmbH (https://aronet.swiss)
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
//debug
ini_set('display_errors', "On");
error_reporting(E_ALL);
$debug = new \Phalcon\Debug();
$debug->listen();
// locales
setlocale(LC_ALL,"de_CH.utf8");
// paths
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
define('VENDOR_PATH', BASE_PATH . '/vendor');
define('FRONTEND_PATH', APP_PATH . '/frontend');
define('BACKEND_PATH', APP_PATH . '/backend');
try {
// check the environment
if(!file_exists(BASE_PATH."/libraries")) mkdir(BASE_PATH."/libraries",0770,true);
if(!file_exists(BASE_PATH."/cache/volt")) mkdir(BASE_PATH."/cache/volt",0770,true);
if(!file_exists(BASE_PATH."/cache/pdf")) mkdir(BASE_PATH."/cache/pdf",0770,true);
if(!file_exists(BASE_PATH."/logs")) mkdir(BASE_PATH."/logs",0770,true);
if(!file_exists(BASE_PATH."/public/gfx")) mkdir(BASE_PATH."/public/gfx",0770,true);
if(!file_exists(BASE_PATH."/public/assets/css")) mkdir(BASE_PATH."/public/assets/css",0770,true);
if(!file_exists(BASE_PATH."/public/assets/js")) mkdir(BASE_PATH."/public/assets/js",0770,true);
if(!file_exists(BACKEND_PATH."/mail")) mkdir(BACKEND_PATH."/mail",0770,true);
if(!file_exists(BACKEND_PATH."/views/templates")) mkdir(BACKEND_PATH."/views/templates",0770,true);
if(!file_exists(BACKEND_PATH."/views/partials")) mkdir(BACKEND_PATH."/views/partials",0770,true);
if(!file_exists(FRONTEND_PATH."/views/partials")) mkdir(FRONTEND_PATH."/views/partials",0770,true);
if(!file_exists(BACKEND_PATH."/views/templates/core")) symlink("../../../../vendor/rnt-forest/core/views/templates",BACKEND_PATH."/views/templates/core");
if(!file_exists(BACKEND_PATH."/views/partials/core")) symlink("../../../../vendor/rnt-forest/core/views",BACKEND_PATH."/views/partials/core");
if(!file_exists(BACKEND_PATH."/views/partials/cms")) symlink("../../../../vendor/rnt-forest/cms/views",BACKEND_PATH."/views/partials/cms");
if(!file_exists(FRONTEND_PATH."/views/partials/cms")) symlink("../../../../vendor/rnt-forest/cms/views",FRONTEND_PATH."/views/partials/cms");
// Bootstrap
include APP_PATH . "/bootstrap.php";
// Handle the request
$application = new \Phalcon\Mvc\Application($di);
// Register application modules
$application->registerModules(
[
'frontend' => [
'className' => 'RNTForest\RDB\frontend\module',
'path' => '../app/frontend/Module.php'
],
'backend' => [
'className' => 'RNTForest\RDB\backend\module',
'path' => '../app/backend/Module.php'
]
]
);
// Assets collection
$application->assets->collection('cssHeader')
->setPrefix($application->config->application->baseUrl);
$application->assets->collection('jsHeader')
->setPrefix($application->config->application->baseUrl);
$application->assets->collection('jsFooter')
->setPrefix($application->config->application->baseUrl);
// Render content
// NGINX - PHP-FPM already set PATH_INFO variable to handle route
$content = $application->handle(!empty($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null)->getContent();
// Generate assets
$application->assetsHelper->generateAllRessourceFiles();
// Output content
echo $content;
} catch (\Exception $e) {
echo $e->getMessage() . '<br>';
echo '<pre>' . $e->getTraceAsString() . '</pre>';
}
?> |