Show
Ignore:
Timestamp:
10/16/06 08:11:03 (2 years ago)
Author:
mdodoo
Message:

This was really annoying, and took more time than the previous commit. For some reason, "svn diff" does not work correctly on my machine.

Location:
branches/multiuser/cls
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/multiuser/cls/db/db.mysql.php

    r1181 r1606  
    3131class MysqlDB extends DB { 
    3232 
     33    var $resource; 
     34 
    3335    function  MysqlDB() { 
    3436        parent::DB(); 
     
    4143     
    4244    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) { 
    4448              die( "<h1>Error connecting to the database!</h1>\n" 
    4549                     ."<p>Have you edited dbinit.php and correctly defined " 
     
    4953     
    5054    function DBSelectDB($dbname) { 
    51         if (!mysql_select_db($dbname)) { 
     55        if (!mysql_select_db($dbname, $this -> resource)) { 
    5256              die( "<h1>Error selecting the database!</h1>\n" 
    5357                     ."<p>Does your database exist?" 
     
    6064     
    6165    function rss_query ($query, $dieOnError=true, $preventRecursion=false) { 
    62          $ret =  mysql_query($query); 
     66         $ret =  mysql_query($query, $this -> resource); 
    6367     
    6468         if ($error = $this -> rss_sql_error()) { 
     
    101105     
    102106    function rss_sql_error() { 
    103          return mysql_errno(); 
     107         return mysql_errno($this -> resource); 
    104108    } 
    105109     
    106110    function rss_sql_error_message () { 
    107          return mysql_error(); 
     111         return mysql_error($this -> resource); 
    108112    } 
    109113     
    110114    function rss_insert_id() { 
    111         return mysql_insert_id(); 
     115        return mysql_insert_id($this -> resource); 
    112116    } 
    113117     
     
    125129        switch ($kind) { 
    126130            case RSS_SQL_ERROR_NO_ERROR: 
    127                 return (mysql_errno() == 0); 
     131                return (mysql_errno($this -> resource) == 0); 
    128132                break; 
    129133            case RSS_SQL_ERROR_DUPLICATE_ROW: 
    130                 return (mysql_errno() == 1062); 
     134                return (mysql_errno($this -> resource) == 1062); 
    131135                break; 
    132136            default: 
  • branches/multiuser/cls/l10n.php

    r1604 r1606  
    3838    function RSSl10n() { 
    3939        $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)) { 
    4542            $locales=array( 
    46                 $m[0].'UTF-8', 
    47                 $m[0].'utf-8', 
     43                $m[0].'.UTF-8', 
     44                $m[0].'.utf-8', 
    4845                $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] 
    5249            ); 
    5350            setlocale(LC_ALL, $locales);     
     
    7572    } 
    7673    function getISOLang() { 
    77         return $this ->isloang; 
     74        return $this ->isolang; 
    7875    } 
    7976    /** 
     
    8178     */ 
    8279    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']); 
    8582            return  $_REQUEST['lang']; 
    8683        } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { 
     
    9996                if (preg_match('#^([a-z]{2})[\-_]?([a-z]{2})?$#i',$ll,$pm)) { 
    10097                    $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]; 
    112104                    } elseif($pm[1] == 'en') { 
    113105                        // ugly: a better way would be to look up all the available locales 
     
    117109                    if ($ret) { 
    118110                        // remember the detected locale for a couple hours 
    119                         setcookie(RSS_LOCALE_COOKIE,$ret,time()+3600*6,getPath()); 
     111                        $this -> __setLocaleCookie($ret); 
    120112                        return $ret; 
    121113                    } 
     
    127119        return getConfig('rss.output.lang'); 
    128120    } 
     121 
     122    function __setLocaleCookie($value) { 
     123        setcookie(RSS_LOCALE_COOKIE,$value,time()+3600*6,getPath()); 
     124    } 
    129125} 
    130126     
  • branches/multiuser/cls/wrappers/item.php

    r1604 r1606  
    7474    return $url; 
    7575  } 
    76   return "http://" . $_SERVER['HTTP_HOST'] . rss_item_pl_url(); 
     76  return guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . rss_item_pl_url(); 
    7777} 
    7878