34. File Comparison Report

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

34.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc modules.inc.php Thu Mar 27 04:18:10 2008 UTC
2 Dolphin-v.6.1.3\inc modules.inc.php Wed Jul 16 09:51:20 2008 UTC

34.2 Comparison summary

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

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

34.4 Active regular expressions

No regular expressions were active.

34.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   require_on ce("member ship_level s.inc.php" );   24   require_on ce("member ship_level s.inc.php" );
25     25  
26   /**   26   /**
27   *   Prepar es strings  to be pas sed throug h command  line as ar guments   27   *   Prepar es strings  to be pas sed throug h command  line as ar guments
28   */   28   */
29   class CCom mandLineAr gs   29   class CCom mandLineAr gs
30   {   30   {
31       var $A rguments =  array();   31       var $A rguments =  array();
32     32  
33       /**   33       /**
34       *   Ad ds a new a rgument to  command l ine   34       *   Ad ds a new a rgument to  command l ine
35       *   35       *
36       *   @p aram strin g   $Argum ent Argume nt itself   36       *   @p aram strin g   $Argum ent Argume nt itself
37       */   37       */
38       functi on AddArgu ment($Argu ment)   38       functi on AddArgu ment($Argu ment)
39       {   39       {
40           $t his->Argum ents[] = ( string)$Ar gument;   40           $t his->Argum ents[] = ( string)$Ar gument;
41       }   41       }
42     42  
43       /**   43       /**
44       *   Re turns coun t of store d argument s   44       *   Re turns coun t of store d argument s
45       *   45       *
46       *   @r eturn int  Count of s tored argu ments   46       *   @r eturn int  Count of s tored argu ments
47       */   47       */
48       functi on Count()   48       functi on Count()
49       {   49       {
50           re turn count ($this->Ar guments);   50           re turn count ($this->Ar guments);
51       }   51       }
52     52  
53       /**   53       /**
54       *   Ma in method.  Returns c orrectly c onstructed  command l ine argume nts   54       *   Ma in method.  Returns c orrectly c onstructed  command l ine argume nts
55       *   55       *
56       *   @r eturn stri ng  Comman d line arg uments, re ady to be  passed   56       *   @r eturn stri ng  Comman d line arg uments, re ady to be  passed
57       */   57       */
58       functi on GetComm andLine()   58       functi on GetComm andLine()
59       {   59       {
60           $R esult = '' ;   60           $R esult = '' ;
61           fo reach ($th is->Argume nts as $Ar gument)   61           fo reach ($th is->Argume nts as $Ar gument)
62           {   62           {
63                if (preg _match('/[ "\s\\\\]/' , $Argumen t))   63                if (preg _match('/[ "\s\\\\]/' , $Argumen t))
64                {   64                {
65                    // R eplace  ["  -> \"] an d [\ -> \\ ] and encl ose result  in double  quotes   65                    // R eplace  ["  -> \"] an d [\ -> \\ ] and encl ose result  in double  quotes
66                    $Res ult .= '"' .str_repla ce(array(' \\', '"'),  array('\\ \\', '\\"' ), $Argume nt).'"';   66                    $Res ult .= '"' .str_repla ce(array(' \\', '"'),  array('\\ \\', '\\"' ), $Argume nt).'"';
67                }   67                }
68                elseif ( strlen(tri m($Argumen t)) <= 0)   68                elseif ( strlen(tri m($Argumen t)) <= 0)
69                {   69                {
70                    $Res ult .= '"" ';   70                    $Res ult .= '"" ';
71                }   71                }
72                else   72                else
73                {   73                {
74                    $Res ult .= $Ar gument;   74                    $Res ult .= $Ar gument;
75                }   75                }
76                $Result  .= ' ';   76                $Result  .= ' ';
77           }   77           }
78           re turn $Resu lt;   78           re turn $Resu lt;
79       }   79       }
80   }   80   }
81     81  
82   /**   82   /**
83   *   Calls  module fun ction, sto red in dat abase. Sup ports arbi trary numb er of modu le functio n paramete rs.   83   *   Calls  module fun ction, sto red in dat abase. Sup ports arbi trary numb er of modu le functio n paramete rs.
84   *   For in ternal use  only. Use  'modules_ xxx' funct ions inste ad.   84   *   For in ternal use  only. Use  'modules_ xxx' funct ions inste ad.
85   *   85   *
86   *   @param  string    $FuncName        Name  of module  function  (actually  name of co lumn of `M odules` ta ble)   86   *   @param  string    $FuncName        Name  of module  function  (actually  name of co lumn of `M odules` ta ble)
87   *   87   *
88   *   @param  string    $Parameter sDeclarati on      Pa rameters s ection of  function d eclaration  (see crea te_functio n)   88   *   @param  string    $Parameter sDeclarati on      Pa rameters s ection of  function d eclaration  (see crea te_functio n)
89   *   89   *
90   *   @param  array     $Parameter s     Para meters val ues, will  be passed  to module  function   90   *   @param  array     $Parameter s     Para meters val ues, will  be passed  to module  function
91   *   91   *
92   *   @param  string    $ModuleTyp e     If n ot equal t o empty st ring, only  specified  type of m odules wil l be proce ssed   92   *   @param  string    $ModuleTyp e     If n ot equal t o empty st ring, only  specified  type of m odules wil l be proce ssed
93   *   93   *
94   *   @param  string    $ModuleNam e     If n ot equal t o empty st ring, only  module wi th specifi ed name wi ll be proc essed,   94   *   @param  string    $ModuleNam e     If n ot equal t o empty st ring, only  module wi th specifi ed name wi ll be proc essed,
95   *                                      para meter $Mod uleType wi ll be igno red   95   *                                      para meter $Mod uleType wi ll be igno red
96   *   96   *
97   *   @param  out  &$Er rorMessage   Will con tain error  message i n case of  any error   97   *   @param  out  &$Er rorMessage   Will con tain error  message i n case of  any error
98   *   98   *
99   *   @retur n mixed    Number of  processed  modules or  returns f alse in ca se of any  error. &$E rrorMessag e will con tain   99   *   @retur n mixed    Number of  processed  modules or  returns f alse in ca se of any  error. &$E rrorMessag e will con tain
100   *                     error mess age, if fa lse is ret urned   100   *                     error mess age, if fa lse is ret urned
101   */   101   */
102   function C allModuleF unction($F uncName, $ Parameters Declaratio n, $Parame ters, $Mod uleType, $ ModuleName , &$ErrorM essage)   102   function C allModuleF unction($F uncName, $ Parameters Declaratio n, $Parame ters, $Mod uleType, $ ModuleName , &$ErrorM essage)
103   {   103   {
104       $FuncN ame = adds lashes($Fu ncName);   104       $FuncN ame = adds lashes($Fu ncName);
105       $Modul eType = ad dslashes($ ModuleType );   105       $Modul eType = ad dslashes($ ModuleType );
106       $Modul eName = ad dslashes($ ModuleName );   106       $Modul eName = ad dslashes($ ModuleName );
107     107  
108       if (!  is_array($ Parameters ))   108       if (!  is_array($ Parameters ))
109       {   109       {
110           $E rrorMessag e = "$Para meters is  not array" ;   110           $E rrorMessag e = "$Para meters is  not array" ;
111           re turn false ;   111           re turn false ;
112       }   112       }
113     113  
114       $Valid Identifier Pattern =  '/[a-zA-Z_ \x7f-\xff] [a-zA-Z0-9 _\x7f-\xff ]*/';   114       $Valid Identifier Pattern =  '/[a-zA-Z_ \x7f-\xff] [a-zA-Z0-9 _\x7f-\xff ]*/';
115       if (!  preg_match ($ValidIde ntifierPat tern, $Fun cName))   115       if (!  preg_match ($ValidIde ntifierPat tern, $Fun cName))
116       {   116       {
117           $E rrorMessag e = "\$Fun cName is n ot a valid  identifie r: '{$Func Name}'";   117           $E rrorMessag e = "\$Fun cName is n ot a valid  identifie r: '{$Func Name}'";
118           re turn false ;   118           re turn false ;
119       }   119       }
120     120  
121       // Che ck $Parame tersDeclar ation for  correctnes s   121       // Che ck $Parame tersDeclar ation for  correctnes s
122       $Valid Parameters Declaratio nPattern =  '/(?:^|,\ s*)(\$[a-z A-Z_\x7f-\ xff][a-zA- Z0-9_\x7f- \xff]*)\s* /'; // Set  of valid  identifier s, separat ed by comm as   122       $Valid Parameters Declaratio nPattern =  '/(?:^|,\ s*)(\$[a-z A-Z_\x7f-\ xff][a-zA- Z0-9_\x7f- \xff]*)\s* /'; // Set  of valid  identifier s, separat ed by comm as
123       $Dummy  = array() ;   123       $Dummy  = array() ;
124       $Decla redParamet ersCount =  preg_matc h_all($Val idParamete rsDeclarat ionPattern , $Paramet ersDeclara tion, $Dum my, PREG_P ATTERN_ORD ER);   124       $Decla redParamet ersCount =  preg_matc h_all($Val idParamete rsDeclarat ionPattern , $Paramet ersDeclara tion, $Dum my, PREG_P ATTERN_ORD ER);
125       if (!  $DeclaredP arametersC ount || $D eclaredPar ametersCou nt <> coun t($Paramet ers))   125       if (!  $DeclaredP arametersC ount || $D eclaredPar ametersCou nt <> coun t($Paramet ers))
126       {   126       {
127           $E rrorMessag e = "erron eous param eters' dec laration:  '$Paramete rsDeclarat ion'";   127           $E rrorMessag e = "erron eous param eters' dec laration:  '$Paramete rsDeclarat ion'";
128           re turn false ;   128           re turn false ;
129       }   129       }
130     130  
131       if (st rlen(trim( $ModuleNam e)) > 0)   131       if (st rlen(trim( $ModuleNam e)) > 0)
132           $W hereClause  = "`Name`  = '{$Modu leName}'";   132           $W hereClause  = "`Name`  = '{$Modu leName}'";
133       elseif  (strlen(t rim($Modul eType)) >  0)   133       elseif  (strlen(t rim($Modul eType)) >  0)
134           $W hereClause  = "`Type`  = '{$Modu leType}'";   134           $W hereClause  = "`Type`  = '{$Modu leType}'";
135       else   135       else
136           $W hereClause  = '';   136           $W hereClause  = '';
137     137  
138       $GetMo dulesQuery  = "SELECT  `Name`, ` {$FuncName }` FROM `M odules`";   138       $GetMo dulesQuery  = "SELECT  `Name`, ` {$FuncName }` FROM `M odules`";
139       if (st rlen(trim( $WhereClau se)) > 0)   139       if (st rlen(trim( $WhereClau se)) > 0)
140           $G etModulesQ uery .= '  WHERE '.$W hereClause ;   140           $G etModulesQ uery .= '  WHERE '.$W hereClause ;
141     141  
142       $ResMo dules = db _res($GetM odulesQuer y);   142       $ResMo dules = db _res($GetM odulesQuer y);
143     143  
144       while  ($ArrModul e = mysql_ fetch_arra y($ResModu les))   144       while  ($ArrModul e = mysql_ fetch_arra y($ResModu les))
145       {   145       {
146           $M oduleFunct ion = $Fun cName.'_'. $ArrModule ['Name'];   146           $M oduleFunct ion = $Fun cName.'_'. $ArrModule ['Name'];
147           gl obal $$Mod uleFunctio n;   147           gl obal $$Mod uleFunctio n;
148           if  (! isset( $$ModuleFu nction))   148           if  (! isset( $$ModuleFu nction))
149           {   149           {
150                $$Module Function =  create_fu nction($Pa rametersDe claration,  $ArrModul e[$FuncNam e]);   150                $$Module Function =  create_fu nction($Pa rametersDe claration,  $ArrModul e[$FuncNam e]);
151           }   151           }
152     152  
153           $F unctionCal lCode = '$ $ModuleFun ction(';   153           $F unctionCal lCode = '$ $ModuleFun ction(';
154           $P rocessedKe ysCount =  0;   154           $P rocessedKe ysCount =  0;
155           fo reach ($Pa rameters a s $Key =>  $Value)   155           fo reach ($Pa rameters a s $Key =>  $Value)
156           {   156           {
157                if (! is _int($Key) )   157                if (! is _int($Key) )
158                {   158                {
159                    $Key  = "'".$Ke y."'";   159                    $Key  = "'".$Ke y."'";
160                }   160                }
161                $Functio nCallCode  .= "\$Para meters[{$K ey}]";   161                $Functio nCallCode  .= "\$Para meters[{$K ey}]";
162                if ($Pro cessedKeys Count != c ount($Para meters) -  1)   162                if ($Pro cessedKeys Count != c ount($Para meters) -  1)
163                {   163                {
164                    $Fun ctionCallC ode .= ',  ';   164                    $Fun ctionCallC ode .= ',  ';
165                }   165                }
166                $Process edKeysCoun t++;   166                $Process edKeysCoun t++;
167           }   167           }
168           $F unctionCal lCode .= ' );';   168           $F unctionCal lCode .= ' );';
169     169  
170           ev al($Functi onCallCode );   170           ev al($Functi onCallCode );
171       }   171       }
172     172  
173       return  mysql_num _rows($Res Modules);   173       return  mysql_num _rows($Res Modules);
174   }   174   }
175     175  
176   /**   176   /**
177   *   Regist ers member  or admin  in modules   177   *   Regist ers member  or admin  in modules
178   *   178   *
179   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   179   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
180   *   180   *
181   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed   181   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed
182   *   182   *
183   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.   183   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.
184   *   184   *
185   *   @retur n int Coun t of proce ssed modul es   185   *   @retur n int Coun t of proce ssed modul es
186   */   186   */
187   function m odules_add ($ID, $Mod uleType =  '', $IsAdm in = 0)   187   function m odules_add ($ID, $Mod uleType =  '', $IsAdm in = 0)
188   {   188   {
189       if (st rlen(trim( $ID)) <= 0 )   189       if (st rlen(trim( $ID)) <= 0 )
190       {   190       {
191           mo dules_err( "modules_a dd(): inva lid user i dentifier  (\$ID = '{ $ID}', \$I sAdmin = ' {$IsAdmin} ')");   191           mo dules_err( "modules_a dd(): inva lid user i dentifier  (\$ID = '{ $ID}', \$I sAdmin = ' {$IsAdmin} ')");
192       }   192       }
193     193  
194       $Proce ssedModule sCount = C allModuleF unction('F uncAdd', ' $UserIdent ifier, $Is Admin', ar ray($ID, $ IsAdmin),   194       $Proce ssedModule sCount = C allModuleF unction('F uncAdd', ' $UserIdent ifier, $Is Admin', ar ray($ID, $ IsAdmin),
195           $M oduleType,  '', $Erro rMessage);   195           $M oduleType,  '', $Erro rMessage);
196     196  
197       if ($P rocessedMo dulesCount  === false )   197       if ($P rocessedMo dulesCount  === false )
198       {   198       {
199           mo dules_err( "modules_a dd() (Call ModuleFunc tion error ): ".$Erro rMessage);   199           mo dules_err( "modules_a dd() (Call ModuleFunc tion error ): ".$Erro rMessage);
200       }   200       }
201     201  
202       return  $Processe dModulesCo unt;   202       return  $Processe dModulesCo unt;
203   }   203   }
204     204  
205   /**   205   /**
206   *   Unregi sters memb er or admi n from mod ules   206   *   Unregi sters memb er or admi n from mod ules
207   *   207   *
208   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   208   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
209   *   209   *
210   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed   210   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed
211   *   211   *
212   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.   212   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.
213   *   213   *
214   *   @retur n int Coun t of proce ssed modul es   214   *   @retur n int Coun t of proce ssed modul es
215   */   215   */
216   function m odules_del ($ID, $Mod uleType =  '', $IsAdm in = 0)   216   function m odules_del ($ID, $Mod uleType =  '', $IsAdm in = 0)
217   {   217   {
218       if (st rlen(trim( $ID)) <= 0 )   218       if (st rlen(trim( $ID)) <= 0 )
219       {   219       {
220           mo dules_err( "modules_d el(): inva lid user i dentifier  (\$ID = '{ $ID}', \$I sAdmin = ' {$IsAdmin} ')");   220           mo dules_err( "modules_d el(): inva lid user i dentifier  (\$ID = '{ $ID}', \$I sAdmin = ' {$IsAdmin} ')");
221       }   221       }
222     222  
223       $Proce ssedModule sCount = C allModuleF unction('F uncDel', ' $UserIdent ifier, $Is Admin', ar ray($ID, $ IsAdmin),   223       $Proce ssedModule sCount = C allModuleF unction('F uncDel', ' $UserIdent ifier, $Is Admin', ar ray($ID, $ IsAdmin),
224           $M oduleType,  '', $Erro rMessage);   224           $M oduleType,  '', $Erro rMessage);
225     225  
226       if ($P rocessedMo dulesCount  === false )   226       if ($P rocessedMo dulesCount  === false )
227       {   227       {
228           mo dules_err( "modules_d el() (Call ModuleFunc tion error ): ".$Erro rMessage);   228           mo dules_err( "modules_d el() (Call ModuleFunc tion error ): ".$Erro rMessage);
229       }   229       }
230     230  
231       return  $Processe dModulesCo unt;   231       return  $Processe dModulesCo unt;
232   }   232   }
233     233  
234   /**   234   /**
235   *   Blocks  member to  use modul es   235   *   Blocks  member to  use modul es
236   *   236   *
237   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   237   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
238   *   238   *
239   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed   239   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed
240   *   240   *
241   *   @retur n int Coun t of proce ssed modul es   241   *   @retur n int Coun t of proce ssed modul es
242   */   242   */
243   function m odules_blo ck($ID, $M oduleType  = '')   243   function m odules_blo ck($ID, $M oduleType  = '')
244   {   244   {
245       if (!  (int)$ID)   245       if (!  (int)$ID)
246       {   246       {
247           mo dules_err( "modules_b lock(): in valid memb er ID (\$I D = '{$ID} ')");   247           mo dules_err( "modules_b lock(): in valid memb er ID (\$I D = '{$ID} ')");
248       }   248       }
249     249  
250       $Proce ssedModule sCount = C allModuleF unction('F uncBlock',  '$UserIde ntifier',  array($ID) , $ModuleT ype, '', $ ErrorMessa ge);   250       $Proce ssedModule sCount = C allModuleF unction('F uncBlock',  '$UserIde ntifier',  array($ID) , $ModuleT ype, '', $ ErrorMessa ge);
251     251  
252       if ($P rocessedMo dulesCount  === false )   252       if ($P rocessedMo dulesCount  === false )
253       {   253       {
254           mo dules_err( "modules_b lock() (Ca llModuleFu nction err or): ".$Er rorMessage );   254           mo dules_err( "modules_b lock() (Ca llModuleFu nction err or): ".$Er rorMessage );
255       }   255       }
256     256  
257       return  $Processe dModulesCo unt;   257       return  $Processe dModulesCo unt;
258   }   258   }
259     259  
260   /**   260   /**
261   *   Allows  member to  use modul es   261   *   Allows  member to  use modul es
262   *   262   *
263   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   263   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
264   *   264   *
265   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed   265   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed
266   *   266   *
267   *   @retur n int Coun t of proce ssed modul es   267   *   @retur n int Coun t of proce ssed modul es
268   */   268   */
269   function m odules_unb lock($ID,  $ModuleTyp e = '')   269   function m odules_unb lock($ID,  $ModuleTyp e = '')
270   {   270   {
271       if (!  (int)$ID)   271       if (!  (int)$ID)
272       {   272       {
273           mo dules_err( "modules_u nblock():  invalid me mber ID (\ $ID = '{$I D}')");   273           mo dules_err( "modules_u nblock():  invalid me mber ID (\ $ID = '{$I D}')");
274       }   274       }
275     275  
276       $Proce ssedModule sCount = C allModuleF unction('F uncUnblock ', '$UserI dentifier' , array($I D), $Modul eType, '',  $ErrorMes sage );   276       $Proce ssedModule sCount = C allModuleF unction('F uncUnblock ', '$UserI dentifier' , array($I D), $Modul eType, '',  $ErrorMes sage );
277     277  
278       if ($P rocessedMo dulesCount  === false )   278       if ($P rocessedMo dulesCount  === false )
279       {   279       {
280           mo dules_err( "modules_u nblock() ( CallModule Function e rror): ".$ ErrorMessa ge);   280           mo dules_err( "modules_u nblock() ( CallModule Function e rror): ".$ ErrorMessa ge);
281       }   281       }
282     282  
283       return  $Processe dModulesCo unt;   283       return  $Processe dModulesCo unt;
284   }   284   }
285     285  
286   /**   286   /**
287   *   Update s member's  or admin' s informat ion   287   *   Update s member's  or admin' s informat ion
288   *   288   *
289   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   289   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
290   *   290   *
291   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed   291   *   @param  string $M oduleType    If not e qual to em pty string , only spe cified typ e of modul es will be  processed
292   *   292   *
293   *   @param  string    $PreviousN ickname    If not emp ty, denote s that nic kname of m ember was  changed   293   *   @param  string    $PreviousN ickname    If not emp ty, denote s that nic kname of m ember was  changed
294   *   294   *
295   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.   295   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter.
296   *   296   *
297   *   @retur n int Coun t of proce ssed modul es   297   *   @retur n int Coun t of proce ssed modul es
298   */   298   */
299   function m odules_upd ate($ID, $ ModuleType  = '', $Pr eviousNick name = '',  $IsAdmin  = 0)   299   function m odules_upd ate($ID, $ ModuleType  = '', $Pr eviousNick name = '',  $IsAdmin  = 0)
300   {   300   {
301       if (st rlen(trim( $ID)) <= 0 )   301       if (st rlen(trim( $ID)) <= 0 )
302       {   302       {
303           mo dules_err( "modules_u pdate(): i nvalid use r identifi er (\$ID =  '{$ID}',  \$IsAdmin  = '{$IsAdm in}')");   303           mo dules_err( "modules_u pdate(): i nvalid use r identifi er (\$ID =  '{$ID}',  \$IsAdmin  = '{$IsAdm in}')");
304       }   304       }
305     305  
306       $Proce ssedModule sCount = C allModuleF unction('F uncUpdate' , '$UserId entifier,  $IsAdmin,  $PreviousN ickname',   306       $Proce ssedModule sCount = C allModuleF unction('F uncUpdate' , '$UserId entifier,  $IsAdmin,  $PreviousN ickname',
307           ar ray($ID, $ IsAdmin, $ PreviousNi ckname), $ ModuleType , '', $Err orMessage) ;   307           ar ray($ID, $ IsAdmin, $ PreviousNi ckname), $ ModuleType , '', $Err orMessage) ;
308     308  
309       if ($P rocessedMo dulesCount  === false )   309       if ($P rocessedMo dulesCount  === false )
310       {   310       {
311           mo dules_err( "modules_u pdate() (C allModuleF unction er ror): ".$E rrorMessag e);   311           mo dules_err( "modules_u pdate() (C allModuleF unction er ror): ".$E rrorMessag e);
312       }   312       }
313     313  
314       return  $Processe dModulesCo unt;   314       return  $Processe dModulesCo unt;
315   }   315   }
316     316  
317   /**   317   /**
318   *   Logs m ember or a dmin into  module   318   *   Logs m ember or a dmin into  module
319   *   319   *
320   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1   320   *   @param  mixed $ID     User i dentifier.  Should be  member ID  if $IsAdm in is 0 or  admin nam e if $IsAd min is 1
321   *   321   *
322   *   @param  string $M oduleName    Defines,  which mod ule to log  in. Canno t be empty   322   *   @param  string $M oduleName    Defines,  which mod ule to log  in. Canno t be empty
323   *   323   *
324   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter   324   *   @param  int  $IsA dmin    De fines, how  to interp ret $ID pa rameter
325   */   325   */
326   function m odules_log in($ID, $M oduleName,  $IsAdmin)   326   function m odules_log in($ID, $M oduleName,  $IsAdmin)
327   {   327   {
328       if (st rlen(trim( $ID)) <= 0 )   328       if (st rlen(trim( $ID)) <= 0 )
329       {   329       {
330           mo dules_err( "modules_l ogin(): in valid user  identifie r (\$ID =  '{$ID}', \ $IsAdmin =  '{$IsAdmi n}')");   330           mo dules_err( "modules_l ogin(): in valid user  identifie r (\$ID =  '{$ID}', \ $IsAdmin =  '{$IsAdmi n}')");
331       }   331       }
332     332  
333       if (st rlen(trim( $ModuleNam e)) <= 0)   333       if (st rlen(trim( $ModuleNam e)) <= 0)
334       {   334       {
335           mo dules_err( "modules_l ogin(): mo dule name  was not sp ecified");   335           mo dules_err( "modules_l ogin(): mo dule name  was not sp ecified");
336       }   336       }
337     337  
338       $Proce ssedModule sCount = C allModuleF unction('L ogin', '$U serIdentif ier, $IsAd min', arra y($ID, $Is Admin), '' ,   338       $Proce ssedModule sCount = C allModuleF unction('L ogin', '$U serIdentif ier, $IsAd min', arra y($ID, $Is Admin), '' ,
339           $M oduleName,  $ErrorMes sage);   339           $M oduleName,  $ErrorMes sage);
340     340  
341       if ($P rocessedMo dulesCount  === false )   341       if ($P rocessedMo dulesCount  === false )
342       {   342       {
343           mo dules_err( "modules_l ogin() (Ca llModuleFu nction err or): ".$Er rorMessage );   343           mo dules_err( "modules_l ogin() (Ca llModuleFu nction err or): ".$Er rorMessage );
344       }   344       }
345     345  
346       if ($P rocessedMo dulesCount  === 0)   346       if ($P rocessedMo dulesCount  === 0)
347       {   347       {
348           mo dules_err( "modules_l ogin(): no  module wi th such na me (\$Modu leName = ' {$ModuleNa me}')");   348           mo dules_err( "modules_l ogin(): no  module wi th such na me (\$Modu leName = ' {$ModuleNa me}')");
349       }   349       }
350   }   350   }
351     351  
352   /**   352   /**
353   *   Raises  module er ror. Calls  exit() fu nction (fi nishes PHP  code inte rperting)   353   *   Raises  module er ror. Calls  exit() fu nction (fi nishes PHP  code inte rperting)
354   *   For in ternal use  only   354   *   For in ternal use  only
355   *   355   *
356   *   @param  string $E rrorMessag e Message  to display   356   *   @param  string $E rrorMessag e Message  to display
357   */   357   */
358   function m odules_err ($ErrorMes sage)   358   function m odules_err ($ErrorMes sage)
359   {   359   {
360       global  $site;   360       global  $site;
361     361  
362     362  
363       mail($ site['bugR eportMail' ], "{$site ['title']}  : error i n module",  $ErrorMes sage);   363       mail($ site['bugR eportMail' ], "{$site ['title']}  : error i n module",  $ErrorMes sage);
364       echo " Module err or: $Error Message";   364       echo " Module err or: $Error Message";
365     365  
366       exit;   366       exit;
367   }   367   }
368     368  
369   /**   369   /**
370   *   Evalua tes FuncCo nf procedu re of modu les (fills  $mods arr ay)   370   *   Evalua tes FuncCo nf procedu re of modu les (fills  $mods arr ay)
371   *   For in ternal use  only   371   *   For in ternal use  only
372   */   372   */
373   function m odules_rea d_config()   373   function m odules_rea d_config()
374   {   374   {
375       global  $mods;   375       global  $mods;
376     376  
377       $ResMo dulesConfi g = db_res ("SELECT ` Conf` FROM  `Modules` ");   377       $ResMo dulesConfi g = db_res ("SELECT ` Conf` FROM  `Modules` ");
378     378  
379       while  ($ArrModul eConfig =  mysql_fetc h_array($R esModulesC onfig))   379       while  ($ArrModul eConfig =  mysql_fetc h_array($R esModulesC onfig))
380       {   380       {
381           ev al($ArrMod uleConfig[ 'Conf']);   381           ev al($ArrMod uleConfig[ 'Conf']);
382       }   382       }
383   }   383   }
384     384  
385   /**   385   /**
386   *   386   *
387   *   Synchr onyzes _ce rtain_ pro files with  modules u sers set   387   *   Synchr onyzes _ce rtain_ pro files with  modules u sers set
388   */   388   */
389   function s ynchronize Profiles($ idList, $i sAdmin)   389   function s ynchronize Profiles($ idList, $i sAdmin)
390   {   390   {
391       global  $dir;    
392       global  $PHPBIN;   391       global  $PHPBIN;
393     392  
394       $Comma ndLineArgs  = new CCo mmandLineA rgs;   393       $Comma ndLineArgs  = new CCo mmandLineA rgs;
395     394  
396       $Comma ndLineArgs ->AddArgum ent((int)$ isAdmin);   395       $Comma ndLineArgs ->AddArgum ent((int)$ isAdmin);
397       foreac h ($idList  as $id)   396       foreac h ($idList  as $id)
398       {   397       {
399           $C ommandLine Args->AddA rgument($i d);   398           $C ommandLine Args->AddA rgument($i d);
400       }   399       }
401     400  
402        if   (chdir( $dir['root '] .'modules/ '))   401        if   (chdir( BX_DIRECTO RY_PATH_RO OT .'modules/ '))
403       {   402       {
404           $s criptRetur nValue = ' value was  not set';   403           $s criptRetur nValue = ' value was  not set';
405           ex ec("{$PHPB IN} -f ref resh.php " .$CommandL ineArgs->G etCommandL ine(), $sc riptOutput , $scriptR eturnValue );   404           ex ec("{$PHPB IN} -f ref resh.php " .$CommandL ineArgs->G etCommandL ine(), $sc riptOutput , $scriptR eturnValue );
406           if  ($scriptR eturnValue  !== 0)   405           if  ($scriptR eturnValue  !== 0)
407           {   406           {
408                echo "re fresh.php  returned:  <br />\n";   407                echo "re fresh.php  returned:  <br />\n";
409                foreach  ($scriptOu tput as $o utputLine)   408                foreach  ($scriptOu tput as $o utputLine)
410                {   409                {
411                    echo  $outputLi ne.'<br /> ';   410                    echo  $outputLi ne.'<br /> ';
412                }   411                }
413                modules_ err("synch ronizeProf iles(): ex ec({$PHPBI N} -f refr esh.php ". $CommandLi neArgs->Ge tCommandLi ne().") re turned ".$ scriptRetu rnValue);   412                modules_ err("synch ronizeProf iles(): ex ec({$PHPBI N} -f refr esh.php ". $CommandLi neArgs->Ge tCommandLi ne().") re turned ".$ scriptRetu rnValue);
414           }   413           }
415       }   414       }
416       else   415       else
417       {   416       {
418            modules_er r("synchro nizeProfil es():   chdir( {$dir['roo t']} modules/)   returned   false");   417            modules_er r("synchro nizeProfil es():   chdir( "   .   BX_DIRECTO RY_PATH_RO OT   .   " modules/)   returned   false");
419       }   418       }
420     419  
421       /* DEB UG   420       /* DEB UG
422       echo " exec({$PHP BIN} -f re fresh.php  ".$Command LineArgs-> GetCommand Line().")" ;   421       echo " exec({$PHP BIN} -f re fresh.php  ".$Command LineArgs-> GetCommand Line().")" ;
423       echo " <br />Retu rn value =  ".$script ReturnValu e."<br >";   422       echo " <br />Retu rn value =  ".$script ReturnValu e."<br >";
424       foreac h ($script Output as  $outputLin e)   423       foreac h ($script Output as  $outputLin e)
425       {   424       {
426           ec ho $output Line.'<br  />';   425           ec ho $output Line.'<br  />';
427       }   426       }
428       echo ' ---------- ---------- ---------- ---------- -- <br />< br />';   427       echo ' ---------- ---------- ---------- ---------- -- <br />< br />';
429       //*/   428       //*/
430   }   429   }
431     430  
432   /**   431   /**
433   *   Synchr onyzes _al l_ profile s with mod ules users  set. Sync hronizatio n is perfo rmed   432   *   Synchr onyzes _al l_ profile s with mod ules users  set. Sync hronizatio n is perfo rmed
434   *   part-b y-part to  avoid exec ution time  limit exc eeding   433   *   part-b y-part to  avoid exec ution time  limit exc eeding
435   */   434   */
436   function m odulesRefr esh($partS ize = 20)   435   function m odulesRefr esh($partS ize = 20)
437   {   436   {
438       /**   437       /**
439       *   Sp lits list  of profile s into par ts and cal ls synchro nizeProfil es functio n for each  part   438       *   Sp lits list  of profile s into par ts and cal ls synchro nizeProfil es functio n for each  part
440       */   439       */
441       functi on splitAn dSynchroni ze($idList , $isAdmin , $partSiz e)   440       functi on splitAn dSynchroni ze($idList , $isAdmin , $partSiz e)
442       {   441       {
443           if  (! is_arr ay($idList ))   442           if  (! is_arr ay($idList ))
444           {   443           {
445                $idList  = array($i dList);   444                $idList  = array($i dList);
446           }   445           }
447           $f ullPartsCo unt = intv al(count($ idList) /  $partSize) ;   446           $f ullPartsCo unt = intv al(count($ idList) /  $partSize) ;
448           fo r ($partIn dex = 0; $ partIndex  <= $fullPa rtsCount -  1; $partI ndex++)   447           fo r ($partIn dex = 0; $ partIndex  <= $fullPa rtsCount -  1; $partI ndex++)
449           {   448           {
450                $part =  array();   449                $part =  array();
451                for ($id Index = 0;  $idIndex  <= $partSi ze - 1; $i dIndex++)   450                for ($id Index = 0;  $idIndex  <= $partSi ze - 1; $i dIndex++)
452                {   451                {
453                    $par t[] = $idL ist[$partI ndex * $pa rtSize + $ idIndex];   452                    $par t[] = $idL ist[$partI ndex * $pa rtSize + $ idIndex];
454                }   453                }
455                synchron izeProfile s($part, $ isAdmin);   454                synchron izeProfile s($part, $ isAdmin);
456           }   455           }
457     456  
458           $r estSize =  count($idL ist) % $pa rtSize;   457           $r estSize =  count($idL ist) % $pa rtSize;
459           if  ($restSiz e)   458           if  ($restSiz e)
460           {   459           {
461                $part =  array();   460                $part =  array();
462                for ($id Index = 0;  $idIndex  <= $restSi ze - 1; $i dIndex++)   461                for ($id Index = 0;  $idIndex  <= $restSi ze - 1; $i dIndex++)
463                {   462                {
464                    $par t[] = $idL ist[$fullP artsCount  * $partSiz e + $idInd ex];   463                    $par t[] = $idL ist[$fullP artsCount  * $partSiz e + $idInd ex];
465                }   464                }
466                synchron izeProfile s($part, $ isAdmin);   465                synchron izeProfile s($part, $ isAdmin);
467           }   466           }
468       } /* f unction sp litAndSync hronize */   467       } /* f unction sp litAndSync hronize */
469     468  
470     469  
471       // Syn chronize a dmins   470       // Syn chronize a dmins
472       $resAd mins = db_ res("SELEC T `Name` F ROM `Admin s`");   471       $resAd mins = db_ res("SELEC T `Name` F ROM `Admin s`");
473       while  ($adminInf o = mysql_ fetch_arra y($resAdmi ns))   472       while  ($adminInf o = mysql_ fetch_arra y($resAdmi ns))
474       {   473       {
475           $a dmins[] =  $adminInfo ['Name'];   474           $a dmins[] =  $adminInfo ['Name'];
476       }   475       }
477       splitA ndSynchron ize($admin s, 1, $par tSize);   476       splitA ndSynchron ize($admin s, 1, $par tSize);
478     477  
479       // Syn chronize m embers   478       // Syn chronize m embers
480       $resMe mbers = db _res("SELE CT `ID`, ` NickName`  FROM `Prof iles`");   479       $resMe mbers = db _res("SELE CT `ID`, ` NickName`  FROM `Prof iles`");
481       while  ($arrMembe r = mysql_ fetch_arra y($resMemb ers))   480       while  ($arrMembe r = mysql_ fetch_arra y($resMemb ers))
482       {   481       {
483           if  (! in_arr ay($arrMem ber['NickN ame'], $ad mins))   482           if  (! in_arr ay($arrMem ber['NickN ame'], $ad mins))
484           {   483           {
485                $members [] = $arrM ember['ID' ];   484                $members [] = $arrM ember['ID' ];
486           }   485           }
487       }   486       }
488       splitA ndSynchron ize($membe rs, 0, $pa rtSize);   487       splitA ndSynchron ize($membe rs, 0, $pa rtSize);
489   }   488   }
490     489  
491   modules_re ad_config( );   490   modules_re ad_config( );
492     491  
493   ?>   492   ?>