193. File Comparison Report

Produced on Mon May 12 13:05:06 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.

193.1 Files compared

# Location File Last Modified
1 Mon May 12 13:05:06 2008 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolGroups.php Wed Apr 23 09:41:28 2008 UTC

193.2 Comparison summary

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

193.3 Comparison options

Whitespace
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

193.4 Active regular expressions

No regular expressions were active.

193.5 Comparison detail

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