32. File Comparison Report

Produced on Thu Jul 17 07:17:23 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

32.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc languages.inc.php Mon May 19 07:27:14 2008 UTC
2 Dolphin-v.6.1.3\inc languages.inc.php Wed Jul 16 09:51:20 2008 UTC

32.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 8 876
Changed 5 12
Inserted 0 0
Removed 2 4

32.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

32.4 Active regular expressions

No regular expressions were active.

32.5 Comparison detail

1   <?   1   <?
2     2  
3   /********* ********** ********** ********** ********** ********** ********** ******   3   /********* ********** ********** ********** ********** ********** ********** ******
4   *                              D olphin Sma rt Communi ty Builder   4   *                              D olphin Sma rt Communi ty Builder
5   *                                 --------- --------   5   *                                 --------- --------
6   *     begi n                 : M on Mar 23  2006   6   *     begi n                 : M on Mar 23  2006
7   *     copy right             : ( C) 2006 Bo onEx Group   7   *     copy right             : ( C) 2006 Bo onEx Group
8   *     webs ite               : h ttp://www. boonex.com /   8   *     webs ite               : h ttp://www. boonex.com /
9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder   9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder
10   *   10   *
11   * Dolphin  is free so ftware. Th is work is  licensed  under a Cr eative Com mons Attri bution 3.0  License.    11   * Dolphin  is free so ftware. Th is work is  licensed  under a Cr eative Com mons Attri bution 3.0  License. 
12   * http://c reativecom mons.org/l icenses/by /3.0/   12   * http://c reativecom mons.org/l icenses/by /3.0/
13   *   13   *
14   * Dolphin  is distrib uted in th e hope tha t it will  be useful,  but WITHO UT ANY WAR RANTY;   14   * Dolphin  is distrib uted in th e hope tha t it will  be useful,  but WITHO UT ANY WAR RANTY;
15   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.   15   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.
16   * See the  Creative C ommons Att ribution 3 .0 License  for more  details.    16   * See the  Creative C ommons Att ribution 3 .0 License  for more  details. 
17   * You shou ld have re ceived a c opy of the  Creative  Commons At tribution  3.0 Licens e along wi th Dolphin   17   * You shou ld have re ceived a c opy of the  Creative  Commons At tribution  3.0 Licens e along wi th Dolphin
18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m   18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m
19   ********** ********** ********** ********** ********** ********** ********** *****/   19   ********** ********** ********** ********** ********** ********** ********** *****/
20     20  
21   require_on ce('header .inc.php') ;   21   require_on ce('header .inc.php') ;
22   require_on ce('db.inc .php');   22   require_on ce('db.inc .php');
23   require_on ce('utils. inc.php');   23   require_on ce('utils. inc.php');
24     24  
25   define('LA NGUAGE_CAT EGORY_ID_P ROFILE_FIE LDS', 24);   25   define('LA NGUAGE_CAT EGORY_ID_P ROFILE_FIE LDS', 24);
26     26  
27   $sCurrentL anguage =  getCurrent LangName() ;   27   $sCurrentL anguage =  getCurrent LangName() ;
28   if( !$sCur rentLangua ge ) {   28   if( !$sCur rentLangua ge ) {
29       echo ' <br /><b>F atal error :</b> Cann ot apply l ocalizatio n.';   29       echo ' <br /><b>F atal error :</b> Cann ot apply l ocalizatio n.';
30       exit;   30       exit;
31   }   31   }
32     32  
33   require_on ce(  
" {$dir['roo t']} langs/lang -{$sCurren tLanguage} .php"   );
  33   require_on ce(   BX_DIRECTO RY_PATH_RO OT   .   "
langs/lang -{$sCurren tLanguage} .php"   );
34     34  
35     35  
36     36  
37     37  
38     38  
39     39  
40   function g etCurrentL angName()  {   40   function g etCurrentL angName()  {
41       $sLang  = '';   41       $sLang  = '';
42          42       
43       if( !$ sLang ) $s Lang = try ToGetLang(  $_GET['la ng'], true  );   43       if( !$ sLang ) $s Lang = try ToGetLang(  $_GET['la ng'], true  );
44       if( !$ sLang ) $s Lang = try ToGetLang(  $_POST['l ang'], tru e );   44       if( !$ sLang ) $s Lang = try ToGetLang(  $_POST['l ang'], tru e );
45       if( !$ sLang ) $s Lang = try ToGetLang(  $_COOKIE[ 'lang'] );   45       if( !$ sLang ) $s Lang = try ToGetLang(  $_COOKIE[ 'lang'] );
46       if( !$ sLang ) $s Lang = try ToGetLang(  $_SERVER[ 'HTTP_ACCE PT_LANGUAG E'] );   46       if( !$ sLang ) $s Lang = try ToGetLang(  $_SERVER[ 'HTTP_ACCE PT_LANGUAG E'] );
47       if( !$ sLang ) $s Lang = try ToGetLang(  getParam(  'lang_def ault' ) );   47       if( !$ sLang ) $s Lang = try ToGetLang(  getParam(  'lang_def ault' ) );
48       if( !$ sLang ) $s Lang = try ToGetLang(  'en' );   48       if( !$ sLang ) $s Lang = try ToGetLang(  'en' );
49          49       
50       return  $sLang;   50       return  $sLang;
51   }   51   }
52     52  
53   function t ryToGetLan g( $sLangs , $bSetCoo kie = fals e ) {   53   function t ryToGetLan g( $sLangs , $bSetCoo kie = fals e ) {
54       $sLang s = trim(  $sLangs );   54       $sLang s = trim(  $sLangs );
55       if( !$ sLangs )   55       if( !$ sLangs )
56           re turn '';   56           re turn '';
57          57       
58       $sLang s = preg_r eplace( '/ [^a-zA-Z0- 9,;-]/m',  '', $sLang s ); // we  do not ne ed 'q=0.3' . we are u sing live  queue :)   58       $sLang s = preg_r eplace( '/ [^a-zA-Z0- 9,;-]/m',  '', $sLang s ); // we  do not ne ed 'q=0.3' . we are u sing live  queue :)
59       $sLang s = strtol ower( $sLa ngs );   59       $sLang s = strtol ower( $sLa ngs );
60          60       
61       if( !$ sLangs )   61       if( !$ sLangs )
62           re turn '';   62           re turn '';
63          63       
64       $aLang s = explod e( ',', $s Langs ); / / ru,en-us ;q=0.7,en; q=0.3 => a rray( 'ru'  , 'en-us; q=0.7' , ' en;q=0.3'  );   64       $aLang s = explod e( ',', $s Langs ); / / ru,en-us ;q=0.7,en; q=0.3 => a rray( 'ru'  , 'en-us; q=0.7' , ' en;q=0.3'  );
65       foreac h( $aLangs  as $sLang  ) {   65       foreac h( $aLangs  as $sLang  ) {
66           if ( !$sLang  ) continue ;   66           if ( !$sLang  ) continue ;
67              67           
68           li st( $sLang  ) = explo de( ';', $ sLang, 2 ) ; // en-us ;q=0.7 =>  en-us   68           li st( $sLang  ) = explo de( ';', $ sLang, 2 ) ; // en-us ;q=0.7 =>  en-us
69           if ( !$sLang  ) continue ;   69           if ( !$sLang  ) continue ;
70              70           
71           //  check wit h country   71           //  check wit h country
72           if ( checkLan gExists( $ sLang ) )  {   72           if ( checkLan gExists( $ sLang ) )  {
73                if( $bSe tCookie )   73                if( $bSe tCookie )
74                    setL angCookie(  $sLang );   74                    setL angCookie(  $sLang );
75                return $ sLang;   75                return $ sLang;
76           }   76           }
77              77           
78           // drop count ry   78           // drop count ry
79           li st( $sLang , $sCntr )  = explode ( '-', $sL ang, 2 );  // en-us = > en   79           li st( $sLang , $sCntr )  = explode ( '-', $sL ang, 2 );  // en-us = > en
80           if ( !$sLang  or !$sCntr  ) continu e; //no la ng or noth ing change d   80           if ( !$sLang  or !$sCntr  ) continu e; //no la ng or noth ing change d
81              81           
82           // check agai n. without  country   82           // check agai n. without  country
83           if ( checkLan gExists( $ sLang ) )  {   83           if ( checkLan gExists( $ sLang ) )  {
84                if( $bSe tCookie )   84                if( $bSe tCookie )
85                    setL angCookie(  $sLang );   85                    setL angCookie(  $sLang );
86                return $ sLang;   86                return $ sLang;
87           }   87           }
88       }   88       }
89          89       
90       return  '';   90       return  '';
91   }   91   }
92     92  
93   function c heckLangEx ists( $sLa ng ) {   93   function c heckLangEx ists( $sLa ng ) {
94       global  $dir;   94        if(   file_exist s(   BX_DIRECTO RY_PATH_RO OT   .   "
langs/lang -{$sLang}. php"   )   )
95           
96        if(   file_exist s(  
" {$dir['roo t']} langs/lang -{$sLang}. php"   )   )
   
97           re turn true;   95           re turn true;
98          96       
99       $sQuer y = "SELEC T `ID` FRO M `Localiz ationLangu ages` WHER E `Name` =  '$sLang'" ;   97       $sQuer y = "SELEC T `ID` FRO M `Localiz ationLangu ages` WHER E `Name` =  '$sLang'" ;
100       $iLang ID = (int) db_value(  $sQuery );   98       $iLang ID = (int) db_value(  $sQuery );
101          99       
102       if( !$ iLangID )   100       if( !$ iLangID )
103           re turn false ;   101           re turn false ;
104          102       
105       if( co mpileLangu age( $iLan gID ) )   103       if( co mpileLangu age( $iLan gID ) )
106           re turn true;   104           re turn true;
107          105       
108       return  false;   106       return  false;
109   }   107   }
110     108  
111   function s etLangCook ie( $sLang  ) {   109   function s etLangCook ie( $sLang  ) {
112       setcoo kie( 'lang ', '',      time() -  60*60*24,     '/' );   110       setcoo kie( 'lang ', '',      time() -  60*60*24,     '/' );
113       setcoo kie( 'lang ', $sLang,  time() +  60*60*24*3 65, '/' );   111       setcoo kie( 'lang ', $sLang,  time() +  60*60*24*3 65, '/' );
114   }   112   }
115     113  
116   function g etLangSwit cher() {   114   function g etLangSwit cher() {
117       global  $sCurrent Language;   115       global  $sCurrent Language;
118       global  $site;   116       global  $site;
119          117       
120       $aLang s = getLan gsArr(true );   118       $aLang s = getLan gsArr(true );
121       if( co unt( $aLan gs ) < 2 )   119       if( co unt( $aLan gs ) < 2 )
122           re turn '';   120           re turn '';
123     121  
124       $sCurL ink = $_SE RVER['REQU EST_URI'];   122       $sCurL ink = $_SE RVER['REQU EST_URI'];
125       $sCurL ink = preg _replace(  '/[\?&]lan g=[a-z-]{2 ,5}/i', '' , $sCurLin k ); //rem ove old la ng from ur i   123       $sCurL ink = preg _replace(  '/[\?&]lan g=[a-z-]{2 ,5}/i', '' , $sCurLin k ); //rem ove old la ng from ur i
126       $sCurL ink .= str pos( $sCur Link, '?',  1 ) ? '&'  : '?';   124       $sCurL ink .= str pos( $sCur Link, '?',  1 ) ? '&'  : '?';
127          125       
128       $sRet  = '';   126       $sRet  = '';
129       foreac h( $aLangs  as $sName  => $sLang  ) {   127       foreac h( $aLangs  as $sName  => $sLang  ) {
130           $s Title = ht mlspecialc hars( subs tr( $sLang , 0, -2 )  );   128           $s Title = ht mlspecialc hars( subs tr( $sLang , 0, -2 )  );
131           $s Flag  = $s ite['flags '] . subst r( $sLang,  -2 ) . '. gif';   129           $s Flag  = $s ite['flags '] . subst r( $sLang,  -2 ) . '. gif';
132              130           
133           if ( $sCurren tLanguage  == $sName  ) {   131           if ( $sCurren tLanguage  == $sName  ) {
134                $sRet .=  '   132                $sRet .=  '
135                    <img  class="la ng_selecte d" src="'  . $sFlag .  '" alt="'  . $sTitle  . '" titl e="' . $sT itle . '"  />';   133                    <img  class="la ng_selecte d" src="'  . $sFlag .  '" alt="'  . $sTitle  . '" titl e="' . $sT itle . '"  />';
136           }  else {   134           }  else {
137                $sLink =  $sCurLink  . 'lang='  . $sName;   135                $sLink =  $sCurLink  . 'lang='  . $sName;
138                $sRet .=  <<<EOF   136                $sRet .=  <<<EOF
139   <a href="{ $sLink}" t itle="{$sT itle}">   137   <a href="{ $sLink}" t itle="{$sT itle}">
140       <img c lass="lang _not_selec ted" src=" {$sFlag}"  alt="{$sTi tle}" titl e="{$sTitl e}" /></a>   138       <img c lass="lang _not_selec ted" src=" {$sFlag}"  alt="{$sTi tle}" titl e="{$sTitl e}" /></a>
141   EOF;   139   EOF;
142           }   140           }
143       }   141       }
144          142       
145       return  $sRet;   143       return  $sRet;
146   }   144   }
147     145  
148   function g etLangsArr ( $bAddFla g = false,  $bRetIDs  = false )  {   146   function g etLangsArr ( $bAddFla g = false,  $bRetIDs  = false )  {
149       $rLang s = db_res ('SELECT *  FROM `Loc alizationL anguages`  ORDER BY ` Title` ASC ');   147       $rLang s = db_res ('SELECT *  FROM `Loc alizationL anguages`  ORDER BY ` Title` ASC ');
150          148       
151       $aLang s = array( );   149       $aLang s = array( );
152       while(  $aLang =  mysql_fetc h_assoc($r Langs) ) {   150       while(  $aLang =  mysql_fetc h_assoc($r Langs) ) {
153           $s Flag = '';   151           $s Flag = '';
154           $s Flag = $bA ddFlag ? (  $aLang['F lag'] ? $a Lang['Flag '] : 'xx'  ) : '';   152           $s Flag = $bA ddFlag ? (  $aLang['F lag'] ? $a Lang['Flag '] : 'xx'  ) : '';
155              153           
156           $s Key = ($bR etIDs) ? $ aLang['ID' ] : $aLang ['Name'];   154           $s Key = ($bR etIDs) ? $ aLang['ID' ] : $aLang ['Name'];
157           $a Langs[ $sK ey ] = $aL ang['Title '] . $sFla g;   155           $a Langs[ $sK ey ] = $aL ang['Title '] . $sFla g;
158       }   156       }
159          157       
160       return  $aLangs;   158       return  $aLangs;
161   }   159   }
162     160  
163   function d eleteLangu age($langI D = 0) {   161   function d eleteLangu age($langI D = 0) {
164       global  $dir;    
165      
166       $langI D = (int)$ langID;   162       $langI D = (int)$ langID;
167     163  
168       if($la ngID <= 0)  return fa lse;   164       if($la ngID <= 0)  return fa lse;
169     165  
170       $resLa ngs = mysq l_query('   166       $resLa ngs = mysq l_query('
171                SELECT   `ID`, `Nam e`   167                SELECT   `ID`, `Nam e`
172                FROM     `Localizat ionLanguag es`   168                FROM     `Localizat ionLanguag es`
173                WHERE    `ID` = '.$ langID);   169                WHERE    `ID` = '.$ langID);
174     170  
175       if(mys ql_num_row s($resLang s) <= 0) r eturn fals e;   171       if(mys ql_num_row s($resLang s) <= 0) r eturn fals e;
176     172  
177       $arrLa ng = mysql _fetch_ass oc($resLan gs);   173       $arrLa ng = mysql _fetch_ass oc($resLan gs);
178     174  
179       $numSt rings = my sql_query( '   175       $numSt rings = my sql_query( '
180           SE LECT COUNT (`IDKey`)   176           SE LECT COUNT (`IDKey`)
181           FR OM `Locali zationStri ngs`   177           FR OM `Locali zationStri ngs`
182           WH ERE `IDLan guage` = ' .$langID);   178           WH ERE `IDLan guage` = ' .$langID);
183       $numSt rings = my sql_fetch_ row($numSt rings);   179       $numSt rings = my sql_fetch_ row($numSt rings);
184       $numSt rings = $n umStrings[ 0];   180       $numSt rings = $n umStrings[ 0];
185     181  
186       mysql_ query('DEL ETE FROM ` Localizati onStrings`  WHERE `ID Language`  = '.$langI D);   182       mysql_ query('DEL ETE FROM ` Localizati onStrings`  WHERE `ID Language`  = '.$langI D);
187     183  
188       if(mys ql_affecte d_rows() <  $numStrin gs) return  false;   184       if(mys ql_affecte d_rows() <  $numStrin gs) return  false;
189     185  
190       mysql_ query('DEL ETE FROM ` Localizati onLanguage s` WHERE ` ID` = '.$l angID);   186       mysql_ query('DEL ETE FROM ` Localizati onLanguage s` WHERE ` ID` = '.$l angID);
191     187  
192       if(mys ql_affecte d_rows() < = 0) retur n false;   188       if(mys ql_affecte d_rows() < = 0) retur n false;
193     189  
194        @unlink( $dir['root '] .'langs/la ng-'.$arrL ang['Name' ].'.php');   190        @unlink(   BX_DIRECTO RY_PATH_RO OT   .   'langs/lan g-'.$arrLa ng['Name'] .'.php');
195     191  
196       return  true;   192       return  true;
197   }   193   }
198     194  
199   function g etLocaliza tionKeys()  {   195   function g etLocaliza tionKeys()  {
200       $resKe ys = db_re s('SELECT  `ID`, `IDC ategory`,  `Key` FROM  `Localiza tionKeys`' );   196       $resKe ys = db_re s('SELECT  `ID`, `IDC ategory`,  `Key` FROM  `Localiza tionKeys`' );
201     197  
202       $arrKe ys = array ();   198       $arrKe ys = array ();
203     199  
204       while( $arr = mys ql_fetch_a ssoc($resK eys))   200       while( $arr = mys ql_fetch_a ssoc($resK eys))
205       {   201       {
206           $I D = $arr[' ID'];   202           $I D = $arr[' ID'];
207           un set($arr[' ID']);   203           un set($arr[' ID']);
208           $a rrKeys[$ID ] = $arr;   204           $a rrKeys[$ID ] = $arr;
209       }   205       }
210     206  
211       return  $arrKeys;   207       return  $arrKeys;
212   }   208   }
213     209  
214   function g etLocaliza tionString Params($ke yID) {   210   function g etLocaliza tionString Params($ke yID) {
215       $keyID  = (int)$k eyID;   211       $keyID  = (int)$k eyID;
216     212  
217       $resPa rams = mys ql_query("   213       $resPa rams = mys ql_query("
218           SE LECT  `IDP aram`,   214           SE LECT  `IDP aram`,
219                    `Des cription`   215                    `Des cription`
220           FR OM    `Loc alizationS tringParam s`   216           FR OM    `Loc alizationS tringParam s`
221           WH ERE   `IDK ey` = $key ID   217           WH ERE   `IDK ey` = $key ID
222           OR DER BY `ID Param`   218           OR DER BY `ID Param`
223       ");   219       ");
224     220  
225       $arrPa rams = arr ay();   221       $arrPa rams = arr ay();
226     222  
227       while  ($arr = my sql_fetch_ assoc($res Params))   223       while  ($arr = my sql_fetch_ assoc($res Params))
228       {   224       {
229           $a rrParams[( int)$arr[' IDParam']]  = $arr['D escription '];   225           $a rrParams[( int)$arr[' IDParam']]  = $arr['D escription '];
230       }   226       }
231     227  
232       return  $arrParam s;   228       return  $arrParam s;
233   }   229   }
234     230  
235   function g etLocaliza tionCatego ries() {   231   function g etLocaliza tionCatego ries() {
236       $resCa tegories =  db_res('S ELECT `ID` , `Name` F ROM `Local izationCat egories` O RDER BY `N ame`');   232       $resCa tegories =  db_res('S ELECT `ID` , `Name` F ROM `Local izationCat egories` O RDER BY `N ame`');
237     233  
238       $arrCa tegories =  array();   234       $arrCa tegories =  array();
239     235  
240       while  ($arr = my sql_fetch_ assoc($res Categories ))   236       while  ($arr = my sql_fetch_ assoc($res Categories ))
241       {   237       {
242           $a rrCategori es[$arr['I D']] = $ar r['Name'];   238           $a rrCategori es[$arr['I D']] = $ar r['Name'];
243       }   239       }
244     240  
245       return  $arrCateg ories;   241       return  $arrCateg ories;
246   }   242   }
247     243  
248   function c ompileLang uage($lang ID = 0) {   244   function c ompileLang uage($lang ID = 0) {
249       global  $dir;    
250      
251       $langI D = (int)$ langID;   245       $langI D = (int)$ langID;
252     246  
253       $newLi ne = "\r\n ";   247       $newLi ne = "\r\n ";
254          248       
255       if($la ngID <= 0)  {   249       if($la ngID <= 0)  {
256           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   250           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
257       } else  {   251       } else  {
258           $r esLangs =  db_res('   252           $r esLangs =  db_res('
259                SELECT   `ID`, `Nam e`   253                SELECT   `ID`, `Nam e`
260                FROM     `Localizat ionLanguag es`   254                FROM     `Localizat ionLanguag es`
261                WHERE    `ID` = '.$ langID   255                WHERE    `ID` = '.$ langID
262           );   256           );
263       }   257       }
264     258  
265       if ( m ysql_num_r ows($resLa ngs) <= 0  )   259       if ( m ysql_num_r ows($resLa ngs) <= 0  )
266           re turn false ;   260           re turn false ;
267     261  
268       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs)) {   262       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs)) {
269           $r esKeysStri ngs = db_r es("   263           $r esKeysStri ngs = db_r es("
270                SELECT   `Localizat ionKeys`.` Key` AS `K ey`,   264                SELECT   `Localizat ionKeys`.` Key` AS `K ey`,
271                         `Localizat ionStrings `.`String`  AS `Strin g`   265                         `Localizat ionStrings `.`String`  AS `Strin g`
272                FROM     `Localizat ionStrings ` INNER JO IN   266                FROM     `Localizat ionStrings ` INNER JO IN
273                         `Localizat ionKeys` O N   267                         `Localizat ionKeys` O N
274                         `Localizat ionKeys`.` ID` = `Loc alizationS trings`.`I DKey`   268                         `Localizat ionKeys`.` ID` = `Loc alizationS trings`.`I DKey`
275                WHERE `L ocalizatio nStrings`. `IDLanguag e` = {$arr Language[' ID']}");   269                WHERE `L ocalizatio nStrings`. `IDLanguag e` = {$arr Language[' ID']}");
276     270  
277            $handle   =   fopen(
" {$dir['roo t']} langs/lang -{$arrLang uage['Name ']}.php",   'w');
  271            $handle   =   fopen(   BX_DIRECTO RY_PATH_RO OT   .   "
langs/lang -{$arrLang uage['Name ']}.php",   'w');
278     272  
279           if ($handle = == false)  return fal se;   273           if ($handle = == false)  return fal se;
280     274  
281           $f ileContent  = "<?{$ne wLine}\$LA NG = array (";   275           $f ileContent  = "<?{$ne wLine}\$LA NG = array (";
282     276  
283           wh ile($arrKe yString =  mysql_fetc h_assoc($r esKeysStri ngs))   277           wh ile($arrKe yString =  mysql_fetc h_assoc($r esKeysStri ngs))
284           {   278           {
285                $langKey  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['Key']) ;   279                $langKey  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['Key']) ;
286                $langKey  = str_rep lace("'",  "\\'", $la ngKey);   280                $langKey  = str_rep lace("'",  "\\'", $la ngKey);
287     281  
288                $langStr  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['String ']);   282                $langStr  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['String ']);
289                $langStr  = str_rep lace("'",  "\\'", $la ngStr);   283                $langStr  = str_rep lace("'",  "\\'", $la ngStr);
290     284  
291                $fileCon tent .= "{ $newLine}\ t'$langKey ' => '$lan gStr',";   285                $fileCon tent .= "{ $newLine}\ t'$langKey ' => '$lan gStr',";
292           }   286           }
293     287  
294           $f ileContent  = trim($f ileContent , ',');   288           $f ileContent  = trim($f ileContent , ',');
295     289  
296           $w riteResult  = fwrite( $handle, $ fileConten t."{$newLi ne});?>");   290           $w riteResult  = fwrite( $handle, $ fileConten t."{$newLi ne});?>");
297           if ($writeRes ult === fa lse) retur n false;   291           if ($writeRes ult === fa lse) retur n false;
298     292  
299           if (fclose($h andle) ===  false) re turn false ;   293           if (fclose($h andle) ===  false) re turn false ;
300     294  
301            @chmod(
" {$dir['roo t']} langs/lang -{$arrLang uage['Name ']}.php",   0666);
  295            @chmod(   BX_DIRECTO RY_PATH_RO OT   .   "
langs/lang -{$arrLang uage['Name ']}.php",   0666);
302       }   296       }
303     297  
304       return  true;   298       return  true;
305   }   299   }
306     300  
307   function a ddStringTo Language($ langKey, $ langString , $langID  = -1, $cat egoryID =  LANGUAGE_C ATEGORY_ID _PROFILE_F IELDS) {   301   function a ddStringTo Language($ langKey, $ langString , $langID  = -1, $cat egoryID =  LANGUAGE_C ATEGORY_ID _PROFILE_F IELDS) {
308       // inp ut validat ion   302       // inp ut validat ion
309       $langI D = (int)$ langID;   303       $langI D = (int)$ langID;
310       $categ oryID = (i nt)$catego ryID;   304       $categ oryID = (i nt)$catego ryID;
311     305  
312       if ( $ langID ==  -1 )   306       if ( $ langID ==  -1 )
313       {   307       {
314           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   308           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
315       }   309       }
316       else   310       else
317       {   311       {
318           $r esLangs =  db_res('   312           $r esLangs =  db_res('
319                SELECT   `ID`, `Nam e`   313                SELECT   `ID`, `Nam e`
320                FROM     `Localizat ionLanguag es`   314                FROM     `Localizat ionLanguag es`
321                WHERE    `ID` = '.$ langID);   315                WHERE    `ID` = '.$ langID);
322       }   316       }
323     317  
324       $langK ey = addsl ashes($lan gKey);   318       $langK ey = addsl ashes($lan gKey);
325       $langS tring = pr ocess_db_i nput($lang String);   319       $langS tring = pr ocess_db_i nput($lang String);
326     320  
327       $resIn sertKey =  db_res( "   321       $resIn sertKey =  db_res( "
328           IN SERT INTO  `Localizat ionKeys`   322           IN SERT INTO  `Localizat ionKeys`
329           SE T          `IDCategor y` = $cate goryID,   323           SE T          `IDCategor y` = $cate goryID,
330                         `Key` = '$ langKey'",  false );   324                         `Key` = '$ langKey'",  false );
331       if ( ! $resInsert Key || mys ql_affecte d_rows() < = 0 )   325       if ( ! $resInsert Key || mys ql_affecte d_rows() < = 0 )
332           re turn false ;   326           re turn false ;
333     327  
334       $keyID  = mysql_i nsert_id() ;   328       $keyID  = mysql_i nsert_id() ;
335     329  
336       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))   330       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))
337       {   331       {
338           $r esInsertSt ring = db_ res( "   332           $r esInsertSt ring = db_ res( "
339                INSERT I NTO `Local izationStr ings`   333                INSERT I NTO `Local izationStr ings`
340                SET          `IDKey ` = $keyID ,   334                SET          `IDKey ` = $keyID ,
341                             `IDLan guage` = { $arrLangua ge['ID']},   335                             `IDLan guage` = { $arrLangua ge['ID']},
342                             `Strin g` = '$lan gString'",  false );   336                             `Strin g` = '$lan gString'",  false );
343           if  ( !$resIn sertString  || mysql_ affected_r ows() <= 0  )   337           if  ( !$resIn sertString  || mysql_ affected_r ows() <= 0  )
344                return f alse;   338                return f alse;
345       }   339       }
346     340  
347       return  true;   341       return  true;
348   }   342   }
349     343  
350   function u pdateStrin gInLanguag e($langKey , $langStr ing, $lang ID = -1) {   344   function u pdateStrin gInLanguag e($langKey , $langStr ing, $lang ID = -1) {
351       // inp ut validat ion   345       // inp ut validat ion
352       $langI D = (int)$ langID;   346       $langI D = (int)$ langID;
353     347  
354       if ( $ langID ==  -1 )   348       if ( $ langID ==  -1 )
355       {   349       {
356           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   350           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
357       }   351       }
358       else   352       else
359       {   353       {
360           $r esLangs =  db_res('   354           $r esLangs =  db_res('
361                SELECT   `ID`, `Nam e`   355                SELECT   `ID`, `Nam e`
362                FROM     `Localizat ionLanguag es`   356                FROM     `Localizat ionLanguag es`
363                WHERE    `ID` = '.$ langID);   357                WHERE    `ID` = '.$ langID);
364       }   358       }
365     359  
366       $langK ey = addsl ashes($lan gKey);   360       $langK ey = addsl ashes($lan gKey);
367       $langS tring = pr ocess_db_i nput($lang String);   361       $langS tring = pr ocess_db_i nput($lang String);
368     362  
369       $arrKe y = db_arr ( "   363       $arrKe y = db_arr ( "
370           SE LECT  `ID`   364           SE LECT  `ID`
371           FR OM    `Loc alizationK eys`   365           FR OM    `Loc alizationK eys`
372           WH ERE   `Key ` = '$lang Key'", fal se );   366           WH ERE   `Key ` = '$lang Key'", fal se );
373     367  
374       if ( ! $arrKey )   368       if ( ! $arrKey )
375           re turn false ;   369           re turn false ;
376     370  
377       $keyID  = $arrKey ['ID'];   371       $keyID  = $arrKey ['ID'];
378     372  
379       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))   373       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))
380       {   374       {
381           $r esUpdateSt ring = db_ res( "   375           $r esUpdateSt ring = db_ res( "
382                UPDATE   `Localizat ionStrings `   376                UPDATE   `Localizat ionStrings `
383                SET          `Strin g` = '$lan gString'   377                SET          `Strin g` = '$lan gString'
384                WHERE        `IDKey ` = $keyID   378                WHERE        `IDKey ` = $keyID
385                AND          `IDLan guage` = { $arrLangua ge['ID']}" , false );   379                AND          `IDLan guage` = { $arrLangua ge['ID']}" , false );
386           if  ( !$resUp dateString  || mysql_ affected_r ows() <= 0  )   380           if  ( !$resUp dateString  || mysql_ affected_r ows() <= 0  )
387                return f alse;   381                return f alse;
388       }   382       }
389     383  
390       return  true;   384       return  true;
391   }   385   }
392     386  
393   function _ t_action(  $str, $arg 0 = "", $a rg1 = "",  $arg2 = ""  ) {   387   function _ t_action(  $str, $arg 0 = "", $a rg1 = "",  $arg2 = ""  ) {
394       return  "<div cla ss=\"actio n\"><div>" ._t($str,$ arg0,$arg1 ,$arg2)."< /div></div >";   388       return  "<div cla ss=\"actio n\"><div>" ._t($str,$ arg0,$arg1 ,$arg2)."< /div></div >";
395   }   389   }
396     390  
397   function _ t_echo_act ion( $str,  $arg0 = " ", $arg1 =  "", $arg2  = "" ) {   391   function _ t_echo_act ion( $str,  $arg0 = " ", $arg1 =  "", $arg2  = "" ) {
398       echo " <div class =\"action\ "><div>"._ t($str,$ar g0,$arg1,$ arg2)."</d iv></div>" ;   392       echo " <div class =\"action\ "><div>"._ t($str,$ar g0,$arg1,$ arg2)."</d iv></div>" ;
399   }   393   }
400     394  
401   function e cho_t_err(  $str, $ar g0 = "", $ arg1 = "",  $arg2 = " " ) {   395   function e cho_t_err(  $str, $ar g0 = "", $ arg1 = "",  $arg2 = " " ) {
402       echo " <div class =\"err\">< div>"._t($ str,$arg0, $arg1,$arg 2)."</div> </div>";   396       echo " <div class =\"err\">< div>"._t($ str,$arg0, $arg1,$arg 2)."</div> </div>";
403   }   397   }
404     398  
405   function _ t_err( $st r, $arg0 =  "", $arg1  = "", $ar g2 = "" )  {   399   function _ t_err( $st r, $arg0 =  "", $arg1  = "", $ar g2 = "" )  {
406       return  '<div cla ss="err">< div>' . _t ( $str, $a rg0, $arg1 , $arg2 )  . '</div>< /div>';   400       return  '<div cla ss="err">< div>' . _t ( $str, $a rg0, $arg1 , $arg2 )  . '</div>< /div>';
407   }   401   }
408     402  
409   function _ t($key, $a rg0 = "",  $arg1 = "" , $arg2 =  "") {   403   function _ t($key, $a rg0 = "",  $arg1 = "" , $arg2 =  "") {
410       global  $LANG;   404       global  $LANG;
411     405  
412       if(iss et($LANG[$ key]))   406       if(iss et($LANG[$ key]))
413       {   407       {
414           $s tr = $LANG [$key];   408           $s tr = $LANG [$key];
415           $s tr = str_r eplace('{0 }', $arg0,  $str);   409           $s tr = str_r eplace('{0 }', $arg0,  $str);
416           $s tr = str_r eplace('{1 }', $arg1,  $str);   410           $s tr = str_r eplace('{1 }', $arg1,  $str);
417           $s tr = str_r eplace('{2 }', $arg2,  $str);   411           $s tr = str_r eplace('{2 }', $arg2,  $str);
418           re turn $str;   412           re turn $str;
419       }   413       }
420       else   414       else
421       {   415       {
422           re turn $key;   416           re turn $key;
423       }   417       }
424   }   418   }
425     419  
426   function _ t_ext($key , $args) {   420   function _ t_ext($key , $args) {
427       global  $LANG;   421       global  $LANG;
428     422  
429       if(iss et($LANG[$ key]))   423       if(iss et($LANG[$ key]))
430       {   424       {
431           $s tr = $LANG [$key];   425           $s tr = $LANG [$key];
432     426  
433           if (!is_array ($args))   427           if (!is_array ($args))
434           {   428           {
435                return s tr_replace ('{0}', $a rgs, $str) ;   429                return s tr_replace ('{0}', $a rgs, $str) ;
436           }   430           }
437     431  
438           fo reach ($ar gs as $key  => $val)   432           fo reach ($ar gs as $key  => $val)
439           {   433           {
440                $str = s tr_replace ('{'.$key. '}', $val,  $str);   434                $str = s tr_replace ('{'.$key. '}', $val,  $str);
441           }   435           }
442     436  
443           re turn $str;   437           re turn $str;
444       }   438       }
445       else   439       else
446       {   440       {
447           re turn $key;   441           re turn $key;
448       }   442       }
449   }   443   }