17. File Comparison Report

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

17.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc\classes BxDolClassifieds.php Tue Jun 3 11:07:42 2008 UTC
2 Dolphin-v.6.1.3\inc\classes BxDolClassifieds.php Wed Jul 16 09:51:19 2008 UTC

17.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 56 6334
Changed 50 146
Inserted 0 0
Removed 5 9

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

17.4 Active regular expressions

No regular expressions were active.

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