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("/"); } }
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); }
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("/"); } }
<?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"); }
public static function logout() { session_destroy(); CApp::redirect("/"); }
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"); } }