Example #1
0
 public function process($parameters)
 {
     $render = new Render();
     //dig out and sanitize data from URL
     $parsedURL = $this->parseURL($render->sanitize($parameters[0]));
     array_shift($parsedURL);
     //throw away because of subdirectory
     //determine language - using 'en' of 'cs' because of ISO
     $userLanguage = $render->getLanguage(array_shift($parsedURL));
     if ($userLanguage == false) {
         $this->messages[] = ['s' => 'error', 'cs' => 'Bohužel jsme nezrozpoznali tvůj preferovaný jazyk', 'en' => 'Sorry, we didn\'t recognize your language'];
         $userLanguage = $this->language;
     }
     $this->language = $userLanguage;
     //empty URL is redirected into intro
     if (empty($parsedURL[0])) {
         $this->redirect('intro');
     }
     //create corrent name of controller class
     $controllerClass = $this->intoCamel(array_shift($parsedURL)) . 'Controller';
     //if class exist, create, else error
     if (file_exists('controllers/' . $controllerClass . '.php')) {
         $this->controller = new $controllerClass($this->language);
     } else {
         $this->redirect('error');
     }
     //make controller happen
     $this->controller->process($parsedURL);
     switch ($this->language) {
         case 'cs':
             $this->data['title'] = $this->controller->header['title']['cs'] . ' - ' . NAME . ' v' . VERSION . ' - Paralelní polis';
             $this->data['description'] = NAME . ' Tenant Management System v' . VERSION . ' pro Paralelní polis - systém pravidelného placení za Bitcoiny';
             $this->data['keywords'] = "TMS, TMS2, TMSv2, Tenant Management System, Paralelni polis, BTC, bitcoin, " . NAME;
             $this->data['mainMenu'] = $render->returnMainMenu('cs');
             $this->data['loginCredentials'] = $render->returnLoginCredentials('cs');
             break;
         case 'en':
             $this->data['title'] = $this->controller->header['title']['en'] . ' - ' . NAME . ' v' . VERSION . ' - Paralell polis';
             $this->data['description'] = NAME . ' Temant Management System v' . VERSION . ' for Paralell polis - system for regular Bitcoin payments';
             $this->data['keywords'] = "TMS, TMS2, TMSv2, Tenant Management System, Paralelni polis, BTC, bitcoin, " . NAME;
             $this->data['mainMenu'] = $render->returnMainMenu('en');
             $this->data['loginCredentials'] = $render->returnLoginCredentials('en');
             break;
     }
     $this->data['languageSwitch'] = $render->returnLanguageSwitch($this->language);
     //catch and send to display multiple messages
     $this->data['messages'] = [];
     foreach ($this->controller->messages as $m) {
         $this->data['messages'][] = $m;
     }
     $this->view = 'layout';
     //view for router
 }
Example #2
0
 /**
  * Процессор:
  */
 public function process($template)
 {
     $session = Session::getInstance();
     $stats = Blog_BlogStatisticsModel::getGlobalStats();
     $links_on = $session->persistenceGet('show_links_panel', true);
     if ($links_on) {
         $filter = $session->persistenceGet('live_filter', true);
         $links = Blog_BlogOnlineModel::GetLinks($filter);
         $template->setParameter('online_links', array_slice($links, 0, 12));
         $template->setParameter('right_panel', $links_on);
     }
     $template->setParameter('global_unique', $stats['unique']);
     $template->setParameter('global_online', $stats['online']);
     $template->setParameter('global_posts', $stats['posts']);
     $template->setParameter('global_unique_posters', $stats['unique_posters']);
     $template->setParameter('global_speed', $stats['speed']);
     if ($session->persistenceGet('global_theme', false)) {
         return $template->render($this->viewParams, $session->persistenceGet('global_theme'));
     }
     parent::process($template);
 }
Example #3
0
<?php

header("Content-Type: text/html; charset=utf-8");
/*
 * @ author: Alexandr Kozyr;
 * @ email: kozyr1av@gmail.com;
 * @ this file are front controller constructed for calling our main controll class;
 */
require_once 'libs/Smarty.class.php';
require_once 'class/Morphy.class.php';
require_once 'class/Controller.class.php';
require_once 'class/TextAnalizator.class.php';
require_once 'class/Line.class.php';
require_once 'class/Word.class.php';
$contr = new Controller();
$contr->process();
Example #4
0
        return true;
    }
    function perform()
    {
        $updaters = array("updateArticleCategories", "updateArticleComments", "updateBlogs", "updateAlbums", "updateResources", "updateArticleText");
        // loop through each one of the methods to take care of updating one of the tables
        foreach ($updaters as $method) {
            $result = $this->{$method}();
            if (!$result) {
                $this->_view = new WizardView("update3");
                $this->_view->setErrorMessage($this->message);
                return false;
            }
        }
        // everything went fine so we can show the final page!
        $this->_view = new WizardView("update4");
        $this->_view->setValue("message", $this->message);
        return true;
    }
}
// check if the "./tmp" folder is writable by us, otherwise
// throw an error before the user gets countless errors
// from Smarty
if (!File::isWritable(TEMP_FOLDER) || !File::isDir(TEMP_FOLDER)) {
    print "<span style=\"color:red; font-size: 14px;\">Error</span><br/><br/>This wizard needs the " . TEMP_FOLDER . " folder to be writable by the web server user.<br/><br/>Please correct that and try again.";
    die;
}
//// main part ////
$controller = new Controller($_actionMap, "nextStep");
$controller->process(HttpVars::getRequest());
Example #5
0
<?php

define("DS", DIRECTORY_SEPARATOR);
define("KEY", "webm-thread");
require "options.php";
require 'classes' . DS . 'dbadapter.php';
require "classes" . DS . "router.php";
include 'classes' . DS . 'model.php';
include 'classes' . DS . 'view.php';
include 'classes' . DS . 'controller.php';
Controller::process(Router::route($_GET["p"]));
Example #6
0
    private $params = array();
    private $error = "";
    function __construct()
    {
        $this->params = $_REQUEST;
    }
    function addParam($key, $val)
    {
        $this->params[$key] = $val;
    }
    function get($key)
    {
        return $this->params[$key];
    }
    function setError($error)
    {
        $this->error = $error;
    }
    function getError()
    {
        return $this->error;
    }
}
$controller = new Controller();
$context = $controller->getContext();
$context->addParam('action', 'feedback');
$context->addParam('email', '*****@*****.**');
$context->addParam('topic', 'my brain');
$context->addParam('msg', 'all about my brain');
$controller->process();
print $context->getError();