Exemple #1
0
 /**
  * save User ACL settings
  */
 public function updateACL($section = '')
 {
     $id = $this->obj->getUid();
     if (!$id) {
         return false;
     }
     $objLst = new AclModel();
     $objLst->connectDb();
     if (is_string($section)) {
         $objLst->where("section='{$section}'");
     }
     if (!$objLst->loadList()) {
         return false;
     }
     $i = 0;
     $fc = FrontController::getInstance();
     $db = DbConnector::getConnection();
     $table = $objLst->dbTable('acl_user');
     while ($objLst->next()) {
         if ($fc->getReqVar('acl_' . $objLst->get('name'))) {
             $db->query('INSERT IGNORE INTO `' . $table . '` SET `user_id`=' . $id . ', `acl_id`=' . $objLst->getUid());
         } else {
             $db->query('DELETE IGNORE FROM `' . $table . '` WHERE `user_id`=' . $id . ' AND `acl_id`=' . $objLst->getUid());
         }
         $i++;
     }
     return $i;
 }
Exemple #2
0
 function indexAction()
 {
     if (!$this->postAds) {
         $view = new installView();
         $result = $view->render();
         //показываем форму установки
     } else {
         $errMes = $this->postConfig($this->postAds);
         //получаем результат после проверки пост данных
         if (!empty($errMes)) {
             $view = new installView();
             $result = $view->render($errMes);
             //показываем форму установки
         } else {
             $this->db = DB::Conn();
             if (!is_object($this->db)) {
                 $view = new installView();
                 $result = $view->render($this->db);
                 //показываем форму установки
             } else {
                 header('Location: http://' . $_SERVER['HTTP_HOST']);
             }
         }
     }
     $fc = FrontController::getInstance();
     $fc->setBody($result);
 }
Exemple #3
0
 public function showAll()
 {
     $fc = FrontController::getInstance();
     $dbh = $fc->connect();
     $sql = "\n\t\t\tSELECT listenerName, listenerTitle, status, moderatedTime\n\t\t\t\tFROM listener \n\t\t\t\t\tORDER by moderatedTime\n\t\t";
     $sth = $dbh->prepare($sql);
     $sth->execute();
     $result = $sth->fetchAll(PDO::FETCH_ASSOC);
     foreach ($result as $item) {
         switch ($item['status']) {
             case 0:
                 $status = "На модерации";
                 break;
             case 1:
                 $status = "<span class='text-success'>Одобрено</span>";
                 break;
             case 2:
                 $status = "<span class='text-danger'>Отклонено</span>";
                 break;
             case 3:
                 $status = "<span class='text-info'>В архиве</span>";
                 break;
         }
         echo "<tr>\n\t\t\t\t\t<td>{$item['listenerName']}</td>\n\t\t\t\t\t<td>{$item['listenerTitle']}</td>\n\t\t\t\t\t<td>{$status}</td>\n\t\t\t\t\t<td>";
         echo $item[moderatedTime] != 0 ? date("d-m-Y H:i:s", $item[moderatedTime]) : "";
         echo "</td>\n\t\t\t\t</tr>";
     }
 }
 public function run()
 {
     if ($this->getConfigFolder() == null) {
         $this->setConfigFolder('../config');
     }
     $this->frontController = FrontController::getInstance();
     if ($this->router == null) {
         $this->router = new DefaultRouter();
     }
     $this->frontController->setRouter($this->router);
     $sess = $this->config->app['session'];
     if (isset($sess['autostart'])) {
         if ($sess['type'] == 'native') {
             $s = new NativeSession($sess['name'], $sess['lifetime'], $sess['path'], $sess['domain'], $sess['secure']);
             $http = new HttpContext(null, $s);
         }
         $this->setHttpContext($http ?? new HttpContext());
     }
     if (isset($this->config->app['identity']['userClass'])) {
         $userConfigClass = $this->config->app['identity']['userClass'];
         $this->identity = new Identity($userConfigClass, new SimpleDB());
     } else {
         $this->identity = new Identity(new IdentityUser(null, null), new SimpleDB());
     }
     $this->frontController->dispatch();
 }
Exemple #5
0
 public function __construct($obj)
 {
     parent::__construct($obj);
     $this->fc = FrontController::getInstance();
     $this->error = '';
     $this->isLoggedIn = $this->isLoggingOut = false;
 }
 public function __construct()
 {
     $fc = FrontController::getInstance();
     $this->params = $fc->getParams();
     $this->format = $fc->getFormat();
     $this->makeObj();
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $admin = new Admin();
     $output = $admin->render(ADMIN_TEMPLATE, ADMIN_LOGIN);
     $fc->setBody($output);
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new PageModel();
     header('HTTP/1.0 Not Found');
     $fc->setBody($model->render('404.php', TEMPLATE));
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $view = new DefaultModel();
     $out = $view->showIndexPage();
     $fc->setBody($out);
 }
Exemple #10
0
 public static function run($request)
 {
     if (!$request instanceof Request) {
         $request = new Request($request);
     }
     $file = $request->getFile();
     $class = $request->getClass();
     $method = $request->getMethod();
     $args = $request->getArgs();
     $front = FrontController::getInstance();
     $registry = $front->getRegistry();
     $registry->oRequest = $request;
     $front->setRegistry($registry);
     if (file_exists($file)) {
         require_once $file;
         $rc = new ReflectionClass($class);
         // if the controller exists and implements IController
         //			if($rc->implementsInterface('IController'))
         if ($rc->isSubclassOf('BaseController')) {
             try {
                 $controller = $rc->newInstance();
                 $classMethod = $rc->getMethod($method);
                 return $classMethod->invokeArgs($controller, $args);
             } catch (ReflectionException $e) {
                 throw new MvcException($e->getMessage());
             }
         } else {
             //				throw new MvcException("Interface iController must be implemented");
             throw new MvcException("abstract class BaseController must be extended");
         }
     } else {
         throw new MvcException("Controller file not found");
     }
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $view = new LoginModel();
     $out = $view->showLoginPage();
     $view->status = $fc->status;
     $fc->setBody($out);
 }
 function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new TestModel();
     $model->name = $fc->getParams();
     $output = $model->render('../views/index.php');
     $fc->setBody($output);
 }
 /**
  * Initialise application
  */
 public function init()
 {
     $this->_paths = self::$_mainCfg['application']['paths'];
     $this->setIncludePath($this->_paths);
     $this->setAutoload();
     $this->_fc = FrontController::getInstance();
     ErSession::startSession();
 }
Exemple #14
0
 function getUserRole()
 {
     $fc = FrontController::getInstance();
     $usersList = $this->getUsersList();
     $userName = key($this->user);
     if (array_key_exists($userName, $usersList)) {
         return [$userName => $usersList[$userName]];
     }
 }
Exemple #15
0
 function getAction()
 {
     $fc = FrontController::getInstance();
     $model = new UserModel();
     $model->user = $fc->getParams();
     $model->userRole = $model->getUserRole();
     $output = $model->render('../views/userRole.php');
     $fc->setBody($output);
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     $model->name = "Гость";
     $output = $model->render(USER_DEFAULT_FILE);
     $fc->setBody($output);
 }
 public function __construct()
 {
     $this->_front = FrontController::getInstance();
     $this->_module = $this->_front->getModule();
     $this->_controller = $this->_front->getController();
     $this->_action = $this->_front->getAction();
     $this->_registry = $this->_front->getRegistry();
     $this->_view = new View();
 }
 public function getserialAction()
 {
     $fc = FrontController::getInstance();
     $data = new DatabaseModel();
     $params = $fc->getParams();
     $name = sqlite_escape_string(strip_tags(trim($params['plname'])));
     $data->getSerialData($name);
     $out = $data->showModalTable();
     $fc->setBody($out);
 }
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     $view = 'statistic.php';
     $file = './protected/views/layout/main.php';
     $output = $model->render($file, $view);
     $fc->setBody($output);
 }
 public function cardProductAction()
 {
     $fc = FrontController::getInstance();
     $db = CatalogDB::getInstance();
     $model = new CatalogModel();
     $params = $fc->getParams();
     $model->search = $params['search'];
     $model->cardProduct = $db->getItem($params['id']);
     $fc->setBody($model->render('cardProduct.php', TEMPLATE));
 }
Exemple #21
0
 public function saveData($id, $data)
 {
     //сохраняем ответ докладчика
     $sql = "\n\t\t\tUPDATE `listener` SET reporterAnswer = '{$data}', answeredTime = '" . time() . "'  WHERE id = {$id}\n\t\t";
     $fc = FrontController::getInstance();
     $dbh = $fc->connect();
     $result = $dbh->exec($sql);
     if ($result === false) {
         echo 'ERROR';
     }
 }
 public function delmsgAction()
 {
     $fc = FrontController::getInstance();
     $model = new GbookModel();
     $params = $fc->getParams();
     if ($params['id']) {
         $model->delmsg($params['id']);
     } else {
         header('Location: /gbook');
     }
 }
Exemple #23
0
 public function sendAction()
 {
     //принимаем id дива и тело сообщения, отправляем ReporterModel
     $fc = FrontController::getInstance();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $id = $fc->clearData($_POST['id'], 'int');
         $data = $fc->clearData($_POST['answer']);
     }
     $model = new ReporterModel();
     $model->saveData($id, $data);
 }
Exemple #24
0
 public function __construct($ads_post)
 {
     if ($ads_post !== null) {
         $this->postAds = $ads_post;
     }
     //если есть $_POST пишем в свойство $postAds
     $this->modelAds = new Ads($this->postAds);
     //инициализируем модель
     $this->fc = FrontController::getInstance();
     //инициализируем фронт контроллер
 }
Exemple #25
0
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     //Добавляем
     $params = $fc->getParams();
     $view = new View();
     //$view->name = "John";
     $view->name = $params['name'];
     $result = $view->render('../views/index.php');
     $fc->setBody($result);
 }
Exemple #26
0
 private function configuration()
 {
     Assets::$test = TRUE;
     // Delete in real
     $this->fc = FrontController::getInstance();
     $this->controller = strtolower(str_replace('Controller', '', $this->fc->getController()));
     $this->action = strtolower(str_replace('Action', '', $this->fc->getAction()));
     $this->view = new View();
     $this->params = $this->fc->getParams();
     if ($this->controller == 'error') {
         return;
     }
     // Users and Access
     $this->mu = M_Users::Instance();
     $this->user = $this->mu->GetUser();
     $accessByIp = IpAccess::isAccess($_SERVER['REMOTE_ADDR']);
     if ((!$accessByIp || $this->user->locked) && $this->controller != 'authorization') {
         $expire = time() + 3600 * 24 * 100;
         setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
         $this->redirect(array('authorization', 'login'));
         exit;
     }
     $access = new Access();
     $access->fillFromUser($this->user);
     $access->setAccessParams($this->controller, $this->action);
     $sectionAccess = $access->sectionAccess();
     $actionAccess = $access->actionAccess();
     if (!$sectionAccess || !$actionAccess) {
         if ($this->user->isGuest) {
             $expire = time() + 3600 * 24 * 100;
             setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
             $this->redirect(array('authorization', 'login'));
         }
         $pageArr = $access->UserAccessPage;
         $redirectArray = $pageArr ? $pageArr : array('error', '');
         $this->redirect($redirectArray);
     }
     $this->access = $access;
     $sInfo = $access->actionAccess(array('service', 'info')) ? true : false;
     $this->fc->setSInfo($sInfo);
     unset($access);
     $this->pageTitle = __('pageTitle');
     $array = array('access' => $this->access, 'controller' => $this->controller, 'action' => $this->action, 'user' => $this->user);
     $this->setMainVars($array);
     if (!empty($_POST)) {
         $_POST = AF::clearDataArray($_POST);
     }
     // Set user
     AF::setUser($this->user);
     AF::setUserAccess($this->access);
     //$sectionID = ( isset($this->params['id']) && is_numeric($this->params['id']) ) ? $this->params['id'] : '';
     //Log::createLog($this->user->user_id, $this->action."Action", $this->controller, $sectionID);
 }
Exemple #27
0
 public static function route($paramLine)
 {
     $ctl = FrontController::getInstance();
     $data = explode('/', $paramLine);
     foreach ($data as &$item) {
         $item = strtr('/', '_', $item);
     }
     if ($ctl->config->get('website', 'niceUrls')) {
         return '/' . implode('/', $data);
     }
     return '/?' . http_build_query($data);
 }
 public function transferAction()
 {
     $fc = FrontController::getInstance();
     $file = new FilesModel();
     $params = $fc->getParams();
     if (preg_match("/^[a-zA-Z0-9_]+(_[\\d]+s|).txt\$/", $params['filename'])) {
         $file->getDataFromFile($params['filename']);
         $file->connectToDb();
         $file->putDataToDatabase();
         $file->getStatus();
     }
 }
function mostrarVehiculos($type)
{
    $id_oficina = $_REQUEST['oficina'];
    echo "<div id='{$type}'>";
    echo "<form method='post' action='viewTarificator3.php'>";
    $idTarifas = FrontController::getInstance()->execute(Entities::TARIFA, Operations::TOLIST, NULL);
    if (sizeof($idTarifas) > 0) {
        echo "<p>Vehiculo: <select name='tarifa' id='id_tarifa' onchange='ocultar();'>";
        foreach ($idTarifas as $idTarifa) {
            $tarifa = FrontController::getInstance()->execute(Entities::TARIFA, Operations::READ, $idTarifa);
            $oficina_id = $tarifa->getOficina()->getId();
            if ($oficina_id == $id_oficina) {
                $oficina = $tarifa->getOficina()->getLocalidad();
                $grupo = $tarifa->getGrupo();
                $id_vehiculos = FrontController::getInstance()->execute(Entities::VEHICULO, Operations::TOLIST, NULL);
                foreach ($id_vehiculos as $id_vehiculo) {
                    $vehiculo = FrontController::getInstance()->execute(Entities::VEHICULO, Operations::READ, $id_vehiculo);
                    $tipo = $vehiculo->getTipo();
                    $group = $vehiculo->getGrupo();
                    if ($tipo == $type && $group == $grupo) {
                        echo "<option value='{$idTarifa}'>Vehiculos del grupo '{$grupo}' en '{$oficina}'</option>";
                    }
                }
            }
        }
        echo "</select></p>";
    } else {
        echo "<p>No existen Tarifas, contacte con el administrador del sitio</p>";
    }
    echo "<p> Los datos de los vehiculos son los siguientes: <p>";
    foreach ($idTarifas as $idTarifa) {
        $tarifa = FrontController::getInstance()->execute(Entities::TARIFA, Operations::READ, $idTarifa);
        $oficina_id = $tarifa->getOficina()->getId();
        if ($oficina_id == $id_oficina) {
            $grupo = $tarifa->getGrupo();
            $id_vehiculos = FrontController::getInstance()->execute(Entities::VEHICULO, Operations::TOLIST, NULL);
            foreach ($id_vehiculos as $id_vehiculo) {
                $vehiculo = FrontController::getInstance()->execute(Entities::VEHICULO, Operations::READ, $id_vehiculo);
                $group = $vehiculo->getGrupo();
                $tipo = $vehiculo->getTipo();
                if ($group == $grupo && $tipo == $type) {
                    echo "<p>";
                    echo $vehiculo->__toString();
                    echo "<p>";
                }
            }
        }
    }
    echo "<p><input type='hidden' name='oficina' value={$id_oficina}></p>";
    echo "<p><input type='submit' value='Siguiente'></p>";
    echo "</form>";
    echo "</div>";
}
Exemple #30
0
 public function indexAction()
 {
     $pdo = DB::getInstance()->getConnection();
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     /* 
      *	$model->name = $params['name'];
      */
     $model->name = "Guest";
     $output = $model->render(TEMPLATE, USER_DEFAULT_FILE);
     $fc->setBody($output);
 }