[PC-BSD Commits] r1711 - in websites/pbidir.com/bibivu: etc/lang/en lib

svn at pcbsd.org svn at pcbsd.org
Thu Apr 10 16:31:56 PDT 2008


Author: fabry
Date: 2008-04-10 16:31:55 -0700 (Thu, 10 Apr 2008)
New Revision: 1711

Modified:
   websites/pbidir.com/bibivu/etc/lang/en/home.lang.php
   websites/pbidir.com/bibivu/lib/pbi.php
   websites/pbidir.com/bibivu/lib/pbi_release.php
Log:
increased size of version for released and url for vendor in pbi.

Modified: websites/pbidir.com/bibivu/etc/lang/en/home.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/en/home.lang.php	2008-04-10 21:22:58 UTC (rev 1710)
+++ websites/pbidir.com/bibivu/etc/lang/en/home.lang.php	2008-04-10 23:31:55 UTC (rev 1711)
@@ -10,5 +10,5 @@
 $lang['footer_note']		= 'Registered trade marks belong to their respective authors';
 $lang['contact_us']			= 'Contact us';
 
-$lang['site_developers']	= 'Take a look at hour <a href="%s">Web Developers</a>';
+$lang['site_developers']	= 'Take a look at our <a href="%s">Web Developers</a>';
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/lib/pbi.php
===================================================================
--- websites/pbidir.com/bibivu/lib/pbi.php	2008-04-10 21:22:58 UTC (rev 1710)
+++ websites/pbidir.com/bibivu/lib/pbi.php	2008-04-10 23:31:55 UTC (rev 1711)
@@ -1,441 +1,441 @@
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-// ------------------------------------------------------------------------
-class pbi extends table_prototype{
-	/**
-	 * Initialize the default class
-	 *
-`	 * @access	private
-	 * @return	void
-	 */ 
-	public function __construct(){
-		parent::__construct();
-		$this->set_table_name('pbi');
-		$this->format =& load_library('format');
-	}
-	
-	public function get_related_tables(){
-		//this is the table that relate all the tables with each other
-		
-		if($this->related==array()){
-			$related = array();
-/*
-			$related[] = array(		'table'			=> 'user',
-									'field'			=> 'id',
-									'main_field'	=> 'id',
-									'show'			=> 'field',		//field, list	- field not working yet
-									'name'			=> 'Users',
-									'relation_table'=> array(
-															'name'			=> 'pbi_user',
-															'field_from'	=> 'pbi_id',
-															'field_to'		=> 'user_id',
-															),
-							  );
-*/
-			$related[] = array(		'table'			=> 'pbi_release',
-									'field'			=> 'pbi_id',
-									'main_field'	=> 'id',
-									'show'			=> 'list',		//field, list
-									'name'			=> 'Releases',
-									'autoopen'		=> false,
-									'relation_table'=> array(),
-							  );
-
-			$related[] = array(		'table'			=> 'pbi_image',
-									'field'			=> 'pbi_id',
-									'main_field'	=> 'id',
-									'show'			=> 'list',		//field, list
-									'name'			=> 'Images',
-									'autoopen'		=> false,
-									'relation_table'=> array(),
-							  );
-
-			$related[] = array(		'table'			=> 'status',
-									'field'			=> 'id',
-									'main_field'	=> 'current_status_id',
-									'show'			=> 'list',		//field, list
-									'name'			=> 'Statuses',
-									'autoopen'		=> false,
-									'relation_table'=> array(
-															'table'			=> 'pbi_status',
-															'field'			=> 'pbi_id',
-															'main_field'	=> 'id',
-															),
-							  );
-			$related[] = array(		'table'			=> 'user',
-									'field'			=> 'id',
-									'main_field'	=> 'user_id',
-									'show'			=> 'list',		//field, list
-									'name'			=> 'Subscriptions',
-									'autoopen'		=> false,
-									'relation_table'=> array(
-															'table'			=> 'subscriptions',
-															'field'			=> 'pbi_id',
-															'main_field'	=> 'id',
-															),
-							  );
-			$this->related = $related;
-		}
-		return $this->related;
-	}
-
-	public function get_fields(){
-		if($this->fields==array()){
-
-			$fields['id'] = array(		'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'number',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'id',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['name'] = array(	'show'	=> true,
-										'view_link'=>true,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 40,
-										'values'=> NULL,
-										'text'	=> 'Name',
-										'required' => true,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$filters = array();
-			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-			$tmps = $this->get_raw($filters, array('name'),array(), '','category');
-			$values = array();
-			foreach($tmps as $tmp){
-				$values[] = $tmp['id'].','.$tmp['name'];
-			}
-			$fields['category_id'] = array(	'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> implode('|',$values),
-										'text'	=> 'Category',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$filters = array();
-			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-			$tmps = $this->get_raw($filters, array('name'),array(), '','licence');
-			$values = array();
-			foreach($tmps as $tmp){
-				$values[] = $tmp['id'].','.$tmp['name'];
-			}
-			$fields['licence_id'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> implode('|',$values),
-										'text'	=> 'Licence',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$filters = array();
-			$filters[0] = array('field'=>'status', 'operator'=>'=', 'value'=>'active');
-			$filters[1][] = array('field'=>'group_id', 'operator'=>'=', 'value'=>'1');	//root
-			$filters[1][] = array('field'=>'group_id', 'operator'=>'=', 'value'=>'3');	//Maintainer
-			$tmps = $this->get_raw($filters, array('name'),array(), '','user');
-			$values = array();
-			foreach($tmps as $tmp){
-				$values[] = $tmp['id'].','.($tmp['name']!=''?$tmp['name']:$tmp['user']);
-			}
-			$fields['user_id'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> implode('|',$values),
-										'text'	=> 'User',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$fields['summary'] = array(	'show'	=> true,
-										'view_link'	=> false,
-										'edit_link'=>false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Summary',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['description'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit_link'=>false,
-										'edit'	=> true,
-										'type'	=> 'text',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Description',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['vendor_name'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit_link'=>false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Vendor Name',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['vendor_url'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit_link'=>false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 40,
-										'values'=> NULL,
-										'text'	=> 'Vendor URI',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['alternative_for'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit_link'=>false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 50,
-										'values'=> NULL,
-										'text'	=> 'Alternative For',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['use_wine'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> 'y,Yes|n,No',
-										'text'	=> 'Uses Wine',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'n',
-										'image'	=> false,
-								);
-			$fields['interface'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> 'g,Graphical|w,Web|c,Command line',
-										'text'	=> 'Interface',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'n',
-										'image'	=> false,
-								);
-			$fields['keep_versions'] = array(	'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> '0,All|1|2|3|4|5|6|7|8|9|10',
-										'text'	=> 'Versions to Keep',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$fields['active'] = array(	'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> 'y,Yes|n,No',
-										'text'	=> 'Active',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$fields['date_last_status_id'] = array(		'show'	=> 'field',
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'date',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'Last Updated',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['date_last_modified'] = array(		'show'	=> 'field',
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'date',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'Last Modified',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['date_added'] = array(		'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'date',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'Date Added',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['status'] = array(		'show'	=> 'view',
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'Status',
-										'required' => NULL,
-										'post'	=> false,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['icon'] = array(		'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'file',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Icon',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> true,
-										'image_width' => 40,
-										'image_heigth' => NULL,
-								);
-			$this->fields = $fields;
-		}
-		return $this->fields;
-	}
-	
-	public function vote_pbi($pbi_id,$vote){
-		if(is_numeric($vote) && $vote>0){
-			$filters = array(
-							array('field'=>'active', 'operator'=>'=', 'value'=>'y'),
-							array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_id)
-						);
-			$ret = $this->update()->set('total_votes','total_votes+1',true)->set('total_points','total_points + '.$vote,true)->where($filters)->do_db();
-			if($ret!==false){
-				$_SESSION['votes'][$pbi_id] = $vote;
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	public function get_vote($pbi_id){
-		$filters = array(
-						array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_id)
-					);
-		$ret = $this->select()->fields(array('total_points','total_votes'))->where($filters)->do_db()->db->fetch_array($this->last_result());
-		if($ret!==false){
-			return (($ret['total_points']+5)/($ret['total_votes']+1));
-		} else {
-			return 'Error Retrieving Vote!!';
-		}
-	}
-	
-	public function get_info(){
-		//I only format all the output
-		$return = parent::get_info();
-		if(!isset($return['status'])){		//do this only once
-			$return['id']					= $this->get('id');
-//			$return['name']					= $this->get('name').$this->get('version');
-//			$return['date_last_status_id']	= $this->format->date($this->get('date_last_status_id'));
-//			$return['date_last_modified']	= $this->format->date($this->get('date_last_modified'));
-//			$return['date_added']			= $this->format->date($this->get('date_added'));
-			$return['rating']				= $this->format->number_format(($this->get('total_points')+5)/($this->get('total_votes')+1),2);
-//			$return['total_download']		= $this->format->number_format($this->get('total_download'));
-			$return['licence']				= isset($return['licence_id'])? $this->get_record($return['licence_id'],'licence')->get('name'):'';
-			$return['status']				= isset($return['current_status_id'])? $this->get_record($return['current_status_id'],'status')->get('name'):'';
-			if(isset($return['user_id'])){
-				$user = $this->get_record($return['user_id'],'user');
-				$return['contributor_name']		= $user->get('name');
-				$return['contributor_email']	= $user->get('email');
-			} else {
-				$return['contributor_name']		= '';
-				$return['contributor_email']	= '';
-			}
-			$this->current = $return;
-		}
-		return $return;
-	}
-	
-	public function add_comment($pbi_id, $comment, $user_id=0, $user='', $IP=NULL){
-		if(trim($comment)!=''){
-			if(is_null($IP)){
-				$IP = $_SERVER['REMOTE_ADDR'];
-			}
-			$ret = $this->insert()->from('pbi_comment')->set('pbi_id',$pbi_id)->set('user_id',$user_id)->set('user',$user)->set('comment',$comment)->set('ip',$IP)->do_db();
-			if($ret!==false){
-				return $this->db->insert_id();
-//				return true;
-			}
-		}
-		return false;
-	}
-	
-	public function delete_comment($pbi_id, $id){
-		$filters = array();
-		$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[] = array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$pbi_id);
-		$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$id);
-		return $this->update()->from('pbi_comment')->set('active','n')->where($filters)->do_db();
-//		return $this->delete()->from('pbi_comment')->where($filters);
-	}
-
-	public function add($tt_post){
-		$tt_post['date_added'] = strftime('%Y-%m-%d %T');
-//		$tt_post['date_added'] = date('Y-m-d');
-		return parent::add($tt_post);
-	}
-/*
-	public function get_all($where=array(), $orders=array(), $group=array(), $limit='', $from='', $join = array(), $xtrfields = array()){
-		$fields = $this->get_fields();
-		$str = '^('.implode('|', array_keys($fields)).').?(ASC|DESC)?$';
-		foreach($orders as $key=>$order){
-			if(!eregi($str,$order)){
-				$orders[$key] = 'name';
-			}
-		}
-		return parent::get_all($where, $orders, $group, $limit, $from, $join, $xtrfields);
-	}
-*/
-}
+<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+// ------------------------------------------------------------------------
+class pbi extends table_prototype{
+	/**
+	 * Initialize the default class
+	 *
+`	 * @access	private
+	 * @return	void
+	 */ 
+	public function __construct(){
+		parent::__construct();
+		$this->set_table_name('pbi');
+		$this->format =& load_library('format');
+	}
+	
+	public function get_related_tables(){
+		//this is the table that relate all the tables with each other
+		
+		if($this->related==array()){
+			$related = array();
+/*
+			$related[] = array(		'table'			=> 'user',
+									'field'			=> 'id',
+									'main_field'	=> 'id',
+									'show'			=> 'field',		//field, list	- field not working yet
+									'name'			=> 'Users',
+									'relation_table'=> array(
+															'name'			=> 'pbi_user',
+															'field_from'	=> 'pbi_id',
+															'field_to'		=> 'user_id',
+															),
+							  );
+*/
+			$related[] = array(		'table'			=> 'pbi_release',
+									'field'			=> 'pbi_id',
+									'main_field'	=> 'id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Releases',
+									'autoopen'		=> false,
+									'relation_table'=> array(),
+							  );
+
+			$related[] = array(		'table'			=> 'pbi_image',
+									'field'			=> 'pbi_id',
+									'main_field'	=> 'id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Images',
+									'autoopen'		=> false,
+									'relation_table'=> array(),
+							  );
+
+			$related[] = array(		'table'			=> 'status',
+									'field'			=> 'id',
+									'main_field'	=> 'current_status_id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Statuses',
+									'autoopen'		=> false,
+									'relation_table'=> array(
+															'table'			=> 'pbi_status',
+															'field'			=> 'pbi_id',
+															'main_field'	=> 'id',
+															),
+							  );
+			$related[] = array(		'table'			=> 'user',
+									'field'			=> 'id',
+									'main_field'	=> 'user_id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Subscriptions',
+									'autoopen'		=> false,
+									'relation_table'=> array(
+															'table'			=> 'subscriptions',
+															'field'			=> 'pbi_id',
+															'main_field'	=> 'id',
+															),
+							  );
+			$this->related = $related;
+		}
+		return $this->related;
+	}
+
+	public function get_fields(){
+		if($this->fields==array()){
+
+			$fields['id'] = array(		'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'number',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'id',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['name'] = array(	'show'	=> true,
+										'view_link'=>true,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 40,
+										'values'=> NULL,
+										'text'	=> 'Name',
+										'required' => true,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$filters = array();
+			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+			$tmps = $this->get_raw($filters, array('name'),array(), '','category');
+			$values = array();
+			foreach($tmps as $tmp){
+				$values[] = $tmp['id'].','.$tmp['name'];
+			}
+			$fields['category_id'] = array(	'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> implode('|',$values),
+										'text'	=> 'Category',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$filters = array();
+			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+			$tmps = $this->get_raw($filters, array('name'),array(), '','licence');
+			$values = array();
+			foreach($tmps as $tmp){
+				$values[] = $tmp['id'].','.$tmp['name'];
+			}
+			$fields['licence_id'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> implode('|',$values),
+										'text'	=> 'Licence',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$filters = array();
+			$filters[0] = array('field'=>'status', 'operator'=>'=', 'value'=>'active');
+			$filters[1][] = array('field'=>'group_id', 'operator'=>'=', 'value'=>'1');	//root
+			$filters[1][] = array('field'=>'group_id', 'operator'=>'=', 'value'=>'3');	//Maintainer
+			$tmps = $this->get_raw($filters, array('name'),array(), '','user');
+			$values = array();
+			foreach($tmps as $tmp){
+				$values[] = $tmp['id'].','.($tmp['name']!=''?$tmp['name']:$tmp['user']);
+			}
+			$fields['user_id'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> implode('|',$values),
+										'text'	=> 'User',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$fields['summary'] = array(	'show'	=> true,
+										'view_link'	=> false,
+										'edit_link'=>false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Summary',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['description'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit_link'=>false,
+										'edit'	=> true,
+										'type'	=> 'text',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Description',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['vendor_name'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit_link'=>false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Vendor Name',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['vendor_url'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit_link'=>false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 50,
+										'values'=> NULL,
+										'text'	=> 'Vendor URI',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['alternative_for'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit_link'=>false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 50,
+										'values'=> NULL,
+										'text'	=> 'Alternative For',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['use_wine'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> 'y,Yes|n,No',
+										'text'	=> 'Uses Wine',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'n',
+										'image'	=> false,
+								);
+			$fields['interface'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> 'g,Graphical|w,Web|c,Command line',
+										'text'	=> 'Interface',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'n',
+										'image'	=> false,
+								);
+			$fields['keep_versions'] = array(	'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> '0,All|1|2|3|4|5|6|7|8|9|10',
+										'text'	=> 'Versions to Keep',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$fields['active'] = array(	'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> 'y,Yes|n,No',
+										'text'	=> 'Active',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$fields['date_last_status_id'] = array(		'show'	=> 'field',
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'date',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'Last Updated',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['date_last_modified'] = array(		'show'	=> 'field',
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'date',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'Last Modified',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['date_added'] = array(		'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'date',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'Date Added',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['status'] = array(		'show'	=> 'view',
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'Status',
+										'required' => NULL,
+										'post'	=> false,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['icon'] = array(		'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'file',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Icon',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> true,
+										'image_width' => 40,
+										'image_heigth' => NULL,
+								);
+			$this->fields = $fields;
+		}
+		return $this->fields;
+	}
+	
+	public function vote_pbi($pbi_id,$vote){
+		if(is_numeric($vote) && $vote>0){
+			$filters = array(
+							array('field'=>'active', 'operator'=>'=', 'value'=>'y'),
+							array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_id)
+						);
+			$ret = $this->update()->set('total_votes','total_votes+1',true)->set('total_points','total_points + '.$vote,true)->where($filters)->do_db();
+			if($ret!==false){
+				$_SESSION['votes'][$pbi_id] = $vote;
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public function get_vote($pbi_id){
+		$filters = array(
+						array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_id)
+					);
+		$ret = $this->select()->fields(array('total_points','total_votes'))->where($filters)->do_db()->db->fetch_array($this->last_result());
+		if($ret!==false){
+			return (($ret['total_points']+5)/($ret['total_votes']+1));
+		} else {
+			return 'Error Retrieving Vote!!';
+		}
+	}
+	
+	public function get_info(){
+		//I only format all the output
+		$return = parent::get_info();
+		if(!isset($return['status'])){		//do this only once
+			$return['id']					= $this->get('id');
+//			$return['name']					= $this->get('name').$this->get('version');
+//			$return['date_last_status_id']	= $this->format->date($this->get('date_last_status_id'));
+//			$return['date_last_modified']	= $this->format->date($this->get('date_last_modified'));
+//			$return['date_added']			= $this->format->date($this->get('date_added'));
+			$return['rating']				= $this->format->number_format(($this->get('total_points')+5)/($this->get('total_votes')+1),2);
+//			$return['total_download']		= $this->format->number_format($this->get('total_download'));
+			$return['licence']				= isset($return['licence_id'])? $this->get_record($return['licence_id'],'licence')->get('name'):'';
+			$return['status']				= isset($return['current_status_id'])? $this->get_record($return['current_status_id'],'status')->get('name'):'';
+			if(isset($return['user_id'])){
+				$user = $this->get_record($return['user_id'],'user');
+				$return['contributor_name']		= $user->get('name');
+				$return['contributor_email']	= $user->get('email');
+			} else {
+				$return['contributor_name']		= '';
+				$return['contributor_email']	= '';
+			}
+			$this->current = $return;
+		}
+		return $return;
+	}
+	
+	public function add_comment($pbi_id, $comment, $user_id=0, $user='', $IP=NULL){
+		if(trim($comment)!=''){
+			if(is_null($IP)){
+				$IP = $_SERVER['REMOTE_ADDR'];
+			}
+			$ret = $this->insert()->from('pbi_comment')->set('pbi_id',$pbi_id)->set('user_id',$user_id)->set('user',$user)->set('comment',$comment)->set('ip',$IP)->do_db();
+			if($ret!==false){
+				return $this->db->insert_id();
+//				return true;
+			}
+		}
+		return false;
+	}
+	
+	public function delete_comment($pbi_id, $id){
+		$filters = array();
+		$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[] = array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$pbi_id);
+		$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$id);
+		return $this->update()->from('pbi_comment')->set('active','n')->where($filters)->do_db();
+//		return $this->delete()->from('pbi_comment')->where($filters);
+	}
+
+	public function add($tt_post){
+		$tt_post['date_added'] = strftime('%Y-%m-%d %T');
+//		$tt_post['date_added'] = date('Y-m-d');
+		return parent::add($tt_post);
+	}
+/*
+	public function get_all($where=array(), $orders=array(), $group=array(), $limit='', $from='', $join = array(), $xtrfields = array()){
+		$fields = $this->get_fields();
+		$str = '^('.implode('|', array_keys($fields)).').?(ASC|DESC)?$';
+		foreach($orders as $key=>$order){
+			if(!eregi($str,$order)){
+				$orders[$key] = 'name';
+			}
+		}
+		return parent::get_all($where, $orders, $group, $limit, $from, $join, $xtrfields);
+	}
+*/
+}
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/lib/pbi_release.php
===================================================================
--- websites/pbidir.com/bibivu/lib/pbi_release.php	2008-04-10 21:22:58 UTC (rev 1710)
+++ websites/pbidir.com/bibivu/lib/pbi_release.php	2008-04-10 23:31:55 UTC (rev 1711)
@@ -71,7 +71,7 @@
 										'view_link'	=> true,
 										'edit'	=> true,
 										'type'	=> 'string',
-										'length'=> 10,
+										'length'=> 20,
 										'values'=> NULL,
 										'text'	=> 'Version',
 										'required' => true,



More information about the Commits mailing list