[PC-BSD Commits] r3688 - in websites/pbidir.com: . bibivu/bin bibivu/etc bibivu/lib bibivu/sbin bibivu/slib bibivu/tpl/pbidir bibivu/tpl/pbidir/pbi

svn at pcbsd.org svn at pcbsd.org
Sat Mar 28 19:52:30 PST 2009


Author: fabry
Date: 2009-03-28 20:52:30 -0700 (Sat, 28 Mar 2009)
New Revision: 3688

Modified:
   websites/pbidir.com/bibivu/bin/start.php
   websites/pbidir.com/bibivu/etc/display.conf.php
   websites/pbidir.com/bibivu/etc/uri.conf.php
   websites/pbidir.com/bibivu/lib/permissions.php
   websites/pbidir.com/bibivu/sbin/uri.php
   websites/pbidir.com/bibivu/slib/table_prototype.php
   websites/pbidir.com/bibivu/tpl/pbidir/header.php
   websites/pbidir.com/bibivu/tpl/pbidir/pbi/icons.php
   websites/pbidir.com/bibivu/tpl/pbidir/pbi/versions.php
   websites/pbidir.com/index.php
Log:
small bug fixes and new functionality to the base system

Modified: websites/pbidir.com/bibivu/bin/start.php
===================================================================
--- websites/pbidir.com/bibivu/bin/start.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/bin/start.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -784,53 +784,56 @@
 	 	switch($this->uri->get_num(3,'pbi')){
 			case 'download.rss':
 			case 'download.xml':
-				$filters = array();
-				$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-				$filters[] = array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
-				$group = array();
-				$order = array('total_download DESC');
-				$limit = 20;
-				$tmps = $this->pbi->get_raw($filters, $order, $group, $limit);
+				$rss->title	= 'pbiDIR - most downloaded software';
+				$filters	= array();
+				$filters[]	= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+				$filters[]	= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+				$group		= array();
+				$order		= array('total_download DESC');
+				$limit		= 20;
+				$join		= array();
+				$tmps		= $this->pbi->get_raw($filters, $order, $group, $limit);
 				break;
 			case 'release.rss':
 			case 'release.xml':
-				$rss->title = 'pbiDIR - latest releases';
-				$filters = array();
-				$filters[] = array('field'=>'pbi_release.active', 'operator'=>'=', 'value'=>'y');
-				$filters[] = array('field'=>'pbi_release.current_status_id', 'operator'=>'=', 'value'=>'100');
-				$group = array('pbi_id');
-				$order = array('pbi_release.date_last_status_id DESC');
-				$limit = 20;
-				$join = array();
-				$fields = array('MAX(pbi_release.date_last_status_id) date_last_status_id', 'MAX(pbi_release.id) id', 'pbi_id');
-				$tmps =  load_library('pbi_release')->get_all($filters, $order, $group, $limit, '', $join, $fields);
+				$rss->title	= 'pbiDIR - latest releases';
+				$filters	= array();
+				$filters[]	= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+				$filters[]	= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+				$group		= array('pbi_id');
+				$order		= array('date_last_status_id DESC');
+				$limit		= 20;
+				$join		= array();
+				$fields		= array('MAX(date_last_status_id) date_last_status_id', 'MAX(id) id', 'pbi_id');
+				$tmps		= load_library('pbi_release')->get_all($filters, $order, $group, $limit, '', $join, $fields);
 				break;
 			case 'pbi.rss':
 			case 'pbi.xml':
 			default:
-				$rss->title = 'pbiDIR - latest pbi';
-				$filters = array();
-				$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-				$filters[] = array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
-				$group = array();
-				$order = array('date_added DESC');
-				$limit = 20;
-				$tmps = $this->pbi->get_raw($filters, $order, $group, $limit);
+				$rss->title	= 'pbiDIR - latest pbi';
+				$filters	= array();
+				$filters[]	= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+				$filters[]	= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+				$group		= array();
+				$order		= array('date_added DESC');
+				$limit		= 20;
+				$join		= array();
+				$tmps		= $this->pbi->get_raw($filters, $order, $group, $limit);
 				break;
 		}
+
 		$pbi_uri = $this->display->get('pbi_uri');
 		foreach($tmps as $pbi) {
 			$item = new FeedItem();
 
-			$item->title = isset($pbi['name'])?$pbi['name']:$pbi['pbi'].' '.$pbi['version'];
-			$item->link = $pbi_uri.'/'.(isset($pbi['pbi_id'])?$pbi['pbi_id'].'/':'').$pbi['id'].'/'.strtolower(preg_replace('/[^0-9a-z]/i','_',(isset($pbi['name'])?$pbi['name']:$pbi['pbi'])));
-			$item->description = $pbi['summary'];
-			$item->date = strtotime($pbi['date_last_status_id']);
-			$item->source = 'http://www.pbidir.com';
+			$item->title		= isset($pbi['name'])?$pbi['name']:$pbi['pbi'].' '.$pbi['version'];
+			$item->link			= $pbi_uri.'/'.(isset($pbi['pbi_id'])?$pbi['pbi_id'].'/':'').$pbi['id'].'/'.strtolower(preg_replace('/[^0-9a-z]/i','_',(isset($pbi['name'])?$pbi['name']:$pbi['pbi'])));
+			$item->description	= $pbi['summary'];
+			$item->date			= strtotime($pbi['date_last_status_id']);
+			$item->source		= 'http://www.pbidir.com';
 			if(isset($pbi['vendor'])){
-				$item->author = $pbi['vendor'];
+				$item->author	= $pbi['vendor'];
 			}
-			
 			$rss->addItem($item);
 		}
 		$rss->outputFeed('RSS1.0'); 

Modified: websites/pbidir.com/bibivu/etc/display.conf.php
===================================================================
--- websites/pbidir.com/bibivu/etc/display.conf.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/etc/display.conf.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -43,6 +43,8 @@
 $display['meta'][7]['name']			= 'description';
 $display['meta'][7]['content']		= 'pbi Directory, where you can find software for your PC-BSD operating system';
 
+$display['meta'][8]['http-equiv']	= 'Content-Style-Type';
+$display['meta'][8]['content']		= 'text/css';
 
 $display['link'][1]['type']			= 'text/css';
 $display['link'][1]['rel']			= 'stylesheet';

Modified: websites/pbidir.com/bibivu/etc/uri.conf.php
===================================================================
--- websites/pbidir.com/bibivu/etc/uri.conf.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/etc/uri.conf.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -18,8 +18,9 @@
 example, if you use apache and index.php as main file, add this to the .htaccess file
 
 RewriteEngine On
-RewriteCond %{REQUEST_URI} !.php|.css|.js|.jpg|.jpeg|.gif|.png$
-	RewriteRule ^(.*)$ /index.php/$1 [L]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+	RewriteRule ^(.*) index.php
 
 and add any other kind of extension to the RewriteCond part
 default: false
@@ -27,6 +28,14 @@
 $uri['hide_self']			= true;
 
 /*
+ - BETA FUNCTIONALITY
+the next parameters decide to show or hide the CLASS_KEY and/or the TASK_KEY.
+if they are hidde, the CLASS_KEY is always the first parameter, and the CLASS_KEY will always be the second parameter in the URL
+default: false
+*/
+$uri['hide_keys']			= false;
+
+/*
 this decice to show or not the host server when referring to local pages.
 default: false
 
@@ -42,7 +51,7 @@
 for example:
 	/bt/category
 will be:
-	/bt/category
+	/bt/category.html
 	
 default: .html
 

Modified: websites/pbidir.com/bibivu/lib/permissions.php
===================================================================
--- websites/pbidir.com/bibivu/lib/permissions.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/lib/permissions.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -161,7 +161,7 @@
 		if(!$this->is_logged() || 
 			(!isset($this->user['group']) && !$this->get_user_group_info())
 		  )	return false;	//no group selected
-		if($this->user['status'] != 'active') return false;
+		if($this->user['status'] != 'active' && $this->user['status'] != '') return false;
 		if($this->user['group']['code']=='root'){
 			//can do everything
 			return true;

Modified: websites/pbidir.com/bibivu/sbin/uri.php
===================================================================
--- websites/pbidir.com/bibivu/sbin/uri.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/sbin/uri.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -1,13 +1,14 @@
 <?php
 class uri{
-	private $GET = array();
-	private $GETnum = array(NULL);
-	private $extraGET = array();
-	private $add_extraGET = false;
-	private $delimiter = '/';
-	private $hide_self = false;
-	private $hide_host = false;
-	private $extension = '.html';
+	private $GET			= array();
+	private $GETnum			= array(NULL);
+	private $extraGET		= array();
+	private $add_extraGET	= false;
+	private $delimiter		= '/';
+	private $hide_self		= false;
+	private $hide_host		= false;
+	private $extension		= '.html';
+	private $hide_keys		= false;
 
 	/**
 	 * Initialize the uri
@@ -23,6 +24,7 @@
 		$this->set_hide_self($config->get('uri_hide_self',false));
 		$this->set_hide_host($config->get('uri_hide_host',false));
 		$this->set_extension($config->get('uri_extension','.html'));
+		$this->set_hide_keys($config->get('uri_hide_keys',false));
 
 		$this->_fill_GET();
 //		$host	= $_SERVER['HTTP_HOST'];
@@ -45,6 +47,9 @@
 	public function set_extension($extension='.html'){
 		$this->extension = $extension;
 	}
+	public function set_hide_keys($hide_keys=false){
+		$this->hide_keys = (bool)$hide_keys;
+	}
 
 	public function check_uri($uri){
 		if (trim($uri) == '' || (
@@ -85,8 +90,12 @@
 	
 	public function set($key, $value){
 		$this->GET[$key] = $value;
-		$this->GETnum[] = $key;
-		$this->GETnum[] = $value;
+		if($this->hide_keys==true && $key==CLASS_KEY && is_array($this->GETnum)){
+			array_unshift($this->GETnum,$key,$value);
+		} else {
+			$this->GETnum[] = $key;
+			$this->GETnum[] = $value;
+		}
 	}
 	
 	/**
@@ -192,20 +201,34 @@
 						}
 					}
 				} else {
-					$key = urldecode($tmp[$i]);
-					$value = urldecode(isset($tmp[$i+1])?$tmp[$i+1]:'');
-					if(strpos($value,'?')!==false){
-						$value = substr($value,0,strpos($value,'?'));
-					}
-					$this->GETnum[] = $key;
-					$this->GETnum[] = $value;
-					if(isset($this->GET[$key])){
-						if(!is_array($this->GET[$key])){
-							$this->GET[$key] = array($this->GET[$key]);
+					if($i==0 && $this->hide_keys==true){
+						$key	= CLASS_KEY;
+						$value	= urldecode($tmp[$i]);
+						$this->GETnum[] = $key;
+						$this->GETnum[] = $value;
+						$this->GET[$key] = $value;
+
+						$key	= TASK_KEY;
+						$value	= urldecode(isset($tmp[$i+1])?$tmp[$i+1]:'');
+						$this->GETnum[] = $key;
+						$this->GETnum[] = $value;
+						$this->GET[$key] = $value;
+					} else {
+						$key	= urldecode($tmp[$i]);
+						$value	= urldecode(isset($tmp[$i+1])?$tmp[$i+1]:'');
+						if(strpos($value,'?')!==false){
+							$value = substr($value,0,strpos($value,'?'));
 						}
-						$this->GET[$key][] = $value;
-					} else {
-						$this->GET[$key] = $value;
+						$this->GETnum[] = $key;
+						$this->GETnum[] = $value;
+						if(isset($this->GET[$key])){
+							if(!is_array($this->GET[$key])){
+								$this->GET[$key] = array($this->GET[$key]);
+							}
+							$this->GET[$key][] = $value;
+						} else {
+							$this->GET[$key] = $value;
+						}
 					}
 				}
 			}
@@ -263,6 +286,16 @@
 //			$query = array_merge($this->extraGET, $query);		//this renumber the keys
 			$query = $query + $this->extraGET;					//this adds only the new keys
 		}
+		if($this->hide_keys==true){
+			$newQry[] = urlencode($this->get(CLASS_KEY));
+			if(isset($query[TASK_KEY])){
+				$newQry[] = urlencode($query[TASK_KEY]);
+			} else {
+				$newQry[] = urlencode($this->get(TASK_KEY));
+			}
+			unset($query[CLASS_KEY]);
+			unset($query[TASK_KEY]);
+		}
 		foreach($query as $key => $item){
 			if(is_array($item)){
 				foreach($item as $kk => $vv){
@@ -277,9 +310,7 @@
 					}
 				}
 			} else {
-				if($key!=CLASS_KEY || $item!=STARTUP){
-					$newQry[] = urlencode($key).$this->delimiter.urlencode($item);
-				}
+				$newQry[] = urlencode($key).$this->delimiter.urlencode($item);
 			}
 		}
 
@@ -300,7 +331,7 @@
 			}
 		} else {
 			$host .= $domain;
-			if(strpos($domain.$page,$this->delimiter)===false)	$host .= $this->delimiter;
+//			if(strpos($domain.$page,$this->delimiter)===false)	$host .= $this->delimiter;
 		}
 
 		if($port==NULL){

Modified: websites/pbidir.com/bibivu/slib/table_prototype.php
===================================================================
--- websites/pbidir.com/bibivu/slib/table_prototype.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/slib/table_prototype.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -347,9 +347,12 @@
 	}
 	
 	private function _process_where_single($where){
-		if(!isset($where['field']) || !isset($where['operator']) || !isset($where['value'])){
+		if(!isset($where['field']) || !isset($where['operator'])){
 			return '';
 		}
+		if(!isset($where['value'])){
+			$where['value'] = '';
+		}
 		$append		= '';
 		$field		= $where['field'];
 		$operator	= strtoupper($where['operator']);

Modified: websites/pbidir.com/bibivu/tpl/pbidir/header.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/header.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/tpl/pbidir/header.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -1,9 +1,9 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html lang="<?=load_library('lang')->get_lang()?>" dir="ltr" xml:lang="<?=load_library('lang')->get_lang()?>" xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_latest_software');?>" href="/bt/rss/pbi.rss">
-	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_latest_releases');?>" href="/bt/rss/release.rss">
-	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_most_downloaded_software');?>" href="/bt/rss/download.rss">
+	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_latest_software');?>" href="/bt/rss/pbi.rss"/>
+	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_latest_releases');?>" href="/bt/rss/release.rss"/>
+	<link rel="alternate" type="application/rss+xml" title="PBIdir - <?=load_library('lang')->get('home_most_downloaded_software');?>" href="/bt/rss/download.rss"/>
 
 
 <?php

Modified: websites/pbidir.com/bibivu/tpl/pbidir/pbi/icons.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/pbi/icons.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/tpl/pbidir/pbi/icons.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -1,22 +1,22 @@
 <div class="pbi_icons">
 <?php
 if($pbi['use_wine']=='y'){
-	?><a href="<?=$type_uri?>/wine"><img src="/bibivu/tpl/pbidir/images/pbi/icon_wine.png" alt="<?=load_library('lang')->get('pbi_use_wine')?>" title="<?=load_library('lang')->get('pbi_use_wine')?>" class="pbi_legend" /><a/><?php
+	?><a href="<?=$type_uri?>/wine"><img src="/bibivu/tpl/pbidir/images/pbi/icon_wine.png" alt="<?=load_library('lang')->get('pbi_use_wine')?>" title="<?=load_library('lang')->get('pbi_use_wine')?>" class="pbi_legend" /></a><?php
 }
 if($pbi['alternative_for']!=''){
-	?><a href="<?=$type_uri?>/alter"><img src="/bibivu/tpl/pbidir/images/pbi/icon_windows.gif" alt="<?=load_library('lang')->get('pbi_alternative_for_windows_package')?>" title="<?=load_library('lang')->get('pbi_alternative_for_windows_package')?>" class="pbi_legend" /><a/><?php
+	?><a href="<?=$type_uri?>/alter"><img src="/bibivu/tpl/pbidir/images/pbi/icon_windows.gif" alt="<?=load_library('lang')->get('pbi_alternative_for_windows_package')?>" title="<?=load_library('lang')->get('pbi_alternative_for_windows_package')?>" class="pbi_legend" /></a><?php
 }
 switch($pbi['interface']){
 	case 'g':
 		if(!isset($hide_legend_g_interface) || $hide_legend_g_interface!==true){
-			?><a href="<?=$type_uri?>/grap_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_gui.gif" alt="<?=load_library('lang')->get('pbi_graphical_interface')?>" title="<?=load_library('lang')->get('pbi_graphical_interface')?>" class="pbi_legend" /><a/><?php
+			?><a href="<?=$type_uri?>/grap_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_gui.gif" alt="<?=load_library('lang')->get('pbi_graphical_interface')?>" title="<?=load_library('lang')->get('pbi_graphical_interface')?>" class="pbi_legend" /></a><?php
 		}
 		break;
 	case 'w':
-		?><a href="<?=$type_uri?>/web_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_web.png" alt="<?=load_library('lang')->get('pbi_web_interface')?>" title="<?=load_library('lang')->get('pbi_web_interface')?>" class="pbi_legend" /><a/><?php
+		?><a href="<?=$type_uri?>/web_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_web.png" alt="<?=load_library('lang')->get('pbi_web_interface')?>" title="<?=load_library('lang')->get('pbi_web_interface')?>" class="pbi_legend" /></a><?php
 		break;
 	case 'c':
-		?><a href="<?=$type_uri?>/comm_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_konsole.png" alt="<?=load_library('lang')->get('pbi_command_line_interface')?>" title="<?=load_library('lang')->get('pbi_command_line_interface')?>" class="pbi_legend" /><a/><?php
+		?><a href="<?=$type_uri?>/comm_i"><img src="/bibivu/tpl/pbidir/images/pbi/icon_konsole.png" alt="<?=load_library('lang')->get('pbi_command_line_interface')?>" title="<?=load_library('lang')->get('pbi_command_line_interface')?>" class="pbi_legend" /></a><?php
 		break;
 }
 ?>

Modified: websites/pbidir.com/bibivu/tpl/pbidir/pbi/versions.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/pbi/versions.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/bibivu/tpl/pbidir/pbi/versions.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -36,7 +36,7 @@
 				<?php
 				$i = 1;
 			}
-			if($i==4){
+			if($i==2){
 				?>
 				</tbody>
 				<thead class="tab_head" id="tab_head_<?=intval($key.$version)?>">
@@ -44,7 +44,7 @@
 						<th colspan="5" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click here for Previous Releases</th>
 					</tr>
 				</thead>
-				<tbody class="<?=($i>=4?'tab_body_'.intval($key.$version):'')?>" style="display:none;">
+				<tbody class="<?=($i>=2?'tab_body_'.intval($key.$version):'')?>" style="display:none;">
 				<?php
 			}
 			?><tr>

Modified: websites/pbidir.com/index.php
===================================================================
--- websites/pbidir.com/index.php	2009-03-28 16:00:45 UTC (rev 3687)
+++ websites/pbidir.com/index.php	2009-03-29 03:52:30 UTC (rev 3688)
@@ -134,11 +134,9 @@
 $config		= load_class('config', true);
 $uri		= load_class('uri', true, $config);
 $startup	= $uri->get(CLASS_KEY);
-if($startup==''){
+if($startup=='' || !load_class($startup, true)){
+	$uri->set(CLASS_KEY,STARTUP);
 	load_class(STARTUP, true);
-} else {
-	//I should show an error if the class doesn't exists
-	load_class($startup, true);
 }
 /*
 if($bibivu	=& load_class('bibivu')){



More information about the Commits mailing list