site initialized; basic catalog lists videos
authorCalin Burloiu <calin.burloiu@gmail.com>
Tue, 12 Jul 2011 12:35:14 +0000 (15:35 +0300)
committerCalin Burloiu <calin.burloiu@gmail.com>
Tue, 12 Jul 2011 12:35:14 +0000 (15:35 +0300)
21 files changed:
.gitignore
.htaccess
application/config/config.php
application/config/database.php
application/config/p2p-tube.php [new file with mode: 0644]
application/config/routes.php
application/controllers/admin.php [new file with mode: 0644]
application/controllers/catalog.php [new file with mode: 0644]
application/controllers/help.php [new file with mode: 0644]
application/controllers/tmp.php [new file with mode: 0644]
application/controllers/video.php [new file with mode: 0644]
application/libraries/Content.class.php [new file with mode: 0755]
application/libraries/Singleton_db.php [new file with mode: 0644]
application/models/videos_model.php [new file with mode: 0644]
application/views/catalog/index_view.php [new file with mode: 0644]
application/views/footer.php [new file with mode: 0644]
application/views/header.php [new file with mode: 0644]
application/views/html_begin.php [new file with mode: 0644]
application/views/html_end.php [new file with mode: 0644]
application/views/tmp.php [new file with mode: 0644]
application/views/video/watch_view.php [new file with mode: 0644]

index 2d77a4e..51743a3 100644 (file)
@@ -26,3 +26,6 @@ config.mk
 .512b
 .directory
 *.patch
+application/logs/*.php
+data/thumbs/*
+data/torrents/*
index cbdfca5..739f845 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,3 +1,11 @@
+<Files data>
+       Order allow,deny
+       Deny from all
+</Files>
+<Files docs>
+       Order allow,deny
+       Deny from all
+</Files>
 <Files .gitignore>
        Order allow,deny
        Deny from all
@@ -10,3 +18,7 @@
        Order allow,deny
        Deny from all
 </Files>
+
+RewriteEngine on
+RewriteCond $1 !^(index\.php|data|robots\.txt)
+RewriteRule ^(.*)$ index.php/$1 [L]
index 1ec6543..1402953 100755 (executable)
@@ -26,7 +26,7 @@ $config['base_url']   = '';
 | variable so that it is blank.
 |
 */
-$config['index_page'] = 'index.php';
+$config['index_page'] = '';
 
 /*
 |--------------------------------------------------------------------------
@@ -180,7 +180,7 @@ $config['directory_trigger']        = 'd'; // experimental not currently in use
 | your log files will fill up very fast.
 |
 */
-$config['log_threshold'] = 0;
+$config['log_threshold'] = 4;
 
 /*
 |--------------------------------------------------------------------------
@@ -358,5 +358,3 @@ $config['rewrite_short_tags'] = FALSE;
 $config['proxy_ips'] = '';
 
 
-/* End of file config.php */
-/* Location: ./application/config/config.php */
index 24d611a..ab8a529 100755 (executable)
@@ -42,9 +42,9 @@ $active_group = 'default';
 $active_record = TRUE;
 
 $db['default']['hostname'] = 'localhost';
-$db['default']['username'] = '';
-$db['default']['password'] = '';
-$db['default']['database'] = '';
+$db['default']['username'] = 'root';
+$db['default']['password'] = 'root';
+$db['default']['database'] = 'livinglab';
 $db['default']['dbdriver'] = 'mysql';
 $db['default']['dbprefix'] = '';
 $db['default']['pconnect'] = TRUE;
@@ -52,7 +52,7 @@ $db['default']['db_debug'] = TRUE;
 $db['default']['cache_on'] = FALSE;
 $db['default']['cachedir'] = '';
 $db['default']['char_set'] = 'utf8';
-$db['default']['dbcollat'] = 'utf8_general_ci';
+$db['default']['dbcollat'] = 'utf8_unicode_ci';
 $db['default']['swap_pre'] = '';
 $db['default']['autoinit'] = TRUE;
 $db['default']['stricton'] = FALSE;
diff --git a/application/config/p2p-tube.php b/application/config/p2p-tube.php
new file mode 100644 (file)
index 0000000..ac03043
--- /dev/null
@@ -0,0 +1,34 @@
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+// P2P-Tube specific configuration files
+
+/*
+|--------------------------------------------------------------------------
+| Default Video File Extension
+|--------------------------------------------------------------------------
+|
+| Sets the default video file extension, which must be set without '.' prefix. 
+| This extension is going to be added to the `name` field from the DB in
+| order to deduce the video file name if not stated otherwise. Possible values:
+|
+|      ogv
+|      ogg
+|
+*/
+$config['default_video_ext'] = 'ogg';  // TODO: Change to 'ogv'!
+
+/*
+|--------------------------------------------------------------------------
+| Default Torrent File Extension
+|--------------------------------------------------------------------------
+|
+| Sets the default torrent file extension, which must be set without '.' prefix. 
+| This extension is going to be added to the video file name in order to deduce
+| the torrent file name if not stated otherwise. Possible values:
+|
+|      tstream
+|      torrent
+|
+*/
+$config['default_video_ext'] = 'tstream';
+
index 5f9a583..36fc124 100755 (executable)
@@ -38,7 +38,7 @@
 |
 */
 
-$route['default_controller'] = "welcome";
+$route['default_controller'] = "catalog";
 $route['404_override'] = '';
 
 
diff --git a/application/controllers/admin.php b/application/controllers/admin.php
new file mode 100644 (file)
index 0000000..3d38865
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * Class Admin controlls site administration features
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Admin extends CI_Controller {
+       
+       public function index()
+       {
+               
+       }
+}
+
+/* End of file admin.php */
+/* Location: ./application/controllers/admin.php */
diff --git a/application/controllers/catalog.php b/application/controllers/catalog.php
new file mode 100644 (file)
index 0000000..8dacaae
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Class Catalog controlls video hierarchy and searching
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Catalog extends CI_Controller {
+       
+       public function index()
+       {
+               $this->load->view('html_begin');
+               $this->load->view('header');
+               
+               $this->load->model('videos_model');
+               $data['query'] = $this->videos_model->getVideosSummary();
+               $this->load->view('catalog/index_view', $data);
+               
+               
+               $this->load->view('footer');
+               $this->load->view('html_end');
+       }
+}
+
+/* End of file catalog.php */
+/* Location: ./application/controllers/catalog.php */
diff --git a/application/controllers/help.php b/application/controllers/help.php
new file mode 100644 (file)
index 0000000..927480d
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * Class Help controlls site's help, support, contact, feedback etc. features
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Help extends CI_Controller {
+       
+       public function index()
+       {
+               
+       }
+}
+
+/* End of file help.php */
+/* Location: ./application/controllers/help.php */
diff --git a/application/controllers/tmp.php b/application/controllers/tmp.php
new file mode 100644 (file)
index 0000000..346acb5
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * Class Tmp controlls video hierarchy and searching
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Tmp extends CI_Controller {
+       
+       public function index()
+       {
+               
+       }
+}
+
+/* End of file tmp.php */
+/* Location: ./application/controllers/tmp.php */
diff --git a/application/controllers/video.php b/application/controllers/video.php
new file mode 100644 (file)
index 0000000..9a910e0
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Class Video controlls video items handling: watching, commenting, rating,
+ * adding etc.
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Video extends CI_Controller {
+       
+       public function index()
+       {
+               
+       }
+       
+       public function watch($id, $name = NULL)
+       {
+               $this->load->helper('url');
+               
+               $this->load->view('html_begin');
+               $this->load->view('header');
+               
+               $this->load->model('videos_model');
+               $data['video'] = $this->videos_model->getVideo($id)->row();
+               if ($name !== NULL && $data['video']->name != $name)
+                       $data['video']->err = 'INVALID_NAME';
+               
+               $this->load->view('video/watch_view', $data);
+               
+               $this->load->view('footer');
+               $this->load->view('html_end');
+       }
+}
+
+/* End of file video.php */
+/* Location: ./application/controllers/video.php */
diff --git a/application/libraries/Content.class.php b/application/libraries/Content.class.php
new file mode 100755 (executable)
index 0000000..cc94490
--- /dev/null
@@ -0,0 +1,393 @@
+<?php
+require_once('includes.inc.php');
+require_once('util.inc.php');
+
+/** 
+* Handles information from database
+*/
+class Content
+{
+       protected $db;
+       protected $languages;
+       protected $content;
+       protected $lang;
+
+       public function __construct($namespace)
+       {
+               try {
+                       $this->db = SingletonDB::connect();
+                       
+                       // Get languages from DB.
+                       if(!$this->db->query("SET NAMES 'utf8'")) throw new DBException('query');
+                       if( !($result = $this->db->query("SELECT * FROM `languages`")) )
+                               throw new DBException('query');
+                       while($row = $result->fetch_assoc())
+                       {
+                               $this->languages[$row['code']]['name'] = $row['name'];
+                               $this->languages[$row['code']]['img'] = $row['image'];
+                       }
+                       
+                       // Set current language
+                       // TODO: language
+                       $matchedLang = DEFAULT_LANG;//$this->matchLanguage();
+                       if(isset($_GET['lang']))
+                       {
+                               $lang = $this->processLangCode($_GET['lang']);
+                               $this->lang = $lang;
+                               if($lang != $matchedLang)
+                                       setcookie("lang", $lang, time() + 30*24*60*60);
+                               else
+                                       setcookie("lang", $lang, time() - 3600);
+                       }
+                       else if(isset($_COOKIE['lang']))
+                               $this->lang = $this->processLangCode($_COOKIE['lang']);
+                       else
+                               $this->lang = $matchedLang;
+                       
+                       // Get content from DB, from common and specified namespace.
+                               if( !($result = $this->db->query("SELECT * FROM `content` WHERE namespace = 'common' OR namespace = '" 
+                                       . $namespace . "'")) )
+                               throw new DBException('query');
+                       while($row = $result->fetch_assoc())
+                       {
+                               $this->content[$row['name']] = json_decode($row['value'], true);
+                       }
+               
+               }
+               catch(DBException $e) {
+                       echo $e->errorMessage();
+                       die();
+               }
+       }
+       
+       // Verifies if the lang code exists in the database and if so it returns it
+       // in lower case. It not it returns the default language.
+       public function processLangCode($lang)
+       {
+               $lang = strtolower($lang);
+               if(isset($this->languages[$lang]))
+                       return $lang;
+               else
+                       return DEFAULT_LANG;
+       }
+       
+       public function getLanguages()
+       {
+               return $this->languages;
+       }
+       
+       public function getLanguage($code)
+       {
+               if(isset($this->languages[$code]))
+                       return $this->languages[$code];
+               else
+                       return null;
+       }
+       
+       public function getCrtLanguage()
+       {
+               return $this->lang;
+       }
+       
+       public function getContent($name, $lang)
+       {
+               if(isset($this->content[$name]))
+                       return $this->content[$name][$lang];
+               else
+                       return null;
+       }
+       
+       public function __get($name)
+       {
+               if(isset($this->content[$name]))
+                       return $this->content[$name][$this->lang];
+               else
+                       return null;
+       }
+       
+       // Returns user's prefered language if the site supports it or english otherwise.
+       public function matchLanguage()
+       {
+               $pattern = '/^(?P<primarytag>[a-zA-Z]{2,8})'.
+    '(?:-(?P<subtag>[a-zA-Z]{2,8}))?(?:(?:;q=)'.
+    '(?P<quantifier>\d\.\d))?$/';
+               
+               foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) 
+               {
+                       $splits = array();
+
+                       if (preg_match($pattern, $lang, $splits)) 
+                       {
+                               $language = $splits['primarytag'];
+                               if(isset($this->languages[$language]))
+                                       return $language;
+                       } 
+                       else 
+                               return 'en';
+               }
+               
+               return 'en';
+       }
+
+       public function isRowIncomplete($row)
+       {
+               $incomplete = '';
+
+               if(empty($row['name']))
+                       $incomplete .= 'n';
+               if(empty($row['address']))
+                       $incomplete .= 'a';
+               if(empty($row['developer']))
+                       $incomplete .= 'd';
+               if(empty($row['chief_architect']))
+                       $incomplete .= '{ca}';
+               if($row['whole_area'] == null || $row['whole_area'] == '0000')
+                       $incomplete .= '{wa}';
+               if(empty($row['height']))
+                       $incomplete .= 'h';
+               if(empty($row['phase']))
+                       $incomplete .= '{ph}';
+               if($row['year_begin'] == null)
+                       $incomplete .= '{yb}';
+
+               $descriptions = json_decode($row['description'], true);
+               foreach($this->getLanguages() as $code => $value)
+               {
+                       if(empty($descriptions[$code]))
+                               $incomplete .= '{de}';
+               }
+
+               $images = json_decode($row['images'], true);
+               if(count($images) < 1)
+                       $incomplete .= 'i';
+               
+               return $incomplete;
+       }
+       
+       // Returns a list of buildings with a specified category as an 
+       // associative array with ID keys. Every element has associated:
+       // name, year_begin, image (thumbnail).
+       public function getPortofolioSummary($category, $page, $checkIncomplete=false)
+       {
+               $portofolio = null;
+
+               if(!$checkIncomplete)
+                       $columns = "id, name, year_begin, images, category";
+               else
+                       $columns = "*";
+               
+               $query = "SELECT ". $columns. " FROM `portofolio`";
+               if($category != null)
+                       $query .= " WHERE category = '". $category . "'";
+               $query .= " ORDER BY year_begin DESC, name ASC";
+               if($page != null)
+                       $query .= " LIMIT ". ($page * PRJ_PER_PAGE) . ", " . PRJ_PER_PAGE;
+               $result = $this->db->query($query);
+                       
+               while($row = $result->fetch_assoc())
+               {
+                       $portofolio[$row['id']]['name'] = $row['name'];
+                       $portofolio[$row['id']]['year_begin'] = $row['year_begin'];
+                       $images = json_decode($row['images'], true);
+                       if(!$images)
+                               $portofolio[$row['id']]['image'] = null;
+                       else
+                               $portofolio[$row['id']]['image'] = getThumbFileName($images[0]);
+                       $portofolio[$row['id']]['category'] = $row['category'];
+
+                       if($checkIncomplete)
+                               $portofolio[$row['id']]['incomplete'] = $this->isRowIncomplete($row);
+               }
+               
+               return $portofolio;
+       }
+       
+       // Returns 3 dictionaries representing projects from portofolio.
+       // Each dictionary has id as key and another dictionary as value with:
+       // name, year_begin, description, thumnail.
+       public function getPortofolioAds()
+       {
+               $portofolio = null;
+               
+               $query = "SELECT id, name, year_begin, description, images FROM `portofolio` ORDER BY RAND() LIMIT "
+                       . P_ADS_COUNT;
+               $result = $this->db->query($query);
+                       
+               while($row = $result->fetch_assoc())
+               {
+                       $portofolio[$row['id']]['name'] = $row['name'];
+                       $portofolio[$row['id']]['year_begin'] = $row['year_begin'];
+                       $images = json_decode($row['images'], true);
+                       if(!$images)
+                               $portofolio[$row['id']]['image'] = null;
+                       else
+                               $portofolio[$row['id']]['image'] = getThumbFileName($images[0]);
+                       $descriptions = json_decode($row['description'], true);
+                       $portofolio[$row['id']]['description'] = $descriptions[$this->lang];
+               }
+               
+               return $portofolio;
+       }
+       
+       public function getPortofolioCardinality($category)
+       {
+               $query = "SELECT count(id) c FROM `portofolio` WHERE category = '". $category. "'";
+               $result = $this->db->query($query);
+               
+               $row = $result->fetch_row();
+               if($row)
+                       return $row[0];
+       }
+       
+       public function getRowNumber($id, $category)
+       {
+               $query = "
+SELECT id id_t, name name_t, year_begin year_begin_t, (
+
+       SELECT COUNT( * ) 
+       FROM  `portofolio` 
+       WHERE category =  '". $category. "'
+       AND id <> id_t
+       AND (year_begin = year_begin_t AND name < name_t OR year_begin > year_begin_t)
+       ORDER BY year_begin DESC , name ASC
+) pos
+FROM  `portofolio` 
+WHERE id = ". $id;
+               $result = $this->db->query($query);
+               
+               $row = $result->fetch_assoc();
+               if($row)
+                       return $row['pos'];
+       }
+
+       // If fullInfo is true, information for all languages will be returned.
+       public function getProject($id, $fullInfo = false)
+       {
+               $result = $this->db->query(
+                       "SELECT * from `portofolio` WHERE id = " . $id);
+               $row = $result->fetch_assoc();
+               
+               if(!$row)
+                       return null;
+               
+               $row['category_code'] = $row['category'];
+               switch($row['category_code'])
+               {
+               case 'office':
+                       $row['category'] = $this->project_category_office;
+                       break;
+               case 'residential':
+                       $row['category'] = $this->project_category_residential;
+                       break;
+               case 'hotel':
+                       $row['category'] = $this->project_category_hotel;
+                       break;
+               case 'industrial':
+                       $row['category'] = $this->project_category_industrial;
+                       break;
+               case 'commercial':
+                       $row['category'] = $this->project_category_commercial;
+                       break;
+               case 'restorations':
+                       $row['category'] = $this->project_category_restorations;
+                       break;
+               case 'hospitals':
+                       $row['category'] = $this->project_category_category;
+                       break;
+               default: // other
+                       $row['category'] = $this->project_category_other;
+                       break;
+               }
+
+               // Translate NULL values.
+               if(!isset($project['whole_area']) || $project['whole_area'] == null)
+                       $project['whole_area'] = '';
+               if(!isset($project['year_begin']) || $project['year_begin'] == null)
+                       $project['year_begin'] = '';
+               if(!isset($project['year_end']) || $project['year_end'] == null)
+                       $project['year_end'] = '';
+               
+               $descriptions = json_decode($row['description'], true);
+               $row['description'] = $descriptions[$this->lang];
+               if($fullInfo)
+                       $row['descriptions'] = $descriptions;
+               
+               $images = json_decode($row['images'], true);
+               $row['images'] = $images;
+
+               return $row;
+       }
+       
+       public static function insertProject($project)
+       {
+               try {
+                       $db = SingletonDB::connect();
+                       
+                       $db->query("SET NAMES 'utf8'");
+                       
+                       $project['name'] = str_replace("'", "`", $project['name']);
+                       $project['description'] = json_encode(str_replace("'", "`", $project['descriptions']));
+                       $project['images'] = json_encode($project['images']);
+                       
+                       $result = $db->query(
+                               "INSERT INTO `portofolio` (name, category, address, developer, chief_architect, whole_area, height, phase, year_begin, year_end, description, images)
+                                VALUES ('". $project['name']. "', '". $project['category_code']. "', '". $project['address']. "', '". $project['developer']. "', '". $project['chief_architect']. "', ". $project['whole_area']. ", '". $project['height']. "', '". $project['phase']. "', ". $project['year_begin']. ", ". $project['year_end']. ", '". $project['description']. "', '". $project['images']. "')");
+                       
+                       if(!$result)
+                               throw new DBException('query');
+               }
+               catch(DBException $e) {
+                       echo $e->errorMessage();
+                       die();
+               }
+       }
+       
+       public static function updateProject($id, $project)
+       {
+               try {
+                       $db = SingletonDB::connect();
+                       
+                       $db->query("SET NAMES 'utf8'");
+                       
+                       $project['name'] = str_replace("'", "`", $project['name']);
+                       $project['description'] = json_encode(str_replace("'", "`", $project['descriptions']));
+                       $project['images'] = json_encode($project['images']);
+                       
+                       $query = "UPDATE `portofolio` SET name='". $project['name']. "', category='". $project['category_code']. "', address='". $project['address']. "', developer='". $project['developer']. "', chief_architect='". $project['chief_architect']. "', whole_area=". $project['whole_area']. ", height='". $project['height']. "', phase='". $project['phase']. "', year_begin=". $project['year_begin']. ", year_end=". $project['year_end']. ", description='". $project['description']. "', images='". $project['images']. "' WHERE id=". $id;
+                       $result = $db->query($query);
+                       
+                       if(!$result)
+                               throw new DBException('query');
+               }
+               catch(DBException $e) {
+                       echo $e->errorMessage();
+                       die();
+               }
+       }
+
+       public static function deleteProject($id, $project)
+       {
+               foreach($project['images'] as $image)
+               {
+                       deleteImage($image);
+               }
+
+               try {
+                       $db = SingletonDB::connect();
+                       
+                       $query = "DELETE FROM `portofolio` WHERE id=". $id;
+                       $result = $db->query($query);
+                       
+                       if(!$result)
+                               throw new DBException('query');
+               }
+               catch(DBException $e) {
+                       echo $e->errorMessage();
+                       die();
+               }
+       }
+}
+
+//$x = new Content('common');
+//echo $x->getRowNumber(56, 'residential');
+?>
\ No newline at end of file
diff --git a/application/libraries/Singleton_db.php b/application/libraries/Singleton_db.php
new file mode 100644 (file)
index 0000000..e9c44c7
--- /dev/null
@@ -0,0 +1,35 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
+
+/**
+ * Library Singleton_db implements a factory that retrieves a single instance
+ * of a Database object for the whole CodeIgniter application.
+ * 
+ * This avoids opening multiple connections to the same database and ensures
+ * that you obtain a Database object only when you need it.
+ *
+ * @category   Controller
+ * @author             Călin-Andrei Burloiu
+ */
+class Singleton_db {
+       
+       private static $db;
+       
+       function __construct()
+       {
+       }
+       
+       public static function connect()
+       {
+               if(!isset(self::$db))
+               {
+                       $CI = & get_instance();
+                       
+                       self::$db = $CI->load->database('default', TRUE);
+               }
+               
+               return self::$db;
+       }
+}
+
+/* End of file Singleton_db.php */
+/* Location: ./application/libraries/Singleton_db.php */
diff --git a/application/models/videos_model.php b/application/models/videos_model.php
new file mode 100644 (file)
index 0000000..b5ae2d7
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Class Videos_model models videos information from the DB
+ *
+ * @category   Model
+ * @author             Călin-Andrei Burloiu
+ */
+class Videos_model extends CI_Model {
+       private $db = NULL;
+       
+       function __construct()
+       {
+               if ($this->db === NULL)
+               {
+                       $this->load->library('singleton_db');
+                       $this->db = $this->singleton_db->connect();
+               }
+       }
+       
+       function getVideosSummary()
+       {
+               return $this->db->get('videos');
+       }
+       
+       function getVideo($id, $name = NULL)
+       {
+               return $this->db->query('SELECT * from videos WHERE id = ?', $id);
+       }
+}
+
+/* End of file videos_model.php */
+/* Location: ./application/models/videos_model.php */
diff --git a/application/views/catalog/index_view.php b/application/views/catalog/index_view.php
new file mode 100644 (file)
index 0000000..de7d1df
--- /dev/null
@@ -0,0 +1,17 @@
+<div id="body">
+       <?php foreach($query->result() as $video):
+               $img_src = sprintf("data/thumbs/%s_t%02d.jpg", $video->name,
+                       $video->default_thumb); 
+               $video_url = sprintf("video/watch/%d", $video->id);
+               ?>
+               <div class="video-icon">
+                       <img src="<?php echo $img_src ?>" />
+                       <a href="<?php echo $video_url ?>">
+                               <div class="video-icon_title"><?php echo $video->title ?></div>
+                       </a>
+                       <div class="video-icon_duration"><?php echo $video->duration ?></div>
+                       <div class="video-icon_views"><?php echo $video->views . ' views' ?></div>
+                       <!--<div class="video-icon_user"><?php echo 'TODO: print user name' ?></div>-->
+                       <br />
+       <?php endforeach ?>
+</div>
diff --git a/application/views/footer.php b/application/views/footer.php
new file mode 100644 (file)
index 0000000..fdc45c6
--- /dev/null
@@ -0,0 +1,4 @@
+<div id="footer">
+       <hr />
+       Footer goes here!
+</div>
diff --git a/application/views/header.php b/application/views/header.php
new file mode 100644 (file)
index 0000000..1743f0b
--- /dev/null
@@ -0,0 +1,4 @@
+<div id="header">
+       Header goes here!
+       <hr />
+</div>
diff --git a/application/views/html_begin.php b/application/views/html_begin.php
new file mode 100644 (file)
index 0000000..9a2f70d
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+
+<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
+
+<!--TODO: title-->
+<title>TODO</title>
+
+<!--TODO: custom css-->
+<link rel="stylesheet" type="text/css" href="main.css" />
+
+<!--TODO: script-->
+<!--<script type="text/javascript" src="TODO.js"></script>-->
+
+<!--TODO: meta-->
+<meta name="description" content="TODO" /> 
+<meta name="keywords" content="TODO" />
+
+</head>
+
+<body>
diff --git a/application/views/html_end.php b/application/views/html_end.php
new file mode 100644 (file)
index 0000000..9870926
--- /dev/null
@@ -0,0 +1,3 @@
+</body>
+
+</html>
\ No newline at end of file
diff --git a/application/views/tmp.php b/application/views/tmp.php
new file mode 100644 (file)
index 0000000..7f10a77
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+
+<!--TODO: title-->
+<title>Conforming XHTML 1.1 Template</title>
+
+<!--TODO: custom css-->
+<link rel="stylesheet" type="text/css" href="main.css" />
+
+<!--TODO: script-->
+<!--<script type="text/javascript" src="TODO.js"></script>-->
+
+<!--TODO: meta-->
+<meta name="description" content="TODO" /> 
+<meta name="keywords" content="TODO" /> 
+
+</head>
+
+<body>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/application/views/video/watch_view.php b/application/views/video/watch_view.php
new file mode 100644 (file)
index 0000000..8984694
--- /dev/null
@@ -0,0 +1,14 @@
+<div id="body">
+       <!-- Invalid name in URL-->
+       <?php if (isset($video->err) && $video->err == 'INVALID_NAME'): 
+               $suggestion = site_url(sprintf("video/watch/%d/%s", $video->id, 
+                       $video->name))
+               ?>
+               <p>Invalid URL <em><?php echo current_url() ?></em> .</p>
+               <p>Did you mean <a href="<?php echo $suggestion ?>">
+                       <?php echo $suggestion ?></a> ?</p>
+       <!-- Correct URL-->
+       <?php else: ?>
+               <h1><?php echo $video->title ?></h1>
+       <?php endif ?>
+</div>
\ No newline at end of file