Exemplo n.º 1
0
 public function deleteAction($id)
 {
     if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN && $_GET["view"] == "delete" && !empty($_GET["id"])) {
         $model = new UserModel();
         $model->deleteById($id);
         CApp::redirect(CApp::getLink(array("controller" => "user", "view" => "index")));
     } else {
         CApp::redirect("/");
     }
 }
Exemplo n.º 2
0
 public function cacheClearAction()
 {
     $dirname = $_SERVER["DOCUMENT_ROOT"] . "/cache/";
     $dir = opendir($dirname);
     while (($file = readdir($dir)) !== false) {
         if (is_file($dirname . "/" . $file)) {
             unlink($dirname . "/" . $file);
         }
     }
     $path = CApp::getLink(array("controller" => "site", "view" => "settings"));
     CApp::redirect($path);
 }
Exemplo n.º 3
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("/");
     }
 }
Exemplo n.º 4
0
<?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");
}
Exemplo n.º 5
0
 public static function logout()
 {
     session_destroy();
     CApp::redirect("/");
 }
Exemplo n.º 6
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");
     }
 }