예제 #1
0
 public static function createPageByModule()
 {
     if (isset($_GET["module"])) {
         $urlModule = ucfirst(strtolower(filterGetValue($_GET["module"])));
         $command = new CCommand();
         $module = $command->createObj($urlModule, 'Module');
         $module->includeModule();
         self::createPageByController($urlModule . 'Module');
     }
     return;
 }
예제 #2
0
 protected function render($view, $controller = "site", $arrResult = array(), $template = TEMPLATE)
 {
     $cache = new CCache(604800);
     $flagCache = false;
     if (!$cache->cacheExists(CApp::getHashCurPage()) && false) {
         $flagCache = true;
         $cache->startCache();
     }
     include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/header.php";
     include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/views/" . strtolower($controller) . "/" . $view . ".php";
     include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/footer.php";
     if ($flagCache) {
         $cache->writeCache(filterGetValue(CApp::getHashCurPage()));
     }
 }
예제 #3
0
 public function registerAction()
 {
     /**
      * ToDo: Registration success messages
      */
     if (isset($_POST["registerForm"]) && !empty($_POST["registerForm"])) {
         $filteredUserInfo = array();
         foreach ($_POST["registerForm"] as $key => $value) {
             $filteredUserInfo[$key] = filterGetValue($value);
         }
         $model = new UserModel();
         $model->create($filteredUserInfo);
     }
     $this->render("register", "user");
 }
예제 #4
0
 public function createAction()
 {
     CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('createUser'));
     if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN) {
         $model = new UserModel();
         if (!empty($_POST["user"])) {
             foreach ($_POST["user"] as $key => $value) {
                 $arrPost[$key] = filterGetValue($value);
             }
             $model->create($arrPost);
         }
         $this->render("create", "user");
     } else {
         CApp::redirect("/");
     }
 }
예제 #5
0
 protected function render($view, $controller = "site", $arrResult = [], $template = null)
 {
     if ($template == null) {
         $template = CApp::settings('APPLICATION')->templates['default'];
     }
     $cache = new CCache(604800);
     $flagCache = false;
     if (!$cache->cacheExists(CApp::getHashCurPage()) && CApp::settings("APPLICATION")->settings['cache_on']) {
         $flagCache = true;
         $cache->startCache();
     }
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/header.php";
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/views/" . strtolower($controller) . "/" . $view . ".php";
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/footer.php";
     if ($flagCache) {
         $cache->writeCache(filterGetValue(CApp::getHashCurPage()));
     }
 }
예제 #6
0
 public function indexAction()
 {
     if ($_SESSION["userRole"] == USER_ROLE_ADMIN) {
         CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('translateApp'));
         $arrResult = CApp::getTranslateAll();
         if (!empty($_POST["TRANSLATE"])) {
             $translateArray = array();
             foreach ($_POST["TRANSLATE"] as $key => $value) {
                 if ($key == "newVal" && empty($value[0]) && empty($value[1])) {
                     continue;
                 }
                 if (empty($value[0]) && empty($value[1])) {
                     continue;
                 }
                 $translateArray[filterGetValue($value[0])] = filterGetValue($value[1]);
             }
             $model = new TranslateModel();
             $arrResult = $model->update($translateArray, $arrResult);
         }
         $this->render("changeTranslate", "translate", $arrResult);
     } else {
         CApp::redirect("/");
     }
 }
예제 #7
0
파일: index.php 프로젝트: ennjamusic/study
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/prolog.php";
if (GMVC_ON) {
    $controller = new CGmvcController();
    if (!isset($_GET["view"])) {
        $controller->indexAction();
    } else {
        $view = filterGetValue($_GET["view"]);
        $command = new CCommand();
        $action = $command->createAction($view);
        $controller->{$action}();
    }
} else {
    CApp::redirect("/errors/404.php");
}
예제 #8
0
 public function createTableAction()
 {
     if ($_SESSION["GMVC_AUTH"] == "Y") {
         if ($_POST["save"] == "Save") {
             $model = new GmvcModel();
             $tableName = filterGetValue($_POST["tableName"]);
             $tableArr = array();
             foreach ($_POST["FIELDS"] as $fieldArr) {
                 $newFieldArr = array();
                 foreach ($fieldArr as $key => $val) {
                     if ($key == "fieldName") {
                         continue;
                     }
                     if (!empty($val)) {
                         switch ($key) {
                             case "fieldType":
                                 $newFieldArr["type"] = filterGetValue($val);
                                 break;
                             case "lengthType":
                                 $newFieldArr["length"] = filterGetValue($val);
                                 break;
                             case "keyType":
                                 $newFieldArr["key"] = filterGetValue($val);
                                 break;
                             case "defaultVal":
                                 $newFieldArr["default"] = filterGetValue($val);
                                 break;
                             case "indexVal":
                                 $newFieldArr["index"] = filterGetValue($val);
                                 break;
                             case "ifNull":
                                 $newFieldArr["not_null"] = $val ? true : false;
                                 break;
                             case "ifAI":
                                 $newFieldArr["auto_increment"] = $val ? true : false;
                                 break;
                             default:
                                 break;
                         }
                     }
                 }
                 $tableArr[filterGetValue($fieldArr["fieldName"])] = $newFieldArr;
             }
             if (!empty($tableArr)) {
                 $model->createTable($tableName, $tableArr);
             }
         }
         $this->render("createTable");
     } else {
         CApp::redirect("index");
     }
 }