[PC-BSD Commits] r1770 - in websites/pbidir.com/bibivu: bin etc/lang/de etc/lang/en etc/lang/es etc/lang/fr etc/lang/it etc/lang/nl etc/lang/tr tpl/pbidir

svn at pcbsd.org svn at pcbsd.org
Thu Apr 24 19:10:16 PDT 2008


Author: fabry
Date: 2008-04-24 19:10:16 -0700 (Thu, 24 Apr 2008)
New Revision: 1770

Modified:
   websites/pbidir.com/bibivu/bin/start.php
   websites/pbidir.com/bibivu/etc/lang/de/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/en/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/es/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/fr/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/it/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/nl/pbi.lang.php
   websites/pbidir.com/bibivu/etc/lang/tr/pbi.lang.php
   websites/pbidir.com/bibivu/tpl/pbidir/download.php
   websites/pbidir.com/bibivu/tpl/pbidir/pbi.php
Log:
ability to keep track of the downloaded "offsite" pbis

Modified: websites/pbidir.com/bibivu/bin/start.php
===================================================================
--- websites/pbidir.com/bibivu/bin/start.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/bin/start.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -378,51 +378,66 @@
 			$this->display('message');
 			return;
 		}
+		$this->display->assign('pbi', $pbi);
 
-		$this->load_library('pbi_release');
-		$filters = array();
-		$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-		$filters[] = array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
-		$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$this->uri->get_num(4));
-		$pbi_release = $this->pbi_release->get_record($filters)->get_info();
-		if(!isset($pbi_release['id']) || $pbi_release['id']!=$this->uri->get_num(4) || $pbi_release['pbi_id']!=$this->uri->get_num(3)){
-			//package doesn't exists
-			$this->display->assign('message', 'Package Release not found!');
-			$this->display('message');
-			return;
-		}
-		$this->display->assign('pbi', $pbi);
-		$this->display->assign('pbi_release', $pbi_release);
-		if($this->uri->get_num(5)>0){
+		if($pbi['offsite_download_url']!=''){
+			//offsite download
 			$filters = array();
-			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-			$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$this->uri->get_num(5));
-			$mirror = $this->table_prototype->get_record($filters, 'mirror')->get_info();
-			if(!isset($mirror['id']) || $mirror['id']!=$this->uri->get_num(5)){
-				//package doesn't exists
-				$this->display->assign('message', 'Mirror not found!');
-				$this->display('message');
-				return;
-			}
-			$this->table_prototype->insert()->from('download')->set('pbi_id',$pbi['id'])->set('download_type_id','1')->set('mirror_id',$mirror['id'])->do_db();
-	
-			$filters = array();
 			$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$pbi['id']);
 			$this->pbi->update()->set('total_download','total_download+1',true)->where()->do_db();
-	
+
+			$this->table_prototype->insert()->from('download')->set('pbi_id',$pbi['id'])->set('download_type_id','3')->set('mirror_id',0)->do_db();
+
+			$mirror['url'] = $pbi['offsite_download_url'];
 			$this->display->assign('mirror', $mirror);
 	
 			$this->display->assign('title', 'Downloading '.$pbi['name']);
 			$this->display('download');
 		} else {
-			//have to choose the mirror to use
+			$this->load_library('pbi_release');
 			$filters = array();
 			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
-			$filters[] = array('field'=>'last_update', 'operator'=>'>', 'value'=>$pbi['date_last_status_id']);
-			$mirror = $this->table_prototype->get_all($filters, array('name ASC','last_update DESC'), array(), '','mirror');
-			$this->display->assign('mirror', $mirror);
-			$this->display->assign('title', 'Downloading '.$pbi['name'].' - Choose a mirror');
-			$this->display('choose_mirror');
+			$filters[] = array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+			$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$this->uri->get_num(4));
+			$pbi_release = $this->pbi_release->get_record($filters)->get_info();
+			if(!isset($pbi_release['id']) || $pbi_release['id']!=$this->uri->get_num(4) || $pbi_release['pbi_id']!=$this->uri->get_num(3)){
+				//package doesn't exists
+				$this->display->assign('message', 'Package Release not found!');
+				$this->display('message');
+				return;
+			}
+			$this->display->assign('pbi_release', $pbi_release);
+			if($this->uri->get_num(5)>0){
+				$filters = array();
+				$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+				$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$this->uri->get_num(5));
+				$mirror = $this->table_prototype->get_record($filters, 'mirror')->get_info();
+				if(!isset($mirror['id']) || $mirror['id']!=$this->uri->get_num(5)){
+					//package doesn't exists
+					$this->display->assign('message', 'Mirror not found!');
+					$this->display('message');
+					return;
+				}
+				$this->table_prototype->insert()->from('download')->set('pbi_id',$pbi['id'])->set('download_type_id','1')->set('mirror_id',$mirror['id'])->do_db();
+		
+				$filters = array();
+				$filters[] = array('field'=>'id', 'operator'=>'=', 'value'=>$pbi['id']);
+				$this->pbi->update()->set('total_download','total_download+1',true)->where()->do_db();
+		
+				$this->display->assign('mirror', $mirror);
+		
+				$this->display->assign('title', 'Downloading '.$pbi['name']);
+				$this->display('download');
+			} else {
+				//have to choose the mirror to use
+				$filters = array();
+				$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+				$filters[] = array('field'=>'last_update', 'operator'=>'>', 'value'=>$pbi['date_last_status_id']);
+				$mirror = $this->table_prototype->get_all($filters, array('name ASC','last_update DESC'), array(), '','mirror');
+				$this->display->assign('mirror', $mirror);
+				$this->display->assign('title', 'Downloading '.$pbi['name'].' - Choose a mirror');
+				$this->display('choose_mirror');
+			}
 		}
 	}
 	

Modified: websites/pbidir.com/bibivu/etc/lang/de/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/de/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/de/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Web Interface';
 $lang['command_line_interface'] = 'Kommandozeile';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/en/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/en/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/en/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Web Interface';
 $lang['command_line_interface'] = 'Command Line';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/es/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/es/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/es/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Interfaz Web';
 $lang['command_line_interface'] = 'Linea de Comandos';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/fr/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/fr/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/fr/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Interface Web';
 $lang['command_line_interface'] = 'Ligne de commande';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/it/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/it/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/it/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Interfaccia Web';
 $lang['command_line_interface'] = 'Linea di Comando';
 
-$lang['offsite_download'] = 'Downloads da altro sito';
+$lang['offsite_download'] = 'Clicca qui per scaricare';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/nl/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/nl/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/nl/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'Web Interface';
 $lang['command_line_interface'] = 'Opdrachtregel';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/etc/lang/tr/pbi.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/tr/pbi.lang.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/etc/lang/tr/pbi.lang.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -38,6 +38,6 @@
 $lang['web_interface'] = 'İnternet Arayüzü';
 $lang['command_line_interface'] = 'Komut Satırı';
 
-$lang['offsite_download'] = 'Downloads from another site';
+$lang['offsite_download'] = 'Click here to download';	//followed by PBI name
 
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/tpl/pbidir/download.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/download.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/tpl/pbidir/download.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -1,17 +1,20 @@
 <?php
 $uri = $mirror['url'];
-if(substr($uri,-1)!=='/' && substr($pbi_release['mirror_path'],0,1)!='/'){
-	$uri .='/';
+$timeout = 2;
+if(isset($pbi_release)){
+	if(substr($uri,-1)!=='/' && substr($pbi_release['mirror_path'],0,1)!='/'){
+		$uri .='/';
+	}
+	$uri .= $pbi_release['mirror_path'];
+	?>
+	<h1><?=load_library('lang')->get('download_downloading')?> <?=$pbi['name']?> v.<?=$pbi_release['version']?></h1>
+	<h2><?=load_library('lang')->get('download_using')?> <?=$mirror['name']?><?php
+	if($mirror['home']!=''){
+		?>&nbsp;-&nbsp;<a href="<?=$mirror['home']?>"><?=load_library('lang')->get('download_mirror_home')?></a><?php
+	}
+	?></h2><?php
 }
-$uri .= $pbi_release['mirror_path'];
-$timeout = 2;
 ?>
-<h1><?=load_library('lang')->get('download_downloading')?> <?=$pbi['name']?> v.<?=$pbi_release['version']?></h1>
-<h2><?=load_library('lang')->get('download_using')?> <?=$mirror['name']?><?php
-if($mirror['home']!=''){
-	?>&nbsp;-&nbsp;<a href="<?=$mirror['home']?>"><?=load_library('lang')->get('download_mirror_home')?></a><?php
-}
-?></h2>
 <br/><?=load_library('lang')->get('download_nostart')?> <a href="<?=$uri?>"><?=load_library('lang')->get('download_clickhere')?></a><br /><br />
 <a href="<?=$pbi_uri?>/<?=$pbi['id']?>"><?=load_library('lang')->get('download_return_pbi')?></a><br /><br />
 <script type="text/javascript" language="javascript"><!-- 

Modified: websites/pbidir.com/bibivu/tpl/pbidir/pbi.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/pbi.php	2008-04-25 00:44:55 UTC (rev 1769)
+++ websites/pbidir.com/bibivu/tpl/pbidir/pbi.php	2008-04-25 02:10:16 UTC (rev 1770)
@@ -107,8 +107,7 @@
 <?=nl2br(load_library('bbcode')->parse($pbi['description']))?>
 <?php
 if($pbi['offsite_download_url']!=''){
-	?><br /><br /><h2><?=load_library('lang')->get('pbi_offsite_download')?></h2>
-	<a href="<?=$pbi['offsite_download_url']?>" target="_blank"><?=$pbi['offsite_download_url']?></a><?php
+	?><br /><br /><h2><a href="<?=$download_uri?>/<?=$pbi['id']?>"><?=load_library('lang')->get('pbi_offsite_download')?> <?=$pbi['name']?></a></h2><?php
 }
 ?></div>
 <?=$this->show('pbidir/pbi_versions')?>



More information about the Commits mailing list