[PC-BSD Commits] r3980 - in websites/pbidir.com/bibivu: bin lib sbin

svn at pcbsd.org svn at pcbsd.org
Sun May 24 15:18:34 PDT 2009


Author: fabry
Date: 2009-05-24 15:18:33 -0700 (Sun, 24 May 2009)
New Revision: 3980

Modified:
   websites/pbidir.com/bibivu/bin/pbi_api.php
   websites/pbidir.com/bibivu/lib/mirror.php
   websites/pbidir.com/bibivu/sbin/uri.php
Log:
updater functionality created.

fixes a few warnings and simple re-formatting for other classes

Modified: websites/pbidir.com/bibivu/bin/pbi_api.php
===================================================================
--- websites/pbidir.com/bibivu/bin/pbi_api.php	2009-05-22 20:35:14 UTC (rev 3979)
+++ websites/pbidir.com/bibivu/bin/pbi_api.php	2009-05-24 22:18:33 UTC (rev 3980)
@@ -51,12 +51,12 @@
 		if($category>0 && is_numeric($category)){
 			$filters[] = array('field'=>'category_id', 'operator'=>'=', 'value'=>$category);
 		}
-		$filters[]		= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[]		= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$filters[]	= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]	= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
 		$group		= array();
 		$order		= array('name');
-		$limit			= '';
-		$pbis			= load_library('pbi')->get_all($filters, $order, $group, $limit);
+		$limit		= '';
+		$pbis		= load_library('pbi')->get_all($filters, $order, $group, $limit);
 		$this->display->assign('list',$pbis);
 		$this->display->assign('type','pbis');
 		$this->display('list');
@@ -64,15 +64,15 @@
 
 	public function web_list_release(){
 		$pbi_id		= trim($this->uri->get('pbi'))+0;
-		$bits			= trim($this->uri->get('bits'));
+		$bits		= trim($this->uri->get('bits'));
 
-		$filters		= array();
-		$filters[]		= array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$pbi_id);
-		$filters[]		= array('field'=>'bits', 'operator'=>'=', 'value'=>$bits);
+		$filters	= array();
+		$filters[]	= array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$pbi_id);
+		$filters[]	= array('field'=>'bits', 'operator'=>'=', 'value'=>$bits);
 		
 		$group		= array();
 		$order		= array('date_last_status_id DESC');
-		$limit			= 3;
+		$limit		= 3;
 		$releases	= load_library('pbi_release')->get_all($filters, $order, $group, $limit);
 
 		$this->display->assign('list',$releases);
@@ -82,21 +82,21 @@
 
 	public function web_list_mirror(){
 		$release_id		= trim($this->uri->get('release_id'));
-		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[]			= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
-		$filters[]			= array('field'=>'id', 'operator'=>'=', 'value'=>$release_id);
+		$filters[]		= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]		= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$filters[]		= array('field'=>'id', 'operator'=>'=', 'value'=>$release_id);
 		$pbi_release	= load_library('pbi_release')->get_record($filters)->get_info();
 
-		$filters			= array();
-		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[]			= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
-		$filters[]			= array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_release['pbi_id']);
-		$pbi				= load_library('pbi')->get_record($filters)->get_info();
+		$filters		= array();
+		$filters[]		= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]		= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$filters[]		= array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_release['pbi_id']);
+		$pbi			= load_library('pbi')->get_record($filters)->get_info();
 
-		$filters			= array();
-		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[]			= array('field'=>'last_update', 'operator'=>'>', 'value'=>$pbi_release['date_last_status_id']);
-		$mirrors			= load_library('mirror')->get_all($filters, array('last_update DESC'), array(), '','mirror');
+		$filters		= array();
+		$filters[]		= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]		= array('field'=>'last_update', 'operator'=>'>', 'value'=>$pbi_release['date_last_status_id']);
+		$mirrors		= load_library('mirror')->get_all($filters, array('last_update DESC'), array(), '','mirror');
 
 		$this->display->assign('list',$mirrors);
 		$this->display->assign('type','mirrors');

Modified: websites/pbidir.com/bibivu/lib/mirror.php
===================================================================
--- websites/pbidir.com/bibivu/lib/mirror.php	2009-05-22 20:35:14 UTC (rev 3979)
+++ websites/pbidir.com/bibivu/lib/mirror.php	2009-05-24 22:18:33 UTC (rev 3980)
@@ -105,9 +105,11 @@
 	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';
+		if(is_array($orders)){
+			foreach($orders as $key=>$order){
+				if(!eregi($str,$order) && $order!='RAND()'){
+					$orders[$key] = 'name';
+				}
 			}
 		}
 		return parent::get_all($where, $orders, $group, $limit, $from, $join, $xtrfields);

Modified: websites/pbidir.com/bibivu/sbin/uri.php
===================================================================
--- websites/pbidir.com/bibivu/sbin/uri.php	2009-05-22 20:35:14 UTC (rev 3979)
+++ websites/pbidir.com/bibivu/sbin/uri.php	2009-05-24 22:18:33 UTC (rev 3980)
@@ -1,6 +1,7 @@
 <?php
 class uri{
 	private $GET			= array();
+	private $POST			= array();
 	private $GETnum			= array(NULL);
 	private $extraGET		= array();
 	private $add_extraGET	= false;
@@ -27,6 +28,7 @@
 		$this->set_hide_keys($config->get('uri_hide_keys',false));
 
 		$this->_fill_GET();
+		$this->_fill_POST();
 //		$host	= $_SERVER['HTTP_HOST'];
 //		if (strrpos($host, ':') > 0){
 //			$host = substr($host, 0, strrpos($host, ':'));
@@ -66,6 +68,20 @@
 		return '<a href="'.$uri.'" target="_top" title="'.str_replace('"', '&quot;', $uri).'">'.$title.'</a>';
 	}
 	
+	public function is_post(){
+		return !empty($this->POST);
+	}
+	
+	public function post($key='', $default=NULL){
+		if($key==''){
+			return $this->get_POST();
+		}elseif(isset($this->POST[$key])){
+			return $this->POST[$key];
+		} else {
+			return $default;
+		}
+	}
+	
 	public function get($key='', $default=NULL){
 		if($key==''){
 			return $this->get_GET();
@@ -99,6 +115,17 @@
 	}
 	
 	/**
+	 * This function returns the internal POST variable
+	 *
+	 * @access	public
+	 * @param	void
+	 * @return	array() the POST coming from the URL
+	 */ 
+	public function get_POST(){
+		return $this->POST;
+	}
+
+	/**
 	 * This function returns the internal GET variable
 	 *
 	 * @access	public
@@ -121,6 +148,17 @@
 	}
 
 	/**
+	 * This function will fill the _POST global variable
+	 *
+	 * @access	private
+	 * @param	void
+	 * @return	void
+	 */ 
+	private function _fill_POST(){
+		//this function just grab the POST variables
+		$this->POST = $this->_clean_magic_quotes($_POST);		//This is needed in case there are some manually passed POST info
+	}
+	/**
 	 * This function will fill the _GET global variable
 	 *
 	 * @access	private
@@ -287,10 +325,15 @@
 			$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])){
+			if(isset($query[CLASS_KEY])){
+				$newQry[] = urlencode($query[CLASS_KEY]);
+			} else {
+				$newQry[] = urlencode($this->get(CLASS_KEY));
+			}
+			if(isset($query[TASK_KEY]) && !(count($query)==2 && isset($query[CLASS_KEY]) && $query[TASK_KEY]=='')){
 				$newQry[] = urlencode($query[TASK_KEY]);
-			} else {
+			} elseif(!isset($query[CLASS_KEY])){
+				//only get the current if the CLASS KEY is not manually set
 				$newQry[] = urlencode($this->get(TASK_KEY));
 			}
 			unset($query[CLASS_KEY]);



More information about the Commits mailing list