187. File Comparison Report

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

187.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\inc\classes BxDolClassifieds.php Wed Mar 5 05:31:24 2008 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolClassifieds.php Mon Apr 28 12:58:26 2008 UTC

187.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 133 5522
Changed 75 224
Inserted 55 467
Removed 2 4

187.3 Comparison options

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

187.4 Active regular expressions

No regular expressions were active.

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