33. File Comparison Report

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

33.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc\classes BxDolClassifieds.php Sun May 11 13:17:00 2008 UTC
2 Dolphin-v.6.1.2\inc\classes BxDolClassifieds.php Tue Jun 3 11:07:42 2008 UTC

33.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 16 6460
Changed 12 29
Inserted 3 3
Removed 0 0

33.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

33.4 Active regular expressions

No regular expressions were active.

33.5 Comparison detail

1   <?   1   <?
2     2  
3   /** simple  function  descriptio n   3   /** simple  function  descriptio n
4    * Return  string for  Header, d epends at  POST param s   4    * Return  string for  Header, d epends at  POST param s
5    *   5    *
6    * @param  $arr  arra y with dat a   6    * @param  $arr  arra y with dat a
7    * @param  $tag  main  tag <main  tag>XML d ata</main  tag>   7    * @param  $tag  main  tag <main  tag>XML d ata</main  tag>
8    * @return  XML prese ntation of  data   8    * @return  XML prese ntation of  data
9    */   9    */
10     10  
11   require_on ce( BX_DIR ECTORY_PAT H_INC . 'h eader.inc. php' );   11   require_on ce( BX_DIR ECTORY_PAT H_INC . 'h eader.inc. php' );
12   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );   12   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
13   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );   13   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );
14   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );   14   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );
15   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolMe diaQuery.p hp' );   15   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolMe diaQuery.p hp' );
16   require_on ce( BX_DIR ECTORY_PAT H_INC . 't ags.inc.ph p' );   16   require_on ce( BX_DIR ECTORY_PAT H_INC . 't ags.inc.ph p' );
17     17  
18   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . "BxDolPa geView.php " );   18   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . "BxDolPa geView.php " );
19   require_on ce( BX_DIR ECTORY_PAT H_ROOT . " templates/ tmpl_{$tmp l}/scripts /BxTemplCm tsView.php " );   19   require_on ce( BX_DIR ECTORY_PAT H_ROOT . " templates/ tmpl_{$tmp l}/scripts /BxTemplCm tsView.php " );
20     20  
21     21  
22   class BxDo lAdPageVie w extends  BxDolPageV iew {   22   class BxDo lAdPageVie w extends  BxDolPageV iew {
23       var $o Classified s;   23       var $o Classified s;
24     24  
25       functi on BxDolAd PageView(& $oAd) {   25       functi on BxDolAd PageView(& $oAd) {
26           $t his->oClas sifieds =  &$oAd;   26           $t his->oClas sifieds =  &$oAd;
27           pa rent::BxDo lPageView( 'ads');   27           pa rent::BxDo lPageView( 'ads');
28       }   28       }
29     29  
30       functi on getBloc kCode_AdPh otos() {   30       functi on getBloc kCode_AdPh otos() {
31           re turn $this ->oClassif ieds->sTAP hotosConte nt;   31           re turn $this ->oClassif ieds->sTAP hotosConte nt;
32       }   32       }
33     33  
34       functi on getBloc kCode_Acti onList() {   34       functi on getBloc kCode_Acti onList() {
35           re turn $this ->oClassif ieds->sTAA ctionsCont ent;   35           re turn $this ->oClassif ieds->sTAA ctionsCont ent;
36       }   36       }
37     37  
38       functi on getBloc kCode_View Comments()  {   38       functi on getBloc kCode_View Comments()  {
39           re turn $this ->oClassif ieds->sTAC ommentsCon tent;   39           re turn $this ->oClassif ieds->sTAC ommentsCon tent;
40       }   40       }
41     41  
42       functi on getBloc kCode_AdIn fo() {   42       functi on getBloc kCode_AdIn fo() {
43           re turn $this ->oClassif ieds->sTAI nfoContent ;   43           re turn $this ->oClassif ieds->sTAI nfoContent ;
44       }   44       }
45     45  
46       functi on getBloc kCode_Desc ription()  {   46       functi on getBloc kCode_Desc ription()  {
47           re turn $this ->oClassif ieds->sTAD escription Content;   47           re turn $this ->oClassif ieds->sTAD escription Content;
48       }   48       }
49     49  
50       functi on getBloc kCode_User OtherAds()  {   50       functi on getBloc kCode_User OtherAds()  {
51           re turn $this ->oClassif ieds->sTAO therListin gContent;   51           re turn $this ->oClassif ieds->sTAO therListin gContent;
52       }   52       }
53   }   53   }
54     54  
55   /*   55   /*
56    * parent  object for  all class es   56    * parent  object for  all class es
57    */   57    */
58   class BxDo lClassifie ds {   58   class BxDo lClassifie ds {
59       /*   59       /*
60       * Glob al(common)  params pa rt, settin gs   60       * Glob al(common)  params pa rt, settin gs
61       */   61       */
62       //vari ables   62       //vari ables
63     63  
64       //max  sizes of p ictures fo r resizing  during up load   64       //max  sizes of p ictures fo r resizing  during up load
65       var $i IconSize =  45;   65       var $i IconSize =  45;
66       var $i ThumbSize  = 110;   66       var $i ThumbSize  = 110;
67       var $i BigThumbSi ze = 340;   67       var $i BigThumbSi ze = 340;
68       var $i ImgSize =  800;   68       var $i ImgSize =  800;
69     69  
70       //uplo ad URL to  dir   70       //uplo ad URL to  dir
71       var $s UploadDir  = '';   71       var $s UploadDir  = '';
72     72  
73       //max  upload fil e size   73       //max  upload fil e size
74       var $i MaxUplFile Size = 100 0000;   74       var $i MaxUplFile Size = 100 0000;
75     75  
76       //path  to image  with Point   76       //path  to image  with Point
77       var $s SpacerPath  = 'templa tes/base/i mages/icon s/spacer.g if';   77       var $s SpacerPath  = 'templa tes/base/i mages/icon s/spacer.g if';
78     78  
79       //path  to image  pic_not_av ail.gif   79       //path  to image  pic_not_av ail.gif
80       var $s PicNotAvai l = 'image s/icons/gr oup_no_pic .gif';   80       var $s PicNotAvai l = 'image s/icons/gr oup_no_pic .gif';
81       //path  to plus.g if image   81       //path  to plus.g if image
82       var $s PicPlus =  'images/pl us.gif';   82       var $s PicPlus =  'images/pl us.gif';
83       //path  to folder .gif image   83       //path  to folder .gif image
84       var $s PicFolder  = 'images/ folder.gif ';   84       var $s PicFolder  = 'images/ folder.gif ';
85     85  
86       //widt h of scrol l boxes in  preview o f Advertis ment   86       //widt h of scrol l boxes in  preview o f Advertis ment
87       //var  $iScrollWi dth=355;   87       //var  $iScrollWi dth=355;
88     88  
89       //admi n mode, ca n All acti ons   89       //admi n mode, ca n All acti ons
90       var $b AdminMode  = FALSE;   90       var $b AdminMode  = FALSE;
91     91  
92       //curr ent file,  for action s of forms  and other   92       //curr ent file,  for action s of forms  and other
93       var $s CurrBrowse dFile = '' ;   93       var $s CurrBrowse dFile = '' ;
94     94  
95       var $i PerPageEle ments = 10 ;   95       var $i PerPageEle ments = 10 ;
96     96  
97       //use  permalink   97       //use  permalink
98       var $b UseFriendl yLinks;   98       var $b UseFriendl yLinks;
99     99  
100       //for  templater  //1310   100       //for  templater  //1310
101       var $s TAPhotosCo ntent = '' ;   101       var $s TAPhotosCo ntent = '' ;
102       var $s TAActionsC ontent = ' ';   102       var $s TAActionsC ontent = ' ';
103       var $s TAComments Content =  '';   103       var $s TAComments Content =  '';
104       var $s TAInfoCont ent = '';   104       var $s TAInfoCont ent = '';
105       var $s TADescript ionContent  = '';   105       var $s TADescript ionContent  = '';
106       var $s TAOtherLis tingConten t = '';   106       var $s TAOtherLis tingConten t = '';
107     107  
108       var $o CmtsView;   108       var $o CmtsView;
109     109  
110       /**   110       /**
111        * con structor   111        * con structor
112        */   112        */
113       functi on BxDolCl assifieds( ) {   113       functi on BxDolCl assifieds( ) {
114           $t his->sUplo adDir = 'm edia/image s/classifi eds/';   114           $t his->sUplo adDir = 'm edia/image s/classifi eds/';
115     115  
116           $t his->bUseF riendlyLin ks = getPa ram('perma links_clas sifieds')  == 'on' ?  true : fal se;   116           $t his->bUseF riendlyLin ks = getPa ram('perma links_clas sifieds')  == 'on' ?  true : fal se;
117       }   117       }
118     118  
119       functi on GetSQLE rror($sQue ry) {   119       functi on GetSQLE rror($sQue ry) {
120           re turn _t_er r('_FAILED _RUN_SQL',  $sQuery,  mysql_erro r());   120           re turn _t_er r('_FAILED _RUN_SQL',  $sQuery,  mysql_erro r());
121       }   121       }
122     122  
123       functi on UseDefa ultCF() {   123       functi on UseDefa ultCF() {
124           gl obal $site ;   124           gl obal $site ;
125           $t his -> sCu rrBrowsedF ile = $sit e['url'] .  'classifi eds.php';   125           $t his -> sCu rrBrowsedF ile = $sit e['url'] .  'classifi eds.php';
126       }   126       }
127     127  
128       /**   128       /**
129        * Gen erate comm on forms a nd include s js   129        * Gen erate comm on forms a nd include s js
130        *   130        *
131        * @re turn HTML  presentati on of data   131        * @re turn HTML  presentati on of data
132        */   132        */
133       functi on PrintCo mmandForms () {   133       functi on PrintCo mmandForms () {
134           gl obal $site ;   134           gl obal $site ;
135     135  
136           $s ActionFile  = ($this  -> bAdminM ode) ? "{$ this -> sC urrBrowsed File}" : " classified smy.php";   136           $s ActionFile  = ($this  -> bAdminM ode) ? "{$ this -> sC urrBrowsed File}" : " classified smy.php";
137           // $sJSPath =  ($this ->  bAdminMod e) ? "../"  : "";   137           // $sJSPath =  ($this ->  bAdminMod e) ? "../"  : "";
138           $s JSPath = $ site['url' ] . 'inc/' ;   138           $s JSPath = $ site['url' ] . 'inc/' ;
139     139  
140           $s ExtraCss =  ($this ->  bAdminMod e) ? '<lin k type="te xt/css" re l="stylesh eet" href= "'.$site[' url_admin' ].'styles/ msgbox.css ">' : '';   140           $s ExtraCss =  ($this ->  bAdminMod e) ? '<lin k type="te xt/css" re l="stylesh eet" href= "'.$site[' url_admin' ].'styles/ msgbox.css ">' : '';
141           $s RetHtml =  <<<EOF   141           $s RetHtml =  <<<EOF
142   {$sExtraCs s}   142   {$sExtraCs s}
143   <script sr c="{$sJSPa th}js/dyna mic_core.j s.php" typ e="text/ja vascript"> </script>   143   <script sr c="{$sJSPa th}js/dyna mic_core.j s.php" typ e="text/ja vascript"> </script>
144   <form acti on="{$this ->sCurrBro wsedFile}"  method="p ost" name= "command_a ctivate_ad vertisemen t">   144   <form acti on="{$this ->sCurrBro wsedFile}"  method="p ost" name= "command_a ctivate_ad vertisemen t">
145       <input  type="hid den" name= "ActivateA dvertiseme ntID" id=" ActivateAd vertisemen tID" value ="" />   145       <input  type="hid den" name= "ActivateA dvertiseme ntID" id=" ActivateAd vertisemen tID" value ="" />
146   </form>   146   </form>
147   <form acti on="{$this ->sCurrBro wsedFile}"  method="p ost" name= "command_d elete_adve rtisement" >   147   <form acti on="{$this ->sCurrBro wsedFile}"  method="p ost" name= "command_d elete_adve rtisement" >
148       <input  type="hid den" name= "DeleteAdv ertisement ID" id="De leteAdvert isementID"  value=""  />   148       <input  type="hid den" name= "DeleteAdv ertisement ID" id="De leteAdvert isementID"  value=""  />
149   </form>   149   </form>
150   <form acti on="{$sAct ionFile}"  method="po st" name=" command_ed it_adverti sement">   150   <form acti on="{$sAct ionFile}"  method="po st" name=" command_ed it_adverti sement">
151       <input  type="hid den" name= "EditAdver tisementID " id="Edit Advertisem entID" val ue="" />   151       <input  type="hid den" name= "EditAdver tisementID " id="Edit Advertisem entID" val ue="" />
152   </form>   152   </form>
153   <form acti on="{$this  -> sCurrB rowsedFile }" method= "post" nam e="command _delete_co mment">   153   <form acti on="{$this  -> sCurrB rowsedFile }" method= "post" nam e="command _delete_co mment">
154       <input  type="hid den" name= "DeleteCom mentID" id ="DeleteCo mmentID" v alue=""/>   154       <input  type="hid den" name= "DeleteCom mentID" id ="DeleteCo mmentID" v alue=""/>
155       <input  type="hid den" name= "DAdvID" i d="DAdvID"  value=""/ >   155       <input  type="hid den" name= "DAdvID" i d="DAdvID"  value=""/ >
156   </form>   156   </form>
157   EOF;   157   EOF;
158           re turn $sRet Html;   158           re turn $sRet Html;
159       }   159       }
160     160  
161       /**   161       /**
162        * Ret urn string  for Heade r, depends  at POST p arams   162        * Ret urn string  for Heade r, depends  at POST p arams
163        *   163        *
164        * @re turn Textp resentatio n of data   164        * @re turn Textp resentatio n of data
165        */   165        */
166       functi on GetHead erString()  {   166       functi on GetHead erString()  {
167           if  (isset($_ GET['PostA d'])) {   167           if  (isset($_ GET['PostA d'])) {
168                if (((in t)$_GET['P ostAd']) = = 1) {   168                if (((in t)$_GET['P ostAd']) = = 1) {
169                    retu rn _t( "_P ostAd" );   169                    retu rn _t( "_P ostAd" );
170                }   170                }
171           }   171           }
172           el seif (isse t($_POST[' PostAdMess age'])) {   172           el seif (isse t($_POST[' PostAdMess age'])) {
173                if (((in t)$_GET['P ostAdMessa ge']) == ' Send') {   173                if (((in t)$_GET['P ostAdMessa ge']) == ' Send') {
174                    retu rn _t( "_P ostAd" );   174                    retu rn _t( "_P ostAd" );
175                }   175                }
176           }   176           }
177           el seif (isse t($_GET['M yAds'])) {   177           el seif (isse t($_GET['M yAds'])) {
178                if (((in t)$_GET['M yAds']) ==  1) {   178                if (((in t)$_GET['M yAds']) ==  1) {
179                    retu rn _t('_My  Advertise ments');   179                    retu rn _t('_My  Advertise ments');
180                }   180                }
181           }   181           }
182           el seif (isse t($_GET['S earchForm' ])) {   182           el seif (isse t($_GET['S earchForm' ])) {
183                if (((in t)$_GET['S earchForm' ]) == 1) {   183                if (((in t)$_GET['S earchForm' ]) == 1) {
184                    retu rn _t('_Fi lter');   184                    retu rn _t('_Fi lter');
185                }   185                }
186           }   186           }
187           el seif (isse t($_REQUES T['action' ]) AND $_R EQUEST['ac tion']=="3 ") {   187           el seif (isse t($_REQUES T['action' ]) AND $_R EQUEST['ac tion']=="3 ") {
188                $sFilter edC = _t(' _Filtered' );   188                $sFilter edC = _t(' _Filtered' );
189                $sListin gC = _t('_ Listing');   189                $sListin gC = _t('_ Listing');
190                return $ sFilteredC .' '.$sLis tingC;   190                return $ sFilteredC .' '.$sLis tingC;
191           }   191           }
192           el seif (isse t($_REQUES T['ShowAdv ertisement ID']) || i sset($_GET ['entryUri '])) {   192           el seif (isse t($_REQUES T['ShowAdv ertisement ID']) || i sset($_GET ['entryUri '])) {
193                return _ t('_Offer  Details');   193                return _ t('_Offer  Details');
194           }   194           }
195           el seif (isse t($_GET['b Classified ID']) || i sset($_GET ['catUri'] )) {   195           el seif (isse t($_GET['b Classified ID']) || i sset($_GET ['catUri'] )) {
196                //$iClas sifiedID =  (int)$_GE T['bClassi fiedID'];   196                //$iClas sifiedID =  (int)$_GE T['bClassi fiedID'];
197                $iClassi fiedID = ( $this->bUs eFriendlyL inks) ? (i nt)db_valu e("SELECT  `ID` FROM  `Classifie ds` WHERE  `CEntryUri `='" . $th is->proces s_html_db_ input($_RE QUEST['cat Uri']) . " ' LIMIT 1" ) : (int)$ _REQUEST[' bClassifie dID'];   197                $iClassi fiedID = ( $this->bUs eFriendlyL inks) ? (i nt)db_valu e("SELECT  `ID` FROM  `Classifie ds` WHERE  `CEntryUri `='" . $th is->proces s_html_db_ input($_RE QUEST['cat Uri']) . " ' LIMIT 1" ) : (int)$ _REQUEST[' bClassifie dID'];
198                if ($iCl assifiedID  > 0) {   198                if ($iCl assifiedID  > 0) {
199                    $sQu ery = "SEL ECT `Name`  FROM `Cla ssifieds`  WHERE `ID`  = {$iClas sifiedID}" ;   199                    $sQu ery = "SEL ECT `Name`  FROM `Cla ssifieds`  WHERE `ID`  = {$iClas sifiedID}" ;
200                    $aSq lCatInfo =  db_arr ($ sQuery);   200                    $aSq lCatInfo =  db_arr ($ sQuery);
201                    if ( $aSqlCatIn fo) {   201                    if ( $aSqlCatIn fo) {
202                         return $aS qlCatInfo[ 'Name'];   202                         return $aS qlCatInfo[ 'Name'];
203                    }   203                    }
204                }   204                }
205           }   205           }
206           el seif (isse t($_GET['b SubClassif iedID']) | | isset($_ GET['scatU ri'])) {   206           el seif (isse t($_GET['b SubClassif iedID']) | | isset($_ GET['scatU ri'])) {
207                //$iSubC lassifiedI D = (int)$ _GET['bSub Classified ID'];   207                //$iSubC lassifiedI D = (int)$ _GET['bSub Classified ID'];
208                $iSubCla ssifiedID  = ($this-> bUseFriend lyLinks) ?  (int)db_v alue("SELE CT `ID` FR OM `Classi fiedsSubs`  WHERE `SE ntryUri`=' " . $this- >process_h tml_db_inp ut($_REQUE ST['scatUr i']) . "'  LIMIT 1")  : (int)$_R EQUEST['bS ubClassifi edID'];   208                $iSubCla ssifiedID  = ($this-> bUseFriend lyLinks) ?  (int)db_v alue("SELE CT `ID` FR OM `Classi fiedsSubs`  WHERE `SE ntryUri`=' " . $this- >process_h tml_db_inp ut($_REQUE ST['scatUr i']) . "'  LIMIT 1")  : (int)$_R EQUEST['bS ubClassifi edID'];
209                if ($iSu bClassifie dID > 0) {   209                if ($iSu bClassifie dID > 0) {
210                    $sSq l = "   210                    $sSq l = "
211                         SELECT `Cl assifieds` .`Name` ,  `Classifie dsSubs`.`N ameSub`   211                         SELECT `Cl assifieds` .`Name` ,  `Classifie dsSubs`.`N ameSub`
212                         FROM `Clas sifieds`    212                         FROM `Clas sifieds` 
213                         INNER JOIN  `Classifi edsSubs` O N ( `Class ifieds`.`I D` = `Clas sifiedsSub s`.`IDClas sified` )    213                         INNER JOIN  `Classifi edsSubs` O N ( `Class ifieds`.`I D` = `Clas sifiedsSub s`.`IDClas sified` ) 
214                         WHERE `Cla ssifiedsSu bs`.`ID` =  {$iSubCla ssifiedID}   214                         WHERE `Cla ssifiedsSu bs`.`ID` =  {$iSubCla ssifiedID}
215                         LIMIT 1   215                         LIMIT 1
216                    ";   216                    ";
217                    $aSu bcatRes =  db_arr($sS ql);   217                    $aSu bcatRes =  db_arr($sS ql);
218     218  
219                    if ( $aSubcatRe s ) {   219                    if ( $aSubcatRe s ) {
220                         $sFilterC  = _t('_Fil ter');   220                         $sFilterC  = _t('_Fil ter');
221                         return "{$ sFilterC}:  ".$aSubca tRes['Name '] . ' ->  ' . $aSubc atRes['Nam eSub'];   221                         return "{$ sFilterC}:  ".$aSubca tRes['Name '] . ' ->  ' . $aSubc atRes['Nam eSub'];
222                    }   222                    }
223                }   223                }
224           }   224           }
225           el se {   225           el se {
226                return _ t( "_CLASS IFIEDS_VIE W_H1" );   226                return _ t( "_CLASS IFIEDS_VIE W_H1" );
227           }   227           }
228       }   228       }
229     229  
230       functi on Restric tAction($i MemberID)  {   230       functi on Restric tAction($i MemberID)  {
231           if  ($this->b AdminMode= =true) ret urn FALSE;   231           if  ($this->b AdminMode= =true) ret urn FALSE;
232           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_CAN_ AD_CLASSIF IEDS );   232           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_CAN_ AD_CLASSIF IEDS );
233           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {   233           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {
234                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );   234                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );
235                //login_ form();   235                //login_ form();
236                return $ ret;   236                return $ ret;
237           }   237           }
238           re turn '';   238           re turn '';
239       }   239       }
240     240  
241       /**   241       /**
242        * Gen erate one  of variant  of Tree p resentatio n of Class ifieds   242        * Gen erate one  of variant  of Tree p resentatio n of Class ifieds
243        *   243        *
244        * @re turn HTML  presentati on of data   244        * @re turn HTML  presentati on of data
245        */   245        */
246       functi on PrintTr eeClassifi edsBrowse( ) {   246       functi on PrintTr eeClassifi edsBrowse( ) {
247           $v SqlRes = $ this -> Ge tDataOfCls ();   247           $v SqlRes = $ this -> Ge tDataOfCls ();
248           if  (mysql_af fected_row s()==-1) {   248           if  (mysql_af fected_row s()==-1) {
249                return $ this -> Ge tSQLError( "");   249                return $ this -> Ge tSQLError( "");
250           }   250           }
251     251  
252           $s TreeRows =  '';   252           $s TreeRows =  '';
253           wh ile( $aSql ResCls = m ysql_fetch _assoc($vS qlRes) ) {   253           wh ile( $aSql ResCls = m ysql_fetch _assoc($vS qlRes) ) {
254                $iID = $ aSqlResCls ['ID'];   254                $iID = $ aSqlResCls ['ID'];
255                $sName =  $aSqlResC ls['Name'] ;   255                $sName =  $aSqlResC ls['Name'] ;
256                $sCUri =  $aSqlResC ls['CEntry Uri'];   256                $sCUri =  $aSqlResC ls['CEntry Uri'];
257     257  
258                $sSqlCnt ClsAdv = " SELECT COU NT(`Classi fiedsAdver tisements` .`ID`) AS  'Count'   258                $sSqlCnt ClsAdv = " SELECT COU NT(`Classi fiedsAdver tisements` .`ID`) AS  'Count'
259                                          FROM  `Classifi eds`   259                                          FROM  `Classifi eds`
260                                          INNE R JOIN `Cl assifiedsS ubs`   260                                          INNE R JOIN `Cl assifiedsS ubs`
261                                          ON ( `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed`)   261                                          ON ( `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed`)
262                                          INNE R JOIN `Cl assifiedsA dvertiseme nts`   262                                          INNE R JOIN `Cl assifiedsA dvertiseme nts`
263                                          ON ( `Classifie dsSubs`.`I D` = `Clas sifiedsAdv ertisement s`.`IDClas sifiedsSub s`)   263                                          ON ( `Classifie dsSubs`.`I D` = `Clas sifiedsAdv ertisement s`.`IDClas sifiedsSub s`)
264                                          WHER E `Classif ieds`.`ID`  = '{$iID} '";   264                                          WHER E `Classif ieds`.`ID`  = '{$iID} '";
265                $aSqlRes Cnt = db_a rr($sSqlCn tClsAdv);   265                $aSqlRes Cnt = db_a rr($sSqlCn tClsAdv);
266                $iCnt =  $aSqlResCn t['Count'] ;   266                $iCnt =  $aSqlResCn t['Count'] ;
267                $sCnt =  ( $aSqlRes Cnt['Count '] > 0 ) ?  "({$iCnt} )" : "(0)" ;   267                $sCnt =  ( $aSqlRes Cnt['Count '] > 0 ) ?  "({$iCnt} )" : "(0)" ;
268     268  
269                //$sCate gLink = ($ this->bUse FriendlyLi nks) ? $si te['url']. 'ads/c/'.$ sCUri : "{ $this->sCu rrBrowsedF ile}?bClas sifiedID={ $iID}";   269                //$sCate gLink = ($ this->bUse FriendlyLi nks) ? $si te['url']. 'ads/c/'.$ sCUri : "{ $this->sCu rrBrowsedF ile}?bClas sifiedID={ $iID}";
270                $sCategL ink = "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$i ID}";   270                $sCategL ink = "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$i ID}";
271     271  
272                $sTreeRo ws .= <<<E OF   272                $sTreeRo ws .= <<<E OF
273   <tr>   273   <tr>
274       <td cl ass="cls_t ree_left">   274       <td cl ass="cls_t ree_left">
275           <i mg id="tre e_action_i mg_{$iID}"  src="{$th is->sPicPl us}" onCli ck="Update ListCommon ('ReloadSu bTree','tr ee_sub_tr_ {$iID}','I DClassifie d', {$iID} );"/>   275           <i mg id="tre e_action_i mg_{$iID}"  src="{$th is->sPicPl us}" onCli ck="Update ListCommon ('ReloadSu bTree','tr ee_sub_tr_ {$iID}','I DClassifie d', {$iID} );"/>
276           <i mg src="{$ this->sPic Folder}" / >   276           <i mg src="{$ this->sPic Folder}" / >
277       </td>   277       </td>
278       <td cl ass="cls_t ree_right" >   278       <td cl ass="cls_t ree_right" >
279           <a  href="{$s CategLink} ">{$sName}  {$sCnt}</ a>   279           <a  href="{$s CategLink} ">{$sName}  {$sCnt}</ a>
280       </td>   280       </td>
281   </tr>   281   </tr>
282   <tr id="1t ree_sub_tr _{$iID}">   282   <tr id="1t ree_sub_tr _{$iID}">
283       <td cl ass="cls_t ree_left"> </td>   283       <td cl ass="cls_t ree_left"> </td>
284       <td cl ass="cls_t ree_right" >   284       <td cl ass="cls_t ree_right" >
285           <d iv id="tre e_sub_tr_{ $iID}">   285           <d iv id="tre e_sub_tr_{ $iID}">
286           </ div>   286           </ div>
287       </td>   287       </td>
288   </tr>   288   </tr>
289   EOF;   289   EOF;
290           }   290           }
291     291  
292           $s RetHtml .=  <<<EOF   292           $s RetHtml .=  <<<EOF
293   <table cla ss="cls_tr ee_table">   293   <table cla ss="cls_tr ee_table">
294       {$sTre eRows}   294       {$sTre eRows}
295   </table>   295   </table>
296   EOF;   296   EOF;
297           re turn $sRet Html;   297           re turn $sRet Html;
298       }   298       }
299     299  
300       /**   300       /**
301        * Gen erate form  to adding  a new Adv ertisement   301        * Gen erate form  to adding  a new Adv ertisement
302        *   302        *
303        * @re turn HTML  presentati on of data   303        * @re turn HTML  presentati on of data
304        */   304        */
305       functi on PrintPo stAdForm(  $arrErr =  NULL ) {   305       functi on PrintPo stAdForm(  $arrErr =  NULL ) {
306           $s Category =  (int)proc ess_db_inp ut( $_POST ['FilterCa t'] );   306           $s Category =  (int)proc ess_db_inp ut( $_POST ['FilterCa t'] );
307           $s CategorySu b = proces s_db_input ( $_POST[' FilterCatS ub'] );   307           $s CategorySu b = proces s_db_input ( $_POST[' FilterCatS ub'] );
308           $s Keywords =  process_d b_input( $ _POST['Fil terKeyword s'] );   308           $s Keywords =  process_d b_input( $ _POST['Fil terKeyword s'] );
309           $s CustomFiel dCaption1  = process_ db_input(  $_POST['ad _CustomFie ldCaption1 '] );   309           $s CustomFiel dCaption1  = process_ db_input(  $_POST['ad _CustomFie ldCaption1 '] );
310           $s CustomFiel dCaption2  = process_ db_input(  $_POST['ad _CustomFie ldCaption2 '] );   310           $s CustomFiel dCaption2  = process_ db_input(  $_POST['ad _CustomFie ldCaption2 '] );
311           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);   311           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);
312           $s Message =  $this->pro cess_html_ db_input($ _POST['mes sage']);   312           $s Message =  $this->pro cess_html_ db_input($ _POST['mes sage']);
313           $i LifeTime =  (int)proc ess_db_inp ut( $_POST ['lifetime '] );   313           $i LifeTime =  (int)proc ess_db_inp ut( $_POST ['lifetime '] );
314           $s Tags = pro cess_db_in put( $_POS T['tags']  );   314           $s Tags = pro cess_db_in put( $_POS T['tags']  );
315           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue1'] ), $ aRegs)) {   315           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue1'] ), $ aRegs)) {
316                $sCustom FieldValue 1 = $aRegs [1];   316                $sCustom FieldValue 1 = $aRegs [1];
317           }   317           }
318           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue2'] ), $ aRegs)) {   318           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue2'] ), $ aRegs)) {
319                $sCustom FieldValue 2 = $aRegs [1];   319                $sCustom FieldValue 2 = $aRegs [1];
320           }   320           }
321     321  
322           $i MemberID =  (int)$_CO OKIE['memb erID'];   322           $i MemberID =  (int)$_CO OKIE['memb erID'];
323           $s RestrictRe s = $this- >RestrictA ction($iMe mberID);   323           $s RestrictRe s = $this- >RestrictA ction($iMe mberID);
324           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   324           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
325           // if ($this- >RestrictA ction($iMe mberID)) r eturn;   325           // if ($this- >RestrictA ction($iMe mberID)) r eturn;
326     326  
327           $i MaxLt = (i nt)getPara m('a_max_l ive_days_c lassifieds ');   327           $i MaxLt = (i nt)getPara m('a_max_l ive_days_c lassifieds ');
328     328  
329           $v SqlRes = $ this -> Ge tDataOfCls ();   329           $v SqlRes = $ this -> Ge tDataOfCls ();
330           if  (mysql_af fected_row s()==-1)   330           if  (mysql_af fected_row s()==-1)
331                return $ this -> Ge tSQLError( "");   331                return $ this -> Ge tSQLError( "");
332           $s CatOptions  = '';   332           $s CatOptions  = '';
333           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {   333           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {
334                $sCatOpt ions .= "< option val ue=\"{$aSq lResStr['I D']}\">{$a SqlResStr[ 'Name']}</ option>\n" ;   334                $sCatOpt ions .= "< option val ue=\"{$aSq lResStr['I D']}\">{$a SqlResStr[ 'Name']}</ option>\n" ;
335           }   335           }
336     336  
337           $s SubDspStyl e = ($sCat egorySub!= "")?'':'no ne';   337           $s SubDspStyl e = ($sCat egorySub!= "")?'':'no ne';
338           $s Cst1DspSty le = ($sCu stomFieldC aption1!=" ")?'':'non e';   338           $s Cst1DspSty le = ($sCu stomFieldC aption1!=" ")?'':'non e';
339           $s Cst2DspSty le = ($sCu stomFieldC aption2!=" ")?'':'non e';   339           $s Cst2DspSty le = ($sCu stomFieldC aption2!=" ")?'':'non e';
340     340  
341           $s StepOption s = '';   341           $s StepOption s = '';
342           fo r ($i=5; $ i<$iMaxLt;  $i+=5) {   342           fo r ($i=5; $ i<$iMaxLt;  $i+=5) {
343                $sStepOp tions .= " <option va lue=\"{$i} \"";   343                $sStepOp tions .= " <option va lue=\"{$i} \"";
344                if ($iLi feTime>0 A ND $i==$iL ifeTime) $ sStepOptio ns .= "sel ected";   344                if ($iLi feTime>0 A ND $i==$iL ifeTime) $ sStepOptio ns .= "sel ected";
345                $sStepOp tions .= " >{$i}</opt ion>";   345                $sStepOp tions .= " >{$i}</opt ion>";
346           }   346           }
347           $s MinStep =  '<option v alue="1">1 </option>' ;   347           $s MinStep =  '<option v alue="1">1 </option>' ;
348           $s MaxedSelec ted = ($iL ifeTime==$ iMaxLt OR  $iLifeTime ==NULL) ?  "selected"  : "";   348           $s MaxedSelec ted = ($iL ifeTime==$ iMaxLt OR  $iLifeTime ==NULL) ?  "selected"  : "";
349           $s MaxedStep  = "<option  value=\"{ $iMaxLt}\"  {$sMaxedS elected}>{ $iMaxLt}</ option>";   349           $s MaxedStep  = "<option  value=\"{ $iMaxLt}\"  {$sMaxedS elected}>{ $iMaxLt}</ option>";
350           $s MaxedStrin g = ($iMax Lt) ? _t(' _WARNING_M AX_LIVE_DA YS', $iMax Lt) : "db  sql error" ;   350           $s MaxedStrin g = ($iMax Lt) ? _t(' _WARNING_M AX_LIVE_DA YS', $iMax Lt) : "db  sql error" ;
351     351  
352           $s CatN = _t( '_Category ');   352           $s CatN = _t( '_Category ');
353           $s SbjN = _t( '_Subject' );   353           $s SbjN = _t( '_Subject' );
354           $s TagsN = _t ('_Tags');   354           $s TagsN = _t ('_Tags');
355           $s LtN = _t(' _Life Time ');   355           $s LtN = _t(' _Life Time ');
356           $s DaysN = _t ('_days');   356           $s DaysN = _t ('_days');
357           $s MsgN = _t( '_Message' );   357           $s MsgN = _t( '_Message' );
358           $s PictN = _t ('_Picture s');   358           $s PictN = _t ('_Picture s');
359           $s AddFileFie ldN = _t(' _Add');   359           $s AddFileFie ldN = _t(' _Add');
360           // $sSendThis N = _t('_S end these  files');   360           // $sSendThis N = _t('_S end these  files');
361           $s SendN = _t ('_Send');   361           $s SendN = _t ('_Send');
362           $s ChooseN =  _t('_choos e');   362           $s ChooseN =  _t('_choos e');
363           $s DeleteC =  _t('_Delet e');   363           $s DeleteC =  _t('_Delet e');
364     364  
365           $a rr = array ('SubClass ified' =>  $iSubClass ifiedID, ' membID' =>  $iMemberI D, 'Subjec t' => $sSu bject,   365           $a rr = array ('SubClass ified' =>  $iSubClass ifiedID, ' membID' =>  $iMemberI D, 'Subjec t' => $sSu bject,
366                'Message ' => $sMes sage, 'cus tVal1' =>  $sCustomFi eldValue1,  'custVal2 ' => $sCus tomFieldVa lue2, 'Lif e Time' =>  $iLifeTim e);   366                'Message ' => $sMes sage, 'cus tVal1' =>  $sCustomFi eldValue1,  'custVal2 ' => $sCus tomFieldVa lue2, 'Lif e Time' =>  $iLifeTim e);
367           $s SCstyle =  ($arrErr[' SubClassif ied'] ? 'b lock' : 'n one');   367           $s SCstyle =  ($arrErr[' SubClassif ied'] ? 'b lock' : 'n one');
368           $s MSGstyle =  ($arrErr[ 'Message']  ? 'block'  : 'none') ;   368           $s MSGstyle =  ($arrErr[ 'Message']  ? 'block'  : 'none') ;
369           $s SBJstyle =  ($arrErr[ 'Subject']  ? 'block'  : 'none') ;   369           $s SBJstyle =  ($arrErr[ 'Subject']  ? 'block'  : 'none') ;
370           $s LTstyle =  ($arrErr[' Life Time' ] ? 'block ' : 'none' );   370           $s LTstyle =  ($arrErr[' Life Time' ] ? 'block ' : 'none' );
371           $s SCmsg = ($ arrErr['Su bClassifie d'] ? _t(  '_'.$arrEr r['SubClas sified'] )  : '' );   371           $s SCmsg = ($ arrErr['Su bClassifie d'] ? _t(  '_'.$arrEr r['SubClas sified'] )  : '' );
372           $s SBJmsg = ( $arrErr['S ubject'] ?  _t( '_'.$ arrErr['Su bject'] )  : '' );   372           $s SBJmsg = ( $arrErr['S ubject'] ?  _t( '_'.$ arrErr['Su bject'] )  : '' );
373           $s MSGmsg = ( $arrErr['M essage'] ?  _t( '_'.$ arrErr['Me ssage'] )  : '' );   373           $s MSGmsg = ( $arrErr['M essage'] ?  _t( '_'.$ arrErr['Me ssage'] )  : '' );
374           $s LTmsg = ($ arrErr['Li fe Time']  ? _t( '_'. $arrErr['L ife Time']  ) : '' );   374           $s LTmsg = ($ arrErr['Li fe Time']  ? _t( '_'. $arrErr['L ife Time']  ) : '' );
375     375  
376           $s CatHndlVal  = $_REQUE ST['Classi fied'];   376           $s CatHndlVal  = $_REQUE ST['Classi fied'];
377           $s SubCatHndl Val = $_RE QUEST['Sub Classified '];   377           $s SubCatHndl Val = $_RE QUEST['Sub Classified '];
378           $s ScriptHand le='';   378           $s ScriptHand le='';
379           if  (isset ($ _REQUEST[' SubClassif ied'])) {   379           if  (isset ($ _REQUEST[' SubClassif ied'])) {
380                $sScript Handle = < <<EOF   380                $sScript Handle = < <<EOF
381   <script ty pe="text/j avascript" >   381   <script ty pe="text/j avascript" >
382       addEve nt( window , 'load',  function() { UpdateFi elds('Clas sified',{$ sCatHndlVa l},'SubCla ssified',{ $sSubCatHn dlVal}); }  );   382       addEve nt( window , 'load',  function() { UpdateFi elds('Clas sified',{$ sCatHndlVa l},'SubCla ssified',{ $sSubCatHn dlVal}); }  );
383   </script>   383   </script>
384   EOF;   384   EOF;
385           }   385           }
386     386  
387           $s RetHtml =  <<<EOF   387           $s RetHtml =  <<<EOF
388   <form acti on="{$this  -> sCurrB rowsedFile }" name="P ostAdForm"  method="p ost" encty pe="multip art/form-d ata" onsub mit="retur n verify_a dding_new_ adv('lifet ime_tr', ' lifetime',  {$iMaxLt} );">   388   <form acti on="{$this  -> sCurrB rowsedFile }" name="P ostAdForm"  method="p ost" encty pe="multip art/form-d ata" onsub mit="retur n verify_a dding_new_ adv('lifet ime_tr', ' lifetime',  {$iMaxLt} );">
389       <table  class="cl s_100_cp">   389       <table  class="cl s_100_cp">
390           <t r class="v c">   390           <t r class="v c">
391                <td clas s="cls_tbl _left_t">{ $sCatN}:</ td>   391                <td clas s="cls_tbl _left_t">{ $sCatN}:</ td>
392                <td clas s="cls_tbl _right_m">   392                <td clas s="cls_tbl _right_m">
393                    <sel ect name=" Classified " id="Clas sified" on Change="Up dateListCo mmon('Relo adClassifi edsAndCust omsFields' ,'SubClass ified','ID Classified ',this.val ue,'ad_Cus tomFieldCa ption1','a d_CustomFi eldCaption 2');">   393                    <sel ect name=" Classified " id="Clas sified" on Change="Up dateListCo mmon('Relo adClassifi edsAndCust omsFields' ,'SubClass ified','ID Classified ',this.val ue,'ad_Cus tomFieldCa ption1','a d_CustomFi eldCaption 2');">
394                         <option va lue="-1">{ $sChooseN} </option>   394                         <option va lue="-1">{ $sChooseN} </option>
395                         <option va lue="-1">- ---------< /option>   395                         <option va lue="-1">- ---------< /option>
396                         {$sCatOpti ons}   396                         {$sCatOpti ons}
397                    </se lect>&nbsp ;&nbsp;&nb sp;&nbsp;   397                    </se lect>&nbsp ;&nbsp;&nb sp;&nbsp;
398                    <sel ect class= "size20" n ame="SubCl assified"  id="SubCla ssified" s tyle="disp lay:{$sSub DspStyle}; ">   398                    <sel ect class= "size20" n ame="SubCl assified"  id="SubCla ssified" s tyle="disp lay:{$sSub DspStyle}; ">
399                    </se lect>   399                    </se lect>
400                    {$sS criptHandl e}   400                    {$sS criptHandl e}
401                    <div  class="ed it_error"  style="dis play:{$sSC style}">   401                    <div  class="ed it_error"  style="dis play:{$sSC style}">
402                         {$sSCmsg}   402                         {$sSCmsg}
403                    </di v>   403                    </di v>
404                </td>   404                </td>
405           </ tr>   405           </ tr>
406           <t r class="v c" id="tr1 " style="d isplay:{$s Cst1DspSty le};">   406           <t r class="v c" id="tr1 " style="d isplay:{$s Cst1DspSty le};">
407                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion1"></t d>   407                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion1"></t d>
408                <td clas s="cls_tbl _right_m"> <input typ e="text" n ame="Custo mFieldValu e1" value= "{$sCustom FieldValue 1}" /></td >   408                <td clas s="cls_tbl _right_m"> <input typ e="text" n ame="Custo mFieldValu e1" value= "{$sCustom FieldValue 1}" /></td >
409           </ tr>   409           </ tr>
410           <t r class="v c" id="tr2 " style="d isplay:{$s Cst2DspSty le};">   410           <t r class="v c" id="tr2 " style="d isplay:{$s Cst2DspSty le};">
411                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion2"></t d>   411                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion2"></t d>
412                <td clas s="cls_tbl _right_m"> <input typ e="text" n ame="Custo mFieldValu e2" value= "{$sCustom FieldValue 2}" /></td >   412                <td clas s="cls_tbl _right_m"> <input typ e="text" n ame="Custo mFieldValu e2" value= "{$sCustom FieldValue 2}" /></td >
413           </ tr>   413           </ tr>
414           <t r class="v c">   414           <t r class="v c">
415                <td clas s="cls_tbl _left_t">{ $sSbjN}:</ td>   415                <td clas s="cls_tbl _left_t">{ $sSbjN}:</ td>
416                <td clas s="cls_tbl _right_m">   416                <td clas s="cls_tbl _right_m">
417                    <div  class="ed it_error"  style="dis play:{$sSB Jstyle}">   417                    <div  class="ed it_error"  style="dis play:{$sSB Jstyle}">
418                         {$sSBJmsg}   418                         {$sSBJmsg}
419                    </di v>   419                    </di v>
420                    <inp ut type="t ext" name= "subject"  value="{$s Subject}"  size="60"  maxlength= "60" />   420                    <inp ut type="t ext" name= "subject"  value="{$s Subject}"  size="60"  maxlength= "60" />
421                </td>   421                </td>
422           </ tr>   422           </ tr>
423           <t r class="v c" id="lif etime_tr">   423           <t r class="v c" id="lif etime_tr">
424                <td clas s="cls_tbl _left_t">{ $sLtN}:</t d>   424                <td clas s="cls_tbl _left_t">{ $sLtN}:</t d>
425                <td clas s="cls_tbl _right_m">   425                <td clas s="cls_tbl _right_m">
426                    <div  class="ed it_error"  style="dis play:{$sLT style}">   426                    <div  class="ed it_error"  style="dis play:{$sLT style}">
427                         {$sLTmsg}   427                         {$sLTmsg}
428                    </di v>   428                    </di v>
429                    <sel ect name=" lifetime"  id="lifeti me">   429                    <sel ect name=" lifetime"  id="lifeti me">
430                         {$sMinStep }   430                         {$sMinStep }
431                         {$sStepOpt ions}   431                         {$sStepOpt ions}
432                         {$sMaxedSt ep}   432                         {$sMaxedSt ep}
433                    </se lect> {$sD aysN}. {$s MaxedStrin g}   433                    </se lect> {$sD aysN}. {$s MaxedStrin g}
434                </td>   434                </td>
435           </ tr>   435           </ tr>
436           <t r class="v c">   436           <t r class="v c">
437                <td clas s="cls_tbl _left_t">{ $sTagsN}:< /td>   437                <td clas s="cls_tbl _left_t">{ $sTagsN}:< /td>
438                <td clas s="cls_tbl _right_m">   438                <td clas s="cls_tbl _right_m">
439                    <inp ut type="t ext" name= "tags" val ue="{$sTag s}" size=" 60" maxlen gth="60" / >   439                    <inp ut type="t ext" name= "tags" val ue="{$sTag s}" size=" 60" maxlen gth="60" / >
440                </td>   440                </td>
441           </ tr>   441           </ tr>
442           <t r class="v c">   442           <t r class="v c">
443                <td clas s="cls_tbl _left_t">{ $sMsgN}:</ td>   443                <td clas s="cls_tbl _left_t">{ $sMsgN}:</ td>
444                <td clas s="cls_tbl _right_m">   444                <td clas s="cls_tbl _right_m">
445                    <div  class="ed it_error"  style="dis play:{$sMS Gstyle}">   445                    <div  class="ed it_error"  style="dis play:{$sMS Gstyle}">
446                         {$sMSGmsg}   446                         {$sMSGmsg}
447                    </di v>   447                    </di v>
448                    <tex tarea name ="message"  rows="20"  cols="60"  class="cl assfiedsTe xtArea" st yle="width :700px;hei ght:400px; ">{$sMessa ge}</texta rea>   448                    <tex tarea name ="message"  rows="20"  cols="60"  class="cl assfiedsTe xtArea" st yle="width :700px;hei ght:400px; ">{$sMessa ge}</texta rea>
449                </td>   449                </td>
450           </ tr>   450           </ tr>
451           <t r class="v c">   451           <t r class="v c">
452                <td clas s="cls_tbl _left_t">{ $sPictN}:< /td>   452                <td clas s="cls_tbl _left_t">{ $sPictN}:< /td>
453                <td clas s="cls_tbl _right_m">   453                <td clas s="cls_tbl _right_m">
454                    <div  id="brows e_file_div "></div>   454                    <div  id="brows e_file_div "></div>
455                    <a h ref="#" on click="Add FilesField s('{$sDele teC}'); re turn false ;">{$sAddF ileFieldN} </a><br />   455                    <a h ref="#" on click="Add FilesField s('{$sDele teC}'); re turn false ;">{$sAddF ileFieldN} </a><br />
456                    <scr ipt type=" text/javas cript">   456                    <scr ipt type=" text/javas cript">
457                         AddFilesFi elds('{$sD eleteC}');   457                         AddFilesFi elds('{$sD eleteC}');
458                    </sc ript>   458                    </sc ript>
459                </td>   459                </td>
460           </ tr>   460           </ tr>
461           <t r class="v c">   461           <t r class="v c">
462                <td clas s="cls_tbl _left_t">< /td>   462                <td clas s="cls_tbl _left_t">< /td>
463                <td clas s="cls_tbl _right_m">   463                <td clas s="cls_tbl _right_m">
464                    <inp ut type="s ubmit" nam e="SendTex t" value=" {$sSendN}"  />   464                    <inp ut type="s ubmit" nam e="SendTex t" value=" {$sSendN}"  />
465                    <inp ut type="h idden" nam e="PostAdM essage" va lue="Send"  />   465                    <inp ut type="h idden" nam e="PostAdM essage" va lue="Send"  />
466                </td>   466                </td>
467           </ tr>   467           </ tr>
468       </tabl e>   468       </tabl e>
469   </form>   469   </form>
470   EOF;   470   EOF;
471           /* <div class ="edit_err or" style= "display:{ $sSBJstyle }">   471           /* <div class ="edit_err or" style= "display:{ $sSBJstyle }">
472                {$sSBJms g}   472                {$sSBJms g}
473           </ div>*/   473           </ div>*/
474           // <input typ e="button"  value="{$ sAddFileFi eldN}" onc lick="AddF ilesFields ()" />   474           // <input typ e="button"  value="{$ sAddFileFi eldN}" onc lick="AddF ilesFields ()" />
475           re turn $sRet Html;   475           re turn $sRet Html;
476       }   476       }
477     477  
478       /**   478       /**
479        * Par sing uploa ded files,  store its  with temp  names, fi ll data in to SQL tab les   479        * Par sing uploa ded files,  store its  with temp  names, fi ll data in to SQL tab les
480        *   480        *
481        * @pa ram $iMemb erID    cu rrent memb er ID   481        * @pa ram $iMemb erID    cu rrent memb er ID
482        * @re turn Text  presentati on of data  (enum ID` s)   482        * @re turn Text  presentati on of data  (enum ID` s)
483        */   483        */
484       functi on parseUp loadedFile s($iMember ID) {   484       functi on parseUp loadedFile s($iMember ID) {
485           gl obal $dir;   485           gl obal $dir;
486     486  
487           $s CurrentTim e = time() ;   487           $s CurrentTim e = time() ;
488     488  
489           if  ( $_FILES ) {   489           if  ( $_FILES ) {
490                $iIDs='' ;   490                $iIDs='' ;
491     491  
492                for ($i= 0; $i<coun t($_FILES[ 'userfile' ]['tmp_nam e']); $i++ ) {   492                for ($i= 0; $i<coun t($_FILES[ 'userfile' ]['tmp_nam e']); $i++ ) {
493                    if(  $_FILES['u serfile'][ 'error'][$ i] )   493                    if(  $_FILES['u serfile'][ 'error'][$ i] )
494                         continue;   494                         continue;
495                    if(  $_FILES['u serfile'][ 'size'][$i ] > $this  -> iMaxUpl FileSize )  { //if si ze more th an 1mb   495                    if(  $_FILES['u serfile'][ 'size'][$i ] > $this  -> iMaxUpl FileSize )  { //if si ze more th an 1mb
496                         print _t_e rr('_WARNI NG_MAX_SIZ E_FILE', $ _FILES['us erfile'][' name'][$i] );   496                         print _t_e rr('_WARNI NG_MAX_SIZ E_FILE', $ _FILES['us erfile'][' name'][$i] );
497                         continue;   497                         continue;
498                    }   498                    }
499     499  
500                    list ( $width,  $height, $ type, $att r ) = geti magesize(  $_FILES['u serfile'][ 'tmp_name' ][$i] );   500                    list ( $width,  $height, $ type, $att r ) = geti magesize(  $_FILES['u serfile'][ 'tmp_name' ][$i] );
501     501  
502                    if (  $type !=  1 and $typ e != 2 and  $type !=  3 )   502                    if (  $type !=  1 and $typ e != 2 and  $type !=  3 )
503                         continue;   503                         continue;
504     504  
505                    $sBa seName = $ iMemberID  .'_'. $sCu rrentTime  .'_'. ($i+ 1);   505                    $sBa seName = $ iMemberID  .'_'. $sCu rrentTime  .'_'. ($i+ 1);
506                    $sEx t = strrch r($_FILES[ 'userfile' ]['name'][ $i], '.');   506                    $sEx t = strrch r($_FILES[ 'userfile' ]['name'][ $i], '.');
507                    $sEx t = strtol ower(trim( $sExt));   507                    $sEx t = strtol ower(trim( $sExt));
508     508  
509                    $vRe sizeRes =  imageResiz e( $_FILES ['userfile ']['tmp_na me'][$i],  "{$dir['ro ot']}{$thi s -> sUplo adDir}img_ {$sBaseNam e}{$sExt}" , $this ->  iImgSize,  $this ->  iImgSize ) ;   509                    $vRe sizeRes =  imageResiz e( $_FILES ['userfile ']['tmp_na me'][$i],  "{$dir['ro ot']}{$thi s -> sUplo adDir}img_ {$sBaseNam e}{$sExt}" , $this ->  iImgSize,  $this ->  iImgSize ) ;
510                    $vTh umbResizeR es = image Resize( $_ FILES['use rfile']['t mp_name'][ $i], "{$di r['root']} {$this ->  sUploadDir }thumb_{$s BaseName}{ $sExt}", $ this -> iT humbSize,  $this -> i ThumbSize  );   510                    $vTh umbResizeR es = image Resize( $_ FILES['use rfile']['t mp_name'][ $i], "{$di r['root']} {$this ->  sUploadDir }thumb_{$s BaseName}{ $sExt}", $ this -> iT humbSize,  $this -> i ThumbSize  );
511                    $vBi gThumbResi zeRes = im ageResize(  $_FILES[' userfile'] ['tmp_name '][$i], "{ $dir['root ']}{$this  -> sUpload Dir}big_th umb_{$sBas eName}{$sE xt}", $thi s -> iBigT humbSize,  $this -> i BigThumbSi ze );   511                    $vBi gThumbResi zeRes = im ageResize(  $_FILES[' userfile'] ['tmp_name '][$i], "{ $dir['root ']}{$this  -> sUpload Dir}big_th umb_{$sBas eName}{$sE xt}", $thi s -> iBigT humbSize,  $this -> i BigThumbSi ze );
512                    $vIc onResizeRe s = imageR esize( $_F ILES['user file']['tm p_name'][$ i], "{$dir ['root']}{ $this -> s UploadDir} icon_{$sBa seName}{$s Ext}", $th is -> iIco nSize, $th is -> iIco nSize );   512                    $vIc onResizeRe s = imageR esize( $_F ILES['user file']['tm p_name'][$ i], "{$dir ['root']}{ $this -> s UploadDir} icon_{$sBa seName}{$s Ext}", $th is -> iIco nSize, $th is -> iIco nSize );
513                    if (  $vResizeR es || $vTh umbResizeR es || $vBi gThumbResi zeRes || $ vIconResiz eRes ) {   513                    if (  $vResizeR es || $vTh umbResizeR es || $vBi gThumbResi zeRes || $ vIconResiz eRes ) {
514                         print _t_e rr("_ERROR _WHILE_PRO CESSING");     514                         print _t_e rr("_ERROR _WHILE_PRO CESSING");  
515                         continue;   515                         continue;
516                    }   516                    }
517     517  
518                    $vSq lRes = $th is -> Inse rtCAM($iMe mberID, $s BaseName,  $sExt);   518                    $vSq lRes = $th is -> Inse rtCAM($iMe mberID, $s BaseName,  $sExt);
519                    if ( $vSqlRes)  {   519                    if ( $vSqlRes)  {
520                         $iIDs .= m ysql_inser t_id().',' ;   520                         $iIDs .= m ysql_inser t_id().',' ;
521                    }   521                    }
522                }   522                }
523                return $ iIDs;   523                return $ iIDs;
524           }   524           }
525       }   525       }
526     526  
527       /**   527       /**
528        * Ins ert POSTed  data into  table `Cl assifiedsA dvertiseme nts`   528        * Ins ert POSTed  data into  table `Cl assifiedsA dvertiseme nts`
529        *   529        *
530        * @re turn Text  presentati on of resu lt   530        * @re turn Text  presentati on of resu lt
531        */   531        */
532       functi on ActionP ostAdMessa ge() {   532       functi on ActionP ostAdMessa ge() {
533           $s RetTxt = ' ';   533           $s RetTxt = ' ';
534           $i SubClassif iedID = (i nt)$_POST[ 'SubClassi fied'];   534           $i SubClassif iedID = (i nt)$_POST[ 'SubClassi fied'];
535           $s SuccAdd =  _t("_SUCC_ ADD_ADV");   535           $s SuccAdd =  _t("_SUCC_ ADD_ADV");
536           $s FailAdd =  _t("_FAIL_ ADD_ADV");   536           $s FailAdd =  _t("_FAIL_ ADD_ADV");
537           $i VisitorID  = (int)$_C OOKIE['mem berID'];   537           $i VisitorID  = (int)$_C OOKIE['mem berID'];
538           if  ($iVisito rID > 0 ||  $this->bA dminMode)  {   538           if  ($iVisito rID > 0 ||  $this->bA dminMode)  {
539                $sMedIds  = $this - > parseUpl oadedFiles ($iVisitor ID);   539                $sMedIds  = $this - > parseUpl oadedFiles ($iVisitor ID);
540                $sSubjec t = $this- >process_h tml_db_inp ut($_POST[ 'subject'] );   540                $sSubjec t = $this- >process_h tml_db_inp ut($_POST[ 'subject'] );
541                if ($sSu bject != ' ' AND $iSu bClassifie dID > 0) {   541                if ($sSu bject != ' ' AND $iSu bClassifie dID > 0) {
542                    $sMe ssage = $t his->proce ss_html_db _input($_P OST['messa ge']);   542                    $sMe ssage = $t his->proce ss_html_db _input($_P OST['messa ge']);
543                    if ( ereg ("([0 -9]+)", pr ocess_db_i nput( $_PO ST['Custom FieldValue 1'] ), $aR egs)) {   543                    if ( ereg ("([0 -9]+)", pr ocess_db_i nput( $_PO ST['Custom FieldValue 1'] ), $aR egs)) {
544                         $sCustomFi eldValue1  = $aRegs[1 ];   544                         $sCustomFi eldValue1  = $aRegs[1 ];
545                    }   545                    }
546                    if ( ereg ("([0 -9]+)", pr ocess_db_i nput( $_PO ST['Custom FieldValue 2'] ), $aR egs)) {   546                    if ( ereg ("([0 -9]+)", pr ocess_db_i nput( $_PO ST['Custom FieldValue 2'] ), $aR egs)) {
547                         $sCustomFi eldValue2  = $aRegs[1 ];   547                         $sCustomFi eldValue2  = $aRegs[1 ];
548                    }   548                    }
549                    $iLi feTime = p rocess_db_ input( $_P OST['lifet ime'] );   549                    $iLi feTime = p rocess_db_ input( $_P OST['lifet ime'] );
550                    $sCu stomFieldV alue1 = ($ sCustomFie ldValue1== null) ? 'N ULL' : "'{ $sCustomFi eldValue1} '";   550                    $sCu stomFieldV alue1 = ($ sCustomFie ldValue1== null) ? 'N ULL' : "'{ $sCustomFi eldValue1} '";
551                    $sCu stomFieldV alue2 = ($ sCustomFie ldValue2== null) ? 'N ULL' : "'{ $sCustomFi eldValue2} '";   551                    $sCu stomFieldV alue2 = ($ sCustomFie ldValue2== null) ? 'N ULL' : "'{ $sCustomFi eldValue2} '";
552                    $sTa gs = proce ss_db_inpu t( $_POST[ 'tags'] );   552                    $sTa gs = proce ss_db_inpu t( $_POST[ 'tags'] );
553                    $aTa gs = explo deTags($sT ags);   553                    $aTa gs = explo deTags($sT ags);
554                    $sTa gs = implo de(",", $a Tags);   554                    $sTa gs = implo de(",", $a Tags);
555                    $vSq lRes = $th is -> Inse rtCA($iVis itorID, $i SubClassif iedID, $sS ubject, $s Message, $ sCustomFie ldValue1,  $sCustomFi eldValue2,  $iLifeTim e, $sMedId s, $sTags) ;   555                    $vSq lRes = $th is -> Inse rtCA($iVis itorID, $i SubClassif iedID, $sS ubject, $s Message, $ sCustomFie ldValue1,  $sCustomFi eldValue2,  $iLifeTim e, $sMedId s, $sTags) ;
556     556  
557                    $sRe tTxt .= (m ysql_affec ted_rows() >0) ? $sSu ccAdd : $s FailAdd;   557                    $sRe tTxt .= (m ysql_affec ted_rows() >0) ? $sSu ccAdd : $s FailAdd;
558                    $iLa stId = mys ql_insert_ id();   558                    $iLa stId = mys ql_insert_ id();
559                    $thi s->UseDefa ultCF();   559                    $thi s->UseDefa ultCF();
560                    if ( $iLastId >  0) {   560                    if ( $iLastId >  0) {
561                         reparseObj Tags( 'ad' , $iLastId  );   561                         reparseObj Tags( 'ad' , $iLastId  );
562                         return  Ms gBox($sRet Txt) . $th is -> Acti onPrintAdv ertisement ($iLastId) ;   562                         return  Ms gBox($sRet Txt) . $th is -> Acti onPrintAdv ertisement ($iLastId) ;
563                    }   563                    }
564                    retu rn MsgBox( $sRetTxt)  . MsgBox(_ t('_Error  Occured')) ;   564                    retu rn MsgBox( $sRetTxt)  . MsgBox(_ t('_Error  Occured')) ;
565                }   565                }
566                return M sgBox($sFa ilAdd);   566                return M sgBox($sFa ilAdd);
567           }  else {   567           }  else {
568                return M sgBox(_t(' _Error Occ ured'));   568                return M sgBox(_t(' _Error Occ ured'));
569           }   569           }
570       }   570       }
571     571  
572       /**   572       /**
573        * Gen erate list  of My Adv ertisement s   573        * Gen erate list  of My Adv ertisement s
574        *   574        *
575        * @re turn HTML  presentati on of data   575        * @re turn HTML  presentati on of data
576        */   576        */
577       functi on PrintMy Ads($iOthe rProfileID =-1, $iRan dLim=-1, $ bHideWarn  = false) {   577       functi on PrintMy Ads($iOthe rProfileID =-1, $iRan dLim=-1, $ bHideWarn  = false) {
578           gl obal $site ;   578           gl obal $site ;
579           $i MemberID =  (int)$_CO OKIE['memb erID'];   579           $i MemberID =  (int)$_CO OKIE['memb erID'];
580           $s RestrictRe s = $this- >RestrictA ction($iMe mberID);   580           $s RestrictRe s = $this- >RestrictA ction($iMe mberID);
581           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   581           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
582           // if ($this- >RestrictA ction($iMe mberID)) r eturn;   582           // if ($this- >RestrictA ction($iMe mberID)) r eturn;
583     583  
584           $s UserListC  = ($iOther ProfileID= =-1)? _t(' _Browse My  Ads'): _t ('_Users o ther listi ng');   584           $s UserListC  = ($iOther ProfileID= =-1)? _t(' _Browse My  Ads'): _t ('_Users o ther listi ng');
585           $s BrowseAllA ds = _t('_ Browse All  Ads');   585           $s BrowseAllA ds = _t('_ Browse All  Ads');
586     586  
587           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";   587           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";
588     588  
589           $s BreadCrumb s = <<<EOF   589           $s BreadCrumb s = <<<EOF
590   <div class ="breadcru mbs">   590   <div class ="breadcru mbs">
591   <a href="{ $site['url ']}">{$sit e['title'] }</a>   591   <a href="{ $site['url ']}">{$sit e['title'] }</a>
592   /   592   /
593   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>   593   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>
594   /   594   /
595   {$sUserLis tC}   595   {$sUserLis tC}
596   </div>   596   </div>
597   EOF;   597   EOF;
598     598  
599           $s RetHtml =  '';   599           $s RetHtml =  '';
600           $i ProfileID  = ($iOther ProfileID> 0)?$iOther ProfileID: $iMemberID ;   600           $i ProfileID  = ($iOther ProfileID> 0)?$iOther ProfileID: $iMemberID ;
601           $v SqlRes = $ this -> Ge tAdvDataOf Profile($i ProfileID,  $iRandLim );   601           $v SqlRes = $ this -> Ge tAdvDataOf Profile($i ProfileID,  $iRandLim );
602           if  (mysql_af fected_row s()==0) {   602           if  (mysql_af fected_row s()==0) {
603                $sRetHtm l =  ($bHi deWarn==fa lse) ? Msg Box(_t('_n o posts'))  : '';   603                $sRetHtm l =  ($bHi deWarn==fa lse) ? Msg Box(_t('_n o posts'))  : '';
604           }  else {   604           }  else {
605                $bRandLi m = ($iRan dLim>0) ?  TRUE : FAL SE;   605                $bRandLi m = ($iRan dLim>0) ?  TRUE : FAL SE;
606                while( $ aSqlResStr  = mysql_f etch_assoc ($vSqlRes)  ) {   606                while( $ aSqlResStr  = mysql_f etch_assoc ($vSqlRes)  ) {
607                    $sRe tHtml .= $ this -> Co mposeResul tStringAdv ($aSqlResS tr, $bRand Lim);   607                    $sRe tHtml .= $ this -> Co mposeResul tStringAdv ($aSqlResS tr, $bRand Lim);
608                }   608                }
609                if ($iOt herProfile ID > 0) {   609                if ($iOt herProfile ID > 0) {
610                    $sRe tHtml = ($ iRandLim>0 ) ? $sRetH tml : $sBr eadCrumbs  . $sRetHtm l;   610                    $sRe tHtml = ($ iRandLim>0 ) ? $sRetH tml : $sBr eadCrumbs  . $sRetHtm l;
611                }   611                }
612           }   612           }
613           if  ($iRandLi m==-1)   613           if  ($iRandLi m==-1)
614                return   DesignBoxC ontent ( _ t('_My Cla ssifieds') , $sRetHtm l, 1);   614                return   DesignBoxC ontent ( _ t('_My Cla ssifieds') , $sRetHtm l, 1);
615           el se   615           el se
616                return $ sRetHtml;   616                return $ sRetHtml;
617       }   617       }
618     618  
619       functi on DeleteP rofileAdve rtisement( $iProfileI D) {   619       functi on DeleteP rofileAdve rtisement( $iProfileI D) {
620           if  ($this->b AdminMode= =true) {   620           if  ($this->b AdminMode= =true) {
621                $vDelSQL  = db_res( "SELECT `I D` FROM `C lassifieds Advertisem ents` WHER E `IDProfi le` = '{$i ProfileID} '");   621                $vDelSQL  = db_res( "SELECT `I D` FROM `C lassifieds Advertisem ents` WHER E `IDProfi le` = '{$i ProfileID} '");
622                while( $ aAdv = mys ql_fetch_a ssoc($vDel SQL) ) {   622                while( $ aAdv = mys ql_fetch_a ssoc($vDel SQL) ) {
623                    $thi s->ActionD eleteAdver tisement($ aAdv['ID'] );   623                    $thi s->ActionD eleteAdver tisement($ aAdv['ID'] );
624                }   624                }
625           }   625           }
626       }   626       }
627     627  
628       /**   628       /**
629        * Del eting Adve rtisement  from `Clas sifiedsAdv ertisement s`   629        * Del eting Adve rtisement  from `Clas sifiedsAdv ertisement s`
630        *   630        *
631        * @pa ram $id    ID of dele ting Adver tisement   631        * @pa ram $id    ID of dele ting Adver tisement
632        * @re turn Text  presentati on of resu lt   632        * @re turn Text  presentati on of resu lt
633        */   633        */
634       functi on ActionD eleteAdver tisement($ id) {   634       functi on ActionD eleteAdver tisement($ id) {
635           gl obal $dir;   635           gl obal $dir;
636     636  
637           $s CheckPostS QL = "SELE CT `IDProf ile`   637           $s CheckPostS QL = "SELE CT `IDProf ile`
638                                 FR OM `Classi fiedsAdver tisements`   638                                 FR OM `Classi fiedsAdver tisements`
639                                 WH ERE `ID`={ $id}   639                                 WH ERE `ID`={ $id}
640                             ";   640                             ";
641           $a AdvOwner =  db_arr($s CheckPostS QL);   641           $a AdvOwner =  db_arr($s CheckPostS QL);
642           $i AdvOwner =  $aAdvOwne r['IDProfi le'];   642           $i AdvOwner =  $aAdvOwne r['IDProfi le'];
643           $i VisitorID  = (int)$_C OOKIE['mem berID'];   643           $i VisitorID  = (int)$_C OOKIE['mem berID'];
644           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $id >  0) {   644           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $id >  0) {
645                if ($thi s->bAdminM ode==false ) {   645                if ($thi s->bAdminM ode==false ) {
646                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);   646                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);
647                    if ( $sRestrict Res != '')  return $s RestrictRe s;   647                    if ( $sRestrict Res != '')  return $s RestrictRe s;
648                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;   648                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;
649                }   649                }
650     650  
651                $sSuccDe l = _t("_S UCC_DEL_AD V");   651                $sSuccDe l = _t("_S UCC_DEL_AD V");
652                $sFailDe l = _t("_F AIL_DEL_AD V");   652                $sFailDe l = _t("_F AIL_DEL_AD V");
653     653  
654                $sRetHtm l = '';   654                $sRetHtm l = '';
655                $iDelete Advertisem entID = (i nt)$id;   655                $iDelete Advertisem entID = (i nt)$id;
656                $sQueryM edia = "   656                $sQueryM edia = "
657                    SELE CT `Media`     657                    SELE CT `Media`  
658                    FROM  `Classifi edsAdverti sements`    658                    FROM  `Classifi edsAdverti sements` 
659                    WHER E `ID` = { $iDeleteAd vertisemen tID}   659                    WHER E `ID` = { $iDeleteAd vertisemen tID}
660                    LIMI T 1   660                    LIMI T 1
661                ";   661                ";
662     662  
663                $aSqlRes Adv = db_a ssoc_arr(  $sQueryMed ia );   663                $aSqlRes Adv = db_a ssoc_arr(  $sQueryMed ia );
664                $sMediaI Ds = $aSql ResAdv['Me dia'];   664                $sMediaI Ds = $aSql ResAdv['Me dia'];
665                if ($sMe diaIDs !=  '') {   665                if ($sMe diaIDs !=  '') {
666                    $aCh unks = pre g_split (" /[,]+/", $ sMediaIDs,  -1, PREG_ SPLIT_NO_E MPTY);   666                    $aCh unks = pre g_split (" /[,]+/", $ sMediaIDs,  -1, PREG_ SPLIT_NO_E MPTY);
667     667  
668                    fore ach ( $aCh unks as $i MedId ) {   668                    fore ach ( $aCh unks as $i MedId ) {
669                         $sAdminCut 2 = ($this ->bAdminMo de==false)  ? "AND `M ediaProfil eID` = {$i VisitorID} " : "";   669                         $sAdminCut 2 = ($this ->bAdminMo de==false)  ? "AND `M ediaProfil eID` = {$i VisitorID} " : "";
670                         $sQueryChu nkFile = "   670                         $sQueryChu nkFile = "
671                             SELECT  `MediaFil e`    671                             SELECT  `MediaFil e` 
672                             FROM ` Classified sAdvertise mentsMedia   672                             FROM ` Classified sAdvertise mentsMedia
673                             WHERE  `MediaID`  = {$iMedId }   673                             WHERE  `MediaID`  = {$iMedId }
674                             {$sAdm inCut2}   674                             {$sAdm inCut2}
675                             LIMIT  1   675                             LIMIT  1
676                         ";   676                         ";
677                         $aSqlResMe diaName =  db_assoc_a rr( $sQuer yChunkFile  );   677                         $aSqlResMe diaName =  db_assoc_a rr( $sQuer yChunkFile  );
678                         $sMediaFil eName = $a SqlResMedi aName['Med iaFile'];   678                         $sMediaFil eName = $a SqlResMedi aName['Med iaFile'];
679                         if ($sMedi aFileName  != '') {   679                         if ($sMedi aFileName  != '') {
680                             if (un link ( $di r['root']. $this->sUp loadDir .  'img_'.$sM ediaFileNa me ) == FA LSE) {   680                             if (un link ( $di r['root']. $this->sUp loadDir .  'img_'.$sM ediaFileNa me ) == FA LSE) {
681                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   681                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
682                             }   682                             }
683                             if (un link ( $di r['root']. $this->sUp loadDir .  'thumb_'.$ sMediaFile Name ) ==  FALSE) {   683                             if (un link ( $di r['root']. $this->sUp loadDir .  'thumb_'.$ sMediaFile Name ) ==  FALSE) {
684                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   684                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
685                             }   685                             }
686                             if (un link ( $di r['root']. $this->sUp loadDir .  'big_thumb _'.$sMedia FileName )  == FALSE)  {   686                             if (un link ( $di r['root']. $this->sUp loadDir .  'big_thumb _'.$sMedia FileName )  == FALSE)  {
687                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   687                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
688                             }   688                             }
689                             if (un link ( $di r['root']. $this->sUp loadDir .  'icon_'.$s MediaFileN ame ) == F ALSE) {   689                             if (un link ( $di r['root']. $this->sUp loadDir .  'icon_'.$s MediaFileN ame ) == F ALSE) {
690                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   690                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
691                             }   691                             }
692                         }   692                         }
693                         $sQueryMed iaID = "DE LETE FROM  `Classifie dsAdvertis ementsMedi a` WHERE ` MediaID` =  {$iMedId}  AND `Medi aProfileID ` = {$iVis itorID} LI MIT 1";   693                         $sQueryMed iaID = "DE LETE FROM  `Classifie dsAdvertis ementsMedi a` WHERE ` MediaID` =  {$iMedId}  AND `Medi aProfileID ` = {$iVis itorID} LI MIT 1";
694                         $aSqlResMe diaID = db _res( $sQu eryMediaID  );   694                         $aSqlResMe diaID = db _res( $sQu eryMediaID  );
695                    }   695                    }
696                }   696                }
697     697  
698                $sAdminC ut3 = ($th is->bAdmin Mode==fals e) ? "AND  `IDProfile ` = {$iVis itorID}" :  "";   698                $sAdminC ut3 = ($th is->bAdmin Mode==fals e) ? "AND  `IDProfile ` = {$iVis itorID}" :  "";
699                $sQuery  = "DELETE  FROM `Clas sifiedsAdv ertisement s` WHERE ` ID` = {$iD eleteAdver tisementID } {$sAdmin Cut3} LIMI T 1";   699                $sQuery  = "DELETE  FROM `Clas sifiedsAdv ertisement s` WHERE ` ID` = {$iD eleteAdver tisementID } {$sAdmin Cut3} LIMI T 1";
700                $vSqlRes CA = db_re s( $sQuery  );   700                $vSqlRes CA = db_re s( $sQuery  );
701     701  
702                $sRetHtm l .= (mysq l_affected _rows()>0)  ? MsgBox( _t($sSuccD el)) : Msg Box(_t($sF ailDel));   702                $sRetHtm l .= (mysq l_affected _rows()>0)  ? MsgBox( _t($sSuccD el)) : Msg Box(_t($sF ailDel));
703                reparseO bjTags( 'a d', $iDele teAdvertis ementID );   703                reparseO bjTags( 'a d', $iDele teAdvertis ementID );
704     704  
705                if ($vSq lResCA)   705                if ($vSq lResCA)
706                {   706                {
707                    $oCm ts = new B xDolCmts(' classified s', $iDele teAdvertis ementID);   707                    $oCm ts = new B xDolCmts(' classified s', $iDele teAdvertis ementID);
708                    $oCm ts->onObje ctDelete() ;   708                    $oCm ts->onObje ctDelete() ;
709                }   709                }
710     710  
711                return $ sRetHtml;   711                return $ sRetHtml;
712           }  elseif($iV isitorID ! = $iAdvOwn er) {   712           }  elseif($iV isitorID ! = $iAdvOwn er) {
713                return M sgBox(_t(' _Hacker St ring'));   713                return M sgBox(_t(' _Hacker St ring'));
714           }  else {   714           }  else {
715                return M sgBox(_t(' _Error Occ ured'));   715                return M sgBox(_t(' _Error Occ ured'));
716           }   716           }
717       }   717       }
718     718  
719       functi on getImag eManagingC ode($sMedi aIDs) {   719       functi on getImag eManagingC ode($sMedi aIDs) {
720           gl obal $site ;   720           gl obal $site ;
721           gl obal $tmpl ;   721           gl obal $tmpl ;
722           gl obal $dir;   722           gl obal $dir;
723     723  
724           $s AddFileFie ldN = _t(' _Add file  field');   724           $s AddFileFie ldN = _t(' _Add file  field');
725           // $sSendThis N = _t('_S end these  files');   725           // $sSendThis N = _t('_S end these  files');
726           $s ChooseC =  _t('_Uploa d File');   726           $s ChooseC =  _t('_Uploa d File');
727           $s DeleteC =  _t('_Delet e');   727           $s DeleteC =  _t('_Delet e');
728           $s PhotosC =  _t('_photo s');   728           $s PhotosC =  _t('_photo s');
729     729  
730           $s SpacerName  = $site[' url'].$thi s->sSpacer Path;   730           $s SpacerName  = $site[' url'].$thi s->sSpacer Path;
731     731  
732           if  ($sMediaI Ds != '')  {   732           if  ($sMediaI Ds != '')  {
733                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );   733                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );
734                foreach  ( $aChunks  as $iMedI d ) {   734                foreach  ( $aChunks  as $iMedI d ) {
735                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;   735                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;
736                    $aSq lRes = db_ arr ($sSql );   736                    $aSq lRes = db_ arr ($sSql );
737                    if ( mysql_affe cted_rows( )>0) {   737                    if ( mysql_affe cted_rows( )>0) {
738                         $sFileName  = $site[' url']. $th is->sUploa dDir.'thum b_'.$aSqlR es['MediaF ile'];   738                         $sFileName  = $site[' url']. $th is->sUploa dDir.'thum b_'.$aSqlR es['MediaF ile'];
739                         $sImgTag . = <<<EOF   739                         $sImgTag . = <<<EOF
740   <div style ="float:le ft;">   740   <div style ="float:le ft;">
741   <img class ="photo1"  src="{$sSp acerName}"  style="wi dth:{$this ->iThumbSi ze}px;heig ht:{$this- >iThumbSiz e}px;backg round-imag e:url({$sF ileName}); " alt="" / >   741   <img class ="photo1"  src="{$sSp acerName}"  style="wi dth:{$this ->iThumbSi ze}px;heig ht:{$this- >iThumbSiz e}px;backg round-imag e:url({$sF ileName}); " alt="" / >
742   <br />   742   <br />
743   <a href="# " onclick= "UpdateFie ld('Delete dPictureID ','{$iMedI d}'); docu ment.forms .EditForm. submit();  return fal se;">{$sDe leteC}</a>   743   <a href="# " onclick= "UpdateFie ld('Delete dPictureID ','{$iMedI d}'); docu ment.forms .EditForm. submit();  return fal se;">{$sDe leteC}</a>
744   <!-- <inpu t type="bu tton" valu e="{$sDele teC}" oncl ick="Updat eField('De letedPictu reID','{$i MedId}');  document.f orms.EditF orm.submit (); return  false;" / > -->   744   <!-- <inpu t type="bu tton" valu e="{$sDele teC}" oncl ick="Updat eField('De letedPictu reID','{$i MedId}');  document.f orms.EditF orm.submit (); return  false;" / > -->
745   </div>   745   </div>
746   EOF;   746   EOF;
747                    }   747                    }
748                }   748                }
749           }   749           }
750           // if ($sImgT ag != '')  {   750           // if ($sImgT ag != '')  {
751                $sOldCod e = $sImgT ag;   751                $sOldCod e = $sImgT ag;
752                $iEdited ClsID = $_ REQUEST['E ditAdverti sementID'] ;   752                $iEdited ClsID = $_ REQUEST['E ditAdverti sementID'] ;
753     753  
754                $sImgTag  = <<<EOF   754                $sImgTag  = <<<EOF
755   <tr class= "vc">   755   <tr class= "vc">
756       <td cl ass="cls_t bl_left_t" >{$sPhotos C}:</td>   756       <td cl ass="cls_t bl_left_t" >{$sPhotos C}:</td>
757       <td cl ass="cls_t bl_right_m ">   757       <td cl ass="cls_t bl_right_m ">
758           <d iv class=" clear_both "></div>   758           <d iv class=" clear_both "></div>
759           <d iv class=" thumbnail_ block">{$s OldCode}</ div>   759           <d iv class=" thumbnail_ block">{$s OldCode}</ div>
760           <i nput type= "hidden" i d="Deleted PictureID"  name="Del etedPictur eID" value ="" />   760           <i nput type= "hidden" i d="Deleted PictureID"  name="Del etedPictur eID" value ="" />
761           <i nput type= "hidden" n ame="actio n" value=" delete_pic ture" />   761           <i nput type= "hidden" n ame="actio n" value=" delete_pic ture" />
762           <d iv class=" clear_both "></div>   762           <d iv class=" clear_both "></div>
763       </td>   763       </td>
764   </tr>   764   </tr>
765   <tr class= "vc">   765   <tr class= "vc">
766       <td cl ass="cls_t bl_left_t" >{$sChoose C}</td>   766       <td cl ass="cls_t bl_left_t" >{$sChoose C}</td>
767       <td cl ass="cls_t bl_right_m ">   767       <td cl ass="cls_t bl_right_m ">
768           <d iv id="bro wse_file_d iv"></div>   768           <d iv id="bro wse_file_d iv"></div>
769           <b r />   769           <b r />
770           <a  href="#"  onclick="A ddFilesFie lds('{$sDe leteC}');  return fal se;">{$sAd dFileField N}</a>   770           <a  href="#"  onclick="A ddFilesFie lds('{$sDe leteC}');  return fal se;">{$sAd dFileField N}</a>
771           <d iv class=" clear_both "></div>   771           <d iv class=" clear_both "></div>
772   <script ty pe="text/j avascript" >   772   <script ty pe="text/j avascript" >
773       AddFil esFields(' {$sDeleteC }');   773       AddFil esFields(' {$sDeleteC }');
774   </script>   774   </script>
775       </td>   775       </td>
776   </tr>   776   </tr>
777   EOF;   777   EOF;
778           // <input nam e="userfil e[]" type= "file" id= "userfile0 " /><br />   778           // <input nam e="userfil e[]" type= "file" id= "userfile0 " /><br />
779           // }   779           // }
780           // <input typ e="button"  value="{$ sAddFileFi eldN}" onc lick="AddF ilesFields ();" />   780           // <input typ e="button"  value="{$ sAddFileFi eldN}" onc lick="AddF ilesFields ();" />
781           re turn $sImg Tag;   781           re turn $sImg Tag;
782       }   782       }
783     783  
784     784  
785       /**   785       /**
786        * Gen erate DIV  overlapped  code of i mages   786        * Gen erate DIV  overlapped  code of i mages
787        *   787        *
788        * @pa ram $sMedi aIDs    st ring array  of images  ID   788        * @pa ram $sMedi aIDs    st ring array  of images  ID
789        * @pa ram $bOnly First   a  key that s ay - show  only first  picture i n array   789        * @pa ram $bOnly First   a  key that s ay - show  only first  picture i n array
790        * @re turn HTML  presentati on of data   790        * @re turn HTML  presentati on of data
791        */   791        */
792       functi on getImag eCode($sMe diaIDs, $b OnlyFirst  = false, $ bDisableJS  = false)  {   792       functi on getImag eCode($sMe diaIDs, $b OnlyFirst  = false, $ bDisableJS  = false)  {
793           // $imgtag =  '';   793           // $imgtag =  '';
794           gl obal $site ;   794           gl obal $site ;
795           gl obal $tmpl ;   795           gl obal $tmpl ;
796           gl obal $dir;   796           gl obal $dir;
797           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;   797           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;
798     798  
799           if  ($sMediaI Ds != '')  {   799           if  ($sMediaI Ds != '')  {
800                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );   800                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );
801                foreach  ( $aChunks  as $iMedI d ) {   801                foreach  ( $aChunks  as $iMedI d ) {
802                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;   802                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;
803                    $aSq lRes = db_ arr ($sSql );   803                    $aSq lRes = db_ arr ($sSql );
804                    if ( mysql_affe cted_rows( )>0) {   804                    if ( mysql_affe cted_rows( )>0) {
805                         if (file_e xists($dir ['url'].$t his -> sUp loadDir.'i con_'.$aSq lRes['Medi aFile']) = = false) {   805                         if (file_e xists($dir ['url'].$t his -> sUp loadDir.'i con_'.$aSq lRes['Medi aFile']) = = false) {
806                             $sFile Name = "{$ site['url' ]}template s/tmpl_{$t mpl}/{$thi s -> sPicN otAvail}";   806                             $sFile Name = "{$ site['url' ]}template s/tmpl_{$t mpl}/{$thi s -> sPicN otAvail}";
807                             $sSwit cherCode =  '';   807                             $sSwit cherCode =  '';
808                         } else {   808                         } else {
809                             $sFile Name = $si te['url'].  $this ->  sUploadDir .'icon_'.$ aSqlRes['M ediaFile'] ;   809                             $sFile Name = $si te['url'].  $this ->  sUploadDir .'icon_'.$ aSqlRes['M ediaFile'] ;
810                             $sSwit cherCode =  "onclick= \"changeBi gPicTo('{$ site['url' ]}{$this - > sUploadD ir}big_thu mb_{$aSqlR es['MediaF ile']}', ' {$site['ur l']}{$this  -> sUploa dDir}img_{ $aSqlRes[' MediaFile' ]}');\"";   810                             $sSwit cherCode =  "onclick= \"changeBi gPicTo('{$ site['url' ]}{$this - > sUploadD ir}big_thu mb_{$aSqlR es['MediaF ile']}', ' {$site['ur l']}{$this  -> sUploa dDir}img_{ $aSqlRes[' MediaFile' ]}');\"";
811                         }   811                         }
812                         if ($bDisa bleJS) $sS witcherCod e = '';   812                         if ($bDisa bleJS) $sS witcherCod e = '';
813                         if ($bOnly First==TRU E) {   813                         if ($bOnly First==TRU E) {
814                             $sImgT ag .= "<im g class=\" icons\" sr c=\"{$sSpa cerName}\"  style=\"w idth:{$thi s -> iIcon Size}px;he ight:{$thi s -> iIcon Size}px;ba ckground-i mage:url({ $sFileName });\" alt= \"\" />";   814                             $sImgT ag .= "<im g class=\" icons\" sr c=\"{$sSpa cerName}\"  style=\"w idth:{$thi s -> iIcon Size}px;he ight:{$thi s -> iIcon Size}px;ba ckground-i mage:url({ $sFileName });\" alt= \"\" />";
815                         }   815                         }
816                         else {   816                         else {
817                             $sImgT ag .= "<im g class=\" icons\" sr c=\"{$sSpa cerName}\"  {$sSwitch erCode} st yle=\"widt h:{$this - > iIconSiz e}px;heigh t:{$this - > iIconSiz e}px;backg round-imag e:url({$sF ileName}); \" alt=\"\ " />";   817                             $sImgT ag .= "<im g class=\" icons\" sr c=\"{$sSpa cerName}\"  {$sSwitch erCode} st yle=\"widt h:{$this - > iIconSiz e}px;heigh t:{$this - > iIconSiz e}px;backg round-imag e:url({$sF ileName}); \" alt=\"\ " />";
818                         }   818                         }
819                    }   819                    }
820                    if ( $bOnlyFirs t==TRUE) {   820                    if ( $bOnlyFirs t==TRUE) {
821                         break;   821                         break;
822                    }   822                    }
823                }   823                }
824           }   824           }
825           if  ($sImgTag  == '' AND  $bOnlyFir st==TRUE)  {   825           if  ($sImgTag  == '' AND  $bOnlyFir st==TRUE)  {
826                $sImgTag  = "<img c lass=\"ico ns\" src=\ "{$sSpacer Name}\" st yle=\"widt h:{$this - > iIconSiz e}px;heigh t:{$this - > iIconSiz e}px;backg round-imag e:url({$si te['url']} templates/ tmpl_{$tmp l}/{$this  -> sPicNot Avail});\"  alt=\"\"  />";   826                $sImgTag  = "<img c lass=\"ico ns\" src=\ "{$sSpacer Name}\" st yle=\"widt h:{$this - > iIconSiz e}px;heigh t:{$this - > iIconSiz e}px;backg round-imag e:url({$si te['url']} templates/ tmpl_{$tmp l}/{$this  -> sPicNot Avail});\"  alt=\"\"  />";
827           }   827           }
828           if  ($bOnlyFi rst==FALSE  AND $sImg Tag != '')  {   828           if  ($bOnlyFi rst==FALSE  AND $sImg Tag != '')  {
829                $sOldCod e = $sImgT ag;   829                $sOldCod e = $sImgT ag;
830     830  
831                $sImgTag  = '<div c lass="icon Block" id= "aIconBloc k">'.$sOld Code."</di v>";   831                $sImgTag  = '<div c lass="icon Block" id= "aIconBloc k">'.$sOld Code."</di v>";
832           }   832           }
833           re turn $sImg Tag;   833           re turn $sImg Tag;
834       }   834       }
835     835  
836       functi on getImag eCodeSimpl e($sMediaI Ds) {   836       functi on getImag eCodeSimpl e($sMediaI Ds) {
837           gl obal $site ;   837           gl obal $site ;
838           gl obal $tmpl ;   838           gl obal $tmpl ;
839           gl obal $dir;   839           gl obal $dir;
840           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;   840           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;
841           $s Ret = '';   841           $s Ret = '';
842     842  
843           if  ($sMediaI Ds != '')  {   843           if  ($sMediaI Ds != '')  {
844                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );   844                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );
845                foreach  ( $aChunks  as $iMedI d ) {   845                foreach  ( $aChunks  as $iMedI d ) {
846                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;   846                    $sSq l = "SELEC T * FROM ` Classified sAdvertise mentsMedia ` WHERE `M ediaID` =  {$iMedId}" ;
847                    $aSq lRes = db_ arr ($sSql );   847                    $aSq lRes = db_ arr ($sSql );
848                    if ( mysql_affe cted_rows( )>0) {   848                    if ( mysql_affe cted_rows( )>0) {
849                         if (file_e xists($dir ['url'].$t his -> sUp loadDir.'b ig_thumb_' .$aSqlRes[ 'MediaFile ']) == tru e) {   849                         if (file_e xists($dir ['url'].$t his -> sUp loadDir.'b ig_thumb_' .$aSqlRes[ 'MediaFile ']) == tru e) {
850                             $sFile Name = $si te['url'].  $this ->  sUploadDir .'big_thum b_'.$aSqlR es['MediaF ile'];   850                             $sFile Name = $si te['url'].  $this ->  sUploadDir .'big_thum b_'.$aSqlR es['MediaF ile'];
851     851  
852                             $sFile NameFullSi ze = $site ['url']. $ this -> sU ploadDir . 'img_'.$aS qlRes['Med iaFile'];   852                             $sFile NameFullSi ze = $site ['url']. $ this -> sU ploadDir . 'img_'.$aS qlRes['Med iaFile'];
853                             $sDirF ileNameFul lSize = $d ir['url'].  $this ->  sUploadDir  .'img_'.$ aSqlRes['M ediaFile'] ;   853                             $sDirF ileNameFul lSize = $d ir['url'].  $this ->  sUploadDir  .'img_'.$ aSqlRes['M ediaFile'] ;
854                             list(  $width, $h eight, $ty pe, $attr  ) = getima gesize( $s DirFileNam eFullSize  );   854                             list(  $width, $h eight, $ty pe, $attr  ) = getima gesize( $s DirFileNam eFullSize  );
855                             $iNewW idth = $wi dth+20;   855                             $iNewW idth = $wi dth+20;
856                             $iNewH eight = $h eight+20;   856                             $iNewH eight = $h eight+20;
857     857  
858                             $sRet  .= <<<EOF   858                             $sRet  .= <<<EOF
859   <img id="A dvBigImg"  class="ico ns" src="{ $sSpacerNa me}" style ="position :absolute; width:{$th is -> iBig ThumbSize} px;height: {$this ->  iBigThumbS ize}px;bac kground-im age:url({$ sFileName} );" alt=""   859   <img id="A dvBigImg"  class="ico ns" src="{ $sSpacerNa me}" style ="position :absolute; width:{$th is -> iBig ThumbSize} px;height: {$this ->  iBigThumbS ize}px;bac kground-im age:url({$ sFileName} );" alt=""
860       onclic k="window. open('{$sF ileNameFul lSize}', ' picView',  'width={$i NewWidth}, height={$i NewHeight} '); return  false;" / >   860       onclic k="window. open('{$sF ileNameFul lSize}', ' picView',  'width={$i NewWidth}, height={$i NewHeight} '); return  false;" / >
861   EOF;   861   EOF;
862                             //$sRe t .= "<img  id=\"AdvB igImg\" cl ass=\"icon s\" src=\" {$sSpacerN ame}\" {$s SwitcherCo de} style= \"position :absolute; width:{$th is -> iBig ThumbSize} px;height: {$this ->  iBigThumbS ize}px;bac kground-im age:url({$ sFileName} );\" alt=\ "\" />";   862                             //$sRe t .= "<img  id=\"AdvB igImg\" cl ass=\"icon s\" src=\" {$sSpacerN ame}\" {$s SwitcherCo de} style= \"position :absolute; width:{$th is -> iBig ThumbSize} px;height: {$this ->  iBigThumbS ize}px;bac kground-im age:url({$ sFileName} );\" alt=\ "\" />";
863                         }   863                         }
864                    }   864                    }
865                }   865                }
866           }   866           }
867           re turn $sRet ;   867           re turn $sRet ;
868       }   868       }
869     869  
870     870  
871       /**   871       /**
872        * Gen erate DIV  overlapped  code of t humb-image  (first on ly)   872        * Gen erate DIV  overlapped  code of t humb-image  (first on ly)
873        *   873        *
874        * @pa ram $sMedi aIDs    st ring array  of images  ID   874        * @pa ram $sMedi aIDs    st ring array  of images  ID
875        * @pa ram $iID   Id of pict ure that g enerate a  href added  code (for  link-imag e)   875        * @pa ram $iID   Id of pict ure that g enerate a  href added  code (for  link-imag e)
876        * @re turn HTML  presentati on of data   876        * @re turn HTML  presentati on of data
877        */   877        */
878       functi on getBigI mageCode($ sMediaIDs,  $iID=0) {   878       functi on getBigI mageCode($ sMediaIDs,  $iID=0) {
879           $s ImgTag = ' ';   879           $s ImgTag = ' ';
880           gl obal $site ;   880           gl obal $site ;
881           gl obal $tmpl ;   881           gl obal $tmpl ;
882           gl obal $dir;   882           gl obal $dir;
883           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;   883           $s SpacerName  = $site[' url'].$thi s -> sSpac erPath;
884     884  
885           $s GenUrl = $ this->genU rl($iID, ' ', 'entry' , true);   885           $s GenUrl = $ this->genU rl($iID, ' ', 'entry' , true);
886     886  
887           if  ($sMediaI Ds != '')  {   887           if  ($sMediaI Ds != '')  {
888                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );   888                $aChunks  = preg_sp lit ("/[,] +/", $sMed iaIDs, -1,  PREG_SPLI T_NO_EMPTY );
889                $iMedId  = $aChunks [0];   889                $iMedId  = $aChunks [0];
890                $sSql =  "SELECT *  FROM `Clas sifiedsAdv ertisement sMedia` WH ERE `Media ID` = {$iM edId}";   890                $sSql =  "SELECT *  FROM `Clas sifiedsAdv ertisement sMedia` WH ERE `Media ID` = {$iM edId}";
891                $aSqlRes  = db_arr  ($sSql);   891                $aSqlRes  = db_arr  ($sSql);
892                if ($aSq lRes) {   892                if ($aSq lRes) {
893                    $sFi leName = $ site['url' ]. $this - > sUploadD ir .'thumb _'.$aSqlRe s['MediaFi le'];   893                    $sFi leName = $ site['url' ]. $this - > sUploadD ir .'thumb _'.$aSqlRe s['MediaFi le'];
894                    if ( file_exist s($dir['ur l'].$this  -> sUpload Dir .'thum b_'.$aSqlR es['MediaF ile']) ==  false)   894                    if ( file_exist s($dir['ur l'].$this  -> sUpload Dir .'thum b_'.$aSqlR es['MediaF ile']) ==  false)
895                         $sFileName  = "{$site ['url']}te mplates/tm pl_{$tmpl} /{$this ->  sPicNotAv ail}";   895                         $sFileName  = "{$site ['url']}te mplates/tm pl_{$tmpl} /{$this ->  sPicNotAv ail}";
896                    if ( (int)$iID  == 0) {   896                    if ( (int)$iID  == 0) {
897                         if (file_e xists($dir ['url'].$t his -> sUp loadDir .' big_thumb_ '.$aSqlRes ['MediaFil e']) == fa lse) {   897                         if (file_e xists($dir ['url'].$t his -> sUp loadDir .' big_thumb_ '.$aSqlRes ['MediaFil e']) == fa lse) {
898                             $sFile Name = "{$ site['url' ]}template s/tmpl_{$t mpl}/{$thi s -> sPicN otAvail}";   898                             $sFile Name = "{$ site['url' ]}template s/tmpl_{$t mpl}/{$thi s -> sPicN otAvail}";
899                         } else {   899                         } else {
900                             $sFile Name = $si te['url'].  $this ->  sUploadDir  .'big_thu mb_'.$aSql Res['Media File'];   900                             $sFile Name = $si te['url'].  $this ->  sUploadDir  .'big_thu mb_'.$aSql Res['Media File'];
901                         }   901                         }
902     902  
903                         if (file_e xists($dir ['url'].$t his -> sUp loadDir .' img_'.$aSq lRes['Medi aFile']) = = false) {   903                         if (file_e xists($dir ['url'].$t his -> sUp loadDir .' img_'.$aSq lRes['Medi aFile']) = = false) {
904                             $sImgT ag .= <<<E OF   904                             $sImgT ag .= <<<E OF
905   <img id="A dvBigImg"  class="pho to" style= "width:{$t his -> iBi gThumbSize }px;height :{$this ->  iBigThumb Size}px;ba ckground-i mage:url({ $sFileName });" src=" {$sSpacerN ame}" alt= "" />   905   <img id="A dvBigImg"  class="pho to" style= "width:{$t his -> iBi gThumbSize }px;height :{$this ->  iBigThumb Size}px;ba ckground-i mage:url({ $sFileName });" src=" {$sSpacerN ame}" alt= "" />
906   EOF;   906   EOF;
907                         } else {   907                         } else {
908                             $sFile NameFullSi ze = $site ['url']. $ this -> sU ploadDir . 'img_'.$aS qlRes['Med iaFile'];   908                             $sFile NameFullSi ze = $site ['url']. $ this -> sU ploadDir . 'img_'.$aS qlRes['Med iaFile'];
909                             $sDirF ileNameFul lSize = $d ir['url'].  $this ->  sUploadDir  .'img_'.$ aSqlRes['M ediaFile'] ;   909                             $sDirF ileNameFul lSize = $d ir['url'].  $this ->  sUploadDir  .'img_'.$ aSqlRes['M ediaFile'] ;
910                             list(  $width, $h eight, $ty pe, $attr  ) = getima gesize( $s DirFileNam eFullSize  );   910                             list(  $width, $h eight, $ty pe, $attr  ) = getima gesize( $s DirFileNam eFullSize  );
911                             $iNewW idth = $wi dth+20;   911                             $iNewW idth = $wi dth+20;
912                             $iNewH eight = $h eight+20;   912                             $iNewH eight = $h eight+20;
913                             $sImgT ag .= <<<E OF   913                             $sImgT ag .= <<<E OF
914   <a id="Adv BigImgFull Size" href ="{$sFileN ameFullSiz e}" target ="_blank"  onclick="w indow.open (this.href , 'picView ', 'width= {$iNewWidt h},height= {$iNewHeig ht}'); ret urn false; ">   914   <a id="Adv BigImgFull Size" href ="{$sFileN ameFullSiz e}" target ="_blank"  onclick="w indow.open (this.href , 'picView ', 'width= {$iNewWidt h},height= {$iNewHeig ht}'); ret urn false; ">
915       <img i d="AdvBigI mg" class= "photo" st yle="width :{$this ->  iBigThumb Size}px;he ight:{$thi s -> iBigT humbSize}p x;backgrou nd-image:u rl({$sFile Name});" s rc="{$sSpa cerName}"  alt="" />   915       <img i d="AdvBigI mg" class= "photo" st yle="width :{$this ->  iBigThumb Size}px;he ight:{$thi s -> iBigT humbSize}p x;backgrou nd-image:u rl({$sFile Name});" s rc="{$sSpa cerName}"  alt="" />
916   </a>   916   </a>
917   EOF;   917   EOF;
918                         }   918                         }
919     919  
920                    }   920                    }
921                    else  {   921                    else  {
922                         //"{$this  -> sCurrBr owsedFile} ?ShowAdver tisementID ={$iID}"   922                         //"{$this  -> sCurrBr owsedFile} ?ShowAdver tisementID ={$iID}"
923                         $sImgTag . = <<<EOF   923                         $sImgTag . = <<<EOF
924   <a href="{ $sGenUrl}" >   924   <a href="{ $sGenUrl}" >
925       <img s rc="{$sSpa cerName}"  style="wid th:{$this- >iThumbSiz e}px;heigh t:{$this-> iThumbSize }px; backg round-imag e: url({$s FileName}) ;" class=" photo1" al t="" />   925       <img s rc="{$sSpa cerName}"  style="wid th:{$this- >iThumbSiz e}px;heigh t:{$this-> iThumbSize }px; backg round-imag e: url({$s FileName}) ;" class=" photo1" al t="" />
926   </a>   926   </a>
927   EOF;   927   EOF;
928                    }   928                    }
929                }   929                }
930           }   930           }
931           if  ($sImgTag  == '') {   931           if  ($sImgTag  == '') {
932                $sNaname  = $site[' url'].'tem plates/tmp l_'.$tmpl. '/'.$this  -> sPicNot Avail;   932                $sNaname  = $site[' url'].'tem plates/tmp l_'.$tmpl. '/'.$this  -> sPicNot Avail;
933                if ((int )$iID == 0 ) {   933                if ((int )$iID == 0 ) {
934                    $sIm gTag .= "< img id=\"A dvBigImg\"  class=\"p hoto\" sty le=\"width :{$this->i BigThumbSi ze}px;heig ht:{$this- >iBigThumb Size}px;ba ckground-i mage:url({ $sNaname}) ;\" src=\" {$sSpacerN ame}\" alt =\"\" />";   934                    $sIm gTag .= "< img id=\"A dvBigImg\"  class=\"p hoto\" sty le=\"width :{$this->i BigThumbSi ze}px;heig ht:{$this- >iBigThumb Size}px;ba ckground-i mage:url({ $sNaname}) ;\" src=\" {$sSpacerN ame}\" alt =\"\" />";
935                }   935                }
936                else {   936                else {
937                    //"{ $this -> s CurrBrowse dFile}?Sho wAdvertise mentID={$i ID}"   937                    //"{ $this -> s CurrBrowse dFile}?Sho wAdvertise mentID={$i ID}"
938                    $sIm gTag .= << <EOF   938                    $sIm gTag .= << <EOF
939   <a href="{ $sGenUrl}" >   939   <a href="{ $sGenUrl}" >
940       <img s rc="{$sSpa cerName}"  style="wid th:{$this- >iThumbSiz e}px;heigh t:{$this-> iThumbSize }px; backg round-imag e: url({$s Naname});"  class="ph oto1" alt= "" />   940       <img s rc="{$sSpa cerName}"  style="wid th:{$this- >iThumbSiz e}px;heigh t:{$this-> iThumbSize }px; backg round-imag e: url({$s Naname});"  class="ph oto1" alt= "" />
941   </a>   941   </a>
942   EOF;   942   EOF;
943                }   943                }
944           }   944           }
945           re turn $sImg Tag;   945           re turn $sImg Tag;
946       }   946       }
947     947  
948       /**   948       /**
949        * Gen erate firs t paid pag e   949        * Gen erate firs t paid pag e
950        *   950        *
951        * @pa ram $id    ID of Adve rtisement   951        * @pa ram $id    ID of Adve rtisement
952        * @re turn HTML  presentati on of data   952        * @re turn HTML  presentati on of data
953        */   953        */
954       functi on ActionB uyAdvertis ement($iAd vertisemen tID) {   954       functi on ActionB uyAdvertis ement($iAd vertisemen tID) {
955           $i MemberID =  (int)$_CO OKIE['memb erID'];   955           $i MemberID =  (int)$_CO OKIE['memb erID'];
956           $s RetHtml =  ''; //_t(' _WARNING') ;   956           $s RetHtml =  ''; //_t(' _WARNING') ;
957           if  ($iMember ID > 0 /*A ND $iMembe rID != $na meRet['ID' ]*/ ) {   957           if  ($iMember ID > 0 /*A ND $iMembe rID != $na meRet['ID' ]*/ ) {
958                $aSqlRes Str = $thi s -> GetAd vertisemen tData( $iA dvertiseme ntID );   958                $aSqlRes Str = $thi s -> GetAd vertisemen tData( $iA dvertiseme ntID );
959                if ($aSq lResStr) {   959                if ($aSq lResStr) {
960                    $sCu stDetails  = ($aSqlRe sStr['Cust omFieldNam e1'] != NU LL AND $aS qlResStr[' CustomFiel dValue1']) ?"{$aSqlRe sStr['Unit ']} {$aSql ResStr['Cu stomFieldV alue1']}": '';   960                    $sCu stDetails  = ($aSqlRe sStr['Cust omFieldNam e1'] != NU LL AND $aS qlResStr[' CustomFiel dValue1']) ?"{$aSqlRe sStr['Unit ']} {$aSql ResStr['Cu stomFieldV alue1']}": '';
961                    $sCu stDetails  .= ($aSqlR esStr['Cus tomFieldNa me2'] != N ULL AND $a SqlResStr[ 'CustomFie ldValue2'] )?" - {$aS qlResStr[' Unit']} {$ aSqlResStr ['CustomFi eldValue2' ]}":'';   961                    $sCu stDetails  .= ($aSqlR esStr['Cus tomFieldNa me2'] != N ULL AND $a SqlResStr[ 'CustomFie ldValue2'] )?" - {$aS qlResStr[' Unit']} {$ aSqlResStr ['CustomFi eldValue2' ]}":'';
962                    $sBu yMsg1 = _t ('_CLS_BUY MSG_1');   962                    $sBu yMsg1 = _t ('_CLS_BUY MSG_1');
963                    $sBu yDet1 = _t ('_CLS_BUY _DET1');   963                    $sBu yDet1 = _t ('_CLS_BUY _DET1');
964                    $sCo ntinue = _ t('_Contin ue');   964                    $sCo ntinue = _ t('_Contin ue');
965     965  
966                    $sBo xTag = <<< EOF   966                    $sBo xTag = <<< EOF
967   <div>   967   <div>
968       <b>{$s BuyMsg1}</ b>   968       <b>{$s BuyMsg1}</ b>
969   </div><br/ >   969   </div><br/ >
970   <div>   970   <div>
971       <b>{$s BuyDet1}</ b>&nbsp;&n bsp;&nbsp; {$sCustDet ails}   971       <b>{$s BuyDet1}</ b>&nbsp;&n bsp;&nbsp; {$sCustDet ails}
972   </div><br/ >   972   </div><br/ >
973   <div>   973   <div>
974       <input  class="bu tton" type ="submit"  onclick="j avascript: this.value ='Wait...' ;this.disa bled=true; document.b id_form.su bmit();" v alue="{$sC ontinue}"  />   974       <input  class="bu tton" type ="submit"  onclick="j avascript: this.value ='Wait...' ;this.disa bled=true; document.b id_form.su bmit();" v alue="{$sC ontinue}"  />
975   </div>   975   </div>
976   EOF;   976   EOF;
977     977  
978                    $sRe tHtml .= D esignBoxCo ntent ( $a SqlResStr[ 'Subject'] , $sBoxTag , 1);   978                    $sRe tHtml .= D esignBoxCo ntent ( $a SqlResStr[ 'Subject'] , $sBoxTag , 1);
979                    $sRe tHtml .= < <<EOF   979                    $sRe tHtml .= < <<EOF
980   <form acti on="{$this ->sCurrBro wsedFile}"  name="bid _form" met hod="post" >   980   <form acti on="{$this ->sCurrBro wsedFile}"  name="bid _form" met hod="post" >
981       <input  type="hid den" name= "BuySendNo w" value=" BuySendNow " />   981       <input  type="hid den" name= "BuySendNo w" value=" BuySendNow " />
982       <input  type="hid den" name= "IDAdv" va lue="{$iAd vertisemen tID}" />   982       <input  type="hid den" name= "IDAdv" va lue="{$iAd vertisemen tID}" />
983       <input  type="hid den" name= "IDSeller"  value="{$ aSqlResStr ['IDProfil e']}" />   983       <input  type="hid den" name= "IDSeller"  value="{$ aSqlResStr ['IDProfil e']}" />
984   </form>   984   </form>
985   EOF;   985   EOF;
986                }   986                }
987           }   987           }
988           re turn $sRet Html;   988           re turn $sRet Html;
989       }   989       }
990     990  
991       /**   991       /**
992        * Gen erate seco nd paid pa ge   992        * Gen erate seco nd paid pa ge
993        *   993        *
994        * @pa ram $id    ID of Adve rtisement   994        * @pa ram $id    ID of Adve rtisement
995        * @re turn HTML  presentati on of data   995        * @re turn HTML  presentati on of data
996        */   996        */
997       functi on ActionB uySendMail Advertisem ent($iAdve rtisementI D) {   997       functi on ActionB uySendMail Advertisem ent($iAdve rtisementI D) {
998           gl obal $site ;   998           gl obal $site ;
999           $i SellerId =  (int)$_RE QUEST['IDS eller'];   999           $i SellerId =  (int)$_RE QUEST['IDS eller'];
1000           $i MemberID =  (int)$_CO OKIE['memb erID'];   1000           $i MemberID =  (int)$_CO OKIE['memb erID'];
1001           $s RetHtml =  _t('_WARNI NG');   1001           $s RetHtml =  _t('_WARNI NG');
1002           if  ($iMember ID > 0 /*A ND $iMembe rID != $na meRet['ID' ]*/ ) {   1002           if  ($iMember ID > 0 /*A ND $iMembe rID != $na meRet['ID' ]*/ ) {
1003                $aSqlRes Str = $thi s -> GetAd vertisemen tData($iAd vertisemen tID);   1003                $aSqlRes Str = $thi s -> GetAd vertisemen tData($iAd vertisemen tID);
1004                $aSqlSel lerRes = $ this -> Ge tProfileDa ta($iSelle rId);   1004                $aSqlSel lerRes = $ this -> Ge tProfileDa ta($iSelle rId);
1005                $aSqlMem berRes = $ this -> Ge tProfileDa ta($iMembe rID);   1005                $aSqlMem berRes = $ this -> Ge tProfileDa ta($iMembe rID);
1006                if ($aSq lResStr) {   1006                if ($aSq lResStr) {
1007                    $sCu stDetails  = ($aSqlRe sStr['Cust omFieldNam e1'] != NU LL AND $aS qlResStr[' CustomFiel dValue1']) ?"{$aSqlRe sStr['Unit ']} {$aSql ResStr['Cu stomFieldV alue1']}": '';   1007                    $sCu stDetails  = ($aSqlRe sStr['Cust omFieldNam e1'] != NU LL AND $aS qlResStr[' CustomFiel dValue1']) ?"{$aSqlRe sStr['Unit ']} {$aSql ResStr['Cu stomFieldV alue1']}": '';
1008                    $sCu stDetails  .= ($aSqlR esStr['Cus tomFieldNa me2'] != N ULL AND $a SqlResStr[ 'CustomFie ldValue2'] )?" - {$aS qlResStr[' Unit']} {$ aSqlResStr ['CustomFi eldValue2' ]}":'';   1008                    $sCu stDetails  .= ($aSqlR esStr['Cus tomFieldNa me2'] != N ULL AND $a SqlResStr[ 'CustomFie ldValue2'] )?" - {$aS qlResStr[' Unit']} {$ aSqlResStr ['CustomFi eldValue2' ]}":'';
1009     1009  
1010                    $sCo pyright =  _t('_copyr ight', 200 7);   1010                    $sCo pyright =  _t('_copyr ight', 200 7);
1011                    $sBo ttom = _t( '_bottom_t ext', 2007 );   1011                    $sBo ttom = _t( '_bottom_t ext', 2007 );
1012                    $sPo wDol = _t( '_powered_ by_Dolphin ');   1012                    $sPo wDol = _t( '_powered_ by_Dolphin ');
1013                    $sBu yMsg2 = _t ('_CLS_BUY MSG_2');   1013                    $sBu yMsg2 = _t ('_CLS_BUY MSG_2');
1014                    $sBu yDet1 = _t ('_CLS_BUY _DET1');   1014                    $sBu yDet1 = _t ('_CLS_BUY _DET1');
1015                    $sRe turnBackC  = _t('_Ret urn Back') ;   1015                    $sRe turnBackC  = _t('_Ret urn Back') ;
1016     1016  
1017                    // S end email  notificati on   1017                    // S end email  notificati on
1018                    $sMe ssageB  =  getParam(  "t_BuyNow"  );   1018                    $sMe ssageB  =  getParam(  "t_BuyNow"  );
1019                    $sMe ssageS  =  getParam(  "t_BuyNowS " );   1019                    $sMe ssageS  =  getParam(  "t_BuyNowS " );
1020                    $sSu bject   =  getParam(' t_BuyNow_s ubject');   1020                    $sSu bject   =  getParam(' t_BuyNow_s ubject');
1021                    $sSu bjectS  =  getParam(' t_BuyNowS_ subject');   1021                    $sSu bjectS  =  getParam(' t_BuyNowS_ subject');
1022     1022  
1023                    $aPl us = array ();   1023                    $aPl us = array ();
1024                    $aPl us['Subjec t'] = $aSq lResStr['S ubject'];   1024                    $aPl us['Subjec t'] = $aSq lResStr['S ubject'];
1025                    $aPl us['NickNa me'] = $aS qlSellerRe s['NickNam e'];   1025                    $aPl us['NickNa me'] = $aS qlSellerRe s['NickNam e'];
1026                    $aPl us['EmailS '] = $aSql SellerRes[ 'Email'];   1026                    $aPl us['EmailS '] = $aSql SellerRes[ 'Email'];
1027                    $aPl us['NickNa meB'] = $a SqlMemberR es['NickNa me'];   1027                    $aPl us['NickNa meB'] = $a SqlMemberR es['NickNa me'];
1028                    $aPl us['EmailB '] = $aSql MemberRes[ 'Email'];   1028                    $aPl us['EmailB '] = $aSql MemberRes[ 'Email'];
1029                    $aPl us['sCustD etails'] =  $sCustDet ails;   1029                    $aPl us['sCustD etails'] =  $sCustDet ails;
1030     1030  
1031                    $sGe nUrl = $th is->genUrl ($iAdverti sementID,  $aSqlResSt r['EntryUr i']);   1031                    $sGe nUrl = $th is->genUrl ($iAdverti sementID,  $aSqlResSt r['EntryUr i']);
1032                    $aPl us['ShowAd vLnk'] = $ sGenUrl; / /"{$site[' url']}clas sifieds.ph p?ShowAdve rtisementI D={$iAdver tisementID }";   1032                    $aPl us['ShowAd vLnk'] = $ sGenUrl; / /"{$site[' url']}clas sifieds.ph p?ShowAdve rtisementI D={$iAdver tisementID }";
1033     1033  
1034                    $aPl us['sPowDo l'] = $sPo wDol;   1034                    $aPl us['sPowDo l'] = $sPo wDol;
1035                    $aPl us['site[\ 'email\']' ] = $site[ 'email'];   1035                    $aPl us['site[\ 'email\']' ] = $site[ 'email'];
1036                    $aPl us['sCopyr ight'] = $ sCopyright ;   1036                    $aPl us['sCopyr ight'] = $ sCopyright ;
1037                    $aPl us['sBotto m'] = $sBo ttom;   1037                    $aPl us['sBotto m'] = $sBo ttom;
1038     1038  
1039                    $sRe tHtml = '' ;   1039                    $sRe tHtml = '' ;
1040                    $aPl us['Who']  = 'buyer';   1040                    $aPl us['Who']  = 'buyer';
1041                    $aPl us['String 1'] = 'You  have purc hased an i tem';   1041                    $aPl us['String 1'] = 'You  have purc hased an i tem';
1042                    if ( sendMail(  $aSqlMembe rRes['Emai l'], $sSub ject, $sMe ssageB, $a SqlSellerR es['ID'],  $aPlus, 'h tml')) {   1042                    if ( sendMail(  $aSqlMembe rRes['Emai l'], $sSub ject, $sMe ssageB, $a SqlSellerR es['ID'],  $aPlus, 'h tml')) {
1043                         //$sRetHtm l .= MsgBo x(_t('_Ema il was suc cessfully  sent'));   1043                         //$sRetHtm l .= MsgBo x(_t('_Ema il was suc cessfully  sent'));
1044                    }   1044                    }
1045                    $aPl us['Who']  = 'seller' ;   1045                    $aPl us['Who']  = 'seller' ;
1046                    $aPl us['String 1'] = 'Som eone wants  to purcha se an item  that you  have offer ed for sal e';   1046                    $aPl us['String 1'] = 'Som eone wants  to purcha se an item  that you  have offer ed for sal e';
1047                    if ( sendMail(  $aSqlSelle rRes['Emai l'], $sSub jectS, $sM essageS, $ aSqlSeller Res['ID'],  $aPlus, ' html')) {   1047                    if ( sendMail(  $aSqlSelle rRes['Emai l'], $sSub jectS, $sM essageS, $ aSqlSeller Res['ID'],  $aPlus, ' html')) {
1048                         $sRetHtml  .= MsgBox( _t('_Email  was succe ssfully se nt'));   1048                         $sRetHtml  .= MsgBox( _t('_Email  was succe ssfully se nt'));
1049                    }   1049                    }
1050                    //"{ $this->sCu rrBrowsedF ile}?ShowA dvertiseme ntID={$iAd vertisemen tID}"   1050                    //"{ $this->sCu rrBrowsedF ile}?ShowA dvertiseme ntID={$iAd vertisemen tID}"
1051                    $sBo xContent =  <<<EOF   1051                    $sBo xContent =  <<<EOF
1052   <div>   1052   <div>
1053       <b>{$s BuyMsg2}</ b>   1053       <b>{$s BuyMsg2}</ b>
1054   </div><br/ >   1054   </div><br/ >
1055   <div>   1055   <div>
1056       <b>{$s BuyDet1}</ b>&nbsp;&n bsp;&nbsp; {$sCustDet ails}   1056       <b>{$s BuyDet1}</ b>&nbsp;&n bsp;&nbsp; {$sCustDet ails}
1057   </div><br/ >   1057   </div><br/ >
1058   <div>   1058   <div>
1059       <a hre f="{$sGenU rl}">{$sRe turnBackC} </a>   1059       <a hre f="{$sGenU rl}">{$sRe turnBackC} </a>
1060   </div>   1060   </div>
1061   EOF;   1061   EOF;
1062     1062  
1063                    $sRe tHtml .= D esignBoxCo ntent ( $s BuyMsg2, $ sBoxConten t, 1);   1063                    $sRe tHtml .= D esignBoxCo ntent ( $s BuyMsg2, $ sBoxConten t, 1);
1064                }   1064                }
1065           }   1065           }
1066           re turn $sRet Html;   1066           re turn $sRet Html;
1067       }   1067       }
1068     1068  
1069       /**   1069       /**
1070        * Gen erate pres entation A dvertiseme nt code wi th images  and other   1070        * Gen erate pres entation A dvertiseme nt code wi th images  and other
1071        *   1071        *
1072        * @pa ram $id    ID of Adve rtisement   1072        * @pa ram $id    ID of Adve rtisement
1073        * @re turn HTML  presentati on of data   1073        * @re turn HTML  presentati on of data
1074        */   1074        */
1075       functi on ActionP rintAdvert isement($i d) {   1075       functi on ActionP rintAdvert isement($i d) {
1076           gl obal $site ;   1076           gl obal $site ;
1077           gl obal $aPre Values;   1077           gl obal $aPre Values;
1078           gl obal $logg ed;   1078           gl obal $logg ed;
1079              1079           
1080           $i Advertisem entID = (i nt)$id;   1080           $i Advertisem entID = (i nt)$id;
1081           $s RetHtml =  '';   1081           $s RetHtml =  '';
1082     1082  
1083           $a SqlResStr  = $this ->  GetAdvert isementDat a($iAdvert isementID) ;   1083           $a SqlResStr  = $this ->  GetAdvert isementDat a($iAdvert isementID) ;
1084           if  ($aSqlRes Str) {   1084           if  ($aSqlRes Str) {
1085                $sAdminL ocalAreaC  = _t('_Adm inArea');   1085                $sAdminL ocalAreaC  = _t('_Adm inArea');
1086                $sBigImg  = $this - > getBigIm ageCode($a SqlResStr[ 'Media']);   1086                $sBigImg  = $this - > getBigIm ageCode($a SqlResStr[ 'Media']);
1087                $bUseNew Feature =  getParam(' ads_galler y_feature' ) == 'on'  ? true : f alse;   1087                $bUseNew Feature =  getParam(' ads_galler y_feature' ) == 'on'  ? true : f alse;
1088                $sImg =  $this -> g etImageCod e($aSqlRes Str['Media '], false,  $bUseNewF eature);   1088                $sImg =  $this -> g etImageCod e($aSqlRes Str['Media '], false,  $bUseNewF eature);
1089     1089  
1090                $aNameRe t = $this  -> GetProf ileData($a SqlResStr[ 'IDProfile ']);   1090                $aNameRe t = $this  -> GetProf ileData($a SqlResStr[ 'IDProfile ']);
1091                $sCountr yName = ($ aNameRet[' Country']= ="")?$sAdm inLocalAre aC:_t($aPr eValues['C ountry'][  $aNameRet[ 'Country']  ]['LKey']  );   1091                $sCountr yName = ($ aNameRet[' Country']= ="")?$sAdm inLocalAre aC:_t($aPr eValues['C ountry'][  $aNameRet[ 'Country']  ]['LKey']  );
1092                $sCountr yPic = ($a NameRet['C ountry']== '')?'':' < img alt="' .$aNameRet ['Country' ].'" src=" '.($site[' flags'].st rtolower($ aNameRet[' Country']) ).'.gif"/> ';   1092                $sCountr yPic = ($a NameRet['C ountry']== '')?'':' < img alt="' .$aNameRet ['Country' ].'" src=" '.($site[' flags'].st rtolower($ aNameRet[' Country']) ).'.gif"/> ';
1093     1093  
1094                /*if( $l ogged['mem ber'] )   1094                /*if( $l ogged['mem ber'] )
1095                    $sVi sible = 'm emb';   1095                    $sVi sible = 'm emb';
1096                else   1096                else
1097                    $sVi sible = 'n on';   1097                    $sVi sible = 'n on';
1098                $sSqlCol s = "   1098                $sSqlCol s = "
1099                    SELE CT *    1099                    SELE CT * 
1100                    FROM  `ClsAdvCo mpose`    1100                    FROM  `ClsAdvCo mpose` 
1101                    WHER E   1101                    WHER E
1102                         `Column` ! = 0 AND   1102                         `Column` ! = 0 AND
1103                         FIND_IN_SE T( '{$sVis ible}', `V isible` )   1103                         FIND_IN_SE T( '{$sVis ible}', `V isible` )
1104                    ORDE R BY `Colu mn` , `Ord er`   1104                    ORDE R BY `Colu mn` , `Ord er`
1105                ";   1105                ";
1106     1106  
1107                $sqlCapt Res = db_r es($sSqlCo ls);   1107                $sqlCapt Res = db_r es($sSqlCo ls);
1108                $aCaptio ns = array ();   1108                $aCaptio ns = array ();
1109                while($a CapSelect  = mysql_fe tch_assoc( $sqlCaptRe s)) {   1109                while($a CapSelect  = mysql_fe tch_assoc( $sqlCaptRe s)) {
1110                    $aCa ptions[$aC apSelect[' Func']] =  _t( $aCapS elect['Cap tion'] );   1110                    $aCa ptions[$aC apSelect[' Func']] =  _t( $aCapS elect['Cap tion'] );
1111                }*/   1111                }*/
1112     1112  
1113                $sPosted ByC = _t(' _Posted by ');   1113                $sPosted ByC = _t(' _Posted by ');
1114                $sAdminC  = _t('_Ad min');   1114                $sAdminC  = _t('_Ad min');
1115                $sPhoneC  = _t('_Ph one');   1115                $sPhoneC  = _t('_Ph one');
1116                $sICQC =  _t('_ICQ' );   1116                $sICQC =  _t('_ICQ' );
1117                $sDetail sC = _t('_ Details');   1117                $sDetail sC = _t('_ Details');
1118                $sReplyC  = _t('_Re ply');   1118                $sReplyC  = _t('_Re ply');
1119                $sSubjec tC = _t('_ Subject');   1119                $sSubjec tC = _t('_ Subject');
1120                $sDateC  = _t('_Dat e');   1120                $sDateC  = _t('_Dat e');
1121                $sLocati onC = _t(' _Location' );   1121                $sLocati onC = _t(' _Location' );
1122                $sDescri ptionC = _ t('_Descri ption');   1122                $sDescri ptionC = _ t('_Descri ption');
1123                $sUserOt herListC =  _t('_User s other li sting');   1123                $sUserOt herListC =  _t('_User s other li sting');
1124                $sAction sC = _t('_ Actions');   1124                $sAction sC = _t('_ Actions');
1125                $sPhotos C = _t('_P hotos');   1125                $sPhotos C = _t('_P hotos');
1126                $sEditC  = _t('_Edi t');   1126                $sEditC  = _t('_Edi t');
1127                $sAdvert isementC =  _t('_Adve rtisement' );   1127                $sAdvert isementC =  _t('_Adve rtisement' );
1128                $sTagsC  = _t('_Tag s');   1128                $sTagsC  = _t('_Tag s');
1129                $sBuyNow C = _t('_B uy Now');   1129                $sBuyNow C = _t('_B uy Now');
1130                $sDelete C = _t('_D elete');   1130                $sDelete C = _t('_D elete');
1131                $sSureC  = _t("_Are  you sure" );   1131                $sSureC  = _t("_Are  you sure" );
1132                $sActiva teC = _t(' _Activate' );   1132                $sActiva teC = _t(' _Activate' );
1133     1133  
1134                $sPosted By = '';   1134                $sPosted By = '';
1135                if (! $a NameRet['N ickName'])  {   1135                if (! $a NameRet['N ickName'])  {
1136                    $sPo stedBy .=  '<div clas s="cls_res _info">'.$ sPostedByC .': '.$sAd minC.'</di v>';   1136                    $sPo stedBy .=  '<div clas s="cls_res _info">'.$ sPostedByC .': '.$sAd minC.'</di v>';
1137                }   1137                }
1138                else {   1138                else {
1139                    $sPo stedBy .=  '<div clas s="cls_res _info">';   1139                    $sPo stedBy .=  '<div clas s="cls_res _info">';
1140                    $sPo stedBy .=  $sPostedBy C.': <span  style="co lor:#33333 3;"><a hre f="'.getPr ofileLink( $aNameRet[ 'ID']).'"> '.$aNameRe t['NickNam e'].'</a>< /span>';   1140                    $sPo stedBy .=  $sPostedBy C.': <span  style="co lor:#33333 3;"><a hre f="'.getPr ofileLink( $aNameRet[ 'ID']).'"> '.$aNameRe t['NickNam e'].'</a>< /span>';
1141                    $sPo stedBy .=  '</div>';   1141                    $sPo stedBy .=  '</div>';
1142                    if ( $aNameRet[ 'Phone'] ! = "") {   1142                    if ( $aNameRet[ 'Phone'] ! = "") {
1143                         $sPostedBy  .= '<div  class="cls _res_info" >';   1143                         $sPostedBy  .= '<div  class="cls _res_info" >';
1144                         $sPostedBy  .= $sPhon eC.": <div  class=\"c lr3\">{$aN ameRet['Ph one']}</di v>";   1144                         $sPostedBy  .= $sPhon eC.": <div  class=\"c lr3\">{$aN ameRet['Ph one']}</di v>";
1145                         $sPostedBy  .= '</div >';   1145                         $sPostedBy  .= '</div >';
1146                    }   1146                    }
1147                    if ( $aNameRet[ 'IcqUIN']  != "") {   1147                    if ( $aNameRet[ 'IcqUIN']  != "") {
1148                         $sPostedBy  .= '<div  class="cls _res_info" >';   1148                         $sPostedBy  .= '<div  class="cls _res_info" >';
1149                         $sPostedBy  .= $sICQC ."#<div cl ass=\"clr3 \">{$aName Ret['IcqUI N']}</div> ";   1149                         $sPostedBy  .= $sICQC ."#<div cl ass=\"clr3 \">{$aName Ret['IcqUI N']}</div> ";
1150                         $sPostedBy  .= '</div >';   1150                         $sPostedBy  .= '</div >';
1151                    }   1151                    }
1152                }   1152                }
1153                $sTimeAg o = _forma t_when($aS qlResStr[' sec']);   1153                $sTimeAg o = _forma t_when($aS qlResStr[' sec']);
1154     1154  
1155                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] || $aSql ResStr['Cu stomFieldN ame2']) ?  "{$sDetail sC}: " : ' ';   1155                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] || $aSql ResStr['Cu stomFieldN ame2']) ?  "{$sDetail sC}: " : ' ';
1156                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] && $aSql ResStr['Cu stomFieldV alue1'])?" <div class =\"clr3\"> {$aSqlResS tr['Unit'] } {$aSqlRe sStr['Cust omFieldVal ue1']}</di v>":'';   1156                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] && $aSql ResStr['Cu stomFieldV alue1'])?" <div class =\"clr3\"> {$aSqlResS tr['Unit'] } {$aSqlRe sStr['Cust omFieldVal ue1']}</di v>":'';
1157                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] && $aSql ResStr['Cu stomFieldN ame2'] &&  $aSqlResSt r['CustomF ieldValue1 '] && $aSq lResStr['C ustomField Value2'])  ? " - " :  '';   1157                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName1' ] && $aSql ResStr['Cu stomFieldN ame2'] &&  $aSqlResSt r['CustomF ieldValue1 '] && $aSq lResStr['C ustomField Value2'])  ? " - " :  '';
1158                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName2' ] && $aSql ResStr['Cu stomFieldV alue2'])?" <div class =\"clr3\"> {$aSqlResS tr['Unit'] } {$aSqlRe sStr['Cust omFieldVal ue2']}</di v>":'';   1158                $sCustDe tails .= ( $aSqlResSt r['CustomF ieldName2' ] && $aSql ResStr['Cu stomFieldV alue2'])?" <div class =\"clr3\"> {$aSqlResS tr['Unit'] } {$aSqlRe sStr['Cust omFieldVal ue2']}</di v>":'';
1159     1159  
1160                $sTags . = $sTagsC. ': <div cl ass="clr3" >';   1160                $sTags . = $sTagsC. ': <div cl ass="clr3" >';
1161                $aTags =  array();   1161                $aTags =  array();
1162                $aTagsLi nks = arra y();   1162                $aTagsLi nks = arra y();
1163                $aTags =  explode(" ,", $aSqlR esStr['Tag s']);   1163                $aTags =  explode(" ,", $aSqlR esStr['Tag s']);
1164                foreach  ( $aTags a s $sTag )  {   1164                foreach  ( $aTags a s $sTag )  {
1165                    $sSu bLink = ($ this->bUse FriendlyLi nks) ? "ad s/tag/" :  "classifie ds_tags.ph p?tag=";   1165                    $sSu bLink = ($ this->bUse FriendlyLi nks) ? "ad s/tag/" :  "classifie ds_tags.ph p?tag=";
1166                    $aTa gsLinks[]  = '<a href ="'."{$sit e['url']}{ $sSubLink} {$sTag}".' ">'.$sTag. '</a>';   1166                    $aTa gsLinks[]  = '<a href ="'."{$sit e['url']}{ $sSubLink} {$sTag}".' ">'.$sTag. '</a>';
1167                }   1167                }
1168                $sTags . = implode( ", ", $aTa gsLinks);   1168                $sTags . = implode( ", ", $aTa gsLinks);
1169                $sTags . = '</div>' ;   1169                $sTags . = '</div>' ;
1170     1170  
1171                $sMember Actions =  '';   1171                $sMember Actions =  '';
1172                $iMember ID = ($log ged['membe r']) ? (in t)$_COOKIE ['memberID '] : -1;   1172                $iMember ID = ($log ged['membe r']) ? (in t)$_COOKIE ['memberID '] : -1;
1173                //$iMemb erID = (in t)$_COOKIE ['memberID '];   1173                //$iMemb erID = (in t)$_COOKIE ['memberID '];
1174                if ($iMe mberID > 0  AND $iMem berID != $ aNameRet[' ID']) {//p rint Send  PM button  and other  actions   1174                if ($iMe mberID > 0  AND $iMem berID != $ aNameRet[' ID']) {//p rint Send  PM button  and other  actions
1175                    $bBn p = getPar am('enable _paid_syst em');   1175                    $bBn p = getPar am('enable _paid_syst em');
1176     1176  
1177                    $sBu yNow = '';   1177                    $sBu yNow = '';
1178                    if ( $bBnp=='on ') {   1178                    if ( $bBnp=='on ') {
1179                         $sBuyNow =  <<<EOF   1179                         $sBuyNow =  <<<EOF
1180   <img src=" {$site['ic ons']}cool .gif" alt= "Buy" titl e="Buy" cl ass="marg_ icon" />   1180   <img src=" {$site['ic ons']}cool .gif" alt= "Buy" titl e="Buy" cl ass="marg_ icon" />
1181   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['B uyNowForm' ].submit() ; return f alse;">   1181   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['B uyNowForm' ].submit() ; return f alse;">
1182       {$sBuy NowC}   1182       {$sBuy NowC}
1183   </a>   1183   </a>
1184   <form acti on="{$this  -> sCurrB rowsedFile }" name="B uyNowForm"  method="p ost">   1184   <form acti on="{$this  -> sCurrB rowsedFile }" name="B uyNowForm"  method="p ost">
1185       <input  type="hid den" name= "BuyNow" v alue="BuyN ow" />   1185       <input  type="hid den" name= "BuyNow" v alue="BuyN ow" />
1186       <input  type="hid den" name= "IDAdv" va lue="{$id} " />   1186       <input  type="hid den" name= "IDAdv" va lue="{$id} " />
1187       <input  type="hid den" name= "IDSeller"  value="{$ aSqlResStr ['IDProfil e']}" />   1187       <input  type="hid den" name= "IDSeller"  value="{$ aSqlResStr ['IDProfil e']}" />
1188   </form>   1188   </form>
1189   <br/>   1189   <br/>
1190   EOF;   1190   EOF;
1191                    }   1191                    }
1192                    $sMe mberAction s .= <<<EO F   1192                    $sMe mberAction s .= <<<EO F
1193   {$sBuyNow}   1193   {$sBuyNow}
1194   <img src=" {$site['ic ons']}acti on_send.gi f" alt="Po st PM" tit le="Post P M" class=" marg_icon"  />   1194   <img src=" {$site['ic ons']}acti on_send.gi f" alt="Po st PM" tit le="Post P M" class=" marg_icon"  />
1195   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['p ost_pm'].s ubmit(); r eturn fals e;">   1195   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['p ost_pm'].s ubmit(); r eturn fals e;">
1196   {$sReplyC}   1196   {$sReplyC}
1197   </a>   1197   </a>
1198   <form acti on="{$site ['url']}co mpose.php"  name="pos t_pm" id=" post_pm" m ethod="pos t">   1198   <form acti on="{$site ['url']}co mpose.php"  name="pos t_pm" id=" post_pm" m ethod="pos t">
1199       <input  type="hid den" name= "ID" value ="{$aSqlRe sStr['IDPr ofile']}"  />   1199       <input  type="hid den" name= "ID" value ="{$aSqlRe sStr['IDPr ofile']}"  />
1200       <input  type="hid den" name= "subject"  value="{$a SqlResStr[ 'Subject'] }" />   1200       <input  type="hid den" name= "subject"  value="{$a SqlResStr[ 'Subject'] }" />
1201       <input  type="hid den" value ="{$sReply C}" />   1201       <input  type="hid den" value ="{$sReply C}" />
1202   </form>   1202   </form>
1203   EOF;   1203   EOF;
1204                }   1204                }
1205                elseif ( $iMemberID  == $aName Ret['ID']  AND $this  -> bAdminM ode==FALSE ) {   1205                elseif ( $iMemberID  == $aName Ret['ID']  AND $this  -> bAdminM ode==FALSE ) {
1206                    $sMe mberAction s .= '<div  class="cl s_result_r ow">';   1206                    $sMe mberAction s .= '<div  class="cl s_result_r ow">';
1207                    $sMe mberAction s .= $this ->Centered ActionsBlo ck('<img s rc="'.$sit e['icons'] .'descript ion_edit.p ng" alt="' .$sEditC.   1207                    $sMe mberAction s .= $this ->Centered ActionsBlo ck('<img s rc="'.$sit e['icons'] .'descript ion_edit.p ng" alt="' .$sEditC.
1208                    '" t itle="'.$s EditC.'" c lass="marg _icon" />' , '<a clas s="actions " href="'. $this->sCu rrBrowsedF ile.   1208                    '" t itle="'.$s EditC.'" c lass="marg _icon" />' , '<a clas s="actions " href="'. $this->sCu rrBrowsedF ile.
1209                    '" o nclick="Up dateField( \'EditAdve rtisementI D\','.$iAd vertisemen tID.   1209                    '" o nclick="Up dateField( \'EditAdve rtisementI D\','.$iAd vertisemen tID.
1210                    ');  document.f orms.comma nd_edit_ad vertisemen t.submit() ; return f alse;">'.$ sEditC.'</ a>');   1210                    ');  document.f orms.comma nd_edit_ad vertisemen t.submit() ; return f alse;">'.$ sEditC.'</ a>');
1211                    $sMe mberAction s .= '</di v>';   1211                    $sMe mberAction s .= '</di v>';
1212                    $sMe mberAction s .= '<div  class="cl s_result_r ow">';   1212                    $sMe mberAction s .= '<div  class="cl s_result_r ow">';
1213                    $sMe mberAction s .= $this ->Centered ActionsBlo ck('<img s rc="'.$sit e['icons'] .'action_b lock.gif"  alt="'.$sD eleteC.   1213                    $sMe mberAction s .= $this ->Centered ActionsBlo ck('<img s rc="'.$sit e['icons'] .'action_b lock.gif"  alt="'.$sD eleteC.
1214                    '" t itle="'.$s DeleteC.'"  class="ma rg_icon" / >', '<a cl ass="actio ns" href=" '.$this->s CurrBrowse dFile.   1214                    '" t itle="'.$s DeleteC.'"  class="ma rg_icon" / >', '<a cl ass="actio ns" href=" '.$this->s CurrBrowse dFile.
1215                    '" o nclick="if  (confirm( \''.$sSure C.'\')) {  UpdateFiel d(\'Delete Advertisem entID\','. $iAdvertis ementID.') ;document. forms.comm and_delete _advertise ment.submi t(); } ret urn false; ">'.$sDele teC.'</a>' );   1215                    '" o nclick="if  (confirm( \''.$sSure C.'\')) {  UpdateFiel d(\'Delete Advertisem entID\','. $iAdvertis ementID.') ;document. forms.comm and_delete _advertise ment.submi t(); } ret urn false; ">'.$sDele teC.'</a>' );
1216                    $sMe mberAction s .= '</di v>';   1216                    $sMe mberAction s .= '</di v>';
1217                }   1217                }
1218     1218  
1219                $sAdminP art = '';   1219                $sAdminP art = '';
1220                if ($thi s -> bAdmi nMode) {   1220                if ($thi s -> bAdmi nMode) {
1221     1221  
1222                    $sAc tivateAbil  = ($aSqlR esStr['Sta tus']=='ac tive') ? ' ' : <<<EOF   1222                    $sAc tivateAbil  = ($aSqlR esStr['Sta tus']=='ac tive') ? ' ' : <<<EOF
1223   <div class ="ar">   1223   <div class ="ar">
1224       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">   1224       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">
1225       <img s rc="{$site ['icons']} online.gif " style="p osition:st atic;" />   1225       <img s rc="{$site ['icons']} online.gif " style="p osition:st atic;" />
1226       </span >   1226       </span >
1227       <span>   1227       <span>
1228       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' ActivateAd vertisemen tID',{$iAd vertisemen tID});docu ment.forms .command_a ctivate_ad vertisemen t.submit() ; return f alse;">   1228       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' ActivateAd vertisemen tID',{$iAd vertisemen tID});docu ment.forms .command_a ctivate_ad vertisemen t.submit() ; return f alse;">
1229       {$sAct ivateC}</a >   1229       {$sAct ivateC}</a >
1230       </span >   1230       </span >
1231   </div>   1231   </div>
1232   EOF;   1232   EOF;
1233     1233  
1234                    $sAd minPart .=  <<<EOF   1234                    $sAd minPart .=  <<<EOF
1235   <div class ="clear_bo th"></div>   1235   <div class ="clear_bo th"></div>
1236   {$sActivat eAbil}   1236   {$sActivat eAbil}
1237   <div class ="ar">   1237   <div class ="ar">
1238       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">   1238       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">
1239       <img s rc="{$site ['icons']} delete.png " style="p osition:st atic;" />   1239       <img s rc="{$site ['icons']} delete.png " style="p osition:st atic;" />
1240       </span >   1240       </span >
1241       <span>   1241       <span>
1242       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="if  (confirm(' {$sSureC}' )) { Updat eField('De leteAdvert isementID' ,{$iAdvert isementID} );document .forms.com mand_delet e_advertis ement.subm it(); } re turn false ;">   1242       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="if  (confirm(' {$sSureC}' )) { Updat eField('De leteAdvert isementID' ,{$iAdvert isementID} );document .forms.com mand_delet e_advertis ement.subm it(); } re turn false ;">
1243       {$sDel eteC}</a>   1243       {$sDel eteC}</a>
1244       </span >   1244       </span >
1245   </div>   1245   </div>
1246   <div class ="ar">   1246   <div class ="ar">
1247       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">   1247       <span  style="ver tical-alig n: middle; margin-rig ht:5px;">
1248       <img s rc="{$site ['icons']} _logout.jp g" style=" position:s tatic;" />   1248       <img s rc="{$site ['icons']} _logout.jp g" style=" position:s tatic;" />
1249       </span >   1249       </span >
1250       <span>   1250       <span>
1251       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' EditAdvert isementID' ,{$iAdvert isementID} ); documen t.forms.co mmand_edit _advertise ment.submi t(); retur n false;">   1251       <a cla ss="action s" href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' EditAdvert isementID' ,{$iAdvert isementID} ); documen t.forms.co mmand_edit _advertise ment.submi t(); retur n false;">
1252       {$sEdi tC}</a>   1252       {$sEdi tC}</a>
1253       </span >   1253       </span >
1254   </div>   1254   </div>
1255   <div class ="clear_bo th"></div>   1255   <div class ="clear_bo th"></div>
1256   EOF;   1256   EOF;
1257                }   1257                }
1258     1258  
1259                $sPictur eSectConte nt = '';   1259                $sPictur eSectConte nt = '';
1260                if ($bUs eNewFeatur e==true) {   1260                if ($bUs eNewFeatur e==true) {
1261                    //// /Gall Ench   1261                    //// /Gall Ench
1262                    $sGa llEnchImg  = $this->g etImageCod eSimple($a SqlResStr[ 'Media']);   1262                    $sGa llEnchImg  = $this->g etImageCod eSimple($a SqlResStr[ 'Media']);
1263     1263  
1264                    $sPi ctureSectC ontent = < <<EOF   1264                    $sPi ctureSectC ontent = < <<EOF
1265   <script ty pe="text/j avascript"  src="{$si te['url']} inc/js/jqu ery.dolPro moT.js"></ script>   1265   <script ty pe="text/j avascript"  src="{$si te['url']} inc/js/jqu ery.dolPro moT.js"></ script>
1266   <script ty pe="text/j avascript" >   1266   <script ty pe="text/j avascript" >
1267       $(docu ment).read y( functio n() {   1267       $(docu ment).read y( functio n() {
1268           $(  '#indexPh oto' ).dol Promo( 300 0, 1 );   1268           $(  '#indexPh oto' ).dol Promo( 300 0, 1 );
1269       } );   1269       } );
1270   </script>   1270   </script>
1271   <script ty pe="text/j avascript" >   1271   <script ty pe="text/j avascript" >
1272       if (wi ndow.attac hEvent)   1272       if (wi ndow.attac hEvent)
1273           wi ndow.attac hEvent( "o nload", on loadPhotos  );   1273           wi ndow.attac hEvent( "o nload", on loadPhotos  );
1274       else   1274       else
1275           wi ndow.addEv entListene r( "load",  onloadPho tos, false );   1275           wi ndow.addEv entListene r( "load",  onloadPho tos, false );
1276     1276  
1277       functi on onloadP hotos()   1277       functi on onloadP hotos()
1278       {   1278       {
1279           hi deScroll() ;   1279           hi deScroll() ;
1280       }   1280       }
1281     1281  
1282       //hide  scrollers  if needed   1282       //hide  scrollers  if needed
1283       functi on hideScr oll()   1283       functi on hideScr oll()
1284       {   1284       {
1285           b  = document .getElemen tById( "aI conBlock"  );   1285           b  = document .getElemen tById( "aI conBlock"  );
1286           s  = document .getElemen tById( "aS crollCont"  );   1286           s  = document .getElemen tById( "aS crollCont"  );
1287              1287           
1288           if ( !b || !s  ) {   1288           if ( !b || !s  ) {
1289                aibc = d ocument.ge tElementBy Id( "aIcon BlockCont"  );   1289                aibc = d ocument.ge tElementBy Id( "aIcon BlockCont"  );
1290                aibc.sty le.display  = "none";   1290                aibc.sty le.display  = "none";
1291                s.style. display =  "none";   1291                s.style. display =  "none";
1292                return f alse;   1292                return f alse;
1293           }   1293           }
1294     1294  
1295           if ( b.parent Node.clien tWidth >=  b.clientWi dth )   1295           if ( b.parent Node.clien tWidth >=  b.clientWi dth )
1296                s.style. display =  "none";   1296                s.style. display =  "none";
1297           el se   1297           el se
1298                s.style. display =  "block";   1298                s.style. display =  "block";
1299       }   1299       }
1300   </script>   1300   </script>
1301     1301  
1302   <div style ="position :relative; width:100% ;height:37 0px;overfl ow:hidden; ">   1302   <div style ="position :relative; width:100% ;height:37 0px;overfl ow:hidden; ">
1303       <div c lass="phot oBlock" id ="indexPho to">   1303       <div c lass="phot oBlock" id ="indexPho to">
1304           {$ sGallEnchI mg}   1304           {$ sGallEnchI mg}
1305       </div>   1305       </div>
1306   </div>   1306   </div>
1307     1307  
1308   <div class ="clear_bo th"></div>   1308   <div class ="clear_bo th"></div>
1309   <div class ="iconBloc kCont" id= "aIconBloc kCont">   1309   <div class ="iconBloc kCont" id= "aIconBloc kCont">
1310       {$sImg }   1310       {$sImg }
1311   </div>   1311   </div>
1312     1312  
1313   <div id="a ScrollCont " class="s crollCont" >   1313   <div id="a ScrollCont " class="s crollCont" >
1314       <div c lass="scro llLeft" on mouseover= "moveScrol lLeftAuto( 'aIconBloc k', true); " onmouseo ut="moveSc rollLeftAu to('aIconB lock', fal se);">   1314       <div c lass="scro llLeft" on mouseover= "moveScrol lLeftAuto( 'aIconBloc k', true); " onmouseo ut="moveSc rollLeftAu to('aIconB lock', fal se);">
1315           <i mg src="{$ site['icon s']}left_a rrow.gif"  style="pos ition:stat ic;" alt=" " />   1315           <i mg src="{$ site['icon s']}left_a rrow.gif"  style="pos ition:stat ic;" alt=" " />
1316       </div>   1316       </div>
1317       <div c lass="scro llRight" o nmouseover ="moveScro llRightAut o('aIconBl ock', true );" onmous eout="move ScrollRigh tAuto('aIc onBlock',  false);">   1317       <div c lass="scro llRight" o nmouseover ="moveScro llRightAut o('aIconBl ock', true );" onmous eout="move ScrollRigh tAuto('aIc onBlock',  false);">
1318           <i mg src="{$ site['icon s']}right_ arrow.gif"  style="po sition:sta tic;" alt= "" />   1318           <i mg src="{$ site['icon s']}right_ arrow.gif"  style="po sition:sta tic;" alt= "" />
1319       </div>   1319       </div>
1320   </div>   1320   </div>
1321     1321  
1322   <div class ="clear_bo th"></div>   1322   <div class ="clear_bo th"></div>
1323   EOF;   1323   EOF;
1324                    //// /Gall Ench  end   1324                    //// /Gall Ench  end
1325                } else {   1325                } else {
1326                    $sPi ctureSectC ontent = < <<EOF   1326                    $sPi ctureSectC ontent = < <<EOF
1327   <script ty pe="text/j avascript" >   1327   <script ty pe="text/j avascript" >
1328       if (wi ndow.attac hEvent)   1328       if (wi ndow.attac hEvent)
1329           wi ndow.attac hEvent( "o nload", on loadPhotos  );   1329           wi ndow.attac hEvent( "o nload", on loadPhotos  );
1330       else   1330       else
1331           wi ndow.addEv entListene r( "load",  onloadPho tos, false );   1331           wi ndow.addEv entListene r( "load",  onloadPho tos, false );
1332     1332  
1333       functi on onloadP hotos()   1333       functi on onloadP hotos()
1334       {   1334       {
1335           hi deScroll() ;   1335           hi deScroll() ;
1336       }   1336       }
1337     1337  
1338       //hide  scrollers  if needed   1338       //hide  scrollers  if needed
1339       functi on hideScr oll()   1339       functi on hideScr oll()
1340       {   1340       {
1341           b  = document .getElemen tById( "aI conBlock"  );   1341           b  = document .getElemen tById( "aI conBlock"  );
1342           s  = document .getElemen tById( "aS crollCont"  );   1342           s  = document .getElemen tById( "aS crollCont"  );
1343              1343           
1344           if ( !b || !s  ) {   1344           if ( !b || !s  ) {
1345                aibc = d ocument.ge tElementBy Id( "aIcon BlockCont"  );   1345                aibc = d ocument.ge tElementBy Id( "aIcon BlockCont"  );
1346                aibc.sty le.display  = "none";   1346                aibc.sty le.display  = "none";
1347                s.style. display =  "none";   1347                s.style. display =  "none";
1348                return f alse;   1348                return f alse;
1349           }   1349           }
1350     1350  
1351           if ( b.parent Node.clien tWidth >=  b.clientWi dth )   1351           if ( b.parent Node.clien tWidth >=  b.clientWi dth )
1352                s.style. display =  "none";   1352                s.style. display =  "none";
1353           el se   1353           el se
1354                s.style. display =  "block";   1354                s.style. display =  "block";
1355       }   1355       }
1356   </script>   1356   </script>
1357   <div class ="photoBlo ck">   1357   <div class ="photoBlo ck">
1358       {$sBig Img}   1358       {$sBig Img}
1359   </div>   1359   </div>
1360   <div class ="iconBloc kCont" id= "aIconBloc kCont">   1360   <div class ="iconBloc kCont" id= "aIconBloc kCont">
1361       {$sImg }   1361       {$sImg }
1362   </div>   1362   </div>
1363   <div id="a ScrollCont " class="s crollCont" >   1363   <div id="a ScrollCont " class="s crollCont" >
1364       <div c lass="scro llLeft" on mouseover= "moveScrol lLeftAuto( 'aIconBloc k', true); " onmouseo ut="moveSc rollLeftAu to('aIconB lock', fal se);">   1364       <div c lass="scro llLeft" on mouseover= "moveScrol lLeftAuto( 'aIconBloc k', true); " onmouseo ut="moveSc rollLeftAu to('aIconB lock', fal se);">
1365           <i mg src="{$ site['icon s']}left_a rrow.gif"  style="pos ition:stat ic;" alt=" " />   1365           <i mg src="{$ site['icon s']}left_a rrow.gif"  style="pos ition:stat ic;" alt=" " />
1366       </div>   1366       </div>
1367       <div c lass="scro llRight" o nmouseover ="moveScro llRightAut o('aIconBl ock', true );" onmous eout="move ScrollRigh tAuto('aIc onBlock',  false);">   1367       <div c lass="scro llRight" o nmouseover ="moveScro llRightAut o('aIconBl ock', true );" onmous eout="move ScrollRigh tAuto('aIc onBlock',  false);">
1368           <i mg src="{$ site['icon s']}right_ arrow.gif"  style="po sition:sta tic;" alt= "" />   1368           <i mg src="{$ site['icon s']}right_ arrow.gif"  style="po sition:sta tic;" alt= "" />
1369       </div>   1369       </div>
1370   </div>   1370   </div>
1371   <div class ="clear_bo th"></div>   1371   <div class ="clear_bo th"></div>
1372   EOF;   1372   EOF;
1373                }   1373                }
1374     1374  
1375                $sPictur eSect = De signBoxCon tent ( _t( '_Advertis ement Phot os'), $sPi ctureSectC ontent, 1) ;   1375                $sPictur eSect = De signBoxCon tent ( _t( '_Advertis ement Phot os'), $sPi ctureSectC ontent, 1) ;
1376                $this->s TAPhotosCo ntent = $s PictureSec tContent;   1376                $this->s TAPhotosCo ntent = $s PictureSec tContent;
1377     1377  
1378                $sAction sSect = ($ iMemberID> 0 || $this ->bAdminMo de) ? Desi gnBoxConte nt ( $sAct ionsC, $sM emberActio ns.$sAdmin Part, 1) :  '';   1378                $sAction sSect = ($ iMemberID> 0 || $this ->bAdminMo de) ? Desi gnBoxConte nt ( $sAct ionsC, $sM emberActio ns.$sAdmin Part, 1) :  '';
1379                $this->s TAActionsC ontent = ( $iMemberID >0 || $thi s->bAdminM ode) ? $sM emberActio ns.$sAdmin Part : '';   1379                $this->s TAActionsC ontent = ( $iMemberID >0 || $thi s->bAdminM ode) ? $sM emberActio ns.$sAdmin Part : '';
1380     1380  
1381                if ($iMe mberID>0 | | $this->b AdminMode)  {   1381                if ($iMe mberID>0 | | $this->b AdminMode)  {
1382                    $thi s->oCmtsVi ew = new B xTemplCmts View ('cla ssifieds',  (int)$iAd vertisemen tID);   1382                    $thi s->oCmtsVi ew = new B xTemplCmts View ('cla ssifieds',  (int)$iAd vertisemen tID);
1383     1383  
1384                    $thi s->sTAComm entsConten t = $this- >oCmtsView ->getExtra Css();   1384                    $thi s->sTAComm entsConten t = $this- >oCmtsView ->getExtra Css();
1385                    $thi s->sTAComm entsConten t .= $this ->oCmtsVie w->getExtr aJs();   1385                    $thi s->sTAComm entsConten t .= $this ->oCmtsVie w->getExtr aJs();
1386                    $thi s->sTAComm entsConten t .= (!$th is->oCmtsV iew->isEna bled()) ?  '' : $this ->oCmtsVie w->getComm entsFirst( );   1386                    $thi s->sTAComm entsConten t .= (!$th is->oCmtsV iew->isEna bled()) ?  '' : $this ->oCmtsVie w->getComm entsFirst( );
1387     1387  
1388                    $sCo mmSect = D esignBoxCo ntent ( $a Captions[' Comments'] , $this->s TAComments Content, 1 );   1388                    $sCo mmSect = D esignBoxCo ntent ( $a Captions[' Comments'] , $this->s TAComments Content, 1 );
1389                }   1389                }
1390                $sUserOt herListing  = $this - > PrintMyA ds($aSqlRe sStr['IDPr ofile'], 2 , true);   1390                $sUserOt herListing  = $this - > PrintMyA ds($aSqlRe sStr['IDPr ofile'], 2 , true);
1391     1391  
    1392                $sDataTi meFormatte d = Locale dDataTime( $aSqlResSt r['DateTim e_UTS']);
1392                $sSubjec tSectConte nt = <<<EO F   1393                $sSubjec tSectConte nt = <<<EO F
1393   {$sPostedB y}   1394   {$sPostedB y}
1394   <div class ="cls_res_ info">   1395   <div class ="cls_res_ info">
1395        {$sDateC}:   <div   class="clr 3">{$ aSqlRe s Str[' Dat e Time '] }   ({$sTimeAg o})</div>   1396        {$sDateC}:   <div   class="clr 3">{$
s
Dat a Time Formatted }   ({$sTimeAg o})</div>
1396   </div>   1397   </div>
1397   <div class ="cls_res_ info">   1398   <div class ="cls_res_ info">
1398       {$sLoc ationC}: < div class= "clr3">{$s CountryNam e}{$sCount ryPic}</di v>   1399       {$sLoc ationC}: < div class= "clr3">{$s CountryNam e}{$sCount ryPic}</di v>
1399   </div>   1400   </div>
1400   <div class ="cls_res_ info">   1401   <div class ="cls_res_ info">
1401       {$sTag s}   1402       {$sTag s}
1402   </div>   1403   </div>
1403   <div class ="cls_res_ info">   1404   <div class ="cls_res_ info">
1404       {$sCus tDetails}   1405       {$sCus tDetails}
1405   </div>   1406   </div>
1406   EOF;   1407   EOF;
1407                $sSubjec tSect = De signBoxCon tent ( $aS qlResStr[' Subject'],  $sSubject SectConten t, 1);   1408                $sSubjec tSect = De signBoxCon tent ( $aS qlResStr[' Subject'],  $sSubject SectConten t, 1);
1408                $this->s TAInfoCont ent = $sSu bjectSectC ontent;   1409                $this->s TAInfoCont ent = $sSu bjectSectC ontent;
1409     1410  
1410                $sDescri ptionSect  = DesignBo xContent (  $sDescrip tionC, $aS qlResStr[' Message'],  1);   1411                $sDescri ptionSect  = DesignBo xContent (  $sDescrip tionC, $aS qlResStr[' Message'],  1);
1411                $this->s TADescript ionContent  = $aSqlRe sStr['Mess age'];   1412                $this->s TADescript ionContent  = $aSqlRe sStr['Mess age'];
1412     1413  
1413                $sOtherL istingCont ent = <<<E OF   1414                $sOtherL istingCont ent = <<<E OF
1414   {$sUserOth erListing}   1415   {$sUserOth erListing}
1415   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['U sersOtherL istingForm '].submit( ); return  false;">{$ sUserOther ListC}</a>   1416   <a class=" actions" h ref="{$thi s -> sCurr BrowsedFil e}" onclic k="documen t.forms['U sersOtherL istingForm '].submit( ); return  false;">{$ sUserOther ListC}</a>
1416   <form acti on="{$this  -> sCurrB rowsedFile }" name="U sersOtherL istingForm " method=" post">   1417   <form acti on="{$this  -> sCurrB rowsedFile }" name="U sersOtherL istingForm " method=" post">
1417       <input  type="hid den" name= "UsersOthe rListing"  value="1"  />   1418       <input  type="hid den" name= "UsersOthe rListing"  value="1"  />
1418       <input  type="hid den" name= "IDProfile " value="{ $aSqlResSt r['IDProfi le']}" />   1419       <input  type="hid den" name= "IDProfile " value="{ $aSqlResSt r['IDProfi le']}" />
1419   </form>   1420   </form>
1420   EOF;   1421   EOF;
1421                $sOtherL istingSect  = DesignB oxContent  ( $sUserOt herListC,  $sOtherLis tingConten t, 1);   1422                $sOtherL istingSect  = DesignB oxContent  ( $sUserOt herListC,  $sOtherLis tingConten t, 1);
1422                $this->s TAOtherLis tingConten t = $sOthe rListingCo ntent;   1423                $this->s TAOtherLis tingConten t = $sOthe rListingCo ntent;
1423     1424  
1424                $sHomeLi nk = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/' : "{$t his->sCurr BrowsedFil e}?Browse= 1";   1425                $sHomeLi nk = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/' : "{$t his->sCurr BrowsedFil e}?Browse= 1";
1425                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ aSqlResStr ['CEntryUr i'] : "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$a SqlResStr[ 'CatID']}" ;   1426                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ aSqlResStr ['CEntryUr i'] : "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$a SqlResStr[ 'CatID']}" ;
1426                $sSCateg Link = ($t his->bUseF riendlyLin ks && $thi s->bAdminM ode == fal se) ? $sit e['url'].' ads/subcat /'.$aSqlRe sStr['SEnt ryUri'] :  "{$this->s CurrBrowse dFile}?bSu bClassifie dID={$aSql ResStr['Su bID']}";   1427                $sSCateg Link = ($t his->bUseF riendlyLin ks && $thi s->bAdminM ode == fal se) ? $sit e['url'].' ads/subcat /'.$aSqlRe sStr['SEnt ryUri'] :  "{$this->s CurrBrowse dFile}?bSu bClassifie dID={$aSql ResStr['Su bID']}";
1427     1428  
1428                $sBrowse AllAds = _ t('_Browse  All Ads') ;   1429                $sBrowse AllAds = _ t('_Browse  All Ads') ;
1429                $sBreadC rumbs = << <EOF   1430                $sBreadC rumbs = << <EOF
1430   <div class ="breadcru mbs">   1431   <div class ="breadcru mbs">
1431   <a href="{ $site['url ']}">{$sit e['title'] }</a>   1432   <a href="{ $site['url ']}">{$sit e['title'] }</a>
1432   /   1433   /
1433   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>   1434   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>
1434   /   1435   /
1435   <a href="{ $sCategLin k}">{$aSql ResStr['Na me']}</a>   1436   <a href="{ $sCategLin k}">{$aSql ResStr['Na me']}</a>
1436   /   1437   /
1437   <a href="{ $sSCategLi nk}">{$aSq lResStr['N ameSub']}< /a>   1438   <a href="{ $sSCategLi nk}">{$aSq lResStr['N ameSub']}< /a>
1438   </div>   1439   </div>
1439   EOF;   1440   EOF;
1440     1441  
1441     1442  
1442                //$iScro llWidth =  $this->iSc rollWidth;   1443                //$iScro llWidth =  $this->iSc rollWidth;
1443                //$iScro llHeight =  $this->iS crollWidth +0;   1444                //$iScro llHeight =  $this->iS crollWidth +0;
1444     1445  
1445                /*$sqlCo lRes = db_ res($sSqlC ols);   1446                /*$sqlCo lRes = db_ res($sSqlC ols);
1446                $aBlocks  = array() ;   1447                $aBlocks  = array() ;
1447                while($a BlockSelec t = mysql_ fetch_asso c($sqlColR es)) {   1448                while($a BlockSelec t = mysql_ fetch_asso c($sqlColR es)) {
1448                    swit ch( $aBloc kSelect['F unc'] ) {   1449                    swit ch( $aBloc kSelect['F unc'] ) {
1449                         case 'Adve rtisement  Photos': $ aBlocks[$a BlockSelec t['Column' ]] .= $sPi ctureSect;       brea k;   1450                         case 'Adve rtisement  Photos': $ aBlocks[$a BlockSelec t['Column' ]] .= $sPi ctureSect;       brea k;
1450                         case 'Acti ons':               $ aBlocks[$a BlockSelec t['Column' ]] .= $sAc tionsSect;       brea k;   1451                         case 'Acti ons':               $ aBlocks[$a BlockSelec t['Column' ]] .= $sAc tionsSect;       brea k;
1451                         case 'Comm ents':              $ aBlocks[$a BlockSelec t['Column' ]] .= $sCo mmSect;          brea k;   1452                         case 'Comm ents':              $ aBlocks[$a BlockSelec t['Column' ]] .= $sCo mmSect;          brea k;
1452                         case 'Adv  Info':              $ aBlocks[$a BlockSelec t['Column' ]] .= $sSu bjectSect;       brea k;   1453                         case 'Adv  Info':              $ aBlocks[$a BlockSelec t['Column' ]] .= $sSu bjectSect;       brea k;
1453                         case 'Desc ription':           $ aBlocks[$a BlockSelec t['Column' ]] .= $sDe scriptionS ect;  brea k;   1454                         case 'Desc ription':           $ aBlocks[$a BlockSelec t['Column' ]] .= $sDe scriptionS ect;  brea k;
1454                         case 'User s Other Li sting':  $ aBlocks[$a BlockSelec t['Column' ]] .= $sOt herListing Sect; brea k;   1455                         case 'User s Other Li sting':  $ aBlocks[$a BlockSelec t['Column' ]] .= $sOt herListing Sect; brea k;
1455                         case 'Echo ':   1456                         case 'Echo ':
1456                             $aBloc ks[$aBlock Select['Co lumn']] .=  DesignBox Content( _ t( $aBlock Select['Ca ption'] ),  $aBlockSe lect['Cont ent'], 1 ) ;   1457                             $aBloc ks[$aBlock Select['Co lumn']] .=  DesignBox Content( _ t( $aBlock Select['Ca ption'] ),  $aBlockSe lect['Cont ent'], 1 ) ;
1457                         break;   1458                         break;
1458                         case 'RSS' :   1459                         case 'RSS' :
1459                             list(  $sUrl, $iN um ) = exp lode( '#',  $aBlockSe lect['Cont ent'] );   1460                             list(  $sUrl, $iN um ) = exp lode( '#',  $aBlockSe lect['Cont ent'] );
1460                             $iNum  = (int)$iN um;   1461                             $iNum  = (int)$iN um;
1461                                1462                             
1462                             $ret =  genRSSHtm lOut( $sUr l, $iNum ) ;   1463                             $ret =  genRSSHtm lOut( $sUr l, $iNum ) ;
1463                                1464                             
1464                             $aBloc ks[$aBlock Select['Co lumn']] .=  DesignBox Content( _ t( $aBlock Select['Ca ption'] ),  $ret, 1 ) ;   1465                             $aBloc ks[$aBlock Select['Co lumn']] .=  DesignBox Content( _ t( $aBlock Select['Ca ption'] ),  $ret, 1 ) ;
1465                         break;   1466                         break;
1466                    }   1467                    }
1467                }*/   1468                }*/
1468     1469  
1469                $aBlocks [1] .= $sP ictureSect ;   1470                $aBlocks [1] .= $sP ictureSect ;
1470                $aBlocks [1] .= $sA ctionsSect ;   1471                $aBlocks [1] .= $sA ctionsSect ;
1471                $aBlocks [1] .= $sC ommSect;   1472                $aBlocks [1] .= $sC ommSect;
1472                $aBlocks [2] .= $sS ubjectSect ;   1473                $aBlocks [2] .= $sS ubjectSect ;
1473                $aBlocks [2] .= $sD escription Sect;   1474                $aBlocks [2] .= $sD escription Sect;
1474                $aBlocks [2] .= $sO therListin gSect;   1475                $aBlocks [2] .= $sO therListin gSect;
1475     1476  
1476                $sRetHtm l = <<<EOF   1477                $sRetHtm l = <<<EOF
1477   {$sBreadCr umbs}   1478   {$sBreadCr umbs}
1478   <div>   1479   <div>
1479       <div c lass="clea r_both"></ div>   1480       <div c lass="clea r_both"></ div>
1480       <div c lass="cls_ info_left" >   1481       <div c lass="cls_ info_left" >
1481           {$ aBlocks['1 ']}   1482           {$ aBlocks['1 ']}
1482       </div>   1483       </div>
1483       <div c lass="cls_ info">   1484       <div c lass="cls_ info">
1484           {$ aBlocks['2 ']}   1485           {$ aBlocks['2 ']}
1485       </div>   1486       </div>
1486       <div c lass="clea r_both"></ div>   1487       <div c lass="clea r_both"></ div>
1487   </div>   1488   </div>
1488   <div class ="clear_bo th"></div>   1489   <div class ="clear_bo th"></div>
1489   EOF;   1490   EOF;
1490           }   1491           }
1491           re turn $sRet Html;   1492           re turn $sRet Html;
1492       }   1493       }
1493     1494  
1494       /**   1495       /**
1495        * Gen erate arra y of Adver tisements  of some Cl assified   1496        * Gen erate arra y of Adver tisements  of some Cl assified
1496        *   1497        *
1497        * @pa ram $iClas sifiedID     ID of Cl assified   1498        * @pa ram $iClas sifiedID     ID of Cl assified
1498        * @re turn HTML  presentati on of data   1499        * @re turn HTML  presentati on of data
1499        */   1500        */
1500       functi on PrintAl lSubRecord s($iClassi fiedID) {   1501       functi on PrintAl lSubRecord s($iClassi fiedID) {
1501           gl obal $site ;   1502           gl obal $site ;
1502     1503  
1503           // ////////// ////////// //////   1504           // ////////// ////////// //////
1504           $s SQLl = $th is->GetAdv ByDateCnt( $iClassifi edID );   1505           $s SQLl = $th is->GetAdv ByDateCnt( $iClassifi edID );
1505     1506  
1506           $a TotalNum =  db_arr( $ sSQLl );   1507           $a TotalNum =  db_arr( $ sSQLl );
1507           $i TotalNum =  $aTotalNu m['Cnt'];   1508           $i TotalNum =  $aTotalNu m['Cnt'];
1508           if ( !$iTotal Num ) {   1509           if ( !$iTotal Num ) {
1509                return M sgBox(_t(  '_Sorry, n othing fou nd' ));   1510                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
1510           }   1511           }
1511     1512  
1512           $i PerPage =  (int)$_GET ['per_page '];   1513           $i PerPage =  (int)$_GET ['per_page '];
1513           if ( !$iPerPa ge )   1514           if ( !$iPerPa ge )
1514                $iPerPag e = $this- >iPerPageE lements;   1515                $iPerPag e = $this- >iPerPageE lements;
1515           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   1516           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
1516     1517  
1517           $i CurPage =  (int)$_GET ['page'];   1518           $i CurPage =  (int)$_GET ['page'];
1518     1519  
1519           if ( $iCurPag e > $iTota lPages )   1520           if ( $iCurPag e > $iTota lPages )
1520                $iCurPag e = $iTota lPages;   1521                $iCurPag e = $iTota lPages;
1521     1522  
1522           if ( $iCurPag e < 1 )   1523           if ( $iCurPag e < 1 )
1523                $iCurPag e = 1;   1524                $iCurPag e = 1;
1524     1525  
1525           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   1526           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
1526           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;   1527           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;
1527           // ////////// ////////// //////   1528           // ////////// ////////// //////
1528     1529  
1529           $v SqlRes = $ this -> Ge tAdvByDate ($iClassif iedID, $sq lLimit);   1530           $v SqlRes = $ this -> Ge tAdvByDate ($iClassif iedID, $sq lLimit);
1530     1531  
1531           $s NameCat =  '';   1532           $s NameCat =  '';
1532           $s DescCat =  '';   1533           $s DescCat =  '';
1533     1534  
1534           $s SubsHtml =  '';   1535           $s SubsHtml =  '';
1535           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {   1536           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {
1536                $sSubsHt ml .= $thi s -> Compo seResultSt ringAdv($a SqlResStr) ;   1537                $sSubsHt ml .= $thi s -> Compo seResultSt ringAdv($a SqlResStr) ;
1537                if ($sNa meCat=='')  {   1538                if ($sNa meCat=='')  {
1538                    $sNa meCat = $a SqlResStr[ 'Name'];   1539                    $sNa meCat = $a SqlResStr[ 'Name'];
1539                    $sDe scCat = $a SqlResStr[ 'Descripti on'];   1540                    $sDe scCat = $a SqlResStr[ 'Descripti on'];
1540                }   1541                }
1541           }   1542           }
1542     1543  
1543           $s Caption =  "<div clas s=\"fl\">{ $sNameCat} </div>\n";   1544           $s Caption =  "<div clas s=\"fl\">{ $sNameCat} </div>\n";
1544     1545  
1545           $s Desc = "<d iv class=\ "cls_resul t_row\">{$ sDescCat}< /div>";   1546           $s Desc = "<d iv class=\ "cls_resul t_row\">{$ sDescCat}< /div>";
1546     1547  
1547           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";   1548           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";
1548     1549  
1549           $s BrowseAllA ds = _t('_ Browse All  Ads');   1550           $s BrowseAllA ds = _t('_ Browse All  Ads');
1550           $s BreadCrumb s = <<<EOF   1551           $s BreadCrumb s = <<<EOF
1551   <div class ="breadcru mbs">   1552   <div class ="breadcru mbs">
1552   <a href="{ $site['url ']}">{$sit e['title'] }</a>   1553   <a href="{ $site['url ']}">{$sit e['title'] }</a>
1553   /   1554   /
1554   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>   1555   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>
1555   /   1556   /
1556   <span clas s="active_ link">{$sN ameCat}</s pan>   1557   <span clas s="active_ link">{$sN ameCat}</s pan>
1557   </div>   1558   </div>
1558   EOF;   1559   EOF;
1559     1560  
1560           // ////////// ////////// /////   1561           // ////////// ////////// /////
1561           if  ($this->b UseFriendl yLinks==fa lse || $th is -> bAdm inMode==tr ue) { //ol d variant   1562           if  ($this->b UseFriendl yLinks==fa lse || $th is -> bAdm inMode==tr ue) { //ol d variant
1562                if( $iTo talPages >  1)   1563                if( $iTo talPages >  1)
1563                {   1564                {
1564                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   1565                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
1565                    $aFi elds = arr ay( 'bClas sifiedID',  'bSubClas sifiedID',  'catUri',  'scatUri'  );   1566                    $aFi elds = arr ay( 'bClas sifiedID',  'bSubClas sifiedID',  'catUri',  'scatUri'  );
1566                       1567                    
1567                    fore ach( $aFie lds as $fi eld )   1568                    fore ach( $aFie lds as $fi eld )
1568                         if( isset(  $_GET[$fi eld] ) )   1569                         if( isset(  $_GET[$fi eld] ) )
1569                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );   1570                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );
1570                       1571                    
1571                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':   1572                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':
1572                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >   1573                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >
1573                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   1574                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
1574                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   1575                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
1575                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   1576                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
1576                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   1577                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
1577                             </sele ct></div>'  .   1578                             </sele ct></div>'  .
1578                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );   1579                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );
1579                }   1580                }
1580                else   1581                else
1581                    $pag ination =  '';   1582                    $pag ination =  '';
1582           }  else {   1583           }  else {
1583                if( $iTo talPages >  1)   1584                if( $iTo talPages >  1)
1584                {   1585                {
1585                    $sRe quest = 'a ds/all/cat /';   1586                    $sRe quest = 'a ds/all/cat /';
1586                    $sPa ginAddon =  '/' . pro cess_db_in put($_GET[ 'catUri']) ;   1587                    $sPa ginAddon =  '/' . pro cess_db_in put($_GET[ 'catUri']) ;
1587                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );   1588                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );
1588                       1589                    
1589                    fore ach( $aFie lds as $fi eld )   1590                    fore ach( $aFie lds as $fi eld )
1590                         if( isset(  $_GET[$fi eld] ) )   1591                         if( isset(  $_GET[$fi eld] ) )
1591                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/   1592                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/
1592                       1593                    
1593                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':   1594                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':
1594                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">   1595                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">
1595                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   1596                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
1596                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   1597                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
1597                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   1598                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
1598                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   1599                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
1599                             </sele ct></div>'  .   1600                             </sele ct></div>'  .
1600                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );   1601                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );
1601                }   1602                }
1602                else   1603                else
1603                    $pag ination =  '';   1604                    $pag ination =  '';
1604           }   1605           }
1605           // ////////// ////////// /////   1606           // ////////// ////////// /////
1606     1607  
1607           $s SubsHtml . = '<div cl ass="clear _both"></d iv>';   1608           $s SubsHtml . = '<div cl ass="clear _both"></d iv>';
1608           $s TagsSect =  DesignBox Content (  $sBreadCru mbs, /*$sD esc.*/$sSu bsHtml.$pa gination,  1);   1609           $s TagsSect =  DesignBox Content (  $sBreadCru mbs, /*$sD esc.*/$sSu bsHtml.$pa gination,  1);
1609           re turn $sTag sSect;   1610           re turn $sTag sSect;
1610       }   1611       }
1611     1612  
1612       /**   1613       /**
1613        * Gen erate arra y of Adver tisements  of some Su bClassifie d   1614        * Gen erate arra y of Adver tisements  of some Su bClassifie d
1614        *   1615        *
1615        * @pa ram $iIDCl assifiedsS ubs   ID o f SubClass ified   1616        * @pa ram $iIDCl assifiedsS ubs   ID o f SubClass ified
1616        * @pa ram $bTabl edView  fi ll collect ed data in to another  table   1617        * @pa ram $bTabl edView  fi ll collect ed data in to another  table
1617        * @re turn HTML  presentati on of data   1618        * @re turn HTML  presentati on of data
1618        */   1619        */
1619       functi on PrintSu bRecords($ iIDClassif iedsSubs,  $bTabledVi ew=FALSE)  {   1620       functi on PrintSu bRecords($ iIDClassif iedsSubs,  $bTabledVi ew=FALSE)  {
1620           gl obal $site ;   1621           gl obal $site ;
1621           $i IDClassifi edsSubs =  (int)$iIDC lassifieds Subs;   1622           $i IDClassifi edsSubs =  (int)$iIDC lassifieds Subs;
1622           $s RetHtml =  '';   1623           $s RetHtml =  '';
1623     1624  
1624           // ////////// ////////// //////   1625           // ////////// ////////// //////
1625           $s SQLl = $th is->GetAdv ByDateCnt( $iIDClassi fiedsSubs, TRUE );   1626           $s SQLl = $th is->GetAdv ByDateCnt( $iIDClassi fiedsSubs, TRUE );
1626     1627  
1627           $a TotalNum =  db_arr( $ sSQLl );   1628           $a TotalNum =  db_arr( $ sSQLl );
1628           $i TotalNum =  $aTotalNu m['Cnt'];   1629           $i TotalNum =  $aTotalNu m['Cnt'];
1629           if ( !$iTotal Num ) {   1630           if ( !$iTotal Num ) {
1630                return M sgBox(_t(  '_Sorry, n othing fou nd' ));   1631                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
1631           }   1632           }
1632     1633  
1633           $i PerPage =  (int)$_GET ['per_page '];   1634           $i PerPage =  (int)$_GET ['per_page '];
1634           if ( !$iPerPa ge )   1635           if ( !$iPerPa ge )
1635                $iPerPag e = $this- >iPerPageE lements;   1636                $iPerPag e = $this- >iPerPageE lements;
1636           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   1637           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
1637     1638  
1638           $i CurPage =  (int)$_GET ['page'];   1639           $i CurPage =  (int)$_GET ['page'];
1639     1640  
1640           if ( $iCurPag e > $iTota lPages )   1641           if ( $iCurPag e > $iTota lPages )
1641                $iCurPag e = $iTota lPages;   1642                $iCurPag e = $iTota lPages;
1642     1643  
1643           if ( $iCurPag e < 1 )   1644           if ( $iCurPag e < 1 )
1644                $iCurPag e = 1;   1645                $iCurPag e = 1;
1645     1646  
1646           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   1647           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
1647           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;   1648           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;
1648           // ////////// ////////// //////   1649           // ////////// ////////// //////
1649     1650  
1650           $v SqlResCA =  $this ->  GetAdvByDa te($iIDCla ssifiedsSu bs, $sqlLi mit, TRUE) ;   1651           $v SqlResCA =  $this ->  GetAdvByDa te($iIDCla ssifiedsSu bs, $sqlLi mit, TRUE) ;
1651     1652  
1652           wh ile( $aSql ResStrCA =  mysql_fet ch_assoc($ vSqlResCA)  ) {   1653           wh ile( $aSql ResStrCA =  mysql_fet ch_assoc($ vSqlResCA)  ) {
1653                $sRetHtm l .= $this  -> Compos eResultStr ingAdv($aS qlResStrCA );   1654                $sRetHtm l .= $this  -> Compos eResultStr ingAdv($aS qlResStrCA );
1654           }   1655           }
1655     1656  
1656           if  ($bTabled View==TRUE ) {   1657           if  ($bTabled View==TRUE ) {
1657                $sSql =  "SELECT `C lassifieds `.`ID` AS  'Classifie dsID', `Cl assifieds` .`Name`, ` Classified s`.`CEntry Uri` , `Cl assifiedsS ubs`.`ID`  AS 'Classi fiedsSubsI D', `Class ifiedsSubs `.`NameSub ` , `Class ifiedsSubs `.`Descrip tion`    1658                $sSql =  "SELECT `C lassifieds `.`ID` AS  'Classifie dsID', `Cl assifieds` .`Name`, ` Classified s`.`CEntry Uri` , `Cl assifiedsS ubs`.`ID`  AS 'Classi fiedsSubsI D', `Class ifiedsSubs `.`NameSub ` , `Class ifiedsSubs `.`Descrip tion` 
1658                    FROM  `Classifi eds`    1659                    FROM  `Classifi eds` 
1659                    INNE R JOIN `Cl assifiedsS ubs` ON (  `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed` )    1660                    INNE R JOIN `Cl assifiedsS ubs` ON (  `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed` ) 
1660                    WHER E `Classif iedsSubs`. `ID` = {$i IDClassifi edsSubs}   1661                    WHER E `Classif iedsSubs`. `ID` = {$i IDClassifi edsSubs}
1661                    LIMI T 1";   1662                    LIMI T 1";
1662                $aSubcat Res = db_a rr($sSql);   1663                $aSubcat Res = db_a rr($sSql);
1663                $sCaptio n = "<div  class=\"fl \">{$aSubc atRes['Nam e']} -> {$ aSubcatRes ['NameSub' ]}</div>\n ";   1664                $sCaptio n = "<div  class=\"fl \">{$aSubc atRes['Nam e']} -> {$ aSubcatRes ['NameSub' ]}</div>\n ";
1664     1665  
1665                $sDesc =  "<div cla ss=\"cls_r esult_row\ ">{$aSubca tRes['Desc ription']} </div>";   1666                $sDesc =  "<div cla ss=\"cls_r esult_row\ ">{$aSubca tRes['Desc ription']} </div>";
1666     1667  
1667                $sHomeLi nk = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/' : "{$t his->sCurr BrowsedFil e}?Browse= 1";   1668                $sHomeLi nk = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/' : "{$t his->sCurr BrowsedFil e}?Browse= 1";
1668                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ aSubcatRes ['CEntryUr i'] : "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$a SubcatRes[ 'Classifie dsID']}";   1669                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ aSubcatRes ['CEntryUr i'] : "{$t his->sCurr BrowsedFil e}?bClassi fiedID={$a SubcatRes[ 'Classifie dsID']}";
1669     1670  
1670                $sBrowse AllAds = _ t('_Browse  All Ads') ;   1671                $sBrowse AllAds = _ t('_Browse  All Ads') ;
1671                $sBreadC rumbs = << <EOF   1672                $sBreadC rumbs = << <EOF
1672   <div class ="breadcru mbs">   1673   <div class ="breadcru mbs">
1673   <a href="{ $site['url ']}">{$sit e['title'] }</a>   1674   <a href="{ $site['url ']}">{$sit e['title'] }</a>
1674   /   1675   /
1675   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>   1676   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>
1676   /   1677   /
1677   <a href="{ $sCategLin k}">{$aSub catRes['Na me']}</a>   1678   <a href="{ $sCategLin k}">{$aSub catRes['Na me']}</a>
1678   /   1679   /
1679   <span clas s="active_ link">{$aS ubcatRes[' NameSub']} </span>   1680   <span clas s="active_ link">{$aS ubcatRes[' NameSub']} </span>
1680   </div>   1681   </div>
1681   EOF;   1682   EOF;
1682     1683  
1683           // ////////// ////////// /////   1684           // ////////// ////////// /////
1684           if  ($this->b UseFriendl yLinks==fa lse || $th is -> bAdm inMode==tr ue) { //ol d variant   1685           if  ($this->b UseFriendl yLinks==fa lse || $th is -> bAdm inMode==tr ue) { //ol d variant
1685                if( $iTo talPages >  1)   1686                if( $iTo talPages >  1)
1686                {   1687                {
1687                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   1688                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
1688                    $aFi elds = arr ay( 'bClas sifiedID',  'bSubClas sifiedID',  'catUri',  'scatUri'  );   1689                    $aFi elds = arr ay( 'bClas sifiedID',  'bSubClas sifiedID',  'catUri',  'scatUri'  );
1689                       1690                    
1690                    fore ach( $aFie lds as $fi eld )   1691                    fore ach( $aFie lds as $fi eld )
1691                         if( isset(  $_GET[$fi eld] ) )   1692                         if( isset(  $_GET[$fi eld] ) )
1692                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );   1693                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );
1693                       1694                    
1694                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':   1695                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':
1695                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >   1696                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >
1696                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   1697                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
1697                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   1698                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
1698                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   1699                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
1699                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   1700                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
1700                             </sele ct></div>'  .   1701                             </sele ct></div>'  .
1701                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );   1702                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );
1702                }   1703                }
1703                else   1704                else
1704                    $pag ination =  '';   1705                    $pag ination =  '';
1705           }  else {   1706           }  else {
1706                if( $iTo talPages >  1)   1707                if( $iTo talPages >  1)
1707                {   1708                {
1708                    $sRe quest = 'a ds/all/sub cat/';   1709                    $sRe quest = 'a ds/all/sub cat/';
1709                    $sPa ginAddon =  '/' . pro cess_db_in put($_GET[ 'scatUri'] );   1710                    $sPa ginAddon =  '/' . pro cess_db_in put($_GET[ 'scatUri'] );
1710                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );   1711                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );
1711                       1712                    
1712                    fore ach( $aFie lds as $fi eld )   1713                    fore ach( $aFie lds as $fi eld )
1713                         if( isset(  $_GET[$fi eld] ) )   1714                         if( isset(  $_GET[$fi eld] ) )
1714                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/   1715                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/
1715                       1716                    
1716                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':   1717                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':
1717                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">   1718                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">
1718                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   1719                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
1719                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   1720                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
1720                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   1721                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
1721                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   1722                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
1722                             </sele ct></div>'  .   1723                             </sele ct></div>'  .
1723                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );   1724                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );
1724                }   1725                }
1725                else   1726                else
1726                    $pag ination =  '';   1727                    $pag ination =  '';
1727           }   1728           }
1728           // ////////// ////////// /////   1729           // ////////// ////////// /////
1729     1730  
1730                $sRetHtm l .= '<div  class="cl ear_both"> </div>';   1731                $sRetHtm l .= '<div  class="cl ear_both"> </div>';
1731                $sTagsSe ct = Desig nBoxConten t ( $sBrea dCrumbs, / *$sDesc.*/  $sRetHtml .$paginati on, 1);   1732                $sTagsSe ct = Desig nBoxConten t ( $sBrea dCrumbs, / *$sDesc.*/  $sRetHtml .$paginati on, 1);
1732           }   1733           }
1733           re turn $sTag sSect;   1734           re turn $sTag sSect;
1734       }   1735       }
1735     1736  
1736       /**   1737       /**
1737        * Gen erate a hr ef to Back  Link   1738        * Gen erate a hr ef to Back  Link
1738        *   1739        *
1739        * @re turn HTML  presentati on of data   1740        * @re turn HTML  presentati on of data
1740        */   1741        */
1741       functi on PrintBa ckLink() {   1742       functi on PrintBa ckLink() {
1742           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";   1743           $s HomeLink =  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";
1743     1744  
1744           $s ReturnBack C = _t('_R eturn Back ');   1745           $s ReturnBack C = _t('_R eturn Back ');
1745           $s RetHtml =  <<<EOF   1746           $s RetHtml =  <<<EOF
1746   <div>   1747   <div>
1747       <b>   1748       <b>
1748           <a  href="{$s HomeLink}" >{$sReturn BackC}</a>   1749           <a  href="{$s HomeLink}" >{$sReturn BackC}</a>
1749       </b>   1750       </b>
1750   </div>   1751   </div>
1751   EOF;   1752   EOF;
1752           re turn $sRet Html;   1753           re turn $sRet Html;
1753       }   1754       }
1754     1755  
1755       /**   1756       /**
1756        * Gen erate a hr ef link to  Back to s ome Advert isement   1757        * Gen erate a hr ef link to  Back to s ome Advert isement
1757        *   1758        *
1758        * par am $iAdver tisementID   1759        * par am $iAdver tisementID
1759        * @re turn HTML  presentati on of data   1760        * @re turn HTML  presentati on of data
1760        */   1761        */
1761       functi on PrintBa ckLink2Adv ($iAdverti sementID)  {   1762       functi on PrintBa ckLink2Adv ($iAdverti sementID)  {
1762           $s ReturnBack C = _t('_R eturn Back ');   1763           $s ReturnBack C = _t('_R eturn Back ');
1763           $s GenUrl = $ this->genU rl($iAdver tisementID , '', 'ent ry', true) ;   1764           $s GenUrl = $ this->genU rl($iAdver tisementID , '', 'ent ry', true) ;
1764           // {$this->sC urrBrowsed File}?Show Advertisem entID={$iA dvertiseme ntID}   1765           // {$this->sC urrBrowsed File}?Show Advertisem entID={$iA dvertiseme ntID}
1765           $s RetHtml =  <<<EOF   1766           $s RetHtml =  <<<EOF
1766   <div>   1767   <div>
1767       <b>   1768       <b>
1768           <a  href="{$s GenUrl}">{ $sReturnBa ckC}</a>   1769           <a  href="{$s GenUrl}">{ $sReturnBa ckC}</a>
1769       </b>   1770       </b>
1770   </div>   1771   </div>
1771   EOF;   1772   EOF;
1772           re turn $sRet Html;   1773           re turn $sRet Html;
1773       }   1774       }
1774     1775  
1775       /**   1776       /**
1776        * Gen erate arra y of Class ified in l ists doubl ed form   1777        * Gen erate arra y of Class ified in l ists doubl ed form
1777        *   1778        *
1778        * @re turn HTML  presentati on of data   1779        * @re turn HTML  presentati on of data
1779        */   1780        */
1780       functi on PrintCl assifieds( ) {   1781       functi on PrintCl assifieds( ) {
1781           gl obal $site ;   1782           gl obal $site ;
1782     1783  
1783           $s RetHtml =  '';   1784           $s RetHtml =  '';
1784     1785  
1785           $v SqlRes = $ this -> Ge tDataOfCls ();   1786           $v SqlRes = $ this -> Ge tDataOfCls ();
1786           if  (mysql_af fected_row s()==-1)   1787           if  (mysql_af fected_row s()==-1)
1787                return $ this -> Ge tSQLError( "");   1788                return $ this -> Ge tSQLError( "");
1788     1789  
1789           $i Counter =  0;   1790           $i Counter =  0;
1790           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {   1791           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {
1791                $iID = $ aSqlResStr ['ID'];   1792                $iID = $ aSqlResStr ['ID'];
1792                $sCatNam e = $aSqlR esStr['Nam e'];   1793                $sCatNam e = $aSqlR esStr['Nam e'];
1793                $sCatUri  = $aSqlRe sStr['CEnt ryUri'];   1794                $sCatUri  = $aSqlRe sStr['CEnt ryUri'];
1794     1795  
1795                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ sCatUri :  "{$this->s CurrBrowse dFile}?bCl assifiedID ={$iID}";   1796                $sCategL ink = ($th is->bUseFr iendlyLink s && $this ->bAdminMo de == fals e) ? $site ['url'].'a ds/cat/'.$ sCatUri :  "{$this->s CurrBrowse dFile}?bCl assifiedID ={$iID}";
1796     1797  
1797                $sHref1  = "<a href =\"{$sCate gLink}\">\ n";   1798                $sHref1  = "<a href =\"{$sCate gLink}\">\ n";
1798                $sqlCoun tCatRec =  "   1799                $sqlCoun tCatRec =  "
1799                    SELE CT COUNT(` Classified sAdvertise ments`.`ID `) AS 'Cou nt'   1800                    SELE CT COUNT(` Classified sAdvertise ments`.`ID `) AS 'Cou nt'
1800                    FROM  `Classifi eds` INNER  JOIN `Cla ssifiedsSu bs`   1801                    FROM  `Classifi eds` INNER  JOIN `Cla ssifiedsSu bs`
1801                    ON ( `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed`)   1802                    ON ( `Classifie ds`.`ID` =  `Classifi edsSubs`.` IDClassifi ed`)
1802                    INNE R JOIN `Cl assifiedsA dvertiseme nts`   1803                    INNE R JOIN `Cl assifiedsA dvertiseme nts`
1803                    ON ( `Classifie dsSubs`.`I D` = `Clas sifiedsAdv ertisement s`.`IDClas sifiedsSub s`)   1804                    ON ( `Classifie dsSubs`.`I D` = `Clas sifiedsAdv ertisement s`.`IDClas sifiedsSub s`)
1804                    WHER E `Classif ieds`.`ID`  = '{$aSql ResStr['ID ']}'   1805                    WHER E `Classif ieds`.`ID`  = '{$aSql ResStr['ID ']}'
1805                    AND  DATE_ADD(` Classified sAdvertise ments`.`Da teTime`, I NTERVAL `C lassifieds Advertisem ents`.`Lif eTime` DAY ) > NOW()" ;   1806                    AND  DATE_ADD(` Classified sAdvertise ments`.`Da teTime`, I NTERVAL `C lassifieds Advertisem ents`.`Lif eTime` DAY ) > NOW()" ;
1806     1807  
1807                $aCountC atRes = db _arr($sqlC ountCatRec );   1808                $aCountC atRes = db _arr($sqlC ountCatRec );
1808                $sCnt =   ( $aCount CatRes['Co unt'] > 0  ) ? " ({$a CountCatRe s['Count'] })" : '';   1809                $sCnt =   ( $aCount CatRes['Co unt'] > 0  ) ? " ({$a CountCatRe s['Count'] })" : '';
1809                $sHref2  = "</a>";   1810                $sHref2  = "</a>";
1810     1811  
1811                $sOrderB y = (getPa ram('enabl e_classifi eds_sort')  == 'on')  ? 'ORDER B Y `Classif iedsSubs`. `NameSub`  ASC' : ''  ;   1812                $sOrderB y = (getPa ram('enabl e_classifi eds_sort')  == 'on')  ? 'ORDER B Y `Classif iedsSubs`. `NameSub`  ASC' : ''  ;
1812                $sQueryS ubs = "SEL ECT * FROM  `Classifi edsSubs` W HERE `IDCl assified`  = {$aSqlRe sStr['ID'] } {$sOrder By}";   1813                $sQueryS ubs = "SEL ECT * FROM  `Classifi edsSubs` W HERE `IDCl assified`  = {$aSqlRe sStr['ID'] } {$sOrder By}";
1813                $sqlResS ubs = db_r es ($sQuer ySubs);   1814                $sqlResS ubs = db_r es ($sQuer ySubs);
1814                if (mysq l_affected _rows()==- 1) {   1815                if (mysq l_affected _rows()==- 1) {
1815                    retu rn $this - > GetSQLEr ror($sQuer ySubs);   1816                    retu rn $this - > GetSQLEr ror($sQuer ySubs);
1816                }   1817                }
1817                $sSubsHt ml = '';   1818                $sSubsHt ml = '';
1818                while( $ aSqlResSub sStr = mys ql_fetch_a ssoc($sqlR esSubs) )  {   1819                while( $ aSqlResSub sStr = mys ql_fetch_a ssoc($sqlR esSubs) )  {
1819                    $iSu bID = $aSq lResSubsSt r['ID'];   1820                    $iSu bID = $aSq lResSubsSt r['ID'];
1820                    $sSq lCountRecS ub = "   1821                    $sSq lCountRecS ub = "
1821                         SELECT COU NT(`ID`) A S 'Count'   1822                         SELECT COU NT(`ID`) A S 'Count'
1822                         FROM `Clas sifiedsAdv ertisement s`   1823                         FROM `Clas sifiedsAdv ertisement s`
1823                         WHERE `IDC lassifieds Subs`='{$a SqlResSubs Str['ID']} '   1824                         WHERE `IDC lassifieds Subs`='{$a SqlResSubs Str['ID']} '
1824                         AND DATE_A DD(`Classi fiedsAdver tisements` .`DateTime `, INTERVA L `Classif iedsAdvert isements`. `LifeTime`  DAY) > NO W()";   1825                         AND DATE_A DD(`Classi fiedsAdver tisements` .`DateTime `, INTERVA L `Classif iedsAdvert isements`. `LifeTime`  DAY) > NO W()";
1825                    $sCo untResSub  = db_arr($ sSqlCountR ecSub);   1826                    $sCo untResSub  = db_arr($ sSqlCountR ecSub);
1826                    $sNa meSubUp =  ucwords($a SqlResSubs Str['NameS ub']);   1827                    $sNa meSubUp =  ucwords($a SqlResSubs Str['NameS ub']);
1827                    $sCn tSub =  (  $sCountRes Sub['Count '] > 0 ) ?  " ({$sCou ntResSub[' Count']})"  : '';   1828                    $sCn tSub =  (  $sCountRes Sub['Count '] > 0 ) ?  " ({$sCou ntResSub[' Count']})"  : '';
1828                    $sSC ategLink =  ($this->b UseFriendl yLinks) ?  $site['url '].'ads/su bcat/'.$aS qlResSubsS tr['SEntry Uri'] : "{ $this->sCu rrBrowsedF ile}?bSubC lassifiedI D={$iSubID }";   1829                    $sSC ategLink =  ($this->b UseFriendl yLinks) ?  $site['url '].'ads/su bcat/'.$aS qlResSubsS tr['SEntry Uri'] : "{ $this->sCu rrBrowsedF ile}?bSubC lassifiedI D={$iSubID }";
1829     1830  
1830                    $sSu bsHtml .=  <<<EOF   1831                    $sSu bsHtml .=  <<<EOF
1831   <div class ="fs_13">   1832   <div class ="fs_13">
1832       <a hre f="{$sSCat egLink}">   1833       <a hre f="{$sSCat egLink}">
1833           {$ sNameSubUp }   1834           {$ sNameSubUp }
1834       </a>   1835       </a>
1835       {$sCnt Sub}   1836       {$sCnt Sub}
1836   </div>   1837   </div>
1837   EOF;   1838   EOF;
1838                }   1839                }
1839                $sCaptio n = $sHref 1.$sCatNam e.$sHref2. $sCnt;   1840                $sCaptio n = $sHref 1.$sCatNam e.$sHref2. $sCnt;
1840                $iCounte r++;   1841                $iCounte r++;
1841                $sMargin  = '';   1842                $sMargin  = '';
1842                $sDiv1 =  '';   1843                $sDiv1 =  '';
1843                $sDiv2 =  '';   1844                $sDiv2 =  '';
1844                $sDivide r = '';   1845                $sDivide r = '';
1845                if (($iC ounter % 3 ) == 1) {   1846                if (($iC ounter % 3 ) == 1) {
1846                    $sDi v1 = '<div  style="wi dth:100%;m argin-bott om:10px;"> ';   1847                    $sDi v1 = '<div  style="wi dth:100%;m argin-bott om:10px;"> ';
1847                }   1848                }
1848                if (($iC ounter % 4 ) == 0) {   1849                if (($iC ounter % 4 ) == 0) {
1849                    $sDi v2 = '</di v>';   1850                    $sDi v2 = '</di v>';
1850                    $sDi vider = '< div class= "clear_bot h"></div>' ;   1851                    $sDi vider = '< div class= "clear_bot h"></div>' ;
1851                }   1852                }
1852                if (($iC ounter % 4 ) != 0) {   1853                if (($iC ounter % 4 ) != 0) {
1853                    $sMa rgin = 'ma rgin-right :12px;';   1854                    $sMa rgin = 'ma rgin-right :12px;';
1854                }   1855                }
1855     1856  
1856                //$sRetH tml .= $th is->Decora teAsTable2 ($sCaption , $sSubsHt ml, $sMarg in) . $sDi vider;   1857                //$sRetH tml .= $th is->Decora teAsTable2 ($sCaption , $sSubsHt ml, $sMarg in) . $sDi vider;
1857                $sRetHtm l .= "<div  class=\"d isignBoxFi rstABlock\ " style=\" {$sMargin} \">" . Des ignBoxCont ent($sCapt ion, $sSub sHtml, 1)  . '</div>'  . $sDivid er;   1858                $sRetHtm l .= "<div  class=\"d isignBoxFi rstABlock\ " style=\" {$sMargin} \">" . Des ignBoxCont ent($sCapt ion, $sSub sHtml, 1)  . '</div>'  . $sDivid er;
1858           }   1859           }
1859           re turn $sRet Html;   1860           re turn $sRet Html;
1860       }   1861       }
1861     1862  
1862       /**   1863       /**
1863        * Gen erate Filt er form wi th ability  of search ing by Cat egory, Cou ntry and k eyword (in  Subject a nd Message )   1864        * Gen erate Filt er form wi th ability  of search ing by Cat egory, Cou ntry and k eyword (in  Subject a nd Message )
1864        *   1865        *
1865        * @re turn HTML  presentati on of form   1866        * @re turn HTML  presentati on of form
1866        */   1867        */
1867       functi on PrintFi lterForm($ iClassifie dID = -1,  $iSubClass ifiedID =  -1) {   1868       functi on PrintFi lterForm($ iClassifie dID = -1,  $iSubClass ifiedID =  -1) {
1868           gl obal $aPre Values;   1869           gl obal $aPre Values;
1869     1870  
1870           $s AnyC = _t( '_Any');   1871           $s AnyC = _t( '_Any');
1871           $i Classified ID = (isse t( $_REQUE ST['Filter Cat'] )) ?  (int)proc ess_db_inp ut( $_REQU EST['Filte rCat'] ) :  $iClassif iedID;   1872           $i Classified ID = (isse t( $_REQUE ST['Filter Cat'] )) ?  (int)proc ess_db_inp ut( $_REQU EST['Filte rCat'] ) :  $iClassif iedID;
1872           $i SubClassif iedID = (i sset( $_RE QUEST['Fil terSubCat' ] )) ? (in t)process_ db_input(  $_REQUEST[ 'FilterSub Cat'] ) :  $iSubClass ifiedID;   1873           $i SubClassif iedID = (i sset( $_RE QUEST['Fil terSubCat' ] )) ? (in t)process_ db_input(  $_REQUEST[ 'FilterSub Cat'] ) :  $iSubClass ifiedID;
1873           $s Country =  process_db _input( $_ REQUEST['F ilterCount ry'] );   1874           $s Country =  process_db _input( $_ REQUEST['F ilterCount ry'] );
1874           $s Keywords =  process_d b_input( $ _REQUEST[' FilterKeyw ords'] );   1875           $s Keywords =  process_d b_input( $ _REQUEST[' FilterKeyw ords'] );
1875           $s CustomFiel dCaption1  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption1 '] );   1876           $s CustomFiel dCaption1  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption1 '] );
1876           $s CustomFiel dCaption2  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption2 '] );   1877           $s CustomFiel dCaption2  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption2 '] );
1877           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value1'] ) , $aRegs))  {   1878           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value1'] ) , $aRegs))  {
1878                $sCustom FieldValue 1 = $aRegs [1];   1879                $sCustom FieldValue 1 = $aRegs [1];
1879           }   1880           }
1880           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value2'] ) , $aRegs))  {   1881           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value2'] ) , $aRegs))  {
1881                $sCustom FieldValue 2 = $aRegs [1];   1882                $sCustom FieldValue 2 = $aRegs [1];
1882           }   1883           }
1883     1884  
1884           // $sCustomFi eldValue2  = process_ db_input(  $_REQUEST[ 'CustomFie ldValue2']  );   1885           // $sCustomFi eldValue2  = process_ db_input(  $_REQUEST[ 'CustomFie ldValue2']  );
1885           $s SubDspStyl e = ($sCat egorySub!= "")?'':'no ne';   1886           $s SubDspStyl e = ($sCat egorySub!= "")?'':'no ne';
1886     1887  
1887           $s Categories C = _t('_C ategories' );   1888           $s Categories C = _t('_C ategories' );
1888           $s CountryC =  _t('_Coun try');   1889           $s CountryC =  _t('_Coun try');
1889           $s KeywordsC  = _t('_Key words');   1890           $s KeywordsC  = _t('_Key words');
1890           $s ApplyC = _ t('_Apply' );   1891           $s ApplyC = _ t('_Apply' );
1891           $s ResetC = _ t('_Reset' );   1892           $s ResetC = _ t('_Reset' );
1892           $s FilterC =  _t('_Filte r');   1893           $s FilterC =  _t('_Filte r');
1893     1894  
1894           $s Classified sOptions =  '';   1895           $s Classified sOptions =  '';
1895           $v SqlRes = $ this -> Ge tDataOfCls ();   1896           $v SqlRes = $ this -> Ge tDataOfCls ();
1896           if  (mysql_af fected_row s()==-1)   1897           if  (mysql_af fected_row s()==-1)
1897                return $ this -> Ge tSQLError( "");   1898                return $ this -> Ge tSQLError( "");
1898     1899  
1899           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {   1900           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {
1900                $sClassi fiedsOptio ns .= "<op tion value =\"{$aSqlR esStr['ID' ]}\"".(($a SqlResStr[ 'ID']==$iC lassifiedI D)?" selec ted":'')." >{$aSqlRes Str['Name' ]}</option >\n";   1901                $sClassi fiedsOptio ns .= "<op tion value =\"{$aSqlR esStr['ID' ]}\"".(($a SqlResStr[ 'ID']==$iC lassifiedI D)?" selec ted":'')." >{$aSqlRes Str['Name' ]}</option >\n";
1901           }   1902           }
1902     1903  
1903           /* $sCountryI nfos = '';   1904           /* $sCountryI nfos = '';
1904           $s QueryC = " SELECT `IS O2` AS 'ID ', `Countr y` AS 'Nam e' FROM `C ountries`" ;   1905           $s QueryC = " SELECT `IS O2` AS 'ID ', `Countr y` AS 'Nam e' FROM `C ountries`" ;
1905     1906  
1906           $v SqlResC =  db_res ($s QueryC);   1907           $v SqlResC =  db_res ($s QueryC);
1907           if  (mysql_af fected_row s()==-1)   1908           if  (mysql_af fected_row s()==-1)
1908                return $ this -> Ge tSQLError( $sQueryC);   1909                return $ this -> Ge tSQLError( $sQueryC);
1909     1910  
1910           wh ile( $sqlR esStrC = m ysql_fetch _assoc($vS qlResC) )  {   1911           wh ile( $sqlR esStrC = m ysql_fetch _assoc($vS qlResC) )  {
1911                $sCountr yInfos .=  "<option v alue=\"{$s qlResStrC[ 'ID']}\"". (($sqlResS trC['ID']= =$sCountry )?" select ed":'')."> {$sqlResSt rC['Name'] }</option> \n";   1912                $sCountr yInfos .=  "<option v alue=\"{$s qlResStrC[ 'ID']}\"". (($sqlResS trC['ID']= =$sCountry )?" select ed":'')."> {$sqlResSt rC['Name'] }</option> \n";
1912           }* /   1913           }* /
1913     1914  
1914           $s CountryOpt ions = '';   1915           $s CountryOpt ions = '';
1915           $s SelCountry  = $sCount ry;   1916           $s SelCountry  = $sCount ry;
1916           fo reach ( $a PreValues[ 'Country']  as $key = > $value )  {   1917           fo reach ( $a PreValues[ 'Country']  as $key = > $value )  {
1917                $sCountr ySelected  = ( $sSelC ountry ==  $key ) ? ' selected=" selected"'  : '';   1918                $sCountr ySelected  = ( $sSelC ountry ==  $key ) ? ' selected=" selected"'  : '';
1918                $sCountr yOptions . = "<option  value=\"{ $key}\" ".  $sCountry Selected . " >". _t($ value['LKe y']) ."</o ption>";   1919                $sCountr yOptions . = "<option  value=\"{ $key}\" ".  $sCountry Selected . " >". _t($ value['LKe y']) ."</o ption>";
1919           }   1920           }
1920     1921  
1921           $s CF1DispSty le = ($sCu stomFieldC aption1!=" ")?'':'non e';   1922           $s CF1DispSty le = ($sCu stomFieldC aption1!=" ")?'':'non e';
1922           $s CF2DispSty le = ($sCu stomFieldC aption2!=" ")?'':'non e';   1923           $s CF2DispSty le = ($sCu stomFieldC aption2!=" ")?'':'non e';
1923           $s KeywordsSt r = (($sKe ywords!='' )?"{$sKeyw ords}":'') ;   1924           $s KeywordsSt r = (($sKe ywords!='' )?"{$sKeyw ords}":'') ;
1924           $s Categ = '' ;   1925           $s Categ = '' ;
1925           $s SubCateg =  '';   1926           $s SubCateg =  '';
1926           if  ($iClassi fiedID==-1  AND $iSub Classified ID==-1) {   1927           if  ($iClassi fiedID==-1  AND $iSub Classified ID==-1) {
1927                $sOnChan ge = ($iCl assifiedID ==-1) ? "o nChange=\" UpdateList Common('Re loadClassi fiedsAndCu stomsField s', 'Filte rSubCat',  'IDClassif ied', this .value, 'C ustomField Caption1',  'CustomFi eldCaption 2', 'unit' );\"" : "" ;   1928                $sOnChan ge = ($iCl assifiedID ==-1) ? "o nChange=\" UpdateList Common('Re loadClassi fiedsAndCu stomsField s', 'Filte rSubCat',  'IDClassif ied', this .value, 'C ustomField Caption1',  'CustomFi eldCaption 2', 'unit' );\"" : "" ;
1928                $sCateg  = <<<EOF   1929                $sCateg  = <<<EOF
1929   <td class= "w50_fs8">   1930   <td class= "w50_fs8">
1930       <b>{$s Categories C}:</b>   1931       <b>{$s Categories C}:</b>
1931       <div>   1932       <div>
1932           <s elect name ="FilterCa t" id="Fil terCat" {$ sOnChange}  style="wi dth:250px; ">   1933           <s elect name ="FilterCa t" id="Fil terCat" {$ sOnChange}  style="wi dth:250px; ">
1933                <option  value="-1" >VIEW ALL< /option>   1934                <option  value="-1" >VIEW ALL< /option>
1934                {$sClass ifiedsOpti ons}   1935                {$sClass ifiedsOpti ons}
1935           </ select>   1936           </ select>
1936       </div>   1937       </div>
1937   </td>   1938   </td>
1938   EOF;   1939   EOF;
1939     1940  
1940                $sSubCat eg = <<<EO F   1941                $sSubCat eg = <<<EO F
1941   <tr id="tr 0">   1942   <tr id="tr 0">
1942       <td cl ass="w50_f s8">   1943       <td cl ass="w50_f s8">
1943           <d iv>   1944           <d iv>
1944                <select  name="Filt erSubCat"  id="Filter SubCat" st yle="displ ay:{$sSubD spStyle};" >   1945                <select  name="Filt erSubCat"  id="Filter SubCat" st yle="displ ay:{$sSubD spStyle};" >
1945                </select >   1946                </select >
1946                <input i d="unit" t ype="text"  value=""  size="3" m axlength=" 8" style=" display:no ne;" />   1947                <input i d="unit" t ype="text"  value=""  size="3" m axlength=" 8" style=" display:no ne;" />
1947           </ div>   1948           </ div>
1948       </td>   1949       </td>
1949   </tr>   1950   </tr>
1950   EOF;   1951   EOF;
1951           }   1952           }
1952     1953  
1953           if  ($iClassi fiedID !=  -1) {   1954           if  ($iClassi fiedID !=  -1) {
1954                $sCateg  .= '<input  type="hid den" name= "FilterCat " value="' .$iClassif iedID.'" / >'; $sSubC ateg='';   1955                $sCateg  .= '<input  type="hid den" name= "FilterCat " value="' .$iClassif iedID.'" / >'; $sSubC ateg='';
1955           }   1956           }
1956           if  ($iSubCla ssifiedID  != -1) {   1957           if  ($iSubCla ssifiedID  != -1) {
1957                $sCateg  .= '<input  type="hid den" name= "FilterSub Cat" value ="'.$iSubC lassifiedI D.'" />';  $sSubCateg ='';   1958                $sCateg  .= '<input  type="hid den" name= "FilterSub Cat" value ="'.$iSubC lassifiedI D.'" />';  $sSubCateg ='';
1958           }   1959           }
1959     1960  
1960           $s RetHtml =  <<<EOF   1961           $s RetHtml =  <<<EOF
1961   <form acti on="{$this  -> sCurrB rowsedFile }" method= "get" name ="filter_f orm" OnSub mit="Updat eFieldByIn nerHtml('C ustomField Caption_1' ,'CustomFi eldCaption 1');Update FieldByInn erHtml('Cu stomFieldC aption_2', 'CustomFie ldCaption2 ');return  true;">   1962   <form acti on="{$this  -> sCurrB rowsedFile }" method= "get" name ="filter_f orm" OnSub mit="Updat eFieldByIn nerHtml('C ustomField Caption_1' ,'CustomFi eldCaption 1');Update FieldByInn erHtml('Cu stomFieldC aption_2', 'CustomFie ldCaption2 ');return  true;">
1962       <table  style="ma rgin-botto m:10px;">   1963       <table  style="ma rgin-botto m:10px;">
1963           <t r>   1964           <t r>
1964                {$sCateg }   1965                {$sCateg }
1965                <td clas s="w50_fs8 ">   1966                <td clas s="w50_fs8 ">
1966                    <b>{ $sCountryC }:</b>   1967                    <b>{ $sCountryC }:</b>
1967                    <div >   1968                    <div >
1968                         <select na me="Filter Country" i d="FilterC ountry">   1969                         <select na me="Filter Country" i d="FilterC ountry">
1969                             <optio n value="- 1">{$sAnyC }</option>   1970                             <optio n value="- 1">{$sAnyC }</option>
1970                             {$sCou ntryOption s}   1971                             {$sCou ntryOption s}
1971                         </select>   1972                         </select>
1972                    </di v>   1973                    </di v>
1973                </td>   1974                </td>
1974           </ tr>   1975           </ tr>
1975           {$ sSubCateg}   1976           {$ sSubCateg}
1976           <t r id="tr1"  style="di splay:{$sC F1DispStyl e};height: 30px;">   1977           <t r id="tr1"  style="di splay:{$sC F1DispStyl e};height: 30px;">
1977                <td clas s="w50_fs8 " id="Cust omFieldCap tion1">{$s CustomFiel dCaption1} </td>   1978                <td clas s="w50_fs8 " id="Cust omFieldCap tion1">{$s CustomFiel dCaption1} </td>
1978                <td clas s="w50_fs8 "><input t ype="text"  name="Cus tomFieldVa lue1" valu e="{$sCust omFieldVal ue1}" /></ td>   1979                <td clas s="w50_fs8 "><input t ype="text"  name="Cus tomFieldVa lue1" valu e="{$sCust omFieldVal ue1}" /></ td>
1979           </ tr>   1980           </ tr>
1980           <t r id="tr2"  style="di splay:{$sC F2DispStyl e};height: 30px;">   1981           <t r id="tr2"  style="di splay:{$sC F2DispStyl e};height: 30px;">
1981                <td clas s="w50_fs8 " id="Cust omFieldCap tion2">{$s CustomFiel dCaption2} </td>   1982                <td clas s="w50_fs8 " id="Cust omFieldCap tion2">{$s CustomFiel dCaption2} </td>
1982                <td clas s="w50_fs8 "><input t ype="text"  name="Cus tomFieldVa lue2" valu e="{$sCust omFieldVal ue2}" /></ td>   1983                <td clas s="w50_fs8 "><input t ype="text"  name="Cus tomFieldVa lue2" valu e="{$sCust omFieldVal ue2}" /></ td>
1983           </ tr>   1984           </ tr>
1984           <t r>   1985           <t r>
1985                <td clas s="w50_fs8 ">   1986                <td clas s="w50_fs8 ">
1986                    <b>{ $sKeywords C}:</b>   1987                    <b>{ $sKeywords C}:</b>
1987                    <div >   1988                    <div >
1988                         <input typ e="text" v alue="{$sK eywordsStr }" id="Fil terKeyword s" name="F ilterKeywo rds"/>   1989                         <input typ e="text" v alue="{$sK eywordsStr }" id="Fil terKeyword s" name="F ilterKeywo rds"/>
1989                    </di v>   1990                    </di v>
1990                </td>   1991                </td>
1991                <td clas s="w50_fs8 ">   1992                <td clas s="w50_fs8 ">
1992                    <div  class="fr ">   1993                    <div  class="fr ">
1993                         <input typ e="hidden"  value=""  id="Custom FieldCapti on_1" name ="CustomFi eldCaption 1" />   1994                         <input typ e="hidden"  value=""  id="Custom FieldCapti on_1" name ="CustomFi eldCaption 1" />
1994                         <input typ e="hidden"  value=""  id="Custom FieldCapti on_2" name ="CustomFi eldCaption 2" />   1995                         <input typ e="hidden"  value=""  id="Custom FieldCapti on_2" name ="CustomFi eldCaption 2" />
1995                         <input typ e="hidden"  name="act ion" value ="3"/>   1996                         <input typ e="hidden"  name="act ion" value ="3"/>
1996                         <input typ e="submit"  class="cu r_pnt" val ue="{$sApp lyC} {$sFi lterC}" na me="butAct ion"/>   1997                         <input typ e="submit"  class="cu r_pnt" val ue="{$sApp lyC} {$sFi lterC}" na me="butAct ion"/>
1997                         <input typ e="button"  class="cu r_pnt" val ue="{$sRes etC} {$sFi lterC}" na me="action " onclick= "reset();  FilterRese t(); retur n false;"  />   1998                         <input typ e="button"  class="cu r_pnt" val ue="{$sRes etC} {$sFi lterC}" na me="action " onclick= "reset();  FilterRese t(); retur n false;"  />
1998                    </di v>   1999                    </di v>
1999                </td>   2000                </td>
2000           </ tr>   2001           </ tr>
2001       </tabl e>   2002       </tabl e>
2002   </form>   2003   </form>
2003   EOF;   2004   EOF;
2004           re turn $sRet Html;   2005           re turn $sRet Html;
2005       }   2006       }
2006     2007  
2007       /**   2008       /**
2008        * Gen erate arra y of filte red Advert isements   2009        * Gen erate arra y of filte red Advert isements
2009        *   2010        *
2010        * @re turn HTML  presentati on of data   2011        * @re turn HTML  presentati on of data
2011        */   2012        */
2012       functi on PrintFi lteredAllA dvertiseme nts() {   2013       functi on PrintFi lteredAllA dvertiseme nts() {
2013           gl obal $site ;   2014           gl obal $site ;
2014           gl obal $aPre Values;   2015           gl obal $aPre Values;
2015           $s RetHtml =  '';   2016           $s RetHtml =  '';
2016     2017  
2017           $s Category =  (int)proc ess_db_inp ut( $_REQU EST['Filte rCat'] );   2018           $s Category =  (int)proc ess_db_inp ut( $_REQU EST['Filte rCat'] );
2018           $s SubCategor y = (int)p rocess_db_ input( $_R EQUEST['Fi lterSubCat '] );   2019           $s SubCategor y = (int)p rocess_db_ input( $_R EQUEST['Fi lterSubCat '] );
2019           $s Country =  process_db _input( $_ REQUEST['F ilterCount ry'] );   2020           $s Country =  process_db _input( $_ REQUEST['F ilterCount ry'] );
2020           $s Keywords =  process_d b_input( $ _REQUEST[' FilterKeyw ords'] );   2021           $s Keywords =  process_d b_input( $ _REQUEST[' FilterKeyw ords'] );
2021     2022  
2022           if  ($sSubCat egory<=0)  {   2023           if  ($sSubCat egory<=0)  {
2023                 return   MsgBox(_t( '
SubCategor y   is   required') );
  2024                 return   MsgBox(_t( ' _ SubCategor y   is   required') );
2024           }   2025           }
2025     2026  
2026           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value1'] ) , $aRegs))  {   2027           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value1'] ) , $aRegs))  {
2027                $sCustom FieldValue 1 = $aRegs [1];   2028                $sCustom FieldValue 1 = $aRegs [1];
2028           }   2029           }
2029           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value2'] ) , $aRegs))  {   2030           if  (ereg ("( [0-9]+)",  process_db _input( $_ REQUEST['C ustomField Value2'] ) , $aRegs))  {
2030                $sCustom FieldValue 2 = $aRegs [1];   2031                $sCustom FieldValue 2 = $aRegs [1];
2031           }   2032           }
2032     2033  
2033           $s CustomFiel dCaption1  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption1 '] );   2034           $s CustomFiel dCaption1  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption1 '] );
2034           $s CustomFiel dCaption2  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption2 '] );   2035           $s CustomFiel dCaption2  = process_ db_input(  $_REQUEST[ 'CustomFie ldCaption2 '] );
2035           $s CustAction 1 = "";   2036           $s CustAction 1 = "";
2036           $s CustAction 2 = "";   2037           $s CustAction 2 = "";
2037     2038  
2038           if  ($sCustom FieldCapti on1 != ''  and $sCust omFieldCap tion1!='Na N') $sCust Action1 =  mb_substr( html_entit y_decode($ sCustomFie ldCaption1 ), 0, 3);   2039           if  ($sCustom FieldCapti on1 != ''  and $sCust omFieldCap tion1!='Na N') $sCust Action1 =  mb_substr( html_entit y_decode($ sCustomFie ldCaption1 ), 0, 3);
2039           if  ($sCustom FieldCapti on2 != ''  and $sCust omFieldCap tion2!='Na N') $sCust Action2 =  mb_substr( html_entit y_decode($ sCustomFie ldCaption2 ), 0, 3);   2040           if  ($sCustom FieldCapti on2 != ''  and $sCust omFieldCap tion2!='Na N') $sCust Action2 =  mb_substr( html_entit y_decode($ sCustomFie ldCaption2 ), 0, 3);
2040     2041  
2041           $a AllowActio ns = array ('<', '>',  '=');   2042           $a AllowActio ns = array ('<', '>',  '=');
2042           sw itch ($sCu stAction1)  {   2043           sw itch ($sCu stAction1)  {
2043                case 'Ma x': $sCust Action1='< '; break;   2044                case 'Ma x': $sCust Action1='< '; break;
2044                case 'Mi n': $sCust Action1='> '; break;   2045                case 'Mi n': $sCust Action1='> '; break;
2045                case 'Eq u': $sCust Action1='= '; break;   2046                case 'Eq u': $sCust Action1='= '; break;
2046           }   2047           }
2047           sw itch ($sCu stAction2)  {   2048           sw itch ($sCu stAction2)  {
2048                case 'Ma x': $sCust Action2='< '; break;   2049                case 'Ma x': $sCust Action2='< '; break;
2049                case 'Mi n': $sCust Action2='> '; break;   2050                case 'Mi n': $sCust Action2='> '; break;
2050                case 'Eq u': $sCust Action2='= '; break;   2051                case 'Eq u': $sCust Action2='= '; break;
2051           }   2052           }
2052     2053  
2053           $s CategoryCa t = ($sCat egory > 0) ?"`Classif iedsSubs`. `IDClassif ied` = '{$ sCategory} '" : '';   2054           $s CategoryCa t = ($sCat egory > 0) ?"`Classif iedsSubs`. `IDClassif ied` = '{$ sCategory} '" : '';
2054           $s SubCategor yCat = ($s SubCategor y > 0)?"`C lassifieds Subs`.`ID`  = '{$sSub Category}' ": '';   2055           $s SubCategor yCat = ($s SubCategor y > 0)?"`C lassifieds Subs`.`ID`  = '{$sSub Category}' ": '';
2055           $s CountryCat  = ($sCoun try == '-1 ')?'':"`Pr ofiles`.`C ountry`='{ $sCountry} '";   2056           $s CountryCat  = ($sCoun try == '-1 ')?'':"`Pr ofiles`.`C ountry`='{ $sCountry} '";
2056           $s KeywordCat  = ($sKeyw ords == '' )?'':"(`Cl assifiedsA dvertiseme nts`.`Subj ect` LIKE  '%{$sKeywo rds}%' OR  `Classifie dsAdvertis ements`.`M essage` LI KE '%{$sKe ywords}%') ";   2057           $s KeywordCat  = ($sKeyw ords == '' )?'':"(`Cl assifiedsA dvertiseme nts`.`Subj ect` LIKE  '%{$sKeywo rds}%' OR  `Classifie dsAdvertis ements`.`M essage` LI KE '%{$sKe ywords}%') ";
2057           $s Custom1Cat  = (in_arr ay($sCustA ction1, $a AllowActio ns)==false  OR $sCust omFieldVal ue1 == '') ?'':"CAST( `Classifie dsAdvertis ements`.`C ustomField Value1`AS  UNSIGNED)  {$sCustAct ion1} {$sC ustomField Value1}";   2058           $s Custom1Cat  = (in_arr ay($sCustA ction1, $a AllowActio ns)==false  OR $sCust omFieldVal ue1 == '') ?'':"CAST( `Classifie dsAdvertis ements`.`C ustomField Value1`AS  UNSIGNED)  {$sCustAct ion1} {$sC ustomField Value1}";
2058           $s Custom2Cat  = (in_arr ay($sCustA ction2, $a AllowActio ns)==false  OR $sCust omFieldVal ue2 == '') ?'':"CAST( `Classifie dsAdvertis ements`.`C ustomField Value2`AS  UNSIGNED)  {$sCustAct ion2} {$sC ustomField Value2}";   2059           $s Custom2Cat  = (in_arr ay($sCustA ction2, $a AllowActio ns)==false  OR $sCust omFieldVal ue2 == '') ?'':"CAST( `Classifie dsAdvertis ements`.`C ustomField Value2`AS  UNSIGNED)  {$sCustAct ion2} {$sC ustomField Value2}";
2059     2060  
2060           $a Wheres = a rray($sCat egoryCat,  $sSubCateg oryCat, $s CountryCat , $sKeywor dCat, $sCu stom1Cat,  $sCustom2C at);   2061           $a Wheres = a rray($sCat egoryCat,  $sSubCateg oryCat, $s CountryCat , $sKeywor dCat, $sCu stom1Cat,  $sCustom2C at);
2061     2062  
2062           $s Query = "   2063           $s Query = "
2063                FROM `Cl assifiedsA dvertiseme nts`   2064                FROM `Cl assifiedsA dvertiseme nts`
2064                INNER JO IN `Classi fiedsSubs`   2065                INNER JO IN `Classi fiedsSubs`
2065                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)   2066                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)
2066                INNER JO IN `Classi fieds`   2067                INNER JO IN `Classi fieds`
2067                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)   2068                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)
2068                LEFT JOI N `Profile s`   2069                LEFT JOI N `Profile s`
2069                ON (`Cla ssifiedsAd vertisemen ts`.`IDPro file`=`Pro files`.`ID `)   2070                ON (`Cla ssifiedsAd vertisemen ts`.`IDPro file`=`Pro files`.`ID `)
2070                WHERE   2071                WHERE
2071                DATE_ADD (`Classifi edsAdverti sements`.` DateTime`,  INTERVAL  `Classifie dsAdvertis ements`.`L ifeTime` D AY) > NOW( )";   2072                DATE_ADD (`Classifi edsAdverti sements`.` DateTime`,  INTERVAL  `Classifie dsAdvertis ements`.`L ifeTime` D AY) > NOW( )";
2072     2073  
2073           fo reach ($aW heres as $ val) {   2074           fo reach ($aW heres as $ val) {
2074                $sQuery. =($val=='' )?'':" AND  ".$val;   2075                $sQuery. =($val=='' )?'':" AND  ".$val;
2075           }   2076           }
2076           $s Query.=" O RDER BY `C lassifieds Advertisem ents`.`Dat eTime` ";   2077           $s Query.=" O RDER BY `C lassifieds Advertisem ents`.`Dat eTime` ";
2077     2078  
2078           // ////////// ////////// //////   2079           // ////////// ////////// //////
2079           $s QueryCnt =  "SELECT C OUNT( `Cla ssifiedsAd vertisemen ts`.`ID` )  AS 'Cnt'  ".$sQuery;   2080           $s QueryCnt =  "SELECT C OUNT( `Cla ssifiedsAd vertisemen ts`.`ID` )  AS 'Cnt'  ".$sQuery;
2080     2081  
2081           $a TotalNum =  db_arr( $ sQueryCnt  );   2082           $a TotalNum =  db_arr( $ sQueryCnt  );
2082           $i TotalNum =  $aTotalNu m['Cnt'];   2083           $i TotalNum =  $aTotalNu m['Cnt'];
2083           if ( !$iTotal Num ) {   2084           if ( !$iTotal Num ) {
2084                return M sgBox(_t(  '_Sorry, n othing fou nd' ));   2085                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
2085           }   2086           }
2086     2087  
2087           $i PerPage =  (int)$_GET ['per_page '];   2088           $i PerPage =  (int)$_GET ['per_page '];
2088           if ( !$iPerPa ge )   2089           if ( !$iPerPa ge )
2089                $iPerPag e = $this- >iPerPageE lements;   2090                $iPerPag e = $this- >iPerPageE lements;
2090           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   2091           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
2091     2092  
2092           $i CurPage =  (int)$_GET ['page'];   2093           $i CurPage =  (int)$_GET ['page'];
2093     2094  
2094           if ( $iCurPag e > $iTota lPages )   2095           if ( $iCurPag e > $iTota lPages )
2095                $iCurPag e = $iTota lPages;   2096                $iCurPag e = $iTota lPages;
2096     2097  
2097           if ( $iCurPag e < 1 )   2098           if ( $iCurPag e < 1 )
2098                $iCurPag e = 1;   2099                $iCurPag e = 1;
2099     2100  
2100           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   2101           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
2101           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;   2102           $s qlLimit =  "LIMIT $sL imitFrom,  $iPerPage" ;
2102           // ////////// ////////// //////   2103           // ////////// ////////// //////
2103     2104  
2104            $sQuery   =   "SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Date Time`))   AS   'sec'  
".$sQuery. $sqlLimit;
  2105            $sQuery   =   "SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Date Time`))   AS   'sec' ,   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`)   AS   'DateTime_ UTS'   ".$sQuery. $sqlLimit;
2105     2106  
2106           $v SqlRes = d b_res ($sQ uery);   2107           $v SqlRes = d b_res ($sQ uery);
2107           if  (mysql_af fected_row s()==-1)   2108           if  (mysql_af fected_row s()==-1)
2108                return $ this -> Ge tSQLError( $sQuery);   2109                return $ this -> Ge tSQLError( $sQuery);
2109           if  (mysql_af fected_row s()>0) {   2110           if  (mysql_af fected_row s()>0) {
2110     2111  
2111                $sFilter edC = _t(' _Filtered' );   2112                $sFilter edC = _t(' _Filtered' );
2112                $sListin gC = _t('_ Listing');   2113                $sListin gC = _t('_ Listing');
2113                $sOutC =  _t('_out' );   2114                $sOutC =  _t('_out' );
2114                $sOfC =  _t('_of');   2115                $sOfC =  _t('_of');
2115     2116  
2116                $sContSt rs = '';   2117                $sContSt rs = '';
2117                while( $ aSqlResStr A = mysql_ fetch_asso c($vSqlRes ) ) {   2118                while( $ aSqlResStr A = mysql_ fetch_asso c($vSqlRes ) ) {
2118                    $sCo ntStrs .=  $this -> C omposeResu ltStringAd v($aSqlRes StrA);   2119                    $sCo ntStrs .=  $this -> C omposeResu ltStringAd v($aSqlRes StrA);
2119                }   2120                }
2120     2121  
2121                //////// ////////// /////////   2122                //////// ////////// /////////
2122                if( $iTo talPages >  1)   2123                if( $iTo talPages >  1)
2123                {   2124                {
2124                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   2125                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
2125                    $aFi elds = arr ay( 'actio n', 'Filte rCat', 'Fi lterSubCat ', 'Filter Country',  'FilterKey words', 'C ustomField Value1', ' CustomFiel dValue2',  'CustomFie ldCaption1 ', 'Custom FieldCapti on2' );   2126                    $aFi elds = arr ay( 'actio n', 'Filte rCat', 'Fi lterSubCat ', 'Filter Country',  'FilterKey words', 'C ustomField Value1', ' CustomFiel dValue2',  'CustomFie ldCaption1 ', 'Custom FieldCapti on2' );
2126                       2127                    
2127                    fore ach( $aFie lds as $fi eld )   2128                    fore ach( $aFie lds as $fi eld )
2128                         if( isset(  $_GET[$fi eld] ) )   2129                         if( isset(  $_GET[$fi eld] ) )
2129                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );   2130                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );
2130                       2131                    
2131                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':   2132                    $pag ination =  '<div styl e="text-al ign: cente r; positio n: relativ e;">'._t(" _Results p er page"). ':
2132                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >   2133                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >
2133                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   2134                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
2134                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   2135                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
2135                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   2136                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
2136                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   2137                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
2137                             </sele ct></div>'  .   2138                             </sele ct></div>'  .
2138                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );   2139                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );
2139                }   2140                }
2140                else   2141                else
2141                    $pag ination =  '';   2142                    $pag ination =  '';
2142                //////// ////////// /////////   2143                //////// ////////// /////////
2143     2144  
2144                $sRetHtm l .= Desig nBoxConten t ( _t('_S EARCH_RESU LT_H'), $s ContStrs.  $paginatio n, 1);   2145                $sRetHtm l .= Desig nBoxConten t ( _t('_S EARCH_RESU LT_H'), $s ContStrs.  $paginatio n, 1);
2145           }   2146           }
2146           el se {   2147           el se {
2147                $sRetHtm l .= '<div >No listin g..</div>' ;   2148                $sRetHtm l .= '<div >No listin g..</div>' ;
2148           }   2149           }
2149           re turn $sRet Html;   2150           re turn $sRet Html;
2150       }   2151       }
2151     2152  
2152       /**   2153       /**
2153        * Gen erate comp osed table  element o f Advertis ement   2154        * Gen erate comp osed table  element o f Advertis ement
2154        *   2155        *
2155        * @pa ram $aSqlR esStrA  SQ L result s tring of A dvertiseme nt   2156        * @pa ram $aSqlR esStrA  SQ L result s tring of A dvertiseme nt
2156        * @re turn HTML  presentati on of data   2157        * @re turn HTML  presentati on of data
2157        */   2158        */
2158       functi on Compose ResultStri ngAdv($aSq lResStrA,  $bVeryShor tView=FALS E) {   2159       functi on Compose ResultStri ngAdv($aSq lResStrA,  $bVeryShor tView=FALS E) {
2159           gl obal $aPre Values;   2160           gl obal $aPre Values;
2160           gl obal $site ;   2161           gl obal $site ;
2161     2162  
2162           $s ActivateC  = _t('_Act ivate');   2163           $s ActivateC  = _t('_Act ivate');
2163           $s DeleteC =  _t('_Delet e');   2164           $s DeleteC =  _t('_Delet e');
2164           $s EditC = _t ('_Edit');   2165           $s EditC = _t ('_Edit');
2165           $s SbjN = _t( '_Subject' );   2166           $s SbjN = _t( '_Subject' );
2166           $s PostedByC  = _t('_Pos ted by');   2167           $s PostedByC  = _t('_Pos ted by');
2167           $s DateC = _t ('_Date');   2168           $s DateC = _t ('_Date');
2168           $s LocationC  = _t('_Loc ation');   2169           $s LocationC  = _t('_Loc ation');
2169           $s AdminLocal AreaC = _t ('_AdminAr ea');   2170           $s AdminLocal AreaC = _t ('_AdminAr ea');
2170           $s AdminC = _ t('_Admin' );   2171           $s AdminC = _ t('_Admin' );
2171           $s SureC = _t ("_Are you  sure");   2172           $s SureC = _t ("_Are you  sure");
2172           $s TimeAgo =  _format_wh en($aSqlRe sStrA['sec ']);   2173           $s TimeAgo =  _format_wh en($aSqlRe sStrA['sec ']);
2173     2174  
2174           $i ID = $aSql ResStrA['I D'];   2175           $i ID = $aSql ResStrA['I D'];
2175     2176  
2176           $i IDProfile  = $aSqlRes StrA['IDPr ofile'];   2177           $i IDProfile  = $aSqlRes StrA['IDPr ofile'];
2177     2178  
2178           $s ImageCode  = $this ->  getBigIma geCode($aS qlResStrA[ 'Media'],  $iID);   2179           $s ImageCode  = $this ->  getBigIma geCode($aS qlResStrA[ 'Media'],  $iID);
    2180           $s DataTimeFo rmatted =  LocaledDat aTime($aSq lResStrA[' DateTime_U TS']);
2179     2181  
2180           $s DelAbil='& nbsp;';   2182           $s DelAbil='& nbsp;';
2181     2183  
2182           if  ($this ->  bAdminMod e == false ) {   2184           if  ($this ->  bAdminMod e == false ) {
2183                //$iMemb erID = (in t)$_COOKIE ['memberID '];   2185                //$iMemb erID = (in t)$_COOKIE ['memberID '];
2184                $iMember ID = ($log ged['membe r']) ? (in t)$_COOKIE ['memberID '] : 0;   2186                $iMember ID = ($log ged['membe r']) ? (in t)$_COOKIE ['memberID '] : 0;
2185                if (($th is->bAdmin Mode==true  OR $iMemb erID!=0) A ND $iIDPro file==$iMe mberID) {/ /ability t o delete A dv for own er   2187                if (($th is->bAdmin Mode==true  OR $iMemb erID!=0) A ND $iIDPro file==$iMe mberID) {/ /ability t o delete A dv for own er
2186                    $sDe lAbil .= < <<EOF   2188                    $sDe lAbil .= < <<EOF
2187   <a href="{ $this -> s CurrBrowse dFile}" on click="if  (confirm(' {$sSureC}' )) { Updat eField('De leteAdvert isementID' ,{$iID});d ocument.fo rms.comman d_delete_a dvertiseme nt.submit( ); } retur n false;"> {$sDeleteC }</a>   2189   <a href="{ $this -> s CurrBrowse dFile}" on click="if  (confirm(' {$sSureC}' )) { Updat eField('De leteAdvert isementID' ,{$iID});d ocument.fo rms.comman d_delete_a dvertiseme nt.submit( ); } retur n false;"> {$sDeleteC }</a>
2188   <a href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' EditAdvert isementID' ,{$iID});  document.f orms.comma nd_edit_ad vertisemen t.submit() ; return f alse;">{$s EditC}</a>   2190   <a href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' EditAdvert isementID' ,{$iID});  document.f orms.comma nd_edit_ad vertisemen t.submit() ; return f alse;">{$s EditC}</a>
2189   EOF;   2191   EOF;
2190                }   2192                }
2191           }  elseif ($t his -> bAd minMode==t rue) {   2193           }  elseif ($t his -> bAd minMode==t rue) {
2192                //abilit y to Activ ate/Delete /Edite adv   2194                //abilit y to Activ ate/Delete /Edite adv
2193                $sActiva teAbil = ( $aSqlResSt rA['Status ']=='activ e') ? '' :  <<<EOF   2195                $sActiva teAbil = ( $aSqlResSt rA['Status ']=='activ e') ? '' :  <<<EOF
2194   <a href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' ActivateAd vertisemen tID',{$iID });documen t.forms.co mmand_acti vate_adver tisement.s ubmit(); r eturn fals e;">{$sAct ivateC}</a >&nbsp;&nb sp;   2196   <a href="{ $this -> s CurrBrowse dFile}" on click="Upd ateField(' ActivateAd vertisemen tID',{$iID });documen t.forms.co mmand_acti vate_adver tisement.s ubmit(); r eturn fals e;">{$sAct ivateC}</a >&nbsp;&nb sp;
2195   EOF;   2197   EOF;
2196     2198  
2197                $sDelAbi l = <<<EOF   2199                $sDelAbi l = <<<EOF
2198   <div class ="tar">   2200   <div class ="tar">
2199       {$sAct ivateAbil}   2201       {$sAct ivateAbil}
2200       <a hre f="{$this  -> sCurrBr owsedFile} " onclick= "if (confi rm('{$sSur eC}')) { U pdateField ('DeleteAd vertisemen tID',{$iID });documen t.forms.co mmand_dele te_adverti sement.sub mit(); } r eturn fals e;">{$sDel eteC}</a>& nbsp;&nbsp ;   2202       <a hre f="{$this  -> sCurrBr owsedFile} " onclick= "if (confi rm('{$sSur eC}')) { U pdateField ('DeleteAd vertisemen tID',{$iID });documen t.forms.co mmand_dele te_adverti sement.sub mit(); } r eturn fals e;">{$sDel eteC}</a>& nbsp;&nbsp ;
2201       <a hre f="{$this  -> sCurrBr owsedFile} " onclick= "UpdateFie ld('EditAd vertisemen tID',{$iID }); docume nt.forms.c ommand_edi t_advertis ement.subm it(); retu rn false;" >{$sEditC} </a>   2203       <a hre f="{$this  -> sCurrBr owsedFile} " onclick= "UpdateFie ld('EditAd vertisemen tID',{$iID }); docume nt.forms.c ommand_edi t_advertis ement.subm it(); retu rn false;" >{$sEditC} </a>
2202   </div>   2204   </div>
2203   EOF;   2205   EOF;
2204           }   2206           }
2205     2207  
2206           $a ProfileRes  = $this - > GetProfi leData($iI DProfile);   2208           $a ProfileRes  = $this - > GetProfi leData($iI DProfile);
2207           $s PostedBy =  ($iIDProf ile==0) ?  $sAdminC :  "<a href= \"".getPro fileLink($ iIDProfile )."\">{$aP rofileRes[ 'NickName' ]}</a>\n";   2209           $s PostedBy =  ($iIDProf ile==0) ?  $sAdminC :  "<a href= \"".getPro fileLink($ iIDProfile )."\">{$aP rofileRes[ 'NickName' ]}</a>\n";
2208           $s CountryNam e = ($aPro fileRes['C ountry']== "")?$sAdmi nLocalArea C:_t($aPre Values['Co untry'][ $ aProfileRe s['Country '] ]['LKey '] );   2210           $s CountryNam e = ($aPro fileRes['C ountry']== "")?$sAdmi nLocalArea C:_t($aPre Values['Co untry'][ $ aProfileRe s['Country '] ]['LKey '] );
2209           $s CountryPic  = ($aProf ileRes['Co untry']==' ')?'':' <i mg alt="'. $aProfileR es['Countr y'].'" src ="'.($site ['flags']. strtolower ($aProfile Res['Count ry'])).'.g if"/>';   2211           $s CountryPic  = ($aProf ileRes['Co untry']==' ')?'':' <i mg alt="'. $aProfileR es['Countr y'].'" src ="'.($site ['flags']. strtolower ($aProfile Res['Count ry'])).'.g if"/>';
2210     2212  
2211           $s CustDetail s = '';   2213           $s CustDetail s = '';
2212           $s DetailsC =  _t('_Deta ils');   2214           $s DetailsC =  _t('_Deta ils');
2213           if  ($aSqlRes StrA['Cust omFieldVal ue1'] OR $ aSqlResStr A['CustomF ieldValue2 ']) {   2215           if  ($aSqlRes StrA['Cust omFieldVal ue1'] OR $ aSqlResStr A['CustomF ieldValue2 ']) {
2214                $sCustDe tails .= " {$sDetails C}:";   2216                $sCustDe tails .= " {$sDetails C}:";
2215                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 1'])?" <di v class=\" clr3\">{$a SqlResStrA ['Unit']}  {$aSqlResS trA['Custo mFieldValu e1']}</div >":'';   2217                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 1'])?" <di v class=\" clr3\">{$a SqlResStrA ['Unit']}  {$aSqlResS trA['Custo mFieldValu e1']}</div >":'';
2216                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 1'] && $aS qlResStrA[ 'CustomFie ldValue2'] )?' - ':'' ;   2218                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 1'] && $aS qlResStrA[ 'CustomFie ldValue2'] )?' - ':'' ;
2217                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 2'])?" <di v class=\" clr3\">{$a SqlResStrA ['Unit']}  {$aSqlResS trA['Custo mFieldValu e2']}</div >":'';   2219                $sCustDe tails .= ( $aSqlResSt rA['Custom FieldValue 2'])?" <di v class=\" clr3\">{$a SqlResStrA ['Unit']}  {$aSqlResS trA['Custo mFieldValu e2']}</div >":'';
2218           }   2220           }
2219     2221  
2220           // $sDataStyl e=($bVeryS hortView)? '':' style ="margin-b ottom:10px ;"';   2222           // $sDataStyl e=($bVeryS hortView)? '':' style ="margin-b ottom:10px ;"';
2221           $s DataStyleW idth=($bVe ryShortVie w)?' style ="width:23 0px;"':'';   2223           $s DataStyleW idth=($bVe ryShortVie w)?' style ="width:23 0px;"':'';
2222     2224  
2223           $s SubjectBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF   2225           $s SubjectBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF
2224   <div class ="cls_res_ info_p">   2226   <div class ="cls_res_ info_p">
2225       {$sPos tedByC}: < div class= "clr3">{$s PostedBy}< /div>   2227       {$sPos tedByC}: < div class= "clr3">{$s PostedBy}< /div>
2226   </div>   2228   </div>
2227   EOF;   2229   EOF;
2228     2230  
2229           $s PostedByBl ock = ($bV eryShortVi ew) ? '' :  <<<EOF   2231           $s PostedByBl ock = ($bV eryShortVi ew) ? '' :  <<<EOF
2230   <div class ="cls_res_ info_p">   2232   <div class ="cls_res_ info_p">
2231       {$sPos tedByC}: < div class= "clr3">{$s PostedBy}< /div>   2233       {$sPos tedByC}: < div class= "clr3">{$s PostedBy}< /div>
2232   </div>   2234   </div>
2233   EOF;   2235   EOF;
2234     2236  
2235           $s SubjectBlo ckValue =  $aSqlResSt rA['Subjec t'];//($bV eryShortVi ew) ? mb_s ubstr($aSq lResStrA[' Subject'],  0, 15).". .." : $aSq lResStrA[' Subject'];   2237           $s SubjectBlo ckValue =  $aSqlResSt rA['Subjec t'];//($bV eryShortVi ew) ? mb_s ubstr($aSq lResStrA[' Subject'],  0, 15).". .." : $aSq lResStrA[' Subject'];
2236     2238  
2237           $s ActionsBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF   2239           $s ActionsBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF
2238   <div class ="cls_res_ info_p">   2240   <div class ="cls_res_ info_p">
2239       {$sDel Abil}   2241       {$sDel Abil}
2240   </div>   2242   </div>
2241   EOF;   2243   EOF;
2242           $s DetailsBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF   2244           $s DetailsBlo ck = ($bVe ryShortVie w) ? '' :  <<<EOF
2243   <div class ="cls_res_ info_p">   2245   <div class ="cls_res_ info_p">
2244       {$sCus tDetails}   2246       {$sCus tDetails}
2245   </div>   2247   </div>
2246   EOF;   2248   EOF;
2247           // {$sDataSty le}   2249           // {$sDataSty le}
2248     2250  
2249           $s GenUrl = $ this->genU rl($iID, $ aSqlResStr A['EntryUr i']);   2251           $s GenUrl = $ this->genU rl($iID, $ aSqlResStr A['EntryUr i']);
2250           // {$this ->  sCurrBrows edFile}?Sh owAdvertis ementID={$ iID}   2252           // {$this ->  sCurrBrows edFile}?Sh owAdvertis ementID={$ iID}
2251     2253  
2252           $s CBStyle =  ($this->bA dminMode== true) ? 'f loat:left'  : '';   2254           $s CBStyle =  ($this->bA dminMode== true) ? 'f loat:left'  : '';
2253           $s RetHtml =  <<<EOF   2255           $s RetHtml =  <<<EOF
2254   <div class ="cls_resu lt_row" st yle="{$sCB Style}">   2256   <div class ="cls_resu lt_row" st yle="{$sCB Style}">
2255       <div c lass="clea r_both"></ div>   2257       <div c lass="clea r_both"></ div>
2256       <div c lass="thum bnail_bloc k"  style= "float: le ft;">   2258       <div c lass="thum bnail_bloc k"  style= "float: le ft;">
2257           {$ sImageCode }   2259           {$ sImageCode }
2258       </div>   2260       </div>
2259       <div c lass="cls_ res_info_n owidth" {$ sDataStyle Width}>   2261       <div c lass="cls_ res_info_n owidth" {$ sDataStyle Width}>
2260           <d iv class=" cls_res_in fo_p">   2262           <d iv class=" cls_res_in fo_p">
2261                <!-- {$s SbjN}: -->   2263                <!-- {$s SbjN}: -->
2262                <a class ="actions"  href="{$s GenUrl}">   2264                <a class ="actions"  href="{$s GenUrl}">
2263                    {$sS ubjectBloc kValue}   2265                    {$sS ubjectBloc kValue}
2264                </a>   2266                </a>
2265           </ div>   2267           </ div>
2266           {$ sPostedByB lock}   2268           {$ sPostedByB lock}
2267           <d iv class=" cls_res_in fo_p">   2269           <d iv class=" cls_res_in fo_p">
2268                 {$sDateC}:   <div   class="clr 3">{$ aSqlRe s StrA[' Dat e Time '] }   ({$sTimeAg o})</div>   2270                 {$sDateC}:   <div   class="clr 3">{$
s
Dat a Time Formatted }   ({$sTimeAg o})</div>
2269           </ div>   2271           </ div>
2270           {$ sLocationB lock}   2272           {$ sLocationB lock}
2271           {$ sDetailsBl ock}   2273           {$ sDetailsBl ock}
2272           {$ sActionsBl ock}   2274           {$ sActionsBl ock}
2273       </div>   2275       </div>
2274       <div c lass="clea r_both"></ div>   2276       <div c lass="clea r_both"></ div>
2275   </div>   2277   </div>
2276   EOF;   2278   EOF;
2277           re turn $sRet Html;   2279           re turn $sRet Html;
2278       }   2280       }
2279     2281  
2280       /**   2282       /**
2281        * Com pose resul t into dis ignBoxFirs tA class   2283        * Com pose resul t into dis ignBoxFirs tA class
2282        *   2284        *
2283        * @pa ram $sCapt ion captio n of Box   2285        * @pa ram $sCapt ion captio n of Box
2284        * @pa ram $sValu e       in ner text o f box   2286        * @pa ram $sValu e       in ner text o f box
2285        * @re turn HTML  presentati on of data   2287        * @re turn HTML  presentati on of data
2286        */   2288        */
2287       
function   DecorateAs Table2($sC aption,   $sValue,   $sMargin)   {
  2289        /* function   DecorateAs Table2($sC aption,   $sValue,   $sMargin)   {
2288           $s DecTbl = < <<EOF   2290           $s DecTbl = < <<EOF
2289   <div class ="disignBo xFirstA" s tyle="{$sM argin}">   2291   <div class ="disignBo xFirstA" s tyle="{$sM argin}">
2290       <div c lass="boxF irstHeader ">{$sCapti on}</div>   2292       <div c lass="boxF irstHeader ">{$sCapti on}</div>
2291       <div c lass="boxC ontent">   2293       <div c lass="boxC ontent">
2292           <d iv class=" cls_result _wrapper">   2294           <d iv class=" cls_result _wrapper">
2293                {$sValue }   2295                {$sValue }
2294           </ div>   2296           </ div>
2295       </div>   2297       </div>
2296   </div>   2298   </div>
2297   EOF;   2299   EOF;
2298           re turn $sDec Tbl;   2300           re turn $sDec Tbl;
2299        }
  2301        } */
2300     2302  
2301       /**   2303       /**
2302        * Com pose Form  to managin g with Cla ssifieds,  subs, and  custom fie lds   2304        * Com pose Form  to managin g with Cla ssifieds,  subs, and  custom fie lds
2303        *   2305        *
2304        * @re turn HTML  presentati on of data   2306        * @re turn HTML  presentati on of data
2305        */   2307        */
2306       functi on PrintMa nageClassi fiedsForm( ) {   2308       functi on PrintMa nageClassi fiedsForm( ) {
2307           $v SqlResCls  = $this ->  GetDataOf Cls();   2309           $v SqlResCls  = $this ->  GetDataOf Cls();
2308           if  (mysql_af fected_row s()==-1)   2310           if  (mysql_af fected_row s()==-1)
2309                return $ this -> Ge tSQLError( "");   2311                return $ this -> Ge tSQLError( "");
2310     2312  
2311           $s Classified sOptions =  '';   2313           $s Classified sOptions =  '';
2312           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCls)  ) {   2314           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCls)  ) {
2313                $iID = $ aSqlResStr ['ID'];   2315                $iID = $ aSqlResStr ['ID'];
2314                $sName =  $aSqlResS tr['Name'] ;   2316                $sName =  $aSqlResS tr['Name'] ;
2315                $sClassi fiedsOptio ns .= "<op tion value =\"{$iID}\ ">{$sName} </option>\ n";   2317                $sClassi fiedsOptio ns .= "<op tion value =\"{$iID}\ ">{$sName} </option>\ n";
2316           }   2318           }
2317     2319  
2318           $s Categories C = _t('_C ategories' );   2320           $s Categories C = _t('_C ategories' );
2319           $s SubCategor iesC = _t( '_SubCateg ories');   2321           $s SubCategor iesC = _t( '_SubCateg ories');
2320           $s TitleC = _ t('_Title' );   2322           $s TitleC = _ t('_Title' );
2321           $s DescC = _t ('_Desctip tion');   2323           $s DescC = _t ('_Desctip tion');
2322           $s AddC = _t( '_Add');   2324           $s AddC = _t( '_Add');
2323           $s AddThisC =  _t('_Add  this');   2325           $s AddThisC =  _t('_Add  this');
2324           $s DeleteC =  _t('_Delet e');   2326           $s DeleteC =  _t('_Delet e');
2325           $s CustomFiel d1C = _t(' _CustomFie ld1');   2327           $s CustomFiel d1C = _t(' _CustomFie ld1');
2326           $s CustomFiel d2C = _t(' _CustomFie ld2');   2328           $s CustomFiel d2C = _t(' _CustomFie ld2');
2327           $s NameC = _t ('_Name');   2329           $s NameC = _t ('_Name');
2328           $s ActionC =  _t('_Actio n');   2330           $s ActionC =  _t('_Actio n');
2329           $s ApplyC = _ t('_Apply' );   2331           $s ApplyC = _ t('_Apply' );
2330           $s EqualC = _ t('_equal' );   2332           $s EqualC = _ t('_equal' );
2331           $s SmallerC =  _t('_smal ler');   2333           $s SmallerC =  _t('_smal ler');
2332           $s BiggerC =  _t('_bigge r');   2334           $s BiggerC =  _t('_bigge r');
2333           $s ChooseC =  _t('_choos e');   2335           $s ChooseC =  _t('_choos e');
2334           $s UnitC = _t ('_Unit');   2336           $s UnitC = _t ('_Unit');
2335     2337  
2336           $s RetHtml =  <<<EOF   2338           $s RetHtml =  <<<EOF
2337   <form acti on="{$this  -> sCurrB rowsedFile }" name="M anageClass ifiedsForm " id="Mana geClassifi edsForm" m ethod="pos t">   2339   <form acti on="{$this  -> sCurrB rowsedFile }" name="M anageClass ifiedsForm " id="Mana geClassifi edsForm" m ethod="pos t">
2338       <table  class="cl s_100_cp"  id="admin_ managing">   2340       <table  class="cl s_100_cp"  id="admin_ managing">
2339           <t r class="v c">   2341           <t r class="v c">
2340                <td clas s="cls_tbl _left_t">{ $sCategori esC}:</td>   2342                <td clas s="cls_tbl _left_t">{ $sCategori esC}:</td>
2341                <td clas s="cls_tbl _right_m">   2343                <td clas s="cls_tbl _right_m">
2342                    <div  class="fl ">   2344                    <div  class="fl ">
2343                         <select na me="Filter Cat" id="F ilterCat"  onChange=" UpdateList Common('Re loadClassi fiedsAndCu stomsField s', 'SubCl assified',  'IDClassi fied', thi s.value, ' customRow1 ', 'custom Row2', 'un it');">   2345                         <select na me="Filter Cat" id="F ilterCat"  onChange=" UpdateList Common('Re loadClassi fiedsAndCu stomsField s', 'SubCl assified',  'IDClassi fied', thi s.value, ' customRow1 ', 'custom Row2', 'un it');">
2344                             <optio n value="- 1">{$sChoo seC}</opti on>   2346                             <optio n value="- 1">{$sChoo seC}</opti on>
2345                             <optio n value="- 1">------- -----</opt ion>   2347                             <optio n value="- 1">------- -----</opt ion>
2346                             {$sCla ssifiedsOp tions}   2348                             {$sCla ssifiedsOp tions}
2347                         </select>   2349                         </select>
2348                    </di v>   2350                    </di v>
2349                    <div  class="fl " id="fiel dCadAdd">   2351                    <div  class="fl " id="fiel dCadAdd">
2350                         &nbsp;<a o nclick="Ad dCatFields ('fieldsCa t', 'field CadAdd', ' fieldsCatD el'); retu rn false;"  href="{$t his -> sCu rrBrowsedF ile}" id=" addHref">{ $sAddC}</a >&nbsp;&nb sp;&nbsp;   2352                         &nbsp;<a o nclick="Ad dCatFields ('fieldsCa t', 'field CadAdd', ' fieldsCatD el'); retu rn false;"  href="{$t his -> sCu rrBrowsedF ile}" id=" addHref">{ $sAddC}</a >&nbsp;&nb sp;&nbsp;
2351                    </di v>   2353                    </di v>
2352                    <div  id="field sCat" styl e="display :none;">   2354                    <div  id="field sCat" styl e="display :none;">
2353                         {$sTitleC} : <input t ype="text"  name="nam e1" id="na meCat" val ue="" size ="12" maxl ength="20" >   2355                         {$sTitleC} : <input t ype="text"  name="nam e1" id="na meCat" val ue="" size ="12" maxl ength="20" >
2354                         {$sDescC}:  <input ty pe="text"  name="desc ription1"  id="descCa t" value=" " size="12 " maxlengt h="50">   2356                         {$sDescC}:  <input ty pe="text"  name="desc ription1"  id="descCa t" value=" " size="12 " maxlengt h="50">
2355                         <a onclick ="UpdateFi eld('iActi on','AddMa inCategory ');documen t.forms.Ma nageClassi fiedsForm. submit();  return fal se;" id="A ddCatHref"  href="{$t his -> sCu rrBrowsedF ile}">{$sA ddC}</a>&n bsp;&nbsp; &nbsp;   2357                         <a onclick ="UpdateFi eld('iActi on','AddMa inCategory ');documen t.forms.Ma nageClassi fiedsForm. submit();  return fal se;" id="A ddCatHref"  href="{$t his -> sCu rrBrowsedF ile}">{$sA ddC}</a>&n bsp;&nbsp; &nbsp;
2356                    </di v>   2358                    </di v>
2357                    <div  id="field sCatDel" c lass="fl">   2359                    <div  id="field sCatDel" c lass="fl">
2358                         <a onclick ="UpdateFi eld('iActi on','Delet eMainCateg ory');docu ment.forms .ManageCla ssifiedsFo rm.submit( ); return  false;" hr ef="{$this  -> sCurrB rowsedFile }">{$sDele teC}</a>   2360                         <a onclick ="UpdateFi eld('iActi on','Delet eMainCateg ory');docu ment.forms .ManageCla ssifiedsFo rm.submit( ); return  false;" hr ef="{$this  -> sCurrB rowsedFile }">{$sDele teC}</a>
2359                    </di v>   2361                    </di v>
2360                </td>   2362                </td>
2361           </ tr>   2363           </ tr>
2362           <t r class="v c" id="cus tomRow1">   2364           <t r class="v c" id="cus tomRow1">
2363                <td clas s="cls_tbl _left_m">{ $sCustomFi eld1C}:</t d>   2365                <td clas s="cls_tbl _left_m">{ $sCustomFi eld1C}:</t d>
2364                <td clas s="cls_tbl _right_m"> {$sNameC}:     2366                <td clas s="cls_tbl _right_m"> {$sNameC}:  
2365                    <inp ut type="t ext" id="C ustomName1 " name="Cu stomName1"  size="25" >&nbsp;{$s ActionC}:    2367                    <inp ut type="t ext" id="C ustomName1 " name="Cu stomName1"  size="25" >&nbsp;{$s ActionC}: 
2366                    <sel ect size=" 1" id="Cus tomAction1 " name="Cu stomAction 1">   2368                    <sel ect size=" 1" id="Cus tomAction1 " name="Cu stomAction 1">
2367                         <option va lue="-1">< /option>   2369                         <option va lue="-1">< /option>
2368                         <option va lue="=">{$ sEqualC}</ option>   2370                         <option va lue="=">{$ sEqualC}</ option>
2369                         <option va lue="&gt;" >{$sBigger C}</option >   2371                         <option va lue="&gt;" >{$sBigger C}</option >
2370                         <option va lue="&lt;" >{$sSmalle rC}</optio n>   2372                         <option va lue="&lt;" >{$sSmalle rC}</optio n>
2371                    </se lect>   2373                    </se lect>
2372                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyChan ges('Apply Changes',  1);">   2374                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyChan ges('Apply Changes',  1);">
2373                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyCha nges('Dele teCustom',  1);">   2375                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyCha nges('Dele teCustom',  1);">
2374                </td>   2376                </td>
2375           </ tr>   2377           </ tr>
2376           <t r class="v c" id="cus tomRow2">   2378           <t r class="v c" id="cus tomRow2">
2377                <td clas s="cls_tbl _left_m">{ $sCustomFi eld2C}:</t d>   2379                <td clas s="cls_tbl _left_m">{ $sCustomFi eld2C}:</t d>
2378                <td clas s="cls_tbl _right_m"> {$sNameC}:     2380                <td clas s="cls_tbl _right_m"> {$sNameC}:  
2379                    <inp ut type="t ext" id="C ustomName2 " name="Cu stomName2"  size="25" >&nbsp;{$s ActionC}:    2381                    <inp ut type="t ext" id="C ustomName2 " name="Cu stomName2"  size="25" >&nbsp;{$s ActionC}: 
2380                    <sel ect size=" 1" id="Cus tomAction2 " name="Cu stomAction 2">   2382                    <sel ect size=" 1" id="Cus tomAction2 " name="Cu stomAction 2">
2381                         <option va lue="-1">< /option>   2383                         <option va lue="-1">< /option>
2382                         <option va lue="=">{$ sEqualC}</ option>   2384                         <option va lue="=">{$ sEqualC}</ option>
2383                         <option va lue="&gt;" >{$sBigger C}</option >   2385                         <option va lue="&gt;" >{$sBigger C}</option >
2384                         <option va lue="&lt;" >{$sSmalle rC}</optio n>   2386                         <option va lue="&lt;" >{$sSmalle rC}</optio n>
2385                    </se lect>   2387                    </se lect>
2386                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyChan ges('Apply Changes',  2);">   2388                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyChan ges('Apply Changes',  2);">
2387                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyCha nges('Dele teCustom',  2);">   2389                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyCha nges('Dele teCustom',  2);">
2388                </td>   2390                </td>
2389           </ tr>   2391           </ tr>
2390           <t r class="v c">   2392           <t r class="v c">
2391                <td clas s="cls_tbl _left_m">{ $sUnitC}:< /td>   2393                <td clas s="cls_tbl _left_m">{ $sUnitC}:< /td>
2392                <td clas s="cls_tbl _right_m"> {$sNameC}:     2394                <td clas s="cls_tbl _right_m"> {$sNameC}:  
2393                    <inp ut id="uni t" type="t ext" value ="" size=" 3" maxleng th="8" />   2395                    <inp ut id="uni t" type="t ext" value ="" size=" 3" maxleng th="8" />
2394                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyUnit Changes('A pplyUnitCh anges');">   2396                    <inp ut type="b utton" val ue="{$sApp lyC}" onCl ick="AdmTr yApplyUnit Changes('A pplyUnitCh anges');">
2395                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyUni tChanges(' DeleteUnit ');">   2397                    <inp ut type="b utton" val ue="{$sDel eteC}" onC lick="AdmT ryApplyUni tChanges(' DeleteUnit ');">
2396                </td>   2398                </td>
2397           </ tr>   2399           </ tr>
2398           <t r class="v c">   2400           <t r class="v c">
2399                <td clas s="cls_tbl _left_t">{ $sSubCateg oriesC}:</ td>   2401                <td clas s="cls_tbl _left_t">{ $sSubCateg oriesC}:</ td>
2400                <td clas s="cls_tbl _right_m">   2402                <td clas s="cls_tbl _right_m">
2401                    <div  class="fl ">   2403                    <div  class="fl ">
2402                         <select na me="SubCla ssified" i d="SubClas sified">   2404                         <select na me="SubCla ssified" i d="SubClas sified">
2403                         </select>   2405                         </select>
2404                    </di v>   2406                    </di v>
2405                    <div  class="fl " id="fiel dSubCadAdd ">   2407                    <div  class="fl " id="fiel dSubCadAdd ">
2406                         <a onclick ="AddCatFi elds('fiel dsSubCat',  'fieldSub CadAdd', ' fieldsSubC atDel'); r eturn fals e;" href=" {$this ->  sCurrBrows edFile}">{ $sAddC}</a >&nbsp;&nb sp;&nbsp;   2408                         <a onclick ="AddCatFi elds('fiel dsSubCat',  'fieldSub CadAdd', ' fieldsSubC atDel'); r eturn fals e;" href=" {$this ->  sCurrBrows edFile}">{ $sAddC}</a >&nbsp;&nb sp;&nbsp;
2407                    </di v>   2409                    </di v>
2408                    <div  id="field sSubCat" s tyle="disp lay:none;"  class="fl ">   2410                    <div  id="field sSubCat" s tyle="disp lay:none;"  class="fl ">
2409                         {$sTitleC} : <input t ype="text"  name="nam e2" id="na meSubCat"  value="" s ize="20" m axlength=" 128" />   2411                         {$sTitleC} : <input t ype="text"  name="nam e2" id="na meSubCat"  value="" s ize="20" m axlength=" 128" />
2410                         {$sDescC}:  <input ty pe="text"  name="desc ription2"  id="descSu bCat" valu e="" size= "20" maxle ngth="150"  />   2412                         {$sDescC}:  <input ty pe="text"  name="desc ription2"  id="descSu bCat" valu e="" size= "20" maxle ngth="150"  />
2411                         <a onclick ="UpdateFi eld('iActi on','AddSu bCategory' );document .forms.Man ageClassif iedsForm.s ubmit(); r eturn fals e;" id="Ad dSubCatHre f" href="{ $this -> s CurrBrowse dFile}">{$ sAddC}</a> &nbsp;&nbs p;&nbsp;   2413                         <a onclick ="UpdateFi eld('iActi on','AddSu bCategory' );document .forms.Man ageClassif iedsForm.s ubmit(); r eturn fals e;" id="Ad dSubCatHre f" href="{ $this -> s CurrBrowse dFile}">{$ sAddC}</a> &nbsp;&nbs p;&nbsp;
2412                    </di v>   2414                    </di v>
2413                    <div  id="field sSubCatDel " class="f l">   2415                    <div  id="field sSubCatDel " class="f l">
2414                         <a onclick ="UpdateFi eld('iActi on','Delet eSubCatego ry');docum ent.forms. ManageClas sifiedsFor m.submit() ; return f alse;" hre f="{$this  -> sCurrBr owsedFile} ">{$sDelet eC}</a>   2416                         <a onclick ="UpdateFi eld('iActi on','Delet eSubCatego ry');docum ent.forms. ManageClas sifiedsFor m.submit() ; return f alse;" hre f="{$this  -> sCurrBr owsedFile} ">{$sDelet eC}</a>
2415                    </di v>   2417                    </di v>
2416                </td>   2418                </td>
2417           </ tr>   2419           </ tr>
2418       </tabl e>   2420       </tabl e>
2419       <input  type="hid den" name= "iAction"  id="iActio n" value=" ">   2421       <input  type="hid den" name= "iAction"  id="iActio n" value=" ">
2420   </form>   2422   </form>
2421   EOF;   2423   EOF;
2422           re turn $sRet Html;   2424           re turn $sRet Html;
2423       }   2425       }
2424     2426  
2425       /**   2427       /**
2426        * Com pose table  with all  New Advert isements   2428        * Com pose table  with all  New Advert isements
2427        *   2429        *
2428        * @re turn HTML  presentati on of data   2430        * @re turn HTML  presentati on of data
2429        */   2431        */
2430       functi on PrintMo deratingTa ble() {   2432       functi on PrintMo deratingTa ble() {
2431           gl obal $site ;   2433           gl obal $site ;
2432           $s RetHtml =  '';   2434           $s RetHtml =  '';
2433     2435  
2434           $s Query = "   2436           $s Query = "
2435                SELECT ` Classified sAdvertise ments`.*,   2437                SELECT ` Classified sAdvertise ments`.*,
2436                DATE_ADD (`Classifi edsAdverti sements`.` DateTime`,  INTERVAL  `Classifie dsAdvertis ements`.`L ifeTime` D AY) < NOW( ) AS 'IsOl d',   2438                DATE_ADD (`Classifi edsAdverti sements`.` DateTime`,  INTERVAL  `Classifie dsAdvertis ements`.`L ifeTime` D AY) < NOW( ) AS 'IsOl d',
2437                `Classif ieds`.`Uni t`, (UNIX_ TIMESTAMP( ) - UNIX_T IMESTAMP(` DateTime`) ) AS `sec`   2439                `Classif ieds`.`Uni t`, (UNIX_ TIMESTAMP( ) - UNIX_T IMESTAMP(` DateTime`) ) AS `sec`
2438                FROM `Cl assifiedsA dvertiseme nts`   2440                FROM `Cl assifiedsA dvertiseme nts`
2439                INNER JO IN `Classi fiedsSubs`   2441                INNER JO IN `Classi fiedsSubs`
2440                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)   2442                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)
2441                INNER JO IN `Classi fieds`   2443                INNER JO IN `Classi fieds`
2442                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)   2444                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)
2443                WHERE `S tatus`='ne w'   2445                WHERE `S tatus`='ne w'
2444           ";   2446           ";
2445           $v SqlResCA =  db_res ($ sQuery);   2447           $v SqlResCA =  db_res ($ sQuery);
2446           $s RetHtml .=  '<form ac tion="'.$t his->sCurr BrowsedFil e.'" metho d="post" n ame="comma nds_couple _advertise ments" id= "commands_ couple_adv ertisement s">';   2448           $s RetHtml .=  '<form ac tion="'.$t his->sCurr BrowsedFil e.'" metho d="post" n ame="comma nds_couple _advertise ments" id= "commands_ couple_adv ertisement s">';
2447           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCA) )  {   2449           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCA) )  {
2448                $sRetHtm l .= <<<EO F   2450                $sRetHtm l .= <<<EO F
2449   <div class ="browseCh eckbox">   2451   <div class ="browseCh eckbox">
2450       <input  type="che ckbox" val ue="{$aSql ResStr['ID ']}" name= "Check[]"/ >   2452       <input  type="che ckbox" val ue="{$aSql ResStr['ID ']}" name= "Check[]"/ >
2451   </div>   2453   </div>
2452   EOF;   2454   EOF;
2453                $sRetHtm l .= $this  -> Compos eResultStr ingAdv($aS qlResStr);   2455                $sRetHtm l .= $this  -> Compos eResultStr ingAdv($aS qlResStr);
2454                $sRetHtm l .= '<div  class="cl ear_both"> </div>';   2456                $sRetHtm l .= '<div  class="cl ear_both"> </div>';
2455           }   2457           }
2456     2458  
2457           $s RetHtml .=  <<<EOF   2459           $s RetHtml .=  <<<EOF
2458   <a onclick ="javascri pt: checkA ll('comman ds_couple_ advertisem ents', '',  true); re turn false ;" href="{ $this->sCu rrBrowsedF ile}">Chec k All</a>   2460   <a onclick ="javascri pt: checkA ll('comman ds_couple_ advertisem ents', '',  true); re turn false ;" href="{ $this->sCu rrBrowsedF ile}">Chec k All</a>
2459   /   2461   /
2460   <a onclick ="javascri pt: checkA ll('comman ds_couple_ advertisem ents', '',  false); r eturn fals e;" href=" {$this->sC urrBrowsed File}">Unc heck All</ a>   2462   <a onclick ="javascri pt: checkA ll('comman ds_couple_ advertisem ents', '',  false); r eturn fals e;" href=" {$this->sC urrBrowsed File}">Unc heck All</ a>
2461   &nbsp;&nbs p;<input t ype="submi t" value=" Delete" na me="Delete Selected"/ >   2463   &nbsp;&nbs p;<input t ype="submi t" value=" Delete" na me="Delete Selected"/ >
2462   &nbsp;&nbs p;<input t ype="submi t" value=" Approve" n ame="Appro veSelected "/>   2464   &nbsp;&nbs p;<input t ype="submi t" value=" Approve" n ame="Appro veSelected "/>
2463   </form>   2465   </form>
2464   EOF;   2466   EOF;
2465     2467  
2466           re turn $sRet Html;   2468           re turn $sRet Html;
2467       }   2469       }
2468     2470  
2469       /**   2471       /**
2470        * Com pose Edit  form for A dvertiseme nt   2472        * Com pose Edit  form for A dvertiseme nt
2471        *   2473        *
2472        * @pa ram $iEdit Advertisem entID ID o f edited A dvertiseme nt   2474        * @pa ram $iEdit Advertisem entID ID o f edited A dvertiseme nt
2473        * @re turn HTML  presentati on of data   2475        * @re turn HTML  presentati on of data
2474        */   2476        */
2475       functi on PrintEd itForm($iE ditAdverti sementID,  $arrErr=NU LL) {   2477       functi on PrintEd itForm($iE ditAdverti sementID,  $arrErr=NU LL) {
2476           $a SqlResAdv  = $this ->  GetAdvert isementDat a($iEditAd vertisemen tID);   2478           $a SqlResAdv  = $this ->  GetAdvert isementDat a($iEditAd vertisemen tID);
2477     2479  
2478           $v SqlResCls  = $this ->  GetDataOf Cls();   2480           $v SqlResCls  = $this ->  GetDataOf Cls();
2479           if  (mysql_af fected_row s()==-1)   2481           if  (mysql_af fected_row s()==-1)
2480                return $ this -> Ge tSQLError( "");   2482                return $ this -> Ge tSQLError( "");
2481     2483  
2482           $s Classified sOptions =  '';   2484           $s Classified sOptions =  '';
2483           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCls)  ) {   2485           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlResCls)  ) {
2484                $sClassi fiedsOptio ns .= "\n< option val ue=\"{$aSq lResStr['I D']}\">{$a SqlResStr[ 'Name']}</ option>";   2486                $sClassi fiedsOptio ns .= "\n< option val ue=\"{$aSq lResStr['I D']}\">{$a SqlResStr[ 'Name']}</ option>";
2485           }   2487           }
2486     2488  
2487           $s SbjC = _t( '_Subject' );   2489           $s SbjC = _t( '_Subject' );
2488           $s OrC = _t(' _or');   2490           $s OrC = _t(' _or');
2489           $s ChangeC =  _t('_Chang e');   2491           $s ChangeC =  _t('_Chang e');
2490           $s CategoryC  = _t('_Cat egory');   2492           $s CategoryC  = _t('_Cat egory');
2491           $s SubCategor yC = _t('_ SubCategor ies');   2493           $s SubCategor yC = _t('_ SubCategor ies');
2492           $s MsgC = _t( '_Message' );   2494           $s MsgC = _t( '_Message' );
2493           $s CommitC =  _t('_Apply  Changes') ;   2495           $s CommitC =  _t('_Apply  Changes') ;
2494           $s TagsC = _t ('_Tags');   2496           $s TagsC = _t ('_Tags');
2495           $s PhotosC =  _t('_photo s');   2497           $s PhotosC =  _t('_photo s');
2496     2498  
2497           $s MSGstyle =  ($arrErr[ 'Message']  ? 'block'  : 'none') ;   2499           $s MSGstyle =  ($arrErr[ 'Message']  ? 'block'  : 'none') ;
2498           $s SBJstyle =  ($arrErr[ 'Subject']  ? 'block'  : 'none') ;   2500           $s SBJstyle =  ($arrErr[ 'Subject']  ? 'block'  : 'none') ;
2499           $s SBJmsg = ( $arrErr['S ubject'] ?  _t( '_'.$ arrErr['Su bject'] )  : '' );   2501           $s SBJmsg = ( $arrErr['S ubject'] ?  _t( '_'.$ arrErr['Su bject'] )  : '' );
2500           $s MSGmsg = ( $arrErr['M essage'] ?  _t( '_'.$ arrErr['Me ssage'] )  : '' );   2502           $s MSGmsg = ( $arrErr['M essage'] ?  _t( '_'.$ arrErr['Me ssage'] )  : '' );
2501     2503  
2502           // $sCategory  = (int)pr ocess_db_i nput( $_PO ST['Filter Cat'] );   2504           // $sCategory  = (int)pr ocess_db_i nput( $_PO ST['Filter Cat'] );
2503           // $sCategory Sub = proc ess_db_inp ut( $_POST ['FilterCa tSub'] );   2505           // $sCategory Sub = proc ess_db_inp ut( $_POST ['FilterCa tSub'] );
2504           // $sKeywords  = process _db_input(  $_POST['F ilterKeywo rds'] );   2506           // $sKeywords  = process _db_input(  $_POST['F ilterKeywo rds'] );
2505           // $sCustomFi eldCaption 1 = proces s_db_input ( $_POST[' ad_CustomF ieldCaptio n1'] );   2507           // $sCustomFi eldCaption 1 = proces s_db_input ( $_POST[' ad_CustomF ieldCaptio n1'] );
2506           // $sCustomFi eldCaption 2 = proces s_db_input ( $_POST[' ad_CustomF ieldCaptio n2'] );   2508           // $sCustomFi eldCaption 2 = proces s_db_input ( $_POST[' ad_CustomF ieldCaptio n2'] );
2507           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);   2509           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);
2508           $s Message =  $this->pro cess_html_ db_input($ _POST['mes sage']);   2510           $s Message =  $this->pro cess_html_ db_input($ _POST['mes sage']);
2509           $s Tags = pro cess_pass_ data($_POS T['Tags']) ;   2511           $s Tags = pro cess_pass_ data($_POS T['Tags']) ;
2510           // $iLifeTime  = (int)pr ocess_db_i nput( $_PO ST['lifeti me'] );   2512           // $iLifeTime  = (int)pr ocess_db_i nput( $_PO ST['lifeti me'] );
2511     2513  
2512           $s Subject =  ($sSubject =="") ? $a SqlResAdv[ 'Subject']  : $sSubje ct;   2514           $s Subject =  ($sSubject =="") ? $a SqlResAdv[ 'Subject']  : $sSubje ct;
2513           $s Message =  ($sMessage =="") ? $a SqlResAdv[ 'Message']  : $sMessa ge;   2515           $s Message =  ($sMessage =="") ? $a SqlResAdv[ 'Message']  : $sMessa ge;
2514           $s Tags = ($s Tags=="")  ? $aSqlRes Adv['Tags' ] : $sTags ;   2516           $s Tags = ($s Tags=="")  ? $aSqlRes Adv['Tags' ] : $sTags ;
2515     2517  
2516           // ///photos/ ////////   2518           // ///photos/ ////////
2517           $s Img = $thi s->getImag eManagingC ode($aSqlR esAdv['Med ia']);   2519           $s Img = $thi s->getImag eManagingC ode($aSqlR esAdv['Med ia']);
2518           // ////////// ///////   2520           // ////////// ///////
2519     2521  
2520           $s CatHndlVal  = (isset( $arrErr))  ? $_REQUES T['Classif ied'] : $a SqlResAdv[ 'CatID'];   2522           $s CatHndlVal  = (isset( $arrErr))  ? $_REQUES T['Classif ied'] : $a SqlResAdv[ 'CatID'];
2521           $s SubCatHndl Val = (iss et($arrErr )) ? $_REQ UEST['SubC lassified' ] : $aSqlR esAdv['Sub ID'];   2523           $s SubCatHndl Val = (iss et($arrErr )) ? $_REQ UEST['SubC lassified' ] : $aSqlR esAdv['Sub ID'];
2522           $s ScriptHand le = <<<EO F   2524           $s ScriptHand le = <<<EO F
2523   <script ty pe="text/j avascript" >   2525   <script ty pe="text/j avascript" >
2524       addEve nt( window , 'load',  function() { UpdateLi stCommon(' ReloadClas sifieds',' SubClassif ied','IDCl assified', {$sCatHndl Val}); } ) ;   2526       addEve nt( window , 'load',  function() { UpdateLi stCommon(' ReloadClas sifieds',' SubClassif ied','IDCl assified', {$sCatHndl Val}); } ) ;
2525       addEve nt( window , 'load',  function() { UpdateFi eld('Class ified',{$s CatHndlVal }); } );   2527       addEve nt( window , 'load',  function() { UpdateFi eld('Class ified',{$s CatHndlVal }); } );
2526       addEve nt( window , 'load',  function() { UpdateFi eld('SubCl assified', {$sSubCatH ndlVal});  } );   2528       addEve nt( window , 'load',  function() { UpdateFi eld('SubCl assified', {$sSubCatH ndlVal});  } );
2527   </script>   2529   </script>
2528   EOF;   2530   EOF;
2529     2531  
2530           $s RetHtml =  <<<EOF   2532           $s RetHtml =  <<<EOF
2531   <form acti on="{$this  -> sCurrB rowsedFile }" name="E ditForm" m ethod="pos t" enctype ="multipar t/form-dat a">   2533   <form acti on="{$this  -> sCurrB rowsedFile }" name="E ditForm" m ethod="pos t" enctype ="multipar t/form-dat a">
2532       <table  class="cl s_100_cp"  cellspacin g="10">   2534       <table  class="cl s_100_cp"  cellspacin g="10">
2533           <t r class="v c">   2535           <t r class="v c">
2534                <td clas s="cls_tbl _left_t">{ $sCategory C}:</td>   2536                <td clas s="cls_tbl _left_t">{ $sCategory C}:</td>
2535                <td clas s="cls_tbl _right_m">   2537                <td clas s="cls_tbl _right_m">
2536                    <sel ect name=" Classified " id="Clas sified" on Change="Up dateListCo mmon('Relo adClassifi edsAndCust omsFields' ,'SubClass ified','ID Classified ',this.val ue,'ad_Cus tomFieldCa ption1','a d_CustomFi eldCaption 2');">   2538                    <sel ect name=" Classified " id="Clas sified" on Change="Up dateListCo mmon('Relo adClassifi edsAndCust omsFields' ,'SubClass ified','ID Classified ',this.val ue,'ad_Cus tomFieldCa ption1','a d_CustomFi eldCaption 2');">
2537                         <option va lue="-1">& nbsp;</opt ion>{$sCla ssifiedsOp tions}   2539                         <option va lue="-1">& nbsp;</opt ion>{$sCla ssifiedsOp tions}
2538                    </se lect>   2540                    </se lect>
2539                    <sel ect name=" SubClassif ied" id="S ubClassifi ed">   2541                    <sel ect name=" SubClassif ied" id="S ubClassifi ed">
2540                    </se lect>   2542                    </se lect>
2541                    {$sS criptHandl e}   2543                    {$sS criptHandl e}
2542                </td>   2544                </td>
2543           </ tr>   2545           </ tr>
2544           <t r class="v c">   2546           <t r class="v c">
2545                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion1" nam e="ad_Cust omFieldCap tion1">{$a SqlResAdv[ 'CustomFie ldName1']} {$aSqlResA dv['Custom Action1']} </td>   2547                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion1" nam e="ad_Cust omFieldCap tion1">{$a SqlResAdv[ 'CustomFie ldName1']} {$aSqlResA dv['Custom Action1']} </td>
2546                <td clas s="cls_tbl _right_m">   2548                <td clas s="cls_tbl _right_m">
2547                    <inp ut type="t ext" name= "CustomFie ldValue1"  value="{$a SqlResAdv[ 'CustomFie ldValue1'] }" size="2 0" maxleng th="20" />   2549                    <inp ut type="t ext" name= "CustomFie ldValue1"  value="{$a SqlResAdv[ 'CustomFie ldValue1'] }" size="2 0" maxleng th="20" />
2548                </td>   2550                </td>
2549           </ tr>   2551           </ tr>
2550           <t r class="v c">   2552           <t r class="v c">
2551                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion2" nam e="ad_Cust omFieldCap tion2">{$a SqlResAdv[ 'CustomFie ldName2']} {$aSqlResA dv['Custom Action2']} </td>   2553                <td clas s="cls_tbl _left_t" i d="ad_Cust omFieldCap tion2" nam e="ad_Cust omFieldCap tion2">{$a SqlResAdv[ 'CustomFie ldName2']} {$aSqlResA dv['Custom Action2']} </td>
2552                <td clas s="cls_tbl _right_m">   2554                <td clas s="cls_tbl _right_m">
2553                    <inp ut type="t ext" name= "CustomFie ldValue2"  value="{$a SqlResAdv[ 'CustomFie ldValue2'] }" size="2 0" maxleng th="20" />   2555                    <inp ut type="t ext" name= "CustomFie ldValue2"  value="{$a SqlResAdv[ 'CustomFie ldValue2'] }" size="2 0" maxleng th="20" />
2554                </td>   2556                </td>
2555           </ tr>   2557           </ tr>
2556           <t r class="v c">   2558           <t r class="v c">
2557                <td clas s="cls_tbl _left_t">{ $sSbjC}:</ td>   2559                <td clas s="cls_tbl _left_t">{ $sSbjC}:</ td>
2558                <td clas s="cls_tbl _right_m">   2560                <td clas s="cls_tbl _right_m">
2559                    <div  class="ed it_error"  style="dis play:{$sSB Jstyle}">   2561                    <div  class="ed it_error"  style="dis play:{$sSB Jstyle}">
2560                         {$sSBJmsg}   2562                         {$sSBJmsg}
2561                    </di v>   2563                    </di v>
2562                    <inp ut type="t ext" name= "subject"  value="{$s Subject}"  size="60"  maxlength= "60" />   2564                    <inp ut type="t ext" name= "subject"  value="{$s Subject}"  size="60"  maxlength= "60" />
2563                </td>   2565                </td>
2564           </ tr>   2566           </ tr>
2565           <t r class="v c">   2567           <t r class="v c">
2566                <td clas s="cls_tbl _left_t">{ $sTagsC}:< /td>   2568                <td clas s="cls_tbl _left_t">{ $sTagsC}:< /td>
2567                <td clas s="cls_tbl _right_m">   2569                <td clas s="cls_tbl _right_m">
2568                    <inp ut type="t ext" name= "Tags" val ue="{$sTag s}" size=" 60" maxlen gth="60" / >   2570                    <inp ut type="t ext" name= "Tags" val ue="{$sTag s}" size=" 60" maxlen gth="60" / >
2569                </td>   2571                </td>
2570           </ tr>   2572           </ tr>
2571           <t r class="v c">   2573           <t r class="v c">
2572                <td clas s="cls_tbl _left_t">{ $sMsgC}:</ td>   2574                <td clas s="cls_tbl _left_t">{ $sMsgC}:</ td>
2573                <td clas s="cls_tbl _right_m">   2575                <td clas s="cls_tbl _right_m">
2574                    <div  class="ed it_error"  style="dis play:{$sMS Gstyle}">   2576                    <div  class="ed it_error"  style="dis play:{$sMS Gstyle}">
2575                         {$sMSGmsg}   2577                         {$sMSGmsg}
2576                    </di v>   2578                    </di v>
2577                    <tex tarea name ="message"  rows="20"  cols="60"  class="cl assfiedsTe xtArea">{$ sMessage}< /textarea>   2579                    <tex tarea name ="message"  rows="20"  cols="60"  class="cl assfiedsTe xtArea">{$ sMessage}< /textarea>
2578                </td>   2580                </td>
2579           </ tr>   2581           </ tr>
2580           {$ sImg}   2582           {$ sImg}
2581           <t r class="v c">   2583           <t r class="v c">
2582                <td clas s="cls_tbl _left_t">< /td>   2584                <td clas s="cls_tbl _left_t">< /td>
2583                <td clas s="cls_tbl _right_m">   2585                <td clas s="cls_tbl _right_m">
2584                    <inp ut type="h idden" nam e="Updated Advertisem entID" val ue="{$iEdi tAdvertise mentID}" / >   2586                    <inp ut type="h idden" nam e="Updated Advertisem entID" val ue="{$iEdi tAdvertise mentID}" / >
2585                    <inp ut type="s ubmit" nam e="UpdateA dvertiseme nt" value= "{$sCommit C}" />   2587                    <inp ut type="s ubmit" nam e="UpdateA dvertiseme nt" value= "{$sCommit C}" />
2586                </td>   2588                </td>
2587           </ tr>   2589           </ tr>
2588       </tabl e>   2590       </tabl e>
2589   </form>   2591   </form>
2590   EOF;   2592   EOF;
2591           re turn $sRet Html;   2593           re turn $sRet Html;
2592       }   2594       }
2593     2595  
2594       functi on GenRepo rtSubmitFo rm($iComme ntID) {   2596       functi on GenRepo rtSubmitFo rm($iComme ntID) {
2595           gl obal $memb er;   2597           gl obal $memb er;
2596           gl obal $site ;   2598           gl obal $site ;
2597     2599  
2598           if  ($iCommen tID ) {   2600           if  ($iCommen tID ) {
2599                $iClsID  = $_REQUES T['clsID'] ;   2601                $iClsID  = $_REQUES T['clsID'] ;
2600                $sAddr   = '<input  type="hidd en" name=" email" val ue="'.$sit e['email_n otify'].'" >';   2602                $sAddr   = '<input  type="hidd en" name=" email" val ue="'.$sit e['email_n otify'].'" >';
2601                $sCode   = '<div cl ass="media Info">';   2603                $sCode   = '<div cl ass="media Info">';
2602                $sCode . = '<form n ame="submi tAction" m ethod="pos t" action= "'.$_SERVE R['PHP_SEL F'].'">';   2604                $sCode . = '<form n ame="submi tAction" m ethod="pos t" action= "'.$_SERVE R['PHP_SEL F'].'">';
2603                $sCode . = '<input  type="hidd en" name=" commentID"  value="'. $iCommentI D.'">';   2605                $sCode . = '<input  type="hidd en" name=" commentID"  value="'. $iCommentI D.'">';
2604                $sCode . = '<input  type="hidd en" name=" clsID" val ue="'.$iCl sID.'">';   2606                $sCode . = '<input  type="hidd en" name=" clsID" val ue="'.$iCl sID.'">';
2605                $sCode . = '<input  type="hidd en" name=" action" va lue="post_ report">';   2607                $sCode . = '<input  type="hidd en" name=" action" va lue="post_ report">';
2606                $sCode . = '<div>'. _t("_Messa ge text"). '</div>';   2608                $sCode . = '<div>'. _t("_Messa ge text"). '</div>';
2607                $sCode . = '<div><t extarea co ls="30" ro ws="10" na me="messag eText"></t extarea></ div>';   2609                $sCode . = '<div><t extarea co ls="30" ro ws="10" na me="messag eText"></t extarea></ div>';
2608                $sCode . = '<div><i nput type= "submit" s ize="15" n ame="send"  value="Se nd">';   2610                $sCode . = '<div><i nput type= "submit" s ize="15" n ame="send"  value="Se nd">';
2609                $sCode . = '<input  type="rese t" size="1 5" name="s end" value ="Reset">< /div>';   2611                $sCode . = '<input  type="rese t" size="1 5" name="s end" value ="Reset">< /div>';
2610                $sCode . = '</form> ';   2612                $sCode . = '</form> ';
2611                $sCode . = '</div>' ;   2613                $sCode . = '</div>' ;
2612           }   2614           }
2613           re turn $sCod e;   2615           re turn $sCod e;
2614       }   2616       }
2615     2617  
2616       functi on ActionR eportSubmi t() {   2618       functi on ActionR eportSubmi t() {
2617           gl obal $site ;   2619           gl obal $site ;
2618     2620  
2619           $i MemberID =  (int)$_CO OKIE['memb erID'];   2621           $i MemberID =  (int)$_CO OKIE['memb erID'];
2620           $i ClsID = $_ REQUEST['c lsID'];   2622           $i ClsID = $_ REQUEST['c lsID'];
2621           $i CommID = $ _REQUEST[' commentID' ];   2623           $i CommID = $ _REQUEST[' commentID' ];
2622           $a User = $th is->GetPro fileData($ iMemberID) ;   2624           $a User = $th is->GetPro fileData($ iMemberID) ;
2623     2625  
2624           $s MailHeader         =  "From: {$s ite['title ']} <{$sit e['email_n otify']}>" ;   2626           $s MailHeader         =  "From: {$s ite['title ']} <{$sit e['email_n otify']}>" ;
2625           $s MailParame ters    =  "-f{$site[ 'email_not ify']}";   2627           $s MailParame ters    =  "-f{$site[ 'email_not ify']}";
2626     2628  
2627           $s Message =  $this->pro cess_html_ db_input($ _REQUEST[' messageTex t']);   2629           $s Message =  $this->pro cess_html_ db_input($ _REQUEST[' messageTex t']);
2628     2630  
2629           $s MailHeader  = "MIME-V ersion: 1. 0\r\n" . " Content-ty pe: text/h tml; chars et=UTF-8\r \n" . $sMa ilHeader;   2631           $s MailHeader  = "MIME-V ersion: 1. 0\r\n" . " Content-ty pe: text/h tml; chars et=UTF-8\r \n" . $sMa ilHeader;
2630           $s MailSubjec t = $aUser ['NickName '].' bad c omment rep ort';   2632           $s MailSubjec t = $aUser ['NickName '].' bad c omment rep ort';
2631     2633  
2632           $s GenUrl = $ this->genU rl($iClsID , '', 'ent ry', true) ;   2634           $s GenUrl = $ this->genU rl($iClsID , '', 'ent ry', true) ;
2633     2635  
2634           // {$site['ur l']}classi fieds.php? ShowAdvert isementID= {$iClsID}   2636           // {$site['ur l']}classi fieds.php? ShowAdvert isementID= {$iClsID}
2635            $ sMailBody     = "Hell o,\n   2637            $ sMailBody     = "Hell o,\n
2636                         {$aUser['N ickName']}  bad class ified comm ent (comm  num {$iCom mID}): <a  href=\"{$s GenUrl}\"> See it</a> \n   2638                         {$aUser['N ickName']}  bad class ified comm ent (comm  num {$iCom mID}): <a  href=\"{$s GenUrl}\"> See it</a> \n
2637                         {$sMessage }\n   2639                         {$sMessage }\n
2638                         Regards";   2640                         Regards";
2639     2641  
2640           $s Mail = $si te['email_ notify'];   2642           $s Mail = $si te['email_ notify'];
2641     2643  
2642           /* $iSendingR esult = ma il( $sMail , $sMailSu bject, nl2 br($sMailB ody), $sMa ilHeader,  $sMailPara meters );   2644           /* $iSendingR esult = ma il( $sMail , $sMailSu bject, nl2 br($sMailB ody), $sMa ilHeader,  $sMailPara meters );
2643     2645  
2644           if  ($iSendin gResult)   2646           if  ($iSendin gResult)
2645           {   2647           {
2646                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';   2648                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';
2647           }   2649           }
2648           re turn MsgBo x($sCode); */   2650           re turn MsgBo x($sCode); */
2649     2651  
2650     2652  
2651           if  (sendMail ( $sMail,  sMailSubje ct, nl2br( $sMailBody ), '', '',  'html'))  {   2653           if  (sendMail ( $sMail,  sMailSubje ct, nl2br( $sMailBody ), '', '',  'html'))  {
2652                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';   2654                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';
2653                return M sgBox($sCo de);   2655                return M sgBox($sCo de);
2654           }   2656           }
2655       }   2657       }
2656     2658  
2657       functi on Centere dActionsBl ock($sPicE lement, $s HrefElemen t) {   2659       functi on Centere dActionsBl ock($sPicE lement, $s HrefElemen t) {
2658           $s ResElement  = <<<EOF   2660           $s ResElement  = <<<EOF
2659   <span styl e="vertica l-align: m iddle;">{$ sPicElemen t}</span>   2661   <span styl e="vertica l-align: m iddle;">{$ sPicElemen t}</span>
2660   <span>{$sH refElement }</span>   2662   <span>{$sH refElement }</span>
2661   EOF;   2663   EOF;
2662           re turn $sRes Element;   2664           re turn $sRes Element;
2663       }   2665       }
2664     2666  
2665       /**   2667       /**
2666        * Com pose Array  of posted  data befo re validat ing (post  ad or edit )   2668        * Com pose Array  of posted  data befo re validat ing (post  ad or edit )
2667        *   2669        *
2668        * @re turn Array   2670        * @re turn Array
2669        */   2671        */
2670       functi on FillPos tAdvertism entArrByPo stValues()  {   2672       functi on FillPos tAdvertism entArrByPo stValues()  {
2671           $i SubClassif iedID = (i nt)$_POST[ 'SubClassi fied'];   2673           $i SubClassif iedID = (i nt)$_POST[ 'SubClassi fied'];
2672           $i MemberID =  (int)$_CO OKIE['memb erID'];   2674           $i MemberID =  (int)$_CO OKIE['memb erID'];
2673           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);   2675           $s Subject =  $this->pro cess_html_ db_input($ _POST['sub ject']);
2674           $s Message =  process_db _input( $_ POST['mess age'] );   2676           $s Message =  process_db _input( $_ POST['mess age'] );
2675           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue1'] ), $ aRegs)) {   2677           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue1'] ), $ aRegs)) {
2676                $sCustom FieldValue 1 = $aRegs [1];   2678                $sCustom FieldValue 1 = $aRegs [1];
2677           }   2679           }
2678           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue2'] ), $ aRegs)) {   2680           if  (ereg ("( [0-9]+)",  process_db _input( $_ POST['Cust omFieldVal ue2'] ), $ aRegs)) {
2679                $sCustom FieldValue 2 = $aRegs [1];   2681                $sCustom FieldValue 2 = $aRegs [1];
2680           }   2682           }
2681     2683  
2682           $i LifeTime =  process_d b_input( $ _POST['lif etime'] );   2684           $i LifeTime =  process_d b_input( $ _POST['lif etime'] );
2683           $a rr = array ('SubClass ified' =>  $iSubClass ifiedID, ' membID' =>  $iMemberI D, 'Subjec t' => $sSu bject, 'Me ssage' =>  $sMessage,   2685           $a rr = array ('SubClass ified' =>  $iSubClass ifiedID, ' membID' =>  $iMemberI D, 'Subjec t' => $sSu bject, 'Me ssage' =>  $sMessage,
2684                             'custV al1' => $s CustomFiel dValue1, ' custVal2'  => $sCusto mFieldValu e2, 'Life  Time' => $ iLifeTime) ;   2686                             'custV al1' => $s CustomFiel dValue1, ' custVal2'  => $sCusto mFieldValu e2, 'Life  Time' => $ iLifeTime) ;
2685           re turn $arr;   2687           re turn $arr;
2686       }   2688       }
2687     2689  
2688       /**   2690       /**
2689        * Com pose Array  of errors  during fi lling (val idating)   2691        * Com pose Array  of errors  during fi lling (val idating)
2690        *   2692        *
2691        * @pa ram $arrAd v   Input  Array with  data   2693        * @pa ram $arrAd v   Input  Array with  data
2692        * @pa ram $bEdit Mode    li ke a simpl e mode, no t all fiel ds are tes ted   2694        * @pa ram $bEdit Mode    li ke a simpl e mode, no t all fiel ds are tes ted
2693        * @re turn Array  with erro rs   2695        * @re turn Array  with erro rs
2694        */   2696        */
2695       functi on checkGr oupErrors(  $arrAdv,  $bEditMode =FALSE ) {   2697       functi on checkGr oupErrors(  $arrAdv,  $bEditMode =FALSE ) {
2696           $a rrErr = ar ray();   2698           $a rrErr = ar ray();
2697           fo reach( $ar rAdv as $s FieldName  => $sField Value ) {   2699           fo reach( $ar rAdv as $s FieldName  => $sField Value ) {
2698                switch(  $sFieldNam e ) {   2700                switch(  $sFieldNam e ) {
2699                    case  'SubClass ified':   2701                    case  'SubClass ified':
2700                         if( $sFiel dValue < 1  AND $bEdi tMode==FAL SE )   2702                         if( $sFiel dValue < 1  AND $bEdi tMode==FAL SE )
2701                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   2703                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
2702                    brea k;   2704                    brea k;
2703                    case  'Subject' :   2705                    case  'Subject' :
2704                         if( !strle n($sFieldV alue) )   2706                         if( !strle n($sFieldV alue) )
2705                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   2707                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
2706                    brea k;   2708                    brea k;
2707                    case  'Message' :   2709                    case  'Message' :
2708                         if( strlen ($sFieldVa lue) < 50  )   2710                         if( strlen ($sFieldVa lue) < 50  )
2709                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e 50 symbo ls at leas t";   2711                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e 50 symbo ls at leas t";
2710                    brea k;   2712                    brea k;
2711                    case  'Life Tim e':   2713                    case  'Life Tim e':
2712                         if( $sFiel dValue < 1  AND $bEdi tMode==FAL SE )   2714                         if( $sFiel dValue < 1  AND $bEdi tMode==FAL SE )
2713                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e positive ";   2715                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e positive ";
2714                    brea k;   2716                    brea k;
2715                }   2717                }
2716           }   2718           }
2717           re turn $arrE rr;   2719           re turn $arrE rr;
2718       }   2720       }
2719     2721  
2720       /**   2722       /**
2721        * Com pose resul t of searc hing Adver tisements  by Tag   2723        * Com pose resul t of searc hing Adver tisements  by Tag
2722        *   2724        *
2723        * @pa ram $sTag  selected t ag string   2725        * @pa ram $sTag  selected t ag string
2724        * @re turn HTML  result   2726        * @re turn HTML  result
2725        */   2727        */
2726       functi on PrintAd vertisemen tsByTag($s Tag) {   2728       functi on PrintAd vertisemen tsByTag($s Tag) {
2727           gl obal $site ;   2729           gl obal $site ;
2728           $s RetHtml='' ;   2730           $s RetHtml='' ;
2729           $s Tag = adds lashes(tri m(strtolow er($sTag)) );   2731           $s Tag = adds lashes(tri m(strtolow er($sTag)) );
2730           $s TagResultC  = _t('_Ta gs') . _t( '_Search')  . _t('_Re sults');   2732           $s TagResultC  = _t('_Ta gs') . _t( '_Search')  . _t('_Re sults');
2731           $s BrowseAllA ds = _t('_ Browse All  Ads');   2733           $s BrowseAllA ds = _t('_ Browse All  Ads');
2732     2734  
2733           $s HomeLink =  ($this->b UseFriendl yLinks) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";   2735           $s HomeLink =  ($this->b UseFriendl yLinks) ?  $site['url '].'ads/'  : "{$this- >sCurrBrow sedFile}?B rowse=1";
2734     2736  
2735           $s BreadCrumb s = <<<EOF   2737           $s BreadCrumb s = <<<EOF
2736   <div class ="breadcru mbs">   2738   <div class ="breadcru mbs">
2737   <a href="{ $site['url ']}">{$sit e['title'] }</a>   2739   <a href="{ $site['url ']}">{$sit e['title'] }</a>
2738   /   2740   /
2739   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>   2741   <a href="{ $sHomeLink }">{$sBrow seAllAds}< /a>
2740   /   2742   /
2741   {$sTagResu ltC}   2743   {$sTagResu ltC}
2742   </div>   2744   </div>
2743   EOF;   2745   EOF;
2744           $v SqlRes = $ this -> Ge tAdvByTags ();   2746           $v SqlRes = $ this -> Ge tAdvByTags ();
2745           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {   2747           wh ile( $aSql ResStr = m ysql_fetch _assoc($vS qlRes) ) {
2746                $sTags =  $aSqlResS tr['Tags'] ;   2748                $sTags =  $aSqlResS tr['Tags'] ;
2747                $aTags =  array();   2749                $aTags =  array();
2748                $aTags =  explode(" ,", $sTags );   2750                $aTags =  explode(" ,", $sTags );
2749                if (in_a rray($sTag , $aTags))  {   2751                if (in_a rray($sTag , $aTags))  {
2750                    $sRe tHtml .= $ this -> Co mposeResul tStringAdv ($aSqlResS tr);   2752                    $sRe tHtml .= $ this -> Co mposeResul tStringAdv ($aSqlResS tr);
2751                }   2753                }
2752           }   2754           }
2753           re turn $sBre adCrumbs.$ sRetHtml;   2755           re turn $sBre adCrumbs.$ sRetHtml;
2754       }   2756       }
2755     2757  
2756       /*   2758       /*
2757       *safe  SQL functi ons   2759       *safe  SQL functi ons
2758       */   2760       */
2759     2761  
2760       /**   2762       /**
2761        * Wri te SQL dat a into Cla ssifiedsAd vertisemen tsMedia   2763        * Wri te SQL dat a into Cla ssifiedsAd vertisemen tsMedia
2762        *   2764        *
2763        * @pa ram $iMemb erID    Me mber ID   2765        * @pa ram $iMemb erID    Me mber ID
2764        * @pa ram $sBase Name    Ba se Name of  picture w ithout ext ension   2766        * @pa ram $sBase Name    Ba se Name of  picture w ithout ext ension
2765        * @pa ram $sExt      Extens ion of pic ture   2767        * @pa ram $sExt      Extens ion of pic ture
2766        * @re turn SQL r esult   2768        * @re turn SQL r esult
2767        */   2769        */
2768       functi on InsertC AM($iMembe rID, $sBas eName, $sE xt) {   2770       functi on InsertC AM($iMembe rID, $sBas eName, $sE xt) {
2769           $s Query = "I NSERT INTO  `Classifi edsAdverti sementsMed ia` SET   2771           $s Query = "I NSERT INTO  `Classifi edsAdverti sementsMed ia` SET
2770                         `MediaProf ileID`='{$ iMemberID} ',   2772                         `MediaProf ileID`='{$ iMemberID} ',
2771                         `MediaType `='photo',   2773                         `MediaType `='photo',
2772                         `MediaFile `='{$sBase Name}{$sEx t}',   2774                         `MediaFile `='{$sBase Name}{$sEx t}',
2773                         `MediaDate `=NOW()";   2775                         `MediaDate `=NOW()";
2774           $v SqlRes = d b_res( $sQ uery );   2776           $v SqlRes = d b_res( $sQ uery );
2775           re turn $vSql Res;   2777           re turn $vSql Res;
2776       }   2778       }
2777     2779  
2778       /**   2780       /**
2779        * Wri te SQL dat a into Cla ssifiedsAd vertisemen ts   2781        * Wri te SQL dat a into Cla ssifiedsAd vertisemen ts
2780        *   2782        *
2781        * @pa ram $iMemb erID    Me mber ID   2783        * @pa ram $iMemb erID    Me mber ID
2782        * @pa ram $iSubC lassifiedI D SubClass ified ID,  where Adv  was added   2784        * @pa ram $iSubC lassifiedI D SubClass ified ID,  where Adv  was added
2783        * @pa ram $sSubj ect     Su bject of A dv   2785        * @pa ram $sSubj ect     Su bject of A dv
2784        * @pa ram $sMess age     Me ssage of A dv   2786        * @pa ram $sMess age     Me ssage of A dv
2785        * @pa ram $sCust omFieldVal ue1 Custom  Value 1   2787        * @pa ram $sCust omFieldVal ue1 Custom  Value 1
2786        * @pa ram $sCust omFieldVal ue2 Custom  Value 2   2788        * @pa ram $sCust omFieldVal ue2 Custom  Value 2
2787        * @pa ram $iLife Time         Life tim e of Adv,  time in da ys how man y showed A dv   2789        * @pa ram $iLife Time         Life tim e of Adv,  time in da ys how man y showed A dv
2788        * @pa ram $sMedI ds      ID `s of atta ched pictu res   2790        * @pa ram $sMedI ds      ID `s of atta ched pictu res
2789        * @re turn SQL r esult   2791        * @re turn SQL r esult
2790        */   2792        */
2791       functi on InsertC A($iMember ID, $iSubC lassifiedI D, $sSubje ct, $sMess age, $sCus tomFieldVa lue1, $sCu stomFieldV alue2, $iL ifeTime, $ sMedIds, $ sTags) {   2793       functi on InsertC A($iMember ID, $iSubC lassifiedI D, $sSubje ct, $sMess age, $sCus tomFieldVa lue1, $sCu stomFieldV alue2, $iL ifeTime, $ sMedIds, $ sTags) {
2792     2794  
2793           $s NewUri = u riGenerate ($sSubject , 'Classif iedsAdvert isements',  'EntryUri ', 50);   2795           $s NewUri = u riGenerate ($sSubject , 'Classif iedsAdvert isements',  'EntryUri ', 50);
2794     2796  
2795           $s Status = ( getParam(' autoApprov al_Classif ieds') ==  'on') ? 'a ctive' : ' new';   2797           $s Status = ( getParam(' autoApprov al_Classif ieds') ==  'on') ? 'a ctive' : ' new';
2796           $s Query = "I NSERT INTO  `Classifi edsAdverti sements` S ET   2798           $s Query = "I NSERT INTO  `Classifi edsAdverti sements` S ET
2797                         `IDProfile `='{$iMemb erID}',   2799                         `IDProfile `='{$iMemb erID}',
2798                         `IDClassif iedsSubs`= '{$iSubCla ssifiedID} ',   2800                         `IDClassif iedsSubs`= '{$iSubCla ssifiedID} ',
2799                         `DateTime` =NOW(),   2801                         `DateTime` =NOW(),
2800                         `Subject`= '{$sSubjec t}',   2802                         `Subject`= '{$sSubjec t}',
2801                         `EntryUri` ='{$sNewUr i}',   2803                         `EntryUri` ='{$sNewUr i}',
2802                         `Message`= '{$sMessag e}',   2804                         `Message`= '{$sMessag e}',
2803                         `Status` =  '{$sStatu s}',   2805                         `Status` =  '{$sStatu s}',
2804                         `CustomFie ldValue1`= {$sCustomF ieldValue1 },   2806                         `CustomFie ldValue1`= {$sCustomF ieldValue1 },
2805                         `CustomFie ldValue2`= {$sCustomF ieldValue2 },   2807                         `CustomFie ldValue2`= {$sCustomF ieldValue2 },
2806                         `LifeTime` ={$iLifeTi me},   2808                         `LifeTime` ={$iLifeTi me},
2807                         `Media`='{ $sMedIds}' ,   2809                         `Media`='{ $sMedIds}' ,
2808                         `Tags`='{$ sTags}'   2810                         `Tags`='{$ sTags}'
2809           ";   2811           ";
2810           $v SqlRes = d b_res( $sQ uery );   2812           $v SqlRes = d b_res( $sQ uery );
2811           re turn $vSql Res;   2813           re turn $vSql Res;
2812       }   2814       }
2813     2815  
2814       functi on ActionD eletePictu re() {   2816       functi on ActionD eletePictu re() {
2815           gl obal $dir;   2817           gl obal $dir;
2816     2818  
2817           $i MediaID =  (int)$_REQ UEST['Dele tedPicture ID'];   2819           $i MediaID =  (int)$_REQ UEST['Dele tedPicture ID'];
2818           $i EditAdvert isementID  = (int)$_R EQUEST['Up datedAdver tisementID '];   2820           $i EditAdvert isementID  = (int)$_R EQUEST['Up datedAdver tisementID '];
2819     2821  
2820           $s CheckPostS QL = "SELE CT `IDProf ile`   2822           $s CheckPostS QL = "SELE CT `IDProf ile`
2821                                 FR OM `Classi fiedsAdver tisements`   2823                                 FR OM `Classi fiedsAdver tisements`
2822                                 WH ERE `ID`={ $iEditAdve rtisementI D}   2824                                 WH ERE `ID`={ $iEditAdve rtisementI D}
2823                             ";   2825                             ";
2824           $a AdvOwner =  db_arr($s CheckPostS QL);   2826           $a AdvOwner =  db_arr($s CheckPostS QL);
2825           $i AdvOwner =  $aAdvOwne r['IDProfi le'];   2827           $i AdvOwner =  $aAdvOwne r['IDProfi le'];
2826           $i VisitorID  = (int)$_C OOKIE['mem berID'];   2828           $i VisitorID  = (int)$_C OOKIE['mem berID'];
2827           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $iEdit Advertisem entID > 0)  {   2829           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $iEdit Advertisem entID > 0)  {
2828                if ($thi s -> bAdmi nMode == F ALSE) {   2830                if ($thi s -> bAdmi nMode == F ALSE) {
2829                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);   2831                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);
2830                    if ( $sRestrict Res != '')  return $s RestrictRe s;   2832                    if ( $sRestrict Res != '')  return $s RestrictRe s;
2831                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;   2833                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;
2832                }   2834                }
2833                //1. get  media arr ay   2835                //1. get  media arr ay
2834                $aAdvDat a = $this- >GetAdvert isementDat a($iEditAd vertisemen tID);   2836                $aAdvDat a = $this- >GetAdvert isementDat a($iEditAd vertisemen tID);
2835                $sMediaI Ds = $aAdv Data['Medi a'];   2837                $sMediaI Ds = $aAdv Data['Medi a'];
2836     2838  
2837                if ($sMe diaIDs !=  '') {   2839                if ($sMe diaIDs !=  '') {
2838                    $aCh unks = pre g_split (" /[,]+/", $ sMediaIDs,  -1, PREG_ SPLIT_NO_E MPTY);   2840                    $aCh unks = pre g_split (" /[,]+/", $ sMediaIDs,  -1, PREG_ SPLIT_NO_E MPTY);
2839     2841  
2840                    //2.  don`t get  deleted e lement   2842                    //2.  don`t get  deleted e lement
2841                    $aNe wMediaIDs  = array();   2843                    $aNe wMediaIDs  = array();
2842                    fore ach ( $aCh unks as $i MedId ) {   2844                    fore ach ( $aCh unks as $i MedId ) {
2843                         if ($iMedI d != $iMed iaID) $aNe wMediaIDs[ ] = $iMedI d;   2845                         if ($iMedI d != $iMed iaID) $aNe wMediaIDs[ ] = $iMedI d;
2844                    }   2846                    }
2845     2847  
2846                    //3.  collect n ew array o f nedia   2848                    //3.  collect n ew array o f nedia
2847                    $sNe wMedia = i mplode("," , $aNewMed iaIDs);   2849                    $sNe wMedia = i mplode("," , $aNewMed iaIDs);
2848     2850  
2849                    //4.  update fi eld Media  in classif ieds with  new array  of media   2851                    //4.  update fi eld Media  in classif ieds with  new array  of media
2850                    $sUp dateSQL =  "UPDATE `C lassifieds Advertisem ents` SET  `Media` =  '{$sNewMed ia}' WHERE  `Classifi edsAdverti sements`.` ID` = {$iE ditAdverti sementID}  LIMIT 1";   2852                    $sUp dateSQL =  "UPDATE `C lassifieds Advertisem ents` SET  `Media` =  '{$sNewMed ia}' WHERE  `Classifi edsAdverti sements`.` ID` = {$iE ditAdverti sementID}  LIMIT 1";
2851                    db_r es( $sUpda teSQL );   2853                    db_r es( $sUpda teSQL );
2852                    if ( mysql_affe cted_rows( ) == 1) {/ /continue   2854                    if ( mysql_affe cted_rows( ) == 1) {/ /continue
2853                         $sAdminCut 2 = ($this ->bAdminMo de==false)  ? "AND `M ediaProfil eID` = {$i VisitorID} " : "";   2855                         $sAdminCut 2 = ($this ->bAdminMo de==false)  ? "AND `M ediaProfil eID` = {$i VisitorID} " : "";
2854                         $sQueryChu nkFile = "   2856                         $sQueryChu nkFile = "
2855                             SELECT  `MediaFil e`    2857                             SELECT  `MediaFil e` 
2856                             FROM ` Classified sAdvertise mentsMedia   2858                             FROM ` Classified sAdvertise mentsMedia
2857                             WHERE  `MediaID`  = {$iMedia ID}   2859                             WHERE  `MediaID`  = {$iMedia ID}
2858                             {$sAdm inCut2}   2860                             {$sAdm inCut2}
2859                             LIMIT  1   2861                             LIMIT  1
2860                         ";   2862                         ";
2861                         //5. delet e physycal ly file   2863                         //5. delet e physycal ly file
2862                         $aSqlResMe diaName =  db_assoc_a rr( $sQuer yChunkFile  );   2864                         $aSqlResMe diaName =  db_assoc_a rr( $sQuer yChunkFile  );
2863                         $sMediaFil eName = $a SqlResMedi aName['Med iaFile'];   2865                         $sMediaFil eName = $a SqlResMedi aName['Med iaFile'];
2864                         if ($sMedi aFileName  != '') {   2866                         if ($sMedi aFileName  != '') {
2865                             if (un link ( $di r['root']. $this->sUp loadDir .  'img_'.$sM ediaFileNa me ) == FA LSE) {   2867                             if (un link ( $di r['root']. $this->sUp loadDir .  'img_'.$sM ediaFileNa me ) == FA LSE) {
2866                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   2868                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
2867                             }   2869                             }
2868                             if (un link ( $di r['root']. $this->sUp loadDir .  'thumb_'.$ sMediaFile Name ) ==  FALSE) {   2870                             if (un link ( $di r['root']. $this->sUp loadDir .  'thumb_'.$ sMediaFile Name ) ==  FALSE) {
2869                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   2871                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
2870                             }   2872                             }
2871                             if (un link ( $di r['root']. $this->sUp loadDir .  'big_thumb _'.$sMedia FileName )  == FALSE)  {   2873                             if (un link ( $di r['root']. $this->sUp loadDir .  'big_thumb _'.$sMedia FileName )  == FALSE)  {
2872                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   2874                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
2873                             }   2875                             }
2874                             if (un link ( $di r['root']. $this->sUp loadDir .  'icon_'.$s MediaFileN ame ) == F ALSE) {   2876                             if (un link ( $di r['root']. $this->sUp loadDir .  'icon_'.$s MediaFileN ame ) == F ALSE) {
2875                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));   2877                                 $s RetHtml .=  MsgBox(_t ('_FAILED_ TO_DELETE_ PIC', $sMe diaFileNam e));
2876                             }   2878                             }
2877                         }   2879                         }
2878                         //6. delet e record f rom table  with media  of Classi fieds abou t deleted  object   2880                         //6. delet e record f rom table  with media  of Classi fieds abou t deleted  object
2879                         $sQueryMed iaID = "DE LETE FROM  `Classifie dsAdvertis ementsMedi a` WHERE ` MediaID` =  {$iMediaI D} AND `Me diaProfile ID` = {$iV isitorID}  LIMIT 1";   2881                         $sQueryMed iaID = "DE LETE FROM  `Classifie dsAdvertis ementsMedi a` WHERE ` MediaID` =  {$iMediaI D} AND `Me diaProfile ID` = {$iV isitorID}  LIMIT 1";
2880                         $aSqlResMe diaID = db _res( $sQu eryMediaID  );   2882                         $aSqlResMe diaID = db _res( $sQu eryMediaID  );
2881                         if (mysql_ affected_r ows() == 1 ) {//conti nue   2883                         if (mysql_ affected_r ows() == 1 ) {//conti nue
2882                             return  MsgBox(_t ('_Photo s uccessfull y deleted' ));   2884                             return  MsgBox(_t ('_Photo s uccessfull y deleted' ));
2883                         }   2885                         }
2884                    } el se return  MsgBox(_t( '_Error Oc cured'));   2886                    } el se return  MsgBox(_t( '_Error Oc cured'));
2885                }   2887                }
2886           }  elseif($iV isitorID ! = $iAdvOwn er) {   2888           }  elseif($iV isitorID ! = $iAdvOwn er) {
2887                return M sgBox(_t(' _Hacker St ring'));   2889                return M sgBox(_t(' _Hacker St ring'));
2888           }  else {   2890           }  else {
2889                return M sgBox(_t(' _Error Occ ured'));   2891                return M sgBox(_t(' _Error Occ ured'));
2890           }   2892           }
2891       }   2893       }
2892     2894  
2893       /**   2895       /**
2894        * SQL  Updating  fields of  Advertisem ent   2896        * SQL  Updating  fields of  Advertisem ent
2895        *   2897        *
2896         * @p aram $iEdi tAdvertise mentID     ID`s of ed iting Adve rtisement   2898         * @p aram $iEdi tAdvertise mentID     ID`s of ed iting Adve rtisement
2897        * @re turn Text  presentati on of data   2899        * @re turn Text  presentati on of data
2898        */   2900        */
2899       functi on ActionU pdateAdver tisementID ($iEditAdv ertisement ID) {   2901       functi on ActionU pdateAdver tisementID ($iEditAdv ertisement ID) {
2900           $s CheckPostS QL = "SELE CT `IDProf ile`   2902           $s CheckPostS QL = "SELE CT `IDProf ile`
2901                                 FR OM `Classi fiedsAdver tisements`   2903                                 FR OM `Classi fiedsAdver tisements`
2902                                 WH ERE `ID`={ $iEditAdve rtisementI D}   2904                                 WH ERE `ID`={ $iEditAdve rtisementI D}
2903                             ";   2905                             ";
2904           $a AdvOwner =  db_arr($s CheckPostS QL);   2906           $a AdvOwner =  db_arr($s CheckPostS QL);
2905           $i AdvOwner =  $aAdvOwne r['IDProfi le'];   2907           $i AdvOwner =  $aAdvOwne r['IDProfi le'];
2906           $i VisitorID  = (int)$_C OOKIE['mem berID'];   2908           $i VisitorID  = (int)$_C OOKIE['mem berID'];
2907           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $iEdit Advertisem entID > 0)  {   2909           if  (($iVisit orID == $i AdvOwner | | $this->b AdminMode)  && $iEdit Advertisem entID > 0)  {
2908                if ($thi s -> bAdmi nMode == F ALSE) {   2910                if ($thi s -> bAdmi nMode == F ALSE) {
2909                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);   2911                    $sRe strictRes  = $this->R estrictAct ion($iVisi torID);
2910                    if ( $sRestrict Res != '')  return $s RestrictRe s;   2912                    if ( $sRestrict Res != '')  return $s RestrictRe s;
2911                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;   2913                    //if  ($this->R estrictAct ion($iVisi torID)) re turn;
2912                }   2914                }
2913     2915  
2914                require_ once( BX_D IRECTORY_P ATH_INC .  'tags.inc. php' );   2916                require_ once( BX_D IRECTORY_P ATH_INC .  'tags.inc. php' );
2915     2917  
2916                $sSuccUp d = _t("_S UCC_UPD_AD V");   2918                $sSuccUp d = _t("_S UCC_UPD_AD V");
2917                $sFailUp d = _t("_F AIL_UPD_AD V");   2919                $sFailUp d = _t("_F AIL_UPD_AD V");
2918                $sCatego ryID = pro cess_db_in put( $_POS T['Classif ied'] );   2920                $sCatego ryID = pro cess_db_in put( $_POS T['Classif ied'] );
2919                $sSubCat egoryID =  process_db _input( $_ POST['SubC lassified' ] );   2921                $sSubCat egoryID =  process_db _input( $_ POST['SubC lassified' ] );
2920                $sCustom FieldValue 1 = (int)$ _POST['Cus tomFieldVa lue1'];   2922                $sCustom FieldValue 1 = (int)$ _POST['Cus tomFieldVa lue1'];
2921                $sCustom FieldValue 2 = (int)$ _POST['Cus tomFieldVa lue2'];   2923                $sCustom FieldValue 2 = (int)$ _POST['Cus tomFieldVa lue2'];
2922                $sTags =  process_d b_input($_ POST['Tags ']);   2924                $sTags =  process_d b_input($_ POST['Tags ']);
2923                $aTags =  explodeTa gs($sTags) ;   2925                $aTags =  explodeTa gs($sTags) ;
2924                $sTags =  implode(" ,", $aTags );   2926                $sTags =  implode(" ,", $aTags );
2925                $sSubjec t = $this- >process_h tml_db_inp ut($_POST[ 'subject'] );   2927                $sSubjec t = $this- >process_h tml_db_inp ut($_POST[ 'subject'] );
2926                $sMessag e = $this- >process_h tml_db_inp ut($_POST[ 'message'] );   2928                $sMessag e = $this- >process_h tml_db_inp ut($_POST[ 'message'] );
2927                $changeC at = ($sCa tegoryID>0  AND $sSub CategoryID >0) ? "`ID Classified sSubs`='{$ sSubCatego ryID}', "  : '';   2929                $changeC at = ($sCa tegoryID>0  AND $sSub CategoryID >0) ? "`ID Classified sSubs`='{$ sSubCatego ryID}', "  : '';
2928     2930  
2929                //1. get  a new fil es and ret urn string -array   2931                //1. get  a new fil es and ret urn string -array
2930                $sNewMed ias = $thi s->parseUp loadedFile s($iAdvOwn er);   2932                $sNewMed ias = $thi s->parseUp loadedFile s($iAdvOwn er);
2931     2933  
2932                //2. get  current m edia datas  from cls   2934                //2. get  current m edia datas  from cls
2933                $aAdvDat a = $this- >GetAdvert isementDat a($iEditAd vertisemen tID);   2935                $aAdvDat a = $this- >GetAdvert isementDat a($iEditAd vertisemen tID);
2934                $sMediaI Ds = $aAdv Data['Medi a'];   2936                $sMediaI Ds = $aAdv Data['Medi a'];
2935                //3. mer ge both   2937                //3. mer ge both
2936                $aOldChu nks = preg _split ("/ [,]+/", $s MediaIDs,  -1, PREG_S PLIT_NO_EM PTY);   2938                $aOldChu nks = preg _split ("/ [,]+/", $s MediaIDs,  -1, PREG_S PLIT_NO_EM PTY);
2937                $aNewChu nks = preg _split ("/ [,]+/", $s NewMedias,  -1, PREG_ SPLIT_NO_E MPTY);   2939                $aNewChu nks = preg _split ("/ [,]+/", $s NewMedias,  -1, PREG_ SPLIT_NO_E MPTY);
2938                $aResult Chunks = a rray_merge  ($aNewChu nks, $aOld Chunks);   2940                $aResult Chunks = a rray_merge  ($aNewChu nks, $aOld Chunks);
2939                $sResult Chunks = i mplode("," , $aResult Chunks);   2941                $sResult Chunks = i mplode("," , $aResult Chunks);
2940                $sPicsAd dSQL = (co unt($aNewC hunks)>0)  ? "`Media`  = '{$sRes ultChunks} '," : '';   2942                $sPicsAd dSQL = (co unt($aNewC hunks)>0)  ? "`Media`  = '{$sRes ultChunks} '," : '';
2941     2943  
2942                //$sNewU ri = uriGe nerate($sS ubject, 'C lassifieds Advertisem ents', 'En tryUri', 5 0);   2944                //$sNewU ri = uriGe nerate($sS ubject, 'C lassifieds Advertisem ents', 'En tryUri', 5 0);
2943     2945  
2944                //4. upd ate result   2946                //4. upd ate result
2945                $sQuery  = "   2947                $sQuery  = "
2946                    UPDA TE `Classi fiedsAdver tisements`  SET   2948                    UPDA TE `Classi fiedsAdver tisements`  SET
2947                    {$ch angeCat}   2949                    {$ch angeCat}
2948                    `Sub ject`='{$s Subject}',   2950                    `Sub ject`='{$s Subject}',
2949                    `Mes sage`='{$s Message}',   2951                    `Mes sage`='{$s Message}',
2950                    `Cus tomFieldVa lue1`={$sC ustomField Value1},   2952                    `Cus tomFieldVa lue1`={$sC ustomField Value1},
2951                    `Cus tomFieldVa lue2`={$sC ustomField Value2},   2953                    `Cus tomFieldVa lue2`={$sC ustomField Value2},
2952                    {$sP icsAddSQL}   2954                    {$sP icsAddSQL}
2953                    `Tag s`='{$sTag s}'   2955                    `Tag s`='{$sTag s}'
2954                    WHER E `ID`={$i EditAdvert isementID}   2956                    WHER E `ID`={$i EditAdvert isementID}
2955                ";   2957                ";
2956                $vSqlRes  = db_res(  $sQuery ) ;   2958                $vSqlRes  = db_res(  $sQuery ) ;
2957                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd ) : _t($sF ailUpd);   2959                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd ) : _t($sF ailUpd);
2958                reparseO bjTags( 'a d', $iEdit Advertisem entID );   2960                reparseO bjTags( 'a d', $iEdit Advertisem entID );
2959                $this->U seDefaultC F();   2961                $this->U seDefaultC F();
2960                return   MsgBox($sR et) . $thi s -> Actio nPrintAdve rtisement( $iEditAdve rtisementI D);   2962                return   MsgBox($sR et) . $thi s -> Actio nPrintAdve rtisement( $iEditAdve rtisementI D);
2961           }  elseif($iV isitorID ! = $iAdvOwn er) {   2963           }  elseif($iV isitorID ! = $iAdvOwn er) {
2962                return M sgBox(_t(' _Hacker St ring'));   2964                return M sgBox(_t(' _Hacker St ring'));
2963           }  else {   2965           }  else {
2964                return M sgBox(_t(' _Error Occ ured'));   2966                return M sgBox(_t(' _Error Occ ured'));
2965           }   2967           }
2966       }   2968       }
2967     2969  
2968       /**   2970       /**
2969        * SQL  Get all A dvertiseme nt data, c ustom fiel ds, units  by Adverti sement ID   2971        * SQL  Get all A dvertiseme nt data, c ustom fiel ds, units  by Adverti sement ID
2970        *   2972        *
2971         * @p aram $iAdv ertisement ID   2973         * @p aram $iAdv ertisement ID
2972        * @re turn SQL d ata   2974        * @re turn SQL d ata
2973        */   2975        */
2974       functi on GetAdve rtisementD ata($iAdve rtisementI D) {   2976       functi on GetAdve rtisementD ata($iAdve rtisementI D) {
2975           $s Query = "   2977           $s Query = "
2976                 SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Custo mFieldName 1`,   `Classifie ds`.`Custo mFieldName 2`,   `Classifie ds`.`Custo mAction1`,   `Classifie ds`.`Custo mAction2`,   `Classifie dsSubs`.`N ameSub`,   `Classifie dsSubs`.`S EntryUri`,   `Classifie dsSubs`.`I D`   AS   'SubID',   `Classifie ds`.`Name` ,   `Classifie ds`.`CEntr yUri`,   `Classifie ds`.`ID`   AS   'CatID',   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec'
  2978                 SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Custo mFieldName 1`,   `Classifie ds`.`Custo mFieldName 2`,   `Classifie ds`.`Custo mAction1`,   `Classifie ds`.`Custo mAction2`,   `Classifie dsSubs`.`N ameSub`,   `Classifie dsSubs`.`S EntryUri`,   `Classifie dsSubs`.`I D`   AS   'SubID',   `Classifie ds`.`Name` ,   `Classifie ds`.`CEntr yUri`,   `Classifie ds`.`ID`   AS   'CatID',   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec' ,
    2979                UNIX_TIM ESTAMP(`Cl assifiedsA dvertiseme nts`.`Date Time`) AS  'DateTime_ UTS'
2977                FROM `Cl assifiedsA dvertiseme nts`   2980                FROM `Cl assifiedsA dvertiseme nts`
2978                INNER JO IN `Classi fiedsSubs`   2981                INNER JO IN `Classi fiedsSubs`
2979                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)   2982                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)
2980                INNER JO IN `Classi fieds`   2983                INNER JO IN `Classi fieds`
2981                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)   2984                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)
2982                WHERE `C lassifieds Advertisem ents`.`ID` ={$iAdvert isementID} ";   2985                WHERE `C lassifieds Advertisem ents`.`ID` ={$iAdvert isementID} ";
2983     2986  
2984           $a SqlResStr  = db_assoc _arr( $sQu ery );   2987           $a SqlResStr  = db_assoc _arr( $sQu ery );
2985           re turn $aSql ResStr;   2988           re turn $aSql ResStr;
2986       }   2989       }
2987     2990  
2988       /**   2991       /**
2989        * SQL  Get all P rofiles da ta by Prof ile Id   2992        * SQL  Get all P rofiles da ta by Prof ile Id
2990        *   2993        *
2991         * @p aram $iPro fileId   2994         * @p aram $iPro fileId
2992        * @re turn SQL d ata   2995        * @re turn SQL d ata
2993        */   2996        */
2994       functi on GetProf ileData($i ProfileId)  {   2997       functi on GetProf ileData($i ProfileId)  {
2995           re turn getPr ofileInfo(  $iProfile Id );   2998           re turn getPr ofileInfo(  $iProfile Id );
2996       }   2999       }
2997     3000  
2998       /**   3001       /**
2999        * SQL  Get all A dvertiseme nt data, c ustom fiel ds, units  by Profile  Id   3002        * SQL  Get all A dvertiseme nt data, c ustom fiel ds, units  by Profile  Id
3000        *   3003        *
3001         * @p aram $iPro fileId   3004         * @p aram $iPro fileId
3002        * @re turn SQL d ata   3005        * @re turn SQL d ata
3003        */   3006        */
3004       functi on GetAdvD ataOfProfi le($iProfi leId, $iRa ndLim=-1)  {   3007       functi on GetAdvD ataOfProfi le($iProfi leId, $iRa ndLim=-1)  {
3005           $s NoCurrentA dd = (isse t($_REQUES T['entryUr i'])==true  && $_REQU EST['entry Uri'] != ' ') ? " AND  `EntryUri `!='". $th is->proces s_html_db_ input($_RE QUEST['ent ryUri']) . "' " : '';   3008           $s NoCurrentA dd = (isse t($_REQUES T['entryUr i'])==true  && $_REQU EST['entry Uri'] != ' ') ? " AND  `EntryUri `!='". $th is->proces s_html_db_ input($_RE QUEST['ent ryUri']) . "' " : '';
3006              3009           
3007           $s RL = ($iRa ndLim>0) ?  " ORDER B Y RAND() L IMIT {$iRa ndLim}" :  '';   3010           $s RL = ($iRa ndLim>0) ?  " ORDER B Y RAND() L IMIT {$iRa ndLim}" :  '';
3008           $s Query = "   3011           $s Query = "
3009                 SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Custo mFieldName 1`,   `Classifie ds`.`Custo mFieldName 2`,   `Classifie ds`.`Custo mAction1`,   `Classifie ds`.`Custo mAction2`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec'
  3012                 SELECT   `Classifie dsAdvertis ements`.*,   `Classifie ds`.`Custo mFieldName 1`,   `Classifie ds`.`Custo mFieldName 2`,   `Classifie ds`.`Custo mAction1`,   `Classifie ds`.`Custo mAction2`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec' ,
    3013                UNIX_TIM ESTAMP(`Cl assifiedsA dvertiseme nts`.`Date Time`) AS  'DateTime_ UTS'
3010                FROM `Cl assifiedsA dvertiseme nts`   3014                FROM `Cl assifiedsA dvertiseme nts`
3011                INNER JO IN `Classi fiedsSubs`   3015                INNER JO IN `Classi fiedsSubs`
3012                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)   3016                ON (`Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs`=`Class ifiedsSubs `.`ID`)
3013                INNER JO IN `Classi fieds`   3017                INNER JO IN `Classi fieds`
3014                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)   3018                ON (`Cla ssifieds`. `ID`=`Clas sifiedsSub s`.`IDClas sified`)
3015                WHERE `I DProfile`  ={$iProfil eId}   3019                WHERE `I DProfile`  ={$iProfil eId}
3016                {$sNoCur rentAdd}   3020                {$sNoCur rentAdd}
3017                {$sRL}   3021                {$sRL}
3018           ";   3022           ";
3019           $a SqlResStr  = db_res(  $sQuery );   3023           $a SqlResStr  = db_res(  $sQuery );
3020           re turn $aSql ResStr;   3024           re turn $aSql ResStr;
3021       }   3025       }
3022     3026  
3023       /**   3027       /**
3024        * SQL  Get all A dvertiseme nt data, u nits take  into mind  LifeDate o f Adv   3028        * SQL  Get all A dvertiseme nt data, u nits take  into mind  LifeDate o f Adv
3025        *   3029        *
3026         * @p aram $iCls ID   3030         * @p aram $iCls ID
3027         * @p aram $sAdd on - strin g addon of  Limits (f or paginat ion)   3031         * @p aram $sAdd on - strin g addon of  Limits (f or paginat ion)
3028         * @p aram $bSub  - present  that curr ent ID is  SubCategor y   3032         * @p aram $bSub  - present  that curr ent ID is  SubCategor y
3029        * @re turn SQL d ata   3033        * @re turn SQL d ata
3030        */   3034        */
3031       functi on GetAdvB yDate($iCl sID, $sAdd on, $bSub= FALSE) {   3035       functi on GetAdvB yDate($iCl sID, $sAdd on, $bSub= FALSE) {
3032           $s WhereAdd =  ($bSub) ?  "`Classif iedsSubs`"  : "`Class ifieds`" ;   3036           $s WhereAdd =  ($bSub) ?  "`Classif iedsSubs`"  : "`Class ifieds`" ;
3033           $s TimeRestri ction = ($ this->bAdm inMode==tr ue) ? '' :  'AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )' ;   3037           $s TimeRestri ction = ($ this->bAdm inMode==tr ue) ? '' :  'AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )' ;
3034           $s Query = "   3038           $s Query = "
3035                 SELECT   `Classifie dsAdvertis ements`.*   ,   `Classifie ds`.`Name` ,   `Classifie ds`.`Descr iption`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec'
  3039                 SELECT   `Classifie dsAdvertis ements`.*   ,   `Classifie ds`.`Name` ,   `Classifie ds`.`Descr iption`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   'sec' ,
    3040                UNIX_TIM ESTAMP(`Cl assifiedsA dvertiseme nts`.`Date Time`) AS  'DateTime_ UTS'
3036                FROM `Cl assifiedsA dvertiseme nts`    3041                FROM `Cl assifiedsA dvertiseme nts` 
3037                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )     3042                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )  
3038                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` )    3043                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` ) 
3039                WHERE {$ sWhereAdd} .`ID` = {$ iClsID}   3044                WHERE {$ sWhereAdd} .`ID` = {$ iClsID}
3040                {$sTimeR estriction }   3045                {$sTimeR estriction }
3041   ".$sAddon;   3046   ".$sAddon;
3042     3047  
3043           $v SqlRes = d b_res ($sQ uery);   3048           $v SqlRes = d b_res ($sQ uery);
3044           re turn $vSql Res;   3049           re turn $vSql Res;
3045       }   3050       }
3046       functi on GetAdvB yDateCnt($ iClsID, $b Sub=FALSE)  {   3051       functi on GetAdvB yDateCnt($ iClsID, $b Sub=FALSE)  {
3047           $s WhereAdd =  ($bSub) ?  "`Classif iedsSubs`"  : "`Class ifieds`" ;   3052           $s WhereAdd =  ($bSub) ?  "`Classif iedsSubs`"  : "`Class ifieds`" ;
3048           $s TimeRestri ction = ($ this->bAdm inMode==tr ue) ? '' :  'AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )' ;   3053           $s TimeRestri ction = ($ this->bAdm inMode==tr ue) ? '' :  'AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )' ;
3049           $s Query = "   3054           $s Query = "
3050                SELECT C OUNT(`Clas sifiedsAdv ertisement s`.`ID`) A S 'Cnt'   3055                SELECT C OUNT(`Clas sifiedsAdv ertisement s`.`ID`) A S 'Cnt'
3051                FROM `Cl assifiedsA dvertiseme nts`    3056                FROM `Cl assifiedsA dvertiseme nts` 
3052                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )     3057                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )  
3053                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` )    3058                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` ) 
3054                WHERE {$ sWhereAdd} .`ID` = {$ iClsID}   3059                WHERE {$ sWhereAdd} .`ID` = {$ iClsID}
3055                {$sTimeR estriction }   3060                {$sTimeR estriction }
3056           ";   3061           ";
3057     3062  
3058           re turn $sQue ry;   3063           re turn $sQue ry;
3059       }   3064       }
3060     3065  
3061       /**   3066       /**
3062        * SQL  Get all C lassifieds  by LifeTi me (for ta g searchin g)   3067        * SQL  Get all C lassifieds  by LifeTi me (for ta g searchin g)
3063        *   3068        *
3064        * @re turn SQL d ata   3069        * @re turn SQL d ata
3065        */   3070        */
3066       functi on GetAdvB yTags() {   3071       functi on GetAdvB yTags() {
3067           $s Query = "   3072           $s Query = "
3068                 SELECT   `Classifie dsAdvertis ements`.*   ,   `Classifie ds`.`Name` ,   `Classifie ds`.`Descr iption`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   `sec`
  3073                 SELECT   `Classifie dsAdvertis ements`.*   ,   `Classifie ds`.`Name` ,   `Classifie ds`.`Descr iption`,   `Classifie ds`.`Unit` ,   (UNIX_TIME STAMP()   -   UNIX_TIMES TAMP(`Clas sifiedsAdv ertisement s`.`DateTi me`))   AS   `sec` ,
    3074                UNIX_TIM ESTAMP(`Cl assifiedsA dvertiseme nts`.`Date Time`) AS  'DateTime_ UTS'
3069                FROM `Cl assifiedsA dvertiseme nts`    3075                FROM `Cl assifiedsA dvertiseme nts` 
3070                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )     3076                INNER JO IN `Classi fiedsSubs`  ON ( `Cla ssifiedsAd vertisemen ts`.`IDCla ssifiedsSu bs` = `Cla ssifiedsSu bs`.`ID` )  
3071                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` )    3077                INNER JO IN `Classi fieds` ON  ( `Classif iedsSubs`. `IDClassif ied` = `Cl assifieds` .`ID` ) 
3072                AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )   3078                AND DATE _ADD( `Cla ssifiedsAd vertisemen ts`.`DateT ime` , INT ERVAL `Cla ssifiedsAd vertisemen ts`.`LifeT ime` DAY )  > NOW( )
3073           ";   3079           ";
3074     3080  
3075           $v SqlRes = d b_res ($sQ uery);   3081           $v SqlRes = d b_res ($sQ uery);
3076           re turn $vSql Res;   3082           re turn $vSql Res;
3077       }   3083       }
3078     3084  
3079       /**   3085       /**
3080        * SQL  Get all C lassifieds   3086        * SQL  Get all C lassifieds
3081        *   3087        *
3082        * @re turn SQL d ata   3088        * @re turn SQL d ata
3083        */   3089        */
3084       functi on GetData OfCls() {   3090       functi on GetData OfCls() {
3085           $s OrderBy =  (getParam( 'enable_cl assifieds_ sort') ==  'on') ? 'O RDER BY `C lassifieds `.`Name` A SC' : '' ;   3091           $s OrderBy =  (getParam( 'enable_cl assifieds_ sort') ==  'on') ? 'O RDER BY `C lassifieds `.`Name` A SC' : '' ;
3086           $s Query = "S ELECT * FR OM `Classi fieds` {$s OrderBy}";   3092           $s Query = "S ELECT * FR OM `Classi fieds` {$s OrderBy}";
3087           $v SqlRes = d b_res ($sQ uery);   3093           $v SqlRes = d b_res ($sQ uery);
3088           re turn $vSql Res;   3094           re turn $vSql Res;
3089       }   3095       }
3090     3096  
3091       functi on genUrl( $iEntryId,  $sEntryUr i, $sType= 'entry', $ bForce = f alse) {   3097       functi on genUrl( $iEntryId,  $sEntryUr i, $sType= 'entry', $ bForce = f alse) {
3092           gl obal $site ;   3098           gl obal $site ;
3093     3099  
3094           if  ($bForce)  {   3100           if  ($bForce)  {
3095                $sEntryU ri = db_va lue("SELEC T `EntryUr i` FROM `C lassifieds Advertisem ents` WHER E `ID`='{$ iEntryId}'  LIMIT 1") ;   3101                $sEntryU ri = db_va lue("SELEC T `EntryUr i` FROM `C lassifieds Advertisem ents` WHER E `ID`='{$ iEntryId}'  LIMIT 1") ;
3096           }   3102           }
3097     3103  
3098           $s MainUrl =  $site['url '];   3104           $s MainUrl =  $site['url '];
3099           if  ($this->b AdminMode)  $sMainUrl  = $site[' url_admin' ];   3105           if  ($this->b AdminMode)  $sMainUrl  = $site[' url_admin' ];
3100     3106  
3101           if  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) {   3107           if  ($this->b UseFriendl yLinks &&  $this->bAd minMode ==  false) {
3102                $sUrl =  $sMainUrl. "ads/{$sTy pe}/{$sEnt ryUri}";   3108                $sUrl =  $sMainUrl. "ads/{$sTy pe}/{$sEnt ryUri}";
3103           }  else {   3109           }  else {
3104                $sUrl =  '';   3110                $sUrl =  '';
3105                switch ( $sType) {   3111                switch ( $sType) {
3106                    case  'entry':   3112                    case  'entry':
3107                         $sUrl = "{ $this->sCu rrBrowsedF ile}?ShowA dvertiseme ntID={$iEn tryId}";   3113                         $sUrl = "{ $this->sCu rrBrowsedF ile}?ShowA dvertiseme ntID={$iEn tryId}";
3108                         break;   3114                         break;
3109                    /*ca se 'part':   3115                    /*ca se 'part':
3110                         $sUrl = "{ $sMainUrl} events.php ?action=sh ow_part&ev ent_id={$i EntryId}";   3116                         $sUrl = "{ $sMainUrl} events.php ?action=sh ow_part&ev ent_id={$i EntryId}";
3111                         break;   3117                         break;
3112                    case  'search':   3118                    case  'search':
3113                         $sUrl = "{ $sMainUrl} events.php ?action=se arch_by_ta g&tagKey={ $sEntryUri }";   3119                         $sUrl = "{ $sMainUrl} events.php ?action=se arch_by_ta g&tagKey={ $sEntryUri }";
3114                         break;*/   3120                         break;*/
3115                }   3121                }
3116           }   3122           }
3117           re turn $sUrl ;   3123           re turn $sUrl ;
3118       }   3124       }
3119     3125  
3120       functi on GenAnyB lockConten t($sOrder= 'last', $i ProfileID= 0, $sLimit ="LIMIT 5"  ) {   3126       functi on GenAnyB lockConten t($sOrder= 'last', $i ProfileID= 0, $sLimit ="LIMIT 5"  ) {
3121           gl obal $site ;   3127           gl obal $site ;
3122           gl obal $shor t_date_for mat;   3128           gl obal $shor t_date_for mat;
3123     3129  
3124           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );   3130           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );
3125           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;   3131           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;
3126           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );   3132           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );
3127     3133  
3128           $s OrderS = ' ';   3134           $s OrderS = ' ';
3129           sw itch ($sOr der) {   3135           sw itch ($sOr der) {
3130                case 'la st':   3136                case 'la st':
3131                    $sOr derS = "OR DER BY `Da teTime` DE SC";   3137                    $sOr derS = "OR DER BY `Da teTime` DE SC";
3132                    brea k;   3138                    brea k;
3133                case 'la test':   3139                case 'la test':
3134                    $sOr derS = "OR DER BY `Da teTime` DE SC";   3140                    $sOr derS = "OR DER BY `Da teTime` DE SC";
3135                    brea k;   3141                    brea k;
3136                case 'ra nd':   3142                case 'ra nd':
3137                    $sOr derS = "OR DER BY RAN D()";   3143                    $sOr derS = "OR DER BY RAN D()";
3138                    brea k;   3144                    brea k;
3139                case 'to p':   3145                case 'to p':
3140                    $sOr derS = "OR DER BY `Co mmCount` D ESC";   3146                    $sOr derS = "OR DER BY `Co mmCount` D ESC";
3141                    brea k;   3147                    brea k;
3142           }   3148           }
3143           $s ProfileS =  ($iProfil eID>0) ? " `Classifie dsAdvertis ements`.`I DProfile`  = '{$iProf ileID}'" :  '1';   3149           $s ProfileS =  ($iProfil eID>0) ? " `Classifie dsAdvertis ements`.`I DProfile`  = '{$iProf ileID}'" :  '1';
3144     3150  
3145           $s TimeAddon  = ($iProfi leID>0) ?  '' : "AND  DATE_ADD(` Classified sAdvertise ments`.`Da teTime` ,  INTERVAL ` Classified sAdvertise ments`.`Li feTime` DA Y) > NOW() ";   3151           $s TimeAddon  = ($iProfi leID>0) ?  '' : "AND  DATE_ADD(` Classified sAdvertise ments`.`Da teTime` ,  INTERVAL ` Classified sAdvertise ments`.`Li feTime` DA Y) > NOW() ";
3146     3152  
3147           $o Cmts = new  BxDolCmts  ('classif ieds', 0,  0);   3153           $o Cmts = new  BxDolCmts  ('classif ieds', 0,  0);
3148     3154  
3149           $s Query = "   3155           $s Query = "
3150                SELECT D ISTINCT   3156                SELECT D ISTINCT
3151                `Classif iedsAdvert isements`. `ID`,   3157                `Classif iedsAdvert isements`. `ID`,
3152                `Classif iedsAdvert isements`. `Subject`,   3158                `Classif iedsAdvert isements`. `Subject`,
3153                `Classif iedsAdvert isements`. `EntryUri` ,   3159                `Classif iedsAdvert isements`. `EntryUri` ,
3154                `Classif iedsAdvert isements`. `Media`,   3160                `Classif iedsAdvert isements`. `Media`,
3155                `Profile s`.`NickNa me`,   3161                `Profile s`.`NickNa me`,
3156                UNIX_TIM ESTAMP( `C lassifieds Advertisem ents`.`Dat eTime` ) a s `DateTim e_f`,   3162                UNIX_TIM ESTAMP( `C lassifieds Advertisem ents`.`Dat eTime` ) a s `DateTim e_f`,
3157                `Classif iedsAdvert isements`. `DateTime` ,   3163                `Classif iedsAdvert isements`. `DateTime` ,
3158                `Classif ieds`.`Nam e`, `Class ifieds`.`C EntryUri`,  `Classifi eds`.`ID`  AS `CatID` ,   3164                `Classif ieds`.`Nam e`, `Class ifieds`.`C EntryUri`,  `Classifi eds`.`ID`  AS `CatID` ,
3159                `Classif iedsSubs`. `NameSub`,  `Classifi edsSubs`.` SEntryUri` , `Classif iedsSubs`. `ID` AS `S ubCatID`,   3165                `Classif iedsSubs`. `NameSub`,  `Classifi edsSubs`.` SEntryUri` , `Classif iedsSubs`. `ID` AS `S ubCatID`,
3160                `Classif iedsAdvert isements`. `Message`,   3166                `Classif iedsAdvert isements`. `Message`,
3161                COUNT(`t c`.`cmt_id `) AS 'Com mCount'   3167                COUNT(`t c`.`cmt_id `) AS 'Com mCount'
3162                FROM `Cl assifiedsA dvertiseme nts`   3168                FROM `Cl assifiedsA dvertiseme nts`
3163                LEFT JOI N `Classif iedsSubs`   3169                LEFT JOI N `Classif iedsSubs`
3164                ON `Clas sifiedsSub s`.`ID`=`C lassifieds Advertisem ents`.`IDC lassifieds Subs`   3170                ON `Clas sifiedsSub s`.`ID`=`C lassifieds Advertisem ents`.`IDC lassifieds Subs`
3165                LEFT JOI N `Classif ieds`   3171                LEFT JOI N `Classif ieds`
3166                ON `Clas sifieds`.` ID`=`Class ifiedsSubs `.`IDClass ified`   3172                ON `Clas sifieds`.` ID`=`Class ifiedsSubs `.`IDClass ified`
3167                LEFT JOI N `Profile s` ON `Pro files`.`ID `=`Classif iedsAdvert isements`. `IDProfile `   3173                LEFT JOI N `Profile s` ON `Pro files`.`ID `=`Classif iedsAdvert isements`. `IDProfile `
3168                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `tc`.` cmt_object _id`=`Clas sifiedsAdv ertisement s`.`ID`   3174                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `tc`.` cmt_object _id`=`Clas sifiedsAdv ertisement s`.`ID`
3169                WHERE   3175                WHERE
3170                {$sProfi leS}   3176                {$sProfi leS}
3171                AND `Cla ssifiedsAd vertisemen ts`.`Statu s` = 'acti ve'   3177                AND `Cla ssifiedsAd vertisemen ts`.`Statu s` = 'acti ve'
3172                {$sTimeA ddon}   3178                {$sTimeA ddon}
3173                GROUP BY  `Classifi edsAdverti sements`.` ID`   3179                GROUP BY  `Classifi edsAdverti sements`.` ID`
3174                {$sOrder S}   3180                {$sOrder S}
3175                {$sLimit }   3181                {$sLimit }
3176           ";   3182           ";
3177     3183  
3178           $r Blogs = db _res( $sQu ery );   3184           $r Blogs = db _res( $sQu ery );
3179     3185  
3180           if ( !mysql_n um_rows( $ rBlogs ) )   3186           if ( !mysql_n um_rows( $ rBlogs ) )
3181                return ' ';   3187                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
3182     3188  
3183           $s Blocks = ' ';   3189           $s Blocks = ' ';
3184     3190  
3185           wh ile( $aBlo g = mysql_ fetch_asso c( $rBlogs  ) ) {   3191           wh ile( $aBlo g = mysql_ fetch_asso c( $rBlogs  ) ) {
3186                if ($sOr der == 'to p' && $aBl og['CommCo unt'] == 0 )   3192                if ($sOr der == 'to p' && $aBl og['CommCo unt'] == 0 )
3187                    cont inue;   3193                    cont inue;
3188     3194  
3189                $sPic =  $this->get ImageCode( $aBlog['Me dia'],TRUE );   3195                $sPic =  $this->get ImageCode( $aBlog['Me dia'],TRUE );
3190     3196  
3191                $sGenUrl  = $this-> genUrl($aB log['ID'],  $aBlog['E ntryUri']) ;   3197                $sGenUrl  = $this-> genUrl($aB log['ID'],  $aBlog['E ntryUri']) ;
3192                $sGenCUr l = ($this ->bUseFrie ndlyLinks  && $this-> bAdminMode  == false)  ? $site[' url'].'ads /cat/'.$aB log['CEntr yUri'] : " {$this->sC urrBrowsed File}?bCla ssifiedID= {$aBlog['C atID']}";   3198                $sGenCUr l = ($this ->bUseFrie ndlyLinks  && $this-> bAdminMode  == false)  ? $site[' url'].'ads /cat/'.$aB log['CEntr yUri'] : " {$this->sC urrBrowsed File}?bCla ssifiedID= {$aBlog['C atID']}";
3193                $sGenSCU rl = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/subcat/' .$aBlog['S EntryUri']  : "{$this ->sCurrBro wsedFile}? bSubClassi fiedID={$a Blog['SubC atID']}";   3199                $sGenSCU rl = ($thi s->bUseFri endlyLinks  && $this- >bAdminMod e == false ) ? $site[ 'url'].'ad s/subcat/' .$aBlog['S EntryUri']  : "{$this ->sCurrBro wsedFile}? bSubClassi fiedID={$a Blog['SubC atID']}";
3194     3200  
3195                $sLinkMo re = '';   3201                $sLinkMo re = '';
3196                if( strl en( $aBlog ['Message' ]) > $iBlo gLimitChar s )    3202                if( strl en( $aBlog ['Message' ]) > $iBlo gLimitChar s ) 
3197                    $sLi nkMore = " ... <a hre f=\"{$sGen Url}\">"._ t('_Read m ore')."</a >";   3203                    $sLi nkMore = " ... <a hre f=\"{$sGen Url}\">"._ t('_Read m ore')."</a >";
3198     3204  
3199                $sBlogSn ippet = mb _substr( s trip_tags(  $aBlog['M essage'] ) , 0, $iBlo gLimitChar s ) . $sLi nkMore;   3205                $sBlogSn ippet = mb _substr( s trip_tags(  $aBlog['M essage'] ) , 0, $iBlo gLimitChar s ) . $sLi nkMore;
3200                
$sDataTime Formatted   =   date(   $php_date_ format,   $aBlog['Da teTime_f']   );
  3206                 // $sDataTime Formatted   =   date(   $php_date_ format,   $aBlog['Da teTime_f']   );
    3207                $sDataTi meFormatte d = Locale dDataTime( $aBlog['Da teTime_f'] );
3201                $sInCatF ormatted =  _t( '_in  Category',  getTempla teIcon( 'a d_category .gif' ), $ sGenCUrl,  process_li ne_output( $aBlog['Na me']) );   3208                $sInCatF ormatted =  _t( '_in  Category',  getTempla teIcon( 'a d_category .gif' ), $ sGenCUrl,  process_li ne_output( $aBlog['Na me']) );
3202                $sSubNam eF = proce ss_line_ou tput($aBlo g['NameSub ']);   3209                $sSubNam eF = proce ss_line_ou tput($aBlo g['NameSub ']);
3203                $sCommen tsF = _t(  '_comments  N', getTe mplateIcon ( 'add_com ment.gif'  ), $aBlog[ 'CommCount '] );   3210                $sCommen tsF = _t(  '_comments  N', getTe mplateIcon ( 'add_com ment.gif'  ), $aBlog[ 'CommCount '] );
3204                $sSubjec tF = proce ss_line_ou tput( $arr ['Subject' ] );   3211                $sSubjec tF = proce ss_line_ou tput( $arr ['Subject' ] );
3205     3212  
3206                $sBlocks  .= <<<EOF   3213                $sBlocks  .= <<<EOF
3207   <div class ="blog_blo ck">   3214   <div class ="blog_blo ck">
3208       <div c lass="icon _block">   3215       <div c lass="icon _block">
3209           <d iv class=" thumbnail_ block" sty le="float: left;">   3216           <d iv class=" thumbnail_ block" sty le="float: left;">
3210                <a href= "{$sGenUrl }" class=" bottom_tex t">   3217                <a href= "{$sGenUrl }" class=" bottom_tex t">
3211                    {$sP ic}   3218                    {$sP ic}
3212                </a>   3219                </a>
3213           </ div>   3220           </ div>
3214       </div>   3221       </div>
3215       <div c lass="blog _wrapper_n ">   3222       <div c lass="blog _wrapper_n ">
3216           <d iv class=" blog_subje ct_n">   3223           <d iv class=" blog_subje ct_n">
3217                <a href= "{$sGenUrl }" class=" bottom_tex t">   3224                <a href= "{$sGenUrl }" class=" bottom_tex t">
3218                    {$sS ubjectF}   3225                    {$sS ubjectF}
3219                </a>   3226                </a>
3220           </ div>   3227           </ div>
3221           <d iv class=" blogInfo">   3228           <d iv class=" blogInfo">
3222                <span><i mg src="{$ sClockIcon }" alt=""  />{$sDataT imeFormatt ed} </span >   3229                <span><i mg src="{$ sClockIcon }" alt=""  />{$sDataT imeFormatt ed} </span >
3223                <span>{$ sInCatForm atted} / < a href="{$ sGenCUrl}" >{$sSubNam eF}</a></s pan>   3230                <span>{$ sInCatForm atted} / < a href="{$ sGenCUrl}" >{$sSubNam eF}</a></s pan>
3224                <span>{$ sCommentsF }</span>   3231                <span>{$ sCommentsF }</span>
3225           </ div>   3232           </ div>
3226           <d iv class=" blogSnippe t">   3233           <d iv class=" blogSnippe t">
3227                {$sBlogS nippet}   3234                {$sBlogS nippet}
3228           </ div>   3235           </ div>
3229       </div>   3236       </div>
3230   </div>   3237   </div>
3231   <div class ="clear_bo th"></div>   3238   <div class ="clear_bo th"></div>
3232   EOF;   3239   EOF;
3233           }   3240           }
3234     3241  
    3242           if  ($sBlocks  == '') $s Blocks = M sgBox(_t(' _Sorry, no thing foun d'));
3235           re turn $sBlo cks;   3243           re turn $sBlo cks;
3236       }   3244       }
3237     3245  
3238       functi on process _html_db_i nput( $sTe xt ) {   3246       functi on process _html_db_i nput( $sTe xt ) {
3239           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));   3247           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));
3240       }   3248       }
3241   }   3249   }
3242   ?>   3250   ?>