/** * view a post * * @param integer|string $postId */ public function view($postId = 0) { $postId = Encryption::decryptId($postId); if (!$this->post->exists($postId)) { return $this->error(404); } Config::setJsConfig('curPage', ["posts", "comments"]); Config::setJsConfig('postId', Encryption::encryptId($postId)); $action = $this->request->query('action'); $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'posts/viewPost.php', ["action" => $action, "postId" => $postId]); }
public function beforeAction() { parent::beforeAction(); Config::setJsConfig('curPage', "files"); $action = $this->request->param('action'); $actions = ['create', 'delete']; $this->Security->requireAjax($actions); $this->Security->requirePost($actions); switch ($action) { case "create": $this->Security->config("form", ['fields' => ['file']]); break; case "delete": $this->Security->config("form", ['fields' => ['file_id']]); break; } }
public function beforeAction() { parent::beforeAction(); Config::setJsConfig('curPage', "login"); $action = $this->request->param('action'); $actions = ['login', 'register', 'forgotPassword', 'updatePassword']; $this->Security->requirePost($actions); $this->Security->requireGet(['index', 'verifyUser', 'resetPassword', 'logOut']); switch ($action) { case "register": $this->Security->config("form", ['fields' => ['name', 'email', 'password', 'confirm_password', 'captcha']]); break; case "login": $this->Security->config("form", ['fields' => ['email', 'password'], 'exclude' => ['remember_me', 'redirect']]); break; case "forgotPassword": $this->Security->config("form", ['fields' => ['email']]); break; case "updatePassword": $this->Security->config("form", ['fields' => ['password', 'confirm_password', 'id', 'token']]); break; } }
public function beforeAction() { parent::beforeAction(); Config::setJsConfig('curPage', "newsfeed"); $action = $this->request->param('action'); $actions = ['create', 'getUpdateForm', 'update', 'getById', 'delete']; $this->Security->requirePost($actions); switch ($action) { case "create": $this->Security->config("form", ['fields' => ['content']]); break; case "getUpdateForm": $this->Security->config("form", ['fields' => ['newsfeed_id']]); break; case "update": $this->Security->config("form", ['fields' => ['newsfeed_id', 'content']]); break; case "getById": case "delete": $this->Security->config("form", ['fields' => ['newsfeed_id']]); break; } }
/** * users can report bugs, features, or enhancement * - Bug is an error you encountered * - Feature is a new functionality you suggest to add * - Enhancement is an existing feature, but you want to improve * */ public function bugs() { Config::setJsConfig('curPage', "bugs"); $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'bugs/index.php'); }
js/jquery.min.js"></script>--> <script src="<?php echo PUBLIC_ROOT; ?> js/bootstrap.min.js"></script> <script src="<?php echo PUBLIC_ROOT; ?> js/sb-admin-2.js"></script> <script src="<?php echo PUBLIC_ROOT; ?> js/main.js"></script> <!-- Assign CSRF Token to JS variable --> <?php Config::setJsConfig('csrfToken', Session::generateCsrfToken()); ?> <!-- Assign all configration variables --> <script>config = <?php echo json_encode(Config::getJsConfig()); ?> ;</script> <!-- Run the application --> <script>$(document).ready(app.init());</script> <?php Database::closeConnection(); ?> </body> </html>
/** * view backups if exist * */ public function backups() { Config::setJsConfig('curPage', "backups"); $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('ADMIN_VIEWS_PATH') . 'backups.php'); }