Changeset 1606 for branches/multiuser/cls
- Timestamp:
- 10/16/06 08:11:03 (2 years ago)
- Location:
- branches/multiuser/cls
- Files:
-
- 3 modified
-
db/db.mysql.php (modified) (6 diffs)
-
l10n.php (modified) (6 diffs)
-
wrappers/item.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/multiuser/cls/db/db.mysql.php
r1181 r1606 31 31 class MysqlDB extends DB { 32 32 33 var $resource; 34 33 35 function MysqlDB() { 34 36 parent::DB(); … … 41 43 42 44 function DBConnect($dbserver, $dbuname, $dbpass) { 43 if (!mysql_connect($dbserver, $dbuname, $dbpass)) { 45 $this -> resource = mysql_connect($dbserver, $dbuname, $dbpass); 46 47 if(!$this -> resource) { 44 48 die( "<h1>Error connecting to the database!</h1>\n" 45 49 ."<p>Have you edited dbinit.php and correctly defined " … … 49 53 50 54 function DBSelectDB($dbname) { 51 if (!mysql_select_db($dbname )) {55 if (!mysql_select_db($dbname, $this -> resource)) { 52 56 die( "<h1>Error selecting the database!</h1>\n" 53 57 ."<p>Does your database exist?" … … 60 64 61 65 function rss_query ($query, $dieOnError=true, $preventRecursion=false) { 62 $ret = mysql_query($query );66 $ret = mysql_query($query, $this -> resource); 63 67 64 68 if ($error = $this -> rss_sql_error()) { … … 101 105 102 106 function rss_sql_error() { 103 return mysql_errno( );107 return mysql_errno($this -> resource); 104 108 } 105 109 106 110 function rss_sql_error_message () { 107 return mysql_error( );111 return mysql_error($this -> resource); 108 112 } 109 113 110 114 function rss_insert_id() { 111 return mysql_insert_id( );115 return mysql_insert_id($this -> resource); 112 116 } 113 117 … … 125 129 switch ($kind) { 126 130 case RSS_SQL_ERROR_NO_ERROR: 127 return (mysql_errno( ) == 0);131 return (mysql_errno($this -> resource) == 0); 128 132 break; 129 133 case RSS_SQL_ERROR_DUPLICATE_ROW: 130 return (mysql_errno( ) == 1062);134 return (mysql_errno($this -> resource) == 1062); 131 135 break; 132 136 default: -
branches/multiuser/cls/l10n.php
r1604 r1606 38 38 function RSSl10n() { 39 39 $this -> locale = preg_replace('#[^a-zA-Z_]#','',$this -> __detectUserLang()); 40 41 $ll=explode('_',$this -> locale); 42 $this->isloang=$ll[0].'-'.strtoupper($ll[1]); 43 44 if (function_exists('version_compare') && version_compare("4.3.0",PHP_VERSION, "<=") && preg_match('#([a-z]{2})_([A-Z]{2})#',$this -> locale,$m)) { 40 $this -> isolang=str_replace('_','-',$this -> locale); 41 if (function_exists('version_compare') && version_compare("4.3.0",PHP_VERSION, "<=") && preg_match('#([a-z]{2})_?([A-Z]{2})?#',$this -> locale,$m)) { 45 42 $locales=array( 46 $m[0].' UTF-8',47 $m[0].' utf-8',43 $m[0].'.UTF-8', 44 $m[0].'.utf-8', 48 45 $m[0], 49 $m[1] .'_'.strtoupper($m[1]),50 $m[1] ,51 $m[2]46 $m[1], 47 $m[1].'_'.strtoupper($m[1]) 48 //$m[2] 52 49 ); 53 50 setlocale(LC_ALL, $locales); … … 75 72 } 76 73 function getISOLang() { 77 return $this ->is loang;74 return $this ->isolang; 78 75 } 79 76 /** … … 81 78 */ 82 79 function __detectUserLang() { 83 if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_ [A-Z]{2}$#',$_REQUEST['lang']) && file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang'])) {84 setcookie(RSS_LOCALE_COOKIE,$_REQUEST['lang'],time()+3600*6,getPath());80 if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && ($_REQUEST['lang'] == 'en' || file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang']))) { 81 $this -> __setLocaleCookie($_REQUEST['lang']); 85 82 return $_REQUEST['lang']; 86 83 } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { … … 99 96 if (preg_match('#^([a-z]{2})[\-_]?([a-z]{2})?$#i',$ll,$pm)) { 100 97 $ret =null; 101 if (isset($pm[2])){ 102 if (file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[2]))) { 103 // xx-yy -> xx_YY 104 $ret= $pm[1] ."_".strtoupper($pm[2]); 105 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[1]))) { 106 // xx-yy -> xx_XX 107 $ret= $pm[1] ."_".strtoupper($pm[1]); 108 } 109 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[1]))) { 110 // xx -> xx_XX 111 $ret= $pm[1] ."_".strtoupper($pm[1]); 98 if (isset($pm[2]) && file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[2]))) { 99 // xx-yy -> xx_YY 100 $ret= $pm[1] ."_".strtoupper($pm[2]); 101 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] )) { 102 // xx -> xx 103 $ret= $pm[1]; 112 104 } elseif($pm[1] == 'en') { 113 105 // ugly: a better way would be to look up all the available locales … … 117 109 if ($ret) { 118 110 // remember the detected locale for a couple hours 119 setcookie(RSS_LOCALE_COOKIE,$ret,time()+3600*6,getPath());111 $this -> __setLocaleCookie($ret); 120 112 return $ret; 121 113 } … … 127 119 return getConfig('rss.output.lang'); 128 120 } 121 122 function __setLocaleCookie($value) { 123 setcookie(RSS_LOCALE_COOKIE,$value,time()+3600*6,getPath()); 124 } 129 125 } 130 126 -
branches/multiuser/cls/wrappers/item.php
r1604 r1606 74 74 return $url; 75 75 } 76 return "http://" . $_SERVER['HTTP_HOST']. rss_item_pl_url();76 return guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . rss_item_pl_url(); 77 77 } 78 78
