code-igniter-v3-giggi: update release v2
diff --git a/application/controllers/Pelican.php b/application/controllers/Pelican.php
index 35eeb2d..01ca772 100644
--- a/application/controllers/Pelican.php
+++ b/application/controllers/Pelican.php
@@ -1,42 +1,93 @@
<?php
class Pelican extends CI_Controller {
- private function is_valid_file($rel_path = '/', $file_html = 'home.html')
+ private function is_valid_file($rel_path = '/', $file_html = 'index.html')
{
$abs_path = APPPATH.$rel_path.$file_html;
- if (file_exists($abs_path))
- return true;
-
- return false;
+ return file_exists($abs_path);
}
- public function index()
+ public function public_author($file_name = 'index')
{
- $this->load->view('index.html');
+ $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 view($file_name = 'home')
+ 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 if ($this->is_valid_file('views/category/', $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 if ($this->is_valid_file('views/page/', $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/draft/blog', $file_html))
+ {
+ $this->load->view('draft/blog/'.$file_html);
+ }
+ else
+ {
+ header('Location: https://'.$_SERVER['HTTP_HOST']);
+ }
+ }
+
+ public function public_gitles()
+ {
+ $gerrit_gitles = '/gerrit/plugins/gitiles/';
+ header('Location: https://'.$_SERVER['HTTP_HOST'].$gerrit_gitles);
+ }
+
+ 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 if ($this->is_valid_file('views/', $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
{
- $this->index();
+ header('Location: https://'.$_SERVER['HTTP_HOST']);
}
}
}