35. File Comparison Report

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

35.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc\classes BxDolGroups.php Sun May 11 13:17:00 2008 UTC
2 Dolphin-v.6.1.2\inc\classes BxDolGroups.php Wed Jun 18 06:23:58 2008 UTC

35.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 26 4212
Changed 16 43
Inserted 7 52
Removed 2 25

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

35.4 Active regular expressions

No regular expressions were active.

35.5 Comparison detail

1   <?   1   <?
2   require_on ce( BX_DIR ECTORY_PAT H_INC . 'h eader.inc. php' );   2   require_on ce( BX_DIR ECTORY_PAT H_INC . 'h eader.inc. php' );
3   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );   3   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
4   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );   4   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );
5   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );   5   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );
6     6  
7   require_on ce( BX_DIR ECTORY_PAT H_INC . 't ags.inc.ph p' );   7   require_on ce( BX_DIR ECTORY_PAT H_INC . 't ags.inc.ph p' );
8     8  
9   /*   9   /*
10    * class f or Groups   10    * class f or Groups
11    */   11    */
12   class BxDo lGroups {   12   class BxDo lGroups {
13       //vari ables   13       //vari ables
14       var $s CurrFile;   14       var $s CurrFile;
15     15  
16       //admi n mode, ca n perform  all action s   16       //admi n mode, ca n perform  all action s
17       var $b AdminMode;   17       var $b AdminMode;
18     18  
19       //use  permalink   19       //use  permalink
20       var $b UseFriendl yLinks;   20       var $b UseFriendl yLinks;
21     21  
22       var $s SubGrpPath ;   22       var $s SubGrpPath ;
23       var $s GrpPath;   23       var $s GrpPath;
24       var $s GrpGalPath ;   24       var $s GrpGalPath ;
25     25  
26       var $s SpacerIcon ;   26       var $s SpacerIcon ;
27     27  
28       /**   28       /**
29        * con structor   29        * con structor
30        */   30        */
31       functi on BxDolGr oups($bAdm Mode = fal se) {   31       functi on BxDolGr oups($bAdm Mode = fal se) {
32           gl obal $site ;   32           gl obal $site ;
33     33  
34           // $dirGroups   -> $this ->sGrpPath   34           // $dirGroups   -> $this ->sGrpPath
35           $t his->sSpac erIcon = g etTemplate Icon( 'spa cer.gif' ) ;   35           $t his->sSpac erIcon = g etTemplate Icon( 'spa cer.gif' ) ;
36     36  
37           $t his->bAdmi nMode = $b AdmMode;   37           $t his->bAdmi nMode = $b AdmMode;
38     38  
39           $t his->bUseF riendlyLin ks = getPa ram('perma links_grou ps') == 'o n' ? true  : false;   39           $t his->bUseF riendlyLin ks = getPa ram('perma links_grou ps') == 'o n' ? true  : false;
40     40  
41           $t his->sSubG rpPath = ' groups/';   41           $t his->sSubG rpPath = ' groups/';
42     42  
43           $t his->sGrpP ath = BX_D IRECTORY_P ATH_ROOT .  $this->sS ubGrpPath;   43           $t his->sGrpP ath = BX_D IRECTORY_P ATH_ROOT .  $this->sS ubGrpPath;
44           $t his->sGrpG alPath = $ this->sGrp Path . 'ga llery/';   44           $t his->sGrpG alPath = $ this->sGrp Path . 'ga llery/';
45     45  
46           $s ite['group s']          = $site[ 'url'].$th is->sSubGr pPath;   46           $s ite['group s']          = $site[ 'url'].$th is->sSubGr pPath;
47           $s ite['group s_gallery' ] = "{$sit e['groups' ]}gallery/ ";   47           $s ite['group s_gallery' ] = "{$sit e['groups' ]}gallery/ ";
48     48  
49           $t his->sCurr File = 'gr p.php';   49           $t his->sCurr File = 'gr p.php';
50       }   50       }
51     51  
52     52  
53       /***** ********** *****Page  functions* ********** ********** ********** ********/   53       /***** ********** *****Page  functions* ********** ********** ********** ********/
54       functi on GenInde xPageOfGro ups() {   54       functi on GenInde xPageOfGro ups() {
55           $s Categories  = $this-> GenAllCate gories();   55           $s Categories  = $this-> GenAllCate gories();
56            $sAllNewGr oups   =   $this->Pag eCompGroup sSearchRes ults(   0 ,   0,   0,   0,   0,   'membersCo unt',   true   );   56           $s KW = $this ->process_ html_db_in put($_GET[ 'keyword'] );
    57           $s KeyAddon =  (isset($_ GET['keywo rd']) && $ sKW != '')  ? $sKW :  0;
    58            $sAllNewGr oups   =   $this->Pag eCompGroup sSearchRes ults(   $_GET['key word'] ,   0,   0,   0,   0,   'membersCo unt',   true   );
57           re turn array ($sCategor ies, $sAll NewGroups) ;   59           re turn array ($sCategor ies, $sAll NewGroups) ;
58       }   60       }
59     61  
60       functi on GenAllC ategories( ) {   62       functi on GenAllC ategories( ) {
61           gl obal $site ;   63           gl obal $site ;
62     64  
63           $s KeywordC =  _t('_Keyw ord');   65           $s KeywordC =  _t('_Keyw ord');
64           $s SearchC =  _t('_Searc h');   66           $s SearchC =  _t('_Searc h');
65           $s AdvSearchC  = _t('_Ad vanced sea rch');   67           $s AdvSearchC  = _t('_Ad vanced sea rch');
66     68  
67           $s Categories  = $this-> genAllCate gsList();   69           $s Categories  = $this-> genAllCate gsList();
68     70  
69           $s Ret = <<<E OF   71           $s Ret = <<<E OF
70   <div class ="groups_c ategs_wrap per">   72   <div class ="groups_c ategs_wrap per">
71       <div c lass="clea r_both"></ div>   73       <div c lass="clea r_both"></ div>
72           {$ sCategorie s}   74           {$ sCategorie s}
73       <div c lass="clea r_both"></ div>   75       <div c lass="clea r_both"></ div>
74   </div>   76   </div>
75     77  
76   <div class ="groups_s earch_simp le">   78   <div class ="groups_s earch_simp le">
77       <form  action="{$ site['url' ]}{$this-> sCurrFile} ?action=ca teg" metho d="get">   79       <form  action="{$ site['url' ]}{$this-> sCurrFile} ?action=ca teg" metho d="get">
78           {$ sKeywordC} :   80           {$ sKeywordC} :
79           <i nput type= "text" nam e="keyword " />   81           <i nput type= "text" nam e="keyword " />
80           <i nput type= "submit" v alue="{$sS earchC}" / >   82           <i nput type= "submit" v alue="{$sS earchC}" / >
81           &n bsp;&nbsp; &nbsp;<a h ref="{$sit e['url']}{ $this->sCu rrFile}?ac tion=searc h">{$sAdvS earchC}</a >   83           &n bsp;&nbsp; &nbsp;<a h ref="{$sit e['url']}{ $this->sCu rrFile}?ac tion=searc h">{$sAdvS earchC}</a >
82       </form >   84       </form >
83   </div>   85   </div>
84   EOF;   86   EOF;
85           re turn $sRet ;   87           re turn $sRet ;
86       }   88       }
87     89  
88        function   GenCategor yPage(
)   {
  90        function   GenCategor yPage( $bHiddenSe archForm   =   false )   {
89           $s Form = '';   91           $s Form = '';
90           $s Results =  '';   92           $s Results =  '';
91     93  
92           li st($sKeywo rd, $sSear chby, $iCa tegID, $sC ountry, $s CityVal, $ sSortby, $ sKeywordDB , $sSearch byDB, $sCa tegIDDB, $ sCountryDB , $sCityDB , $sSortby DB) = $thi s->Collect BrowsePara ms();   94           li st($sKeywo rd, $sSear chby, $iCa tegID, $sC ountry, $s CityVal, $ sSortby, $ sKeywordDB , $sSearch byDB, $sCa tegIDDB, $ sCountryDB , $sCityDB , $sSortby DB) = $thi s->Collect BrowsePara ms();
93            $sForm   =   $this->Gen SearchForm ($sKeyword ,   $sSearchby ,   $iCategID,   $sCountry,   $sCityVal,   $sSortby
);
  95            $sForm   =   $this->Gen SearchForm ($sKeyword ,   $sSearchby ,   $iCategID,   $sCountry,   $sCityVal,   $sSortby ,   $bHiddenSe archForm );
94     96  
95           if ( $sKeywor dDB or $sC ategIDDB o r $sCountr yDB or $sC ityVal )   97           if ( $sKeywor dDB or $sC ategIDDB o r $sCountr yDB or $sC ityVal )
96                $sResult s = $this- >PageCompG roupsSearc hResults(  $sKeywordD B, $sSearc hbyDB, $sC ategIDDB,  $sCountryD B, $sCityD B, $sSortb yDB );   98                $sResult s = $this- >PageCompG roupsSearc hResults(  $sKeywordD B, $sSearc hbyDB, $sC ategIDDB,  $sCountryD B, $sCityD B, $sSortb yDB );
97     99  
98           re turn array ($sForm, $ sResults);   100           re turn array ($sForm, $ sResults);
99       }   101       }
100     102  
101       functi on Collect BrowsePara ms() {   103       functi on Collect BrowsePara ms() {
102           gl obal $aPre Values;   104           gl obal $aPre Values;
103     105  
104           //  get searc h params   106           //  get searc h params
105           $s Keyword  =  $_REQUEST ['keyword' ];   107           $s Keyword  =  $_REQUEST ['keyword' ];
106           $s Searchby =  $_REQUEST ['searchby '];   108           $s Searchby =  $_REQUEST ['searchby '];
107           $s Country  =  $_REQUEST ['Country' ];   109           $s Country  =  $_REQUEST ['Country' ];
108           $s CityVal      = $_REQU EST['City' ];   110           $s CityVal      = $_REQU EST['City' ];
109           $s Sortby   =  $_REQUEST ['sortby'] ;   111           $s Sortby   =  $_REQUEST ['sortby'] ;
110           //  [END] get  search pa rams   112           //  [END] get  search pa rams
111     113  
112           if  (isset($_ REQUEST['c ategUri']) ) {   114           if  (isset($_ REQUEST['c ategUri']) ) {
113                $sUri =  process_db _input($_R EQUEST['ca tegUri']);   115                $sUri =  process_db _input($_R EQUEST['ca tegUri']);
114                $iCategI D = (int)d b_value("S ELECT `ID`  FROM `Gro upsCateg`  WHERE `Uri `='{$sUri} '");   116                $iCategI D = (int)d b_value("S ELECT `ID`  FROM `Gro upsCateg`  WHERE `Uri `='{$sUri} '");
115           }  else {   117           }  else {
116                $iCategI D = (int)$ _REQUEST[' categID'];   118                $iCategI D = (int)$ _REQUEST[' categID'];
117           }       119           }    
118     120  
119           //  check sea rch params   121           //  check sea rch params
120           un set( $sKey wordDB );   122           un set( $sKey wordDB );
121           un set( $sSea rchbyDB );   123           un set( $sSea rchbyDB );
122           un set( $sCat egIDDB );   124           un set( $sCat egIDDB );
123           un set( $sCou ntryDB );   125           un set( $sCou ntryDB );
124           un set( $sCit yDB );   126           un set( $sCit yDB );
125           un set( $sSor tbyDB );   127           un set( $sSor tbyDB );
126     128  
127           if ( isset($s Keyword) a nd strlen( $sKeyword)  ) {   129           if ( isset($s Keyword) a nd strlen( $sKeyword)  ) {
128                $sKeywor d = trim(  $sKeyword  );   130                $sKeywor d = trim(  $sKeyword  );
129                if( strl en( $sKeyw ord ) )   131                if( strl en( $sKeyw ord ) )
130                    $sKe ywordDB =  strtoupper ( process_ db_input(  $sKeyword  ) );   132                    $sKe ywordDB =  strtoupper ( process_ db_input(  $sKeyword  ) );
131                $sKeywor d = proces s_pass_dat a( $sKeywo rd );   133                $sKeywor d = proces s_pass_dat a( $sKeywo rd );
132           }   134           }
133     135  
134           if ( $sSearch by == 'nam e' or $sSe archby ==  'keyword'  )   136           if ( $sSearch by == 'nam e' or $sSe archby ==  'keyword'  )
135                $sSearch byDB = $sS earchby;   137                $sSearch byDB = $sS earchby;
136           el se   138           el se
137                $sSearch byDB = $sS earchby =  'keyword';   139                $sSearch byDB = $sS earchby =  'keyword';
138     140  
139           $s CategIDDB  = $iCategI D = (int)$ iCategID;   141           $s CategIDDB  = $iCategI D = (int)$ iCategID;
140     142  
141           if ( isset( $ sCountry )  and isset ( $aPreVal ues['Count ry'][$sCou ntry] ) )   143           if ( isset( $ sCountry )  and isset ( $aPreVal ues['Count ry'][$sCou ntry] ) )
142                $sCountr yDB = $sCo untry;   144                $sCountr yDB = $sCo untry;
143           el se   145           el se
144                $sCountr y = '';   146                $sCountr y = '';
145     147  
146           if ( isset($s CityVal) a nd strlen( $sCityVal)  ) {   148           if ( isset($s CityVal) a nd strlen( $sCityVal)  ) {
147                $sCityVa l = trim(  $sCityVal  );   149                $sCityVa l = trim(  $sCityVal  );
148                if( strl en( $sCity Val ) )   150                if( strl en( $sCity Val ) )
149                    $sCi tyDB = str toupper( p rocess_db_ input( $sC ityVal ) ) ;   151                    $sCi tyDB = str toupper( p rocess_db_ input( $sC ityVal ) ) ;
150                $sCityVa l = proces s_pass_dat a( $sCityV al );   152                $sCityVa l = proces s_pass_dat a( $sCityV al );
151           }   153           }
152     154  
153           if ( $sSortby  == 'Name'  or $sSort by == 'mem bersCount'  or $sSort by == 'cre ated' )   155           if ( $sSortby  == 'Name'  or $sSort by == 'mem bersCount'  or $sSort by == 'cre ated' )
154                $sSortby DB = $sSor tby;   156                $sSortby DB = $sSor tby;
155           el se   157           el se
156                $sSortby DB = $sSor tby = 'mem bersCount' ;   158                $sSortby DB = $sSor tby = 'mem bersCount' ;
157           //  [END] che ck search  params   159           //  [END] che ck search  params
158     160  
159           $a Res = arra y($sKeywor d, $sSearc hby, $iCat egID, $sCo untry, $sC ityVal, $s Sortby, $s KeywordDB,  $sSearchb yDB, $sCat egIDDB, $s CountryDB,  $sCityDB,  $sSortbyD B);   161           $a Res = arra y($sKeywor d, $sSearc hby, $iCat egID, $sCo untry, $sC ityVal, $s Sortby, $s KeywordDB,  $sSearchb yDB, $sCat egIDDB, $s CountryDB,  $sCityDB,  $sSortbyD B);
160           re turn $aRes ;   162           re turn $aRes ;
161       }   163       }
162     164  
163       //Page CompGroups SearchForm   165       //Page CompGroups SearchForm
164        function   GenSearchF orm(   $sKeyword,   $sSearchby ,   $iCategID,   $sCountry,   $sCityVal,   $sSortby  
)   {
  166        function   GenSearchF orm(   $sKeyword,   $sSearchby ,   $iCategID,   $sCountry,   $sCityVal,   $sSortby ,   $bHiddenSe archForm   =   false   )   {
165           gl obal $aPre Values;   167           gl obal $aPre Values;
166           gl obal $site ;   168           gl obal $site ;
167     169  
168           $s KeywordC =  _t('_Keyw ord');   170           $s KeywordC =  _t('_Keyw ord');
169           $s SearchByC  = _t('_Sea rch by');   171           $s SearchByC  = _t('_Sea rch by');
170           $s ByGrpNameC  = _t('_by  group nam e');   172           $s ByGrpNameC  = _t('_by  group nam e');
171           $s ByKeywC =  _t('_by ke yword');   173           $s ByKeywC =  _t('_by ke yword');
172           $s CategoryC  = _t('_Cat egory');   174           $s CategoryC  = _t('_Cat egory');
173           $s AnyC = _t( '_Any');   175           $s AnyC = _t( '_Any');
174           $s CountryC =  _t('_Coun try');   176           $s CountryC =  _t('_Coun try');
175           $s CityC = _t ('_City');   177           $s CityC = _t ('_City');
176           $s SortByC =  _t('_Sort  by');   178           $s SortByC =  _t('_Sort  by');
177           $s ByGrpNameC  = _t('_by  group nam e');   179           $s ByGrpNameC  = _t('_by  group nam e');
178           $s ByPopularC  = _t('_by  popular') ;   180           $s ByPopularC  = _t('_by  popular') ;
179           $s ByNewestC  = _t('_by  newest');   181           $s ByNewestC  = _t('_by  newest');
180           $s SearchC =  _t('_Searc h');   182           $s SearchC =  _t('_Searc h');
181           $s EnterParam sC = _t('_ Please sel ect at lea st one sea rch parame ter');   183           $s EnterParam sC = _t('_ Please sel ect at lea st one sea rch parame ter');
182     184  
183           $s UnbrKeyw =  $this->un break_js(  str_replac e( '\'','\ \\'', str_ replace( ' \\','\\\\' ,$sKeyword  ) ) );   185           $s UnbrKeyw =  $this->un break_js(  str_replac e( '\'','\ \\'', str_ replace( ' \\','\\\\' ,$sKeyword  ) ) );
184           $s UnbrCity =  $this->un break_js(  str_replac e( '\'','\ \\'', str_ replace( ' \\','\\\\' ,$sCityVal  ) ) );   186           $s UnbrCity =  $this->un break_js(  str_replac e( '\'','\ \\'', str_ replace( ' \\','\\\\' ,$sCityVal  ) ) );
185     187  
186           $s JSCode = < <<EOF   188           $s JSCode = < <<EOF
187   <script ty pe="text/j avascript" >   189   <script ty pe="text/j avascript" >
188       var ke yword  = ' {$sUnbrKey w}';   190       var ke yword  = ' {$sUnbrKey w}';
189       var se archby = ' {$sSearchb y}';   191       var se archby = ' {$sSearchb y}';
190       var ca tegID  = ' {$iCategID }';   192       var ca tegID  = ' {$iCategID }';
191       var Co untry  = ' {$sCountry }';   193       var Co untry  = ' {$sCountry }';
192       var Ci ty     = ' {$sUnbrCit y}';   194       var Ci ty     = ' {$sUnbrCit y}';
193       var so rtby   = ' {$sSortby} ';   195       var so rtby   = ' {$sSortby} ';
194     196  
195       functi on checkSe archForm()  {   197       functi on checkSe archForm()  {
196           _f orm = docu ment.forms .groups_se arch_form;   198           _f orm = docu ment.forms .groups_se arch_form;
197           if ( !_form )   199           if ( !_form )
198                return f alse;   200                return f alse;
199     201  
200           if ( !_form.k eyword.val ue && !_fo rm.categID .value &&  !_form.Cou ntry.value  && !_form .City.valu e ) {   202           if ( !_form.k eyword.val ue && !_fo rm.categID .value &&  !_form.Cou ntry.value  && !_form .City.valu e ) {
201                alert( ' {$sEnterPa ramsC}' );   203                alert( ' {$sEnterPa ramsC}' );
202                return f alse;   204                return f alse;
203           }   205           }
204       }   206       }
205      
206       functi on switchG roupsSearc hPage(page ) {    
207           _f orm = docu ment.forms .groups_se arch_form;    
208           if ( !_form )    
209                return f alse;    
210      
211           _f orm.keywor d.value =  keyword;    
212           _f orm.categI D.value =  categID;    
213           _f orm.Countr y.value =  Country;    
214           _f orm.City.v alue    =  City;    
215      
216           fo r( i = 0;  i < _form. searchby.l ength; i + + )    
217                if( _for m.searchby [i].value  == searchb y )    
218                    _for m.searchby [i].checke d = true;    
219      
220           fo r( i = 0;  i < _form. sortby.len gth; i ++  )    
221                if( _for m.sortby[i ].value ==  sortby )    
222                    _for m.sortby[i ].checked  = true;    
223      
224           _f orm.page.v alue = pag e;    
225      
226           _f orm.submit ();    
227           re turn true;    
228       }    
229   </script>   207   </script>
230   EOF;   208   EOF;
231     209  
232           /* $bNoFilter  = false;   210           /* $bNoFilter  = false;
233           if  (isset($_ REQUEST['c ategID'])  && isset($ _REQUEST[' nf']) && ( int)$_REQU EST['nf']  == 1) $bNo Filter = t rue;   211           if  (isset($_ REQUEST['c ategID'])  && isset($ _REQUEST[' nf']) && ( int)$_REQU EST['nf']  == 1) $bNo Filter = t rue;
234           if  ($bNoFilt er == true ) $sDispla yStyle='st yle="displ ay:none"';   212           if  ($bNoFilt er == true ) $sDispla yStyle='st yle="displ ay:none"';
235           if  ($bNoFilt er == true ) $sNFelem ent = '<in put type=" hidden" na me="nf" va lue="1" /> ';*/   213           if  ($bNoFilt er == true ) $sNFelem ent = '<in put type=" hidden" na me="nf" va lue="1" /> ';*/
236     214  
237           $s Keyword =  htmlspecia lchars_adv ($sKeyword );   215           $s Keyword =  htmlspecia lchars_adv ($sKeyword );
238           $s City = htm lspecialch ars_adv($s CityVal);   216           $s City = htm lspecialch ars_adv($s CityVal);
239     217  
240           $s Categories Opt = '';   218           $s Categories Opt = '';
241           $r Vals = db_ res( "SELE CT * FROM  `GroupsCat eg` ORDER  BY `Name`"  );   219           $r Vals = db_ res( "SELE CT * FROM  `GroupsCat eg` ORDER  BY `Name`"  );
242           wh ile ( $arr  = mysql_f etch_assoc ( $rVals )  ) {   220           wh ile ( $arr  = mysql_f etch_assoc ( $rVals )  ) {
243                $sCategN ame = html specialcha rs_adv( $a rr['Name']  );   221                $sCategN ame = html specialcha rs_adv( $a rr['Name']  );
244                $sSelect ed = ($iCa tegID == $ arr['ID'])  ? ' selec ted="selec ted"' : '' ;   222                $sSelect ed = ($iCa tegID == $ arr['ID'])  ? ' selec ted="selec ted"' : '' ;
245                $sCatego riesOpt .=  <<<EOF   223                $sCatego riesOpt .=  <<<EOF
246   <option va lue="{$arr ['ID']}" { $sSelected }>{$sCateg Name}</opt ion>   224   <option va lue="{$arr ['ID']}" { $sSelected }>{$sCateg Name}</opt ion>
247   EOF;   225   EOF;
248           }   226           }
249     227  
250           $s Countries  = '';   228           $s Countries  = '';
251           fo reach( $aP reValues[' Country']  as $sKey = > $sVal )  {   229           fo reach( $aP reValues[' Country']  as $sKey = > $sVal )  {
252                $sSelecC nt = (strc mp($sCount ry, $sKey) ) ? '' : '  selected= "selected" ';   230                $sSelecC nt = (strc mp($sCount ry, $sKey) ) ? '' : '  selected= "selected" ';
253                $sCountr yLocaliz =  _t($sVal[ 'LKey']);   231                $sCountr yLocaliz =  _t($sVal[ 'LKey']);
254     232  
255                $sCountr ies .= <<< EOF   233                $sCountr ies .= <<< EOF
256   <option va lue="{$sKe y}" {$sSel ecCnt}>{$s CountryLoc aliz}</opt ion>   234   <option va lue="{$sKe y}" {$sSel ecCnt}>{$s CountryLoc aliz}</opt ion>
257   EOF;   235   EOF;
258           }   236           }
259     237  
260           $s Checked =  'checked=" checked"';   238           $s Checked =  'checked=" checked"';
261           $s SBVal = ($ sSearchby  == 'name')  ? $sCheck ed : '';   239           $s SBVal = ($ sSearchby  == 'name')  ? $sCheck ed : '';
262           $s SBKey = ($ sSearchby  == 'keywor d') ? $sCh ecked : '' ;   240           $s SBKey = ($ sSearchby  == 'keywor d') ? $sCh ecked : '' ;
263           $s SortBySel  = ($sSortb y == 'Name ') ? $sChe cked : '';   241           $s SortBySel  = ($sSortb y == 'Name ') ? $sChe cked : '';
264           $s ByMembConS el = ($sSo rtby == 'm embersCoun t') ? $sCh ecked : '' ;   242           $s ByMembConS el = ($sSo rtby == 'm embersCoun t') ? $sCh ecked : '' ;
265           $s ByCreatedS el = ($sSo rtby == 'c reated') ?  $sChecked  : '';   243           $s ByCreatedS el = ($sSo rtby == 'c reated') ?  $sChecked  : '';
266     244  
    245           if  ($bHidden SearchForm  == true)  {
    246                $sRetHtm l = <<<EOF
    247       <form  action="{$ site['url' ]}{$this-> sCurrFile} ?action=ca teg" metho d="get" na me="groups _search_fo rm" onsubm it="return  checkSear chForm();" >
    248           <i nput type= "hidden" i d="keyword " name="ke yword" val ue="" />
    249           <i nput type= "hidden" n ame="searc hby" value ="name" id ="searchby _name" />
    250           <i nput type= "hidden" n ame="searc hby" value ="keyword"  id="searc hby_keywor d" />
    251           <i nput type= "hidden" i d="categID " name="ca tegID" val ue="{$iCat egID}" />
    252           <i nput type= "hidden" i d="Country " name="Co untry" val ue="" />
    253           <i nput type= "hidden" i d="City" n ame="City"  value=""  />
    254           <i nput type= "hidden" n ame="sortb y" value=" Name" id=" sortby_Nam e" />
    255           <i nput type= "hidden" n ame="sortb y" value=" membersCou nt" id="so rtby_membe rsCount" / >
    256           <i nput type= "hidden" n ame="sortb y" value=" created" i d="sortby_ created" / >
    257           <i nput type= "hidden" n ame="hidde n_mode" va lue="1" />
    258           <i nput type= "hidden" n ame="page"  value="1"  />
    259           <i nput type= "hidden" v alue="sear ch" id="ac tion" name ="action"  />
    260           <! -- <input  type="subm it" value= "{$sSearch C}" class= "groups_se arch_label for" /> -- >
    261       </form >
    262   EOF;
    263           }  else {
267           $s RetHtml =  <<<EOF   264                $sRetHtm l = <<<EOF
268   <div class ="groups_s earch_adv"  {$sDispla yStyle} >   265   <div class ="groups_s earch_adv"  {$sDispla yStyle} >
269       <div c lass="clea r_both"></ div>   266       <div c lass="clea r_both"></ div>
270       <form  action="{$ site['url' ]}{$this-> sCurrFile} ?action=ca teg" metho d="get" na me="groups _search_fo rm" onsubm it="return  checkSear chForm();" >   267       <form  action="{$ site['url' ]}{$this-> sCurrFile} ?action=ca teg" metho d="get" na me="groups _search_fo rm" onsubm it="return  checkSear chForm();" >
271           <d iv class=" groups_sea rch_row">   268           <d iv class=" groups_sea rch_row">
272                <div cla ss="groups _search_la bel">{$sKe ywordC}:</ div>   269                <div cla ss="groups _search_la bel">{$sKe ywordC}:</ div>
273                <div cla ss="groups _search_va lue">   270                <div cla ss="groups _search_va lue">
274                    <inp ut type="t ext" id="k eyword" na me="keywor d" class=" groups_sea rch_text"  value="{$s Keyword}"  />   271                    <inp ut type="t ext" id="k eyword" na me="keywor d" class=" groups_sea rch_text"  value="{$s Keyword}"  />
275                </div>   272                </div>
276                <div cla ss="clear_ both"></di v>   273                <div cla ss="clear_ both"></di v>
277           </ div>   274           </ div>
278     275  
279           <d iv class=" groups_sea rch_row">   276           <d iv class=" groups_sea rch_row">
280                <div cla ss="groups _search_la bel">{$sSe archByC}:< /div>   277                <div cla ss="groups _search_la bel">{$sSe archByC}:< /div>
281                <div cla ss="groups _search_va lue">   278                <div cla ss="groups _search_va lue">
282                    <inp ut type="r adio" name ="searchby " class="g roups_sear ch_radio"  value="nam e" id="sea rchby_name " {$sSBVal } />   279                    <inp ut type="r adio" name ="searchby " class="g roups_sear ch_radio"  value="nam e" id="sea rchby_name " {$sSBVal } />
283                    <lab el for="se archby_nam e" class=" groups_sea rch_labelf or">{$sByG rpNameC}</ label>   280                    <lab el for="se archby_nam e" class=" groups_sea rch_labelf or">{$sByG rpNameC}</ label>
284     281  
285                    <inp ut type="r adio" name ="searchby " class="g roups_sear ch_radio"  value="key word" id=" searchby_k eyword" {$ sSBKey} />   282                    <inp ut type="r adio" name ="searchby " class="g roups_sear ch_radio"  value="key word" id=" searchby_k eyword" {$ sSBKey} />
286                    <lab el for="se archby_key word" clas s="groups_ search_lab elfor">{$s ByKeywC}</ label>   283                    <lab el for="se archby_key word" clas s="groups_ search_lab elfor">{$s ByKeywC}</ label>
287                </div>   284                </div>
288                <div cla ss="clear_ both"></di v>   285                <div cla ss="clear_ both"></di v>
289           </ div>   286           </ div>
290     287  
291           <d iv class=" groups_sea rch_row">   288           <d iv class=" groups_sea rch_row">
292                <div cla ss="groups _search_la bel">{$sCa tegoryC}:< /div>   289                <div cla ss="groups _search_la bel">{$sCa tegoryC}:< /div>
293                <div cla ss="groups _search_va lue">   290                <div cla ss="groups _search_va lue">
294                    <sel ect id="ca tegID" nam e="categID " class="g roups_sear ch_select"  >   291                    <sel ect id="ca tegID" nam e="categID " class="g roups_sear ch_select"  >
295                         <option va lue="">{$s AnyC}</opt ion>   292                         <option va lue="">{$s AnyC}</opt ion>
296                         {$sCategor iesOpt}   293                         {$sCategor iesOpt}
297                    </se lect>   294                    </se lect>
298                </div>   295                </div>
299                <div cla ss="clear_ both"></di v>   296                <div cla ss="clear_ both"></di v>
300           </ div>   297           </ div>
301     298  
302           <d iv class=" groups_sea rch_row">   299           <d iv class=" groups_sea rch_row">
303                <div cla ss="groups _search_la bel">{$sCo untryC}:</ div>   300                <div cla ss="groups _search_la bel">{$sCo untryC}:</ div>
304                <div cla ss="groups _search_va lue">   301                <div cla ss="groups _search_va lue">
305                    <sel ect id="Co untry" nam e="Country " class="g roups_sear ch_select"  >   302                    <sel ect id="Co untry" nam e="Country " class="g roups_sear ch_select"  >
306                         <option va lue="">{$s AnyC}</opt ion>   303                         <option va lue="">{$s AnyC}</opt ion>
307                         {$sCountri es}   304                         {$sCountri es}
308                    </se lect>   305                    </se lect>
309                </div>   306                </div>
310                <div cla ss="clear_ both"></di v>   307                <div cla ss="clear_ both"></di v>
311           </ div>   308           </ div>
312     309  
313           <d iv class=" groups_sea rch_row">   310           <d iv class=" groups_sea rch_row">
314                <div cla ss="groups _search_la bel">{$sCi tyC}:</div >   311                <div cla ss="groups _search_la bel">{$sCi tyC}:</div >
315                <div cla ss="groups _search_va lue">   312                <div cla ss="groups _search_va lue">
316                    <inp ut type="t ext" id="C ity" name= "City" cla ss="groups _search_te xt" value= "{$sCity}"  />   313                    <inp ut type="t ext" id="C ity" name= "City" cla ss="groups _search_te xt" value= "{$sCity}"  />
317                </div>   314                </div>
318                <div cla ss="clear_ both"></di v>   315                <div cla ss="clear_ both"></di v>
319           </ div>   316           </ div>
320     317  
321           <d iv class=" groups_sea rch_row">   318           <d iv class=" groups_sea rch_row">
322                <div cla ss="groups _search_la bel">{$sSo rtByC}:</d iv>   319                <div cla ss="groups _search_la bel">{$sSo rtByC}:</d iv>
323                <div cla ss="groups _search_va lue">   320                <div cla ss="groups _search_va lue">
324                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="Name"  id="sortb y_Name" {$ sSortBySel } />   321                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="Name"  id="sortb y_Name" {$ sSortBySel } />
325                    <lab el for="so rtby_Name"  class="gr oups_searc h_labelfor ">{$sByGrp NameC}</la bel>   322                    <lab el for="so rtby_Name"  class="gr oups_searc h_labelfor ">{$sByGrp NameC}</la bel>
326     323  
327                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="membe rsCount" i d="sortby_ membersCou nt" {$sByM embConSel}  />   324                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="membe rsCount" i d="sortby_ membersCou nt" {$sByM embConSel}  />
328                    <lab el for="so rtby_membe rsCount" c lass="grou ps_search_ labelfor"> {$sByPopul arC}</labe l>   325                    <lab el for="so rtby_membe rsCount" c lass="grou ps_search_ labelfor"> {$sByPopul arC}</labe l>
329     326  
330                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="creat ed" id="so rtby_creat ed" {$sByC reatedSel}  />   327                    <inp ut type="r adio" name ="sortby"  class="gro ups_search _radio" va lue="creat ed" id="so rtby_creat ed" {$sByC reatedSel}  />
331                    <lab el for="so rtby_creat ed" class= "groups_se arch_label for">{$sBy NewestC}</ label>   328                    <lab el for="so rtby_creat ed" class= "groups_se arch_label for">{$sBy NewestC}</ label>
332                </div>   329                </div>
333                <div cla ss="clear_ both"></di v>   330                <div cla ss="clear_ both"></di v>
334           </ div>   331           </ div>
335     332  
336           <i nput type= "hidden" n ame="page"  value="1"  />   333           <i nput type= "hidden" n ame="page"  value="1"  />
337           {$ sNFelement }   334  
338           <d iv class=" groups_sea rch_row_ce nter">   335           <d iv class=" groups_sea rch_row_ce nter">
339                <input t ype="hidde n" value=" search" id ="action"  name="acti on" />   336                <input t ype="hidde n" value=" search" id ="action"  name="acti on" />
340                <input t ype="submi t" value=" {$sSearchC }" class=" groups_sea rch_labelf or" />   337                <input t ype="submi t" value=" {$sSearchC }" class=" groups_sea rch_labelf or" />
341                <div cla ss="clear_ both"></di v>   338                <div cla ss="clear_ both"></di v>
342           </ div>   339           </ div>
343       </form >   340       </form >
344       <div c lass="clea r_both"></ div>   341       <div c lass="clea r_both"></ div>
345   </div>   342   </div>
346   EOF;   343   EOF;
    344           }
347     345  
348            return  
DesignBoxC ontent(   _t('_Searc h   Groups'),   $sJSCode   .   $sRetHtml,   1);
  346            return   ($bHiddenS earchForm   ==   true)   ?   $sJSCode.$ sRetHtml   :   DesignBoxC ontent(   _t('_Searc h   Groups'),   $sJSCode   .   $sRetHtml,   1);
349           // return ($b NoFilter = = true) ?  $sJSCode .  $sRetHtml  : DesignB oxContent  ( _t('_Sea rch Groups '), $sJSCo de . $sRet Html, 1);   347           // return ($b NoFilter = = true) ?  $sJSCode .  $sRetHtml  : DesignB oxContent  ( _t('_Sea rch Groups '), $sJSCo de . $sRet Html, 1);
350       }   348       }
351     349  
352       // Ma- an it is c razy. I do n't know w hat they'l l enter in  search fo rm =)   350       // Ma- an it is c razy. I do n't know w hat they'l l enter in  search fo rm =)
353       // Our  testers e ntered <sc ript>alert (1)</scrip t> it has  broken eve rything   351       // Our  testers e ntered <sc ript>alert (1)</scrip t> it has  broken eve rything
354       functi on unbreak _js( $sTex t ) {   352       functi on unbreak _js( $sTex t ) {
355           re turn str_r eplace( '< /script>',  "</scr'+' ipt>", $sT ext );   353           re turn str_r eplace( '< /script>',  "</scr'+' ipt>", $sT ext );
356       }   354       }
357     355  
358       functi on PCGroup Members($a GroupInfo,  $iGroupID , $iMember ID) {   356       functi on PCGroup Members($a GroupInfo,  $iGroupID , $iMember ID) {
359           gl obal $site ;   357           gl obal $site ;
360           gl obal $oTem plConfig;   358           gl obal $oTem plConfig;
361     359  
362           $s ViewAllC =  _t("_View  all membe rs");   360           $s ViewAllC =  _t("_View  all membe rs");
363           $s EditMembC  = _t('_Edi t members' );   361           $s EditMembC  = _t('_Edi t members' );
364     362  
365           $s RetHtml =  '<div clas s="group_m embers_pre 1">';   363           $s RetHtml =  '<div clas s="group_m embers_pre 1">';
366     364  
367           $i NumberMemb ers = $oTe mplConfig  -> iGroupM embersPreN um;   365           $i NumberMemb ers = $oTe mplConfig  -> iGroupM embersPreN um;
368           $s QuerySQL =  "   366           $s QuerySQL =  "
369                SELECT   367                SELECT
370                    `Gro upsMembers `.`memberI D` AS `ID` ,   368                    `Gro upsMembers `.`memberI D` AS `ID` ,
371                    `Pro files`.`Ni ckName`   369                    `Pro files`.`Ni ckName`
372                FROM `Gr oupsMember s`   370                FROM `Gr oupsMember s`
373                INNER JO IN `Profil es` ON `Gr oupsMember s`.`member ID` = `Pro files`.`ID `   371                INNER JO IN `Profil es` ON `Gr oupsMember s`.`member ID` = `Pro files`.`ID `
374                WHERE   372                WHERE
375                    `Gro upsMembers `.`groupID ` = '{$iGr oupID}' AN D `GroupsM embers`.`S tatus` = ' Active'   373                    `Gro upsMembers `.`groupID ` = '{$iGr oupID}' AN D `GroupsM embers`.`S tatus` = ' Active'
376                ORDER BY  RAND()   374                ORDER BY  RAND()
377                LIMIT {$ iNumberMem bers}   375                LIMIT {$ iNumberMem bers}
378           ;" ;   376           ;" ;
379     377  
380           $v Members =  db_res( $s QuerySQL ) ;   378           $v Members =  db_res( $s QuerySQL ) ;
381     379  
382           wh ile ( $aMe mberInfo =  mysql_fet ch_assoc(  $vMembers  ) ) {   380           wh ile ( $aMe mberInfo =  mysql_fet ch_assoc(  $vMembers  ) ) {
383                $sMembTh umb = get_ member_thu mbnail( $a MemberInfo ['ID'],'no ne', true  );   381                $sMembTh umb = get_ member_thu mbnail( $a MemberInfo ['ID'],'no ne', true  );
384                $sMembLi nk = getPr ofileLink(  $aMemberI nfo['ID']  );   382                $sMembLi nk = getPr ofileLink(  $aMemberI nfo['ID']  );
385                $sMembNi ck = htmls pecialchar s_adv( $aM emberInfo[ 'NickName' ] );   383                $sMembNi ck = htmls pecialchar s_adv( $aM emberInfo[ 'NickName' ] );
386                $sRetHtm l .= <<<EO F   384                $sRetHtm l .= <<<EO F
387   <div class ="group_me mber_pre">   385   <div class ="group_me mber_pre">
388       {$sMem bThumb}   386       {$sMem bThumb}
389       <a hre f="{$sMemb Link}">{$s MembNick}< /a>   387       <a hre f="{$sMemb Link}">{$s MembNick}< /a>
390   </div>   388   </div>
391   EOF;   389   EOF;
392           }   390           }
393           $s RetHtml .=  <<<EOF   391           $s RetHtml .=  <<<EOF
394       </div>   392       </div>
395   <div class ="clear_bo th"></div>   393   <div class ="clear_bo th"></div>
396   <div class ="view_all _link">   394   <div class ="view_all _link">
397       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group_m embers&ID= {$iGroupID }">{$sView AllC}</a>   395       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group_m embers&ID= {$iGroupID }">{$sView AllC}</a>
398   </div>   396   </div>
399   EOF;   397   EOF;
400     398  
401           $s CreatorEdi tMembers =  '';   399           $s CreatorEdi tMembers =  '';
402           if ( $aGroupI nfo['creat orID'] ==  $iMemberID  ) {   400           if ( $aGroupI nfo['creat orID'] ==  $iMemberID  ) {
403                $sCreato rEditMembe rs = <<<EO F   401                $sCreato rEditMembe rs = <<<EO F
404   <div class ="caption_ item">   402   <div class ="caption_ item">
405       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group_m embers&amp ;mode=edit &amp;ID={$ iGroupID}" >{$sEditMe mbC}</a>   403       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group_m embers&amp ;mode=edit &amp;ID={$ iGroupID}" >{$sEditMe mbC}</a>
406   </div>   404   </div>
407   EOF;   405   EOF;
408           }   406           }
409     407  
410           re turn Desig nBoxConten t( _t("_Gr oup member s"), $sRet Html, 1, $ sCreatorEd itMembers  );   408           re turn Desig nBoxConten t( _t("_Gr oup member s"), $sRet Html, 1, $ sCreatorEd itMembers  );
411       }   409       }
412     410  
413       functi on PCGroup Forum($aGr oupInfo, $ iGroupID,  $iMemberID ) {   411       functi on PCGroup Forum($aGr oupInfo, $ iGroupID,  $iMemberID ) {
414           gl obal $site ;   412           gl obal $site ;
415     413  
416            $sForumUri   =  
db_value(" SELECT   `forum_uri `   FROM   `grp_forum `   WHERE   `forum_id`   =   '{$iGroupI D}'   LIMIT   1")
;
  414            $sForumUri   =   urlencode( db_value(" SELECT   `forum_uri `   FROM   `grp_forum `   WHERE   `forum_id`   =   '{$iGroupI D}'   LIMIT   1") ) ;
417     415  
418           // $sRet = fi le_get_con tents( "{$ site['grou ps']}orca/ ?action=gr oup_last_t opics&foru m={$iGroup ID}&virtID ={$iMember ID}&virtPa ss={$_COOK IE['member Password'] }&trans=1"  );   416           // Замечание:  Если вы о ткрываете  URI содерж ащий спецс имволы, та кие как пр обел, вам  нужно зако дировать U RI при пом ощи urlenc ode(). 
419           $s Ret = file _get_conte nts( "{$si te['groups ']}orca/?a ction=grou p_last_top ics&forum= {$sForumUr i}&trans=1 " );   417           $s Ret = file _get_conte nts("{$sit e['groups' ]}orca/?ac tion=group _last_topi cs&forum={ $sForumUri }&trans=1" );
420     418  
421           $s ViewAllFor um = _t( ' _View all  topics' );   419           $s ViewAllFor um = _t( ' _View all  topics' );
422           $s PostNewTop ic = _t( ' _Post a ne w topic' ) ;   420           $s PostNewTop ic = _t( ' _Post a ne w topic' ) ;
423     421  
424           $c aption_ite m = '<div  class="cap tion_item" >';   422           $c aption_ite m = '<div  class="cap tion_item" >';
425           if  ( $this-> isGroupMem ber( $iMem berID, $iG roupID ) )   423           if  ( $this-> isGroupMem ber( $iMem berID, $iG roupID ) )
426                $caption _item .= " <a href=\" {$site['gr oups']}orc a/forum/{$ sForumUri} -0.htm#act ion=goto&a mp;new_top ic={$sForu mUri}\">{$ sPostNewTo pic}</a> |  ";   424                $caption _item .= " <a href=\" {$site['gr oups']}orc a/forum/{$ sForumUri} -0.htm#act ion=goto&a mp;new_top ic={$sForu mUri}\">{$ sPostNewTo pic}</a> |  ";
427           $c aption_ite m .= "<a h ref=\"{$si te['groups ']}orca/fo rum/{$sFor umUri}-0.h tm\">{$sVi ewAllForum }</a>";   425           $c aption_ite m .= "<a h ref=\"{$si te['groups ']}orca/fo rum/{$sFor umUri}-0.h tm\">{$sVi ewAllForum }</a>";
428           $c aption_ite m .= '</di v>';   426           $c aption_ite m .= '</di v>';
429     427  
430           re turn Desig nBoxConten t( _t("_Gr oup forum" ), $sRet,  1, $captio n_item );   428           re turn Desig nBoxConten t( _t("_Gr oup forum" ), $sRet,  1, $captio n_item );
431       }   429       }
432     430  
433       functi on PCGroup Actions($a GroupInfo,  $iGroupID , $iMember ID) {   431       functi on PCGroup Actions($a GroupInfo,  $iGroupID , $iMember ID) {
434           gl obal $site ;   432           gl obal $site ;
435           gl obal $logg ed;   433           gl obal $logg ed;
436     434  
437           $s RetHtml =  '';   435           $s RetHtml =  '';
438     436  
439           if  ( $logged ['member']  ) {   437           if  ( $logged ['member']  ) {
440                if ( $th is->isGrou pMember( $ iMemberID,  $iGroupID , false )  ) {   438                if ( $th is->isGrou pMember( $ iMemberID,  $iGroupID , false )  ) {
441                    if (  $this->is GroupMembe r( $iMembe rID, $iGro upID ) ) {  //if Acti ve member   439                    if (  $this->is GroupMembe r( $iMembe rID, $iGro upID ) ) {  //if Acti ve member
442                         if( (int)$ aGroupInfo ['members_ invite'] o r $aGroupI nfo['creat orID'] ==  $iMemberID  )   440                         if( (int)$ aGroupInfo ['members_ invite'] o r $aGroupI nfo['creat orID'] ==  $iMemberID  )
443                             $sRetH tml .= $th is->genGro upActionBt n( 'Invite  others',  "group_act ions.php?a =invite&am p;ID={$iGr oupID}" );   441                             $sRetH tml .= $th is->genGro upActionBt n( 'Invite  others',  "group_act ions.php?a =invite&am p;ID={$iGr oupID}" );
444                           442                        
445                         if( (int)$ aGroupInfo ['members_ post_image s'] or $aG roupInfo[' creatorID' ] == $iMem berID )   443                         if( (int)$ aGroupInfo ['members_ post_image s'] or $aG roupInfo[' creatorID' ] == $iMem berID )
446                             $sRetH tml .= $th is->genGro upActionBt n( 'Upload  image', " group_acti ons.php?a= upload&amp ;ID={$iGro upID}" );   444                             $sRetH tml .= $th is->genGro upActionBt n( 'Upload  image', " group_acti ons.php?a= upload&amp ;ID={$iGro upID}" );
447                         //$sRetHtm l .= $this ->genGroup ActionBtn(  'Post top ic', "{$th is->sSubGr pPath}orca /?action=g oto&amp;fo rum_id={$i GroupID}#a ction=goto &amp;new_t opic={$iGr oupID}" );   445                         //$sRetHtm l .= $this ->genGroup ActionBtn(  'Post top ic', "{$th is->sSubGr pPath}orca /?action=g oto&amp;fo rum_id={$i GroupID}#a ction=goto &amp;new_t opic={$iGr oupID}" );
448                         $sForumUri  = db_valu e("SELECT  `forum_uri ` FROM `gr p_forum` W HERE `foru m_id` = '{ $iGroupID} ' LIMIT 1" );   446                         $sForumUri  = db_valu e("SELECT  `forum_uri ` FROM `gr p_forum` W HERE `foru m_id` = '{ $iGroupID} ' LIMIT 1" );
449                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Post topic ', "groups /orca/foru m/{$sForum Uri}-0.htm #action=go to&amp;new _topic={$s ForumUri}"  );   447                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Post topic ', "groups /orca/foru m/{$sForum Uri}-0.htm #action=go to&amp;new _topic={$s ForumUri}"  );
450                    }   448                    }
451     449  
452                    if (  $aGroupIn fo['creato rID'] == $ iMemberID  )   450                    if (  $aGroupIn fo['creato rID'] == $ iMemberID  )
453                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Edit group ', "{$this ->sCurrFil e}?action= edit&ID={$ iGroupID}"  );   451                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Edit group ', "{$this ->sCurrFil e}?action= edit&ID={$ iGroupID}"  );
454                    else   452                    else
455                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Resign gro up', "grou p_actions. php?a=resi gn&amp;ID= {$iGroupID }", true ) ;   453                         $sRetHtml  .= $this-> genGroupAc tionBtn( ' Resign gro up', "grou p_actions. php?a=resi gn&amp;ID= {$iGroupID }", true ) ;
456                } else   454                } else
457                    $sRe tHtml .= $ this->genG roupAction Btn( 'Join  group', " group_acti ons.php?a= join&amp;I D={$iGroup ID}", true  );   455                    $sRe tHtml .= $ this->genG roupAction Btn( 'Join  group', " group_acti ons.php?a= join&amp;I D={$iGroup ID}", true  );
458           }   456           }
459     457  
460           re turn $sRet Html;   458           re turn $sRet Html;
461       }   459       }
462     460  
463       functi on genGrou pActionBtn ( $sTitle,  $sUrl, $b Ask = fals e ) {   461       functi on genGrou pActionBtn ( $sTitle,  $sUrl, $b Ask = fals e ) {
464           gl obal $site ;   462           gl obal $site ;
465     463  
466           $s Onclick =  ($bAsk) ?  'onclick=" return con firm(\''._ t("_Are yo u sure wan t to {$sTi tle}?").'\ ')"' : '';   464           $s Onclick =  ($bAsk) ?  'onclick=" return con firm(\''._ t("_Are yo u sure wan t to {$sTi tle}?").'\ ')"' : '';
467           $s LocTitle =  _t('_'.$s Title);   465           $s LocTitle =  _t('_'.$s Title);
468     466  
469           $s RetHtml =  <<<EOF   467           $s RetHtml =  <<<EOF
470   <div class ="group_ac tion">   468   <div class ="group_ac tion">
471       <a hre f="{$site[ 'url']}{$s Url}" {$sO nclick}>{$ sLocTitle} </a>   469       <a hre f="{$site[ 'url']}{$s Url}" {$sO nclick}>{$ sLocTitle} </a>
472   </div>   470   </div>
473   EOF;   471   EOF;
474           re turn $sRet Html;   472           re turn $sRet Html;
475       }   473       }
476     474  
477     475  
478       functi on ShowGro upGalleryP age() {   476       functi on ShowGro upGalleryP age() {
479           gl obal $logg ed;   477           gl obal $logg ed;
480           gl obal $site ;   478           gl obal $site ;
481     479  
482           $i NameIndex  = 75;   480           $i NameIndex  = 75;
483           $s HeaderT =  _t( "_Grou p gallery"  );   481           $s HeaderT =  _t( "_Grou p gallery"  );
484           $s Header = _ t( "_Group  gallery"  );   482           $s Header = _ t( "_Group  gallery"  );
485           $s MainCode =  '';   483           $s MainCode =  '';
486     484  
487           if ( $logged[ 'member']  = member_a uth( 0, fa lse ) )   485           if ( $logged[ 'member']  = member_a uth( 0, fa lse ) )
488                $iMember ID = (int) $_COOKIE[' memberID'] ;   486                $iMember ID = (int) $_COOKIE[' memberID'] ;
489           el se {   487           el se {
490                $iMember ID = 0;   488                $iMember ID = 0;
491                $logged[ 'admin'] =  member_au th( 1, fal se );   489                $logged[ 'admin'] =  member_au th( 1, fal se );
492           }   490           }
493     491  
494           $i GroupID =  (int)$_REQ UEST['ID'] ;   492           $i GroupID =  (int)$_REQ UEST['ID'] ;
495     493  
496           if  ( !$iGrou pID ) {   494           if  ( !$iGrou pID ) {
497                Header(  "Location:  {$site['u rl']}{$thi s->sCurrFi le}" );   495                Header(  "Location:  {$site['u rl']}{$thi s->sCurrFi le}" );
498                exit;   496                exit;
499           }   497           }
500     498  
501           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {   499           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {
502                $aGroupI nfo['Name_ html'] = h tmlspecial chars_adv(  $aGroupIn fo['Name']  );   500                $aGroupI nfo['Name_ html'] = h tmlspecial chars_adv(  $aGroupIn fo['Name']  );
503     501  
504                if ( (in t)$aGroupI nfo['hidde n_group']  and !$this ->isGroupM ember( $iM emberID, $ iGroupID )  and !$log ged['admin '] )   502                if ( (in t)$aGroupI nfo['hidde n_group']  and !$this ->isGroupM ember( $iM emberID, $ iGroupID )  and !$log ged['admin '] )
505                    $sMa inCode = _ t( "_You c annot view  gallery w hile not a  group mem ber" );   503                    $sMa inCode = _ t( "_You c annot view  gallery w hile not a  group mem ber" );
506                else {   504                else {
507                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {   505                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {
508                         $sHeader =  _t( "_Gro up gallery " );   506                         $sHeader =  _t( "_Gro up gallery " );
509                         $sMainCode  = $this-> PCGenGroup Gallery($i MemberID,  $iGroupID,  $aGroupIn fo);   507                         $sMainCode  = $this-> PCGenGroup Gallery($i MemberID,  $iGroupID,  $aGroupIn fo);
510                    } el se {   508                    } el se {
511                         $iNameInde x = 0;   509                         $iNameInde x = 0;
512                         $sHeader =  _t( "_Gro up is susp ended" );   510                         $sHeader =  _t( "_Gro up is susp ended" );
513                         $sHeaderT  = _t( "_Gr oup is sus pended" );   511                         $sHeaderT  = _t( "_Gr oup is sus pended" );
514                         $sMainCode  = _t( "_S orry, grou p is suspe nded" );   512                         $sMainCode  = _t( "_S orry, grou p is suspe nded" );
515                    }   513                    }
516                }   514                }
517           }  else   515           }  else
518                $sMainCo de = _t( " _Group not  found_des c" );   516                $sMainCo de = _t( " _Group not  found_des c" );
519     517  
520           re turn array ($iNameInd ex, $sHead er, $sHead erT, $sMai nCode);   518           re turn array ($iNameInd ex, $sHead er, $sHead erT, $sMai nCode);
521       }   519       }
522     520  
523       functi on PCGenGr oupGallery ($iMemberI D, $iGroup ID, $aGrou pInfo) {   521       functi on PCGenGr oupGallery ($iMemberI D, $iGroup ID, $aGrou pInfo) {
524           gl obal $site ;   522           gl obal $site ;
525     523  
526           $s UploadedBy C = _t('_U ploaded by ');   524           $s UploadedBy C = _t('_U ploaded by ');
527           $s SetAsThumb C = _t('_S et as thum bnail');   525           $s SetAsThumb C = _t('_S et as thum bnail');
528           $s DelImgC =  _t('_Delet e image');   526           $s DelImgC =  _t('_Delet e image');
529           $s UploadImag eC = _t('_ Upload ima ge');   527           $s UploadImag eC = _t('_ Upload ima ge');
530     528  
531           $s GroupLink  = $this->g etGroupUrl ($iGroupID , $aGroupI nfo['Uri'] );   529           $s GroupLink  = $this->g etGroupUrl ($iGroupID , $aGroupI nfo['Uri'] );
532     530  
533           $s BreadCrumb s = <<<EOJ   531           $s BreadCrumb s = <<<EOJ
534   <div class ="groups_b readcrumbs ">   532   <div class ="groups_b readcrumbs ">
535       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /   533       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /
536       <a hre f="{$site[ 'url']}{$t his->sCurr File}">__G roups__</a > /   534       <a hre f="{$site[ 'url']}{$t his->sCurr File}">__G roups__</a > /
537       <a hre f="{$sGrou pLink}">{$ aGroupInfo ['Name_htm l']}</a> /   535       <a hre f="{$sGrou pLink}">{$ aGroupInfo ['Name_htm l']}</a> /
538       <span  class="act ive_link"> __Group ga llery__</s pan>   536       <span  class="act ive_link"> __Group ga llery__</s pan>
539   </div>   537   </div>
540   EOJ;   538   EOJ;
541     539  
542           $s BreadCrumb s = str_re place( "__ Groups__",  _t( "_Gro ups" ), $s BreadCrumb s );   540           $s BreadCrumb s = str_re place( "__ Groups__",  _t( "_Gro ups" ), $s BreadCrumb s );
543           $s BreadCrumb s = str_re place( "__ Group gall ery__", _t ( "_Group  gallery" ) , $sBreadC rumbs );   541           $s BreadCrumb s = str_re place( "__ Group gall ery__", _t ( "_Group  gallery" ) , $sBreadC rumbs );
544     542  
545           $s QuerySQL =  "   543           $s QuerySQL =  "
546                SELECT ` GroupsGall ery`.*, `P rofiles`.` NickName`   544                SELECT ` GroupsGall ery`.*, `P rofiles`.` NickName`
547                FROM `Gr oupsGaller y`   545                FROM `Gr oupsGaller y`
548                LEFT JOI N `Profile s` ON `Gro upsGallery `.`by`=`Pr ofiles`.`I D`   546                LEFT JOI N `Profile s` ON `Gro upsGallery `.`by`=`Pr ofiles`.`I D`
549                WHERE `G roupsGalle ry`.`group ID`='{$iGr oupID}'   547                WHERE `G roupsGalle ry`.`group ID`='{$iGr oupID}'
550                ORDER BY  `GroupsGa llery`.`ID `   548                ORDER BY  `GroupsGa llery`.`ID `
551           ";   549           ";
552     550  
553           $r esPics = d b_res( $sQ uerySQL );   551           $r esPics = d b_res( $sQ uerySQL );
554     552  
555           $s RetHtml =  <<<EOF   553           $s RetHtml =  <<<EOF
556   {$sBreadCr umbs}   554   {$sBreadCr umbs}
557   <div class ="group_ga llery_wrap per">   555   <div class ="group_ga llery_wrap per">
558       <div c lass="clea r_both"></ div>   556       <div c lass="clea r_both"></ div>
559   EOF;   557   EOF;
560     558  
561           wh ile( $arrP ic = mysql _fetch_ass oc( $resPi cs ) ) {   559           wh ile( $arrP ic = mysql _fetch_ass oc( $resPi cs ) ) {
562                $sGalNic k = htmlsp ecialchars _adv($arrP ic['NickNa me']);   560                $sGalNic k = htmlsp ecialchars _adv($arrP ic['NickNa me']);
563                $iNewJSW  = $arrPic ['width']+ 20;   561                $iNewJSW  = $arrPic ['width']+ 20;
564                $iNewJSH  = $arrPic ['height'] +20;   562                $iNewJSH  = $arrPic ['height'] +20;
565     563  
566                $sRetHtm l .= <<<EO F   564                $sRetHtm l .= <<<EO F
567   <div class ="group_ga llery_pic"  style="">   565   <div class ="group_ga llery_pic"  style="">
568       <a hre f="{$site[ 'groups_ga llery']}{$ arrPic['gr oupID']}_{ $arrPic['I D']}_{$arr Pic['seed' ]}.{$arrPi c['ext']}"   566       <a hre f="{$site[ 'groups_ga llery']}{$ arrPic['gr oupID']}_{ $arrPic['I D']}_{$arr Pic['seed' ]}.{$arrPi c['ext']}"
569         titl e="{$sUplo adedByC} { $sGalNick} " onclick= "window.op en(this.hr ef, '_blan k', 'width ={$iNewJSW },height={ $iNewJSH}' );return f alse;">   567         titl e="{$sUplo adedByC} { $sGalNick} " onclick= "window.op en(this.hr ef, '_blan k', 'width ={$iNewJSW },height={ $iNewJSH}' );return f alse;">
570           <i mg src="{$ site['grou ps_gallery ']}{$arrPi c['groupID ']}_{$arrP ic['ID']}_ {$arrPic[' seed']}_.{ $arrPic['e xt']}"   568           <i mg src="{$ site['grou ps_gallery ']}{$arrPi c['groupID ']}_{$arrP ic['ID']}_ {$arrPic[' seed']}_.{ $arrPic['e xt']}"
571              style="wid th:{$arrPi c['width_' ]}px;heigh t:{$arrPic ['height_' ]}px" alt= "" />   569              style="wid th:{$arrPi c['width_' ]}px;heigh t:{$arrPic ['height_' ]}px" alt= "" />
572       </a>   570       </a>
573   EOF;   571   EOF;
574                if( $aGr oupInfo['t humb'] !=  $arrPic['I D'] and $a GroupInfo[ 'creatorID '] == $iMe mberID ) {   572                if( $aGr oupInfo['t humb'] !=  $arrPic['I D'] and $a GroupInfo[ 'creatorID '] == $iMe mberID ) {
575                    $sRe tHtml .= < <<EOF   573                    $sRe tHtml .= < <<EOF
576   <br />   574   <br />
577   <a href="{ $site['url ']}group_a ctions.php ?ID={$iGro upID}&amp; a=def&amp; img={$arrP ic['ID']}"  class="gr oup_set_th umb">{$sSe tAsThumbC} </a>   575   <a href="{ $site['url ']}group_a ctions.php ?ID={$iGro upID}&amp; a=def&amp; img={$arrP ic['ID']}"  class="gr oup_set_th umb">{$sSe tAsThumbC} </a>
578   EOF;   576   EOF;
579                }   577                }
580     578  
581                if( $aGr oupInfo['c reatorID']  == $iMemb erID or $a rrPic['by' ] == $iMem berID ) {   579                if( $aGr oupInfo['c reatorID']  == $iMemb erID or $a rrPic['by' ] == $iMem berID ) {
582                    $sRe tHtml .= < <<EOF   580                    $sRe tHtml .= < <<EOF
583   <br />   581   <br />
584   <a href="{ $site['url ']}group_a ctions.php ?ID={$iGro upID}&amp; a=delimg&a mp;img={$a rrPic['ID' ]}" class= "group_set _thumb" on click="ret urn confir m('<?=_t(' _Are you s ure want t o delete t his image? ')?>');">{ $sDelImgC} </a>   582   <a href="{ $site['url ']}group_a ctions.php ?ID={$iGro upID}&amp; a=delimg&a mp;img={$a rrPic['ID' ]}" class= "group_set _thumb" on click="ret urn confir m('<?=_t(' _Are you s ure want t o delete t his image? ')?>');">{ $sDelImgC} </a>
585   EOF;   583   EOF;
586                }   584                }
587     585  
588                $sRetHtm l .= '</di v>';   586                $sRetHtm l .= '</di v>';
589           }   587           }
590     588  
591           $s RetHtml .=  '<div cla ss="clear_ both"></di v></div>';   589           $s RetHtml .=  '<div cla ss="clear_ both"></di v></div>';
592     590  
593           if ( ( (int)$ aGroupInfo ['members_ post_image s'] and $t his->isGro upMember(  $iMemberID , $iGroupI D ) ) or $ aGroupInfo ['creatorI D'] == $iM emberID )  {   591           if ( ( (int)$ aGroupInfo ['members_ post_image s'] and $t his->isGro upMember(  $iMemberID , $iGroupI D ) ) or $ aGroupInfo ['creatorI D'] == $iM emberID )  {
594                $sRetHtm l .= <<<EO F   592                $sRetHtm l .= <<<EO F
595   <a href="{ $site['url ']}group_a ctions.php ?a=upload& ID={$iGrou pID}" clas s="actions ">{$sUploa dImageC}</ a>   593   <a href="{ $site['url ']}group_a ctions.php ?a=upload& ID={$iGrou pID}" clas s="actions ">{$sUploa dImageC}</ a>
596   EOF;   594   EOF;
597           }   595           }
598     596  
599           re turn $sRet Html;   597           re turn $sRet Html;
600       }   598       }
601     599  
602       functi on PCEditG roupFormPa ge($iGroup ID, $iMemb erID) {   600       functi on PCEditG roupFormPa ge($iGroup ID, $iMemb erID) {
603           $s MainCode =  '';   601           $s MainCode =  '';
604           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {   602           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {
605                if ( $aG roupInfo[' creatorID' ] == $iMem berID ) // only creat or can edi t group   603                if ( $aG roupInfo[' creatorID' ] == $iMem berID ) // only creat or can edi t group
606                    $sMa inCode = $ this->PCEd itGroupFor m($iGroupI D, $iMembe rID, $aGro upInfo);   604                    $sMa inCode = $ this->PCEd itGroupFor m($iGroupI D, $iMembe rID, $aGro upInfo);
607                else   605                else
608                    $sMa inCode = _ t( "_You'r e not crea tor" );   606                    $sMa inCode = _ t( "_You'r e not crea tor" );
609           }   607           }
610           el se   608           el se
611                $sMainCo de = _t( " _Group not  found_des c" );   609                $sMainCo de = _t( " _Group not  found_des c" );
612           re turn $sMai nCode;   610           re turn $sMai nCode;
613       }   611       }
614     612  
615       functi on PCEditG roupForm($ iGroupID,  $iMemberID , $aGroupI nfo) {   613       functi on PCEditG roupForm($ iGroupID,  $iMemberID , $aGroupI nfo) {
616           gl obal $site ;   614           gl obal $site ;
617     615  
618           $a rrGroupFie lds = $thi s->getDefa ultGroupEd itArr();   616           $a rrGroupFie lds = $thi s->getDefa ultGroupEd itArr();
619           $t his->fillG roupArrByD BValues( $ arrGroupFi elds, $aGr oupInfo );   617           $t his->fillG roupArrByD BValues( $ arrGroupFi elds, $aGr oupInfo );
620           $a Error = ar ray();   618           $a Error = ar ray();
621     619  
622           if ( isset( $ _POST['do_ submit'] )  ) {   620           if ( isset( $ _POST['do_ submit'] )  ) {
623                $arrOldG roupFields  = $arrGro upFields;   621                $arrOldG roupFields  = $arrGro upFields;
624                $this->f illGroupAr rByPostVal ues( $arrG roupFields  );   622                $this->f illGroupAr rByPostVal ues( $arrG roupFields  );
625                $arrUpdG roupFields  = $this-> compareUpd atedGroupF ields( $ar rOldGroupF ields, $ar rGroupFiel ds );   623                $arrUpdG roupFields  = $this-> compareUpd atedGroupF ields( $ar rOldGroupF ields, $ar rGroupFiel ds );
626     624  
627                $sGroupL ink = $thi s->getGrou pUrl($iGro upID, $aGr oupInfo['U ri']);   625                $sGroupL ink = $thi s->getGrou pUrl($iGro upID, $aGr oupInfo['U ri']);
628     626  
629                if( !emp ty( $arrUp dGroupFiel ds ) ) {   627                if( !emp ty( $arrUp dGroupFiel ds ) ) {
630                    $aEr ror = $thi s->checkGr oupErrors(  $arrUpdGr oupFields  );   628                    $aEr ror = $thi s->checkGr oupErrors(  $arrUpdGr oupFields  );
631     629  
632                    if(  empty( $aE rror ) ) {   630                    if(  empty( $aE rror ) ) {
633                         $this->sav eGroup( $a rrUpdGroup Fields, $i GroupID );   631                         $this->sav eGroup( $a rrUpdGroup Fields, $i GroupID );
634                         Header( "L ocation: { $sGroupLin k}" );   632                         Header( "L ocation: { $sGroupLin k}" );
635                         exit;   633                         exit;
636                    }   634                    }
637                } else {   635                } else {
638                    Head er( "Locat ion: {$sGr oupLink}"  );   636                    Head er( "Locat ion: {$sGr oupLink}"  );
639                    exit ;   637                    exit ;
640                }   638                }
641           }   639           }
642     640  
643           $r es = $this ->genGroup EditForm(  $arrGroupF ields, $aE rror, fals e, $iGroup ID );   641           $r es = $this ->genGroup EditForm(  $arrGroupF ields, $aE rror, fals e, $iGroup ID );
644           re turn $res;   642           re turn $res;
645       }   643       }
646     644  
647       functi on PCCreat eForm($iMe mberID) {   645       functi on PCCreat eForm($iMe mberID) {
648           gl obal $site ;   646           gl obal $site ;
649     647  
650           $a rrNewGroup  = $this-> getDefault GroupEditA rr();   648           $a rrNewGroup  = $this-> getDefault GroupEditA rr();
651           $a Error = ar ray();   649           $a Error = ar ray();
652     650  
653           if ( isset( $ _POST['do_ submit'] )  ) {   651           if ( isset( $ _POST['do_ submit'] )  ) {
654                $this->f illGroupAr rByPostVal ues( $arrN ewGroup );   652                $this->f illGroupAr rByPostVal ues( $arrN ewGroup );
655                $aError  = $this->c heckGroupE rrors( $ar rNewGroup  );   653                $aError  = $this->c heckGroupE rrors( $ar rNewGroup  );
656     654  
657                if( md5(  $_POST['s img'] ) !=  $_COOKIE[ 'strSec']  )   655                if( md5(  $_POST['s img'] ) !=  $_COOKIE[ 'strSec']  )
658                    $aEr ror['simg' ] = 'SIMG_ ERR';   656                    $aEr ror['simg' ] = 'SIMG_ ERR';
659                unset( $ _COOKIE['s trSec'] );   657                unset( $ _COOKIE['s trSec'] );
660     658  
661                if( empt y( $aError  ) ) {   659                if( empt y( $aError  ) ) {
662                    $arr NewGroup[' creatorID' ] = array( 'Name' =>  'creatorID ','Type' = > 'text',' Value' =>  $iMemberID );   660                    $arr NewGroup[' creatorID' ] = array( 'Name' =>  'creatorID ','Type' = > 'text',' Value' =>  $iMemberID );
663                    $arr NewGroup[' Uri'] = ar ray('Name'  => 'Uri', 'Type' =>  'text',   661                    $arr NewGroup[' Uri'] = ar ray('Name'  => 'Uri', 'Type' =>  'text',
664                         'Value' =>  uriGenera te($arrNew Group['Nam e']['Value '], 'Group s', 'Uri',  255) );   662                         'Value' =>  uriGenera te($arrNew Group['Nam e']['Value '], 'Group s', 'Uri',  255) );
665                    $new GroupID =  $this->sav eGroup( $a rrNewGroup  );   663                    $new GroupID =  $this->sav eGroup( $a rrNewGroup  );
666                    if(  $newGroupI D ) {   664                    if(  $newGroupI D ) {
667                         $this->add Member2Gro up( $iMemb erID, $new GroupID, ' Active' );   665                         $this->add Member2Gro up( $iMemb erID, $new GroupID, ' Active' );
668     666  
669                         $groupHome Link = "{$ site['url' ]}{$this-> sCurrFile} ?action=gr oup&amp;ID ={$newGrou pID}";   667                         $groupHome Link = "{$ site['url' ]}{$this-> sCurrFile} ?action=gr oup&amp;ID ={$newGrou pID}";
670                         $res = _t(  '_Group c reation su ccessful',  $groupHom eLink );   668                         $res = _t(  '_Group c reation su ccessful',  $groupHom eLink );
671                         $res .= "< br />";   669                         $res .= "< br />";
672                         $res .= _t ('_Gallery  upload_de sc');   670                         $res .= _t ('_Gallery  upload_de sc');
673                         $res .= $t his->genUp loadForm(  $newGroupI D, true, t rue );   671                         $res .= $t his->genUp loadForm(  $newGroupI D, true, t rue );
674                    } el se   672                    } el se
675                         $res = _t( '_Group cr eation unk nown error ');   673                         $res = _t( '_Group cr eation unk nown error ');
676                    retu rn $res;   674                    retu rn $res;
677                }   675                }
678           }   676           }
679     677  
680           $r es = $this ->genGroup EditForm(  $arrNewGro up, $aErro r, true );   678           $r es = $this ->genGroup EditForm(  $arrNewGro up, $aErro r, true );
681           re turn $res;   679           re turn $res;
682       }   680       }
683     681  
684       functi on GenGrou pMainPage( $iGroupID,  $iMemberI D) {   682       functi on GenGrou pMainPage( $iGroupID,  $iMemberI D) {
685           gl obal $logg ed;   683           gl obal $logg ed;
686           gl obal $site ;   684           gl obal $site ;
687           gl obal $aPre Values;   685           gl obal $aPre Values;
688     686  
689           // $bPermalin k = getPar am('permal inks_group s') == 'on ' ? true :  false;   687           // $bPermalin k = getPar am('permal inks_group s') == 'on ' ? true :  false;
690     688  
691           // ret vals   689           // ret vals
692           $i NameIndex  = 71;   690           $i NameIndex  = 71;
693           $s Header = ' ';   691           $s Header = ' ';
694           $s HeaderT =  '';   692           $s HeaderT =  '';
695           $s MainCode =  '';   693           $s MainCode =  '';
696     694  
697           $s GrpBrd = ' ';   695           $s GrpBrd = ' ';
698           $s GrpLCat =  '';   696           $s GrpLCat =  '';
699           $s GrpLCreate d = '';   697           $s GrpLCreate d = '';
700           $s GrpLLocati on = '';   698           $s GrpLLocati on = '';
701           $s GrpLMember Count = '' ;   699           $s GrpLMember Count = '' ;
702           $s GrpLCreato r = '';   700           $s GrpLCreato r = '';
703           $s GrpLAbout  = '';   701           $s GrpLAbout  = '';
704           $s GrpLType =  '';   702           $s GrpLType =  '';
705           $s GrpLTypeHe lp = '';   703           $s GrpLTypeHe lp = '';
706     704  
707           $s GrpVImage  = '';   705           $s GrpVImage  = '';
708           $s GrpVGalLin k = '';   706           $s GrpVGalLin k = '';
709           $s GrpVCreato rThumb = ' ';   707           $s GrpVCreato rThumb = ' ';
710           $s GrpVCreato rLink = '' ;   708           $s GrpVCreato rLink = '' ;
711           $s GrpVCat =  '';   709           $s GrpVCat =  '';
712           $s GrpVCatLin k = '';   710           $s GrpVCatLin k = '';
713           $s GrpVType =  '';   711           $s GrpVType =  '';
714           $s GrpVCreate d = '';   712           $s GrpVCreate d = '';
715           $s GrpVCountr y = '';   713           $s GrpVCountr y = '';
716           $s GrpVCity =  '';   714           $s GrpVCity =  '';
717           $s GrpVMCount  = '';   715           $s GrpVMCount  = '';
718           $s GrpVAbout  = '';   716           $s GrpVAbout  = '';
719           $s GrpVDesc =  '';   717           $s GrpVDesc =  '';
720           $s GrpVStatus  = '';   718           $s GrpVStatus  = '';
721           $s GrpVAction s = '';   719           $s GrpVAction s = '';
722           $s GrpVMember s = '';   720           $s GrpVMember s = '';
723           $s GrpVForum  = '';   721           $s GrpVForum  = '';
724     722  
725           $d ate_format _php = get Param('php _date_form at');   723           $d ate_format _php = get Param('php _date_form at');
726     724  
727           if  ( !$aGrou pInfo = $t his->getGr oupInfo( $ iGroupID )  ) {   725           if  ( !$aGrou pInfo = $t his->getGr oupInfo( $ iGroupID )  ) {
728                $iNameIn dex = 0;   726                $iNameIn dex = 0;
729                $sHeader  = _t( "_G roup not f ound" );   727                $sHeader  = _t( "_G roup not f ound" );
730                $sHeader T = _t( "_ Group not  found" );   728                $sHeader T = _t( "_ Group not  found" );
731                $sMainCo de = _t( " _Group not  found_des c" );   729                $sMainCo de = _t( " _Group not  found_des c" );
732           }  else {   730           }  else {
733                if( (int )$aGroupIn fo['hidden _group'] a nd !$this- >isGroupMe mber( $iMe mberID, $i GroupID )  and !$logg ed['admin' ] ) {    731                if( (int )$aGroupIn fo['hidden _group'] a nd !$this- >isGroupMe mber( $iMe mberID, $i GroupID )  and !$logg ed['admin' ] ) { 
734                    $iNa meIndex =  0;   732                    $iNa meIndex =  0;
735                    $sHe ader = _t(  "_Group i s hidden"  );   733                    $sHe ader = _t(  "_Group i s hidden"  );
736                    $sHe aderT = _t ( "_Group  is hidden"  );   734                    $sHe aderT = _t ( "_Group  is hidden"  );
737                    $sMa inCode = _ t( "_Sorry , group is  hidden" ) ;   735                    $sMa inCode = _ t( "_Sorry , group is  hidden" ) ;
738                } else {   736                } else {
739                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {   737                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {
740                         $aGroupInf o['Name_ht ml'] = htm lspecialch ars_adv( $ aGroupInfo ['Name'] ) ;   738                         $aGroupInf o['Name_ht ml'] = htm lspecialch ars_adv( $ aGroupInfo ['Name'] ) ;
741     739  
742                         $sGroupsUr l = $this- >bUseFrien dlyLinks ?  'groups/a ll' : $thi s->sCurrFi le ;   740                         $sGroupsUr l = $this- >bUseFrien dlyLinks ?  'groups/a ll' : $thi s->sCurrFi le ;
743                         $sBreadCru mbs = <<<E OJ   741                         $sBreadCru mbs = <<<E OJ
744   <div class ="groups_b readcrumbs ">   742   <div class ="groups_b readcrumbs ">
745       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /   743       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /
746       <a hre f="{$site[ 'url']}{$s GroupsUrl} ">__Groups __</a> /   744       <a hre f="{$site[ 'url']}{$s GroupsUrl} ">__Groups __</a> /
747       <span  class="act ive_link"> {$aGroupIn fo['Name_h tml']}</sp an>   745       <span  class="act ive_link"> {$aGroupIn fo['Name_h tml']}</sp an>
748   </div>   746   </div>
749   EOJ;   747   EOJ;
750     748  
751                         $sBreadCru mbs = str_ replace( " __Groups__ ", _t( "_G roups" ),  $sBreadCru mbs );   749                         $sBreadCru mbs = str_ replace( " __Groups__ ", _t( "_G roups" ),  $sBreadCru mbs );
752     750  
753                         $sHeader =  "{$site[' title']} /  " . _t( " _Groups" )  . " / {$a GroupInfo[ 'Name_html ']}";   751                         $sHeader =  "{$site[' title']} /  " . _t( " _Groups" )  . " / {$a GroupInfo[ 'Name_html ']}";
754                         $sHeaderT  = $aGroupI nfo['Name_ html'];   752                         $sHeaderT  = $aGroupI nfo['Name_ html'];
755     753  
756                         //$_page_c ont[$_ni][ 'groups_br eadcrumbs' ] = $sBrea dCrumbs;   754                         //$_page_c ont[$_ni][ 'groups_br eadcrumbs' ] = $sBrea dCrumbs;
757                         $sGrpBrd =  $sBreadCr umbs;   755                         $sGrpBrd =  $sBreadCr umbs;
758     756  
759                         // begin g roup info   757                         // begin g roup info
760     758  
761                         if( (int)$ aGroupInfo ['hidden_g roup'] )   759                         if( (int)$ aGroupInfo ['hidden_g roup'] )
762                             $typeH elp = 7;   760                             $typeH elp = 7;
763                         else   761                         else
764                             if( (i nt)$aGroup Info['open _join'] )   762                             if( (i nt)$aGroup Info['open _join'] )
765                                 $t ypeHelp =  5;   763                                 $t ypeHelp =  5;
766                             else   764                             else
767                                 $t ypeHelp =  6;   765                                 $t ypeHelp =  6;
768     766  
769                         $typeHelpL ink = "{$s ite['url'] }{$this->s CurrFile}? action=hel p&amp;i={$ typeHelp}" ;   767                         $typeHelpL ink = "{$s ite['url'] }{$this->s CurrFile}? action=hel p&amp;i={$ typeHelp}" ;
770     768  
771                         // labels   769                         // labels
772                         $sGrpLCat  = _t( "_Ca tegory" );   770                         $sGrpLCat  = _t( "_Ca tegory" );
773                         //$_page_c ont[$_ni][ 'category_ l']      =  _t( "_Cat egory" );   771                         //$_page_c ont[$_ni][ 'category_ l']      =  _t( "_Cat egory" );
774                         $sGrpLCrea ted = _t(  "_Created"  );   772                         $sGrpLCrea ted = _t(  "_Created"  );
775                         //$_page_c ont[$_ni][ 'created_l ']       =  _t( "_Cre ated" );   773                         //$_page_c ont[$_ni][ 'created_l ']       =  _t( "_Cre ated" );
776                         $sGrpLLoca tion = _t(  "_Locatio n" );   774                         $sGrpLLoca tion = _t(  "_Locatio n" );
777                         //$_page_c ont[$_ni][ 'location_ l']      =  _t( "_Loc ation" );   775                         //$_page_c ont[$_ni][ 'location_ l']      =  _t( "_Loc ation" );
778                         $sGrpLMemb erCount =  _t( "_Memb ers count"  );   776                         $sGrpLMemb erCount =  _t( "_Memb ers count"  );
779                         //$_page_c ont[$_ni][ 'members_c ount_l'] =  _t( "_Mem bers count " );   777                         //$_page_c ont[$_ni][ 'members_c ount_l'] =  _t( "_Mem bers count " );
780                         $sGrpLCrea tor = _t(  "_Group cr eator" );   778                         $sGrpLCrea tor = _t(  "_Group cr eator" );
781                         //$_page_c ont[$_ni][ 'group_cre ator_l'] =  _t( "_Gro up creator " );   779                         //$_page_c ont[$_ni][ 'group_cre ator_l'] =  _t( "_Gro up creator " );
782                         $sGrpLAbou t = _t( "_ About grou p" );   780                         $sGrpLAbou t = _t( "_ About grou p" );
783                         //$_page_c ont[$_ni][ 'group_abo ut_l']   =  _t( "_Abo ut group"  );   781                         //$_page_c ont[$_ni][ 'group_abo ut_l']   =  _t( "_Abo ut group"  );
784                         $sGrpLType  = _t( "_G roup type"  );   782                         $sGrpLType  = _t( "_G roup type"  );
785                         //$_page_c ont[$_ni][ 'group_typ e_l']    =  _t( "_Gro up type" ) ;   783                         //$_page_c ont[$_ni][ 'group_typ e_l']    =  _t( "_Gro up type" ) ;
786                         $sGrpLType Help = '<a  href="'.$ typeHelpLi nk.'" targ et="_blank " onclick= "window.op en(this.hr ef,\'helpw in\',\'wid th=350,hei ght=200\') ;return fa lse;" >'._ t( "_help"  ).'</a>';   784                         $sGrpLType Help = '<a  href="'.$ typeHelpLi nk.'" targ et="_blank " onclick= "window.op en(this.hr ef,\'helpw in\',\'wid th=350,hei ght=200\') ;return fa lse;" >'._ t( "_help"  ).'</a>';
787                         //$_page_c ont[$_ni][ 'group_typ e_help'] =  '<a href= "'.$typeHe lpLink.'"  target="_b lank" oncl ick="windo w.open(thi s.href,\'h elpwin\',\ 'width=350 ,height=20 0\');retur n false;"  >'._t( "_h elp" ).'</ a>';   785                         //$_page_c ont[$_ni][ 'group_typ e_help'] =  '<a href= "'.$typeHe lpLink.'"  target="_b lank" oncl ick="windo w.open(thi s.href,\'h elpwin\',\ 'width=350 ,height=20 0\');retur n false;"  >'._t( "_h elp" ).'</ a>';
788     786  
789                         //info   787                         //info
790                         if ( $aGro upInfo['th umb'] and  file_exist s($this->s GrpGalPath  . "{$iGro upID}_{$aG roupInfo[' thumb']}_{ $aGroupInf o['seed']} _.{$aGroup Info['thum bExt']}" )  )   788                         if ( $aGro upInfo['th umb'] and  file_exist s($this->s GrpGalPath  . "{$iGro upID}_{$aG roupInfo[' thumb']}_{ $aGroupInf o['seed']} _.{$aGroup Info['thum bExt']}" )  )
791                             $group ImageUrl =  "{$site[' groups_gal lery']}{$i GroupID}_{ $aGroupInf o['thumb'] }_{$aGroup Info['seed ']}_.{$aGr oupInfo['t humbExt']} ";   789                             $group ImageUrl =  "{$site[' groups_gal lery']}{$i GroupID}_{ $aGroupInf o['thumb'] }_{$aGroup Info['seed ']}_.{$aGr oupInfo['t humbExt']} ";
792                         else   790                         else
793                             $group ImageUrl =  "{$site[' groups_gal lery']}no_ pic.gif";   791                             $group ImageUrl =  "{$site[' groups_gal lery']}no_ pic.gif";
794                           792                        
795                         $arrMem =  getProfile Info( $aGr oupInfo['c reatorID']  );   793                         $arrMem =  getProfile Info( $aGr oupInfo['c reatorID']  );
796                         $creatorNi ck = $arrM em['NickNa me'];   794                         $creatorNi ck = $arrM em['NickNa me'];
797     795  
798                         //<!--<img  src=\"$gr oupImageUr l\" />-->   796                         //<!--<img  src=\"$gr oupImageUr l\" />-->
799                         //$_page_c ont[$_ni][ 'group_ima ge']          = <<<EO F   797                         //$_page_c ont[$_ni][ 'group_ima ge']          = <<<EO F
800                         $sGrpVImag e = <<<EOF   798                         $sGrpVImag e = <<<EOF
801   <a   href="{$si te['url']} {$this->sC urrFile}?a ction=gall ery&ID={$i GroupID}">
  799   <a   href="{$si te['url']} {$this->sC urrFile}?a ction=gall ery&ID={$i GroupID}"> <img   src="{$thi s->sSpacer Icon}"   style="bac kground-im age:   url({$grou pImageUrl} );"   class="gro up_info_ma in_img"   alt=""   /></a>
802       <img s rc="{$this ->sSpacerI con}" styl e="width:1 10px;heigh t:110px; b ackground- image: url ({$groupIm ageUrl});"  class="ph oto1" alt= "" />    
803   </a>    
804   EOF;   800   EOF;
805                         $sGrpVGalL ink = "<a  href=\"{$s ite['url'] }{$this->s CurrFile}? action=gal lery&ID={$ iGroupID}\ ">" . _t(  "_Group ga llery" ) .  "</a>";   801                         $sGrpVGalL ink = "<a  href=\"{$s ite['url'] }{$this->s CurrFile}? action=gal lery&ID={$ iGroupID}\ ">" . _t(  "_Group ga llery" ) .  "</a>";
806                         //$_page_c ont[$_ni][ 'group_gal lery_link' ]  = "<a h ref=\"{$si te['url']} {$this->sC urrFile}?a ction=gall ery&ID={$i GroupID}\" >" . _t( " _Group gal lery" ) .  "</a>";   802                         //$_page_c ont[$_ni][ 'group_gal lery_link' ]  = "<a h ref=\"{$si te['url']} {$this->sC urrFile}?a ction=gall ery&ID={$i GroupID}\" >" . _t( " _Group gal lery" ) .  "</a>";
807     803  
808                         $sGrpVCrea torThumb   =   get_member _thumbnail (   $aGroupInf o['creator ID'],   'none'  
);
  804                         $sGrpVCrea torThumb   =   get_member _thumbnail (   $aGroupInf o['creator ID'],   'none' ,   false   );
809                         //$_page_c ont[$_ni][ 'group_cre ator_thumb '] = get_m ember_thum bnail( $aG roupInfo[' creatorID' ], 'none'  );   805                         //$_page_c ont[$_ni][ 'group_cre ator_thumb '] = get_m ember_thum bnail( $aG roupInfo[' creatorID' ], 'none'  );
810                         $sGrpVCrea torLink  =  "<a href= \"{$site[' url']}{$cr eatorNick} \">".htmls pecialchar s_adv($cre atorNick). "</a>";   806                         $sGrpVCrea torLink  =  "<a href= \"{$site[' url']}{$cr eatorNick} \">".htmls pecialchar s_adv($cre atorNick). "</a>";
811                         //$_page_c ont[$_ni][ 'group_cre ator_link' ]  = "<a h ref=\"{$si te['url']} {$creatorN ick}\">".h tmlspecial chars_adv( $creatorNi ck)."</a>" ;   807                         //$_page_c ont[$_ni][ 'group_cre ator_link' ]  = "<a h ref=\"{$si te['url']} {$creatorN ick}\">".h tmlspecial chars_adv( $creatorNi ck)."</a>" ;
812     808  
813                         $sGrpVCat  = htmlspec ialchars_a dv(  $aGro upInfo['ca tegName']  );   809                         $sGrpVCat  = htmlspec ialchars_a dv(  $aGro upInfo['ca tegName']  );
814                         //$_page_c ont[$_ni][ 'category' ]             = htmls pecialchar s_adv(  $a GroupInfo[ 'categName '] );   810                         //$_page_c ont[$_ni][ 'category' ]             = htmls pecialchar s_adv(  $a GroupInfo[ 'categName '] );
815                         $sCategUrl  = $this-> getGroupsC ategUrl($a GroupInfo[ 'categID'] , $aGroupI nfo['categ Uri']);   811                         $sCategUrl  = $this-> getGroupsC ategUrl($a GroupInfo[ 'categID'] , $aGroupI nfo['categ Uri']);
816                         $sGrpVCatL ink = "<a  href=\"$sC ategUrl\"> {$aGroupIn fo['categN ame']}</a> ";   812                         $sGrpVCatL ink = "<a  href=\"$sC ategUrl\"> {$aGroupIn fo['categN ame']}</a> ";
817                         //$_page_c ont[$_ni][ 'category_ link']        = "<a h ref=\"$sCa tegUrl\">{ $aGroupInf o['categNa me']}</a>" ;   813                         //$_page_c ont[$_ni][ 'category_ link']        = "<a h ref=\"$sCa tegUrl\">{ $aGroupInf o['categNa me']}</a>" ;
818     814  
819                         $sGrpVType  = _t( ( (  (int)$aGr oupInfo['o pen_join']  and !(int )$aGroupIn fo['hidden _group'] )  ? '_Publi c group' :  '_Private  group' )  );   815                         $sGrpVType  = _t( ( (  (int)$aGr oupInfo['o pen_join']  and !(int )$aGroupIn fo['hidden _group'] )  ? '_Publi c group' :  '_Private  group' )  );
820                         //$_page_c ont[$_ni][ 'group_typ e']           = _t( (  ( (int)$a GroupInfo[ 'open_join '] and !(i nt)$aGroup Info['hidd en_group']  ) ? '_Pub lic group'  : '_Priva te group'  ) );   816                         //$_page_c ont[$_ni][ 'group_typ e']           = _t( (  ( (int)$a GroupInfo[ 'open_join '] and !(i nt)$aGroup Info['hidd en_group']  ) ? '_Pub lic group'  : '_Priva te group'  ) );
821                        
$sGrpVCrea ted   =   date(   $date_form at_php,   strtotime(   $aGroupInf o['created ']   )   );
  817                         // $sGrpVCrea ted   =   date(   $date_form at_php,   strtotime(   $aGroupInf o['created ']   )   );
    818                         $sGrpVCrea ted = Loca ledDataTim e($aGroupI nfo['creat ed_UTS']);
822                         //$_page_c ont[$_ni][ 'created']               = date(  $date_for mat_php, s trtotime(  $aGroupInf o['created '] ) );   819                         //$_page_c ont[$_ni][ 'created']               = date(  $date_for mat_php, s trtotime(  $aGroupInf o['created '] ) );
823                         $sGrpVCoun try = _t(  $aPreValue s['Country '][ $aGrou pInfo['Cou ntry'] ][' LKey'] );   820                         $sGrpVCoun try = _t(  $aPreValue s['Country '][ $aGrou pInfo['Cou ntry'] ][' LKey'] );
824                         //$_page_c ont[$_ni][ 'country']               = _t( $ aPreValues ['Country' ][ $aGroup Info['Coun try'] ]['L Key'] );   821                         //$_page_c ont[$_ni][ 'country']               = _t( $ aPreValues ['Country' ][ $aGroup Info['Coun try'] ]['L Key'] );
825                         $sGrpVMCit y = htmlsp ecialchars _adv( $aGr oupInfo['C ity'] );   822                         $sGrpVMCit y = htmlsp ecialchars _adv( $aGr oupInfo['C ity'] );
826                         //$_page_c ont[$_ni][ 'city']                  = htmls pecialchar s_adv( $aG roupInfo[' City'] );   823                         //$_page_c ont[$_ni][ 'city']                  = htmls pecialchar s_adv( $aG roupInfo[' City'] );
827                         $sGrpVMCou nt = $aGro upInfo['me mbersCount '];   824                         $sGrpVMCou nt = $aGro upInfo['me mbersCount '];
828                         //$_page_c ont[$_ni][ 'members_c ount']        = $aGro upInfo['me mbersCount '];   825                         //$_page_c ont[$_ni][ 'members_c ount']        = $aGro upInfo['me mbersCount '];
829                         $sGrpVAbou t = htmlsp ecialchars _adv( $aGr oupInfo['A bout'] );   826                         $sGrpVAbou t = htmlsp ecialchars _adv( $aGr oupInfo['A bout'] );
830                         //$_page_c ont[$_ni][ 'group_abo ut']          = htmls pecialchar s_adv( $aG roupInfo[' About'] );   827                         //$_page_c ont[$_ni][ 'group_abo ut']          = htmls pecialchar s_adv( $aG roupInfo[' About'] );
831                         $sGrpVDesc  = $aGroup Info['Desc ']; //no h tmlspecial chars   828                         $sGrpVDesc  = $aGroup Info['Desc ']; //no h tmlspecial chars
832                         //$_page_c ont[$_ni][ 'group_des cription']    = $aGro upInfo['De sc']; //no  htmlspeci alchars   829                         //$_page_c ont[$_ni][ 'group_des cription']    = $aGro upInfo['De sc']; //no  htmlspeci alchars
833     830  
834                         if( $aGrou pInfo['sta tus'] != ' Active' )  {   831                         if( $aGrou pInfo['sta tus'] != ' Active' )  {
835                             //$_pa ge_cont[$_ ni]['group _status']     = _t( ' _Group sta tus' ) . ' : ' .   832                             //$_pa ge_cont[$_ ni]['group _status']     = _t( ' _Group sta tus' ) . ' : ' .
836                             $sGrpV Status = _ t( '_Group  status' )  . ': ' .   833                             $sGrpV Status = _ t( '_Group  status' )  . ': ' .
837                               '<sp an style=" color:red; font-weigh t:bold;">'  . _t( '_'  . $aGroup Info['stat us'] ) .'< /span>' .   834                               '<sp an style=" color:red; font-weigh t:bold;">'  . _t( '_'  . $aGroup Info['stat us'] ) .'< /span>' .
838                               " (< a href=\"{ $site['url ']}{$this- >sCurrFile }?action=h elp&amp;i= 8\" target =\"_blank\ " onclick= \"window.o pen(this.h ref,'helpw in','width =350,heigh t=200');re turn false ;\">"._t(  "_Explanat ion" )."</ a>)";   835                               " (< a href=\"{ $site['url ']}{$this- >sCurrFile }?action=h elp&amp;i= 8\" target =\"_blank\ " onclick= \"window.o pen(this.h ref,'helpw in','width =350,heigh t=200');re turn false ;\">"._t(  "_Explanat ion" )."</ a>)";
839                         } else   836                         } else
840                             //$_pa ge_cont[$_ ni]['group _status']     = '';   837                             //$_pa ge_cont[$_ ni]['group _status']     = '';
841                             $sGrpV Status = ' ';   838                             $sGrpV Status = ' ';
842     839  
843                         //end grou p info   840                         //end grou p info
844     841  
845                         $sGrpVActi ons = $thi s->PCGroup Actions($a GroupInfo,  $iGroupID , $iMember ID);   842                         $sGrpVActi ons = $thi s->PCGroup Actions($a GroupInfo,  $iGroupID , $iMember ID);
846                         //$_page_c ont[$_ni][ 'group_act ions']        = $this ->PCGroupA ctions($aG roupInfo);   843                         //$_page_c ont[$_ni][ 'group_act ions']        = $this ->PCGroupA ctions($aG roupInfo);
847                         $sGrpVMemb ers = $thi s->PCGroup Members($a GroupInfo,  $iGroupID , $iMember ID);   844                         $sGrpVMemb ers = $thi s->PCGroup Members($a GroupInfo,  $iGroupID , $iMember ID);
848                         //$_page_c ont[$_ni][ 'group_mem bers']        = $this ->PCGroupM embers($aG roupInfo);   845                         //$_page_c ont[$_ni][ 'group_mem bers']        = $this ->PCGroupM embers($aG roupInfo);
849                         $sGrpVForu m = $this- >PCGroupFo rum($aGrou pInfo, $iG roupID, $i MemberID);   846                         $sGrpVForu m = $this- >PCGroupFo rum($aGrou pInfo, $iG roupID, $i MemberID);
850                         //$_page_c ont[$_ni][ 'group_for um']          = $this ->PCGroupF orum();   847                         //$_page_c ont[$_ni][ 'group_for um']          = $this ->PCGroupF orum();
851                    } el se {   848                    } el se {
852                         $iNameInde x = 0;   849                         $iNameInde x = 0;
853                         $sHeader =  _t( "_Gro up is susp ended" );   850                         $sHeader =  _t( "_Gro up is susp ended" );
854                         $sHeaderT  = _t( "_Gr oup is sus pended" );   851                         $sHeaderT  = _t( "_Gr oup is sus pended" );
855                         $sMainCode  = _t( "_S orry, grou p is suspe nded" );   852                         $sMainCode  = _t( "_S orry, grou p is suspe nded" );
856                    }   853                    }
857                }   854                }
858           }   855           }
859     856  
860           re turn array ($iNameInd ex, $sHead er, $sHead erT, $sMai nCode, $sG rpBrd, $sG rpLCat, $s GrpLCreate d, $sGrpLL ocation, $ sGrpLMembe rCount, $s GrpLCreato r, $sGrpLA bout, $sGr pLType, $s GrpLTypeHe lp, $sGrpV Image, $sG rpVGalLink , $sGrpVCr eatorThumb , $sGrpVCr eatorLink,  $sGrpVCat , $sGrpVCa tLink, $sG rpVType, $ sGrpVCreat ed, $sGrpV Country, $ sGrpVCity,  $sGrpVMCo unt, $sGrp VAbout, $s GrpVDesc,  $sGrpVStat us, $sGrpV Actions, $ sGrpVMembe rs, $sGrpV Forum);   857           re turn array ($iNameInd ex, $sHead er, $sHead erT, $sMai nCode, $sG rpBrd, $sG rpLCat, $s GrpLCreate d, $sGrpLL ocation, $ sGrpLMembe rCount, $s GrpLCreato r, $sGrpLA bout, $sGr pLType, $s GrpLTypeHe lp, $sGrpV Image, $sG rpVGalLink , $sGrpVCr eatorThumb , $sGrpVCr eatorLink,  $sGrpVCat , $sGrpVCa tLink, $sG rpVType, $ sGrpVCreat ed, $sGrpV Country, $ sGrpVCity,  $sGrpVMCo unt, $sGrp VAbout, $s GrpVDesc,  $sGrpVStat us, $sGrpV Actions, $ sGrpVMembe rs, $sGrpV Forum);
861       }   858       }
862     859  
863       functi on GenMemb ersPage()  {   860       functi on GenMemb ersPage()  {
864           gl obal $logg ed;   861           gl obal $logg ed;
865     862  
866           if ( $logged[ 'member']  = member_a uth( 0, fa lse ) )   863           if ( $logged[ 'member']  = member_a uth( 0, fa lse ) )
867                $iMember ID = (int) $_COOKIE[' memberID'] ;   864                $iMember ID = (int) $_COOKIE[' memberID'] ;
868           el se {   865           el se {
869                $iMember ID = 0;   866                $iMember ID = 0;
870                $logged[ 'admin'] =  member_au th( 1, fal se );   867                $logged[ 'admin'] =  member_au th( 1, fal se );
871           }   868           }
872     869  
873           $i GroupID =  (int)$_REQ UEST['ID'] ;   870           $i GroupID =  (int)$_REQ UEST['ID'] ;
874     871  
875           $s BreadCrumb Res = '';   872           $s BreadCrumb Res = '';
876           $s Pagination Res = '';   873           $s Pagination Res = '';
877           $s ShowingRes ultsRes =  '';   874           $s ShowingRes ultsRes =  '';
878           $s HeaderT =  '';   875           $s HeaderT =  '';
879           $s Header = ' ';   876           $s Header = ' ';
880           $s PageMainCo de = '';   877           $s PageMainCo de = '';
881           $i NameIndex  = 77;   878           $i NameIndex  = 77;
882     879  
883           if  ( !$iGrou pID ) {   880           if  ( !$iGrou pID ) {
884                Header(  "Location:  {$site['u rl']}{$thi s->sCurrFi le}" );   881                Header(  "Location:  {$site['u rl']}{$thi s->sCurrFi le}" );
885                exit;   882                exit;
886           }   883           }
887     884  
888           $s HeaderT =  _t( "_Grou p members"  );   885           $s HeaderT =  _t( "_Grou p members"  );
889           $s Header = _ t( "_Group  members"  );   886           $s Header = _ t( "_Group  members"  );
890     887  
891           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {   888           if  ( $aGroup Info = $th is->getGro upInfo( $i GroupID )  ) {
892                $aGroupI nfo['Name_ html'] = h tmlspecial chars_adv(  $aGroupIn fo['Name']  );   889                $aGroupI nfo['Name_ html'] = h tmlspecial chars_adv(  $aGroupIn fo['Name']  );
893     890  
894                if ( (in t)$aGroupI nfo['hidde n_group']  and !$this ->isGroupM ember( $iM emberID, $ iGroupID )  and !$log ged['admin '] )   891                if ( (in t)$aGroupI nfo['hidde n_group']  and !$this ->isGroupM ember( $iM emberID, $ iGroupID )  and !$log ged['admin '] )
895                    $sPa geMainCode  = _t( "_Y ou cannot  view group  members w hile not a  group mem ber" );   892                    $sPa geMainCode  = _t( "_Y ou cannot  view group  members w hile not a  group mem ber" );
896                else {   893                else {
897                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {   894                    if(  $aGroupInf o['status' ] == 'Acti ve' or $aG roupInfo[' creatorID' ] == $iMem berID or $ logged['ad min'] ) {
898                         $sHeader =  _t( "_Gro up members " );   895                         $sHeader =  _t( "_Gro up members " );
899                         list($sBre adCrumb, $ sPaginatio n, $sShowR esult, $sM ainCode) =  $this->PC ShowGroupM embers($iG roupID, $a GroupInfo,  $iMemberI D);   896                         list($sBre adCrumb, $ sPaginatio n, $sShowR esult, $sM ainCode) =  $this->PC ShowGroupM embers($iG roupID, $a GroupInfo,  $iMemberI D);
900                         $sBreadCru mbRes = $s BreadCrumb ;   897                         $sBreadCru mbRes = $s BreadCrumb ;
901                         $sPaginati onRes = $s Pagination ;   898                         $sPaginati onRes = $s Pagination ;
902                         $sPageMain Code = $sM ainCode;   899                         $sPageMain Code = $sM ainCode;
903                         $sShowingR esultsRes  = $sShowRe sult;   900                         $sShowingR esultsRes  = $sShowRe sult;
904                    } el se {   901                    } el se {
905                         $iNameInde x = 0;   902                         $iNameInde x = 0;
906                         $sHeader =  _t( "_Gro up is susp ended" );   903                         $sHeader =  _t( "_Gro up is susp ended" );
907                         $sHeaderT  = _t( "_Gr oup is sus pended" );   904                         $sHeaderT  = _t( "_Gr oup is sus pended" );
908                         $sPageMain Code = _t(  "_Sorry,  group is s uspended"  );   905                         $sPageMain Code = _t(  "_Sorry,  group is s uspended"  );
909                    }   906                    }
910                }   907                }
911           }  else   908           }  else
912                $sPageMa inCode = _ t( "_Group  not found _desc" );   909                $sPageMa inCode = _ t( "_Group  not found _desc" );
913     910  
914           re turn array ($sHeaderT , $sHeader , $sPageMa inCode, $i NameIndex,  $sBreadCr umbRes, $s Pagination Res, $sSho wingResult sRes);   911           re turn array ($sHeaderT , $sHeader , $sPageMa inCode, $i NameIndex,  $sBreadCr umbRes, $s Pagination Res, $sSho wingResult sRes);
915       }   912       }
916     913  
917       functi on PCShowG roupMember s($iGroupI D, $aGroup Info, $iMe mberID) {   914       functi on PCShowG roupMember s($iGroupI D, $aGroup Info, $iMe mberID) {
918           gl obal $site ;   915           gl obal $site ;
919           gl obal $oTem plConfig;   916           gl obal $oTem plConfig;
920     917  
921           $s BreadCrumb  = '';   918           $s BreadCrumb  = '';
922           $s Pagination  = '';   919           $s Pagination  = '';
923           $s ShowResult  = '';   920           $s ShowResult  = '';
924           $s MainCode =  '';   921           $s MainCode =  '';
925     922  
926           $s SureC = _t ('_Are you  sure want  to delete  this memb er?');   923           $s SureC = _t ('_Are you  sure want  to delete  this memb er?');
927           $s DeleteMemb C = _t('_D elete memb er');   924           $s DeleteMemb C = _t('_D elete memb er');
928     925  
929           if ( $_REQUES T['mode']  == 'edit'  and $aGrou pInfo['cre atorID'] = = $iMember ID ) {   926           if ( $_REQUES T['mode']  == 'edit'  and $aGrou pInfo['cre atorID'] = = $iMember ID ) {
930                $bEditMo de = true;   927                $bEditMo de = true;
931                $sEditMo deReq = 'm ode=edit&a mp;';   928                $sEditMo deReq = 'm ode=edit&a mp;';
932                $sEditMo deSql = "` memberID`! ={$aGroupI nfo['creat orID']} AN D";   929                $sEditMo deSql = "` memberID`! ={$aGroupI nfo['creat orID']} AN D";
933           }  else {   930           }  else {
934                $bEditMo de = false ;   931                $bEditMo de = false ;
935                $sEditMo deReq = '' ;   932                $sEditMo deReq = '' ;
936                $sEditMo deSql = '' ;   933                $sEditMo deSql = '' ;
937           }   934           }
938     935  
939           $s BreadCrumb s = <<<EOJ   936           $s BreadCrumb s = <<<EOJ
940   <div class ="groups_b readcrumbs ">   937   <div class ="groups_b readcrumbs ">
941       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /   938       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /
942       <a hre f="{$site[ 'url']}{$t his->sCurr File}">__G roups__</a > /   939       <a hre f="{$site[ 'url']}{$t his->sCurr File}">__G roups__</a > /
943       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group&a mp;ID={$iG roupID}">{ $aGroupInf o['Name_ht ml']}</a>  /   940       <a hre f="{$site[ 'url']}{$t his->sCurr File}?acti on=group&a mp;ID={$iG roupID}">{ $aGroupInf o['Name_ht ml']}</a>  /
944       <span  class="act ive_link"> __Group me mbers__</s pan>   941       <span  class="act ive_link"> __Group me mbers__</s pan>
945   </div>   942   </div>
946   EOJ;   943   EOJ;
947     944  
948           $s BreadCrumb s = str_re place( "__ Groups__",  _t( "_Gro ups" ), $s BreadCrumb s );   945           $s BreadCrumb s = str_re place( "__ Groups__",  _t( "_Gro ups" ), $s BreadCrumb s );
949           $s BreadCrumb s = str_re place( "__ Group memb ers__", _t ( "_Group  members" ) , $sBreadC rumbs );   946           $s BreadCrumb s = str_re place( "__ Group memb ers__", _t ( "_Group  members" ) , $sBreadC rumbs );
950     947  
951           $a MemNum = d b_arr( "SE LECT COUNT (*) FROM ` GroupsMemb ers` WHERE  {$sEditMo deSql} `gr oupID`={$i GroupID}   AND `statu s`='Active '" );   948           $a MemNum = d b_arr( "SE LECT COUNT (*) FROM ` GroupsMemb ers` WHERE  {$sEditMo deSql} `gr oupID`={$i GroupID}   AND `statu s`='Active '" );
952     949  
953           $i TotalNum =  (int)$aMe mNum[0];   950           $i TotalNum =  (int)$aMe mNum[0];
954           if ( $iTotalN um ) {   951           if ( $iTotalN um ) {
955                $iPerPag e = $oTemp lConfig ->  iGroupMem bersResPer Page;   952                $iPerPag e = $oTemp lConfig ->  iGroupMem bersResPer Page;
956                $iPagesN um = ceil(  $iTotalNu m / $iPerP age );   953                $iPagesN um = ceil(  $iTotalNu m / $iPerP age );
957                $iPage =  (int)$_RE QUEST['pag e'];   954                $iPage =  (int)$_RE QUEST['pag e'];
958     955  
959                if( $iPa ge < 1 )   956                if( $iPa ge < 1 )
960                    $iPa ge = 1;   957                    $iPa ge = 1;
961                if( $iPa ge > $iPag esNum )   958                if( $iPa ge > $iPag esNum )
962                    $iPa ge = $iPag esNum;   959                    $iPa ge = $iPag esNum;
963     960  
964                $iSqlFro m = ( ( $i Page - 1 )  * $iPerPa ge );   961                $iSqlFro m = ( ( $i Page - 1 )  * $iPerPa ge );
965     962  
966                $sQueryS QL = "   963                $sQueryS QL = "
967                    SELE CT   964                    SELE CT
968                         `GroupsMem bers`.`mem berID`, `P rofiles`.` NickName`,   965                         `GroupsMem bers`.`mem berID`, `P rofiles`.` NickName`,
969                         IF(`Groups Members`.` memberID`= '{$aGroupI nfo['creat orID']}',  1, 0 ) AS  `isCreator `   966                         IF(`Groups Members`.` memberID`= '{$aGroupI nfo['creat orID']}',  1, 0 ) AS  `isCreator `
970                    FROM   967                    FROM
971                         `GroupsMem bers`, `Pr ofiles`   968                         `GroupsMem bers`, `Pr ofiles`
972                    WHER E   969                    WHER E
973                         {$sEditMod eSql}   970                         {$sEditMod eSql}
974                         `GroupsMem bers`.`gro upID`='{$i GroupID}'  AND   971                         `GroupsMem bers`.`gro upID`='{$i GroupID}'  AND
975                         `GroupsMem bers`.`sta tus`='Acti ve' AND   972                         `GroupsMem bers`.`sta tus`='Acti ve' AND
976                         `GroupsMem bers`.`mem berID`=`Pr ofiles`.`I D`   973                         `GroupsMem bers`.`mem berID`=`Pr ofiles`.`I D`
977                    ORDE R BY   974                    ORDE R BY
978                         `isCreator ` DESC,   975                         `isCreator ` DESC,
979                         `GroupsMem bers`.`Dat e` DESC   976                         `GroupsMem bers`.`Dat e` DESC
980                    LIMI T {$iSqlFr om}, {$iPe rPage}   977                    LIMI T {$iSqlFr om}, {$iPe rPage}
981                ";   978                ";
982     979  
983                $vMember s = db_res ( $sQueryS QL );   980                $vMember s = db_res ( $sQueryS QL );
984     981  
985                $iNumOnP age = mysq l_num_rows ( $vMember s );   982                $iNumOnP age = mysq l_num_rows ( $vMember s );
986                $iShowin gFrom = $i SqlFrom +  1;   983                $iShowin gFrom = $i SqlFrom +  1;
987                $iShowin gTo   = $i SqlFrom +  $iNumOnPag e;   984                $iShowin gTo   = $i SqlFrom +  $iNumOnPag e;
988     985  
989                $sShowin gResults =  _t( '_Sho wing resul ts:', $iSh owingFrom,  $iShowing To, $iTota lNum );   986                $sShowin gResults =  _t( '_Sho wing resul ts:', $iSh owingFrom,  $iShowing To, $iTota lNum );
990     987  
991                if( $iPa gesNum > 1  ) {   988                if( $iPa gesNum > 1  ) {
992                    $sPa gesUrl = " {$_SERVER[ 'PHP_SELF' ]}?action= group_memb ers&{$sEdi tModeReq}I D={$iGroup ID}&amp;pa ge={page}" ;   989                    $sPa gesUrl = " {$_SERVER[ 'PHP_SELF' ]}?action= group_memb ers&{$sEdi tModeReq}I D={$iGroup ID}&amp;pa ge={page}" ;
993                    $sGe nPaginatio n = genPag ination( $ iPagesNum,  $iPage, $ sPagesUrl  );   990                    $sGe nPaginatio n = genPag ination( $ iPagesNum,  $iPage, $ sPagesUrl  );
994                }   991                }
995     992  
996                $sBreadC rumb = $sB readCrumbs ;   993                $sBreadC rumb = $sB readCrumbs ;
997                $sPagina tion = $sG enPaginati on;   994                $sPagina tion = $sG enPaginati on;
998                $sShowRe sult = $sS howingResu lts;   995                $sShowRe sult = $sS howingResu lts;
999     996  
1000                $sRetHtm l = '<div  class="cle ar_both">< /div>';   997                $sRetHtm l = '<div  class="cle ar_both">< /div>';
1001     998  
1002                while( $ aMemberInf o = mysql_ fetch_asso c( $vMembe rs ) ) {   999                while( $ aMemberInf o = mysql_ fetch_asso c( $vMembe rs ) ) {
1003                    $sMe mbThumb =  get_member _thumbnail ( $aMember Info['memb erID'], 'n one', true  );   1000                    $sMe mbThumb =  get_member _thumbnail ( $aMember Info['memb erID'], 'n one', true  );
1004                    $sMe mbLink = g etProfileL ink($aMemb erInfo['me mberID']);   1001                    $sMe mbLink = g etProfileL ink($aMemb erInfo['me mberID']);
1005     1002  
1006                    $sRe tHtml .= < <<EOF   1003                    $sRe tHtml .= < <<EOF
1007   <div class ="group_me mber">   1004   <div class ="group_me mber">
1008       {$sMem bThumb}   1005       {$sMem bThumb}
1009       <a hre f="{$sMemb Link}">{$a MemberInfo ['NickName ']}</a>   1006       <a hre f="{$sMemb Link}">{$a MemberInfo ['NickName ']}</a>
1010   EOF;   1007   EOF;
1011     1008  
1012                    if(  (int)$aMem berInfo['i sCreator']  )   1009                    if(  (int)$aMem berInfo['i sCreator']  )
1013                         $sRetHtml  .= '<div c lass="mygr oup_leader _is">'._t( '_group cr eator').'< /div>';   1010                         $sRetHtml  .= '<div c lass="mygr oup_leader _is">'._t( '_group cr eator').'< /div>';
1014                    if(  $bEditMode  )   1011                    if(  $bEditMode  )
1015                         $sRetHtml  .= <<<EOF   1012                         $sRetHtml  .= <<<EOF
1016   <div class ="group_me mber_edit" >   1013   <div class ="group_me mber_edit" >
1017       <a hre f="{$site[ 'url']}gro up_actions .php?ID={$ iGroupID}& amp;a=delm em&amp;mem ={$aMember Info['memb erID']}" o nclick="re turn confi rm('{$sSur eC}')">{$s DeleteMemb C}</a>   1014       <a hre f="{$site[ 'url']}gro up_actions .php?ID={$ iGroupID}& amp;a=delm em&amp;mem ={$aMember Info['memb erID']}" o nclick="re turn confi rm('{$sSur eC}')">{$s DeleteMemb C}</a>
1018   </div>   1015   </div>
1019   EOF;   1016   EOF;
1020     1017  
1021                    $sRe tHtml .= ' </div>';   1018                    $sRe tHtml .= ' </div>';
1022                }   1019                }
1023                $sRetHtm l .= '<div  class="cl ear_both"> </div>';   1020                $sRetHtm l .= '<div  class="cl ear_both"> </div>';
1024     1021  
1025                $sMainCo de = $sRet Html;   1022                $sMainCo de = $sRet Html;
1026           }  else {   1023           }  else {
1027                $sBreadC rumb = '';   1024                $sBreadC rumb = '';
1028                $sPagina tion = '';   1025                $sPagina tion = '';
1029                $sShowRe sult = '';   1026                $sShowRe sult = '';
1030                $sMainCo de = _t( ' _Sorry, no  members a re found'  );   1027                $sMainCo de = _t( ' _Sorry, no  members a re found'  );
1031           }   1028           }
1032           re turn array ($sBreadCr umb, $sPag ination, $ sShowResul t, $sMainC ode);   1029           re turn array ($sBreadCr umb, $sPag ination, $ sShowResul t, $sMainC ode);
1033       }   1030       }
1034     1031  
1035       /***** ********** ********** ********** ********** ********** ********** ********/   1032       /***** ********** ********** ********** ********** ********** ********** ********/
1036     1033  
1037     1034  
1038       ////// ////////// ///////old  functiona l///////// ////////// ////////// ////////// ////////// /   1035       ////// ////////// ///////old  functiona l///////// ////////// ////////// ////////// ////////// /
1039     1036  
1040       //func tion GenMy Groups( $i MemberID )  {   1037       //func tion GenMy Groups( $i MemberID )  {
1041       functi on showMyG roups( $iM emberID )  {   1038       functi on showMyG roups( $iM emberID )  {
1042           gl obal $site ;   1039           gl obal $site ;
1043     1040  
1044           $s NoMyGrpC =  _t("_No m y groups f ound");   1041           $s NoMyGrpC =  _t("_No m y groups f ound");
1045           $s GroupCreat orC = _t(" _group cre ator");   1042           $s GroupCreat orC = _t(" _group cre ator");
1046     1043  
1047           $i MemberID =  (int)$iMe mberID;   1044           $i MemberID =  (int)$iMe mberID;
1048           if  ( !$iMemb erID )   1045           if  ( !$iMemb erID )
1049                return f alse;   1046                return f alse;
1050     1047  
1051           $a MyGroups =  $this->Ge tMyGroups(  $iMemberI D );   1048           $a MyGroups =  $this->Ge tMyGroups(  $iMemberI D );
1052     1049  
1053           $s HtmlRet =  '';   1050           $s HtmlRet =  '';
1054           if  ( !$aMyGr oups ) {   1051           if  ( !$aMyGr oups ) {
1055                $sHtmlRe t .= <<<EO F   1052                $sHtmlRe t .= <<<EO F
1056   <div class ="mygroups _no">{$sNo MyGrpC}</d iv>   1053   <div class ="mygroups _no">{$sNo MyGrpC}</d iv>
1057   EOF;   1054   EOF;
1058           }  else {   1055           }  else {
1059                $sHtmlRe t .= <<<EO F   1056                $sHtmlRe t .= <<<EO F
1060   <div class ="mygroups _container ">   1057   <div class ="mygroups _container ">
1061       <div c lass="clea r_both"></ div>   1058       <div c lass="clea r_both"></ div>
1062   EOF;   1059   EOF;
1063     1060  
1064                foreach  ( $aMyGrou ps as $aGr oupInfo )  {   1061                foreach  ( $aMyGrou ps as $aGr oupInfo )  {
1065                    $iGr oupID = $a GroupInfo[ 'ID'];   1062                    $iGr oupID = $a GroupInfo[ 'ID'];
1066                    $sGr oupUrl = $ this->getG roupUrl($a GroupInfo[ 'ID'], $aG roupInfo[' Uri']);   1063                    $sGr oupUrl = $ this->getG roupUrl($a GroupInfo[ 'ID'], $aG roupInfo[' Uri']);
1067     1064  
1068                    if (  $aGroupIn fo['thumb' ] and file _exists($t his->sGrpG alPath . " {$aGroupIn fo['ID']}_ {$aGroupIn fo['thumb' ]}_{$aGrou pInfo['see d']}_.{$aG roupInfo[' thumbExt'] }" ) )   1065                    if (  $aGroupIn fo['thumb' ] and file _exists($t his->sGrpG alPath . " {$aGroupIn fo['ID']}_ {$aGroupIn fo['thumb' ]}_{$aGrou pInfo['see d']}_.{$aG roupInfo[' thumbExt'] }" ) )
1069                         $fileGroup Thumb = "{ $site['gro ups_galler y']}{$aGro upInfo['ID ']}_{$aGro upInfo['th umb']}_{$a GroupInfo[ 'seed']}_. {$aGroupIn fo['thumbE xt']}";   1066                         $fileGroup Thumb = "{ $site['gro ups_galler y']}{$aGro upInfo['ID ']}_{$aGro upInfo['th umb']}_{$a GroupInfo[ 'seed']}_. {$aGroupIn fo['thumbE xt']}";
1070                    else   1067                    else
1071                         $fileGroup Thumb = "{ $site['gro ups_galler y']}no_pic .gif";   1068                         $fileGroup Thumb = "{ $site['gro ups_galler y']}no_pic .gif";
1072     1069  
1073                    $sGr pImg = <<< EOF   1070                    $sGr pImg = <<< EOF
1074   <img class ="photo1"  alt="{$aGr oupInfo['N ame']}" sr c="{$this- >sSpacerIc on}" style ="width: 1 10px; heig ht: 110px;  backgroun d-image: u rl({$fileG roupThumb} );" />   1071   <img class ="photo1"  alt="{$aGr oupInfo['N ame']}" sr c="{$this- >sSpacerIc on}" style ="width: 1 10px; heig ht: 110px;  backgroun d-image: u rl({$fileG roupThumb} );" />
1075   EOF;   1072   EOF;
1076                    $sGr pName = ht mlspecialc hars_adv(  $aGroupInf o['Name']  );   1073                    $sGr pName = ht mlspecialc hars_adv(  $aGroupInf o['Name']  );
1077                    $sHt mlRet .= < <<EOF   1074                    $sHt mlRet .= < <<EOF
1078   <div class ="mygroup_ container" >   1075   <div class ="mygroup_ container" >
1079       <div c lass="mygr oup_name">   1076       <div c lass="mygr oup_name">
1080           <a  href="{$s GroupUrl}"  class="ac tions">   1077           <a  href="{$s GroupUrl}"  class="ac tions">
1081                {$sGrpNa me}   1078                {$sGrpNa me}
1082           </ a>   1079           </ a>
1083       </div>   1080       </div>
1084       <div c lass="thum bnail_bloc k">   1081       <div c lass="thum bnail_bloc k">
1085           <a  href="{$s GroupUrl}" >   1082           <a  href="{$s GroupUrl}" >
1086                {$sGrpIm g}   1083                {$sGrpIm g}
1087           </ a>   1084           </ a>
1088       </div>   1085       </div>
1089   EOF;   1086   EOF;
1090                    if (  (int)$aGr oupInfo['i sCreator']  ) {   1087                    if (  (int)$aGr oupInfo['i sCreator']  ) {
1091                         $sHtmlRet  .= <<<EOF   1088                         $sHtmlRet  .= <<<EOF
1092   <div class ="mygroup_ leader_is" >{$sGroupC reatorC}</ div>   1089   <div class ="mygroup_ leader_is" >{$sGroupC reatorC}</ div>
1093   EOF;   1090   EOF;
1094                    }   1091                    }
1095     1092  
1096                    $sHt mlRet .= ' </div>';   1093                    $sHt mlRet .= ' </div>';
1097                }   1094                }
1098     1095  
1099                $sHtmlRe t .= '<div  class="cl ear_both"> </div></di v>';   1096                $sHtmlRe t .= '<div  class="cl ear_both"> </div></di v>';
1100           }   1097           }
1101           re turn $sHtm lRet;   1098           re turn $sHtm lRet;
1102       }   1099       }
1103     1100  
1104       functi on GetMyGr oups( $iMe mberID ) {   1101       functi on GetMyGr oups( $iMe mberID ) {
1105           $i MemberID =  (int)$iMe mberID;   1102           $i MemberID =  (int)$iMe mberID;
1106           if  ( !$iMemb erID )   1103           if  ( !$iMemb erID )
1107                return n ull;   1104                return n ull;
1108     1105  
1109           $s QuerySQL =  "   1106           $s QuerySQL =  "
1110                SELECT   1107                SELECT
1111                    `Gro ups`.`ID`,   1108                    `Gro ups`.`ID`,
1112                    `Gro ups`.`Name `,   1109                    `Gro ups`.`Name `,
1113                    `Gro ups`.`Uri` ,   1110                    `Gro ups`.`Uri` ,
1114                    IF(  `Groups`.` creatorID`  = '{$iMem berID}', 1 , 0 ) AS ' isCreator' ,   1111                    IF(  `Groups`.` creatorID`  = '{$iMem berID}', 1 , 0 ) AS ' isCreator' ,
1115                    `Gro ups`.`thum b`,   1112                    `Gro ups`.`thum b`,
1116                    `Gro upsGallery `.`seed`,   1113                    `Gro upsGallery `.`seed`,
1117                    `Gro upsGallery `.`ext` AS  `thumbExt `   1114                    `Gro upsGallery `.`ext` AS  `thumbExt `
1118                FROM `Gr oupsMember s`, `Group s`   1115                FROM `Gr oupsMember s`, `Group s`
1119                LEFT JOI N `GroupsG allery` ON  `Groups`. `thumb` =  `GroupsGal lery`.`ID`   1116                LEFT JOI N `GroupsG allery` ON  `Groups`. `thumb` =  `GroupsGal lery`.`ID`
1120                WHERE    1117                WHERE 
1121                    `Gro upsMembers `.`memberI D` = '{$iM emberID}'  AND   1118                    `Gro upsMembers `.`memberI D` = '{$iM emberID}'  AND
1122                    `Gro upsMembers `.`groupID `  = `Grou ps`.`ID` A ND   1119                    `Gro upsMembers `.`groupID `  = `Grou ps`.`ID` A ND
1123                    `Gro upsMembers `.`status`    = 'Acti ve'   1120                    `Gro upsMembers `.`status`    = 'Acti ve'
1124           ";   1121           ";
1125     1122  
1126           $v ResGroups  = db_res(  $sQuerySQL  );   1123           $v ResGroups  = db_res(  $sQuerySQL  );
1127     1124  
1128           if  ( !$vResG roups or ! mysql_num_ rows( $vRe sGroups )  )   1125           if  ( !$vResG roups or ! mysql_num_ rows( $vRe sGroups )  )
1129                return n ull;   1126                return n ull;
1130     1127  
1131           $a MyGroups =  array();   1128           $a MyGroups =  array();
1132     1129  
1133           wh ile ( $aGr oupInfo =  mysql_fetc h_assoc( $ vResGroups  ) ) {   1130           wh ile ( $aGr oupInfo =  mysql_fetc h_assoc( $ vResGroups  ) ) {
1134                $iGroupI D = $aGrou pInfo['ID' ];   1131                $iGroupI D = $aGrou pInfo['ID' ];
1135                $aMyGrou ps[ $iGrou pID ] = $a GroupInfo;   1132                $aMyGrou ps[ $iGrou pID ] = $a GroupInfo;
1136           }   1133           }
1137     1134  
1138           re turn $aMyG roups;   1135           re turn $aMyG roups;
1139       }   1136       }
1140     1137  
1141       functi on getGrou pInfo( $iG roupID ) {   1138       functi on getGrou pInfo( $iG roupID ) {
1142           $i GroupID =  (int)$iGro upID;   1139           $i GroupID =  (int)$iGro upID;
1143           if  ( !$iGrou pID )   1140           if  ( !$iGrou pID )
1144                return n ull;   1141                return n ull;
1145     1142  
1146           $s QuerySQL =  "   1143           $s QuerySQL =  "
1147                SELECT   1144                SELECT
1148                    `Gro ups`.*,   1145                    `Gro ups`.*,
    1146                    UNIX _TIMESTAMP ( `Groups` .`created` ) AS 'crea ted_UTS',
1149                    `Gro upsCateg`. `Name` AS  `categName `,   1147                    `Gro upsCateg`. `Name` AS  `categName `,
1150                    `Gro upsCateg`. `Uri` AS ` categUri`,   1148                    `Gro upsCateg`. `Uri` AS ` categUri`,
1151                    COUN T(`GroupsM embers`.`m emberID`)   AS  `memb ersCount`,   1149                    COUN T(`GroupsM embers`.`m emberID`)   AS  `memb ersCount`,
1152                    `Gro upsGallery `.`ext`  A S  `thumbE xt`,   1150                    `Gro upsGallery `.`ext`  A S  `thumbE xt`,
1153                    `Gro upsGallery `.`seed`   1151                    `Gro upsGallery `.`seed`
1154                FROM `Gr oups`   1152                FROM `Gr oups`
1155                INNER JO IN `Groups Categ` ON   1153                INNER JO IN `Groups Categ` ON
1156                    `Gro upsCateg`. `ID` = `Gr oups`.`cat egID`   1154                    `Gro upsCateg`. `ID` = `Gr oups`.`cat egID`
1157                LEFT JOI N `GroupsG allery` ON   1155                LEFT JOI N `GroupsG allery` ON
1158                    `Gro ups`.`thum b` = `Grou psGallery` .`ID`   1156                    `Gro ups`.`thum b` = `Grou psGallery` .`ID`
1159                LEFT JOI N `GroupsM embers` ON   1157                LEFT JOI N `GroupsM embers` ON
1160                    `Gro upsMembers `.`groupID ` = `Group s`.`ID` AN D   1158                    `Gro upsMembers `.`groupID ` = `Group s`.`ID` AN D
1161                    `Gro upsMembers `.`status`  = 'Active '   1159                    `Gro upsMembers `.`status`  = 'Active '
1162                WHERE   1160                WHERE
1163                    `Gro ups`.`ID`  = '{$iGrou pID}'   1161                    `Gro ups`.`ID`  = '{$iGrou pID}'
1164                GROUP BY  `Groups`. `ID`   1162                GROUP BY  `Groups`. `ID`
1165           ";   1163           ";
1166     1164  
1167           $a GroupInfo  = db_assoc _arr( $sQu erySQL );   1165           $a GroupInfo  = db_assoc _arr( $sQu erySQL );
1168           re turn $aGro upInfo;   1166           re turn $aGro upInfo;
1169       }   1167       }
1170     1168  
1171       functi on isGroup NameExists ( $Name )  {   1169       functi on isGroup NameExists ( $Name )  {
1172           $v Res = db_r es( "SELEC T `Name` F ROM `Group s` WHERE U PPER(`Name `)='" . ad dslashes(s trtoupper( $Name)) .  "' LIMIT 1 " );   1170           $v Res = db_r es( "SELEC T `Name` F ROM `Group s` WHERE U PPER(`Name `)='" . ad dslashes(s trtoupper( $Name)) .  "' LIMIT 1 " );
1173     1171  
1174           if ( $vRes an d mysql_nu m_rows( $v Res ) )   1172           if ( $vRes an d mysql_nu m_rows( $v Res ) )
1175                return t rue;   1173                return t rue;
1176           el se   1174           el se
1177                return f alse;   1175                return f alse;
1178       }   1176       }
1179     1177  
1180       functi on isGroup Member( $i MemberID,  $iGroupID,  $checkAct iveStatus  = true ) {   1178       functi on isGroup Member( $i MemberID,  $iGroupID,  $checkAct iveStatus  = true ) {
1181           /* global $aM emStatusCa che;   1179           /* global $aM emStatusCa che;
1182     1180  
1183           if ( !is_arra y( $aMemSt atusCache  ) ) {   1181           if ( !is_arra y( $aMemSt atusCache  ) ) {
1184                $aMemSta tusCache =  array();   1182                $aMemSta tusCache =  array();
1185                $rStatus  = db_res(  "SELECT *  FROM `Gro upsMembers ` ORDER BY  `groupID` ,`memberID `" );   1183                $rStatus  = db_res(  "SELECT *  FROM `Gro upsMembers ` ORDER BY  `groupID` ,`memberID `" );
1186                while( $ aStatus =  mysql_fetc h_assoc( $ rStatus )  )   1184                while( $ aStatus =  mysql_fetc h_assoc( $ rStatus )  )
1187                    $aMe mStatusCac he[$aStatu s['groupID ']][$aStat us['member ID']] = $a Status['st atus'];   1185                    $aMe mStatusCac he[$aStatu s['groupID ']][$aStat us['member ID']] = $a Status['st atus'];
1188           }* /   1186           }* /
1189     1187  
1190           $i MemberID =  (int)$iMe mberID;   1188           $i MemberID =  (int)$iMe mberID;
1191           $i GroupID =  (int)$iGro upID;   1189           $i GroupID =  (int)$iGro upID;
1192     1190  
1193           if  ( !$iMemb erID or !$ iGroupID )   1191           if  ( !$iMemb erID or !$ iGroupID )
1194                return f alse;   1192                return f alse;
1195     1193  
1196           $s QuerySQL =  "SELECT ` Status` FR OM `Groups Members` W HERE `memb erID` = '{ $iMemberID }' AND `gr oupID` = ' {$iGroupID }'" .   1194           $s QuerySQL =  "SELECT ` Status` FR OM `Groups Members` W HERE `memb erID` = '{ $iMemberID }' AND `gr oupID` = ' {$iGroupID }'" .
1197                ( $check ActiveStat us ? " AND  `Status`= 'Active'"  : '' );   1195                ( $check ActiveStat us ? " AND  `Status`= 'Active'"  : '' );
1198     1196  
1199           $v Res = db_r es( $sQuer ySQL );   1197           $v Res = db_r es( $sQuer ySQL );
1200           if  ( $vRes a nd mysql_n um_rows( $ vRes ) )   1198           if  ( $vRes a nd mysql_n um_rows( $ vRes ) )
1201                return t rue;   1199                return t rue;
1202           el se   1200           el se
1203                return f alse;   1201                return f alse;
1204     1202  
1205           /* if( isset(  $aMemStat usCache[$i GroupID][$ iMemberID]  ) )   1203           /* if( isset(  $aMemStat usCache[$i GroupID][$ iMemberID]  ) )
1206                if( $che ckActiveSt atus )   1204                if( $che ckActiveSt atus )
1207                    if(  $aMemStatu sCache[$iG roupID][$i MemberID]  == 'Active ' )   1205                    if(  $aMemStatu sCache[$iG roupID][$i MemberID]  == 'Active ' )
1208                         return tru e;   1206                         return tru e;
1209                    else   1207                    else
1210                         return fal se;   1208                         return fal se;
1211                else   1209                else
1212                    retu rn true;*/   1210                    retu rn true;*/
1213     1211  
1214           // return fal se;   1212           // return fal se;
1215           // echo "isMe mberResult s: .$resul t. .$resul t1.";   1213           // echo "isMe mberResult s: .$resul t. .$resul t1.";
1216       }   1214       }
1217     1215  
1218       functi on getDefa ultGroupEd itArr() {   1216       functi on getDefa ultGroupEd itArr() {
1219           $a Fields = a rray(   1217           $a Fields = a rray(
1220                'Name' = > array(   1218                'Name' = > array(
1221                    'Nam e' => 'Nam e',   1219                    'Nam e' => 'Nam e',
1222                    'Cap tion' => ' Group name ',   1220                    'Cap tion' => ' Group name ',
1223                    'Typ e' => 'tex t',   1221                    'Typ e' => 'tex t',
1224                    'Len ' => 64   1222                    'Len ' => 64
1225                ),   1223                ),
1226                'categID ' => array (   1224                'categID ' => array (
1227                    'Nam e' => 'cat egID',   1225                    'Nam e' => 'cat egID',
1228                    'Cap tion' => ' Category',   1226                    'Cap tion' => ' Category',
1229                    'Typ e' => 'dro pdown'   1227                    'Typ e' => 'dro pdown'
1230                ),   1228                ),
1231                'open_jo in' => arr ay(   1229                'open_jo in' => arr ay(
1232                    'Nam e' => 'ope n_join',   1230                    'Nam e' => 'ope n_join',
1233                    'Cap tion' => ' Open join' ,   1231                    'Cap tion' => ' Open join' ,
1234                    'Typ e' => 'boo l',   1232                    'Typ e' => 'boo l',
1235                    'Val ue' => tru e,   1233                    'Val ue' => tru e,
1236                    'Hel pIndex' =>  1   1234                    'Hel pIndex' =>  1
1237                ),   1235                ),
1238                'hidden_ group' =>  array(   1236                'hidden_ group' =>  array(
1239                    'Nam e' => 'hid den_group' ,   1237                    'Nam e' => 'hid den_group' ,
1240                    'Cap tion' => ' Hidden gro up',   1238                    'Cap tion' => ' Hidden gro up',
1241                    'Typ e' => 'boo l',   1239                    'Typ e' => 'boo l',
1242                    'Val ue' => fal se,   1240                    'Val ue' => fal se,
1243                    'Hel pIndex' =>  2   1241                    'Hel pIndex' =>  2
1244                ),   1242                ),
1245                'members _post_imag es' => arr ay(   1243                'members _post_imag es' => arr ay(
1246                    'Nam e' => 'mem bers_post_ images',   1244                    'Nam e' => 'mem bers_post_ images',
1247                    'Cap tion' => ' Members ca n post ima ges',   1245                    'Cap tion' => ' Members ca n post ima ges',
1248                    'Typ e' => 'boo l',   1246                    'Typ e' => 'boo l',
1249                    'Val ue' => tru e,   1247                    'Val ue' => tru e,
1250                    'Hel pIndex' =>  3   1248                    'Hel pIndex' =>  3
1251                ),   1249                ),
1252                'members _invite' = > array(   1250                'members _invite' = > array(
1253                    'Nam e' => 'mem bers_invit e',   1251                    'Nam e' => 'mem bers_invit e',
1254                    'Cap tion' => ' Members ca n invite',   1252                    'Cap tion' => ' Members ca n invite',
1255                    'Typ e' => 'boo l',   1253                    'Typ e' => 'boo l',
1256                    'Val ue' => tru e,   1254                    'Val ue' => tru e,
1257                    'Hel pIndex' =>  4   1255                    'Hel pIndex' =>  4
1258                ),   1256                ),
1259                'Country ' => array (   1257                'Country ' => array (
1260                    'Nam e' => 'Cou ntry',   1258                    'Nam e' => 'Cou ntry',
1261                    'Cap tion' => ' Country',   1259                    'Cap tion' => ' Country',
1262                    'Typ e' => 'dro pdown'   1260                    'Typ e' => 'dro pdown'
1263                ),   1261                ),
1264                'City' = > array(   1262                'City' = > array(
1265                    'Nam e' => 'Cit y',   1263                    'Nam e' => 'Cit y',
1266                    'Cap tion' => ' City',   1264                    'Cap tion' => ' City',
1267                    'Typ e' => 'tex t',   1265                    'Typ e' => 'tex t',
1268                    'Len ' => 64   1266                    'Len ' => 64
1269                ),   1267                ),
1270                'About'  => array(   1268                'About'  => array(
1271                    'Nam e' => 'Abo ut',   1269                    'Nam e' => 'Abo ut',
1272                    'Cap tion' => ' About grou p',   1270                    'Cap tion' => ' About grou p',
1273                    'Typ e' => 'tex t',   1271                    'Typ e' => 'tex t',
1274                    'Len ' => 255   1272                    'Len ' => 255
1275                ),   1273                ),
1276                'Desc' = > array(   1274                'Desc' = > array(
1277                    'Nam e' => 'Des c',   1275                    'Nam e' => 'Des c',
1278                    'Cap tion' => ' Group desc ription',   1276                    'Cap tion' => ' Group desc ription',
1279                    'Typ e' => 'htm l'   1277                    'Typ e' => 'htm l'
1280                )   1278                )
1281           );   1279           );
1282           re turn $aFie lds;   1280           re turn $aFie lds;
1283       }   1281       }
1284     1282  
1285       functi on genGrou psDropdown ( $aField,  $bShowCho ose = true  ) {   1283       functi on genGrou psDropdown ( $aField,  $bShowCho ose = true  ) {
1286           gl obal $aPre Values;   1284           gl obal $aPre Values;
1287     1285  
1288           $s ChooseC =  _t("_Choos e");   1286           $s ChooseC =  _t("_Choos e");
1289     1287  
1290           $s Res = <<<E OJ   1288           $s Res = <<<E OJ
1291   <select na me="{$aFie ld['Name'] }" class=" group_edit _dropdown" >   1289   <select na me="{$aFie ld['Name'] }" class=" group_edit _dropdown" >
1292   EOJ;   1290   EOJ;
1293           sw itch ( $aF ield['Name '] ) {   1291           sw itch ( $aF ield['Name '] ) {
1294                case 'Co untry':   1292                case 'Co untry':
1295                    $aVa ls = $aPre Values['Co untry'];   1293                    $aVa ls = $aPre Values['Co untry'];
1296                    fore ach ( $aVa ls as $sKe y => $sVal  )   1294                    fore ach ( $aVa ls as $sKe y => $sVal  )
1297                         $aVals[$sK ey] = html specialcha rs_adv( _t ( $sVal['L Key'] ) );   1295                         $aVals[$sK ey] = html specialcha rs_adv( _t ( $sVal['L Key'] ) );
1298                break;   1296                break;
1299                case 'ca tegID':   1297                case 'ca tegID':
1300                    $aVa ls = array ();   1298                    $aVa ls = array ();
1301                    $rVa ls = db_re s( "SELECT  * FROM `G roupsCateg ` ORDER BY  `Name`" ) ;   1299                    $rVa ls = db_re s( "SELECT  * FROM `G roupsCateg ` ORDER BY  `Name`" ) ;
1302                    whil e ( $aVal  = mysql_fe tch_assoc(  $rVals )  )   1300                    whil e ( $aVal  = mysql_fe tch_assoc(  $rVals )  )
1303                         $aVals[ $a Val['ID']  ] = htmlsp ecialchars _adv( $aVa l['Name']  );   1301                         $aVals[ $a Val['ID']  ] = htmlsp ecialchars _adv( $aVa l['Name']  );
1304                break;   1302                break;
1305           }   1303           }
1306     1304  
1307           $b Sel = ($aF ield['Valu e']) ? ''  : 'selecte d="selecte d"';   1305           $b Sel = ($aF ield['Valu e']) ? ''  : 'selecte d="selecte d"';
1308           $s Res .= '<o ption valu e="" '. $b Sel . '>'  . $sChoose C . "</opt ion>\n";   1306           $s Res .= '<o ption valu e="" '. $b Sel . '>'  . $sChoose C . "</opt ion>\n";
1309     1307  
1310           fo reach ( $a Vals as $V al => $Opt  ) {   1308           fo reach ( $a Vals as $V al => $Opt  ) {
1311                $bSel2 =  ( $aField ['Value']  == $Val ?  'selected= "selected" ' : '' );   1309                $bSel2 =  ( $aField ['Value']  == $Val ?  'selected= "selected" ' : '' );
1312                $sRes .=  "<option  value=\"{$ Val}\" {$b Sel2}>{$Op t}</option >\n";   1310                $sRes .=  "<option  value=\"{$ Val}\" {$b Sel2}>{$Op t}</option >\n";
1313           }   1311           }
1314     1312  
1315           $s Res .= "</ select>";   1313           $s Res .= "</ select>";
1316           re turn $sRes ;   1314           re turn $sRes ;
1317       }   1315       }
1318     1316  
1319       functi on genGrou pEditForm(  $aGroupIn fo, $aErro r = false,  $bShowSIm g = false,  $iGroupID  = 0 ) {   1317       functi on genGrou pEditForm(  $aGroupIn fo, $aErro r = false,  $bShowSIm g = false,  $iGroupID  = 0 ) {
1320           gl obal $site ;   1318           gl obal $site ;
1321     1319  
1322           $s RetHtml =  '';   1320           $s RetHtml =  '';
1323     1321  
1324           $s YesC = _t( '_Yes');   1322           $s YesC = _t( '_Yes');
1325           $s NoC = _t(' _No');   1323           $s NoC = _t(' _No');
1326           $s HelpC = _t ('_help');   1324           $s HelpC = _t ('_help');
1327           $s EnterWhatS eeC = _t(' _Enter wha t you see: ');   1325           $s EnterWhatS eeC = _t(' _Enter wha t you see: ');
1328           $s SubmitC =  _t('_Submi t');   1326           $s SubmitC =  _t('_Submi t');
1329     1327  
1330           $s GetAction  = '';   1328           $s GetAction  = '';
1331           $s PostAction Form = '';   1329           $s PostAction Form = '';
1332           if  ( $iGroup ID ) {   1330           if  ( $iGroup ID ) {
1333                $sGetAct ion = "?ac tion=edit& ID={$iGrou pID}";   1331                $sGetAct ion = "?ac tion=edit& ID={$iGrou pID}";
1334                $sPostAc tionForm =  '<input t ype="hidde n" value=" edit" name ="action"  />';   1332                $sPostAc tionForm =  '<input t ype="hidde n" value=" edit" name ="action"  />';
1335           }  else {   1333           }  else {
1336                $sGetAct ion = "?ac tion=creat e";   1334                $sGetAct ion = "?ac tion=creat e";
1337                $sPostAc tionForm =  '<input t ype="hidde n" value=" create" na me="action " />';   1335                $sPostAc tionForm =  '<input t ype="hidde n" value=" create" na me="action " />';
1338           }   1336           }
1339     1337  
1340           $s RetHtml .=  <<<EOF   1338           $s RetHtml .=  <<<EOF
1341   <form acti on="{$_SER VER['PHP_S ELF']}{$sG etAction}"  method="P OST">   1339   <form acti on="{$_SER VER['PHP_S ELF']}{$sG etAction}"  method="P OST">
1342       <table  class="gr oup_edit_t able">   1340       <table  class="gr oup_edit_t able">
1343   EOF;   1341   EOF;
1344     1342  
1345           if  ( $iGroup ID ) {   1343           if  ( $iGroup ID ) {
1346                $sRetHtm l .= <<<EO F   1344                $sRetHtm l .= <<<EO F
1347   <input typ e="hidden"  name="ID"  value="{$ iGroupID}"  />   1345   <input typ e="hidden"  name="ID"  value="{$ iGroupID}"  />
1348   EOF;   1346   EOF;
1349           }  else {   1347           }  else {
1350           }   1348           }
1351     1349  
1352           $s Checked =  'checked=" checked"';   1350           $s Checked =  'checked=" checked"';
1353           $s NowTR = "o dd";   1351           $s NowTR = "o dd";
1354     1352  
1355           fo reach ( $a GroupInfo  as $aField  ) {   1353           fo reach ( $a GroupInfo  as $aField  ) {
1356                $sFieldC apt = _t(  '_'.$aFiel d['Caption '] );   1354                $sFieldC apt = _t(  '_'.$aFiel d['Caption '] );
1357                $sNameBl ock = ($aE rror[$aFie ld['Name'] ] ? 'block ' : 'none' );   1355                $sNameBl ock = ($aE rror[$aFie ld['Name'] ] ? 'block ' : 'none' );
1358                $sNameDV al = ($aEr ror[$aFiel d['Name']]  ? _t( '_' .$aError[$ aField['Na me']] ) :  '' );   1356                $sNameDV al = ($aEr ror[$aFiel d['Name']]  ? _t( '_' .$aError[$ aField['Na me']] ) :  '' );
1359                $sRetHtm l .= <<<EO F   1357                $sRetHtm l .= <<<EO F
1360   <tr class= "group_edi t_tr_{$sNo wTR}">   1358   <tr class= "group_edi t_tr_{$sNo wTR}">
1361       <td cl ass="group _edit_td_l abel">{$sF ieldCapt}: </td>   1359       <td cl ass="group _edit_td_l abel">{$sF ieldCapt}: </td>
1362       <td cl ass="group _edit_td_v alue">   1360       <td cl ass="group _edit_td_v alue">
1363           <d iv class=" group_edit _error" st yle="displ ay:{$sName Block}">   1361           <d iv class=" group_edit _error" st yle="displ ay:{$sName Block}">
1364                {$sNameD Val}   1362                {$sNameD Val}
1365           </ div>   1363           </ div>
1366   EOF;   1364   EOF;
1367                switch(  $aField['T ype'] ) {   1365                switch(  $aField['T ype'] ) {
1368                    case  'text':   1366                    case  'text':
1369                         $sVal = ht mlspecialc hars_adv($ aField['Va lue']);   1367                         $sVal = ht mlspecialc hars_adv($ aField['Va lue']);
1370                         $sRetHtml  .= <<<EOF   1368                         $sRetHtml  .= <<<EOF
1371   <input typ e="text" n ame="{$aFi eld['Name' ]}" class= "group_edi t_text" va lue="{$sVa l}" maxlen gth="{$aFi eld['Len'] }" />   1369   <input typ e="text" n ame="{$aFi eld['Name' ]}" class= "group_edi t_text" va lue="{$sVa l}" maxlen gth="{$aFi eld['Len'] }" />
1372   EOF;   1370   EOF;
1373                    brea k;   1371                    brea k;
1374                    case  'bool':   1372                    case  'bool':
1375                         $sCheckedV al = $aFie ld['Value' ] ? $sChec ked : '';   1373                         $sCheckedV al = $aFie ld['Value' ] ? $sChec ked : '';
1376                         $sCheckedV al2 = $aFi eld['Value '] ? '' :  $sChecked;   1374                         $sCheckedV al2 = $aFi eld['Value '] ? '' :  $sChecked;
1377                         $sRetHtml  .= <<<EOF   1375                         $sRetHtml  .= <<<EOF
1378   <input typ e="radio"  name="{$aF ield['Name ']}" value ="yes" id= "{$aField[ 'Name']}_y es" {$sChe ckedVal} / >   1376   <input typ e="radio"  name="{$aF ield['Name ']}" value ="yes" id= "{$aField[ 'Name']}_y es" {$sChe ckedVal} / >
1379   <label for ="{$aField ['Name']}_ yes">{$sYe sC}</label >   1377   <label for ="{$aField ['Name']}_ yes">{$sYe sC}</label >
1380   &nbsp;   1378   &nbsp;
1381   <input typ e="radio"  name="{$aF ield['Name ']}" value ="no"  id= "{$aField[ 'Name']}_n o" {$sChec kedVal2} / >   1379   <input typ e="radio"  name="{$aF ield['Name ']}" value ="no"  id= "{$aField[ 'Name']}_n o" {$sChec kedVal2} / >
1382   <label for ="{$aField ['Name']}_ no">{$sNoC }</label>   1380   <label for ="{$aField ['Name']}_ no">{$sNoC }</label>
1383   EOF;   1381   EOF;
1384                         if( $aFiel d['HelpInd ex'] ) {   1382                         if( $aFiel d['HelpInd ex'] ) {
1385                             $sRetH tml .= <<< EOF   1383                             $sRetH tml .= <<< EOF
1386   &nbsp; <sp an class=" group_help _link">(<a  href="{$s ite['url'] }{$this->s CurrFile}? action=hel p&i={$aFie ld['HelpIn dex']}" ta rget="_bla nk" onclic k="window. open(this. href,'help win','widt h=350,heig ht=200');r eturn fals e;" >{$sHe lpC}</a>)< /span>   1384   &nbsp; <sp an class=" group_help _link">(<a  href="{$s ite['url'] }{$this->s CurrFile}? action=hel p&i={$aFie ld['HelpIn dex']}" ta rget="_bla nk" onclic k="window. open(this. href,'help win','widt h=350,heig ht=200');r eturn fals e;" >{$sHe lpC}</a>)< /span>
1387   EOF;   1385   EOF;
1388                         }   1386                         }
1389                    brea k;   1387                    brea k;
1390                    case  'html':   1388                    case  'html':
1391                         $sValue =  htmlspecia lchars_adv ($aField[' Value']);   1389                         $sValue =  htmlspecia lchars_adv ($aField[' Value']);
1392                         $sRetHtml  .= <<<EOF   1390                         $sRetHtml  .= <<<EOF
1393   <textarea  name="{$aF ield['Name ']}" class ="group_ed it_html">{ $sValue}</ textarea>   1391   <textarea  name="{$aF ield['Name ']}" class ="group_ed it_html">{ $sValue}</ textarea>
1394   EOF;   1392   EOF;
1395                    brea k;   1393                    brea k;
1396                    case  'dropdown ':   1394                    case  'dropdown ':
1397                         $sRetHtml  .= $this-> genGroupsD ropdown( $ aField );   1395                         $sRetHtml  .= $this-> genGroupsD ropdown( $ aField );
1398                    brea k;   1396                    brea k;
1399                }   1397                }
1400     1398  
1401                $sRetHtm l .= <<<EO F   1399                $sRetHtm l .= <<<EO F
1402       </td>   1400       </td>
1403   </tr>   1401   </tr>
1404   EOF;   1402   EOF;
1405     1403  
1406                $sNowTR  = ($sNowTR  == "odd")  ? "even"  : "odd";   1404                $sNowTR  = ($sNowTR  == "odd")  ? "even"  : "odd";
1407           }   1405           }
1408              1406           
1409           if  ( $bShowS Img ) {   1407           if  ( $bShowS Img ) {
1410                $sSimgBl ock = ($aE rror['simg '] ? 'bloc k' : 'none ');   1408                $sSimgBl ock = ($aE rror['simg '] ? 'bloc k' : 'none ');
1411                $sSimgL  = ($aError ['simg'])  ? _t( '_'. $aError['s img'] ) :  '';   1409                $sSimgL  = ($aError ['simg'])  ? _t( '_'. $aError['s img'] ) :  '';
1412     1410  
1413                $sRetHtm l .= <<<EO F   1411                $sRetHtm l .= <<<EO F
1414   <tr class= "group_edi t_tr_{$sNo wTR}">   1412   <tr class= "group_edi t_tr_{$sNo wTR}">
1415       <td cl ass="group _edit_td_l abel">{$sE nterWhatSe eC}</td>   1413       <td cl ass="group _edit_td_l abel">{$sE nterWhatSe eC}</td>
1416       <td cl ass="group _edit_td_v alue" styl e="text-al ign:center ;">   1414       <td cl ass="group _edit_td_v alue" styl e="text-al ign:center ;">
1417           <d iv class=" group_edit _error" st yle="displ ay:{$sSimg Block}">   1415           <d iv class=" group_edit _error" st yle="displ ay:{$sSimg Block}">
1418                {$sSimgL }   1416                {$sSimgL }
1419           </ div>   1417           </ div>
1420           <i mg src="{$ site['url' ]}simg/sim g.php"><br  />   1418           <i mg src="{$ site['url' ]}simg/sim g.php"><br  />
1421           <i nput type= "input" na me="simg"  class="gro up_edit_si mg" maxlen gth="6" />   1419           <i nput type= "input" na me="simg"  class="gro up_edit_si mg" maxlen gth="6" />
1422       </td>   1420       </td>
1423   </tr>   1421   </tr>
1424   EOF;   1422   EOF;
1425                $sNowTR  = ($sNowTR  == "odd")  ? "even"  : "odd";   1423                $sNowTR  = ($sNowTR  == "odd")  ? "even"  : "odd";
1426           }   1424           }
1427     1425  
1428           $s RetHtml .=  <<<EOF   1426           $s RetHtml .=  <<<EOF
1429           <t r class="g roup_edit_ tr_{$sNowT R}">   1427           <t r class="g roup_edit_ tr_{$sNowT R}">
1430                <td clas s="group_e dit_td_lab el">&nbsp; </td>   1428                <td clas s="group_e dit_td_lab el">&nbsp; </td>
1431                <td clas s="group_e dit_td_col span">   1429                <td clas s="group_e dit_td_col span">
1432                    <inp ut type="s ubmit" nam e="do_subm it" value= "{$sSubmit C}" />   1430                    <inp ut type="s ubmit" nam e="do_subm it" value= "{$sSubmit C}" />
1433                    {$sP ostActionF orm}   1431                    {$sP ostActionF orm}
1434                </td>   1432                </td>
1435           </ tr>   1433           </ tr>
1436       </tabl e>   1434       </tabl e>
1437   </form>   1435   </form>
1438   EOF;   1436   EOF;
1439     1437  
1440           re turn $sRet Html;   1438           re turn $sRet Html;
1441       }   1439       }
1442     1440  
1443       functi on fillGro upArrByPos tValues( & $aGroupInf o ) {   1441       functi on fillGro upArrByPos tValues( & $aGroupInf o ) {
1444           fo reach( $aG roupInfo a s $sFieldN ame => $aF ield ) {   1442           fo reach( $aG roupInfo a s $sFieldN ame => $aF ield ) {
1445                switch(  $aField['T ype'] ) {   1443                switch(  $aField['T ype'] ) {
1446                    case  'text':   1444                    case  'text':
1447                    case  'dropdown ':   1445                    case  'dropdown ':
1448                         $aGroupInf o[$sFieldN ame]['Valu e'] = trim ( process_ pass_data(  $_POST[$s FieldName]  ) );   1446                         $aGroupInf o[$sFieldN ame]['Valu e'] = trim ( process_ pass_data(  $_POST[$s FieldName]  ) );
1449                    brea k;   1447                    brea k;
1450                    case  'html':   1448                    case  'html':
1451                         $aGroupInf o[$sFieldN ame]['Valu e'] = clea r_xss( tri m( process _pass_data ( $_POST[$ sFieldName ] ) ) );   1449                         $aGroupInf o[$sFieldN ame]['Valu e'] = clea r_xss( tri m( process _pass_data ( $_POST[$ sFieldName ] ) ) );
1452                    brea k;   1450                    brea k;
1453                    case  'bool':   1451                    case  'bool':
1454                         $aGroupInf o[$sFieldN ame]['Valu e'] = (boo l)( $_POST [$sFieldNa me] == 'ye s' );   1452                         $aGroupInf o[$sFieldN ame]['Valu e'] = (boo l)( $_POST [$sFieldNa me] == 'ye s' );
1455                    brea k;   1453                    brea k;
1456                }   1454                }
1457           }   1455           }
1458       }   1456       }
1459     1457  
1460       functi on fillGro upArrByDBV alues( &$a Fields, $a GroupInfo  ) {   1458       functi on fillGro upArrByDBV alues( &$a Fields, $a GroupInfo  ) {
1461           fo reach( $aF ields as $ sFieldName  => $arrFi eld ) {   1459           fo reach( $aF ields as $ sFieldName  => $arrFi eld ) {
1462                switch(  $arrField[ 'Type'] )  {   1460                switch(  $arrField[ 'Type'] )  {
1463                    case  'text':   1461                    case  'text':
1464                    case  'html':   1462                    case  'html':
1465                    case  'dropdown ':   1463                    case  'dropdown ':
1466                         $aFields[$ sFieldName ]['Value']  = $aGroup Info[$sFie ldName];   1464                         $aFields[$ sFieldName ]['Value']  = $aGroup Info[$sFie ldName];
1467                    brea k;   1465                    brea k;
1468                    case  'bool':   1466                    case  'bool':
1469                         $aFields[$ sFieldName ]['Value']  = (bool)( int)$aGrou pInfo[$sFi eldName];   1467                         $aFields[$ sFieldName ]['Value']  = (bool)( int)$aGrou pInfo[$sFi eldName];
1470                    brea k;   1468                    brea k;
1471                }   1469                }
1472           }   1470           }
1473       }   1471       }
1474     1472  
1475       functi on checkGr oupErrors(  &$aGroupI nfo ) {   1473       functi on checkGr oupErrors(  &$aGroupI nfo ) {
1476           gl obal $aPre Values;   1474           gl obal $aPre Values;
1477     1475  
1478           $a Error = ar ray();   1476           $a Error = ar ray();
1479     1477  
1480           fo reach( $aG roupInfo a s $aField  ) {   1478           fo reach( $aG roupInfo a s $aField  ) {
1481                $sFieldN ame = $aFi eld['Name' ];   1479                $sFieldN ame = $aFi eld['Name' ];
1482                   1480                
1483                switch(  $aField['T ype'] ) {   1481                switch(  $aField['T ype'] ) {
1484                    case  'text':   1482                    case  'text':
1485                         if( !strle n( $aGroup Info[$sFie ldName]['V alue'] ) )   1483                         if( !strle n( $aGroup Info[$sFie ldName]['V alue'] ) )
1486                             $aErro r[ $sField Name ] = " {$sFieldNa me} is req uired";   1484                             $aErro r[ $sField Name ] = " {$sFieldNa me} is req uired";
1487                         else {   1485                         else {
1488                             if( $s FieldName  == 'Name'  )   1486                             if( $s FieldName  == 'Name'  )
1489                                 if ( $this->i sGroupName Exists( $a GroupInfo[ 'Name']['V alue'] ) )   1487                                 if ( $this->i sGroupName Exists( $a GroupInfo[ 'Name']['V alue'] ) )
1490                                      $aError[  $sFieldNa me ] = "Gr oup name a lready exi sts";   1488                                      $aError[  $sFieldNa me ] = "Gr oup name a lready exi sts";
1491                         }   1489                         }
1492                    brea k;   1490                    brea k;
1493                    case  'dropdown ':   1491                    case  'dropdown ':
1494                         switch( $s FieldName  ) {   1492                         switch( $s FieldName  ) {
1495                             case ' Country':   1493                             case ' Country':
1496                                 $a GroupInfo[ 'Country'] ['Value']  = substr(  $aGroupInf o['Country ']['Value' ], 0, 2 );   1494                                 $a GroupInfo[ 'Country'] ['Value']  = substr(  $aGroupInf o['Country ']['Value' ], 0, 2 );
1497                                 if ( !strlen(  $aGroupIn fo['Countr y']['Value '] ) )   1495                                 if ( !strlen(  $aGroupIn fo['Countr y']['Value '] ) )
1498                                      $aError[ 'Country']  = 'Countr y is requi red';   1496                                      $aError[ 'Country']  = 'Countr y is requi red';
1499                                 el se   1497                                 el se
1500                                      if ( !is set( $aPre Values['Co untry'][ $ aGroupInfo ['Country' ]['Value']  ] ) ) {   1498                                      if ( !is set( $aPre Values['Co untry'][ $ aGroupInfo ['Country' ]['Value']  ] ) ) {
1501                                          $aEr ror['Count ry'] = "Co untry does n't exists ";   1499                                          $aEr ror['Count ry'] = "Co untry does n't exists ";
1502                                          unse t( $aGroup Info['Coun try']['Val ue'] );   1500                                          unse t( $aGroup Info['Coun try']['Val ue'] );
1503                                      }   1501                                      }
1504                             break;   1502                             break;
1505                             case ' categID':   1503                             case ' categID':
1506                                 $a GroupInfo[ 'categID'] ['Value']  = (int)$aG roupInfo[' categID'][ 'Value'];   1504                                 $a GroupInfo[ 'categID'] ['Value']  = (int)$aG roupInfo[' categID'][ 'Value'];
1507                                 if ( !$aGroup Info['cate gID']['Val ue'] )   1505                                 if ( !$aGroup Info['cate gID']['Val ue'] )
1508                                      $aError[ 'categID']  = "Catego ry is requ ired";   1506                                      $aError[ 'categID']  = "Catego ry is requ ired";
1509                                 el se   1507                                 el se
1510                                      if( !$th is->isGrou psCategExi sts( $aGro upInfo['ca tegID']['V alue'] ) )  {   1508                                      if( !$th is->isGrou psCategExi sts( $aGro upInfo['ca tegID']['V alue'] ) )  {
1511                                          $aEr ror['categ ID'] = "Ca tegory doe sn't exist s";   1509                                          $aEr ror['categ ID'] = "Ca tegory doe sn't exist s";
1512                                          unse t( $aGroup Info['cate gID']['Val ue'] );   1510                                          unse t( $aGroup Info['cate gID']['Val ue'] );
1513                                      }   1511                                      }
1514                             break;   1512                             break;
1515                         }   1513                         }
1516                    brea k;   1514                    brea k;
1517                    case  'html':   1515                    case  'html':
1518                         //Commente d for poss ible modif ications   1516                         //Commente d for poss ible modif ications
1519                         /*if( !str len( $aGro upInfo[$sF ieldName][ 'Value'] )  )   1517                         /*if( !str len( $aGro upInfo[$sF ieldName][ 'Value'] )  )
1520                             $aErro r[ $sField Name ] = " {$sFieldNa me} is req uired";*/   1518                             $aErro r[ $sField Name ] = " {$sFieldNa me} is req uired";*/
1521                    brea k;   1519                    brea k;
1522                    case  'bool':   1520                    case  'bool':
1523                    brea k;   1521                    brea k;
1524                }   1522                }
1525           }   1523           }
1526     1524  
1527           re turn $aErr or;   1525           re turn $aErr or;
1528       }   1526       }
1529     1527  
1530       functi on isGroup sCategExis ts( $ID )  {   1528       functi on isGroup sCategExis ts( $ID )  {
1531           $i ID = (int) $ID;   1529           $i ID = (int) $ID;
1532     1530  
1533           if ( !$iID )   1531           if ( !$iID )
1534                return f alse;   1532                return f alse;
1535     1533  
1536           $v Res = db_r es( "SELEC T `ID` FRO M `GroupsC ateg` WHER E `ID`='{$ iID}'" );   1534           $v Res = db_r es( "SELEC T `ID` FRO M `GroupsC ateg` WHER E `ID`='{$ iID}'" );
1537     1535  
1538           if ( $vRes an d mysql_nu m_rows( $v Res ) )   1536           if ( $vRes an d mysql_nu m_rows( $v Res ) )
1539                return t rue;   1537                return t rue;
1540           el se   1538           el se
1541                return f alse;   1539                return f alse;
1542       }   1540       }
1543     1541  
1544       functi on saveGro up( $aGrou pInfo, $iG roupID = 0  ) {   1542       functi on saveGro up( $aGrou pInfo, $iG roupID = 0  ) {
1545           $i GroupID =  (int)$iGro upID;   1543           $i GroupID =  (int)$iGro upID;
1546           $s SqlSet = ' SET ';   1544           $s SqlSet = ' SET ';
1547     1545  
1548           fo reach( $aG roupInfo a s $sFieldN ame => $aF ield ) {   1546           fo reach( $aG roupInfo a s $sFieldN ame => $aF ield ) {
1549                switch(  $aField['T ype'] ) {   1547                switch(  $aField['T ype'] ) {
1550                    case  'text':   1548                    case  'text':
1551                    case  'html':   1549                    case  'html':
1552                    case  'dropdown ':   1550                    case  'dropdown ':
1553                         $sSetValue  = addslas hes( $aFie ld['Value' ] );   1551                         $sSetValue  = addslas hes( $aFie ld['Value' ] );
1554                    brea k;   1552                    brea k;
1555                    case  'bool':   1553                    case  'bool':
1556                         $sSetValue  = (string )(int)$aFi eld['Value ']; //conv ert true - > 1, false  -> 0   1554                         $sSetValue  = (string )(int)$aFi eld['Value ']; //conv ert true - > 1, false  -> 0
1557                    brea k;   1555                    brea k;
1558                    defa ult:   1556                    defa ult:
1559                         $sSetValue  = addslas hes( $aFie ld['Value' ] );   1557                         $sSetValue  = addslas hes( $aFie ld['Value' ] );
1560                }   1558                }
1561                $sSqlSet  .= "`{$aF ield['Name ']}`='{$sS etValue}',  ";   1559                $sSqlSet  .= "`{$aF ield['Name ']}`='{$sS etValue}',  ";
1562           }   1560           }
1563           $s SqlSet = s ubstr( $sS qlSet, 0,  -2 ); // r emove last  ", "   1561           $s SqlSet = s ubstr( $sS qlSet, 0,  -2 ); // r emove last  ", "
1564     1562  
1565           if  ( $iGroup ID > 0 ) {   1563           if  ( $iGroup ID > 0 ) {
1566                $sQueryS QL = "UPDA TE `Groups ` {$sSqlSe t} WHERE ` ID`='{$iGr oupID}'";   1564                $sQueryS QL = "UPDA TE `Groups ` {$sSqlSe t} WHERE ` ID`='{$iGr oupID}'";
1567                db_res(  $sQuerySQL  );   1565                db_res(  $sQuerySQL  );
1568                if( mysq l_affected _rows() )  {   1566                if( mysq l_affected _rows() )  {
1569                    $thi s->saveGro upForum( $ iGroupID,  $aGroupInf o );   1567                    $thi s->saveGro upForum( $ iGroupID,  $aGroupInf o );
1570                    retu rn true;   1568                    retu rn true;
1571                } else   1569                } else
1572                    retu rn false;   1570                    retu rn false;
1573           }  else {   1571           }  else {
1574                $sQueryS QL = "INSE RT `Groups ` {$sSqlSe t}, `creat ed`=NOW()" ;   1572                $sQueryS QL = "INSE RT `Groups ` {$sSqlSe t}, `creat ed`=NOW()" ;
1575                db_res(  $sQuerySQL  );   1573                db_res(  $sQuerySQL  );
1576                $iGroupI D = mysql_ insert_id( );   1574                $iGroupI D = mysql_ insert_id( );
1577                if( $iGr oupID ) {   1575                if( $iGr oupID ) {
1578                    $thi s->saveGro upForum( $ iGroupID,  $aGroupInf o, true );   1576                    $thi s->saveGro upForum( $ iGroupID,  $aGroupInf o, true );
1579                    retu rn $iGroup ID;   1577                    retu rn $iGroup ID;
1580                } else   1578                } else
1581                    retu rn false;   1579                    retu rn false;
1582           }   1580           }
1583       }   1581       }
1584     1582  
1585       functi on saveGro upForum( $ iGroupID,  $aGroupInf o, $bNew =  false ) {   1583       functi on saveGro upForum( $ iGroupID,  $aGroupInf o, $bNew =  false ) {
1586           $i GroupId =  (int)$iGro upID;   1584           $i GroupId =  (int)$iGro upID;
1587     1585  
1588           $s SqlSet = ' ';   1586           $s SqlSet = ' ';
1589     1587  
1590           fo reach( $aG roupInfo a s $sFieldN ame => $ar rField ) {   1588           fo reach( $aG roupInfo a s $sFieldN ame => $ar rField ) {
1591                unset( $ sSetValue  );   1589                unset( $ sSetValue  );
1592     1590  
1593                if( $sFi eldName ==  'hidden_g roup' ) {   1591                if( $sFi eldName ==  'hidden_g roup' ) {
1594                    $sSe tColumn =  "forum_typ e";   1592                    $sSe tColumn =  "forum_typ e";
1595                    $sSe tValue  =  ( $arrFiel d['Value']  ) ? 'priv ate' : 'pu blic';   1593                    $sSe tValue  =  ( $arrFiel d['Value']  ) ? 'priv ate' : 'pu blic';
1596                } elseif ( $sFieldN ame == 'Na me' ) {   1594                } elseif ( $sFieldN ame == 'Na me' ) {
1597                    $sSe tColumn =  'forum_tit le';   1595                    $sSe tColumn =  'forum_tit le';
1598                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );   1596                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );
1599                } elseif ( $sFieldN ame == 'Ab out' ) {   1597                } elseif ( $sFieldN ame == 'Ab out' ) {
1600                    $sSe tColumn =  'forum_des c';   1598                    $sSe tColumn =  'forum_des c';
1601                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );   1599                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );
1602                } elseif ( $sFieldN ame == 'Ur i' ) {   1600                } elseif ( $sFieldN ame == 'Ur i' ) {
1603                    $sSe tColumn =  'forum_uri ';   1601                    $sSe tColumn =  'forum_uri ';
1604                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );   1602                    $sSe tValue  =  addslashes ( htmlspec ialchars(  $arrField[ 'Value'] )  );
1605                }   1603                }
1606     1604  
1607                if( isse t( $sSetVa lue ) )   1605                if( isse t( $sSetVa lue ) )
1608                    $sSq lSet .= "` {$sSetColu mn}` = '{$ sSetValue} ', ";   1606                    $sSq lSet .= "` {$sSetColu mn}` = '{$ sSetValue} ', ";
1609           }   1607           }
1610     1608  
1611           if ( !strlen(  $sSqlSet  ) )   1609           if ( !strlen(  $sSqlSet  ) )
1612                return f alse;   1610                return f alse;
1613     1611  
1614           $s SqlSet = " SET " . su bstr( $sSq lSet, 0, - 2 ); // re move last  ", "   1612           $s SqlSet = " SET " . su bstr( $sSq lSet, 0, - 2 ); // re move last  ", "
1615     1613  
1616           if  ( $bNew )   1614           if  ( $bNew )
1617                $sQueryS QL = "INSE RT `grp_fo rum` {$sSq lSet}, `fo rum_id`='{ $iGroupId} ', `cat_id `=1";   1615                $sQueryS QL = "INSE RT `grp_fo rum` {$sSq lSet}, `fo rum_id`='{ $iGroupId} ', `cat_id `=1";
1618           el se   1616           el se
1619                $sQueryS QL = "UPDA TE `grp_fo rum` {$sSq lSet} WHER E `forum_i d`='{$iGro upId}'";   1617                $sQueryS QL = "UPDA TE `grp_fo rum` {$sSq lSet} WHER E `forum_i d`='{$iGro upId}'";
1620     1618  
1621           db _res( $sQu erySQL );   1619           db _res( $sQu erySQL );
1622       }   1620       }
1623     1621  
1624       functi on addMemb er2Group(  $iMemberID , $iGroupI D, $status  = 'Active ' ) {   1622       functi on addMemb er2Group(  $iMemberID , $iGroupI D, $status  = 'Active ' ) {
1625           db _res("INSE RT INTO `G roupsMembe rs` SET `m emberID`=' {$iMemberI D}', `grou pID`='{$iG roupID}',  `status`=' {$status}' , Date=NOW ()");   1623           db _res("INSE RT INTO `G roupsMembe rs` SET `m emberID`=' {$iMemberI D}', `grou pID`='{$iG roupID}',  `status`=' {$status}' , Date=NOW ()");
1626       }   1624       }
1627     1625  
1628       functi on resignG roupMember ( $iMember ID, $iGrou pID ) {   1626       functi on resignG roupMember ( $iMember ID, $iGrou pID ) {
1629           db _res( "DEL ETE FROM ` GroupsMemb ers` WHERE  `memberID `={$iMembe rID} AND ` groupID`={ $iGroupID} " );   1627           db _res( "DEL ETE FROM ` GroupsMemb ers` WHERE  `memberID `={$iMembe rID} AND ` groupID`={ $iGroupID} " );
1630       }   1628       }
1631     1629  
1632       functi on compare UpdatedGro upFields(  $aOldField s, $aNewFi elds ) {   1630       functi on compare UpdatedGro upFields(  $aOldField s, $aNewFi elds ) {
1633           $a UpdFields  = array();   1631           $a UpdFields  = array();
1634     1632  
1635           fo reach( $aO ldFields a s $sFieldN ame => $ar rOldField  ) {   1633           fo reach( $aO ldFields a s $sFieldN ame => $ar rOldField  ) {
1636                if( $arr OldField[' Value'] !=  $aNewFiel ds[$sField Name]['Val ue'] )   1634                if( $arr OldField[' Value'] !=  $aNewFiel ds[$sField Name]['Val ue'] )
1637                    $aUp dFields[$s FieldName]  = $aNewFi elds[$sFie ldName];   1635                    $aUp dFields[$s FieldName]  = $aNewFi elds[$sFie ldName];
1638           }   1636           }
1639     1637  
1640           re turn $aUpd Fields;   1638           re turn $aUpd Fields;
1641       }   1639       }
1642     1640  
1643       functi on genUplo adForm( $i GroupID, $ bBackHome  = false, $ bSetDef =  false ) {   1641       functi on genUplo adForm( $i GroupID, $ bBackHome  = false, $ bSetDef =  false ) {
1644           gl obal $site ;   1642           gl obal $site ;
1645     1643  
1646           $s SelectFile C = _t( '_ Select fil e' );   1644           $s SelectFile C = _t( '_ Select fil e' );
1647           $s SubmitC =  _t('_Submi t');   1645           $s SubmitC =  _t('_Submi t');
1648     1646  
1649           $s RetHtml .=  <<<EOF   1647           $s RetHtml .=  <<<EOF
1650   <div class ="group_up load_form" >   1648   <div class ="group_up load_form" >
1651       <form  action="{$ site['url' ]}group_ac tions.php"  method="P OST" encty pe="multip art/form-d ata">   1649       <form  action="{$ site['url' ]}group_ac tions.php"  method="P OST" encty pe="multip art/form-d ata">
1652           <i nput type= "hidden" n ame="ID" v alue="{$iG roupID}" / >   1650           <i nput type= "hidden" n ame="ID" v alue="{$iG roupID}" / >
1653           <i nput type= "hidden" n ame="a" va lue="uploa d" />   1651           <i nput type= "hidden" n ame="a" va lue="uploa d" />
1654   EOF;   1652   EOF;
1655     1653  
1656           if ( $bBackHo me ) {   1654           if ( $bBackHo me ) {
1657                $sRetHtm l .= <<<EO F   1655                $sRetHtm l .= <<<EO F
1658   <input typ e="hidden"  name="bac k" value=" home" />   1656   <input typ e="hidden"  name="bac k" value=" home" />
1659   EOF;   1657   EOF;
1660           }   1658           }
1661     1659  
1662           if ( $bSetDef  ) {   1660           if ( $bSetDef  ) {
1663                $sRetHtm l .= <<<EO F   1661                $sRetHtm l .= <<<EO F
1664   <input typ e="hidden"  name="set _def" valu e="yes" />   1662   <input typ e="hidden"  name="set _def" valu e="yes" />
1665   EOF;   1663   EOF;
1666           }   1664           }
1667     1665  
1668           $s RetHtml .=  <<<EOF   1666           $s RetHtml .=  <<<EOF
1669           {$ sSelectFil eC}<br />   1667           {$ sSelectFil eC}<br />
1670           <i nput type= "file" nam e="file" / >   1668           <i nput type= "file" nam e="file" / >
1671           <i nput type= "submit" n ame="do_su bmit" valu e="{$sSubm itC}" />   1669           <i nput type= "submit" n ame="do_su bmit" valu e="{$sSubm itC}" />
1672       </form >   1670       </form >
1673   </div>   1671   </div>
1674   EOF;   1672   EOF;
1675     1673  
1676           re turn $sRet Html;   1674           re turn $sRet Html;
1677       }   1675       }
1678     1676  
1679       functi on setGrou pThumb( $i GroupID, $ vImg ) {   1677       functi on setGrou pThumb( $i GroupID, $ vImg ) {
1680           $i GroupID =  (int)$iGro upID;   1678           $i GroupID =  (int)$iGro upID;
1681           $i Img = (int )$vImg;   1679           $i Img = (int )$vImg;
1682     1680  
1683           if ( $iGroupI D and $iIm g ) {   1681           if ( $iGroupI D and $iIm g ) {
1684                $aImg =  db_assoc_a rr( "SELEC T `ID` FRO M `GroupsG allery` WH ERE `group ID`='{$iGr oupID}' AN D `ID`='{$ iImg}'" );   1682                $aImg =  db_assoc_a rr( "SELEC T `ID` FRO M `GroupsG allery` WH ERE `group ID`='{$iGr oupID}' AN D `ID`='{$ iImg}'" );
1685                if( $aIm g['ID'] ==  $iImg ) {   1683                if( $aIm g['ID'] ==  $iImg ) {
1686                    db_r es( "UPDAT E `Groups`  SET `thum b`='{$iImg }' WHERE ` ID`='{$iGr oupID}'" ) ;   1684                    db_r es( "UPDAT E `Groups`  SET `thum b`='{$iImg }' WHERE ` ID`='{$iGr oupID}'" ) ;
1687                }   1685                }
1688           }   1686           }
1689       }   1687       }
1690     1688  
1691       functi on deleteG roupImage(  $iGroupID , $vImg )  {   1689       functi on deleteG roupImage(  $iGroupID , $vImg )  {
1692           $i GroupID =  (int)$iGro upID;   1690           $i GroupID =  (int)$iGro upID;
1693           $i Img = (int )$vImg;   1691           $i Img = (int )$vImg;
1694     1692  
1695           if ( $iGroupI D and $iIm g ) {   1693           if ( $iGroupI D and $iIm g ) {
1696                $aImg =  db_assoc_a rr( "SELEC T * FROM ` GroupsGall ery` WHERE  `groupID` ='{$iGroup ID}' AND ` ID`='{$iIm g}'" );   1694                $aImg =  db_assoc_a rr( "SELEC T * FROM ` GroupsGall ery` WHERE  `groupID` ='{$iGroup ID}' AND ` ID`='{$iIm g}'" );
1697                if( $aIm g['ID'] ==  $iImg ) {   1695                if( $aIm g['ID'] ==  $iImg ) {
1698                    db_r es( "DELET E FROM `Gr oupsGaller y` WHERE ` ID`='{$iIm g}' AND `g roupID`='{ $iGroupID} '" );   1696                    db_r es( "DELET E FROM `Gr oupsGaller y` WHERE ` ID`='{$iIm g}' AND `g roupID`='{ $iGroupID} '" );
1699                    unli nk( $this- >sGrpGalPa th . "{$iG roupID}_{$ iImg}_{$aI mg['seed'] }_.{$aImg[ 'ext']}" ) ;   1697                    unli nk( $this- >sGrpGalPa th . "{$iG roupID}_{$ iImg}_{$aI mg['seed'] }_.{$aImg[ 'ext']}" ) ;
1700                    unli nk( $this- >sGrpGalPa th . "{$iG roupID}_{$ iImg}_{$aI mg['seed'] }.{$aImg[' ext']}" );   1698                    unli nk( $this- >sGrpGalPa th . "{$iG roupID}_{$ iImg}_{$aI mg['seed'] }.{$aImg[' ext']}" );
1701                }   1699                }
1702           }   1700           }
1703       }   1701       }
1704     1702  
1705       functi on getGrou psCategLis t( $sOrder By = 'ID'  ) {   1703       functi on getGrou psCategLis t( $sOrder By = 'ID'  ) {
1706           $v Categs = d b_res( "   1704           $v Categs = d b_res( "
1707                SELECT   1705                SELECT
1708                    `Gro upsCateg`. *,   1706                    `Gro upsCateg`. *,
1709                    COUN T(`Groups` .`ID`) AS  `groupsCou nt`   1707                    COUN T(`Groups` .`ID`) AS  `groupsCou nt`
1710                FROM `Gr oupsCateg`   1708                FROM `Gr oupsCateg`
1711                LEFT JOI N `Groups`   1709                LEFT JOI N `Groups`
1712                ON ( `Gr oups`.`cat egID` = `G roupsCateg `.`ID` AND  `Groups`. `status` =  'Active'  )   1710                ON ( `Gr oups`.`cat egID` = `G roupsCateg `.`ID` AND  `Groups`. `status` =  'Active'  )
1713                GROUP BY  `GroupsCa teg`.`ID`   1711                GROUP BY  `GroupsCa teg`.`ID`
1714                ORDER BY  `GroupsCa teg`.`{$sO rderBy}`   1712                ORDER BY  `GroupsCa teg`.`{$sO rderBy}`
1715                " );   1713                " );
1716           $a Categs = f ill_assoc_ array( $vC ategs );   1714           $a Categs = f ill_assoc_ array( $vC ategs );
1717           re turn $aCat egs;   1715           re turn $aCat egs;
1718       }   1716       }
1719     1717  
1720       functi on sendReq uestToCrea tor( $iGro upID, $iMe mberID ) {   1718       functi on sendReq uestToCrea tor( $iGro upID, $iMe mberID ) {
1721           gl obal $site ;   1719           gl obal $site ;
1722     1720  
1723           $s ubject = ' Group join  request';   1721           $s ubject = ' Group join  request';
1724           $m sg = getPa ram( 'grou p_creator_ request' ) ;   1722           $m sg = getPa ram( 'grou p_creator_ request' ) ;
1725     1723  
1726           $s QuerySQL =  "   1724           $s QuerySQL =  "
1727                SELECT   1725                SELECT
1728                    `Gro ups`.`Name ` AS `grou p`,   1726                    `Gro ups`.`Name ` AS `grou p`,
1729                    `Pro files`.`ID ` AS `crea torID`,   1727                    `Pro files`.`ID ` AS `crea torID`,
1730                    `Pro files`.`Ni ckName` AS  `creator` ,   1728                    `Pro files`.`Ni ckName` AS  `creator` ,
1731                    `Pro files2`.`N ickName` A S `member`   1729                    `Pro files2`.`N ickName` A S `member`
1732                FROM `Gr oups`   1730                FROM `Gr oups`
1733                LEFT JOI N `Profile s`   1731                LEFT JOI N `Profile s`
1734                ON `Prof iles`.`ID`  = `Groups `.`creator ID`   1732                ON `Prof iles`.`ID`  = `Groups `.`creator ID`
1735                LEFT JOI N `Profile s` AS `Pro files2`   1733                LEFT JOI N `Profile s` AS `Pro files2`
1736                ON `Prof iles2`.`ID ` = '{$iMe mberID}'   1734                ON `Prof iles2`.`ID ` = '{$iMe mberID}'
1737                WHERE   1735                WHERE
1738                    `Gro ups`.`ID`  = '{$iGrou pID}'   1736                    `Gro ups`.`ID`  = '{$iGrou pID}'
1739           ";   1737           ";
1740     1738  
1741           $a rrInfo = d b_arr( $sQ uerySQL );   1739           $a rrInfo = d b_arr( $sQ uerySQL );
1742     1740  
1743           $c reatorID =  (int)$arr Info['crea torID'];   1741           $c reatorID =  (int)$arr Info['crea torID'];
1744     1742  
1745           $g roup   = h tmlspecial chars_adv(  $arrInfo[ 'group'] ) ;   1743           $g roup   = h tmlspecial chars_adv(  $arrInfo[ 'group'] ) ;
1746           $c reator = h tmlspecial chars_adv(  $arrInfo[ 'creator']  );   1744           $c reator = h tmlspecial chars_adv(  $arrInfo[ 'creator']  );
1747           $m ember  = h tmlspecial chars_adv(  $arrInfo[ 'member']  );   1745           $m ember  = h tmlspecial chars_adv(  $arrInfo[ 'member']  );
1748     1746  
1749           $m ember  = " <a href=\" {$site['ur l']}{$memb er}\">{$me mber}</a>" ;   1747           $m ember  = " <a href=\" {$site['ur l']}{$memb er}\">{$me mber}</a>" ;
1750     1748  
1751           $a pprove = " <a href=\" {$site['ur l']}group_ actions.ph p?a=approv e&amp;ID={ $iGroupID} &amp;mem={ $iMemberID }\" >appro ve</a>";   1749           $a pprove = " <a href=\" {$site['ur l']}group_ actions.ph p?a=approv e&amp;ID={ $iGroupID} &amp;mem={ $iMemberID }\" >appro ve</a>";
1752           $r eject  = " <a href=\" {$site['ur l']}group_ actions.ph p?a=reject &amp;ID={$ iGroupID}& amp;mem={$ iMemberID} \" >reject </a>";   1750           $r eject  = " <a href=\" {$site['ur l']}group_ actions.ph p?a=reject &amp;ID={$ iGroupID}& amp;mem={$ iMemberID} \" >reject </a>";
1753     1751  
1754           $m sg = str_r eplace( '{ group}',    $group,    $msg );   1752           $m sg = str_r eplace( '{ group}',    $group,    $msg );
1755           $m sg = str_r eplace( '{ creator}',  $creator,  $msg );   1753           $m sg = str_r eplace( '{ creator}',  $creator,  $msg );
1756           $m sg = str_r eplace( '{ member}',   $member,   $msg );   1754           $m sg = str_r eplace( '{ member}',   $member,   $msg );
1757           $m sg = str_r eplace( '{ approve}',  $approve,  $msg );   1755           $m sg = str_r eplace( '{ approve}',  $approve,  $msg );
1758           $m sg = str_r eplace( '{ reject}',   $reject,   $msg );   1756           $m sg = str_r eplace( '{ reject}',   $reject,   $msg );
1759     1757  
1760           $m sg = addsl ashes( $ms g );   1758           $m sg = addsl ashes( $ms g );
1761     1759  
1762           db _res( "INS ERT INTO ` Messages`   1760           db _res( "INS ERT INTO ` Messages`
1763                ( `Date` , `Sender` , `Recipie nt`, `Text `, `Subjec t`, `New`  )   1761                ( `Date` , `Sender` , `Recipie nt`, `Text `, `Subjec t`, `New`  )
1764                VALUES   1762                VALUES
1765                ( NOW(),  {$iMember ID}, {$cre atorID}, ' {$msg}', ' {$subject} ', '1' )"  );   1763                ( NOW(),  {$iMember ID}, {$cre atorID}, ' {$msg}', ' {$subject} ', '1' )"  );
1766       }   1764       }
1767     1765  
1768       functi on genAllC ategsList( ) {   1766       functi on genAllC ategsList( ) {
1769           gl obal $site ;   1767           gl obal $site ;
1770     1768  
1771           $s Ret = '';   1769           $s Ret = '';
1772     1770  
1773           $a rrCategs =  $this->ge tGroupsCat egList( 'N ame' );   1771           $a rrCategs =  $this->ge tGroupsCat egList( 'N ame' );
1774     1772  
1775           fo reach( $ar rCategs as  $arrCateg  ) {   1773           fo reach( $ar rCategs as  $arrCateg  ) {
1776                $sLink =  $this->ge tGroupsCat egUrl($arr Categ['ID' ], $arrCat eg['Uri']) ;   1774                $sLink =  $this->ge tGroupsCat egUrl($arr Categ['ID' ], $arrCat eg['Uri']) ;
1777                $sName =  htmlspeci alchars_ad v( $arrCat eg['Name']  );   1775                $sName =  htmlspeci alchars_ad v( $arrCat eg['Name']  );
1778                $sGroupC nt = _t('_ groups cou nt',$arrCa teg['group sCount']);   1776                $sGroupC nt = _t('_ groups cou nt',$arrCa teg['group sCount']);
1779     1777  
1780                $sRet .=  <<<EOF   1778                $sRet .=  <<<EOF
1781   <div class ="groups_c ategory">   1779   <div class ="groups_c ategory">
1782       <span  class="gro ups_categ_ name">   1780       <span  class="gro ups_categ_ name">
1783           <a  href="{$s Link}">{$s Name}</a>   1781           <a  href="{$s Link}">{$s Name}</a>
1784       </span >   1782       </span >
1785       &nbsp; <span clas s="groups_ categ_info ">({$sGrou pCnt})</sp an>   1783       &nbsp; <span clas s="groups_ categ_info ">({$sGrou pCnt})</sp an>
1786   </div>   1784   </div>
1787   EOF;   1785   EOF;
1788           }   1786           }
1789           re turn $sRet ;   1787           re turn $sRet ;
1790       }   1788       }
1791     1789  
1792       functi on PageCom pGroupsSea rchResults ( $sKeywor d, $sSearc hby, $iCat egID, $sCo untry, $sC ityVal, $s Sortby, $i sTopGroups Page = fal se ) {   1790       functi on PageCom pGroupsSea rchResults ( $sKeywor d, $sSearc hby, $iCat egID, $sCo untry, $sC ityVal, $s Sortby, $i sTopGroups Page = fal se ) {
1793           gl obal $oTem plConfig;   1791           gl obal $oTem plConfig;
1794           gl obal $site ;   1792           gl obal $site ;
1795           gl obal $dir;   1793           gl obal $dir;
1796           gl obal $tmpl ;   1794           gl obal $tmpl ;
1797           gl obal $aPre Values;   1795           gl obal $aPre Values;
1798     1796  
1799           $s HtmlRet =  '';   1797           $s HtmlRet =  '';
1800     1798  
1801           $d ate_format _php = get Param('php _date_form at');   1799           $d ate_format _php = get Param('php _date_form at');
1802     1800  
1803           if ( $sSortby  == 'creat ed' or $sS ortby == ' membersCou nt' )   1801           if ( $sSortby  == 'creat ed' or $sS ortby == ' membersCou nt' )
1804                $sortOrd er = 'DESC ';   1802                $sortOrd er = 'DESC ';
1805           el se   1803           el se
1806                $sortOrd er = 'ASC' ;   1804                $sortOrd er = 'ASC' ;
1807     1805  
1808           $a QueryWhere  = array() ; //array  will conta in search  conditions  combined  by AND   1806           $a QueryWhere  = array() ; //array  will conta in search  conditions  combined  by AND
1809     1807  
1810           if ( $sKeywor d ) {   1808           if ( $sKeywor d ) {
1811                if( $sSe archby ==  'name' )   1809                if( $sSe archby ==  'name' )
1812                    $aQu eryWhere[]  = "UPPER( `Groups`.` Name`) LIK E '%{$sKey word}%'";   1810                    $aQu eryWhere[]  = "UPPER( `Groups`.` Name`) LIK E '%{$sKey word}%'";
1813                else   1811                else
1814                    $aQu eryWhere[]  = "(UPPER (`Groups`. `Name`) LI KE '%{$sKe yword}%')  OR (UPPER( `Groups`.` About`) LI KE '%{$sKe yword}%')  OR (UPPER( `Groups`.` Desc`) LIK E '%{$sKey word}%')";   1812                    $aQu eryWhere[]  = "(UPPER (`Groups`. `Name`) LI KE '%{$sKe yword}%')  OR (UPPER( `Groups`.` About`) LI KE '%{$sKe yword}%')  OR (UPPER( `Groups`.` Desc`) LIK E '%{$sKey word}%')";
1815           }   1813           }
1816     1814  
1817           if ( $iCategI D )   1815           if ( $iCategI D )
1818                $aQueryW here[] = " `Groups`.` categID`=' {$iCategID }'";   1816                $aQueryW here[] = " `Groups`.` categID`=' {$iCategID }'";
1819     1817  
1820           if ( $sCountr y )   1818           if ( $sCountr y )
1821                $aQueryW here[] = " `Groups`.` Country`=' {$sCountry }'";   1819                $aQueryW here[] = " `Groups`.` Country`=' {$sCountry }'";
1822     1820  
1823           if ( $sCityVa l )   1821           if ( $sCityVa l )
1824                $aQueryW here[] = " UPPER(`Gro ups`.`City `) LIKE '% {$sCityVal }%'";   1822                $aQueryW here[] = " UPPER(`Gro ups`.`City `) LIKE '% {$sCityVal }%'";
1825     1823  
1826           $a QueryWhere [] = "`Gro ups`.`stat us` = 'Act ive'";   1824           $a QueryWhere [] = "`Gro ups`.`stat us` = 'Act ive'";
1827     1825  
1828           $s QueryWhere  = "WHERE  (" . implo de( ") AND  (", $aQue ryWhere )  . ")";   1826           $s QueryWhere  = "WHERE  (" . implo de( ") AND  (", $aQue ryWhere )  . ")";
1829     1827  
1830           if ( $isTopGr oupsPage )   1828           if ( $isTopGr oupsPage )
1831                $SRdbTit le = _t( ' _Top Group s' );   1829                $SRdbTit le = _t( ' _Top Group s' );
1832           el se   1830           el se
1833                $SRdbTit le = _t( ' _Groups se arch resul ts' ); //S earchResul tDesignBox Title   1831                $SRdbTit le = _t( ' _Groups se arch resul ts' ); //S earchResul tDesignBox Title
1834     1832  
1835           $a rrNum = db _arr( "SEL ECT COUNT( `ID`) FROM  `Groups`  {$sQueryWh ere}" );   1833           $a rrNum = db _arr( "SEL ECT COUNT( `ID`) FROM  `Groups`  {$sQueryWh ere}" );
1836     1834  
1837           $i TotalNum =  (int)$arr Num[0];   1835           $i TotalNum =  (int)$arr Num[0];
1838           if ( $iTotalN um > 0 ) {   1836           if ( $iTotalN um > 0 ) {
1839                $iPerPag e = $oTemp lConfig ->  iGroupsSe archResPer Page;   1837                $iPerPag e = $oTemp lConfig ->  iGroupsSe archResPer Page;
1840                $iPagesN um = ceil(  $iTotalNu m / $iPerP age );   1838                $iPagesN um = ceil(  $iTotalNu m / $iPerP age );
1841                $iPage =  (int)$_RE QUEST['pag e'];   1839                $iPage =  (int)$_RE QUEST['pag e'];
1842     1840  
1843                if( $iPa ge < 1 )   1841                if( $iPa ge < 1 )
1844                    $iPa ge = 1;   1842                    $iPa ge = 1;
1845                if( $iPa ge > $iPag esNum )   1843                if( $iPa ge > $iPag esNum )
1846                    $iPa ge = $iPag esNum;   1844                    $iPa ge = $iPag esNum;
1847     1845  
1848                $iSqlFro m = ( ( $i Page - 1 )  * $iPerPa ge );   1846                $iSqlFro m = ( ( $i Page - 1 )  * $iPerPa ge );
1849     1847  
1850                $sQuery  = "   1848                $sQuery  = "
1851                    SELE CT   1849                    SELE CT
1852                         `Groups`.* ,   1850                         `Groups`.* ,
    1851                         UNIX_TIMES TAMP( `Gro ups`.`crea ted`) AS ' created_UT S',
1853                         `GroupsCat eg`.`Name`  AS `categ Name`,   1852                         `GroupsCat eg`.`Name`  AS `categ Name`,
1854                         `GroupsCat eg`.`Uri`  AS `categU ri`,   1853                         `GroupsCat eg`.`Uri`  AS `categU ri`,
1855                         COUNT( `Gr oupsMember s`.`member ID` ) AS ` membersCou nt`,   1854                         COUNT( `Gr oupsMember s`.`member ID` ) AS ` membersCou nt`,
1856                         `GroupsGal lery`.`see d`,   1855                         `GroupsGal lery`.`see d`,
1857                         `GroupsGal lery`.`ext ` AS `thum bExt`   1856                         `GroupsGal lery`.`ext ` AS `thum bExt`
1858                    FROM  `Groups`   1857                    FROM  `Groups`
1859                    INNE R JOIN `Gr oupsCateg`  ON `Group sCateg`.`I D` = `Grou ps`.`categ ID`   1858                    INNE R JOIN `Gr oupsCateg`  ON `Group sCateg`.`I D` = `Grou ps`.`categ ID`
1860                    LEFT  JOIN `Gro upsMembers `   1859                    LEFT  JOIN `Gro upsMembers `
1861                         ON (`Group sMembers`. `groupID`  = `Groups` .`ID` AND  `GroupsMem bers`.`sta tus`='Acti ve')   1860                         ON (`Group sMembers`. `groupID`  = `Groups` .`ID` AND  `GroupsMem bers`.`sta tus`='Acti ve')
1862                    LEFT  JOIN `Gro upsGallery `   1861                    LEFT  JOIN `Gro upsGallery `
1863                         ON (`Group s`.`thumb`  = `Groups Gallery`.` ID`)   1862                         ON (`Group s`.`thumb`  = `Groups Gallery`.` ID`)
1864                    {$sQ ueryWhere}   1863                    {$sQ ueryWhere}
1865                    GROU P BY `Grou ps`.`ID`   1864                    GROU P BY `Grou ps`.`ID`
1866                    ORDE R BY `{$sS ortby}` {$ sortOrder} , `Groups` .`ID` DESC   1865                    ORDE R BY `{$sS ortby}` {$ sortOrder} , `Groups` .`ID` DESC
1867                    LIMI T {$iSqlFr om}, {$iPe rPage}   1866                    LIMI T {$iSqlFr om}, {$iPe rPage}
1868                ";   1867                ";
1869     1868  
1870                $vResGro ups = db_r es( $sQuer y );   1869                $vResGro ups = db_r es( $sQuer y );
1871     1870  
1872                $iNumOnP age = mysq l_num_rows ( $vResGro ups );   1871                $iNumOnP age = mysq l_num_rows ( $vResGro ups );
1873                $iShowin gFrom = $i SqlFrom +  1;   1872                $iShowin gFrom = $i SqlFrom +  1;
1874                $iShowin gTo   = $i SqlFrom +  $iNumOnPag e;   1873                $iShowin gTo   = $i SqlFrom +  $iNumOnPag e;
1875     1874  
1876                $sShowin gResults =  _t( '_Sho wing resul ts:', $iSh owingFrom,  $iShowing To, $iTota lNum );   1875                $sShowin gResults =  _t( '_Sho wing resul ts:', $iSh owingFrom,  $iShowing To, $iTota lNum );
1877     1876  
1878                if( $iPa gesNum > 1  and !$isT opGroupsPa ge ) {   1877                if( $iPa gesNum > 1  and !$isT opGroupsPa ge ) {
1879                    $sPa gesUrl = " javascript :void(0);" ;   1878                    $sPa gesUrl = " javascript :void(0);" ;
1880                    $pag esOnclick  = "switchG roupsSearc hPage({pag e}); retur n false;";   1879                    $pag esOnclick  = "switchG roupsSearc hPage({pag e}); retur n false;";
1881                    $sGe nPaginatio n = genPag ination( $ iPagesNum,  $iPage, $ sPagesUrl,  $pagesOnc lick );   1880                    $sGe nPaginatio n = genPag ination( $ iPagesNum,  $iPage, $ sPagesUrl,  $pagesOnc lick );
1882                }   1881                }
1883     1882  
1884                $sRowTmp l = file_g et_content s("{$dir[' root']}tem plates/tmp l_{$tmpl}/ searchrow_ group.html ");   1883                $sRowTmp l = file_g et_content s("{$dir[' root']}tem plates/tmp l_{$tmpl}/ searchrow_ group.html ");
1885     1884  
1886                $sBreadC rumbs = '' ;   1885                $sBreadC rumbs = '' ;
1887                if( $iCa tegID ) {   1886                if( $iCa tegID ) {
1888                    $arr Categ = db _arr( "SEL ECT `Name`  FROM `Gro upsCateg`  WHERE `ID` ='{$iCateg ID}'" );   1887                    $arr Categ = db _arr( "SEL ECT `Name`  FROM `Gro upsCateg`  WHERE `ID` ='{$iCateg ID}'" );
1889                    if(  $arrCateg[ 'Name'] )  {   1888                    if(  $arrCateg[ 'Name'] )  {
1890                         $sCategNam e = _t( '_ Category'  ).': '.htm lspecialch ars_adv( $ arrCateg[' Name'] );   1889                         $sCategNam e = _t( '_ Category'  ).': '.htm lspecialch ars_adv( $ arrCateg[' Name'] );
1891                         $SRdbTitle  = $sCateg Name;   1890                         $SRdbTitle  = $sCateg Name;
1892     1891  
1893                         $sGroupsUr l = $this- >bUseFrien dlyLinks ?  'groups/a ll' : $thi s->sCurrFi le ;   1892                         $sGroupsUr l = $this- >bUseFrien dlyLinks ?  'groups/a ll' : $thi s->sCurrFi le ;
1894                         $sBreadCru mbs = <<<E OJ   1893                         $sBreadCru mbs = <<<E OJ
1895   <div class ="groups_b readcrumbs ">   1894   <div class ="groups_b readcrumbs ">
1896       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /   1895       <a hre f="{$site[ 'url']}">{ $site['tit le']}</a>  /
1897       <a hre f="{$site[ 'url']}{$s GroupsUrl} ">__Groups __</a> /   1896       <a hre f="{$site[ 'url']}{$s GroupsUrl} ">__Groups __</a> /
1898       <span  class="act ive_link"> {$sCategNa me}</span>   1897       <span  class="act ive_link"> {$sCategNa me}</span>
1899   </div>   1898   </div>
1900   EOJ;   1899   EOJ;
1901     1900  
1902                         $sBreadCru mbs = str_ replace( " __Groups__ ", _t( "_G roups" ),  $sBreadCru mbs );   1901                         $sBreadCru mbs = str_ replace( " __Groups__ ", _t( "_G roups" ),  $sBreadCru mbs );
1903                    }   1902                    }
1904                }   1903                }
1905     1904  
1906                 if(   !$isTopGro upsPage   )
  1905                 if(   !$isTopGro upsPage   )   {
1907                {    
1908                    $sHt mlRet .= < <<EOF   1906                    $sHt mlRet .= < <<EOF
1909   {$sBreadCr umbs}   1907   {$sBreadCr umbs}
    1908  
    1909   <script ty pe="text/j avascript"  language= "javascrip t">
    1910       functi on switchG roupsSearc hPage(page ) {
    1911           _f orm = docu ment.forms .groups_se arch_form;
    1912           if ( !_form )
    1913                return f alse;
    1914  
    1915           _f orm.keywor d.value =  keyword;
    1916           _f orm.categI D.value =  categID;
    1917           _f orm.Countr y.value =  Country;
    1918           _f orm.City.v alue    =  City;
    1919  
    1920           fo r( i = 0;  i < _form. searchby.l ength; i + + )
    1921                if( _for m.searchby [i].value  == searchb y )
    1922                    _for m.searchby [i].checke d = true;
    1923  
    1924           fo r( i = 0;  i < _form. sortby.len gth; i ++  )
    1925                if( _for m.sortby[i ].value ==  sortby )
    1926                    _for m.sortby[i ].checked  = true;
    1927  
    1928           _f orm.page.v alue = pag e;
    1929  
    1930           _f orm.submit ();
    1931           re turn true;
    1932       }
    1933   </script>
    1934  
1910   <div class ="groups_s howing_res ults">   1935   <div class ="groups_s howing_res ults">
1911       {$sSho wingResult s}   1936       {$sSho wingResult s}
1912   </div>   1937   </div>
1913   <div class ="groups_p agination" >   1938   <div class ="groups_p agination" >
1914       {$sGen Pagination }   1939       {$sGen Pagination }
1915   </div>   1940   </div>
1916   EOF;   1941   EOF;
1917                }   1942                }
1918     1943  
1919                $sHtmlRe t .= <<<EO F   1944                $sHtmlRe t .= <<<EO F
1920   <div class ="groups_r esult_wrap per">   1945   <div class ="groups_r esult_wrap per">
1921   EOF;   1946   EOF;
1922     1947  
1923                while( $ aGroupInfo  = mysql_f etch_assoc ( $vResGro ups ) ) {   1948                while( $ aGroupInfo  = mysql_f etch_assoc ( $vResGro ups ) ) {
1924                    $sGr oupLink =  $this->get GroupUrl($ aGroupInfo ['ID'], $a GroupInfo[ 'Uri']);   1949                    $sGr oupLink =  $this->get GroupUrl($ aGroupInfo ['ID'], $a GroupInfo[ 'Uri']);
1925                    $sCa tegLink =  $this->get GroupsCate gUrl($aGro upInfo['ca tegID'],$a GroupInfo[ 'categUri' ]);   1950                    $sCa tegLink =  $this->get GroupsCate gUrl($aGro upInfo['ca tegID'],$a GroupInfo[ 'categUri' ]);
1926     1951  
1927                    $aRo wTmpl = ar ray();   1952                    $aRo wTmpl = ar ray();
1928     1953  
1929                    if (  $aGroupIn fo['thumb' ] and file _exists($t his->sGrpG alPath . " {$aGroupIn fo['ID']}_ {$aGroupIn fo['thumb' ]}_{$aGrou pInfo['see d']}_.{$aG roupInfo[' thumbExt'] }" ) )   1954                    if (  $aGroupIn fo['thumb' ] and file _exists($t his->sGrpG alPath . " {$aGroupIn fo['ID']}_ {$aGroupIn fo['thumb' ]}_{$aGrou pInfo['see d']}_.{$aG roupInfo[' thumbExt'] }" ) )
1930                         $groupImag eUrl = "{$ site['grou ps_gallery ']}{$aGrou pInfo['ID' ]}_{$aGrou pInfo['thu mb']}_{$aG roupInfo[' seed']}_.{ $aGroupInf o['thumbEx t']}";   1955                         $groupImag eUrl = "{$ site['grou ps_gallery ']}{$aGrou pInfo['ID' ]}_{$aGrou pInfo['thu mb']}_{$aG roupInfo[' seed']}_.{ $aGroupInf o['thumbEx t']}";
1931                    else   1956                    else
1932                         $groupImag eUrl = "{$ site['grou ps_gallery ']}no_pic. gif";   1957                         $groupImag eUrl = "{$ site['grou ps_gallery ']}no_pic. gif";
1933     1958  
1934                    if(  (int)$aGro upInfo['hi dden_group '] )   1959                    if(  (int)$aGro upInfo['hi dden_group '] )
1935                         $typeHelp  = 7;   1960                         $typeHelp  = 7;
1936                    else   1961                    else
1937                         if( (int)$ aGroupInfo ['open_joi n'] )   1962                         if( (int)$ aGroupInfo ['open_joi n'] )
1938                             $typeH elp = 5;   1963                             $typeH elp = 5;
1939                         else   1964                         else
1940                             $typeH elp = 6;   1965                             $typeH elp = 6;
1941     1966  
1942                    $typ eHelpLink  = "{$site[ 'url']}{$t his->sCurr File}?acti on=help&am p;i=$typeH elp";   1967                    $typ eHelpLink  = "{$site[ 'url']}{$t his->sCurr File}?acti on=help&am p;i=$typeH elp";
1943     1968  
1944                    $aRo wTmpl['gro up_name_l' ]    = _t(  '_Group n ame' );   1969                    $aRo wTmpl['gro up_name_l' ]    = _t(  '_Group n ame' );
1945                    $aRo wTmpl['cat egory_l']       = _t(  '_Categor y' );   1970                    $aRo wTmpl['cat egory_l']       = _t(  '_Categor y' );
1946                    $aRo wTmpl['abo ut_group_l ']   = _t(  '_About g roup' );   1971                    $aRo wTmpl['abo ut_group_l ']   = _t(  '_About g roup' );
1947                    $aRo wTmpl['mem bers_count _l'] = _t(  '_Members  count' );   1972                    $aRo wTmpl['mem bers_count _l'] = _t(  '_Members  count' );
1948                    $aRo wTmpl['cre ated_l']        = _t(  '_Created ' );   1973                    $aRo wTmpl['cre ated_l']        = _t(  '_Created ' );
1949                    $aRo wTmpl['gro up_type_l' ]    = _t(  '_Group t ype' );   1974                    $aRo wTmpl['gro up_type_l' ]    = _t(  '_Group t ype' );
1950                    $aRo wTmpl['loc ation_l']       = _t(  '_Locatio n' );   1975                    $aRo wTmpl['loc ation_l']       = _t(  '_Locatio n' );
1951                    $aRo wTmpl['gro up_type_he lp'] = '<a  href="'.$ typeHelpLi nk.'" targ et="_blank " onclick= "window.op en(this.hr ef,\'helpw in\',\'wid th=350,hei ght=200\') ;return fa lse;" >'._ t( "_help"  ).'</a>';   1976                    $aRo wTmpl['gro up_type_he lp'] = '<a  href="'.$ typeHelpLi nk.'" targ et="_blank " onclick= "window.op en(this.hr ef,\'helpw in\',\'wid th=350,hei ght=200\') ;return fa lse;" >'._ t( "_help"  ).'</a>';
1952     1977  
1953                    $sGr oupName =  htmlspecia lchars_adv ( $aGroupI nfo['Name' ] );   1978                    $sGr oupName =  htmlspecia lchars_adv ( $aGroupI nfo['Name' ] );
1954                    $aRo wTmpl['thu mbnail']      = <<<EO F   1979                    $aRo wTmpl['thu mbnail']      = <<<EO F
1955   <a href="{ $sGroupLin k}">   1980   <a href="{ $sGroupLin k}">
1956       <img s rc="{$this ->sSpacerI con}" styl e="width:1 10px;heigh t:110px; b ackground- image: url ({$groupIm ageUrl});"  class="ph oto1" alt= "{$sGroupN ame}" />   1981       <img s rc="{$this ->sSpacerI con}" styl e="width:1 10px;heigh t:110px; b ackground- image: url ({$groupIm ageUrl});"  class="ph oto1" alt= "{$sGroupN ame}" />
1957   </a>   1982   </a>
1958   EOF;   1983   EOF;
1959                    /*$a RowTmpl['t humbnail']      = "<! --<div cla ss=\"group _thumb\">- -><a href= \"$sGroupL ink\">   1984                    /*$a RowTmpl['t humbnail']      = "<! --<div cla ss=\"group _thumb\">- -><a href= \"$sGroupL ink\">
1960                                                       <! --<img src =\"{$group ImageUrl}\ " />-->   1985                                                       <! --<img src =\"{$group ImageUrl}\ " />-->
1961                                                       <i mg src=\"{ $this->sSp acerIcon}\ " style=\" width:110p x;height:1 10px; back ground-ima ge: url({$ groupImage Url});\" c lass=\"pho to1\" alt= \"{$sGroup Name}\" />   1986                                                       <i mg src=\"{ $this->sSp acerIcon}\ " style=\" width:110p x;height:1 10px; back ground-ima ge: url({$ groupImage Url});\" c lass=\"pho to1\" alt= \"{$sGroup Name}\" />
1962                                                       </ a><!--</di v>-->";*/   1987                                                       </ a><!--</di v>-->";*/
1963                    $aRo wTmpl['gro up_name']     = "<a c lass=\"act ions\" hre f=\"{$sGro upLink}\"> ".$sGroupN ame."</a>" ;   1988                    $aRo wTmpl['gro up_name']     = "<a c lass=\"act ions\" hre f=\"{$sGro upLink}\"> ".$sGroupN ame."</a>" ;
1964                    $aRo wTmpl['gro up_about']    = htmls pecialchar s_adv( $aG roupInfo[' About'] );   1989                    $aRo wTmpl['gro up_about']    = htmls pecialchar s_adv( $aG roupInfo[' About'] );
1965                    $aRo wTmpl['cat egory']       = "<a h ref=\"{$sC ategLink}\ ">".htmlsp ecialchars _adv( $aGr oupInfo['c ategName']  )."</a>";   1990                    $aRo wTmpl['cat egory']       = "<a h ref=\"{$sC ategLink}\ ">".htmlsp ecialchars _adv( $aGr oupInfo['c ategName']  )."</a>";
1966                    $aRo wTmpl['mem bers_count '] = $aGro upInfo['me mbersCount '];   1991                    $aRo wTmpl['mem bers_count '] = $aGro upInfo['me mbersCount '];
1967                    
$aRowTmpl[ 'created']         =   date(   $date_form at_php,   strtotime(   $aGroupInf o['created ']   )   );
  1992                     // $aRowTmpl[ 'created']         =   date(   $date_form at_php,   strtotime(   $aGroupInf o['created ']   )   );
    1993                    $aRo wTmpl['cre ated']        = Local edDataTime ($aGroupIn fo['create d_UTS']);
1968                    $aRo wTmpl['gro up_type']     = _t( (  ( (int)$a GroupInfo[ 'open_join '] and !(i nt)$aGroup Info['hidd en_group']  ) ? '_Pub lic group'  : '_Priva te group'  ) );   1994                    $aRo wTmpl['gro up_type']     = _t( (  ( (int)$a GroupInfo[ 'open_join '] and !(i nt)$aGroup Info['hidd en_group']  ) ? '_Pub lic group'  : '_Priva te group'  ) );
1969                    $aRo wTmpl['cou ntry']        = _t( $ aPreValues ['Country' ][ $aGroup Info['Coun try'] ]['L Key'] );   1995                    $aRo wTmpl['cou ntry']        = _t( $ aPreValues ['Country' ][ $aGroup Info['Coun try'] ]['L Key'] );
1970                    $aRo wTmpl['cit y']           = htmls pecialchar s_adv( $aG roupInfo[' City'] );   1996                    $aRo wTmpl['cit y']           = htmls pecialchar s_adv( $aG roupInfo[' City'] );
1971     1997  
1972                    $sRo w = $sRowT mpl;   1998                    $sRo w = $sRowT mpl;
1973                    fore ach( $aRow Tmpl as $w hat => $to  )   1999                    fore ach( $aRow Tmpl as $w hat => $to  )
1974                         $sRow = st r_replace(  "__{$what }__", $to,  $sRow );   2000                         $sRow = st r_replace(  "__{$what }__", $to,  $sRow );
1975     2001  
1976                    $sHt mlRet .= $ sRow;   2002                    $sHt mlRet .= $ sRow;
1977                }   2003                }
1978     2004  
1979                $sHtmlRe t .= <<<EO F   2005                $sHtmlRe t .= <<<EO F
1980       <div c lass="clea r_both"></ div>   2006       <div c lass="clea r_both"></ div>
1981   </div>   2007   </div>
1982   EOF;   2008   EOF;
1983     2009  
1984                if( !$is TopGroupsP age ) {   2010                if( !$is TopGroupsP age ) {
1985                    $sHt mlRet .= < <<EOF   2011                    $sHt mlRet .= < <<EOF
1986   <div class ="groups_s howing_res ults">   2012   <div class ="groups_s howing_res ults">
1987       {$sSho wingResult s}   2013       {$sSho wingResult s}
1988   </div>   2014   </div>
1989   <div class ="groups_p agination" >   2015   <div class ="groups_p agination" >
1990       {$sGen Pagination }   2016       {$sGen Pagination }
1991   </div>   2017   </div>
1992   EOF;   2018   EOF;
1993                }   2019                }
1994                $sRet =  $sHtmlRet;   2020                $sRet =  $sHtmlRet;
1995           }  else {   2021           }  else {
1996                $sRet =  MsgBox(_t(  '_Sorry,  no groups  found' ));   2022                $sRet =  MsgBox(_t(  '_Sorry,  no groups  found' ));
1997           }   2023           }
1998     2024  
1999           re turn Desig nBoxConten t( $SRdbTi tle, $sRet , $oTemplC onfig->iGr oupsSearch Results_db num );   2025           re turn Desig nBoxConten t( $SRdbTi tle, $sRet , $oTemplC onfig->iGr oupsSearch Results_db num );
2000       }   2026       }
2001     2027  
2002       functi on getGrou pIdByUri($ sUri) {   2028       functi on getGrou pIdByUri($ sUri) {
2003           $s Uri = proc ess_db_inp ut($sUri);   2029           $s Uri = proc ess_db_inp ut($sUri);
2004           $s qlQuery =  "SELECT `I D` FROM `G roups` WHE RE `Uri`=' {$sUri}'";   2030           $s qlQuery =  "SELECT `I D` FROM `G roups` WHE RE `Uri`=' {$sUri}'";
2005           $i Id = (int) db_value($ sqlQuery);   2031           $i Id = (int) db_value($ sqlQuery);
2006           re turn $iId;   2032           re turn $iId;
2007       }   2033       }
2008     2034  
2009       functi on getGrou pUrl($iGro upId, $sGr oupUri) {   2035       functi on getGrou pUrl($iGro upId, $sGr oupUri) {
2010           $s Link = $th is->bUseFr iendlyLink s ? 'group s/entry/'. $sGroupUri  : $this-> sCurrFile. '?action=g roup&ID='. $iGroupId;   2036           $s Link = $th is->bUseFr iendlyLink s ? 'group s/entry/'. $sGroupUri  : $this-> sCurrFile. '?action=g roup&ID='. $iGroupId;
2011           re turn $GLOB ALS['site' ]['url'].$ sLink;   2037           re turn $GLOB ALS['site' ]['url'].$ sLink;
2012       }   2038       }
2013     2039  
2014       functi on getGrou psCategUrl ($iCatId,  $sCatUri)  {   2040       functi on getGrou psCategUrl ($iCatId,  $sCatUri)  {
2015           $s Link = $th is->bUseFr iendlyLink s ? 'group s/category /'.$sCatUr i : $this- >sCurrFile .'?action= categ&amp; categID='. $iCatId;   2041           $s Link = $th is->bUseFr iendlyLink s ? 'group s/category /'.$sCatUr i : $this- >sCurrFile .'?action= categ&amp; categID='. $iCatId;
2016           re turn $GLOB ALS['site' ]['url'].$ sLink;   2042           re turn $GLOB ALS['site' ]['url'].$ sLink;
2017       }   2043       }
2018     2044  
2019       functi on GetGrou pPicture($ iGroupID)  {   2045       functi on GetGrou pPicture($ iGroupID)  {
2020           gl obal $dir;   2046           gl obal $dir;
2021           gl obal $site ;   2047           gl obal $site ;
2022     2048  
2023           $s PicNotAvai l = getTem plateIcon(  'group_no _pic.gif'  );   2049           $s PicNotAvai l = getTem plateIcon(  'group_no _pic.gif'  );
2024           $s Request =  "SELECT `t humb`, `Ur i` FROM `G roups` WHE RE `ID` =  {$iGroupID } LIMIT 1" ;   2050           $s Request =  "SELECT `t humb`, `Ur i` FROM `G roups` WHE RE `ID` =  {$iGroupID } LIMIT 1" ;
2025     2051  
2026           $a ResPic = d b_arr($sRe quest);   2052           $a ResPic = d b_arr($sRe quest);
2027           $i GroupPicID  = (int)$a ResPic['th umb'];   2053           $i GroupPicID  = (int)$a ResPic['th umb'];
2028           $s Request =  "SELECT *  FROM `Grou psGallery`  WHERE `ID ` = {$iGro upPicID}";   2054           $s Request =  "SELECT *  FROM `Grou psGallery`  WHERE `ID ` = {$iGro upPicID}";
2029           $a ResPicName  = db_arr( $sRequest) ;   2055           $a ResPicName  = db_arr( $sRequest) ;
2030           $s PicName =  $aResPicNa me['groupI D'].'_'.$a ResPicName ['ID'].'_' .$aResPicN ame['seed' ].'_icon.' .$aResPicN ame['ext'] ;   2056           $s PicName =  $aResPicNa me['groupI D'].'_'.$a ResPicName ['ID'].'_' .$aResPicN ame['seed' ].'_icon.' .$aResPicN ame['ext'] ;
2031           $i ThumbSize  = 45;   2057           $i ThumbSize  = 45;
2032           $s EventPicNa me = $sPic Name;   2058           $s EventPicNa me = $sPic Name;
2033     2059  
2034           $s GroupLink  = $this->g etGroupUrl ($iGroupID , $aResPic ['Uri']);   2060           $s GroupLink  = $this->g etGroupUrl ($iGroupID , $aResPic ['Uri']);
2035     2061  
2036           $s EventPicNa me = ( str len(trim($ sEventPicN ame)) && f ile_exists ('groups/g allery/' .  $sEventPi cName) )   2062           $s EventPicNa me = ( str len(trim($ sEventPicN ame)) && f ile_exists ('groups/g allery/' .  $sEventPi cName) )
2037                    ? "< img class= \"icons\"  alt=\"\" s tyle=\"wid th:{$iThum bSize}px;h eight:{$iT humbSize}p x;backgrou nd-image:u rl(groups/ gallery/{$ sTypePic}{ $sEventPic Name});\"  src=\"{$th is->sSpace rIcon}\" / >"   2063                    ? "< img class= \"icons\"  alt=\"\" s tyle=\"wid th:{$iThum bSize}px;h eight:{$iT humbSize}p x;backgrou nd-image:u rl(groups/ gallery/{$ sTypePic}{ $sEventPic Name});\"  src=\"{$th is->sSpace rIcon}\" / >"
2038                    : "< img class= \"icons\"  alt=\"\" s tyle=\"wid th:{$iThum bSize}px;h eight:{$iT humbSize}p x;backgrou nd-image:u rl({$sPicN otAvail}); \" src=\"{ $this->sSp acerIcon}\ " />";   2064                    : "< img class= \"icons\"  alt=\"\" s tyle=\"wid th:{$iThum bSize}px;h eight:{$iT humbSize}p x;backgrou nd-image:u rl({$sPicN otAvail}); \" src=\"{ $this->sSp acerIcon}\ " />";
2039           $s EventPic =  <<<EOF   2065           $s EventPic =  <<<EOF
2040   <div  clas s="thumbna il_block"  style="flo at:left;">   2066   <div  clas s="thumbna il_block"  style="flo at:left;">
2041       <a hre f="{$sGrou pLink}">   2067       <a hre f="{$sGrou pLink}">
2042           {$ sEventPicN ame}   2068           {$ sEventPicN ame}
2043       </a>   2069       </a>
2044   </div>   2070   </div>
2045   EOF;   2071   EOF;
2046           re turn $sEve ntPic;   2072           re turn $sEve ntPic;
2047       }   2073       }
2048     2074  
2049       functi on GenAnyB lockConten t($sOrder= 'latest',  $iProfileI D=0, $sLim it="LIMIT  5" ) {   2075       functi on GenAnyB lockConten t($sOrder= 'latest',  $iProfileI D=0, $sLim it="LIMIT  5" ) {
2050           gl obal $site ;   2076           gl obal $site ;
2051     2077  
2052           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );   2078           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );
2053           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;   2079           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;
2054           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );   2080           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );
2055     2081  
2056           $s OrderS = ' ';   2082           $s OrderS = ' ';
2057           sw itch ($sOr der) {   2083           sw itch ($sOr der) {
2058                case 'la test':   2084                case 'la test':
2059                    $sOr derS = 'OR DER BY `Gr oups`.`cre ated` DESC ';   2085                    $sOr derS = 'OR DER BY `Gr oups`.`cre ated` DESC ';
2060                break;   2086                break;
2061                case 'ra nd':   2087                case 'ra nd':
2062                    $sOr derS = 'OR DER BY RAN D()';   2088                    $sOr derS = 'OR DER BY RAN D()';
2063                break;   2089                break;
2064           }   2090           }
2065           $s ProfileS =  '1';   2091           $s ProfileS =  '1';
2066           $s GrpJoin =  '';   2092           $s GrpJoin =  '';
2067           if  ($iProfil eID>0) {   2093           if  ($iProfil eID>0) {
2068                $sGrpJoi n = 'INNER  JOIN `Gro upsMembers ` ON `Grou psMembers` .`groupID` =`Groups`. `ID` ';   2094                $sGrpJoi n = 'INNER  JOIN `Gro upsMembers ` ON `Grou psMembers` .`groupID` =`Groups`. `ID` ';
2069                $sProfil eS = <<<EO F   2095                $sProfil eS = <<<EO F
2070   `GroupsMem bers`.`mem berID` = ' {$iProfile ID}' AND   2096   `GroupsMem bers`.`mem berID` = ' {$iProfile ID}' AND
2071   `GroupsMem bers`.`sta tus`   = ' Active'   2097   `GroupsMem bers`.`sta tus`   = ' Active'
2072   EOF;   2098   EOF;
2073           }  else {   2099           }  else {
2074                $sProfil eS = "`Gro ups`.`Stat us` = 'Act ive'";   2100                $sProfil eS = "`Gro ups`.`Stat us` = 'Act ive'";
2075           }   2101           }
2076     2102  
2077           // INNER JOIN  `GroupsCa teg` ON `G roupsCateg `.`ID` = ` Groups`.`c ategID`    2103           // INNER JOIN  `GroupsCa teg` ON `G roupsCateg `.`ID` = ` Groups`.`c ategID` 
2078           // `GroupsCat eg`.`Name`  AS 'Categ Name', `Gr oupsCateg` .`Uri` as  `CategUri`   2104           // `GroupsCat eg`.`Name`  AS 'Categ Name', `Gr oupsCateg` .`Uri` as  `CategUri`
2079           $s Query = "   2105           $s Query = "
2080                SELECT D ISTINCT `G roups`.`ID `, `Groups `.`Name`,  `Groups`.` Uri`, `Gro ups`.`cate gID` AS `C ategID`,   2106                SELECT D ISTINCT `G roups`.`ID `, `Groups `.`Name`,  `Groups`.` Uri`, `Gro ups`.`cate gID` AS `C ategID`,
2081                LEFT(`Gr oups`.`Des c`, {$iBlo gLimitChar s}) as 'De sc_f',    2107                LEFT(`Gr oups`.`Des c`, {$iBlo gLimitChar s}) as 'De sc_f', 
2082                UNIX_TIM ESTAMP( `G roups`.`cr eated` ) a s `DateTim e_f`,   2108                UNIX_TIM ESTAMP( `G roups`.`cr eated` ) a s `DateTim e_f`,
2083                `Profile s`.`NickNa me`   2109                `Profile s`.`NickNa me`
2084                FROM `Gr oups`   2110                FROM `Gr oups`
2085                INNER JO IN `Profil es` ON `Pr ofiles`.`I D` = `Grou ps`.`creat orID`    2111                INNER JO IN `Profil es` ON `Pr ofiles`.`I D` = `Grou ps`.`creat orID` 
2086                {$sGrpJo in}   2112                {$sGrpJo in}
2087                WHERE   2113                WHERE
2088                {$sProfi leS}   2114                {$sProfi leS}
2089                {$sOrder S}   2115                {$sOrder S}
2090                {$sLimit }   2116                {$sLimit }
2091           ";   2117           ";
2092   //print $s Query;   2118  
2093           $r Blog = db_ res( $sQue ry );   2119           $r Blog = db_ res( $sQue ry );
    2120           if ( !mysql_n um_rows( $ rBlog ) )
    2121                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
2094     2122  
2095           $s Ret = '';   2123           $s Ret = '';
2096      
2097           $s FolderIco  = getTempl ateIcon( ' folder_sma ll.png' );   2124           $s FolderIco  = getTempl ateIcon( ' folder_sma ll.png' );
2098     2125            // $sRet   .=   '<div   class="cle ar_both">< /div>';
2099           $o Events = n ew BxDolEv ents();    
2100      
2101           
$sRet   .=   '<div   class="cle ar_both">< /div>';
   
2102           wh ile ($arr  = mysql_fe tch_array( $rBlog)) {   2126           wh ile ($arr  = mysql_fe tch_array( $rBlog)) {
2103                $sPic =  $this->Get GroupPictu re($arr['I D']);   2127                $sPic =  $this->Get GroupPictu re($arr['I D']);
2104                $aCategI nfo = db_a rr("SELECT  `GroupsCa teg`.`Name ` AS 'Cate gName', `G roupsCateg `.`Uri` as  `CategUri ` FROM `Gr oupsCateg`  WHERE `ID `='{$arr[' CategID']} ' LIMIT 1; ");   2128                $aCategI nfo = db_a rr("SELECT  `GroupsCa teg`.`Name ` AS 'Cate gName', `G roupsCateg `.`Uri` as  `CategUri ` FROM `Gr oupsCateg`  WHERE `ID `='{$arr[' CategID']} ' LIMIT 1; ");
2105                $sCategN ame = $aCa tegInfo['C ategName'] ;   2129                $sCategN ame = $aCa tegInfo['C ategName'] ;
2106                $sCategU ri = $aCat egInfo['Ca tegUri'];   2130                $sCategU ri = $aCat egInfo['Ca tegUri'];
2107     2131  
2108                $sLinkMo re = '';   2132                $sLinkMo re = '';
2109                $sGroupL ink = $thi s->getGrou pUrl($arr[ 'ID'], $ar r['Uri']);   2133                $sGroupL ink = $thi s->getGrou pUrl($arr[ 'ID'], $ar r['Uri']);
2110                if ( str len($arr[' Desc']) ==  $iBlogLim itChars )    2134                if ( str len($arr[' Desc']) ==  $iBlogLim itChars ) 
2111                    $sLi nkMore = " ... <a hre f=\"".$sGr oupLink."\ ">"._t('_R ead more') ."</a>";   2135                    $sLi nkMore = " ... <a hre f=\"".$sGr oupLink."\ ">"._t('_R ead more') ."</a>";
2112     2136  
2113                $sAuthor  = ($iProf ileID>0) ?  '' : '<sp an>' . _t(  '_By Auth or', $arr[ 'NickName' ], $arr['N ickName']  ) . '</spa n>';   2137                $sAuthor  = ($iProf ileID>0) ?  '' : '<sp an>' . _t(  '_By Auth or', $arr[ 'NickName' ], $arr['N ickName']  ) . '</spa n>';
2114                $sName =  process_l ine_output ( $arr['Na me'] );   2138                $sName =  process_l ine_output ( $arr['Na me'] );
2115                
$sDateF   =   date(   $php_date_ format,   $arr['Date Time_f']   );
  2139                 // $sDateF   =   date(   $php_date_ format,   $arr['Date Time_f']   );
    2140                $sDateF  = LocaledD ataTime($a rr['DateTi me_f']);
2116                //$sDate F = Locale dDataTime(  $arr['Dat eTime_f'],  3 );   2141                //$sDate F = Locale dDataTime(  $arr['Dat eTime_f'],  3 );
2117                $sCatego ry = _t( ' _in Catego ry', $sFol derIco, $t his->getGr oupsCategU rl($arr['C ategID'],  $sCategUri ), process _line_outp ut($sCateg Name) );   2142                $sCatego ry = _t( ' _in Catego ry', $sFol derIco, $t his->getGr oupsCategU rl($arr['C ategID'],  $sCategUri ), process _line_outp ut($sCateg Name) );
2118                $sDescr  = strip_ta gs(process _html_outp ut( $arr[' Desc_f'] ) );   2143                $sDescr  = strip_ta gs(process _html_outp ut( $arr[' Desc_f'] ) );
2119     2144  
2120                $sRet .=  <<<EOF   2145                $sRet .=  <<<EOF
2121   <div>   2146   <div>
2122       <div c lass="icon _block">   2147       <div c lass="icon _block">
2123           {$ sPic}   2148           {$ sPic}
2124       </div>   2149       </div>
2125       <div c lass="blog _wrapper_n ">   2150       <div c lass="blog _wrapper_n ">
2126           <d iv class=" blog_subje ct_n">   2151           <d iv class=" blog_subje ct_n">
2127                <a href= "{$sGroupL ink}" clas s="bottom_ text">   2152                <a href= "{$sGroupL ink}" clas s="bottom_ text">
2128                    {$sN ame}   2153                    {$sN ame}
2129                </a>   2154                </a>
2130           </ div>   2155           </ div>
2131           <d iv class=" blogInfo">   2156           <d iv class=" blogInfo">
2132                {$sAutho r}   2157                {$sAutho r}
2133                <span>   2158                <span>
2134                    <img  src="{$sC lockIcon}"  alt="" /> {$sDateF}   2159                    <img  src="{$sC lockIcon}"  alt="" /> {$sDateF}
2135                </span>   2160                </span>
2136                <span>{$ sCategory} </span>   2161                <span>{$ sCategory} </span>
2137           </ div>   2162           </ div>
2138           <d iv class=" blog_text" >   2163           <d iv class=" blog_text" >
2139                {$sDescr }{$sLinkMo re}   2164                {$sDescr }{$sLinkMo re}
2140           </ div>   2165           </ div>
2141       </div>   2166       </div>
2142   </div>   2167   </div>
2143   <div class ="clear_bo th"></div>   2168   <div class ="clear_bo th"></div>
2144   EOF;   2169   EOF;
2145           }   2170           }
    2171           if  ($sBlocks  == '') $s Blocks = M sgBox(_t(' _Sorry, no thing foun d'));
2146           re turn $sRet ;   2172           re turn $sRet ;
2147       }   2173       }
2148     2174  
2149       functi on process _html_db_i nput( $sTe xt ) {   2175       functi on process _html_db_i nput( $sTe xt ) {
2150           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));   2176           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));
2151       }   2177       }
2152   }   2178   }
2153   ?>   2179   ?>