[PC-BSD Commits] r1500 - in websites/pbidir.com/bibivu: bin slib

svn at pcbsd.org svn at pcbsd.org
Sat Mar 1 08:42:56 PST 2008


Author: fabry
Date: 2008-03-01 08:42:56 -0800 (Sat, 01 Mar 2008)
New Revision: 1500

Modified:
   websites/pbidir.com/bibivu/bin/start.php
   websites/pbidir.com/bibivu/slib/lang.php
Log:
if coming into pbidir with a link similar to "www.pbidir.com/bt/lang/es" the navigation is automatically set to that language. refs #97

Modified: websites/pbidir.com/bibivu/bin/start.php
===================================================================
--- websites/pbidir.com/bibivu/bin/start.php	2008-03-01 16:27:50 UTC (rev 1499)
+++ websites/pbidir.com/bibivu/bin/start.php	2008-03-01 16:42:56 UTC (rev 1500)
@@ -34,15 +34,21 @@
 					return true;
 				}
 				break;
+			case 'lang':
+				load_library('lang')->set_lang($this->uri->get_num(3));
+				$task = 'home';
+				break;
 		}
 
 		$this->ajax	 = isset($_POST['ajax']) || isset($_GET['ajax']);
 		$this->load_library('table_prototype');
 		$this->load_library('pbi');			//this is enough
 		$this->load_library('permissions');
+		
+		if($this->permissions->is_logged()){
+			load_library('lang')->set_lang($this->permissions->get('lang',''));
+		}
 
-		load_library('lang')->set_lang($this->permissions->get('lang',''));
-
 		$this->display->assign('is_logged',$this->permissions->is_logged());
 		$this->display->assign('pbi_uri',$this->uri->create_uri(array(TASK_KEY=>'pbi')));
 		load_library('menu')->create_menu($this->display);

Modified: websites/pbidir.com/bibivu/slib/lang.php
===================================================================
--- websites/pbidir.com/bibivu/slib/lang.php	2008-03-01 16:27:50 UTC (rev 1499)
+++ websites/pbidir.com/bibivu/slib/lang.php	2008-03-01 16:42:56 UTC (rev 1500)
@@ -13,11 +13,13 @@
 				$this->config[$key]=$value;
 			}
 		}
+		$this->set_lang(load_library('cookies')->get('lang'));
 	}
 
 	public function set_lang($lang='en'){
-		if($lang=='')	$lang='en';
-		$this->config['detected'] = $lang;
+		if($lang!=''){
+			$this->config['detected'] = $lang;
+		}
 	}
 	public function get($word, $default='', $lang=''){
 		if($lang=='')	$lang = $this->_detect_lang();
@@ -167,6 +169,7 @@
 		}
 		if(!in_array($lang, $this->config['supported']))	$lang = $this->config['lang'];
 		$this->config['detected'] = $lang;
+		load_library('cookies')->set('lang', $lang);
 		return $lang;
 	}
 }



More information about the Commits mailing list