--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path=""/>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>P2PTube</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.php.core.PHPNature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
--- /dev/null
+#Thu Aug 25 11:41:32 EEST 2011
+eclipse.preferences.version=1
+include_path=0;/P2PTube
--- /dev/null
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
--- /dev/null
+Window
\ No newline at end of file
$config['proxy_ips'] = '';
+/*
+| -------------------------------------------------------------------
+| Native Autoload - by Phil Sturgeon.
+| -------------------------------------------------------------------
+|
+| Nothing to do with config/autoload.php, this allows PHP autoload to work
+| for base controllers and some third-party libraries.
+|
+| If using HMVC you do not need this! HMVC will autoload.
+|
+| Place this code at the bottom of your application/config/config.php file.
+*/
+function __autoload($class)
+{
+ if (strpos($class, 'CI_') !== 0)
+ {
+ if (file_exists($file = APPPATH . 'core/' . $class . EXT))
+ {
+ include $file;
+ }
+ elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
+ {
+ include $file;
+ }
+ }
+}
+
$route['default_controller'] = "catalog";
$route['404_override'] = '';
-
+// Watch pages
$route['watch/([\d]+)/?'] = "video/watch/$1";
$route['watch/([\d]+)/(.+)'] = "video/watch/$1/$2";
+// Article pages
+$route['about'] = 'article/about';
+$route['help'] = 'article/help';
+
/* End of file routes.php */
<?php
/**
- * Class Admin controlls site administration features
+ * Class Admin controls site administration features
*
* @category Controller
* @author Călin-Andrei Burloiu
--- /dev/null
+<?php
+
+/**
+ * Class Article typically controls static pages.
+ * Their content depends on the language.
+ *
+ * The page views are located in "application/views/article/$language/$method".
+ * Article's name can be set in language file 'article_lang.php' by using an
+ * entry named "article_$method". If not present "$method" is used as a name.
+ * Article meta description has the entry "article_$method_description"
+ *
+ * @category Controller
+ * @author Călin-Andrei Burloiu
+ */
+class Article extends Article_Controller {
+
+ public function _remap($method, $params = array())
+ {
+ // **
+ // ** DATA
+ // **
+ $this->lang->load('article');
+ $title = $this->lang->line("article_$method");
+ if ($title == FALSE)
+ $title = $method;
+ $descr = $this->lang->line("article_${method}_description");
+ if ($descr == FALSE)
+ $descr = '';
+
+ $html_params = array( 'title' =>
+ $title.' - '. $this->config->item('site_name'),
+ 'css' => array(
+ 'jquery-ui.css'
+ ),
+ //'js' => array(),
+ 'metas' => array('description'=>$descr)
+ );
+ $this->load->library('html_head_params', $html_params);
+
+ // **
+ // ** LOADING VIEWS
+ // **
+ $this->load->view('html_begin', $this->html_head_params);
+ $this->load->view('header', array('selected_menu' => $method));
+
+ $this->load->view('echo',
+ array('output' => $this->_load($method, $params),
+ 'clear' => TRUE)
+ );
+
+ $this->load->view('footer');
+ $this->load->view('html_end');
+ }
+}
+
+/* End of file article.php */
+/* Location: ./application/controllers/article.php */
<?php
/**
- * Class Catalog controlls video hierarchy and searching
+ * Class Catalog controls video hierarchy and searching
*
* @category Controller
* @author Călin-Andrei Burloiu
// ** LOADING VIEWS
// **
$this->load->view('html_begin', $this->html_head_params);
- $this->load->view('header', array('selected_menu' => 'Home'));
+ $this->load->view('header', array('selected_menu' => 'home'));
$this->load->view('catalog/index_view', $data);
public function test($page = 0)
{
- $this->load->helper('url');
- $str = '800x600';
-
- echo substr($str, strpos($str, 'x') + 1);
}
public function category($category_id, $offset = 0)
+++ /dev/null
-<?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 */
<?php
/**
- * Class Tmp controlls video hierarchy and searching
+ * Class Tmp controls video hierarchy and searching
*
* @category Controller
* @author Călin-Andrei Burloiu
<?php
/**
- * Class Video controlls video items handling: watching, commenting, rating,
+ * Class Video controls video items handling: watching, commenting, rating,
* adding etc.
*
* @category Controller
--- /dev/null
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Library Article_Controller can be extended by a controller to be used for
+ * content pages that depend on the language.
+ *
+ * Several language specific parameters can be coded in language files.
+ * Non language specific parameters can be putted in config files.
+ *
+ * @category Library
+ * @author Călin-Andrei Burloiu
+ */
+class Article_Controller extends CI_Controller {
+
+ function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * Override this with site specific information (header, menus...) and call
+ * $this->_load which is a generic method that loads the article.
+ * Both parameters must be passed to $this->_load.
+ */
+ public function _remap($method, $params = array())
+ {
+ $this->load->view('echo',
+ array('output' => $this->_load($method, $params),
+ 'clear' => TRUE)
+ );
+ }
+
+ /**
+ * Returns the article based on the language from
+ * "application/views/article/$language/$method".
+ *
+ * @param string $method defines article name
+ * @param array $params odd elements are keys and even elements are
+ * their values (eg.: [0] => key, [1] => value etc.). This are going to
+ * be converted to an associative array that is passed to the view if
+ * $assoc parameter is FALSE. Otherwise this parameter is already an
+ * associative array.
+ * @param bool $assoc states whether or not $params is associative
+ */
+ public function _load($method, $params = array(), $assoc = FALSE)
+ {
+ if (! $assoc)
+ {
+ $alt = 0;
+ $params_assoc = array();
+ $prev_val = NULL;
+ foreach ($params as $i => $val)
+ {
+ if ($alt == 0)
+ $prev_val = $val;
+ else if ($alt == 1)
+ $params_assoc[$prev_val] = $val;
+
+ $alt = ($alt + 1) % 2;
+ }
+ }
+ else
+ $params_assoc = $params;
+
+ return $this->load->view('article/'. $this->config->item('language')
+ . '/' . $method, $params_assoc, TRUE);
+ }
+}
+
+/* End of file Article_Controller.php */
+/* Location: ./application/core/Article_Controller.php */
--- /dev/null
+<?php
+
+$lang['article_about'] = 'About Us';
+
+/* End of file article_lang.php */
+/* Location: ./application/language/english/article_lang.php */
\ No newline at end of file
--- /dev/null
+<?php
+
+$lang['article_about'] = 'Despre noi';
+
+/* End of file article_lang.php */
+/* Location: ./application/language/romanian/article_lang.php */
\ No newline at end of file
<?php
+// Navigation Menu
+$lang['ui_nav_menu_home'] = 'Acasă';
+$lang['ui_nav_menu_about'] = 'Despre';
+$lang['ui_nav_menu_log_in'] = 'Autentificare';
+$lang['ui_nav_menu_register'] = 'Înregistrare';
+$lang['ui_nav_menu_help'] = 'Ajutor';
+
+$lang['ui_search'] = 'Search';
+
// Video Categories
$lang['ui_categ_movies'] = 'Filme';
$lang['ui_categ_tech_talks'] = 'TechTalks';
$lang['ui_category'] = 'categoria';
$lang['ui_tags'] = 'etichete';
$lang['ui_license'] = 'licență';
+$lang['ui_uploaded_by'] = 'Încărcată de';
+$lang['ui_on_date'] = 'în';
/* End of file ui_lang.php */
/* Location: ./application/language/romanian/ui_lang.php */
\ No newline at end of file
* @param int $offset
* @param int $count
* @return array a list of videos, each one being an assoc array with:
- * * id, name, title, duration, thumbs_count, default_thumb, views => from DB
- * * shorted_title => ellipsized title
- * * video_url => P2P-Tube video URl
- * * TODO: user_id, user_name
- * * thumbs => thumbnail images' URLs
+ * <ul>
+ * <li>id, name, title, duration, thumbs_count, default_thumb, views => from DB</li>
+ * <li>shorted_title => ellipsized title</li>
+ * <li>video_url => P2P-Tube video URl</li>
+ * <li>TODO: user_id, user_name</li>
+ * <li>thumbs => thumbnail images' URLs</li>
+ * </ul>
*/
public function get_videos_summary($category_id, $offset, $count)
{
* table. NULL means there is no name provided.
* @return array an associative list with information about a video
* with the following keys:
- * * all columns form DB with some exceptions that are overwritten or new
- * * formats content is moved in assets
- * * assets => list of associative lists where each one represents a
+ * <ul>
+ * <li>all columns form DB with some exceptions that are overwritten or new</li>
+ * <li>content is moved in assets</li>
+ * <li>assets => list of associative lists where each one represents a</li>
* video asset having keys: "src", "res", "par" and "ext". Value of key
* "src" is the video torrent formated as
- * {name}_{format}.{video_ext}.{default_torrent_ext}
- * * user_name => TODO: user name from `users` table
- * * category_title => a human-friendly category name
- * * tags => associative list of "tag => score"
- * * date => date and time when the video was created
- * * thumbs => thumbnail images' URLs
+ * {name}_{format}.{video_ext}.{default_torrent_ext}</li>
+ * <li>user_name => TODO: user name from `users` table</li>
+ * <li>category_title => a human-friendly category name</li>
+ * <li>tags => associative list of "tag => score"</li>
+ * <li>date => date and time when the video was created</li>
+ * <li>thumbs => thumbnail images' URLs</li>
+ * </ul>
*/
public function get_video($id, $name = NULL)
{
--- /dev/null
+About <strong>us</strong>!
\ No newline at end of file
--- /dev/null
+TODO <em>Help</em>
\ No newline at end of file
--- /dev/null
+Despre <strong>noi</strong>!
\ No newline at end of file
--- /dev/null
+TODO <em>Ajutor</em>
\ No newline at end of file
--- /dev/null
+<?php if ($clear): ?>
+ <div style="clear: both"></div>
+<?php endif ?>
+<?php echo $output; //print_r(get_defined_vars());
\ No newline at end of file
$selected_menu = '';
endif ?>
-<ul id="nav-menu"><!--
- Home--><li class="menu-left"><a href="<?php echo site_url() ?>" <?php echo ($selected_menu == 'Home' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_home') ?></a></li><!--
- About--><li class="menu-left"><a href="#"
- <?php echo ($selected_menu == 'About' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_about') ?></a></li><!--
- Help--><li class="menu-left"><a href="#"
- <?php echo ($selected_menu == 'Help' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_help') ?></a></li><!--
+<ul id="nav-menu">
+ <li class="menu-left"><a href="<?php echo site_url() ?>" <?php echo ($selected_menu == 'home' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_home') ?></a></li>
- Register--><li class="menu-right"><a href="#"
- <?php echo ($selected_menu == 'Register' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_register') ?></a></li><!--
- Log In--><li class="menu-right"><a href="#"
- <?php echo ($selected_menu == 'Log In' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_log_in') ?></a></li>
+ <li class="menu-left"><a href="<?php echo site_url('about') ?>"
+ <?php echo ($selected_menu == 'about' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_about') ?></a></li>
+
+ <li class="menu-left"><a href="<?php echo site_url('help') ?>"
+ <?php echo ($selected_menu == 'help' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_help') ?></a></li>
+
+ <li class="menu-right"><a href="#<?php //echo site_url('register') ?>"
+ <?php echo ($selected_menu == 'register' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_register') ?></a></li>
+
+ <li class="menu-right"><a href="#<?php //echo site_url('login') ?>"
+ <?php echo ($selected_menu == 'login' ? 'class="selected"' : '') ?>><?php echo $this->lang->line('ui_nav_menu_log_in') ?></a></li>
</ul>
<div id="header">
--- /dev/null
+* [[http://philsturgeon.co.uk/news/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY|Useful for more basic Controller classes]]
* @link http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller {
+
+ // TODO remove development declaration (used for Eclipse)
+ /**
+ * @var CI_Config
+ */
+ var $config;
+ /**
+ * @var CI_DB_active_record
+ */
+ var $db;
+ /**
+ * @var CI_Email
+ */
+ var $email;
+ /**
+ * @var CI_Form_validation
+ */
+ var $form_validation;
+ /**
+ * @var CI_Input
+ */
+ var $input;
+ /**
+ * @var CI_Loader
+ */
+ var $load;
+ /**
+ * @var CI_Router
+ */
+ var $router;
+ /**
+ * @var CI_Session
+ */
+ var $session;
+ /**
+ * @var CI_Table
+ */
+ var $table;
+ /**
+ * @var CI_Unit_test
+ */
+ var $unit;
+ /**
+ * @var CI_URI
+ */
+ var $uri;
+ /**
+ * @var CI_Pagination
+ */
+ var $pagination;
private static $instance;
* @link http://codeigniter.com/user_guide/libraries/config.html
*/
class CI_Model {
+
+ // TODO remove development declaration (used for Eclipse)
+ /**
+ * @var CI_Config
+ */
+ var $config;
+ /**
+ * @var CI_DB_active_record
+ */
+ var $db;
+ /**
+ * @var CI_Email
+ */
+ var $email;
+ /**
+ * @var CI_Form_validation
+ */
+ var $form_validation;
+ /**
+ * @var CI_Input
+ */
+ var $input;
+ /**
+ * @var CI_Loader
+ */
+ var $load;
+ /**
+ * @var CI_Router
+ */
+ var $router;
+ /**
+ * @var CI_Session
+ */
+ var $session;
+ /**
+ * @var CI_Table
+ */
+ var $table;
+ /**
+ * @var CI_Unit_test
+ */
+ var $unit;
+ /**
+ * @var CI_URI
+ */
+ var $uri;
+ /**
+ * @var CI_Pagination
+ */
+ var $pagination;
/**
* Constructor