Exemplo n.º 1
0
 public function index($id = NULL)
 {
     if (!is_null($id)) {
         echo 'Page not found.';
         die(1);
     }
     plug_view('default');
 }
Exemplo n.º 2
0
 /**
  * テンプレートを出力する
  */
 function template($file, $vars = [], $hidden = FALSE)
 {
     ob_start();
     plug_view($file, $vars);
     $contents = ob_get_contents();
     ob_end_clean();
     if (!$hidden) {
         echo $contents;
     }
     return $contents;
 }
Exemplo n.º 3
0
 /**
  * ログイン
  */
 public function login()
 {
     if (!in_array($this->segments['actor'], $this->config['auth_actors']) or isset($_SESSION['auth'][$this->segments['actor']])) {
         redirect('welcome');
     }
     $vars = [];
     if ($this->input->post() !== []) {
         $result = $this->auth_model->authenticate($this->segments['actor'], $this->input->post('login'), $this->input->post('password'));
         if ($result !== NULL) {
             unset($result['password']);
             $_SESSION['auth'][$this->segments['actor']] = $result;
             redirect('welcome');
         }
     }
     plug_view('auth/default', $vars);
 }
Exemplo n.º 4
0
 /**
  * 修正
  */
 public function edit($target, $id)
 {
     $vars['target'] = $target;
     $vars['fields'] = $fields = $this->get_fields($target);
     $this->row = $this->get_row($target, $id, $fields);
     if (is_null($this->row)) {
         echo 'Row not found';
         exit(1);
     }
     if ($this->input->post() !== []) {
         $this->row = $this->edit_row($target, $id, $fields, $this->input->post());
         $this->meta_model->clear_labels($target);
         if (count($_SESSION['breadcrumbs']) >= 2) {
             $segments = $_SESSION['breadcrumbs'][count($_SESSION['breadcrumbs']) - 2]['segments'];
             if ($segments['action'] === 'view') {
                 $segments['action'] = 'index';
             }
         } else {
             $segments = $_SESSION['breadcrumbs'][count($_SESSION['breadcrumbs']) - 1]['segments'];
             $segments['action'] = 'index';
         }
         redirect(segments_to_path($segments));
     }
     $vars['row'] = $this->row;
     $vars['has_many_suites'] = $this->has_many_suites = $this->get_has_many_suites($target, $id);
     $vars['breadcrumbs'] = $_SESSION['breadcrumbs'];
     plug_view('default', $vars);
 }