4. File Comparison Report

Produced on Thu Jul 17 07:17:04 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.

4.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\admin global_settings.php Sat Apr 26 08:19:16 2008 UTC
2 Dolphin-v.6.1.3\admin global_settings.php Wed Jul 16 09:51:21 2008 UTC

4.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 1648
Changed 1 2
Inserted 0 0
Removed 2 2

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

4.4 Active regular expressions

No regular expressions were active.

4.5 Comparison detail

1   <?php   1   <?php
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   /*   21   /*
22    * Page fo r displayi ng and edi ting Globa l Settings  in admin  panel.   22    * Page fo r displayi ng and edi ting Globa l Settings  in admin  panel.
23    */   23    */
24   require_on ce( '../in c/header.i nc.php' );   24   require_on ce( '../in c/header.i nc.php' );
25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );   25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
26   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );   26   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );
27   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rof.inc.ph p' );   27   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rof.inc.ph p' );
28   require_on ce( BX_DIR ECTORY_PAT H_INC . 'a dmin_desig n.inc.php'  );   28   require_on ce( BX_DIR ECTORY_PAT H_INC . 'a dmin_desig n.inc.php'  );
29   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );   29   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );
30   require_on ce( BX_DIR ECTORY_PAT H_INC . 'i mages.inc. php' );   30   require_on ce( BX_DIR ECTORY_PAT H_INC . 'i mages.inc. php' );
31     31  
32   // Check i f administ rator is l ogged in.   If not di splay logi n form.   32   // Check i f administ rator is l ogged in.   If not di splay logi n form.
33   $logged['a dmin']   =   member_aut h(1
);
  33   $logged['a dmin']   =   member_aut h(1 ,   true,   true );
34     34  
35   $_page['cs s_name'] =  'global_s ettings.cs s';   35   $_page['cs s_name'] =  'global_s ettings.cs s';
36     36  
37   // Get cat egory.   37   // Get cat egory.
38     38  
39   if( $_GET[ 'cat'] )   39   if( $_GET[ 'cat'] )
40   {   40   {
41       $cat =  $_GET['ca t'];   41       $cat =  $_GET['ca t'];
42       if ( i s_numeric( $cat) && ( int)$cat < = 0 )   42       if ( i s_numeric( $cat) && ( int)$cat < = 0 )
43       {   43       {
44           $c at = '';   44           $c at = '';
45       }   45       }
46   }   46   }
47   else   47   else
48   {   48   {
49       $cat =  '';   49       $cat =  '';
50   }   50   }
51     51  
52   if ($cat== '1' || $ca t == '16')   52   if ($cat== '1' || $ca t == '16')
53   {   53   {
54       $_page ['header']  = 'Advanc ed Setting s';   54       $_page ['header']  = 'Advanc ed Setting s';
55   }   55   }
56   else    56   else 
57   {   57   {
58       $_page ['header']  = 'Settin gs';   58       $_page ['header']  = 'Settin gs';
59   }   59   }
60     60  
61   // Constan ts.   61   // Constan ts.
62   define('EM AIL_TEMPLA TE_CATEGOR Y', 4);   62   define('EM AIL_TEMPLA TE_CATEGOR Y', 4);
63   define('WA TERMARK_CA TEGORY', 1 6);   63   define('WA TERMARK_CA TEGORY', 1 6);
64     64  
65   define('E_ INVALID_OL D_PASSWORD ', 1);   65   define('E_ INVALID_OL D_PASSWORD ', 1);
66   define('E_ PASSWORD_C ONFIRMATIO N_FAILED',  2);   66   define('E_ PASSWORD_C ONFIRMATIO N_FAILED',  2);
67   define('E_ INVALID_PA SSWORD_LEN GTH', 3);   67   define('E_ INVALID_PA SSWORD_LEN GTH', 3);
68   define('S_ OK', 0);   68   define('S_ OK', 0);
69   define('E_ INVALID_PA RAMETER',  1);   69   define('E_ INVALID_PA RAMETER',  1);
70     70  
71   TopCodeAdm in();   71   TopCodeAdm in();
72     72  
73   ob_start() ;   73   ob_start() ;
74     74  
75   // SAVE CH ANGES   75   // SAVE CH ANGES
76   $save_sett ings = ('y es' == $_P OST['save_ settings'] );   76   $save_sett ings = ('y es' == $_P OST['save_ settings'] );
77   if (strlen ($cat) > 0 )   77   if (strlen ($cat) > 0 )
78   {   78   {
79       // Adm in passwor d was chan ged.  Try  to save it .   79       // Adm in passwor d was chan ged.  Try  to save it .
80       if (FA LSE != $sa ve_setting s && 'ap'  == $cat)   80       if (FA LSE != $sa ve_setting s && 'ap'  == $cat)
81       {   81       {
82           if  ( $demo_m ode )   82           if  ( $demo_m ode )
83           {   83           {
84                echo '<s pan class= "succ">Pas sword can\ 't be chan ged.</span ><br />';   84                echo '<s pan class= "succ">Pas sword can\ 't be chan ged.</span ><br />';
85           }   85           }
86           el se   86           el se
87           {   87           {
88                $result  = save_adm in_passwor d($_COOKIE ['adminID' ], $_POST[ 'pwd_old'] , $_POST[' pwd_new'],  $_POST['p wd_new_con firm']);   88                $result  = save_adm in_passwor d($_COOKIE ['adminID' ], $_POST[ 'pwd_old'] , $_POST[' pwd_new'],  $_POST['p wd_new_con firm']);
89                switch ( $result)   89                switch ( $result)
90                {   90                {
91                    case  S_OK:   91                    case  S_OK:
92                    {   92                    {
93                         // No erro r.  Displa y message.   93                         // No erro r.  Displa y message.
94                         echo '<spa n class="s ucc">Passw ord change d.</span>< br />';   94                         echo '<spa n class="s ucc">Passw ord change d.</span>< br />';
95                    }   95                    }
96                    brea k;   96                    brea k;
97                    case  E_INVALID _OLD_PASSW ORD:   97                    case  E_INVALID _OLD_PASSW ORD:
98                    {   98                    {
99                         echo '<div  class="er r">Error s aving new  password:  wrong old  password!< /div><br>' ;   99                         echo '<div  class="er r">Error s aving new  password:  wrong old  password!< /div><br>' ;
100                    }   100                    }
101                    brea k;   101                    brea k;
102                    case  E_INVALID _PASSWORD_ LENGTH:   102                    case  E_INVALID _PASSWORD_ LENGTH:
103                    {   103                    {
104                         echo '<div  class="er r">Error s aving new  password:  invalid pa ssword len gth (betwe en 3 and 1 1 characte rs).</div> <br>';   104                         echo '<div  class="er r">Error s aving new  password:  invalid pa ssword len gth (betwe en 3 and 1 1 characte rs).</div> <br>';
105                    }   105                    }
106                    brea k;   106                    brea k;
107                    case  E_PASSWOR D_CONFIRMA TION_FAILE D:   107                    case  E_PASSWOR D_CONFIRMA TION_FAILE D:
108                    {   108                    {
109                         echo '<div  class="er r">Error s aving new  passowrd:  password n ot confirm ed.</div>< br>';   109                         echo '<div  class="er r">Error s aving new  passowrd:  password n ot confirm ed.</div>< br>';
110                    }   110                    }
111                }   111                }
112           }   112           }
113       }   113       }
114       else i f (FALSE ! = $save_se ttings &&  WATERMARK_ CATEGORY = = $cat)   114       else i f (FALSE ! = $save_se ttings &&  WATERMARK_ CATEGORY = = $cat)
115       {   115       {
116           sa ve_water_m ark();   116           sa ve_water_m ark();
117       }   117       }
118       else i f (FALSE ! = $save_se ttings &&  'all' == $ cat)   118       else i f (FALSE ! = $save_se ttings &&  'all' == $ cat)
119       {   119       {
120           sa ve_setting s_all();   120           sa ve_setting s_all();
121           //  Check $er rors array .  If it's  not empty  display e rror messa ges,   121           //  Check $er rors array .  If it's  not empty  display e rror messa ges,
122           //  otherwise  display s uccess mes sage.   122           //  otherwise  display s uccess mes sage.
123           if  (count($e rrors) > 0 )   123           if  (count($e rrors) > 0 )
124           {   124           {
125                echo get _error_mes sages();   125                echo get _error_mes sages();
126           }   126           }
127           el se   127           el se
128           {   128           {
129                echo '<d iv class=" succ">Sett ings saved .</div><br  />';   129                echo '<d iv class=" succ">Sett ings saved .</div><br  />';
130           }   130           }
131       }   131       }
132       else i f (FALSE ! = $save_se ttings)   132       else i f (FALSE ! = $save_se ttings)
133       {   133       {
134           sw itch ($cat )   134           sw itch ($cat )
135           {   135           {
136                case '1'  :    136                case '1'  : 
137                case '16 ': $aCat =  array('16 ','1','23' ,'3','12', '15'); bre ak;   137                case '16 ': $aCat =  array('16 ','1','23' ,'3','12', '15'); bre ak;
138                case '4'  : $aCat =  array('8' ,'17','4') ; break;   138                case '4'  : $aCat =  array('8' ,'17','4') ; break;
139                default   : $aCat =  array($ca t);   139                default   : $aCat =  array($ca t);
140           }   140           }
141           fo reach ($aC at as $i = > $sKey)   141           fo reach ($aC at as $i = > $sKey)
142           {   142           {
143                if ( WAT ERMARK_CAT EGORY == $ sKey )   143                if ( WAT ERMARK_CAT EGORY == $ sKey )
144                {   144                {
145                    save _water_mar k();   145                    save _water_mar k();
146                }   146                }
147                else   147                else
148                {   148                {
149                    save _settings( $sKey);   149                    save _settings( $sKey);
150                }      150                }   
151           }   151           }
152           //  Check $er rors array .  If it's  not empty  display e rror messa ges,   152           //  Check $er rors array .  If it's  not empty  display e rror messa ges,
153           //  Otherwise  display s uccess mes sage.   153           //  Otherwise  display s uccess mes sage.
154           if  (count($e rrors) > 0 )   154           if  (count($e rrors) > 0 )
155           {   155           {
156                echo get _error_mes sages();   156                echo get _error_mes sages();
157           }   157           }
158           el se   158           el se
159           {   159           {
160                echo '<d iv class=" succ">Sett ings saved .</div><br  />';   160                echo '<d iv class=" succ">Sett ings saved .</div><br  />';
161           }   161           }
162       }   162       }
163   }   163   }
164     164  
165   // Display  forms and  controls  for editin g settings .   165   // Display  forms and  controls  for editin g settings .
166   if ( strle n($cat) >  0)   166   if ( strle n($cat) >  0)
167   {   167   {
168       if ( ' ap' == $ca t )   168       if ( ' ap' == $ca t )
169           $p ageHeader  = display_ admin_pass word();   169           $p ageHeader  = display_ admin_pass word();
170       elseif  ('all' ==  $cat)   170       elseif  ('all' ==  $cat)
171       {   171       {
172           $p ageHeader  = 'All set tings';   172           $p ageHeader  = 'All set tings';
173              173           
174           di splay_admi n_password ();   174           di splay_admi n_password ();
175           di splay_wate rmark_sett ings();   175           di splay_wate rmark_sett ings();
176           ?>   176           ?>
177           <f orm method ="post" ac tion="<? e cho $_SERV ER['PHP_SE LF']."?cat =all"; ?>" >   177           <f orm method ="post" ac tion="<? e cho $_SERV ER['PHP_SE LF']."?cat =all"; ?>" >
178           <i nput type= "hidden" n ame="save_ settings"  value="yes ">   178           <i nput type= "hidden" n ame="save_ settings"  value="yes ">
179           <? php   179           <? php
180           //  Get a lis t of categ ories.   180           //  Get a lis t of categ ories.
181           $q _str = 'SE LECT `ID`  FROM `GlPa ramsKateg`  WHERE `ID ` <> '. WA TERMARK_CA TEGORY;   181           $q _str = 'SE LECT `ID`  FROM `GlPa ramsKateg`  WHERE `ID ` <> '. WA TERMARK_CA TEGORY;
182           $r es = db_re s($q_str);   182           $r es = db_re s($q_str);
183           //  Iterate t hru catego ries.   183           //  Iterate t hru catego ries.
184           wh ile ($row  = mysql_fe tch_array( $res))   184           wh ile ($row  = mysql_fe tch_array( $res))
185           {   185           {
186                display_ category_s ettings($r ow['ID']);   186                display_ category_s ettings($r ow['ID']);
187           }   187           }
188           ?>   188           ?>
189           <c enter><inp ut type="s ubmit" val ue="Save C hanges" cl ass="text" ></center>   189           <c enter><inp ut type="s ubmit" val ue="Save C hanges" cl ass="text" ></center>
190           </ form>   190           </ form>
191           <? php   191           <? php
192       }   192       }
193       else   193       else
194       {?>   194       {?>
195           <f orm method ="post" ac tion="<? e cho $_SERV ER[PHP_SEL F]."?cat=$ cat"; ?>">   195           <f orm method ="post" ac tion="<? e cho $_SERV ER[PHP_SEL F]."?cat=$ cat"; ?>">
196           <i nput type= "hidden" n ame="save_ settings"  value="yes ">   196           <i nput type= "hidden" n ame="save_ settings"  value="yes ">
197           <? php   197           <? php
198                switch($ cat)   198                switch($ cat)
199                {   199                {
200                    case  '1':   200                    case  '1':
201                    case  '16': $aC at = array ('1','23', '16','3',' 12','15');  break;   201                    case  '16': $aC at = array ('1','23', '16','3',' 12','15');  break;
202                    case  '4' : $aC at = array ('8','17', '4'); brea k;   202                    case  '4' : $aC at = array ('8','17', '4'); brea k;
203                    defa ult  : $aC at = array ($cat);   203                    defa ult  : $aC at = array ($cat);
204                }   204                }
205                foreach  ($aCat as  $i => $sKe y)   205                foreach  ($aCat as  $i => $sKe y)
206                {   206                {
207                    if ( WATERMARK_ CATEGORY = = $sKey)   207                    if ( WATERMARK_ CATEGORY = = $sKey)
208                    {   208                    {
209                         continue;   209                         continue;
210                    }   210                    }
211                    else   211                    else
212                    {   212                    {
213                         $pageHeade r .= displ ay_categor y_settings ($sKey);   213                         $pageHeade r .= displ ay_categor y_settings ($sKey);
214                    }   214                    }
215                }   215                }
216     216  
217           ?>   217           ?>
218           <c enter><inp ut type="s ubmit" val ue="Save C hanges" cl ass="text" ></center>   218           <c enter><inp ut type="s ubmit" val ue="Save C hanges" cl ass="text" ></center>
219           </ form>   219           </ form>
220           <?   220           <?
221           if  ('1' == $ cat || '16 ' == $cat)   221           if  ('1' == $ cat || '16 ' == $cat)
222           {   222           {
223                $pageHea der .= dis play_water mark_setti ngs();   223                $pageHea der .= dis play_water mark_setti ngs();
224           }   224           }
225       }   225       }
226   }   226   }
227     227  
228   $mainConte nt = ob_ge t_clean();   228   $mainConte nt = ob_ge t_clean();
229     229  
230   ContentBlo ckHead( $p ageHeader  );   230   ContentBlo ckHead( $p ageHeader  );
231       echo $ mainConten t;   231       echo $ mainConten t;
232   ContentBlo ckFoot();   232   ContentBlo ckFoot();
233     233  
234     234  
235   BottomCode ();   235   BottomCode ();
236   // END OF  DOCUMENT   236   // END OF  DOCUMENT
237     237  
238     238  
239     239  
240   // UTILITY  FUNCTIONS  SECTION   240   // UTILITY  FUNCTIONS  SECTION
241     241  
242   /**   242   /**
243    * Display  form and  conrols fo r editing  admin pass word.   243    * Display  form and  conrols fo r editing  admin pass word.
244    */   244    */
245   function d isplay_adm in_passwor d()   245   function d isplay_adm in_passwor d()
246   {   246   {
247       ?>   247       ?>
248       <cente r>   248       <cente r>
249       <form  method="po st" action ="<? echo  $_SERVER[P HP_SELF].' ?cat=ap';  ?>">   249       <form  method="po st" action ="<? echo  $_SERVER[P HP_SELF].' ?cat=ap';  ?>">
250       <input  type="hid den" name= "save_sett ings" valu e="yes">   250       <input  type="hid den" name= "save_sett ings" valu e="yes">
251       <table  width="10 0%" cellsp acing="2"  cellpaddin g="3" clas s="text">   251       <table  width="10 0%" cellsp acing="2"  cellpaddin g="3" clas s="text">
252           <! --<tr clas s="panel">   252           <! --<tr clas s="panel">
253                <td cols pan="2"><b >Change ad ministrato r password </b></td>   253                <td cols pan="2"><b >Change ad ministrato r password </b></td>
254           </ tr>-->   254           </ tr>-->
255           <t r>   255           <t r>
256                <td alig n="right"  width="50% "> Old Pas sword: </t d>   256                <td alig n="right"  width="50% "> Old Pas sword: </t d>
257                <td alig n="left" w idth="50%" ><input ty pe="passwo rd" size=" 14" name=" pwd_old">< /td>   257                <td alig n="left" w idth="50%" ><input ty pe="passwo rd" size=" 14" name=" pwd_old">< /td>
258           </ tr>   258           </ tr>
259           <t r>   259           <t r>
260                <td alig n="right"  width="50% "> New Pas sword: </t d>   260                <td alig n="right"  width="50% "> New Pas sword: </t d>
261                <td alig n="left">< input type ="password " size="14 " name="pw d_new"></t d>   261                <td alig n="left">< input type ="password " size="14 " name="pw d_new"></t d>
262           </ tr>   262           </ tr>
263           <t r>   263           <t r>
264                <td alig n="right"  width="50% "> Confirm  New Passw ord: </td>   264                <td alig n="right"  width="50% "> Confirm  New Passw ord: </td>
265                <td alig n="left">< input type ="password " size="14 " name="pw d_new_conf irm"></td>   265                <td alig n="left">< input type ="password " size="14 " name="pw d_new_conf irm"></td>
266           </ tr>   266           </ tr>
267       </tabl e>   267       </tabl e>
268       <br />   268       <br />
269       <input  class=no  type="subm it" value= "Save Pass word" clas s=text>   269       <input  class=no  type="subm it" value= "Save Pass word" clas s=text>
270       </form >   270       </form >
271       </cent er>   271       </cent er>
272       <?php   272       <?php
273          273       
274       return  'Password s';   274       return  'Password s';
275   }   275   }
276     276  
277   function d isplay_wat ermark_set tings()   277   function d isplay_wat ermark_set tings()
278   {   278   {
279       global  $site;   279       global  $site;
280       global  $dir;   280       global  $dir;
281     281  
282       ?>   282       ?>
283       <br/>   283       <br/>
284       <cente r>   284       <cente r>
285       <form  method="po st" enctyp e="multipa rt/form-da ta" action ="<? echo  $_SERVER[' PHP_SELF'] .'?cat=16' ; ?>">   285       <form  method="po st" enctyp e="multipa rt/form-da ta" action ="<? echo  $_SERVER[' PHP_SELF'] .'?cat=16' ; ?>">
286   <table wid th="100%"  cellspacin g="0" cell padding="3 " class="t ext" style ="border-c ollapse: c ollapse; b order: 1px  solid sil ver" borde r="0">         286   <table wid th="100%"  cellspacin g="0" cell padding="3 " class="t ext" style ="border-c ollapse: c ollapse; b order: 1px  solid sil ver" borde r="0">      
287   <tr><td></ td></tr>         <!-- <tr class= "panel">   287   <tr><td></ td></tr>         <!-- <tr class= "panel">
288                <td cols pan="2"><b >Change Wa termark</b ></td>   288                <td cols pan="2"><b >Change Wa termark</b ></td>
289           </ tr>-->   289           </ tr>-->
290   <?   290   <?
291       if ( s trlen(trim (getParam( "Water_Mar k"))) && f ile_exists ( $dir['pr ofileImage '] . getPa ram("Water _Mark") )  )   291       if ( s trlen(trim (getParam( "Water_Mar k"))) && f ile_exists ( $dir['pr ofileImage '] . getPa ram("Water _Mark") )  )
292       {   292       {
293   ?>   293   ?>
294           <t r>   294           <t r>
295                <td cols pan="2" al ign="cente r" valign= "middle">   295                <td cols pan="2" al ign="cente r" valign= "middle">
296                    <img  src="<?=  $site['pro fileImage' ] . getPar am("Water_ Mark") ?>"  border="0 ">   296                    <img  src="<?=  $site['pro fileImage' ] . getPar am("Water_ Mark") ?>"  border="0 ">
297                </td>   297                </td>
298           </ tr>   298           </ tr>
299   <?   299   <?
300       }   300       }
301   ?>   301   ?>
302           <t r>   302           <t r>
303                <td alig n="right"  width="50% "><?echo g etParamDes c("Water_M ark")?>:</ td>   303                <td alig n="right"  width="50% "><?echo g etParamDes c("Water_M ark")?>:</ td>
304                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="file_ watermark"  size="10"  type="fil e"></td>   304                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="file_ watermark"  size="10"  type="fil e"></td>
305           </ tr>   305           </ tr>
306           <t r>   306           <t r>
307                <td alig n="right"  width="50% "><?echo g etParamDes c("transpa rent1")?>< /td>   307                <td alig n="right"  width="50% "><?echo g etParamDes c("transpa rent1")?>< /td>
308                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="trans p1" size=" 10" type=" text" valu e="<?echo  getParam(" transparen t1")?>">%< /td>   308                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="trans p1" size=" 10" type=" text" valu e="<?echo  getParam(" transparen t1")?>">%< /td>
309           </ tr>   309           </ tr>
310            < tr>   310            < tr>
311                <td alig n="right"  width="50% "><?echo g etParamDes c("enable_ watermark" )?></td>   311                <td alig n="right"  width="50% "><?echo g etParamDes c("enable_ watermark" )?></td>
312                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="enabl e_wm" size ="10" type ="checkbox " <?if(get Param("ena ble_waterm ark")) ech o "checked ";?>></td> </tr>   312                <td alig n="left" w idth="50%" ><input cl ass="no" n ame="enabl e_wm" size ="10" type ="checkbox " <?if(get Param("ena ble_waterm ark")) ech o "checked ";?>></td> </tr>
313       <tr><t d align="c enter" col span="2">< input type ="hidden"  name="save _settings"  value="ye s">   313       <tr><t d align="c enter" col span="2">< input type ="hidden"  name="save _settings"  value="ye s">
314       <input  name="MAX _FILE_SIZE " value="2 097152" ty pe="hidden ">   314       <input  name="MAX _FILE_SIZE " value="2 097152" ty pe="hidden ">
315       <input  class="no " value="S ave" type= "submit">   315       <input  class="no " value="S ave" type= "submit">
316       </form >   316       </form >
317       </cent er>   317       </cent er>
318       <br/>   318       <br/>
319           </ td></tr>   319           </ td></tr>
320          </t able>   320          </t able>
321         <br  />   321         <br  />
322     322  
323       <?php   323       <?php
324          324       
325       return  '';   325       return  '';
326   }   326   }
327     327  
328   /**   328   /**
329    * Display  controls  for editin g category  settings.   329    * Display  controls  for editin g category  settings.
330    * The enc losing for m must be  defined ou tside of t he functio n, this is  done to b e able   330    * The enc losing for m must be  defined ou tside of t he functio n, this is  done to b e able
331    * to disp lay contro ls for edi ting a sin gle catego ry or a gr oup of cat egories.   331    * to disp lay contro ls for edi ting a sin gle catego ry or a gr oup of cat egories.
332    * @param  $cat -- Ca tegory for  which to  display co ntrols.   332    * @param  $cat -- Ca tegory for  which to  display co ntrols.
333    * The fun ction make s use of $ errors glo bal variab le.  This  is an arra y of inval id paramet ers and   333    * The fun ction make s use of $ errors glo bal variab le.  This  is an arra y of inval id paramet ers and
334    * it is u sed to hig hligh thos e paramter s while di splaying.   334    * it is u sed to hig hligh thos e paramter s while di splaying.
335    */   335    */
336   function d isplay_cat egory_sett ings($cat)   336   function d isplay_cat egory_sett ings($cat)
337   {   337   {
338       global  $errors;   338       global  $errors;
339       global  $dir;    
340     339  
341       $cat =  (int)$cat ;   340       $cat =  (int)$cat ;
342     341  
343       // Get  category  name.   342       // Get  category  name.
344       $q_str  = "SELECT  `name` FR OM `GlPara msKateg` W HERE `ID`  = '$cat'";   343       $q_str  = "SELECT  `name` FR OM `GlPara msKateg` W HERE `ID`  = '$cat'";
345       $row =  db_arr($q _str);   344       $row =  db_arr($q _str);
346       $cat_n ame = $row ['name'];   345       $cat_n ame = $row ['name'];
347     346  
348       // Get  a list of  category  items.   347       // Get  a list of  category  items.
349       $q_str  = "   348       $q_str  = "
350                SELECT   349                SELECT
351                         `Name`,   350                         `Name`,
352                         `VALUE`,   351                         `VALUE`,
353                         `desc`,   352                         `desc`,
354                         `Type`   353                         `Type`
355                FROM   354                FROM
356                         `GlParams`   355                         `GlParams`
357                WHERE   356                WHERE
358                         `kateg` =  '$cat' AND  `Name` NO T LIKE '%_ subject' O RDER BY `o rder_in_ka teg` ASC";   357                         `kateg` =  '$cat' AND  `Name` NO T LIKE '%_ subject' O RDER BY `o rder_in_ka teg` ASC";
359       $items  = db_res( $q_str);   358       $items  = db_res( $q_str);
360       // Dis play contr ols for ed iting item s.   359       // Dis play contr ols for ed iting item s.
361       ?>   360       ?>
362       <cente r>   361       <cente r>
363       <table  width="10 0%" cellsp acing="0"  cellpaddin g="3" clas s="text" s tyle="bord er-collaps e: collaps e; border:  1px solid  silver" b order="0">   362       <table  width="10 0%" cellsp acing="0"  cellpaddin g="3" clas s="text" s tyle="bord er-collaps e: collaps e; border:  1px solid  silver" b order="0">
364              363           
365           <? php   364           <? php
366           //  Iterate t hru items.   365           //  Iterate t hru items.
367           $i  = 0;   366           $i  = 0;
368           wh ile ($row  = mysql_fe tch_array( $items))   367           wh ile ($row  = mysql_fe tch_array( $items))
369           {   368           {
370                $param_n ame = $row ['Name'];   369                $param_n ame = $row ['Name'];
371                $param_v alue = $ro w['VALUE'] ;   370                $param_v alue = $ro w['VALUE'] ;
372                $param_t ype = $row ['Type'];   371                $param_t ype = $row ['Type'];
373                $param_d esc = $row ['desc'];   372                $param_d esc = $row ['desc'];
374                if (1 ==  $errors[$ param_name ])   373                if (1 ==  $errors[$ param_name ])
375                {   374                {
376                    $cla ss = 'tabl e_err';   375                    $cla ss = 'tabl e_err';
377                }   376                }
378                else   377                else
379                {   378                {
380                    if ( 0 == $i %  2)   379                    if ( 0 == $i %  2)
381                    {   380                    {
382                         $class = ' table';   381                         $class = ' table';
383                    }   382                    }
384                    else   383                    else
385                    {   384                    {
386                         $class = ' table_odd' ;   385                         $class = ' table_odd' ;
387                    }   386                    }
388                }   387                }
389                $i++;   388                $i++;
390                echo "<t r class=\" $class\">< td align=\ "left\" cl ass=\"smal l1\"";   389                echo "<t r class=\" $class\">< td align=\ "left\" cl ass=\"smal l1\"";
391                // Displ ay item ca ption.   390                // Displ ay item ca ption.
392                if ('tex t' == $par am_type)   391                if ('tex t' == $par am_type)
393                {   392                {
394                    echo  ' valign= "top"';   393                    echo  ' valign= "top"';
395                }   394                }
396                echo ">$ param_desc </td><td a lign=\"rig ht\" width =\"200\">" ;   395                echo ">$ param_desc </td><td a lign=\"rig ht\" width =\"200\">" ;
397                // Displ ay item co ntrol.   396                // Displ ay item co ntrol.
398                if ('tex t' == $par am_type)   397                if ('tex t' == $par am_type)
399                {   398                {
400                    if ( EMAIL_TEMP LATE_CATEG ORY == $ca t)   399                    if ( EMAIL_TEMP LATE_CATEG ORY == $ca t)
401                    {   400                    {
402                         // Get ema il subject .   401                         // Get ema il subject .
403                         $subject_n ame = $par am_name.'_ subject';   402                         $subject_n ame = $par am_name.'_ subject';
404                         $q_str = " SELECT `VA LUE` FROM  `GlParams`  WHERE `Na me` = '$su bject_name '";   403                         $q_str = " SELECT `VA LUE` FROM  `GlParams`  WHERE `Na me` = '$su bject_name '";
405                         $res = db_ res($q_str );   404                         $res = db_ res($q_str );
406                         if ($row =  mysql_fet ch_array($ res))   405                         if ($row =  mysql_fet ch_array($ res))
407                         {   406                         {
408                             $subje ct_value =  $row['VAL UE'];   407                             $subje ct_value =  $row['VAL UE'];
409                         }   408                         }
410                         else   409                         else
411                         {   410                         {
412                             $subje ct_value =  '';   411                             $subje ct_value =  '';
413                         }   412                         }
414                         echo "<b>H TML versio n</b>&nbsp ;(";   413                         echo "<b>H TML versio n</b>&nbsp ;(";
415                         echo "<a h ref=\"java script:voi d(0);\" on Click=\"ja vascript:d ocOpen('".  rawurlenc ode($param _value) ." ');\">";   414                         echo "<a h ref=\"java script:voi d(0);\" on Click=\"ja vascript:d ocOpen('".  rawurlenc ode($param _value) ." ');\">";
416                         echo _t("_ Preview");   415                         echo _t("_ Preview");
417                         echo "</a> )<br>";   416                         echo "</a> )<br>";
418     417  
419                         echo 'Subj ect:<br /> ';   418                         echo 'Subj ect:<br /> ';
420                         echo "<inp ut type=\" text\" cla ss=\"no\"  size=\"50\ " name=\"{ $param_nam e}_subject \" value=\ "$subject_ value\"/>< br /><br / >";   419                         echo "<inp ut type=\" text\" cla ss=\"no\"  size=\"50\ " name=\"{ $param_nam e}_subject \" value=\ "$subject_ value\"/>< br /><br / >";
421                         echo 'Body :<br />';   420                         echo 'Body :<br />';
422                         echo "<tex tarea cols =\"50\" ro ws=\"10\"  class=\"no \" name=\" $param_nam e\">". htm lspecialch ars($param _value) ." </textarea >";   421                         echo "<tex tarea cols =\"50\" ro ws=\"10\"  class=\"no \" name=\" $param_nam e\">". htm lspecialch ars($param _value) ." </textarea >";
423     422  
424                         $tags = '< RealName>  <SiteName>  <ConfCode > <Confirm ationLink>  <StrID> < Email> <Pa ssword>     <YourReal Name> <Nic kName>   423                         $tags = '< RealName>  <SiteName>  <ConfCode > <Confirm ationLink>  <StrID> < Email> <Pa ssword>     <YourReal Name> <Nic kName>
425                             <Domai n> <ID> <T EXT> <VKis sLink> <Co ntactInfo>  <DomainNa me> <FromN ame> <Link > <NickSpa mer> <IDsp amer>   424                             <Domai n> <ID> <T EXT> <VKis sLink> <Co ntactInfo>  <DomainNa me> <FromN ame> <Link > <NickSpa mer> <IDsp amer>
426                             <LinkS pamer> <Ma tchProfile Link>    < Requester>  <Profile>  <site> <P rivPhotosM ember> <Lo ginLink> < Title>   425                             <LinkS pamer> <Ma tchProfile Link>    < Requester>  <Profile>  <site> <P rivPhotosM ember> <Lo ginLink> < Title>
427                             <Messa ge_Text> < MessageTex t> <LinkSD atingEvent > <NameSDa ting> <Pla ceSDating>  <WhenStar SDating> < PersonalUI D>   426                             <Messa ge_Text> < MessageTex t> <LinkSD atingEvent > <NameSDa ting> <Pla ceSDating>  <WhenStar SDating> < PersonalUI D>
428                             <Match Link>';   427                             <Match Link>';
429                         echo '<br> <br><br><b >Text vers ion</b><br >';   428                         echo '<br> <br><br><b >Text vers ion</b><br >';
430                         echo 'Subj ect:<br /> ';   429                         echo 'Subj ect:<br /> ';
431                         echo "<inp ut readonl y type=\"t ext\" clas s=\"no\" s ize=\"50\"  name=\"{$ param_name }_subject_ ro\" value =\"$subjec t_value\"/ ><br /><br  />";   430                         echo "<inp ut readonl y type=\"t ext\" clas s=\"no\" s ize=\"50\"  name=\"{$ param_name }_subject_ ro\" value =\"$subjec t_value\"/ ><br /><br  />";
432                         echo 'Body :<br />';   431                         echo 'Body :<br />';
433                         echo "<tex tarea read only cols= \"50\" row s=\"10\" c lass=\"no\ " name=\"{ $param_nam e}_ro\">".  htmlspeci alchars(ht ml2txt($pa ram_value,  $tags)) . "</textare a>";   432                         echo "<tex tarea read only cols= \"50\" row s=\"10\" c lass=\"no\ " name=\"{ $param_nam e}_ro\">".  htmlspeci alchars(ht ml2txt($pa ram_value,  $tags)) . "</textare a>";
434                    }   433                    }
435                    else   434                    else
436                    {   435                    {
437                         echo "<tex tarea cols =\"50\" ro ws=\"10\"  class=\"no \" name=\" $param_nam e\">$param _value</te xtarea>";   436                         echo "<tex tarea cols =\"50\" ro ws=\"10\"  class=\"no \" name=\" $param_nam e\">$param _value</te xtarea>";
438                    }   437                    }
439                }   438                }
440                elseif ( 'digit' ==  $param_ty pe)   439                elseif ( 'digit' ==  $param_ty pe)
441                {   440                {
442                    echo  "<input t ype=\"text \" class=\ "no\" name =\"$param_ name\" siz e=\"15\" v alue=\"$pa ram_value\ " />";   441                    echo  "<input t ype=\"text \" class=\ "no\" name =\"$param_ name\" siz e=\"15\" v alue=\"$pa ram_value\ " />";
443                }   442                }
444                elseif ( 'checkbox'  == $param _type)   443                elseif ( 'checkbox'  == $param _type)
445                {   444                {
446                    echo  "<input t ype=\"chec kbox\" nam e=\"$param _name\" ". ('on' == $ param_valu e ? 'check ed' : ''). '>';   445                    echo  "<input t ype=\"chec kbox\" nam e=\"$param _name\" ". ('on' == $ param_valu e ? 'check ed' : ''). '>';
447                }   446                }
448                elseif ( 'select' = = $param_t ype)   447                elseif ( 'select' = = $param_t ype)
449                {   448                {
450                    echo  "&nbsp;";   449                    echo  "&nbsp;";
451                }   450                }
452                elseif ( 'combobox'  == $param _type)   451                elseif ( 'combobox'  == $param _type)
453                {   452                {
454                    $old _val = get Param('tem plate');   453                    $old _val = get Param('tem plate');
455                    $tem pl_choices  = get_tem plates_arr ay();   454                    $tem pl_choices  = get_tem plates_arr ay();
456     455  
457                    echo  "<select  name=\"$pa ram_name\" >";   456                    echo  "<select  name=\"$pa ram_name\" >";
458                    fore ach ( $tem pl_choices  as $key = > $value )   457                    fore ach ( $tem pl_choices  as $key = > $value )
459                    {   458                    {
460                         echo "<opt ion value= \"{$key}\"  ". ($old_ val == $ke y ? 'selec ted="selec ted"' : '' ) .">{$val ue}</optio n>\n";   459                         echo "<opt ion value= \"{$key}\"  ". ($old_ val == $ke y ? 'selec ted="selec ted"' : '' ) .">{$val ue}</optio n>\n";
461                    }   460                    }
462                    echo  "</select >";   461                    echo  "</select >";
463                }   462                }
464                else   463                else
465                {   464                {
466                    echo  "<input t ype=\"text \" name=\" $param_nam e\" value= \"$param_v alue\" siz e=\"30\" / >";   465                    echo  "<input t ype=\"text \" name=\" $param_nam e\" value= \"$param_v alue\" siz e=\"30\" / >";
467                }   466                }
468                echo "</ td></tr>";   467                echo "</ td></tr>";
469           }   468           }
470           ?>   469           ?>
471       </tabl e>   470       </tabl e>
472       </cent er><br />   471       </cent er><br />
473       <?php   472       <?php
474          473       
475       return  ' ';   474       return  ' ';
476   }   475   }
477     476  
478   /**   477   /**
479    * Display  error mes sages.   478    * Display  error mes sages.
480    * @global  $erros --  An array  of param n ames with  invalid va lues.   479    * @global  $erros --  An array  of param n ames with  invalid va lues.
481    * @retval  -- HTML f ormatted e rror messa ges.   480    * @retval  -- HTML f ormatted e rror messa ges.
482    */   481    */
483   function g et_error_m essages()   482   function g et_error_m essages()
484   {   483   {
485       global  $errors;   484       global  $errors;
486       // Ite rate thru  param name s.   485       // Ite rate thru  param name s.
487       foreac h ($errors  as $key = > $val)   486       foreac h ($errors  as $key = > $val)
488       {   487       {
489           if  (1 == $va l)   488           if  (1 == $va l)
490           {   489           {
491                // Get e rror messa ge.   490                // Get e rror messa ge.
492                $q_str =  "SELECT ` desc`, `er r_text` FR OM `GlPara ms` WHERE  `Name`='$k ey'";   491                $q_str =  "SELECT ` desc`, `er r_text` FR OM `GlPara ms` WHERE  `Name`='$k ey'";
493                $row = d b_arr($q_s tr);   492                $row = d b_arr($q_s tr);
494                //   493                //
495                $err_tex t .= "<div  class=\"e rr\">$row[ desc]: $ro w[err_text ]</div><br  />";   494                $err_tex t .= "<div  class=\"e rr\">$row[ desc]: $ro w[err_text ]</div><br  />";
496           }   495           }
497       }   496       }
498       return  $err_text ;   497       return  $err_text ;
499   }   498   }
500     499  
501   /**   500   /**
502    * Save ad ministrato r password  into data base.   501    * Save ad ministrato r password  into data base.
503    * The fun ction chec ks if the  newly ente red passwo rd confirm ed correct ly,   502    * The fun ction chec ks if the  newly ente red passwo rd confirm ed correct ly,
504    * if the  new passwo rd is of a llowable l ength.   503    * if the  new passwo rd is of a llowable l ength.
505    * In case  all the c onditions  are met th e new pass word is wr itten to t he databas e.   504    * In case  all the c onditions  are met th e new pass word is wr itten to t he databas e.
506    * @param  admin_name  -- Admini strator na me (there  can be man y admins).   505    * @param  admin_name  -- Admini strator na me (there  can be man y admins).
507    * @param  $pwd_old - - Old pass word.   506    * @param  $pwd_old - - Old pass word.
508    * @param  $pwd_new - - New pass word.   507    * @param  $pwd_new - - New pass word.
509    * @param  $pwd_new_c onfirm --  New passwo rd confirm ation.   508    * @param  $pwd_new_c onfirm --  New passwo rd confirm ation.
510    * @retval  Returns 0  in case o f success,  otherwise  returns e rror code:   509    * @retval  Returns 0  in case o f success,  otherwise  returns e rror code:
511    * E_INVAL ID_OLD_PAS SWORD -- I n case of  wrong old  password,   510    * E_INVAL ID_OLD_PAS SWORD -- I n case of  wrong old  password,
512    * E_PASSW ORD_CONFIR MATION_FAI LED -- In  case $new_ pwd and $n ew_pwd_con firm are n ot equal,   511    * E_PASSW ORD_CONFIR MATION_FAI LED -- In  case $new_ pwd and $n ew_pwd_con firm are n ot equal,
513    * E_INVAL ID_PASSWOR D_LENGTH - - In case  password i s too shor t, or too  long.   512    * E_INVAL ID_PASSWOR D_LENGTH - - In case  password i s too shor t, or too  long.
514    */   513    */
515   function s ave_admin_ password($ admin_name , $pwd_old , $pwd_new , $pwd_new _confirm)   514   function s ave_admin_ password($ admin_name , $pwd_old , $pwd_new , $pwd_new _confirm)
516   {   515   {
517       // Get  previous  admin pass word from  database.   516       // Get  previous  admin pass word from  database.
518       $q_str  = "SELECT  Password  FROM Admin s WHERE Na me = '$adm in_name'";   517       $q_str  = "SELECT  Password  FROM Admin s WHERE Na me = '$adm in_name'";
519       $row =  db_arr($q _str);   518       $row =  db_arr($q _str);
520       // Che ck passwor d and save  it if che ck conditi ons are me t.   519       // Che ck passwor d and save  it if che ck conditi ons are me t.
521       if ($r ow['Passwo rd'] != md 5($pwd_old )) // Chec k old pass word   520       if ($r ow['Passwo rd'] != md 5($pwd_old )) // Chec k old pass word
522       {   521       {
523           $r esult = E_ INVALID_OL D_PASSWORD ;   522           $r esult = E_ INVALID_OL D_PASSWORD ;
524       }   523       }
525       else i f (strlen( $pwd_new)  > 10 || st rlen($pwd_ new) < 3)  // Check p assword le ngth.   524       else i f (strlen( $pwd_new)  > 10 || st rlen($pwd_ new) < 3)  // Check p assword le ngth.
526       {   525       {
527           $r esult = E_ INVALID_PA SSWORD_LEN GTH;   526           $r esult = E_ INVALID_PA SSWORD_LEN GTH;
528       }   527       }
529       else i f ($pwd_ne w != $pwd_ new_confir m) // Chec k if passw ord confir med correc tly.   528       else i f ($pwd_ne w != $pwd_ new_confir m) // Chec k if passw ord confir med correc tly.
530       {   529       {
531           $r esult = E_ PASSWORD_C ONFIRMATIO N_FAILED;   530           $r esult = E_ PASSWORD_C ONFIRMATIO N_FAILED;
532       }   531       }
533       else / / no error s, save ne w password   532       else / / no error s, save ne w password
534       {   533       {
535           //  Write new  password  to databas e.   534           //  Write new  password  to databas e.
536           $q _str = "UP DATE Admin s SET Pass word = md5 ('$pwd_new ') WHERE N ame = '$ad min_name'" ;   535           $q _str = "UP DATE Admin s SET Pass word = md5 ('$pwd_new ') WHERE N ame = '$ad min_name'" ;
537           my sql_query( $q_str);   536           my sql_query( $q_str);
538           $r esult = S_ OK;   537           $r esult = S_ OK;
539       }   538       }
540       return  $result;   539       return  $result;
541   }   540   }
542     541  
543   /**   542   /**
544    * Save ch anges for  certain ca tegory of  global set tings.   543    * Save ch anges for  certain ca tegory of  global set tings.
545    * @param  $cat -- Ca tegory to  save.   544    * @param  $cat -- Ca tegory to  save.
546    * @global  $errors - - an array  of param  names with  invalid v alues.   545    * @global  $errors - - an array  of param  names with  invalid v alues.
547    * @global  $_POST --  an array  of param n ames and v alues.   546    * @global  $_POST --  an array  of param n ames and v alues.
548    */   547    */
549   function s ave_settin gs($cat)   548   function s ave_settin gs($cat)
550   {   549   {
551       global  $dir;    
552     550       
553       assert (strlen($c at) > 0);   551       assert (strlen($c at) > 0);
554       assert ((int)$cat  > 0);   552       assert ((int)$cat  > 0);
555     553  
556       global  $errors;   554       global  $errors;
557     555  
558       // Get  checking  conditions  and error  messages  for every  item in th e category .   556       // Get  checking  conditions  and error  messages  for every  item in th e category .
559       $q_str  = "SELECT  `Name`, ` check` FRO M `GlParam s` WHERE ` kateg` = $ cat";   557       $q_str  = "SELECT  `Name`, ` check` FRO M `GlParam s` WHERE ` kateg` = $ cat";
560       $res =  db_res($q _str);   558       $res =  db_res($q _str);
561     559  
562     560  
563       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'Variabl es'";   561       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'Variabl es'";
564       $vid =  db_arr($q _str);   562       $vid =  db_arr($q _str);
565       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'Profile s'";   563       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'Profile s'";
566       $pid =  db_arr($q _str);   564       $pid =  db_arr($q _str);
567       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'SpeedDa ting'";   565       $q_str  = "SELECT  `ID` FROM  `GlParams Kateg` WHE RE `name`  = 'SpeedDa ting'";
568       $sid =  db_arr($q _str);   566       $sid =  db_arr($q _str);
569       $mid =  23;   567       $mid =  23;
570     568  
571       // Ite rate thru  items and  check if v alues ente red are va lid.   569       // Ite rate thru  items and  check if v alues ente red are va lid.
572       while  ($row = my sql_fetch_ array($res ))   570       while  ($row = my sql_fetch_ array($res ))
573       {   571       {
574           $p aram_name  = $row['Na me'];   572           $p aram_name  = $row['Na me'];
575           $c hecked = T RUE;   573           $c hecked = T RUE;
576           //  Generate  function o ut of chec k conditio n (if the  one is not  empty).   574           //  Generate  function o ut of chec k conditio n (if the  one is not  empty).
577           $f _body = $r ow['check' ]; // Get  function b ody.   575           $f _body = $r ow['check' ]; // Get  function b ody.
578           if  ( strlen( $f_body) >  0 )   576           if  ( strlen( $f_body) >  0 )
579           {   577           {
580                $check_f unc = crea te_functio n('$arg0',  $f_body);   578                $check_f unc = crea te_functio n('$arg0',  $f_body);
581                $checked  = FALSE;   579                $checked  = FALSE;
582           }   580           }
583           //  Get new v alue.   581           //  Get new v alue.
584           //  Then chec k if the v alue is va lid.  If i t is then  save it,   582           //  Then chec k if the v alue is va lid.  If i t is then  save it,
585           //  otherwise  generate  error mess age.   583           //  otherwise  generate  error mess age.
586                $param_v alue = $_P OST[$param _name];   584                $param_v alue = $_P OST[$param _name];
587                if ( is_ array( $pa ram_value  ) ) $param _value = i mplode( ', ', $param_ value );   585                if ( is_ array( $pa ram_value  ) ) $param _value = i mplode( ', ', $param_ value );
588           if  ($checked  || $check _func($par am_value))   586           if  ($checked  || $check _func($par am_value))
589           {   587           {
590                // Save  parameter   588                // Save  parameter
591                setParam ($param_na me, $param _value);   589                setParam ($param_na me, $param _value);
592                // updat e header f ile   590                // updat e header f ile
593                /**   591                /**
594                 * Rewri te global  vars at pa rams.inc.p hp from Va riables Ca tegory   592                 * Rewri te global  vars at pa rams.inc.p hp from Va riables Ca tegory
595                 * $vid[ 'ID']   -  ID of Vari ables Cate gory   593                 * $vid[ 'ID']   -  ID of Vari ables Cate gory
596                 * $cat          -  ID of Cate gory that  currently  under chan ges   594                 * $cat          -  ID of Cate gory that  currently  under chan ges
597                 *   595                 *
598                 */   596                 */
599                if ( $vi d['ID'] ==  $cat )   597                if ( $vi d['ID'] ==  $cat )
600                {   598                {
601                    if (  $param_va lue == 'on ' ) $vval  = 1;   599                    if (  $param_va lue == 'on ' ) $vval  = 1;
602                    else if ( $para m_value ==  '' ) $vva l = 0;   600                    else if ( $para m_value ==  '' ) $vva l = 0;
603                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;   601                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;
604                    else  $vval = $ param_valu e;   602                    else  $vval = $ param_valu e;
605     603  
606                    swit ch ( $para m_name )   604                    swit ch ( $para m_name )
607                    {   605                    {
608                    case  'currency _sign': $v target = ' $doll';   606                    case  'currency _sign': $v target = ' $doll';
609                         break;   607                         break;
610                    case  'profile_ pic_num':  $vtarget =  '$pic_num ';   608                    case  'profile_ pic_num':  $vtarget =  '$pic_num ';
611                         break;   609                         break;
612                    case  'enable_z ip_loc': $ vtarget =  '$en_ziplo c';   610                    case  'enable_z ip_loc': $ vtarget =  '$en_ziplo c';
613                         break;   611                         break;
614                    case  'enable_a ff': $vtar get = '$en _aff';   612                    case  'enable_a ff': $vtar get = '$en _aff';
615                         break;   613                         break;
616                    case  'enable_i nbox_notif y': $vtarg et = '$en_ inbox_noti fy';   614                    case  'enable_i nbox_notif y': $vtarg et = '$en_ inbox_noti fy';
617                         break;   615                         break;
618                    case  'enable_d ir': $vtar get = '$en _dir';   616                    case  'enable_d ir': $vtar get = '$en _dir';
619                         break;   617                         break;
620                    case  'vote_pic _max': $vt arget = '$ max_voting _mark';   618                    case  'vote_pic _max': $vt arget = '$ max_voting _mark';
621                         break;   619                         break;
622                    case  'template ': $vtarge t = '$tmpl ';   620                    case  'template ': $vtarge t = '$tmpl ';
623                         break;   621                         break;
624                    case  'friendli st': $vtar get = '$en able_frien dlist';   622                    case  'friendli st': $vtar get = '$en able_frien dlist';
625                         break;   623                         break;
626                    case  'enable_t humb': $vt arget = '$ enable_aut o_thumbnai l';   624                    case  'enable_t humb': $vt arget = '$ enable_aut o_thumbnai l';
627                         break;   625                         break;
628                    case  'date_for mat': $vta rget = '$d ate_format ';   626                    case  'date_for mat': $vta rget = '$d ate_format ';
629                         break;   627                         break;
630                    case  'short_da te_format' : $vtarget  = '$short _date_form at';   628                    case  'short_da te_format' : $vtarget  = '$short _date_form at';
631                         break;   629                         break;
632                    defa ult: $vtar get = "";   630                    defa ult: $vtar get = "";
633                    brea k;   631                    brea k;
634                    }   632                    }
635     633  
636                    if (  $vtarget  )   634                    if (  $vtarget  )
637                         Replace_Va rs( BX_DIR ECTORY_PAT H_INC . 'p arams.inc. php', $vta rget, " =  $vval;");   635                         Replace_Va rs( BX_DIR ECTORY_PAT H_INC . 'p arams.inc. php', $vta rget, " =  $vval;");
638                }   636                }
639                elseif (  $pid['ID' ] == $cat  )   637                elseif (  $pid['ID' ] == $cat  )
640                {   638                {
641                    /**   639                    /**
642                     * R ewrite glo bal vars a t params.i nc.php fro m Profiles  Category   640                     * R ewrite glo bal vars a t params.i nc.php fro m Profiles  Category
643                     * $ pid['ID']    - ID of  Profiles C ategory   641                     * $ pid['ID']    - ID of  Profiles C ategory
644                     * $ cat          - ID of  Category t hat curren tly under  changes   642                     * $ cat          - ID of  Category t hat curren tly under  changes
645                     *   643                     *
646                     */   644                     */
647                       645                    
648                    if (  $param_va lue == 'on ' ) $vval  = 1;   646                    if (  $param_va lue == 'on ' ) $vval  = 1;
649                    else if ( $para m_value ==  '' ) $vva l = 0;   647                    else if ( $para m_value ==  '' ) $vva l = 0;
650                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;   648                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;
651                    else  $vval = $ param_valu e;   649                    else  $vval = $ param_valu e;
652                    swit ch ( $para m_name )   650                    swit ch ( $para m_name )
653                    {   651                    {
654                         case 'thum b_width':  $vtarget =  '$max_thu mb_width';   652                         case 'thum b_width':  $vtarget =  '$max_thu mb_width';
655                             break;   653                             break;
656                         case 'thum b_height':  $vtarget  = '$max_th umb_height ';   654                         case 'thum b_height':  $vtarget  = '$max_th umb_height ';
657                             break;   655                             break;
658                         case 'sear ch_start_a ge': $vtar get = '$se arch_start _age';   656                         case 'sear ch_start_a ge': $vtar get = '$se arch_start _age';
659                             break;   657                             break;
660                         case 'sear ch_end_age ': $vtarge t = '$sear ch_end_age ';   658                         case 'sear ch_end_age ': $vtarge t = '$sear ch_end_age ';
661                             break;   659                             break;
662                         case 'pic_ width': $v target = ' $max_photo _width';   660                         case 'pic_ width': $v target = ' $max_photo _width';
663                             break;   661                             break;
664                         case 'pic_ height': $ vtarget =  '$max_phot o_height';   662                         case 'pic_ height': $ vtarget =  '$max_phot o_height';
665                             break;   663                             break;
666                         case 'trac k_profile_ view': $vt arget = '$ track_prof ile_view';   664                         case 'trac k_profile_ view': $vt arget = '$ track_prof ile_view';
667                             break;   665                             break;
668                         case 'vote s': $vtarg et = '$vot es';   666                         case 'vote s': $vtarg et = '$vot es';
669                             break;   667                             break;
670                         case 'vote s_pic': $v target = ' $votes_pic ';   668                         case 'vote s_pic': $v target = ' $votes_pic ';
671                             break;   669                             break;
672                         case 'anon _mode': $v target = ' $anon_mode ';   670                         case 'anon _mode': $v target = ' $anon_mode ';
673                             break;   671                             break;
674                         case 'zodi ac': $vtar get = '$en able_zodia c';   672                         case 'zodi ac': $vtar get = '$en able_zodia c';
675                             break;   673                             break;
676                         case 'newu sernotify' : $vtarget  = '$newus ernotify';   674                         case 'newu sernotify' : $vtarget  = '$newus ernotify';
677                             break;   675                             break;
678                         case 'blog _step': $v target = ' $blog_step ';   676                         case 'blog _step': $v target = ' $blog_step ';
679                             break;   677                             break;
680                         case 'enab le_blog':  $vtarget =  '$enable_ blog';   678                         case 'enab le_blog':  $vtarget =  '$enable_ blog';
681                             break;   679                             break;
682                         default: $ vtarget =  "";   680                         default: $ vtarget =  "";
683                         break;   681                         break;
684                    }   682                    }
685     683  
686                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;   684                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;
687                }   685                }
688                elseif (  $sid['ID' ] == $cat  )   686                elseif (  $sid['ID' ] == $cat  )
689                {   687                {
690                    /**   688                    /**
691                     * R ewrite glo bal vars a t params.i nc.php fro m SpeedDat ing Catego ry   689                     * R ewrite glo bal vars a t params.i nc.php fro m SpeedDat ing Catego ry
692                     * $ pid['ID']    - ID of  SpeedDatin g Category   690                     * $ pid['ID']    - ID of  SpeedDatin g Category
693                     * $ cat          - ID of  Category t hat curren tly under  changes   691                     * $ cat          - ID of  Category t hat curren tly under  changes
694                     *   692                     *
695                     */   693                     */
696     694  
697                    if (  $param_va lue == 'on ' ) $vval  = 1;   695                    if (  $param_va lue == 'on ' ) $vval  = 1;
698                    else if ( $para m_value ==  '' ) $vva l = 0;   696                    else if ( $para m_value ==  '' ) $vva l = 0;
699                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;   697                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;
700                    else  $vval = $ param_valu e;   698                    else  $vval = $ param_valu e;
701                    swit ch ( $para m_name )   699                    swit ch ( $para m_name )
702                    {   700                    {
703                         default: $ vtarget =  "";   701                         default: $ vtarget =  "";
704                         break;   702                         break;
705                    }   703                    }
706     704  
707                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;   705                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;
708                }   706                }
709                elseif(  $mid == $c at )   707                elseif(  $mid == $c at )
710                {   708                {
711                    if (  $param_va lue == 'on ' ) $vval  = 1;   709                    if (  $param_va lue == 'on ' ) $vval  = 1;
712                    else if ( $para m_value ==  '' ) $vva l = 0;   710                    else if ( $para m_value ==  '' ) $vva l = 0;
713                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;   711                    else if ( !preg _match ("/ ^\d+$/i",  $param_val ue) ) $vva l = "'$par am_value'" ;
714                    else  $vval = $ param_valu e;   712                    else  $vval = $ param_valu e;
715                    /*   713                    /*
716                    echo  '<hr>';   714                    echo  '<hr>';
717                         echo '[' .  $param_na me . '] =>  ' . $vval ;   715                         echo '[' .  $param_na me . '] =>  ' . $vval ;
718                    echo  '<hr>';   716                    echo  '<hr>';
719                    */   717                    */
720                    swit ch ( $para m_name )   718                    swit ch ( $para m_name )
721                    {   719                    {
722                         case 'max_ voting_mar k':   720                         case 'max_ voting_mar k':
723                             $vtarg et = '$max _voting_ma rk';   721                             $vtarg et = '$max _voting_ma rk';
724                         break;   722                         break;
725                         case 'min_ voting_mar k':   723                         case 'min_ voting_mar k':
726                             $vtarg et = '$min _voting_ma rk';   724                             $vtarg et = '$min _voting_ma rk';
727                         break;   725                         break;
728                         case 'max_ voting_per iod':   726                         case 'max_ voting_per iod':
729                             $vtarg et = '$max _voting_pe riod';   727                             $vtarg et = '$max _voting_pe riod';
730                         break;   728                         break;
731                         case 'max_ icon_width ':   729                         case 'max_ icon_width ':
732                             $vtarg et = '$max _icon_widt h';   730                             $vtarg et = '$max _icon_widt h';
733                         break;   731                         break;
734                         case 'max_ icon_heigh t':   732                         case 'max_ icon_heigh t':
735                             $vtarg et = '$max _icon_heig ht';   733                             $vtarg et = '$max _icon_heig ht';
736                         break;   734                         break;
737                         case 'max_ thumb_widt h':   735                         case 'max_ thumb_widt h':
738                             $vtarg et = '$max _thumb_wid th';   736                             $vtarg et = '$max _thumb_wid th';
739                         break;   737                         break;
740                         case 'max_ thumb_heig ht':   738                         case 'max_ thumb_heig ht':
741                             $vtarg et = '$max _thumb_hei ght';   739                             $vtarg et = '$max _thumb_hei ght';
742                         break;   740                         break;
743                         case 'max_ photo_widt h':   741                         case 'max_ photo_widt h':
744                             $vtarg et = '$max _photo_wid th';   742                             $vtarg et = '$max _photo_wid th';
745                         break;   743                         break;
746                         case 'max_ photo_heig ht':   744                         case 'max_ photo_heig ht':
747                             $vtarg et = '$max _photo_hei ght';   745                             $vtarg et = '$max _photo_hei ght';
748                         break;   746                         break;
749                         case 'max_ photo_file s':   747                         case 'max_ photo_file s':
750                             $vtarg et = '$max _photo_fil es';   748                             $vtarg et = '$max _photo_fil es';
751                         break;   749                         break;
752                         case 'max_ photo_size ':   750                         case 'max_ photo_size ':
753                             $vtarg et = '$max _photo_siz e';   751                             $vtarg et = '$max _photo_siz e';
754                         break;   752                         break;
755                         case 'max_ media_titl e':   753                         case 'max_ media_titl e':
756                             $vtarg et = '$max _media_tit le';   754                             $vtarg et = '$max _media_tit le';
757                         break;   755                         break;
758                         case 'min_ media_titl e':   756                         case 'min_ media_titl e':
759                             $vtarg et = '$min _media_tit le';   757                             $vtarg et = '$min _media_tit le';
760                         break;   758                         break;
761                         default: $ vtarget =  '';   759                         default: $ vtarget =  '';
762                         break;   760                         break;
763                    }   761                    }
764     762  
765                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;   763                    if (  $vtarget  ) Replace_ Vars( BX_D IRECTORY_P ATH_INC .  'params.in c.php', $v target, "  = $vval;") ;
766                }   764                }
767     765  
768           }   766           }
769           el se   767           el se
770           {   768           {
771                $errors[ $param_nam e] = 1;   769                $errors[ $param_nam e] = 1;
772           }   770           }
773       } // w hile   771       } // w hile
774   }   772   }
775     773  
776   /**   774   /**
777    * Save al l settings .   775    * Save al l settings .
778    * The fun ction gets  a list of  all setti ng categor ies from d atabase, i terates th ru them,   776    * The fun ction gets  a list of  all setti ng categor ies from d atabase, i terates th ru them,
779    * and sav es changes  for every  category.   777    * and sav es changes  for every  category.
780    */   778    */
781   function s ave_settin gs_all()   779   function s ave_settin gs_all()
782   {   780   {
783       // Get  a list of  categorie s.   781       // Get  a list of  categorie s.
784       $q_str  = 'SELECT  `ID` FROM  `GlParams Kateg` WHE RE `ID` <>  '. WATERM ARK_CATEGO RY;   782       $q_str  = 'SELECT  `ID` FROM  `GlParams Kateg` WHE RE `ID` <>  '. WATERM ARK_CATEGO RY;
785       $res =  db_res($q _str);   783       $res =  db_res($q _str);
786       // Ite rate thru  categories .   784       // Ite rate thru  categories .
787       while  ($row = my sql_fetch_ array($res ))   785       while  ($row = my sql_fetch_ array($res ))
788           sa ve_setting s($row['ID ']);   786           sa ve_setting s($row['ID ']);
789   }   787   }
790     788  
791   /**   789   /**
792    * Upload  WaterMark.   790    * Upload  WaterMark.
793    */   791    */
794   function s ave_water_ mark()   792   function s ave_water_ mark()
795   {   793   {
796       global  $dir;   794       global  $dir;
797     795  
798     796  
799       $gl_pi c['pic'][' width'] =  getParam(  'max_photo _width' );   797       $gl_pi c['pic'][' width'] =  getParam(  'max_photo _width' );
800       $gl_pi c['pic'][' height'] =  getParam(  'max_phot o_height'  );   798       $gl_pi c['pic'][' height'] =  getParam(  'max_phot o_height'  );
801          799       
802       $scan  = getimage size( $_FI LES['file_ watermark' ]['tmp_nam e'] );   800       $scan  = getimage size( $_FI LES['file_ watermark' ]['tmp_nam e'] );
803     801  
804       if ( $ scan && (  1 == $scan [2] || 2 = = $scan[2]  || 3 == $ scan[2] ||  6 == $sca n[2] ) )   802       if ( $ scan && (  1 == $scan [2] || 2 = = $scan[2]  || 3 == $ scan[2] ||  6 == $sca n[2] ) )
805       {   803       {
806           $u ploadfile  = $dir['tm p'] . $_FI LES['file_ watermark' ]['name'];   804           $u ploadfile  = $dir['tm p'] . $_FI LES['file_ watermark' ]['name'];
807           $t argetfile  = $dir['pr ofileImage '] . $_FIL ES['file_w atermark'] ['name'];   805           $t argetfile  = $dir['pr ofileImage '] . $_FIL ES['file_w atermark'] ['name'];
808           if  ( move_up loaded_fil e($_FILES[ 'file_wate rmark']['t mp_name'],  $uploadfi le) )   806           if  ( move_up loaded_fil e($_FILES[ 'file_wate rmark']['t mp_name'],  $uploadfi le) )
809           {   807           {
810                $query =  "UPDATE ` GlParams`  SET  `VALU E` ='". ad dslashes($ _FILES['fi le_waterma rk']['name ']) ."' WH ERE `Name`  = 'Water_ Mark'";   808                $query =  "UPDATE ` GlParams`  SET  `VALU E` ='". ad dslashes($ _FILES['fi le_waterma rk']['name ']) ."' WH ERE `Name`  = 'Water_ Mark'";
811                db_res($ query);   809                db_res($ query);
812                imageRes ize( $uplo adfile, $t argetfile,  $gl_pic[' pic']['wid th'], $gl_ pic['pic'] ['height']  );   810                imageRes ize( $uplo adfile, $t argetfile,  $gl_pic[' pic']['wid th'], $gl_ pic['pic'] ['height']  );
813                unlink(  $uploadfil e );   811                unlink(  $uploadfil e );
814                @chmod($ targetfile , 0644);   812                @chmod($ targetfile , 0644);
815           }   813           }
816       }   814       }
817     815  
818       $query  = "UPDATE  `GlParams ` SET `VAL UE` ='". ( int)$_POST ['transp1' ] ."' WHER E `Name` =  'transpar ent1'";   816       $query  = "UPDATE  `GlParams ` SET `VAL UE` ='". ( int)$_POST ['transp1' ] ."' WHER E `Name` =  'transpar ent1'";
819       db_res ($query);   817       db_res ($query);
820       $query  = "UPDATE  `GlParams ` SET `VAL UE` ='". p rocess_db_ input($_PO ST['enable _wm']) ."'  WHERE `Na me` = 'ena ble_waterm ark'";   818       $query  = "UPDATE  `GlParams ` SET `VAL UE` ='". p rocess_db_ input($_PO ST['enable _wm']) ."'  WHERE `Na me` = 'ena ble_waterm ark'";
821       db_res ($query);   819       db_res ($query);
822       ?>   820       ?>
823       <div c lass="succ ">Watermar k settings  saved.</d iv><br />   821       <div c lass="succ ">Watermar k settings  saved.</d iv><br />
824       <?php   822       <?php
825   }   823   }
826     824  
827   ?>   825   ?>