public function index() { if (Request::isPost()) { Cookie::set('is_admin', 1); Request::redirect('admin'); } $this->render('admin/login'); }
public function show404() { if (Request::isPost()) { $page = App::collection(self::PAGES_COLLECTION)->create(Input::get('page')); Request::redirect($page->slug); } $layouts = array(); $layout_files = glob(Router::config('paths')['root'] . 'app/views/layouts/*'); foreach ($layout_files as $layout_file) { $layout_ext = pathinfo($layout_file, PATHINFO_EXTENSION); $layout_name = basename($layout_file, '.' . $layout_ext); $words = preg_split('/_/', $layout_name); $layout_label = join(' ', array_map(function ($word) { return ucfirst($word); }, $words)); $layouts[$layout_name] = $layout_label; } $this->render('cms/404', array('request_path' => Request::path(), 'layouts' => $layouts)); }
public static function getData() { // TODO: refactoring if (Request::isPost()) { $data = Request::post('d', Request::post('data', Request::post())); } else { $data = Input::get('d', Input::get('data', Input::get())); } $attached_files = array(); // Check for base64-encoded files foreach ($data as $key => $value) { if (Model\File::base64($value)) { $attached_files[$key] = $value; } } if (!empty($_FILES)) { $attached_files = array_merge($attached_files, $_FILES); } if (!empty($attached_files)) { $data[Model\Collection::ATTACHED_FILES] = $attached_files; } return $data; }