| <?php |
| |
| class Pelican extends CI_Controller { |
| private function is_valid_file($rel_path = '/', $file_html = 'index.html') |
| { |
| $abs_path = APPPATH.$rel_path.$file_html; |
| return file_exists($abs_path); |
| } |
| |
| public function public_author($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/author/', $file_html)) |
| { |
| $this->load->view('author/'.$file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| |
| public function public_blog($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/blog/', $file_html)) |
| { |
| $this->load->view('blog/'.$file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| |
| public function public_category($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/category/', $file_html)) |
| { |
| $this->load->view('category/'.$file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| |
| public function public_draft($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/blog/draft', $file_html)) |
| { |
| $this->load->view('blog/draft/'.$file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| |
| public function public_gitiles() |
| { |
| $gerrit_gitiles = '/gerrit/plugins/gitiles/'; |
| header('Location: https://'.$_SERVER['HTTP_HOST'].$gerrit_gitiles); |
| } |
| |
| public function public_page($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/page/', $file_html)) |
| { |
| $this->load->view('page/'.$file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| |
| public function public_root($file_name = 'index') |
| { |
| $file_html = $file_name.'.html'; |
| if ($this->is_valid_file('views/', $file_html)) |
| { |
| $this->load->view($file_html); |
| } |
| else |
| { |
| header('Location: https://'.$_SERVER['HTTP_HOST']); |
| } |
| } |
| } |