15. File Comparison Report

Produced on Thu Jul 17 07:17:06 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

15.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc\classes BxDolArticles.php Mon May 26 10:15:40 2008 UTC
2 Dolphin-v.6.1.3\inc\classes BxDolArticles.php Wed Jul 16 09:51:19 2008 UTC

15.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 24 1350
Changed 20 62
Inserted 2 5
Removed 1 1

15.3 Comparison options

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

15.4 Active regular expressions

No regular expressions were active.

15.5 Comparison detail

1   <?   1   <?
    2  
2   require_on ce(BX_DIRE CTORY_PATH _INC . 'he ader.inc.p hp' );   3   require_on ce(BX_DIRE CTORY_PATH _INC . 'he ader.inc.p hp' );
3   require_on ce(BX_DIRE CTORY_PATH _INC . 'ad min.inc.ph p');   4   require_on ce(BX_DIRE CTORY_PATH _INC . 'ad min.inc.ph p');
4   require_on ce(BX_DIRE CTORY_PATH _INC . 'de sign.inc.p hp' );   5   require_on ce(BX_DIRE CTORY_PATH _INC . 'de sign.inc.p hp' );
5   require_on ce(BX_DIRE CTORY_PATH _INC . 'pr ofiles.inc .php' );   6   require_on ce(BX_DIRE CTORY_PATH _INC . 'pr ofiles.inc .php' );
6   require_on ce(BX_DIRE CTORY_PATH _INC . 'ut ils.inc.ph p' );   7   require_on ce(BX_DIRE CTORY_PATH _INC . 'ut ils.inc.ph p' );
7   require_on ce(BX_DIRE CTORY_PATH _INC . 'ta gs.inc.php ' );   8   require_on ce(BX_DIRE CTORY_PATH _INC . 'ta gs.inc.php ' );
8     9  
9   /*   10   /*
10    * class f or Events   11    * class f or Events
11    */   12    */
12   class BxDo lArticles  {   13   class BxDo lArticles  {
13     14  
14       //admi n mode, ca n All acti ons   15       //admi n mode, ca n All acti ons
15       var $b AdminMode;   16       var $b AdminMode;
16     17  
17       var $s CurrBrowse dFile;   18       var $s CurrBrowse dFile;
18     19  
19       var $i VisitorID;   20       var $i VisitorID;
20     21  
21       var $s Url;   22       var $s Url;
22          23       
23       //cons tructor   24       //cons tructor
24       functi on BxDolAr ticles( $l ogged, $sC urrBrowsed File='' )  {   25       functi on BxDolAr ticles( $l ogged, $sC urrBrowsed File='' )  {
25           gl obal $site ;   26           gl obal $site ;
26     27  
27           $t his->bAdmi nMode = $l ogged['adm in'] ? tru e : false;   28           $t his->bAdmi nMode = $l ogged['adm in'] ? tru e : false;
28           $t his->iVisi torID = (i nt)$_COOKI E['memberI D'];   29           $t his->iVisi torID = (i nt)$_COOKI E['memberI D'];
29           $t his->sCurr BrowsedFil e = ($sCur rBrowsedFi le=='') ?  $_SERVER[' PHP_SELF']  : $sCurrB rowsedFile ;   30           $t his->sCurr BrowsedFil e = ($sCur rBrowsedFi le=='') ?  $_SERVER[' PHP_SELF']  : $sCurrB rowsedFile ;
30     31  
31           if ( $this->b AdminMode  ) {   32           if ( $this->b AdminMode  ) {
32                $this->s Url = $sit e['url_adm in'];   33                $this->s Url = $sit e['url_adm in'];
33           }  else {   34           }  else {
34                $this->s Url = $sit e['url'];   35                $this->s Url = $sit e['url'];
35           }   36           }
36       }   37       }
37     38  
38       /**   39       /**
39        *    40        * 
40        *   41        *
41        * @pa ram    42        * @pa ram 
42        * @re turn HTML  presentati on of data   43        * @re turn HTML  presentati on of data
43        */   44        */
44       functi on getArti clesCatego riesList(  $resurs =  false ) {   45       functi on getArti clesCatego riesList(  $resurs =  false ) {
45           gl obal $site ;   46           gl obal $site ;
46           gl obal $sUrl ;   47           gl obal $sUrl ;
47     48  
48           $s AddCategor yC = _t('_ Add Catego ry');   49           $s AddCategor yC = _t('_ Add Catego ry');
49           $s AddNewArti cleC = _t( '_Add New  Article');   50           $s AddNewArti cleC = _t( '_Add New  Article');
50           $s EditC = _t ('_Edit');   51           $s EditC = _t ('_Edit');
51           $s DeleteC =  _t('_Delet e');   52           $s DeleteC =  _t('_Delet e');
52           $s SureC = _t ('_are you  sure?');   53           $s SureC = _t ('_are you  sure?');
53     54  
54           $s CategQuery  = "   55           $s CategQuery  = "
55                    SELE CT   56                    SELE CT
56                             `Categ oryID`,   57                             `Categ oryID`,
57                             `Categ oryName`,   58                             `Categ oryName`,
58                             `Categ oryDescrip tion`   59                             `Categ oryDescrip tion`
59                    FROM   60                    FROM
60                             `Artic lesCategor y`   61                             `Artic lesCategor y`
61                    ORDE R BY `Cate goryID` AS C   62                    ORDE R BY `Cate goryID` AS C
62           ";   63           ";
63           $r Category =  db_res( $ sCategQuer y );   64           $r Category =  db_res( $ sCategQuer y );
64     65  
65           if ( $resurs  ) {   66           if ( $resurs  ) {
66                return $ rCategory;   67                return $ rCategory;
67           }  else {   68           }  else {
68                $ret = ' ';   69                $ret = ' ';
69     70  
70                $sAction s = '';   71                $sAction s = '';
71                if( $thi s->bAdminM ode ) {   72                if( $thi s->bAdminM ode ) {
72                    $sAc tions .= < <<EOF   73                    $sAc tions .= < <<EOF
73   <a href="{ $this->sUr l}articles .php?actio n=addcateg ory">{$sAd dCategoryC }</a>&nbsp ;   74   <a href="{ $this->sUr l}articles .php?actio n=addcateg ory">{$sAd dCategoryC }</a>&nbsp ;
74   EOF;   75   EOF;
75                }   76                }
76                if ($thi s->bAdminM ode || $th is->iVisit orID) {   77                if ($thi s->bAdminM ode || $th is->iVisit orID) {
77                $ret .=  <<<EOF   78                    $ret  .= <<<EOF
78   <div class ="addLink" >   79   <div class ="addLink" >
79       {$sAct ions}   80       {$sAct ions}
80       <a hre f="{$this- >sUrl}arti cles.php?a ction=adda rticle">{$ sAddNewArt icleC}</a>   81       <a hre f="{$this- >sUrl}arti cles.php?a ction=adda rticle">{$ sAddNewArt icleC}</a>
81   </div>   82   </div>
82   EOF;   83   EOF;
83   }   84   }
84                $i = '';   85                $i = '';
85                while ($ aCategory  = mysql_fe tch_assoc(  $rCategor y )) {   86                while ($ aCategory  = mysql_fe tch_assoc(  $rCategor y )) {
86                    if (  ($i%2) ==  0 ) {   87                    if (  ($i%2) ==  0 ) {
87                         $sStyleAdd  = '1';   88                         $sStyleAdd  = '1';
88                    } el se {   89                    } el se {
89                         $sStyleAdd  = '2';   90                         $sStyleAdd  = '2';
90                    }   91                    }
91     92  
92                    $sCa tegoryName  = process _line_outp ut( $aCate gory['Cate goryName']  );   93                    $sCa tegoryName  = process _line_outp ut( $aCate gory['Cate goryName']  );
93                    $sCa tegoryDesc ription =  process_ht ml_output(  $aCategor y['Categor yDescripti on'] );   94                    $sCa tegoryDesc ription =  process_ht ml_output(  $aCategor y['Categor yDescripti on'] );
94                    $sCa tegUrl = $ this->getA rticleCatU rl($aCateg ory['Categ oryID']);   95                    $sCa tegUrl = $ this->getA rticleCatU rl($aCateg ory['Categ oryID']);
95     96  
96                    $sAd minActions  = '';   97                    $sAd minActions  = '';
97                    if(  $this->bAd minMode) {   98                    if(  $this->bAd minMode) {
98                         $sAdminAct ions .= << <EOF   99                         $sAdminAct ions .= << <EOF
99   <div class ="category Edit">   100   <div class ="category Edit">
100       <a hre f="{$sUrl} articles.p hp?catID={ $aCategory ['Category ID']}&amp; action=cat egoryedit" >{$sEditC} </a>&nbsp;   101       <a hre f="{$sUrl} articles.p hp?catID={ $aCategory ['Category ID']}&amp; action=cat egoryedit" >{$sEditC} </a>&nbsp;
101       <a hre f="{$sUrl} articles.p hp?catID={ $aCategory ['Category ID']}&amp; action=cat egorydelet e" onclick ="javascri pt: return  confirm(' Do you rea ly want to  delete ca tegory {$a Category[' CategoryNa me']} and  all its ar ticles ')" >{$sDelete C}</a>   102       <a hre f="{$sUrl} articles.p hp?catID={ $aCategory ['Category ID']}&amp; action=cat egorydelet e" onclick ="javascri pt: return  confirm(' Do you rea ly want to  delete ca tegory {$a Category[' CategoryNa me']} and  all its ar ticles ')" >{$sDelete C}</a>
102   </div>   103   </div>
103   EOF;   104   EOF;
104                    }   105                    }
105     106  
106                    $ret  .= <<<EOF   107                    $ret  .= <<<EOF
107   <div class ="category Block{$sSt yleAdd}">   108   <div class ="category Block{$sSt yleAdd}">
108       <div c lass="cate goryCaptio n">   109       <div c lass="cate goryCaptio n">
109           <a  href="{$s CategUrl}" >{$sCatego ryName}</a >   110           <a  href="{$s CategUrl}" >{$sCatego ryName}</a >
110       </div>   111       </div>
111       <div c lass="clea r_both"></ div>   112       <div c lass="clea r_both"></ div>
112       <div c lass="cate goryDescri ption">   113       <div c lass="cate goryDescri ption">
113           {$ sCategoryD escription }   114           {$ sCategoryD escription }
114       </div>   115       </div>
115       {$sAdm inActions}   116       {$sAdm inActions}
116   </div>   117   </div>
117   EOF;   118   EOF;
118     119  
119                    $i++ ;   120                    $i++ ;
120                }   121                }
121                return $ ret;   122                return $ ret;
122           }   123           }
123       }   124       }
124     125  
125       functi on getArti clesList(  $iCategory ID ) {   126       functi on getArti clesList(  $iCategory ID ) {
126           gl obal $sUrl ;   127           gl obal $sUrl ;
127           gl obal $site ;   128           gl obal $site ;
128           gl obal $shor t_date_for mat;   129           gl obal $shor t_date_for mat;
129     130  
130           $s ArticlesC  = _t('_Art icles');   131           $s ArticlesC  = _t('_Art icles');
131           $s EditC = _t ('_Edit');   132           $s EditC = _t ('_Edit');
132           $s DeleteC =  _t('_Delet e');   133           $s DeleteC =  _t('_Delet e');
133           $s SureC = _t ('_are you  sure?');   134           $s SureC = _t ('_are you  sure?');
134     135  
135           $i CategoryID  = (int)$i CategoryID ;   136           $i CategoryID  = (int)$i CategoryID ;
136           if ( !(int)$i CategoryID  ) {   137           if ( !(int)$i CategoryID  ) {
137                return ' ';   138                return ' ';
138           }  else {   139           }  else {
139                $sCatego ryQuery =  "   140                $sCatego ryQuery =  "
140                         SELECT `Ca tegoryName `, `Catego ryDescript ion`   141                         SELECT `Ca tegoryName `, `Catego ryDescript ion`
141                         FROM `Arti clesCatego ry`   142                         FROM `Arti clesCatego ry`
142                         WHERE `Cat egoryID` =  '{$iCateg oryID}'   143                         WHERE `Cat egoryID` =  '{$iCateg oryID}'
143                         LIMIT 1;   144                         LIMIT 1;
144                ";   145                ";
145                $aCatego ry = db_ar r( $sCateg oryQuery ) ;   146                $aCatego ry = db_ar r( $sCateg oryQuery ) ;
146           }   147           }
147     148  
148           $s ArticlesQu ery = "   149           $s ArticlesQu ery = "
149                         SELECT `Ti tle`, `Tex t`, DATE_F ORMAT( `Da te`, '{$sh ort_date_f ormat}' )  AS Date, ` ArticlesID `, `Articl eFlag`, `o wnerID`   150                         SELECT `Ti tle`, `Tex t`, DATE_F ORMAT( `Da te`, '{$sh ort_date_f ormat}' )  AS Date, ` ArticlesID `, `Articl eFlag`, `o wnerID`
150                         FROM `Arti cles`   151                         FROM `Arti cles`
151                         WHERE `Cat egoryID` =  '{$iCateg oryID}'   152                         WHERE `Cat egoryID` =  '{$iCateg oryID}'
152           ";   153           ";
153           $r Articles =  db_res( $ sArticlesQ uery );   154           $r Articles =  db_res( $ sArticlesQ uery );
154     155  
155           $s CategoryNa me = proce ss_line_ou tput( $aCa tegory['Ca tegoryName '] );   156           $s CategoryNa me = proce ss_line_ou tput( $aCa tegory['Ca tegoryName '] );
156           $s CategoryDe scription  = process_ text_outpu t( $aCateg ory['Categ oryDescrip tion'] );   157           $s CategoryDe scription  = process_ text_outpu t( $aCateg ory['Categ oryDescrip tion'] );
157     158  
158     159  
159           $r et = <<<EO F   160           $r et = <<<EO F
160   <div class ="navigati onLinks">   161   <div class ="navigati onLinks">
161       <span> <a href="{ $sUrl}arti cles.php"> {$sArticle sC}</a></s pan>   162       <span> <a href="{ $sUrl}arti cles.php"> {$sArticle sC}</a></s pan>
162       <span> &gt;</span >   163       <span> &gt;</span >
163       <span> {$sCategor yName}</sp an>   164       <span> {$sCategor yName}</sp an>
164   </div>   165   </div>
165   <div class ="category Header">   166   <div class ="category Header">
166       <div c lass="artC aption">{$ sCategoryN ame}</div>   167       <div c lass="artC aption">{$ sCategoryN ame}</div>
167       <div>   168       <div>
168           {$ sCategoryD escription }   169           {$ sCategoryD escription }
169       </div>   170       </div>
170   </div>   171   </div>
171   EOF;   172   EOF;
172     173  
173           $i  = '';   174           $i  = '';
174           wh ile ( $aAr ticles = m ysql_fetch _assoc( $r Articles ) ) {   175           wh ile ( $aAr ticles = m ysql_fetch _assoc( $r Articles ) ) {
175                if ( ($i %2) == 0 )  {   176                if ( ($i %2) == 0 )  {
176                    $sSt yleAdd = ' 1';   177                    $sSt yleAdd = ' 1';
177                } else {   178                } else {
178                    $sSt yleAdd = ' 2';   179                    $sSt yleAdd = ' 2';
179                }   180                }
180     181  
181                $sArticl eUrl = $th is->getArt icleUrl($a Articles[' ArticlesID ']);   182                $sArticl eUrl = $th is->getArt icleUrl($a Articles[' ArticlesID ']);
182                $sArticl eTitle = p rocess_lin e_output(  $aArticles ['Title']  );   183                $sArticl eTitle = p rocess_lin e_output(  $aArticles ['Title']  );
183     184  
184                $sArticl eText = '' ;   185                $sArticl eText = '' ;
185                if( $aAr ticles['Ar ticleFlag' ] == 'HTML ' ) {   186                if( $aAr ticles['Ar ticleFlag' ] == 'HTML ' ) {
186                    $sAr ticleText  = process_ html_outpu t( strmaxt extlen( st rip_tags($ aArticles[ 'Text']),  200 ) ) .  "\n";   187                    $sAr ticleText  = process_ html_outpu t( strmaxt extlen( st rip_tags($ aArticles[ 'Text']),  200 ) ) .  "\n";
187                } else {   188                } else {
188                    $sAr ticleText  = strmaxte xtlen( $aA rticles['T ext'], 200  );   189                    $sAr ticleText  = strmaxte xtlen( $aA rticles['T ext'], 200  );
189                    //$s ArticleTex t = proces s_text_out put( strma xtextlen(  $aArticles ['Text'],  200 ) ) .  "\n";   190                    //$s ArticleTex t = proces s_text_out put( strma xtextlen(  $aArticles ['Text'],  200 ) ) .  "\n";
190                }   191                }
191     192  
192                $sAdminA ctions = ' ';   193                $sAdminA ctions = ' ';
193                if( $thi s->bAdminM ode || ($a Articles[' ownerID']  != 0 && $a Articles[' ownerID']  == $this-> iVisitorID  )) {   194                if( $thi s->bAdminM ode || ($a Articles[' ownerID']  != 0 && $a Articles[' ownerID']  == $this-> iVisitorID  )) {
194                    $sAd minActions  .= <<<EOF   195                    $sAd minActions  .= <<<EOF
195   <div class ="category Edit">   196   <div class ="category Edit">
196       <a hre f="{$this- >sUrl}arti cles.php?a rticleID={ $aArticles ['Articles ID']}&amp; action=edi tarticle"> {$sEditC}< /a>&nbsp;   197       <a hre f="{$this- >sUrl}arti cles.php?a rticleID={ $aArticles ['Articles ID']}&amp; action=edi tarticle"> {$sEditC}< /a>&nbsp;
197       <a hre f="{$this- >sUrl}arti cles.php?a rticleID={ $aArticles ['Articles ID']}&amp; action=del etearticle " onclick= "javascrip t: return  confirm('{ $sSureC}') ">{$sDelet eC}</a>   198       <a hre f="{$this- >sUrl}arti cles.php?a rticleID={ $aArticles ['Articles ID']}&amp; action=del etearticle " onclick= "javascrip t: return  confirm('{ $sSureC}') ">{$sDelet eC}</a>
198   </div>   199   </div>
199   EOF;   200   EOF;
200                }   201                }
201     202  
202                $ret .=  <<<EOF   203                $ret .=  <<<EOF
203   <div class ="articleB lock{$sSty leAdd}">   204   <div class ="articleB lock{$sSty leAdd}">
204       <div c lass="titl e">   205       <div c lass="titl e">
205           <a  href="{$s ArticleUrl }">{$sArti cleTitle}< /a>   206           <a  href="{$s ArticleUrl }">{$sArti cleTitle}< /a>
206       </div>   207       </div>
207       <div c lass="date ">{$aArtic les['Date' ]}</div>   208       <div c lass="date ">{$aArtic les['Date' ]}</div>
208       <div c lass="prev iew">   209       <div c lass="prev iew">
209           {$ sArticleTe xt}   210           {$ sArticleTe xt}
210       </div>   211       </div>
211       {$sAdm inActions}   212       {$sAdm inActions}
212   </div>   213   </div>
213   EOF;   214   EOF;
214                $i++;   215                $i++;
215           }   216           }
216           re turn $ret;   217           re turn $ret;
217       }   218       }
218     219  
219       functi on getArti cle( $iArt icleID ) {   220       functi on getArti cle( $iArt icleID ) {
220           gl obal $shor t_date_for mat;   221           gl obal $shor t_date_for mat;
221     222  
222           $s ArticlesC  = _t('_Art icles');   223           $s ArticlesC  = _t('_Art icles');
223     224  
224           if ( !(int)$i ArticleID  ) {   225           if ( !(int)$i ArticleID  ) {
225                return ' ';   226                return ' ';
226           }  else {   227           }  else {
227                $sArticl eQuery = "   228                $sArticl eQuery = "
228                         SELECT `Ti tle`, `Tex t`, `Artic les`.`Cate goryID`, D ATE_FORMAT ( `Date`,  '{$short_d ate_format }' ) AS Da te,   229                         SELECT `Ti tle`, `Tex t`, `Artic les`.`Cate goryID`, D ATE_FORMAT ( `Date`,  '{$short_d ate_format }' ) AS Da te,
229                                 `A rticlesID` , `Categor yName`, `A rticleFlag `, `ownerI D`   230                                 `A rticlesID` , `Categor yName`, `A rticleFlag `, `ownerI D`
230                         FROM `Arti cles`   231                         FROM `Arti cles`
231                         INNER JOIN  `Articles Category`  ON `Articl es`.`Categ oryID` = ` ArticlesCa tegory`.`C ategoryID`   232                         INNER JOIN  `Articles Category`  ON `Articl es`.`Categ oryID` = ` ArticlesCa tegory`.`C ategoryID`
232                         WHERE `Art iclesID` =  '{$iArtic leID}'   233                         WHERE `Art iclesID` =  '{$iArtic leID}'
233                         LIMIT 1;   234                         LIMIT 1;
234                ";   235                ";
235           }   236           }
236           $a Article =  db_arr( $s ArticleQue ry );   237           $a Article =  db_arr( $s ArticleQue ry );
237     238  
238           $s CategoryNa me = proce ss_line_ou tput( $aAr ticle['Cat egoryName' ] );   239           $s CategoryNa me = proce ss_line_ou tput( $aAr ticle['Cat egoryName' ] );
239           $s Title = pr ocess_line _output( $ aArticle[' Title']);   240           $s Title = pr ocess_line _output( $ aArticle[' Title']);
240           $s Text = '';   241           $s Text = '';
241           if ( $aArticl e['Article Flag'] ==  'HTML' ) {   242           if ( $aArticl e['Article Flag'] ==  'HTML' ) {
242                $sText =  process_h tml_output ( $aArticl e['Text']  ) . "\n";   243                $sText =  process_h tml_output ( $aArticl e['Text']  ) . "\n";
243           }  else {   244           }  else {
244                $sText =  process_t ext_output ( $aArticl e['Text']  ) . "\n";   245                $sText =  process_t ext_output ( $aArticl e['Text']  ) . "\n";
245           }   246           }
246     247  
247       $ret =  <<<EOF   248       $ret =  <<<EOF
248   <div class ="navigati onLinks">   249   <div class ="navigati onLinks">
249       <span> <a href="a rticles.ph p">{$sArti clesC}</a> </span>   250       <span> <a href="a rticles.ph p">{$sArti clesC}</a> </span>
250       <span> &gt;</span >   251       <span> &gt;</span >
251       <span> <a href="a rticles.ph p?catID={$ aArticle[' CategoryID ']}&amp;ac tion=viewc ategory">{ $sCategory Name}</a>< /span>   252       <span> <a href="a rticles.ph p?catID={$ aArticle[' CategoryID ']}&amp;ac tion=viewc ategory">{ $sCategory Name}</a>< /span>
252       <span> &gt;</span >   253       <span> &gt;</span >
253       <span> {$sTitle}< /span>   254       <span> {$sTitle}< /span>
254   </div>   255   </div>
255   <div class ="articleB lock">   256   <div class ="articleB lock">
256       <div c lass="main Title">{$s Title}</di v>   257       <div c lass="main Title">{$s Title}</di v>
257       <div c lass="date ">{$aArtic le['Date'] }</div>   258       <div c lass="date ">{$aArtic le['Date'] }</div>
258       <div>{ $sText}</d iv>   259       <div>{ $sText}</d iv>
259   </div>   260   </div>
260   EOF;   261   EOF;
261           re turn $ret;   262           re turn $ret;
262       }   263       }
263     264  
264       functi on getArti clesCatego ryEditForm ( $iCatego ryID = ''  ) {   265       functi on getArti clesCatego ryEditForm ( $iCatego ryID = ''  ) {
265           gl obal $site ;   266           gl obal $site ;
266     267  
267           $s ArticlesC  = _t('_Art icles');   268           $s ArticlesC  = _t('_Art icles');
268           $s CategoryCa ptionC = _ t('_Catego ry Caption ');   269           $s CategoryCa ptionC = _ t('_Catego ry Caption ');
269           $s CategoryDe scriptionC  = _t('_ca tegory_des cription') ;   270           $s CategoryDe scriptionC  = _t('_ca tegory_des cription') ;
270     271  
271           $r et = '';   272           $r et = '';
272     273  
273           if ( (int)$iC ategoryID  ) {   274           if ( (int)$iC ategoryID  ) {
274                $sEditCa tegoryQuer y = "   275                $sEditCa tegoryQuer y = "
275                    SELE CT `Catego ryID`, `Ca tegoryName `, `Catego ryDescript ion`   276                    SELE CT `Catego ryID`, `Ca tegoryName `, `Catego ryDescript ion`
276                    FROM  `Articles Category`   277                    FROM  `Articles Category`
277                    WHER E `Categor yID` = '{$ iCategoryI D}'   278                    WHER E `Categor yID` = '{$ iCategoryI D}'
278                    LIMI T 1;   279                    LIMI T 1;
279                ";   280                ";
280                $aCatego ry = db_ar r( $sEditC ategoryQue ry );   281                $aCatego ry = db_ar r( $sEditC ategoryQue ry );
281           }   282           }
282     283  
283           $r et .= <<<E OF   284           $r et .= <<<E OF
284   <div class ="navigati onLinks">   285   <div class ="navigati onLinks">
285       <span> <a href="a rticles.ph p">{$sArti clesC}</a> </span>   286       <span> <a href="a rticles.ph p">{$sArti clesC}</a> </span>
286   </div>   287   </div>
287   EOF;   288   EOF;
288     289  
289           $r et .= <<<E OF   290           $r et .= <<<E OF
290   <script ty pe="text/j avascript" >   291   <script ty pe="text/j avascript" >
291   function c heckForm()  {   292   function c heckForm()  {
292       var el ;   293       var el ;
293       var ha sErr = fal se;   294       var ha sErr = fal se;
294       var fi ld = "";   295       var fi ld = "";
295     296  
296       el = d ocument.ge tElementBy Id("captio n");   297       el = d ocument.ge tElementBy Id("captio n");
297       if( el .value.len gth < 3 )  {   298       if( el .value.len gth < 3 )  {
298           el .style.bac kgroundCol or = "pink ";   299           el .style.bac kgroundCol or = "pink ";
299           ha sErr = tru e;   300           ha sErr = tru e;
300           fi ld += " Ca tegory Tit le ";   301           fi ld += " Ca tegory Tit le ";
301       } else  {   302       } else  {
302           el .style.bac kgroundCol or = "#fff ";   303           el .style.bac kgroundCol or = "#fff ";
303       }   304       }
304     305  
305       el = d ocument.ge tElementBy Id("descri ption");   306       el = d ocument.ge tElementBy Id("descri ption");
306       if( el .value.len gth < 3 )  {   307       if( el .value.len gth < 3 )  {
307           el .style.bac kgroundCol or = "pink ";   308           el .style.bac kgroundCol or = "pink ";
308           ha sErr = tru e;   309           ha sErr = tru e;
309           fi ld += " Ca tegory Des cription";   310           fi ld += " Ca tegory Des cription";
310       } else  {   311       } else  {
311           el .style.bac kgroundCol or = "#fff ";   312           el .style.bac kgroundCol or = "#fff ";
312       }   313       }
313     314  
314       if (ha sErr) {   315       if (ha sErr) {
315           al ert( "Plea se fill ne xt fields  first!" +  fild )   316           al ert( "Plea se fill ne xt fields  first!" +  fild )
316           re turn false ;   317           re turn false ;
317       } else  {   318       } else  {
318           re turn true;   319           re turn true;
319       }   320       }
320   }   321   }
321   </script>   322   </script>
322   EOF;   323   EOF;
323     324  
324           $s FormInputs  = '';   325           $s FormInputs  = '';
325           if ( (int)$iC ategoryID  ) {   326           if ( (int)$iC ategoryID  ) {
326                $sFormIn puts .= '< input type ="hidden"  name="edit _category"  value="tr ue" />' .  "\n";   327                $sFormIn puts .= '< input type ="hidden"  name="edit _category"  value="tr ue" />' .  "\n";
327                $sFormIn puts .= '< input type ="hidden"  name="cate goryID" va lue="' . $ iCategoryI D . '" />'  . "\n";   328                $sFormIn puts .= '< input type ="hidden"  name="cate goryID" va lue="' . $ iCategoryI D . '" />'  . "\n";
328           }  else {   329           }  else {
329                $sFormIn puts .= '< input type ="hidden"  name="add_ category"  value="tru e" />' . " \n";   330                $sFormIn puts .= '< input type ="hidden"  name="add_ category"  value="tru e" />' . " \n";
330           }   331           }
331     332  
332           $s CategoryNa me = proce ss_line_ou tput( $aCa tegory['Ca tegoryName '] );   333           $s CategoryNa me = proce ss_line_ou tput( $aCa tegory['Ca tegoryName '] );
333           $s CategoryDe scription  = process_ text_outpu t( $aCateg ory['Categ oryDescrip tion'] );   334           $s CategoryDe scription  = process_ text_outpu t( $aCateg ory['Categ oryDescrip tion'] );
334     335  
335           $r et .= <<<E OF   336           $r et .= <<<E OF
336   <div class ="articles FormBlock" >   337   <div class ="articles FormBlock" >
337       <form  method="po st" action ="{$this-> sUrl}artic les.php" o nsubmit="r eturn chec kForm();">   338       <form  method="po st" action ="{$this-> sUrl}artic les.php" o nsubmit="r eturn chec kForm();">
338           <d iv>{$sCate goryCaptio nC}</div>   339           <d iv>{$sCate goryCaptio nC}</div>
339           <d iv>   340           <d iv>
340                <input t ype="text"  name="cap tion" id=" caption" c lass="catC aption" va lue="{$sCa tegoryName }" />   341                <input t ype="text"  name="cap tion" id=" caption" c lass="catC aption" va lue="{$sCa tegoryName }" />
341           </ div>   342           </ div>
342           <d iv>{$sCate goryDescri ptionC}</d iv>   343           <d iv>{$sCate goryDescri ptionC}</d iv>
343           <d iv>   344           <d iv>
344                <textare a name="de scription"   id="desc ription" c lass="catD esc">{$sCa tegoryDesc ription}</ textarea>   345                <textare a name="de scription"   id="desc ription" c lass="catD esc">{$sCa tegoryDesc ription}</ textarea>
345           </ div>   346           </ div>
346           <d iv>   347           <d iv>
347                <input t ype="submi t" value=" Submit">   348                <input t ype="submi t" value=" Submit">
348                {$sFormI nputs}   349                {$sFormI nputs}
349           </ div>   350           </ div>
350       </form >   351       </form >
351   </div>   352   </div>
352   EOF;   353   EOF;
353     354  
354           re turn $ret;   355           re turn $ret;
355       }   356       }
356     357  
357       functi on getArti cleEditFor m( $iArtic leID = ''  ) {   358       functi on getArti cleEditFor m( $iArtic leID = ''  ) {
358           $s EditArticl eC = _t('_ Edit Artic le');   359           $s EditArticl eC = _t('_ Edit Artic le');
359           $s ArticlesC  = _t('_Art icles');   360           $s ArticlesC  = _t('_Art icles');
360           $s ArticleC =  _t('_Arti cle');   361           $s ArticleC =  _t('_Arti cle');
361           $s ArticleTit leC = _t(' _Article T itle');   362           $s ArticleTit leC = _t(' _Article T itle');
362           $s SelectCate goryC = _t ('_Select  Category') ;   363           $s SelectCate goryC = _t ('_Select  Category') ;
363           $s PrintAsC =  _t('_Prin t As');   364           $s PrintAsC =  _t('_Prin t As');
364     365  
365           $r Catories =  $this->ge tArticlesC ategoriesL ist( true  );   366           $r Catories =  $this->ge tArticlesC ategoriesL ist( true  );
366     367  
367           if ( (int)$iA rticleID )  {   368           if ( (int)$iA rticleID )  {
368                $article Query = "   369                $article Query = "
369                    SELE CT `Articl es`.`Artic lesID`, `A rticles`.` CategoryID `, `Articl es`.`Date` ,   370                    SELE CT `Articl es`.`Artic lesID`, `A rticles`.` CategoryID `, `Articl es`.`Date` ,
370                             `Artic les`.`Titl e`, `Artic les`.`Text `, `Articl es`.`Artic leFlag`, ` ArticlesCa tegory`.`C ategoryNam e`   371                             `Artic les`.`Titl e`, `Artic les`.`Text `, `Articl es`.`Artic leFlag`, ` ArticlesCa tegory`.`C ategoryNam e`
371                    FROM  `Articles `   372                    FROM  `Articles `
372                    INNE R JOIN `Ar ticlesCate gory` ON   `ArticlesC ategory`.` CategoryID ` = `Artic les`.`Cate goryID`   373                    INNE R JOIN `Ar ticlesCate gory` ON   `ArticlesC ategory`.` CategoryID ` = `Artic les`.`Cate goryID`
373                    WHER E `Article s`.`Articl esID` = '{ $iArticleI D}';   374                    WHER E `Article s`.`Articl esID` = '{ $iArticleI D}';
374                ";   375                ";
375                $aArticl e = db_arr ( $article Query );   376                $aArticl e = db_arr ( $article Query );
376           }   377           }
377     378  
378           $s CategoryNa meAd = '';   379           $s CategoryNa meAd = '';
379           if ( $iArticl eID && str len( $aArt icle['Cate goryName']  ) ) {   380           if ( $iArticl eID && str len( $aArt icle['Cate goryName']  ) ) {
380                $sCatego ryNameAd =  <<<EOF   381                $sCatego ryNameAd =  <<<EOF
381   <span>&gt; </span>   382   <span>&gt; </span>
382   <span><a h ref="{$thi s->sUrl}ar ticles.php ?catID={$a Article['C ategoryID' ]}&amp;act ion=viewca tegory">{$ aArticle[' CategoryNa me']}</a>< /span>   383   <span><a h ref="{$thi s->sUrl}ar ticles.php ?catID={$a Article['C ategoryID' ]}&amp;act ion=viewca tegory">{$ aArticle[' CategoryNa me']}</a>< /span>
383   <span>&gt; </span>   384   <span>&gt; </span>
384   <span>{$sE ditArticle C}</span>   385   <span>{$sE ditArticle C}</span>
385   EOF;   386   EOF;
386           }   387           }
387     388  
388           $s RetCateg =  '';   389           $s RetCateg =  '';
389           wh ile ( $aCa tegory = m ysql_fetch _assoc( $r Catories )  ) {   390           wh ile ( $aCa tegory = m ysql_fetch _assoc( $r Catories )  ) {
390                if( $aAr ticle['Cat egoryID']  == $aCateg ory['Categ oryID'] )  {   391                if( $aAr ticle['Cat egoryID']  == $aCateg ory['Categ oryID'] )  {
391                    $sSe lectedCate gory = ' s elected="s elected"';   392                    $sSe lectedCate gory = ' s elected="s elected"';
392                } else {   393                } else {
393                    $sSe lectedCate gory = '';   394                    $sSe lectedCate gory = '';
394                }   395                }
395                $sRetCat eg .= '<op tion value ="' . $aCa tegory['Ca tegoryID']  . '"' . $ sSelectedC ategory .  '>' . proc ess_line_o utput( str maxtextlen ( $aCatego ry['Catego ryName'],  50 ) ) . ' </option>'  . "\n";   396                $sRetCat eg .= '<op tion value ="' . $aCa tegory['Ca tegoryID']  . '"' . $ sSelectedC ategory .  '>' . proc ess_line_o utput( str maxtextlen ( $aCatego ry['Catego ryName'],  50 ) ) . ' </option>'  . "\n";
396           }   397           }
397     398  
398           $s ArticleAct ions = '';   399           $s ArticleAct ions = '';
399           if ( (int)$iA rticleID )  {   400           if ( (int)$iA rticleID )  {
400                $sArticl eActions . = '<input  type="hidd en" name=" edit_artic le" value= "true" />'  . "\n";   401                $sArticl eActions . = '<input  type="hidd en" name=" edit_artic le" value= "true" />'  . "\n";
401                $sArticl eActions . = '<input  type="hidd en" name=" articleID"  value="'  . $iArticl eID . '" / >' . "\n";   402                $sArticl eActions . = '<input  type="hidd en" name=" articleID"  value="'  . $iArticl eID . '" / >' . "\n";
402           }  else {   403           }  else {
403                $sArticl eActions . = '<input  type="hidd en" name=" add_articl e" value=" true" />'  . "\n";   404                $sArticl eActions . = '<input  type="hidd en" name=" add_articl e" value=" true" />'  . "\n";
404           }   405           }
405     406  
406           $s Title = pr ocess_line _output( $ aArticle[' Title'] );   407           $s Title = pr ocess_line _output( $ aArticle[' Title'] );
407     408  
408           $t extSelecte d = ( $aAr ticle['Art icleFlag']  == 'Text'  ) ? ' sel ected="sel ected"' :  '';   409           $t extSelecte d = ( $aAr ticle['Art icleFlag']  == 'Text'  ) ? ' sel ected="sel ected"' :  '';
409           $h tmlSelecte d = ( $aAr ticle['Art icleFlag']  == 'HTML'  ) ? ' sel ected="sel ected"' :  '';   410           $h tmlSelecte d = ( $aAr ticle['Art icleFlag']  == 'HTML'  ) ? ' sel ected="sel ected"' :  '';
410     411  
411           $r et = <<<EO F   412           $r et = <<<EO F
412   <div class ="navigati onLinks">   413   <div class ="navigati onLinks">
413       <span> <a href="{ $this->sUr l}articles .php">{$sA rticlesC}< /a></span>   414       <span> <a href="{ $this->sUr l}articles .php">{$sA rticlesC}< /a></span>
414       {$sCat egoryNameA d}   415       {$sCat egoryNameA d}
415   </div>   416   </div>
416     417  
417   <script ty pe="text/j avascript" >   418   <script ty pe="text/j avascript" >
418   function c heckForm()  {   419   function c heckForm()  {
419       var el ;   420       var el ;
420       var ha sErr = fal se;   421       var ha sErr = fal se;
421       var fi ld = "";   422       var fi ld = "";
422       el = d ocument.ge tElementBy Id("articl eTitle");   423       el = d ocument.ge tElementBy Id("articl eTitle");
423       if( el .value.len gth < 3 )  {   424       if( el .value.len gth < 3 )  {
424           el .style.bac kgroundCol or = "pink ";   425           el .style.bac kgroundCol or = "pink ";
425           ha sErr = tru e;   426           ha sErr = tru e;
426           fi ld += " Ar ticle Titl e";   427           fi ld += " Ar ticle Titl e";
427       } else  {   428       } else  {
428           el .style.bac kgroundCol or = "#fff ";   429           el .style.bac kgroundCol or = "#fff ";
429       }   430       }
430     431  
431       el = d ocument.ge tElementBy Id("articl eBody");   432       el = d ocument.ge tElementBy Id("articl eBody");
432       if( el .value.len gth < 3 )  {   433       if( el .value.len gth < 3 )  {
433           if  (typeof t inyMCE !=  'undefined ') {//here  Tiny   434           if  (typeof t inyMCE !=  'undefined ') {//here  Tiny
434                if( tiny MCE.select edElement. innerHTML. length < 3  ) {   435                if( tiny MCE.select edElement. innerHTML. length < 3  ) {
435                    el.s tyle.backg roundColor  = "pink";   436                    el.s tyle.backg roundColor  = "pink";
436                    hasE rr = true;   437                    hasE rr = true;
437                    fild  += " Arti cle text";   438                    fild  += " Arti cle text";
438                } else {   439                } else {
439                    el.s tyle.backg roundColor  = "#fff";   440                    el.s tyle.backg roundColor  = "#fff";
440                }   441                }
441           }   442           }
442       } else  {   443       } else  {
443           el .style.bac kgroundCol or = "#fff ";   444           el .style.bac kgroundCol or = "#fff ";
444       }   445       }
445     446  
446       el = d ocument.ge tElementBy Id("catego ryID");   447       el = d ocument.ge tElementBy Id("catego ryID");
447       if( el .value.len gth < 1 )  {   448       if( el .value.len gth < 1 )  {
448           el .style.bac kgroundCol or = "pink ";   449           el .style.bac kgroundCol or = "pink ";
449           ha sErr = tru e;   450           ha sErr = tru e;
450           fi ld += " Ca tegory ";   451           fi ld += " Ca tegory ";
451       } else  {   452       } else  {
452           el .style.bac kgroundCol or = "#fff ";   453           el .style.bac kgroundCol or = "#fff ";
453       }   454       }
454     455  
455       el = d ocument.ge tElementBy Id("flag") ;   456       el = d ocument.ge tElementBy Id("flag") ;
456       if( el .value.len gth < 1 )  {   457       if( el .value.len gth < 1 )  {
457           el .style.bac kgroundCol or = "pink ";   458           el .style.bac kgroundCol or = "pink ";
458           ha sErr = tru e;   459           ha sErr = tru e;
459           fi ld += " Te xt type ";   460           fi ld += " Te xt type ";
460       } else  {   461       } else  {
461           el .style.bac kgroundCol or = "#fff ";   462           el .style.bac kgroundCol or = "#fff ";
462       }   463       }
463     464  
464       if (ha sErr) {   465       if (ha sErr) {
465           al ert( "Plea se fill ne xt fields  first!" +  fild )   466           al ert( "Plea se fill ne xt fields  first!" +  fild )
466           re turn false ;   467           re turn false ;
467       } else  {   468       } else  {
468           re turn true;   469           re turn true;
469       }   470       }
470   }   471   }
471   </script>   472   </script>
472     473  
473   <div class ="articles FormBlock" >   474   <div class ="articles FormBlock" >
474       <form  method="po st" action ="{$this-> sUrl}artic les.php" o nsubmit="r eturn chec kForm();">   475       <form  method="po st" action ="{$this-> sUrl}artic les.php" o nsubmit="r eturn chec kForm();">
475           <d iv>{$sArti cleTitleC} </div>   476           <d iv>{$sArti cleTitleC} </div>
476           <d iv>   477           <d iv>
477                <input t ype="text"  name="tit le" id="ar ticleTitle " class="c atCaption"  value="{$ sTitle}" / >   478                <input t ype="text"  name="tit le" id="ar ticleTitle " class="c atCaption"  value="{$ sTitle}" / >
478           </ div>   479           </ div>
479           <d iv>{$sArti cleC}</div >   480           <d iv>{$sArti cleC}</div >
480           <d iv style=" margin-bot tom:7px;">   481           <d iv style=" margin-bot tom:7px;">
481                <textare a name="ar ticle" id= "articleBo dy" class= "classfied sTextArea  articl">{$ aArticle[' Text']}</t extarea>   482                <textare a name="ar ticle" id= "articleBo dy" class= "classfied sTextArea  articl">{$ aArticle[' Text']}</t extarea>
482           </ div>   483           </ div>
483           <d iv style=" margin-bot tom:7px;">   484           <d iv style=" margin-bot tom:7px;">
484                <select  name="cate goryID" id ="category ID">   485                <select  name="cate goryID" id ="category ID">
485                    <opt ion value= "">{$sSele ctCategory C}</option >   486                    <opt ion value= "">{$sSele ctCategory C}</option >
486                    {$sR etCateg}   487                    {$sR etCateg}
487                </select >   488                </select >
488           </ div>   489           </ div>
489           <d iv style=" margin-bot tom:7px;">   490           <d iv style=" margin-bot tom:7px;">
490                <input t ype="hidde n" name="f lag" value ="HTML" />   491                <input t ype="hidde n" name="f lag" value ="HTML" />
491                <!-- <se lect name= "flag" id= "flag">   492                <!-- <se lect name= "flag" id= "flag">
492                    <opt ion value= "">{$sPrin tAsC}</opt ion>   493                    <opt ion value= "">{$sPrin tAsC}</opt ion>
493                    <opt ion value= "Text"{$te xtSelected }>Text</op tion>   494                    <opt ion value= "Text"{$te xtSelected }>Text</op tion>
494                    <opt ion value= "HTML"{$ht mlSelected }>HTML</op tion>   495                    <opt ion value= "HTML"{$ht mlSelected }>HTML</op tion>
495                </select > -->   496                </select > -->
496           </ div>   497           </ div>
497           <d iv>   498           <d iv>
498                <input t ype="submi t" value=" Submit">   499                <input t ype="submi t" value=" Submit">
499                {$sArtic leActions}   500                {$sArtic leActions}
500           </ div>   501           </ div>
501       </form >   502       </form >
502   </div>   503   </div>
503   EOF;   504   EOF;
504           re turn $ret;   505           re turn $ret;
505       }   506       }
506     507  
507       functi on deleteC ategory( $ iCategoryI D ) {   508       functi on deleteC ategory( $ iCategoryI D ) {
508     509  
509           $s ADS = _t(' _Articles  were delet ed success fully');   510           $s ADS = _t(' _Articles  were delet ed success fully');
510           $s ADF = _t(' _Articles  are not de leted');   511           $s ADF = _t(' _Articles  are not de leted');
511           $s CDS = _t(' _category_ deleted');   512           $s CDS = _t(' _category_ deleted');
512           $s CDF = _t(' _category_ delete_fai led');   513           $s CDF = _t(' _category_ delete_fai led');
513     514  
514           $s RetVal = _ t('_Error  Occured');   515           $s RetVal = _ t('_Error  Occured');
515           if ( $this->b AdminMode  ) {   516           if ( $this->b AdminMode  ) {
516                $sCatego ryDeleteQu ery = "DEL ETE FROM ` ArticlesCa tegory` WH ERE `Categ oryID` = ' {$iCategor yID}' LIMI T 1;";   517                $sCatego ryDeleteQu ery = "DEL ETE FROM ` ArticlesCa tegory` WH ERE `Categ oryID` = ' {$iCategor yID}' LIMI T 1;";
517                $sCatego riesArticl esDeleteQu ery = "DEL ETE FROM ` Articles`  WHERE `Cat egoryID` =  '{$iCateg oryID}';";   518                $sCatego riesArticl esDeleteQu ery = "DEL ETE FROM ` Articles`  WHERE `Cat egoryID` =  '{$iCateg oryID}';";
518     519  
519                if( db_r es( $sCate goriesArti clesDelete Query ) )  {   520                if( db_r es( $sCate goriesArti clesDelete Query ) )  {
520                    $sRe tVal = $sA DS;   521                    $sRe tVal = $sA DS;
521                } else {   522                } else {
522                    $sRe tVal = $sA DF;   523                    $sRe tVal = $sA DF;
523                }   524                }
524     525  
525                if( db_r es( $sCate goryDelete Query ) )  {   526                if( db_r es( $sCate goryDelete Query ) )  {
526                    $sRe tVal = $sC DS;   527                    $sRe tVal = $sC DS;
527                } else {   528                } else {
528                    $sRe tVal = $sC DF;   529                    $sRe tVal = $sC DF;
529                }   530                }
530           }  else {   531           }  else {
531           }   532           }
532           re turn MsgBo x($sRetVal );   533           re turn MsgBo x($sRetVal );
533       }   534       }
534     535  
535       functi on deleteA rticle( $i ArticleID  ) {   536       functi on deleteA rticle( $i ArticleID  ) {
536     537  
537           $s ADS = _t(' _Article w as deleted  successfu lly');   538           $s ADS = _t(' _Article w as deleted  successfu lly');
538           $s ADF = _t(' _Article w as not del eted');   539           $s ADF = _t(' _Article w as not del eted');
539     540  
540           $s RetVal = _ t('_Error  Occured');   541           $s RetVal = _ t('_Error  Occured');
541           if ( $this->b AdminMode  )   542           if ( $this->b AdminMode  )
542                $sArticl eDeleteQue ry = "DELE TE FROM `A rticles` W HERE `Arti clesID` =  '{$iArticl eID}'";   543                $sArticl eDeleteQue ry = "DELE TE FROM `A rticles` W HERE `Arti clesID` =  '{$iArticl eID}'";
543           el se   544           el se
544                $sArticl eDeleteQue ry = "DELE TE FROM `A rticles` W HERE `Arti clesID` =  '{$iArticl eID}' AND  `ownerID`= '{$this->i VisitorID} '";   545                $sArticl eDeleteQue ry = "DELE TE FROM `A rticles` W HERE `Arti clesID` =  '{$iArticl eID}' AND  `ownerID`= '{$this->i VisitorID} '";
545              546           
546           if ( db_res(  $sArticleD eleteQuery  ) )   547           if ( db_res(  $sArticleD eleteQuery  ) )
547                $sRetVal  = $sADS;   548                $sRetVal  = $sADS;
548           el se   549           el se
549                $sRetVal  = $sADF;   550                $sRetVal  = $sADF;
550     551  
551           re turn MsgBo x($sRetVal );   552           re turn MsgBo x($sRetVal );
552       }   553       }
553     554  
554       functi on ActionA ddUpdateEl ements() {   555       functi on ActionA ddUpdateEl ements() {
555           $s ActionText  = '';   556           $s ActionText  = '';
556           if ( $_POST[' add_catego ry'] ) {   557           if ( $_POST[' add_catego ry'] ) {
557                 $sCategory Subject   =   process_db _input(   $_POST['ca ption']  
);
  558                 $sCategory Subject   =   process_db _input(   $_POST['ca ption'] ,   1   );
558                 $sCategory Desc   =   process_db _input(   $_POST['de scription' ]  
);
  559                 $sCategory Desc   =   process_db _input(   $_POST['de scription' ] ,   1   );
559                 $sCategory Uri   =   uriGenerat e( process_db _input(   $sCategory Subject   ) ,   'ArticlesC ategory',   'CategoryU ri',   255);   560                 $sCategory Uri   =   uriGenerat e(  
$sCategory Subject
,   'ArticlesC ategory',   'CategoryU ri',   255);
560     561  
561                $sAddQue ry = "INSE RT INTO `A rticlesCat egory` SET  `Category Name` = '{ $sCategory Subject}',  `Category Descriptio n` = '{$sC ategoryDes c}', `Cate goryUri`=' {$sCategor yUri}'";   562                $sAddQue ry = "INSE RT INTO `A rticlesCat egory` SET  `Category Name` = '{ $sCategory Subject}',  `Category Descriptio n` = '{$sC ategoryDes c}', `Cate goryUri`=' {$sCategor yUri}'";
562                if ($sCa tegorySubj ect=='' ||  $sCategor yDesc=='')  {   563                if ($sCa tegorySubj ect=='' ||  $sCategor yDesc=='')  {
563                    $sAc tionText =  'Category  didn\'t a dd';   564                    $sAc tionText =  'Category  didn\'t a dd';
564                }   565                 }   elseif(   db_res(   $sAddQuery   )   )   {
565                
elseif(   db_res(   $sAddQuery   )   )   {
   
566                    $sAc tionText =  'Category  Added';   566                    $sAc tionText =  'Category  Added';
567                } else {   567                } else {
568                    $sAc tionText =  'Category  didn\'t a dd';   568                    $sAc tionText =  'Category  didn\'t a dd';
569                }   569                }
570           }  elseif( $_ POST['edit _category' ] ) {   570           }  elseif( $_ POST['edit _category' ] ) {
571                 $sCategory Subject   =   process_db _input(   $_POST['ca ption']  
);
  571                 $sCategory Subject   =   process_db _input(   $_POST['ca ption'] ,   1   );
572                 $sCategory Desc   =   process_db _input(   $_POST['de scription' ]  
);
  572                 $sCategory Desc   =   process_db _input(   $_POST['de scription' ] ,   1   );
573                $iCatego ryID = (in t)$_POST[' categoryID '];   573                $iCatego ryID = (in t)$_POST[' categoryID '];
574     574  
575                $sAddQue ry = "UPDA TE `Articl esCategory ` SET `Cat egoryName`  = '{$sCat egorySubje ct}', `Cat egoryDescr iption` =  '{$sCatego ryDesc}' W HERE `Cate goryID` =  '{$iCatego ryID}' LIM IT 1;";   575                $sAddQue ry = "UPDA TE `Articl esCategory ` SET `Cat egoryName`  = '{$sCat egorySubje ct}', `Cat egoryDescr iption` =  '{$sCatego ryDesc}' W HERE `Cate goryID` =  '{$iCatego ryID}' LIM IT 1;";
576                if ($sCa tegorySubj ect=='' ||  $sCategor yDesc=='')  {   576                if ($sCa tegorySubj ect=='' ||  $sCategor yDesc=='')  {
577                    $sAc tionText =  'Category  didn\'t a dd';   577                    $sAc tionText =  'Category  didn\'t a dd';
578                }   578                 }   elseif(   db_res(   $sAddQuery   )   )   {
579                
elseif(   db_res(   $sAddQuery   )   )   {
   
580                    $sAc tionText =  'Category  Udated';   579                    $sAc tionText =  'Category  Udated';
581                } else {   580                } else {
582                    $sAc tionText =  'Category  didn\'t u pdated';   581                    $sAc tionText =  'Category  didn\'t u pdated';
583                }   582                }
584           }  elseif( $_ POST['add_ article']  ) {   583           }  elseif( $_ POST['add_ article']  ) {
585                 $sArticleT itle   =   process_db _input(   $_POST['ti tle']  
);
  584                 $sArticleT itle   =   process_db _input(   $_POST['ti tle'] ,   1   );
586                 $sArticle   =  
process_
db_input(   $_POST['ar ticle']   );
  585                 $sArticle   =   $this-> process_ html_ db_input(   $_POST['ar ticle']   );
587                $iCatego ryID = (in t)$_POST[' categoryID '];   586                $iCatego ryID = (in t)$_POST[' categoryID '];
588                if( $_PO ST['flag']  == 'HTML' ) {   587                if( $_PO ST['flag']  == 'HTML' ) {
589                    $sFl ag = 'HTML ';   588                    $sFl ag = 'HTML ';
590                } else {   589                } else {
591                    $sFl ag = 'Text ';   590                    $sFl ag = 'Text ';
592                }   591                }
593                   592                
594                $sArticl eUri = uri Generate($ sArticleTi tle, 'Arti cles', 'Ar ticleUri',  100);   593                $sArticl eUri = uri Generate($ sArticleTi tle, 'Arti cles', 'Ar ticleUri',  100);
595                   594                
596                $sOwner  = $this->b AdminMode  ? "" : ",  `ownerID`  = '{$this- >iVisitorI D}'";   595                $sOwner  = $this->b AdminMode  ? "" : ",  `ownerID`  = '{$this- >iVisitorI D}'";
597                 $sAddQuery   =   "INSERT   INTO   `Articles`   SET   `Title`   =   '{$sArticl eTitle}',   `Text`   =   '{$sArticl e}',   `CategoryI D`   =   '{$iCatego ryID}',   `Date`   =   NOW(),   `ArticleFl ag`   =   '{$sFlag}' ,   `ArticleUr i`='{$sArt icleUri}'  
$sOwner
";
  596                 $sAddQuery   =   "INSERT   INTO   `Articles`   SET   `Title`   =   '{$sArticl eTitle}',   `Text`   =   '{$sArticl e}',   `CategoryI D`   =   '{$iCatego ryID}',   `Date`   =   NOW(),   `ArticleFl ag`   =   '{$sFlag}' ,   `ArticleUr i`='{$sArt icleUri}'   { $sOwner } ";
598                if ($sAr ticleTitle =='' || $s Article==' ') {   597                if ($sAr ticleTitle =='' || $s Article==' ') {
599                    $sAc tionText =  'Article  Not Added' ;   598                    $sAc tionText =  'Article  Not Added' ;
600                }   599                 }   elseif(   db_res(   $sAddQuery   )   )   {
601                
elseif(   db_res(   $sAddQuery   )   )   {
   
602                    $sAc tionText =  'Article  Added';   600                    $sAc tionText =  'Article  Added';
603                } else {   601                } else {
604                    $sAc tionText =  'Article  Not Added' ;   602                    $sAc tionText =  'Article  Not Added' ;
605                }   603                }
606           }  elseif( $_ POST['edit _article']  ) {   604           }  elseif( $_ POST['edit _article']  ) {
607                 $sArticleT itle   =   process_db _input(   $_POST['ti tle']  
);
  605                 $sArticleT itle   =   process_db _input(   $_POST['ti tle'] ,   1   );
608                 $sArticle   =  
process_
db_input(   $_POST['ar ticle']   );
  606                 $sArticle   =   $this-> process_ html_ db_input(   $_POST['ar ticle']   );
609                $iCatego ryID = (in t)$_POST[' categoryID '];   607                $iCatego ryID = (in t)$_POST[' categoryID '];
610                $iArticl eID = (int )$_POST['a rticleID'] ;   608                $iArticl eID = (int )$_POST['a rticleID'] ;
611                $sArticl eUri = uri Generate($ sArticleTi tle, 'Arti cles', 'Ti tle', 100) ;   609                $sArticl eUri = uri Generate($ sArticleTi tle, 'Arti cles', 'Ti tle', 100) ;
612                if( $_PO ST['flag']  == 'HTML' ) {   610                if( $_PO ST['flag']  == 'HTML' ) {
613                    $sFl ag = 'HTML ';   611                    $sFl ag = 'HTML ';
614                } else {   612                } else {
615                    $sFl ag = 'Text ';   613                    $sFl ag = 'Text ';
616                }   614                }
617     615  
618                if ($thi s->bAdminM ode) {   616                if ($thi s->bAdminM ode) {
619                    $sOw ner = ", ` ownerID`=' 0'";   617                    $sOw ner = ", ` ownerID`=' 0'";
620                    $sOw nerCond =  "";   618                    $sOw nerCond =  "";
621                }
  619                }  else {
622                else {    
623                    $sOw ner = ", ` ownerID`=' {$this->iV isitorID}' ";   620                    $sOw ner = ", ` ownerID`=' {$this->iV isitorID}' ";
624                    $sOw nerCond =  " AND `own erID`='{$t his->iVisi torID}'";   621                    $sOw nerCond =  " AND `own erID`='{$t his->iVisi torID}'";
625                }   622                }
626                 $sAddQuery   =   "UPDATE   `Articles`   SET   `Title`   =   '{$sArticl eTitle}',   `Text`   =   '{$sArticl e}',   `CategoryI D`   =   '{$iCatego ryID}',   `Date`   =   NOW(),   `ArticleFl ag`   =   '{$sFlag}' ,   `ArticleUr i`='{$sArt icleUri}'  
$sOwner  
WHERE   `ArticlesI D`   =   '{$iArticl eID}'  
$sOwnerCon d
";
  623                 $sAddQuery   =   "UPDATE   `Articles`   SET   `Title`   =   '{$sArticl eTitle}',   `Text`   =   '{$sArticl e}',   `CategoryI D`   =   '{$iCatego ryID}',   `Date`   =   NOW(),   `ArticleFl ag`   =   '{$sFlag}' ,   `ArticleUr i`='{$sArt icleUri}'   { $sOwner }   WHERE   `ArticlesI D`   =   '{$iArticl eID}'   { $sOwnerCon d } ";
627                if ($sAr ticleTitle =='' || $s Article==' ') {   624                if ($sAr ticleTitle =='' || $s Article==' ') {
628                    $sAc tionText =  'Article  Updated';   625                    $sAc tionText =  'Article  Updated';
629                }   626                 }   elseif(   db_res(   $sAddQuery   )   )   {
630                
elseif(   db_res(   $sAddQuery   )   )   {
   
631                    $sAc tionText =  'Article  Updated';   627                    $sAc tionText =  'Article  Updated';
632                } else {   628                } else {
633                    $sAc tionText =  'Article  Not Update d';   629                    $sAc tionText =  'Article  Not Update d';
634                }   630                }
635           }   631           }
636           re turn ($sAc tionText!= '') ? MsgB ox($sActio nText) : ' ';   632           re turn ($sAc tionText!= '') ? MsgB ox($sActio nText) : ' ';
637       }   633       }
638          634       
639        function   getArticle IdByUri($s Name)
  635        function   getArticle IdByUri($s Name)   {
640       {    
641           $s Name = pro cess_db_in put($sName );   636           $s Name = pro cess_db_in put($sName );
642            return    db_value(   "SELECT   `ArticlesI D`   FROM   `Articles`   WHERE   `ArticleUr i`   =   '
$sName
'"   );
  637            return    db_value(   "SELECT   `ArticlesI D`   FROM   `Articles`   WHERE   `ArticleUr i`   =   ' { $sName } '"   );
643       }   638       }
644          639       
645        function   getArticle CatIdByUri ($sName)
  640        function   getArticle CatIdByUri ($sName)   {
646       {    
647           $s Name = pro cess_db_in put($sName );   641           $s Name = pro cess_db_in put($sName );
648           re turn  db_v alue( "SEL ECT `Categ oryID` FRO M `Article sCategory`  WHERE `Ca tegoryUri`  = '$sName '" );   642           re turn  db_v alue( "SEL ECT `Categ oryID` FRO M `Article sCategory`  WHERE `Ca tegoryUri`  = '$sName '" );
649       }   643       }
650          644       
651        function   getArticle Url($iArti cleId)
  645        function   getArticle Url($iArti cleId)   {
652       {    
653           gl obal $sUrl ;   646           gl obal $sUrl ;
654     647  
655           $i ArticleId  = (int)$iA rticleId;   648           $i ArticleId  = (int)$iA rticleId;
656           if  ($this->i sPermalink Enabled()  && $this-> bAdminMode  == false)  {   649           if  ($this->i sPermalink Enabled()  && $this-> bAdminMode  == false)  {
657                $sArticl eUri = db_ value("SEL ECT `Artic leUri` FRO M `Article s` WHERE ` ArticlesID `='{$iArti cleId}'");   650                $sArticl eUri = db_ value("SEL ECT `Artic leUri` FRO M `Article s` WHERE ` ArticlesID `='{$iArti cleId}'");
658                $sLinkUr l = $sUrl. 'articles/ entry/'.$s ArticleUri ;   651                $sLinkUr l = $sUrl. 'articles/ entry/'.$s ArticleUri ;
659           }   652           }
660           el se   653           el se
661                $sLinkUr l = $sUrl. 'articles. php?action =viewartic le&article ID='.$iArt icleId;   654                $sLinkUr l = $sUrl. 'articles. php?action =viewartic le&article ID='.$iArt icleId;
662              655           
663           re turn $sLin kUrl;   656           re turn $sLin kUrl;
664       }   657       }
665          658       
666        function   getArticle CatUrl($iC ategoryId)
  659        function   getArticle CatUrl($iC ategoryId)   {
667       {    
668           gl obal $sUrl ;   660           gl obal $sUrl ;
669     661  
670           $i ArticleId  = (int)$iA rticleId;   662           $i ArticleId  = (int)$iA rticleId;
671           if  ($this->i sPermalink Enabled()  && $this-> bAdminMode  == false)  {   663           if  ($this->i sPermalink Enabled()  && $this-> bAdminMode  == false)  {
672                $sCatego ryUri = db _value("SE LECT `Cate goryUri` F ROM `Artic lesCategor y` WHERE ` CategoryID `='{$iCate goryId}'") ;   664                $sCatego ryUri = db _value("SE LECT `Cate goryUri` F ROM `Artic lesCategor y` WHERE ` CategoryID `='{$iCate goryId}'") ;
673                $sLinkUr l = $sUrl. 'articles/ category/' .$sCategor yUri;   665                $sLinkUr l = $sUrl. 'articles/ category/' .$sCategor yUri;
674           }
  666           }  else
675           el se    
676                $sLinkUr l = $sUrl. 'articles. php?action =viewcateg ory&catID= '.$iCatego ryId;   667                $sLinkUr l = $sUrl. 'articles. php?action =viewcateg ory&catID= '.$iCatego ryId;
677              668           
678           re turn $sLin kUrl;   669           re turn $sLin kUrl;
679       }   670       }
680     671  
681        function   isPermalin kEnabled()
  672        function   isPermalin kEnabled()   {
682       {    
683           re turn isset ($this->_i sPermalink Enabled) ?  $this->_i sPermalink Enabled :  ($this->_i sPermalink Enabled =  (getParam( 'permalink s_articles ') == 'on' ));   673           re turn isset ($this->_i sPermalink Enabled) ?  $this->_i sPermalink Enabled :  ($this->_i sPermalink Enabled =  (getParam( 'permalink s_articles ') == 'on' ));
684       }   674       }
685          675       
686        function   getArticle sResource( $iLimit   =   1)
  676        function   getArticle sResource( $iLimit   =   1)   {
687       {    
688           $i Limit = (i nt)$iLimit ;   677           $i Limit = (i nt)$iLimit ;
689              678  
690           $s Query = "   679           $s Query = "
691           SE LECT   680                SELECT
692                `Article sID`,   681                    `Art iclesID`,
693                `Article s`.`Catego ryID`,   682                    `Art icles`.`Ca tegoryID`,
694                `Date`,   683                    `Dat e`,
695                UNIX_TIM ESTAMP(`Da te`) AS 'D ate_UTS',   684                    UNIX _TIMESTAMP (`Date`) A S 'Date_UT S',
696                `Title`,   685                    `Tit le`,
697                `Text`,   686                    `Tex t`,
698                `Categor yName`,   687                    `Cat egoryName` ,
699                `ownerID `   688                    `own erID`
700           FR OM `Articl es`   689                FROM `Ar ticles`
701           IN NER JOIN ` ArticlesCa tegory` US ING( `Cate goryID` )   690                INNER JO IN `Articl esCategory ` USING( ` CategoryID ` )
702           OR DER BY `Da te` DESC   691                ORDER BY  `Date` DE SC
703            LIMIT  
$iLimit
  692                 LIMIT   { $iLimit }
704       ";   693           ";
705           
706           $r Articles =  db_res($s Query);   694           $r Articles =  db_res($s Query);
707              695  
708           re turn $rArt icles;   696           re turn $rArt icles;
709       }   697       }
710          698  
    699       functi on process _html_db_i nput( $sTe xt ) {
    700           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));
    701       }
    702       
711   }   703   }
712     704  
713   ?>   705   ?>