48. File Comparison Report

Produced on Wed Jun 18 08:01:49 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.

48.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc languages.inc.php Sat Apr 26 08:19:16 2008 UTC
2 Dolphin-v.6.1.2\inc languages.inc.php Mon May 19 07:27:14 2008 UTC

48.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 890
Changed 1 8
Inserted 0 0
Removed 0 0

48.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

48.4 Active regular expressions

No regular expressions were active.

48.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 ['root']}l angs/lang- {$sCurrent Language}. php" );   33   require_on ce( "{$dir ['root']}l angs/lang- {$sCurrent Language}. 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       global  $dir;
95          95       
96       if( fi le_exists(  "{$dir['r oot']}lang s/lang-{$s Lang}.php"  ) )   96       if( fi le_exists(  "{$dir['r oot']}lang s/lang-{$s Lang}.php"  ) )
97           re turn true;   97           re turn true;
98          98       
99       $sQuer y = "SELEC T `ID` FRO M `Localiz ationLangu ages` WHER E `Name` =  '$sLang'" ;   99       $sQuer y = "SELEC T `ID` FRO M `Localiz ationLangu ages` WHER E `Name` =  '$sLang'" ;
100       $iLang ID = (int) db_value(  $sQuery );   100       $iLang ID = (int) db_value(  $sQuery );
101          101       
102       if( !$ iLangID )   102       if( !$ iLangID )
103           re turn false ;   103           re turn false ;
104          104       
105       if( co mpileLangu age( $iLan gID ) )   105       if( co mpileLangu age( $iLan gID ) )
106           re turn true;   106           re turn true;
107          107       
108       return  false;   108       return  false;
109   }   109   }
110     110  
111   function s etLangCook ie( $sLang  ) {   111   function s etLangCook ie( $sLang  ) {
112       setcoo kie( 'lang ', '',      time() -  60*60*24,     '/' );   112       setcoo kie( 'lang ', '',      time() -  60*60*24,     '/' );
113       setcoo kie( 'lang ', $sLang,  time() +  60*60*24*3 65, '/' );   113       setcoo kie( 'lang ', $sLang,  time() +  60*60*24*3 65, '/' );
114   }   114   }
115     115  
116   function g etLangSwit cher() {   116   function g etLangSwit cher() {
117       global  $sCurrent Language;   117       global  $sCurrent Language;
118       global  $site;   118       global  $site;
119          119       
120       $aLang s = getLan gsArr(true );   120       $aLang s = getLan gsArr(true );
121       if( co unt( $aLan gs ) < 2 )   121       if( co unt( $aLan gs ) < 2 )
122           re turn '';   122           re turn '';
123     123  
124       $sCurL ink = $_SE RVER['REQU EST_URI'];   124       $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   125       $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 ) ? '&'  : '?';   126       $sCurL ink .= str pos( $sCur Link, '?',  1 ) ? '&'  : '?';
127          127       
128       $sRet  = '';   128       $sRet  = '';
129       foreac h( $aLangs  as $sName  => $sLang  ) {   129       foreac h( $aLangs  as $sName  => $sLang  ) {
130           $s Title = ht mlspecialc hars( subs tr( $sLang , 0, -2 )  );   130           $s Title = ht mlspecialc hars( subs tr( $sLang , 0, -2 )  );
131           $s Flag  = $s ite['flags '] . subst r( $sLang,  -2 ) . '. gif';   131           $s Flag  = $s ite['flags '] . subst r( $sLang,  -2 ) . '. gif';
132              132           
133           if ( $sCurren tLanguage  == $sName  ) {   133           if ( $sCurren tLanguage  == $sName  ) {
134                $sRet .=  '   134                $sRet .=  '
135                    <img  class="la ng_selecte d" src="'  . $sFlag .  '" alt="'  . $sTitle  . '" titl e="' . $sT itle . '"  />';   135                    <img  class="la ng_selecte d" src="'  . $sFlag .  '" alt="'  . $sTitle  . '" titl e="' . $sT itle . '"  />';
136           }  else {   136           }  else {
137                $sLink =  $sCurLink  . 'lang='  . $sName;   137                $sLink =  $sCurLink  . 'lang='  . $sName;
138                 $sRet   .=   '   138                 $sRet   .=   <<<EOF
139                     <a   href=" '   .   $sLink   .' "   title=" '   .   $sTitle   .   ' ">   139   <a   href=" { $sLink } "   title=" { $sTitle } ">
140                         <img   class="lan g_not_sele cted"   src=" '   .   $sFlag   .   ' "   alt=" '   .   $sTitle   .   ' "   title=" '   .   $sTitle   .   ' "   />
  140        <img   class="lan g_not_sele cted"   src=" { $sFlag } "   alt=" { $sTitle } "   title=" { $sTitle } "   /> </a>
141                    </a> ';   141   EOF;
142           }   142           }
143       }   143       }
144          144       
145       return  $sRet;   145       return  $sRet;
146   }   146   }
147     147  
148   function g etLangsArr ( $bAddFla g = false,  $bRetIDs  = false )  {   148   function g etLangsArr ( $bAddFla g = false,  $bRetIDs  = false )  {
149       $rLang s = db_res ('SELECT *  FROM `Loc alizationL anguages`  ORDER BY ` Title` ASC ');   149       $rLang s = db_res ('SELECT *  FROM `Loc alizationL anguages`  ORDER BY ` Title` ASC ');
150          150       
151       $aLang s = array( );   151       $aLang s = array( );
152       while(  $aLang =  mysql_fetc h_assoc($r Langs) ) {   152       while(  $aLang =  mysql_fetc h_assoc($r Langs) ) {
153           $s Flag = '';   153           $s Flag = '';
154           $s Flag = $bA ddFlag ? (  $aLang['F lag'] ? $a Lang['Flag '] : 'xx'  ) : '';   154           $s Flag = $bA ddFlag ? (  $aLang['F lag'] ? $a Lang['Flag '] : 'xx'  ) : '';
155              155           
156           $s Key = ($bR etIDs) ? $ aLang['ID' ] : $aLang ['Name'];   156           $s Key = ($bR etIDs) ? $ aLang['ID' ] : $aLang ['Name'];
157           $a Langs[ $sK ey ] = $aL ang['Title '] . $sFla g;   157           $a Langs[ $sK ey ] = $aL ang['Title '] . $sFla g;
158       }   158       }
159          159       
160       return  $aLangs;   160       return  $aLangs;
161   }   161   }
162     162  
163   function d eleteLangu age($langI D = 0) {   163   function d eleteLangu age($langI D = 0) {
164       global  $dir;   164       global  $dir;
165     165  
166       $langI D = (int)$ langID;   166       $langI D = (int)$ langID;
167     167  
168       if($la ngID <= 0)  return fa lse;   168       if($la ngID <= 0)  return fa lse;
169     169  
170       $resLa ngs = mysq l_query('   170       $resLa ngs = mysq l_query('
171                SELECT   `ID`, `Nam e`   171                SELECT   `ID`, `Nam e`
172                FROM     `Localizat ionLanguag es`   172                FROM     `Localizat ionLanguag es`
173                WHERE    `ID` = '.$ langID);   173                WHERE    `ID` = '.$ langID);
174     174  
175       if(mys ql_num_row s($resLang s) <= 0) r eturn fals e;   175       if(mys ql_num_row s($resLang s) <= 0) r eturn fals e;
176     176  
177       $arrLa ng = mysql _fetch_ass oc($resLan gs);   177       $arrLa ng = mysql _fetch_ass oc($resLan gs);
178     178  
179       $numSt rings = my sql_query( '   179       $numSt rings = my sql_query( '
180           SE LECT COUNT (`IDKey`)   180           SE LECT COUNT (`IDKey`)
181           FR OM `Locali zationStri ngs`   181           FR OM `Locali zationStri ngs`
182           WH ERE `IDLan guage` = ' .$langID);   182           WH ERE `IDLan guage` = ' .$langID);
183       $numSt rings = my sql_fetch_ row($numSt rings);   183       $numSt rings = my sql_fetch_ row($numSt rings);
184       $numSt rings = $n umStrings[ 0];   184       $numSt rings = $n umStrings[ 0];
185     185  
186       mysql_ query('DEL ETE FROM ` Localizati onStrings`  WHERE `ID Language`  = '.$langI D);   186       mysql_ query('DEL ETE FROM ` Localizati onStrings`  WHERE `ID Language`  = '.$langI D);
187     187  
188       if(mys ql_affecte d_rows() <  $numStrin gs) return  false;   188       if(mys ql_affecte d_rows() <  $numStrin gs) return  false;
189     189  
190       mysql_ query('DEL ETE FROM ` Localizati onLanguage s` WHERE ` ID` = '.$l angID);   190       mysql_ query('DEL ETE FROM ` Localizati onLanguage s` WHERE ` ID` = '.$l angID);
191     191  
192       if(mys ql_affecte d_rows() < = 0) retur n false;   192       if(mys ql_affecte d_rows() < = 0) retur n false;
193     193  
194       @unlin k($dir['ro ot'].'lang s/lang-'.$ arrLang['N ame'].'.ph p');   194       @unlin k($dir['ro ot'].'lang s/lang-'.$ arrLang['N ame'].'.ph p');
195     195  
196       return  true;   196       return  true;
197   }   197   }
198     198  
199   function g etLocaliza tionKeys()  {   199   function g etLocaliza tionKeys()  {
200       $resKe ys = db_re s('SELECT  `ID`, `IDC ategory`,  `Key` FROM  `Localiza tionKeys`' );   200       $resKe ys = db_re s('SELECT  `ID`, `IDC ategory`,  `Key` FROM  `Localiza tionKeys`' );
201     201  
202       $arrKe ys = array ();   202       $arrKe ys = array ();
203     203  
204       while( $arr = mys ql_fetch_a ssoc($resK eys))   204       while( $arr = mys ql_fetch_a ssoc($resK eys))
205       {   205       {
206           $I D = $arr[' ID'];   206           $I D = $arr[' ID'];
207           un set($arr[' ID']);   207           un set($arr[' ID']);
208           $a rrKeys[$ID ] = $arr;   208           $a rrKeys[$ID ] = $arr;
209       }   209       }
210     210  
211       return  $arrKeys;   211       return  $arrKeys;
212   }   212   }
213     213  
214   function g etLocaliza tionString Params($ke yID) {   214   function g etLocaliza tionString Params($ke yID) {
215       $keyID  = (int)$k eyID;   215       $keyID  = (int)$k eyID;
216     216  
217       $resPa rams = mys ql_query("   217       $resPa rams = mys ql_query("
218           SE LECT  `IDP aram`,   218           SE LECT  `IDP aram`,
219                    `Des cription`   219                    `Des cription`
220           FR OM    `Loc alizationS tringParam s`   220           FR OM    `Loc alizationS tringParam s`
221           WH ERE   `IDK ey` = $key ID   221           WH ERE   `IDK ey` = $key ID
222           OR DER BY `ID Param`   222           OR DER BY `ID Param`
223       ");   223       ");
224     224  
225       $arrPa rams = arr ay();   225       $arrPa rams = arr ay();
226     226  
227       while  ($arr = my sql_fetch_ assoc($res Params))   227       while  ($arr = my sql_fetch_ assoc($res Params))
228       {   228       {
229           $a rrParams[( int)$arr[' IDParam']]  = $arr['D escription '];   229           $a rrParams[( int)$arr[' IDParam']]  = $arr['D escription '];
230       }   230       }
231     231  
232       return  $arrParam s;   232       return  $arrParam s;
233   }   233   }
234     234  
235   function g etLocaliza tionCatego ries() {   235   function g etLocaliza tionCatego ries() {
236       $resCa tegories =  db_res('S ELECT `ID` , `Name` F ROM `Local izationCat egories` O RDER BY `N ame`');   236       $resCa tegories =  db_res('S ELECT `ID` , `Name` F ROM `Local izationCat egories` O RDER BY `N ame`');
237     237  
238       $arrCa tegories =  array();   238       $arrCa tegories =  array();
239     239  
240       while  ($arr = my sql_fetch_ assoc($res Categories ))   240       while  ($arr = my sql_fetch_ assoc($res Categories ))
241       {   241       {
242           $a rrCategori es[$arr['I D']] = $ar r['Name'];   242           $a rrCategori es[$arr['I D']] = $ar r['Name'];
243       }   243       }
244     244  
245       return  $arrCateg ories;   245       return  $arrCateg ories;
246   }   246   }
247     247  
248   function c ompileLang uage($lang ID = 0) {   248   function c ompileLang uage($lang ID = 0) {
249       global  $dir;   249       global  $dir;
250     250  
251       $langI D = (int)$ langID;   251       $langI D = (int)$ langID;
252     252  
253       $newLi ne = "\r\n ";   253       $newLi ne = "\r\n ";
254          254       
255       if($la ngID <= 0)  {   255       if($la ngID <= 0)  {
256           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   256           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
257       } else  {   257       } else  {
258           $r esLangs =  db_res('   258           $r esLangs =  db_res('
259                SELECT   `ID`, `Nam e`   259                SELECT   `ID`, `Nam e`
260                FROM     `Localizat ionLanguag es`   260                FROM     `Localizat ionLanguag es`
261                WHERE    `ID` = '.$ langID   261                WHERE    `ID` = '.$ langID
262           );   262           );
263       }   263       }
264     264  
265       if ( m ysql_num_r ows($resLa ngs) <= 0  )   265       if ( m ysql_num_r ows($resLa ngs) <= 0  )
266           re turn false ;   266           re turn false ;
267     267  
268       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs)) {   268       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs)) {
269           $r esKeysStri ngs = db_r es("   269           $r esKeysStri ngs = db_r es("
270                SELECT   `Localizat ionKeys`.` Key` AS `K ey`,   270                SELECT   `Localizat ionKeys`.` Key` AS `K ey`,
271                         `Localizat ionStrings `.`String`  AS `Strin g`   271                         `Localizat ionStrings `.`String`  AS `Strin g`
272                FROM     `Localizat ionStrings ` INNER JO IN   272                FROM     `Localizat ionStrings ` INNER JO IN
273                         `Localizat ionKeys` O N   273                         `Localizat ionKeys` O N
274                         `Localizat ionKeys`.` ID` = `Loc alizationS trings`.`I DKey`   274                         `Localizat ionKeys`.` ID` = `Loc alizationS trings`.`I DKey`
275                WHERE `L ocalizatio nStrings`. `IDLanguag e` = {$arr Language[' ID']}");   275                WHERE `L ocalizatio nStrings`. `IDLanguag e` = {$arr Language[' ID']}");
276     276  
277           $h andle = fo pen("{$dir ['root']}l angs/lang- {$arrLangu age['Name' ]}.php", ' w');   277           $h andle = fo pen("{$dir ['root']}l angs/lang- {$arrLangu age['Name' ]}.php", ' w');
278     278  
279           if ($handle = == false)  return fal se;   279           if ($handle = == false)  return fal se;
280     280  
281           $f ileContent  = "<?{$ne wLine}\$LA NG = array (";   281           $f ileContent  = "<?{$ne wLine}\$LA NG = array (";
282     282  
283           wh ile($arrKe yString =  mysql_fetc h_assoc($r esKeysStri ngs))   283           wh ile($arrKe yString =  mysql_fetc h_assoc($r esKeysStri ngs))
284           {   284           {
285                $langKey  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['Key']) ;   285                $langKey  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['Key']) ;
286                $langKey  = str_rep lace("'",  "\\'", $la ngKey);   286                $langKey  = str_rep lace("'",  "\\'", $la ngKey);
287     287  
288                $langStr  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['String ']);   288                $langStr  = str_rep lace("\\",  "\\\\", $ arrKeyStri ng['String ']);
289                $langStr  = str_rep lace("'",  "\\'", $la ngStr);   289                $langStr  = str_rep lace("'",  "\\'", $la ngStr);
290     290  
291                $fileCon tent .= "{ $newLine}\ t'$langKey ' => '$lan gStr',";   291                $fileCon tent .= "{ $newLine}\ t'$langKey ' => '$lan gStr',";
292           }   292           }
293     293  
294           $f ileContent  = trim($f ileContent , ',');   294           $f ileContent  = trim($f ileContent , ',');
295     295  
296           $w riteResult  = fwrite( $handle, $ fileConten t."{$newLi ne});?>");   296           $w riteResult  = fwrite( $handle, $ fileConten t."{$newLi ne});?>");
297           if ($writeRes ult === fa lse) retur n false;   297           if ($writeRes ult === fa lse) retur n false;
298     298  
299           if (fclose($h andle) ===  false) re turn false ;   299           if (fclose($h andle) ===  false) re turn false ;
300     300  
301           @c hmod("{$di r['root']} langs/lang -{$arrLang uage['Name ']}.php",  0666);   301           @c hmod("{$di r['root']} langs/lang -{$arrLang uage['Name ']}.php",  0666);
302       }   302       }
303     303  
304       return  true;   304       return  true;
305   }   305   }
306     306  
307   function a ddStringTo Language($ langKey, $ langString , $langID  = -1, $cat egoryID =  LANGUAGE_C ATEGORY_ID _PROFILE_F IELDS) {   307   function a ddStringTo Language($ langKey, $ langString , $langID  = -1, $cat egoryID =  LANGUAGE_C ATEGORY_ID _PROFILE_F IELDS) {
308       // inp ut validat ion   308       // inp ut validat ion
309       $langI D = (int)$ langID;   309       $langI D = (int)$ langID;
310       $categ oryID = (i nt)$catego ryID;   310       $categ oryID = (i nt)$catego ryID;
311     311  
312       if ( $ langID ==  -1 )   312       if ( $ langID ==  -1 )
313       {   313       {
314           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   314           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
315       }   315       }
316       else   316       else
317       {   317       {
318           $r esLangs =  db_res('   318           $r esLangs =  db_res('
319                SELECT   `ID`, `Nam e`   319                SELECT   `ID`, `Nam e`
320                FROM     `Localizat ionLanguag es`   320                FROM     `Localizat ionLanguag es`
321                WHERE    `ID` = '.$ langID);   321                WHERE    `ID` = '.$ langID);
322       }   322       }
323     323  
324       $langK ey = addsl ashes($lan gKey);   324       $langK ey = addsl ashes($lan gKey);
325       $langS tring = pr ocess_db_i nput($lang String);   325       $langS tring = pr ocess_db_i nput($lang String);
326     326  
327       $resIn sertKey =  db_res( "   327       $resIn sertKey =  db_res( "
328           IN SERT INTO  `Localizat ionKeys`   328           IN SERT INTO  `Localizat ionKeys`
329           SE T          `IDCategor y` = $cate goryID,   329           SE T          `IDCategor y` = $cate goryID,
330                         `Key` = '$ langKey'",  false );   330                         `Key` = '$ langKey'",  false );
331       if ( ! $resInsert Key || mys ql_affecte d_rows() < = 0 )   331       if ( ! $resInsert Key || mys ql_affecte d_rows() < = 0 )
332           re turn false ;   332           re turn false ;
333     333  
334       $keyID  = mysql_i nsert_id() ;   334       $keyID  = mysql_i nsert_id() ;
335     335  
336       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))   336       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))
337       {   337       {
338           $r esInsertSt ring = db_ res( "   338           $r esInsertSt ring = db_ res( "
339                INSERT I NTO `Local izationStr ings`   339                INSERT I NTO `Local izationStr ings`
340                SET          `IDKey ` = $keyID ,   340                SET          `IDKey ` = $keyID ,
341                             `IDLan guage` = { $arrLangua ge['ID']},   341                             `IDLan guage` = { $arrLangua ge['ID']},
342                             `Strin g` = '$lan gString'",  false );   342                             `Strin g` = '$lan gString'",  false );
343           if  ( !$resIn sertString  || mysql_ affected_r ows() <= 0  )   343           if  ( !$resIn sertString  || mysql_ affected_r ows() <= 0  )
344                return f alse;   344                return f alse;
345       }   345       }
346     346  
347       return  true;   347       return  true;
348   }   348   }
349     349  
350   function u pdateStrin gInLanguag e($langKey , $langStr ing, $lang ID = -1) {   350   function u pdateStrin gInLanguag e($langKey , $langStr ing, $lang ID = -1) {
351       // inp ut validat ion   351       // inp ut validat ion
352       $langI D = (int)$ langID;   352       $langI D = (int)$ langID;
353     353  
354       if ( $ langID ==  -1 )   354       if ( $ langID ==  -1 )
355       {   355       {
356           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');   356           $r esLangs =  db_res('SE LECT `ID`,  `Name` FR OM `Locali zationLang uages`');
357       }   357       }
358       else   358       else
359       {   359       {
360           $r esLangs =  db_res('   360           $r esLangs =  db_res('
361                SELECT   `ID`, `Nam e`   361                SELECT   `ID`, `Nam e`
362                FROM     `Localizat ionLanguag es`   362                FROM     `Localizat ionLanguag es`
363                WHERE    `ID` = '.$ langID);   363                WHERE    `ID` = '.$ langID);
364       }   364       }
365     365  
366       $langK ey = addsl ashes($lan gKey);   366       $langK ey = addsl ashes($lan gKey);
367       $langS tring = pr ocess_db_i nput($lang String);   367       $langS tring = pr ocess_db_i nput($lang String);
368     368  
369       $arrKe y = db_arr ( "   369       $arrKe y = db_arr ( "
370           SE LECT  `ID`   370           SE LECT  `ID`
371           FR OM    `Loc alizationK eys`   371           FR OM    `Loc alizationK eys`
372           WH ERE   `Key ` = '$lang Key'", fal se );   372           WH ERE   `Key ` = '$lang Key'", fal se );
373     373  
374       if ( ! $arrKey )   374       if ( ! $arrKey )
375           re turn false ;   375           re turn false ;
376     376  
377       $keyID  = $arrKey ['ID'];   377       $keyID  = $arrKey ['ID'];
378     378  
379       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))   379       while( $arrLangua ge = mysql _fetch_ass oc($resLan gs))
380       {   380       {
381           $r esUpdateSt ring = db_ res( "   381           $r esUpdateSt ring = db_ res( "
382                UPDATE   `Localizat ionStrings `   382                UPDATE   `Localizat ionStrings `
383                SET          `Strin g` = '$lan gString'   383                SET          `Strin g` = '$lan gString'
384                WHERE        `IDKey ` = $keyID   384                WHERE        `IDKey ` = $keyID
385                AND          `IDLan guage` = { $arrLangua ge['ID']}" , false );   385                AND          `IDLan guage` = { $arrLangua ge['ID']}" , false );
386           if  ( !$resUp dateString  || mysql_ affected_r ows() <= 0  )   386           if  ( !$resUp dateString  || mysql_ affected_r ows() <= 0  )
387                return f alse;   387                return f alse;
388       }   388       }
389     389  
390       return  true;   390       return  true;
391   }   391   }
392     392  
393   function _ t_action(  $str, $arg 0 = "", $a rg1 = "",  $arg2 = ""  ) {   393   function _ t_action(  $str, $arg 0 = "", $a rg1 = "",  $arg2 = ""  ) {
394       return  "<div cla ss=\"actio n\"><div>" ._t($str,$ arg0,$arg1 ,$arg2)."< /div></div >";   394       return  "<div cla ss=\"actio n\"><div>" ._t($str,$ arg0,$arg1 ,$arg2)."< /div></div >";
395   }   395   }
396     396  
397   function _ t_echo_act ion( $str,  $arg0 = " ", $arg1 =  "", $arg2  = "" ) {   397   function _ t_echo_act ion( $str,  $arg0 = " ", $arg1 =  "", $arg2  = "" ) {
398       echo " <div class =\"action\ "><div>"._ t($str,$ar g0,$arg1,$ arg2)."</d iv></div>" ;   398       echo " <div class =\"action\ "><div>"._ t($str,$ar g0,$arg1,$ arg2)."</d iv></div>" ;
399   }   399   }
400     400  
401   function e cho_t_err(  $str, $ar g0 = "", $ arg1 = "",  $arg2 = " " ) {   401   function e cho_t_err(  $str, $ar g0 = "", $ arg1 = "",  $arg2 = " " ) {
402       echo " <div class =\"err\">< div>"._t($ str,$arg0, $arg1,$arg 2)."</div> </div>";   402       echo " <div class =\"err\">< div>"._t($ str,$arg0, $arg1,$arg 2)."</div> </div>";
403   }   403   }
404     404  
405   function _ t_err( $st r, $arg0 =  "", $arg1  = "", $ar g2 = "" )  {   405   function _ t_err( $st r, $arg0 =  "", $arg1  = "", $ar g2 = "" )  {
406       return  '<div cla ss="err">< div>' . _t ( $str, $a rg0, $arg1 , $arg2 )  . '</div>< /div>';   406       return  '<div cla ss="err">< div>' . _t ( $str, $a rg0, $arg1 , $arg2 )  . '</div>< /div>';
407   }   407   }
408     408  
409   function _ t($key, $a rg0 = "",  $arg1 = "" , $arg2 =  "") {   409   function _ t($key, $a rg0 = "",  $arg1 = "" , $arg2 =  "") {
410       global  $LANG;   410       global  $LANG;
411     411  
412       if(iss et($LANG[$ key]))   412       if(iss et($LANG[$ key]))
413       {   413       {
414           $s tr = $LANG [$key];   414           $s tr = $LANG [$key];
415           $s tr = str_r eplace('{0 }', $arg0,  $str);   415           $s tr = str_r eplace('{0 }', $arg0,  $str);
416           $s tr = str_r eplace('{1 }', $arg1,  $str);   416           $s tr = str_r eplace('{1 }', $arg1,  $str);
417           $s tr = str_r eplace('{2 }', $arg2,  $str);   417           $s tr = str_r eplace('{2 }', $arg2,  $str);
418           re turn $str;   418           re turn $str;
419       }   419       }
420       else   420       else
421       {   421       {
422           re turn $key;   422           re turn $key;
423       }   423       }
424   }   424   }
425     425  
426   function _ t_ext($key , $args) {   426   function _ t_ext($key , $args) {
427       global  $LANG;   427       global  $LANG;
428     428  
429       if(iss et($LANG[$ key]))   429       if(iss et($LANG[$ key]))
430       {   430       {
431           $s tr = $LANG [$key];   431           $s tr = $LANG [$key];
432     432  
433           if (!is_array ($args))   433           if (!is_array ($args))
434           {   434           {
435                return s tr_replace ('{0}', $a rgs, $str) ;   435                return s tr_replace ('{0}', $a rgs, $str) ;
436           }   436           }
437     437  
438           fo reach ($ar gs as $key  => $val)   438           fo reach ($ar gs as $key  => $val)
439           {   439           {
440                $str = s tr_replace ('{'.$key. '}', $val,  $str);   440                $str = s tr_replace ('{'.$key. '}', $val,  $str);
441           }   441           }
442     442  
443           re turn $str;   443           re turn $str;
444       }   444       }
445       else   445       else
446       {   446       {
447           re turn $key;   447           re turn $key;
448       }   448       }
449   }   449   }