19. File Comparison Report

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

19.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc\classes BxDolGroups.php Wed Jun 18 06:23:58 2008 UTC
2 Dolphin-v.6.1.3\inc\classes BxDolGroups.php Wed Jul 16 09:51:19 2008 UTC

19.2 Comparison summary

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

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

19.4 Active regular expressions

No regular expressions were active.

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