16. File Comparison Report

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

16.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.2\inc\classes BxDolBlogs.php Mon Jun 16 05:18:34 2008 UTC
2 Dolphin-v.6.1.3\inc\classes BxDolBlogs.php Wed Jul 16 09:51:19 2008 UTC

16.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 102 4836
Changed 83 234
Inserted 13 43
Removed 5 51

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

16.4 Active regular expressions

No regular expressions were active.

16.5 Comparison detail

1   <?   1   <?
2     2  
3   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' );
4   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');
5   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' );
6   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' );
7   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' );
8   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 ' );
9     9  
10   require_on ce( BX_DIR ECTORY_PAT H_ROOT . " templates/ tmpl_{$tmp l}/scripts /BxTemplCm tsView.php " );   10   require_on ce( BX_DIR ECTORY_PAT H_ROOT . " templates/ tmpl_{$tmp l}/scripts /BxTemplCm tsView.php " );
11     11  
12   /*   12   /*
13    * class f or Events   13    * class f or Events
14    */   14    */
15   class BxDo lBlogs {   15   class BxDo lBlogs {
16       //vari ables   16       //vari ables
17     17  
18       //max  sizes of p ictures fo r resizing  during up load   18       //max  sizes of p ictures fo r resizing  during up load
19       var $i IconSize =  45;   19       var $i IconSize =  45;
20       var $i ThumbSize  = 110;   20       var $i ThumbSize  = 110;
21       var $i BigThumbSi ze = 340;   21       var $i BigThumbSi ze = 340;
22       var $i ImgSize =  800;   22       var $i ImgSize =  800;
23     23  
24       //admi n mode, ca n All acti ons   24       //admi n mode, ca n All acti ons
25       var $b AdminMode;   25       var $b AdminMode;
26     26  
27       //path  to image  pic_not_av ail.gif   27       //path  to image  pic_not_av ail.gif
28       var $s PicNotAvai l;   28       var $s PicNotAvai l;
29       //path  to spacer  image   29       //path  to spacer  image
30       var $s SpacerPath  = 'templa tes/base/i mages/icon s/spacer.g if';   30       var $s SpacerPath  = 'templa tes/base/i mages/icon s/spacer.g if';
31     31  
32       var $a BlogConf =  array();   32       var $a BlogConf =  array();
33     33  
34       var $i LastPosted PostID = - 1;   34       var $i LastPosted PostID = - 1;
35     35  
36       var $i PerPageEle ments;   36       var $i PerPageEle ments;
37     37  
38       var $s CommonCSS;   38       var $s CommonCSS;
39       var $i TopTagsCnt ;   39       var $i TopTagsCnt ;
40     40  
41       var $o CmtsView =  null;   41       var $o CmtsView =  null;
42     42  
43       /**   43       /**
44        * con structor   44        * con structor
45        */   45        */
46       functi on BxDolBl ogs($bAdmM ode = fals e) {   46       functi on BxDolBl ogs($bAdmM ode = fals e) {
47           gl obal $logg ed;   47           gl obal $logg ed;
48     48  
49           $t his->iPerP ageElement s = (int)g etParam('b log_step') ;   49           $t his->iPerP ageElement s = (int)g etParam('b log_step') ;
50     50  
51           $t his->aBlog Conf['visi torID']    = (int)$_C OOKIE['mem berID'];   51           $t his->aBlog Conf['visi torID']    = (int)$_C OOKIE['mem berID'];
52           $t his->aBlog Conf['owne rID']      = isset($_ REQUEST['o wnerID'])  ? (int)$_R EQUEST['ow nerID'] :  $this->aBl ogConf['vi sitorID'];   52           $t his->aBlog Conf['owne rID']      = isset($_ REQUEST['o wnerID'])  ? (int)$_R EQUEST['ow nerID'] :  $this->aBl ogConf['vi sitorID'];
53           $t his->aBlog Conf['isOw ner']      = ( $this- >aBlogConf ['ownerID' ] == $this ->aBlogCon f['visitor ID'] ) ? t rue : fals e;   53           $t his->aBlog Conf['isOw ner']      = ( $this- >aBlogConf ['ownerID' ] == $this ->aBlogCon f['visitor ID'] ) ? t rue : fals e;
54     54  
55           if ( !$this-> aBlogConf[ 'isOwner']  )   55           if ( !$this-> aBlogConf[ 'isOwner']  )
56                $this->a BlogConf[' isFriend']  = is_frie nds( $this ->aBlogCon f['visitor ID'], $thi s->aBlogCo nf['ownerI D'] );   56                $this->a BlogConf[' isFriend']  = is_frie nds( $this ->aBlogCon f['visitor ID'], $thi s->aBlogCo nf['ownerI D'] );
57     57  
58           $t his->aBlog Conf['logg edMember']               = $logg ed['member '];   58           $t his->aBlog Conf['logg edMember']               = $logg ed['member '];
59           $t his->aBlog Conf['cate goryCaptio nMaxLenght '] = (int) getParam(' blogCatego ryCaptionM axLenght') ;   59           $t his->aBlog Conf['cate goryCaptio nMaxLenght '] = (int) getParam(' blogCatego ryCaptionM axLenght') ;
60           $t his->aBlog Conf['blog CaptionMax Lenght']      = (int) getParam(' blogCaptio nMaxLenght ');   60           $t his->aBlog Conf['blog CaptionMax Lenght']      = (int) getParam(' blogCaptio nMaxLenght ');
61     61  
62           $t his->bAdmi nMode = $b AdmMode;   62           $t his->bAdmi nMode = $b AdmMode;
63           $t his->sComm onCSS = '' ;   63           $t his->sComm onCSS = '' ;
64     64  
65           // temple   65           // temple
66           $t his->bAdmi nMode = ($ logged['ad min']==tru e) ? true:  $this->bA dminMode;   66           $t his->bAdmi nMode = ($ logged['ad min']==tru e) ? true:  $this->bA dminMode;
67     67  
68           $t his->iTopT agsCnt = 2 0;   68           $t his->iTopT agsCnt = 2 0;
69       }   69       }
70     70  
71       functi on CheckLo gged() {   71       functi on CheckLo gged() {
72           gl obal $logg ed;   72           gl obal $logg ed;
73           if ( !$logged ['member']  && !$logg ed['admin' ] ) {   73           if ( !$logged ['member']  && !$logg ed['admin' ] ) {
74                member_a uth(0);   74                member_a uth(0);
75           }   75           }
76       }   76       }
77     77  
78       /**   78       /**
79        * Ret urn string  for Heade r, depends  at POST p arams   79        * Ret urn string  for Heade r, depends  at POST p arams
80        *   80        *
81        * @re turn Textp resentatio n of data   81        * @re turn Textp resentatio n of data
82        */   82        */
83       functi on GetHead erString()  {   83       functi on GetHead erString()  {
84           sw itch ( $_R EQUEST['ac tion'] ) {   84           sw itch ( $_R EQUEST['ac tion'] ) {
85                //print  functions   85                //print  functions
86                case 'to p_blogs':   86                case 'to p_blogs':
87                    $sCa ption = _t ('_Top Blo gs');   87                    $sCa ption = _t ('_Top Blo gs');
88                    brea k;   88                    brea k;
89                case 'sh ow_member_ blog':   89                case 'sh ow_member_ blog':
90                    $sCa ption = _t ('_my_blog ');   90                    $sCa ption = _t ('_my_blog ');
91                    $iMe mberID = $ this->defi neUserId() ;   91                    $iMe mberID = $ this->defi neUserId() ;
92                     $sUser   =   getNickNam e($ aBlogsR e s['Own erID '] );   92                     $sUser   =   getNickNam e($ iM e mb erID
);
93                    $sAs Blog = _t( '_Members_ blog', $sU ser);   93                    $sAs Blog = _t( '_Members_ blog', $sU ser);
94                    $sCa ption = $s AsBlog;   94                    $sCa ption = $s AsBlog;
95                    brea k;   95                    brea k;
96                case 'to p_posts':   96                case 'to p_posts':
97                    $sCa ption = _t ('_Top Pos ts');   97                    $sCa ption = _t ('_Top Pos ts');
98                    brea k;   98                    brea k;
99                case 'ne w_post':   99                case 'ne w_post':
100                    $sCa ption = _t ('_Add Pos t');   100                    $sCa ption = _t ('_Add Pos t');
101                    brea k;   101                    brea k;
102                case 'sh ow_member_ post':   102                case 'sh ow_member_ post':
103                    $sCa ption = _t ('_Post');   103                    $sCa ption = _t ('_Post');
    104                    $iPo stID = -1;
    105                    if ( isset($_RE QUEST['pos tUri'])) {
    106                         $sPostUri  = process_ db_input($ _REQUEST[' postUri'],  1);
    107                         $sqlQuery  = "SELECT  `PostID`,  `PostCapti on` FROM ` BlogPosts`  WHERE `Po stUri`='{$ sPostUri}' ";
    108                    } el seif (isse t($_REQUES T['post_id '])) {
    109                         $iPostID =  (int)$_RE QUEST['pos t_id'];
    110                         $sqlQuery  = "SELECT  `PostCapti on` FROM ` BlogPosts`  WHERE `Po stID`='{$i PostID}'";
    111                    }
    112                    if ( $sqlQuery  != '') {
    113                         $aPostCapt  = db_arr( $sqlQuery) ;
    114                         $sCaption  = htmlspec ialchars($ aPostCapt[ 'PostCapti on']);
    115                    }
104                    brea k;   116                    brea k;
105                case 'se arch_by_ta g':   117                case 'se arch_by_ta g':
106                    $sCa ption = _t ('_Search  result');   118                    $sCa ption = _t ('_Search  result');
107                    brea k;   119                    brea k;
108                default:   120                default:
109                    $sCa ption = _t ('_Blogs') ;   121                    $sCa ption = _t ('_Blogs') ;
110                    brea k;   122                    brea k;
111           }   123           }
112           re turn $sCap tion;   124           re turn $sCap tion;
113       }   125       }
114     126  
115       /**   127       /**
116        * Gen erate comm on forms a nd include s js   128        * Gen erate comm on forms a nd include s js
117        *   129        *
118        * @re turn HTML  presentati on of data   130        * @re turn HTML  presentati on of data
119        */   131        */
120       functi on GenComm andForms()  {   132       functi on GenComm andForms()  {
121           gl obal $site ;   133           gl obal $site ;
122     134  
123           // $sJSPath =  ($this ->  bAdminMod e) ? "../"  : "";   135           // $sJSPath =  ($this ->  bAdminMod e) ? "../"  : "";
124           $s JSPath = $ site['url' ] . 'inc/' ;   136           $s JSPath = $ site['url' ] . 'inc/' ;
125     137  
126           $s Link = $th is->genBlo gFormUrl() ;   138           $s Link = $th is->genBlo gFormUrl() ;
127           $s RetHtml =  <<<EOF   139           $s RetHtml =  <<<EOF
128           {$ this->sCom monCSS}   140           {$ this->sCom monCSS}
129           <s cript src= "{$sJSPath }js/dynami c_core.js. php" type= "text/java script"></ script>   141           <s cript src= "{$sJSPath }js/dynami c_core.js. php" type= "text/java script"></ script>
130     142  
131           <f orm action ="{$sLink} " method=" post" name ="command_ delete_pos t">   143           <f orm action ="{$sLink} " method=" post" name ="command_ delete_pos t">
132                <input t ype="hidde n" name="a ction" val ue="delete _post" />   144                <input t ype="hidde n" name="a ction" val ue="delete _post" />
133                <input t ype="hidde n" name="D OwnerID" i d="DOwnerI D" value=" "/>   145                <input t ype="hidde n" name="D OwnerID" i d="DOwnerI D" value=" "/>
134                <input t ype="hidde n" name="D eletePostI D" id="Del etePostID"  value=""/ >   146                <input t ype="hidde n" name="D eletePostI D" id="Del etePostID"  value=""/ >
135           </ form>   147           </ form>
136           <f orm action ="{$sLink} " method=" post" name ="command_ delete_cat egory">   148           <f orm action ="{$sLink} " method=" post" name ="command_ delete_cat egory">
137                <input t ype="hidde n" name="a ction" val ue="delete _category"  />   149                <input t ype="hidde n" name="a ction" val ue="delete _category"  />
138                <input t ype="hidde n" name="D eleteCateg oryID" id= "DeleteCat egoryID" v alue="" />   150                <input t ype="hidde n" name="D eleteCateg oryID" id= "DeleteCat egoryID" v alue="" />
139           </ form>   151           </ form>
140           <f orm action ="{$sLink} " method=" post" name ="command_ edit_post" >   152           <f orm action ="{$sLink} " method=" post" name ="command_ edit_post" >
141                <input t ype="hidde n" name="a ction" val ue="edit_p ost" />   153                <input t ype="hidde n" name="a ction" val ue="edit_p ost" />
142                <input t ype="hidde n" name="E ditPostID"  id="EditP ostID" val ue="" />   154                <input t ype="hidde n" name="E ditPostID"  id="EditP ostID" val ue="" />
143           </ form>   155           </ form>
144           <f orm action ="{$sLink} " method=" post" name ="command_ delete_blo g">   156           <f orm action ="{$sLink} " method=" post" name ="command_ delete_blo g">
145                <input t ype="hidde n" name="a ction" id= "action" v alue="dele te_blog" / >   157                <input t ype="hidde n" name="a ction" id= "action" v alue="dele te_blog" / >
146                <input t ype="hidde n" name="D eleteBlogI D" id="Del eteBlogID"  value=""  />   158                <input t ype="hidde n" name="D eleteBlogI D" id="Del eteBlogID"  value=""  />
147           </ form>   159           </ form>
148   EOF;   160   EOF;
149           re turn $sRet Html;   161           re turn $sRet Html;
150       }   162       }
151     163  
152       functi on CheckRe strictionT oUse($iMem berID) {   164       functi on CheckRe strictionT oUse($iMem berID) {
153           if  ($this->b AdminMode= =true) ret urn FALSE;   165           if  ($this->b AdminMode= =true) ret urn FALSE;
154           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_USE_ BLOG );   166           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_USE_ BLOG );
155           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {   167           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {
156                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );   168                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );
157                return $ ret;   169                return $ ret;
158           }   170           }
159           re turn '';   171           re turn '';
160       }   172       }
161     173  
162       functi on CheckRe strictionT oView($iMe mberID) {   174       functi on CheckRe strictionT oView($iMe mberID) {
163           if  ($this->b AdminMode= =true) ret urn FALSE;   175           if  ($this->b AdminMode= =true) ret urn FALSE;
164           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_VIEW _BLOG );   176           $v CheckRes =  checkActi on( $iMemb erID, ACTI ON_ID_VIEW _BLOG );
165           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {   177           if  ( $vCheck Res[CHECK_ ACTION_RES ULT] != CH ECK_ACTION _RESULT_AL LOWED ) {
166                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );   178                $ret = M sgBox(stri p_tags($vC heckRes[CH ECK_ACTION _MESSAGE]) );
167                return $ ret;   179                return $ ret;
168           }   180           }
169           re turn '';   181           re turn '';
170       }   182       }
171     183  
172       /**   184       /**
173        * Gen erate List  of Blogs   185        * Gen erate List  of Blogs
174        *   186        *
175        * @pa ram $sType  - tyle of  list ('to p', 'last' )   187        * @pa ram $sType  - tyle of  list ('to p', 'last' )
176        * @re turn HTML  presentati on of data   188        * @re turn HTML  presentati on of data
177        */   189        */
178       functi on GenBlog Lists($sTy pe = '') {   190       functi on GenBlog Lists($sTy pe = '') {
179           $s Descriptio nC = _t('_ Descriptio n');   191           $s Descriptio nC = _t('_ Descriptio n');
180           $s PostsC = _ t('_Posts' );   192           $s PostsC = _ t('_Posts' );
181           $s NoBlogsC =  _t('_Sorr y, nothing  found');   193           $s NoBlogsC =  _t('_Sorr y, nothing  found');
182           $s AllBlogsC  = _t('_All  Blogs');   194           $s AllBlogsC  = _t('_All  Blogs');
183           $s TopBlogsC  = _t('_Top  Blogs');   195           $s TopBlogsC  = _t('_Top  Blogs');
184     196  
185           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   197           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
186           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);   198           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);
187           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   199           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
188     200  
189           $s BlogsSQL =  "   201           $s BlogsSQL =  "
190                SELECT ` Blogs`. *  , `Profile s`.`Nickna me`    202                SELECT ` Blogs`. *  , `Profile s`.`Nickna me` 
191                FROM `Bl ogs`    203                FROM `Bl ogs` 
192                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`   204                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`
193           ";   205           ";
194     206  
195           // ////////// //////pagi nation add ition///// ////////// ////////// /   207           // ////////// //////pagi nation add ition///// ////////// ////////// /
196           $i TotalNum =  db_value(  "SELECT C OUNT(*) FR OM `Blogs`  INNER JOI N `Profile s` ON `Blo gs`.`Owner ID` = `Pro files`.`ID `" );   208           $i TotalNum =  db_value(  "SELECT C OUNT(*) FR OM `Blogs`  INNER JOI N `Profile s` ON `Blo gs`.`Owner ID` = `Pro files`.`ID `" );
197           if ( !$iTotal Num ) {   209           if ( !$iTotal Num ) {
198                return M sgBox($sNo BlogsC);   210                return M sgBox($sNo BlogsC);
199           }   211           }
200     212  
201           $i PerPage =  (int)$_GET ['per_page '];   213           $i PerPage =  (int)$_GET ['per_page '];
202           if ( !$iPerPa ge )   214           if ( !$iPerPa ge )
203                $iPerPag e = $this- >iPerPageE lements;   215                $iPerPag e = $this- >iPerPageE lements;
204           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   216           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
205     217  
206           $i CurPage =  (int)$_GET ['page'];   218           $i CurPage =  (int)$_GET ['page'];
207     219  
208           if ( $iCurPag e > $iTota lPages )   220           if ( $iCurPag e > $iTota lPages )
209                $iCurPag e = $iTota lPages;   221                $iCurPag e = $iTota lPages;
210     222  
211           if ( $iCurPag e < 1 )   223           if ( $iCurPag e < 1 )
212                $iCurPag e = 1;   224                $iCurPag e = 1;
213     225  
214           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   226           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
215           $s qlLimit =  "LIMIT {$s LimitFrom} , {$iPerPa ge}";   227           $s qlLimit =  "LIMIT {$s LimitFrom} , {$iPerPa ge}";
216           // ////////// ////////// //////   228           // ////////// ////////// //////
217     229  
218           $s Caption =  $sAllBlogs C;   230           $s Caption =  $sAllBlogs C;
219     231  
220           if  ($sType = = 'top') {   232           if  ($sType = = 'top') {
221                $sBlogsS QL = "   233                $sBlogsS QL = "
222                    SELE CT `Blogs` .`ID` , `B logs`.`Own erID` , `B logs`.`Des cription`  , `Profile s`.`Nickna me` , MAX( `PostDate` ) AS 'MPD' , COUNT(`B logPosts`. `PostID`)  AS 'PostCo unt'   234                    SELE CT `Blogs` .`ID` , `B logs`.`Own erID` , `B logs`.`Des cription`  , `Profile s`.`Nickna me` , MAX( `PostDate` ) AS 'MPD' , COUNT(`B logPosts`. `PostID`)  AS 'PostCo unt'
223                    FROM  `Blogs`    235                    FROM  `Blogs` 
224                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Owner ID` = `Blo gs`.`Owner ID`    236                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Owner ID` = `Blo gs`.`Owner ID` 
225                    INNE R JOIN `Pr ofiles` ON  `Profiles `.`ID` = ` Blogs`.`Ow nerID`    237                    INNE R JOIN `Pr ofiles` ON  `Profiles `.`ID` = ` Blogs`.`Ow nerID` 
226                    INNE R JOIN `Bl ogPosts` O N `BlogPos ts`.`Categ oryID` = ` BlogCatego ries`.`Cat egoryID`   238                    INNE R JOIN `Bl ogPosts` O N `BlogPos ts`.`Categ oryID` = ` BlogCatego ries`.`Cat egoryID`
227                    WHER E `PostSta tus`='appr oval'   239                    WHER E `PostSta tus`='appr oval'
228                    GROU P BY `Blog s`.`ID`    240                    GROU P BY `Blog s`.`ID` 
229                    ORDE R BY `Post Count` DES C   241                    ORDE R BY `Post Count` DES C
230                    {$sq lLimit}   242                    {$sq lLimit}
231                ";   243                ";
232                $sCaptio n = $sTopB logsC;   244                $sCaptio n = $sTopB logsC;
233           }  elseif ($s Type == 'l ast') {   245           }  elseif ($s Type == 'l ast') {
234                $sBlogsS QL = "   246                $sBlogsS QL = "
235                    SELE CT `Blogs` .`ID` , `B logs`.`Own erID` , `B logs`.`Des cription`  , `Profile s`.`Nickna me` , MAX(  `PostDate ` ) AS 'MP D', COUNT(  `BlogPost s`.`PostID ` ) AS 'Po stCount'   247                    SELE CT `Blogs` .`ID` , `B logs`.`Own erID` , `B logs`.`Des cription`  , `Profile s`.`Nickna me` , MAX(  `PostDate ` ) AS 'MP D', COUNT(  `BlogPost s`.`PostID ` ) AS 'Po stCount'
236                    FROM  `Blogs`    248                    FROM  `Blogs` 
237                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Owner ID` = `Blo gs`.`Owner ID`    249                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Owner ID` = `Blo gs`.`Owner ID` 
238                    INNE R JOIN `Pr ofiles` ON  `Profiles `.`ID` = ` Blogs`.`Ow nerID`    250                    INNE R JOIN `Pr ofiles` ON  `Profiles `.`ID` = ` Blogs`.`Ow nerID` 
239                    INNE R JOIN `Bl ogPosts` O N `BlogPos ts`.`Categ oryID` = ` BlogCatego ries`.`Cat egoryID`   251                    INNE R JOIN `Bl ogPosts` O N `BlogPos ts`.`Categ oryID` = ` BlogCatego ries`.`Cat egoryID`
240                    WHER E `PostSta tus`='appr oval'   252                    WHER E `PostSta tus`='appr oval'
241                    GROU P BY `Blog s`.`ID`   253                    GROU P BY `Blog s`.`ID`
242                    ORDE R BY `MPD`  DESC   254                    ORDE R BY `MPD`  DESC
243                    {$sq lLimit}   255                    {$sq lLimit}
244                ";   256                ";
245           }   257           }
246     258  
247           //  process d atabase qu eries   259           //  process d atabase qu eries
248           $v BlogsRes =  db_res( $ sBlogsSQL  );   260           $v BlogsRes =  db_res( $ sBlogsSQL  );
249           if  (mysql_nu m_rows($vB logsRes)== 0) {   261           if  (mysql_nu m_rows($vB logsRes)== 0) {
250                return M sgBox($sNo BlogsC);   262                return M sgBox($sNo BlogsC);
251           }   263           }
252           wh ile ( $aBl ogsRes = m ysql_fetch _assoc($vB logsRes) )  {   264           wh ile ( $aBl ogsRes = m ysql_fetch _assoc($vB logsRes) )  {
253                if ($aBl ogsRes['Po stCount']  == 0 && $s Type == 't op') //in  Top blogs  skip blogs  with 0 co mments   265                if ($aBl ogsRes['Po stCount']  == 0 && $s Type == 't op') //in  Top blogs  skip blogs  with 0 co mments
254                    cont inue;   266                    cont inue;
255     267  
256                $sCont =  get_membe r_thumbnai l($aBlogsR es['OwnerI D'], 'left ', TRUE );   268                $sCont =  get_membe r_thumbnai l($aBlogsR es['OwnerI D'], 'left ', TRUE );
257                $sBlogOw nerLink =  $this->gen BlogLink(' show_membe r_blog', a rray('Perm alink'=>$a BlogsRes[' Nickname'] , 'Link'=> $aBlogsRes ['OwnerID' ]));   269                $sBlogOw nerLink =  $this->gen BlogLink(' show_membe r_blog', a rray('Perm alink'=>$a BlogsRes[' Nickname'] , 'Link'=> $aBlogsRes ['OwnerID' ]));
    270                $sDescri ption = ht mlspecialc hars($aBlo gsRes['Des cription'] );
    271  
258                $sRetHtm l .= <<<EO F   272                $sRetHtm l .= <<<EO F
259   <div>   273   <div>
260       <div c lass="clea r_both"></ div>   274       <div c lass="clea r_both"></ div>
261           {$ sCont}   275           {$ sCont}
262       <div c lass="cls_ res_info_n owidth">   276       <div c lass="cls_ res_info_n owidth">
263           <d iv>   277           <d iv>
264                 <a   href="
$sBlogOwne rLink
">
  278                 <a   href=" { $sBlogOwne rLink } ">
265                    {$aB logsRes['N ickname']}  Blog   279                    {$aB logsRes['N ickname']}  Blog
266                </a>   280                </a>
267           </ div>   281           </ div>
268           <d iv>   282           <d iv>
269                {$aBlogs Res['PostC ount']} {$ sPostsC}   283                {$aBlogs Res['PostC ount']} {$ sPostsC}
270           </ div>   284           </ div>
271           <d iv>   285           <d iv>
272                 {$sDescrip tionC}:   <div   class="clr 3">{$ aBlogsRe s [' Descriptio n '] }</div>   286                 {$sDescrip tionC}:   <div   class="clr 3">{$
s
Descriptio n
}</div>
273           </ div>   287           </ div>
274       </div>   288       </div>
275       <div c lass="clea r_both"></ div>   289       <div c lass="clea r_both"></ div>
276   </div>   290   </div>
277   EOF;   291   EOF;
278           }   292           }
279     293  
280           // ///////pag ination ad dition//// ////////// ////   294           // ///////pag ination ad dition//// ////////// ////
281           if  ($this->i sPermalink Enabled()= =false) {  //old vari ant   295           if  ($this->i sPermalink Enabled()= =false) {  //old vari ant
282                if( $iTo talPages >  1) {   296                if( $iTo talPages >  1) {
283                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   297                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
284                    $aFi elds = arr ay( 'actio n' );   298                    $aFi elds = arr ay( 'actio n' );
285     299  
286                    fore ach( $aFie lds as $vF ield )   300                    fore ach( $aFie lds as $vF ield )
287                         if( isset(  $_GET[$vF ield] ) )   301                         if( isset(  $_GET[$vF ield] ) )
288                             $sRequ est .= "&{ $vField}="  . htmlent ities( pro cess_pass_ data( $_GE T[$vField]  ) );   302                             $sRequ est .= "&{ $vField}="  . htmlent ities( pro cess_pass_ data( $_GE T[$vField]  ) );
289     303  
290                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':   304                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':
291                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >   305                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >
292                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   306                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
293                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   307                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
294                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   308                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
295                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   309                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
296                             </sele ct></div>'  .   310                             </sele ct></div>'  .
297                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );   311                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );
298                } else   312                } else
299                    $sPa gination =  '';   313                    $sPa gination =  '';
300           }  else {   314           }  else {
301                 if(   $iTotalPag es   >   1)
  315                 if(   $iTotalPag es   >   1)   {
302                {    
303                    $sRe quest = ($ _REQUEST[' action'] = = 'top_blo gs') ? 'bl ogs/top/'  : 'blogs/a ll/';   316                    $sRe quest = ($ _REQUEST[' action'] = = 'top_blo gs') ? 'bl ogs/top/'  : 'blogs/a ll/';
304                    $sPa ginAddon =  '';   317                    $sPa ginAddon =  '';
305                    //$s PaginAddon  = '/' . p rocess_db_ input($_GE T['catUri' ]);   318                    //$s PaginAddon  = '/' . p rocess_db_ input($_GE T['catUri' ]);
306                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );   319                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );
307                       320                    
308                    fore ach( $aFie lds as $fi eld )   321                    fore ach( $aFie lds as $fi eld )
309                         if( isset(  $_GET[$fi eld] ) )   322                         if( isset(  $_GET[$fi eld] ) )
310                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/   323                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/
311                       324                    
312                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':   325                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':
313                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">   326                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">
314                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   327                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
315                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   328                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
316                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   329                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
317                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   330                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
318                             </sele ct></div>'  .   331                             </sele ct></div>'  .
319                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );   332                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );
320                }   333                }
321                else   334                else
322                    $sPa gination =  '';   335                    $sPa gination =  '';
323           }   336           }
324           // ////////// ////////// /////   337           // ////////// ////////// /////
325     338  
326           re turn Desig nBoxConten t( $sCapti on, $sRetH tml.$sPagi nation, 1  );   339           re turn Desig nBoxConten t( $sCapti on, $sRetH tml.$sPagi nation, 1  );
327       }   340       }
328     341  
329       /**   342       /**
330        * Gen erate List  of Posts   343        * Gen erate List  of Posts
331        *   344        *
332        * @pa ram $sType  - tyle of  list ('to p', 'last' ), but now  realized  only Top p osts   345        * @pa ram $sType  - tyle of  list ('to p', 'last' ), but now  realized  only Top p osts
333        * @re turn HTML  presentati on of data   346        * @re turn HTML  presentati on of data
334        */   347        */
335       functi on GenPost Lists($sTy pe = '') {   348       functi on GenPost Lists($sTy pe = '') {
336           gl obal $site ;   349           gl obal $site ;
337     350  
338           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   351           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
339           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);   352           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);
340           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   353           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
341     354  
342           $s EditC = _t ('_Edit');   355           $s EditC = _t ('_Edit');
343           $s DeleteC =  _t('_Delet e');   356           $s DeleteC =  _t('_Delet e');
344           $s SureC = _t ("_Are you  sure");   357           $s SureC = _t ("_Are you  sure");
345           $s PostCommen tC = _t('_ Post Comme nt');   358           $s PostCommen tC = _t('_ Post Comme nt');
346           $s Descriptio nC = _t('_ Descriptio n');   359           $s Descriptio nC = _t('_ Descriptio n');
347           $s AddComment C = _t('_A dd comment ');   360           $s AddComment C = _t('_A dd comment ');
348           $s NewPostC =  _t('_New  Post');   361           $s NewPostC =  _t('_New  Post');
349           $s TagsC = _t ('_Tags');   362           $s TagsC = _t ('_Tags');
350           $s PostsC = _ t('_Posts' );   363           $s PostsC = _ t('_Posts' );
351           $s Caption =  _t('_Top P osts');   364           $s Caption =  _t('_Top P osts');
352     365  
353           
$sDateForm atPhp   =   getParam(' php_date_f ormat');
  366            // $sDateForm atPhp   =   getParam(' php_date_f ormat');
354              367           
355           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;   368           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;
356     369  
357           $s TopPostSQL  = "   370           $s TopPostSQL  = "
358                SELECT ` BlogPosts` .*, COUNT( `cmt_id`)  AS `CountC omments`,  `BlogCateg ories`.`Ow nerID`,`Bl ogCategori es`.`Categ oryName`,  `BlogCateg ories`.`Ca tegoryUri`   371                SELECT ` BlogPosts` .*, COUNT( `cmt_id`)  AS `CountC omments`,  `BlogCateg ories`.`Ow nerID`,`Bl ogCategori es`.`Categ oryName`,  `BlogCateg ories`.`Ca tegoryUri`
359                FROM `Bl ogPosts`   372                FROM `Bl ogPosts`
360                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `BlogP osts`.`Pos tID` = `tc `.`cmt_obj ect_id`   373                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `BlogP osts`.`Pos tID` = `tc `.`cmt_obj ect_id`
361                LEFT JOI N `BlogCat egories` O N `BlogCat egories`.` CategoryID `=`BlogPos ts`.`Categ oryID`   374                LEFT JOI N `BlogCat egories` O N `BlogCat egories`.` CategoryID `=`BlogPos ts`.`Categ oryID`
362                WHERE `P ostStatus` ='approval '   375                WHERE `P ostStatus` ='approval '
363                GROUP BY  `BlogPost s`.`PostID `   376                GROUP BY  `BlogPost s`.`PostID `
364                ORDER BY  `CountCom ments` DES C, `PostDa te` DESC   377                ORDER BY  `CountCom ments` DES C, `PostDa te` DESC
365           ";   378           ";
366           $v TopPostSQL  = db_res( $sTopPostS QL);   379           $v TopPostSQL  = db_res( $sTopPostS QL);
367     380  
368           if  (mysql_nu m_rows($vT opPostSQL) >0) {   381           if  (mysql_nu m_rows($vT opPostSQL) >0) {
369                while (  $aResSQL =  mysql_fet ch_assoc($ vTopPostSQ L) ) {   382                while (  $aResSQL =  mysql_fet ch_assoc($ vTopPostSQ L) ) {
370                    if ( $aResSQL[' CountComme nts'] > 0)  {   383                    if ( $aResSQL[' CountComme nts'] > 0)  {
371                         $bFriend =  is_friend s( $this-> aBlogConf[ 'visitorID '], $aResS QL['OwnerI D'] );   384                         $bFriend =  is_friend s( $this-> aBlogConf[ 'visitorID '], $aResS QL['OwnerI D'] );
372                         $bOwner =  ($this->aB logConf['v isitorID'] ==$aResSQL ['OwnerID' ]) ? true  : false;   385                         $bOwner =  ($this->aB logConf['v isitorID'] ==$aResSQL ['OwnerID' ]) ? true  : false;
373                         $sBlogPost s .= $this ->GenPostS tring($aRe sSQL, 2);   386                         $sBlogPost s .= $this ->GenPostS tring($aRe sSQL, 2);
374                    }   387                    }
375                }   388                }
376                $sRetHtm l = $sBlog Posts;   389                $sRetHtm l = $sBlog Posts;
377           }  else {   390           }  else {
378                $sRetHtm l = MsgBox (_t('_Sorr y, nothing  found'));   391                $sRetHtm l = MsgBox (_t('_Sorr y, nothing  found'));
379           }   392           }
380           if  ($sBlogPo sts=='') {   393           if  ($sBlogPo sts=='') {
381                $sRetHtm l = MsgBox (_t('_Sorr y, nothing  found'));   394                $sRetHtm l = MsgBox (_t('_Sorr y, nothing  found'));
382           }   395           }
383     396  
384           re turn Desig nBoxConten t ($sCapti on, $sRetH tml, 1);   397           re turn Desig nBoxConten t ($sCapti on, $sRetH tml, 1);
385       }   398       }
386     399  
387       /**   400       /**
388        * Gen erate Post  Block by  Array of d ata   401        * Gen erate Post  Block by  Array of d ata
389        *   402        *
390        * @pa ram $aResS QL - Post  Array Data   403        * @pa ram $aResS QL - Post  Array Data
391        * @pa ram $iView  - type of  view(1 is  short vie w, 2 is fu ll view, 3  is post v iew(short) )   404        * @pa ram $iView  - type of  view(1 is  short vie w, 2 is fu ll view, 3  is post v iew(short) )
392        * @re turn HTML  presentati on of data   405        * @re turn HTML  presentati on of data
393        */   406        */
394       functi on GenPost String($aR esSQL, $iV iew=1) {   407       functi on GenPost String($aR esSQL, $iV iew=1) {
395           gl obal $site ;   408           gl obal $site ;
396     409  
397           $s EditC = _t ('_Edit');   410           $s EditC = _t ('_Edit');
398           $s DeleteC =  _t('_Delet e');   411           $s DeleteC =  _t('_Delet e');
399           $s SureC = _t ("_Are you  sure");   412           $s SureC = _t ("_Are you  sure");
400           $s PostCommen tC = _t('_ Post Comme nt');   413           $s PostCommen tC = _t('_ Post Comme nt');
401           $s Descriptio nC = _t('_ Descriptio n');   414           $s Descriptio nC = _t('_ Descriptio n');
402           $s AddComment C = _t('_A dd comment ');   415           $s AddComment C = _t('_A dd comment ');
403           $s NewPostC =  _t('_New  Post');   416           $s NewPostC =  _t('_New  Post');
404           $s TagsC = _t ('_Tags');   417           $s TagsC = _t ('_Tags');
405           $s PostsC = _ t('_Posts' );   418           $s PostsC = _ t('_Posts' );
406           $s CommentsC  = _t('_com ments');   419           $s CommentsC  = _t('_com ments');
407           $s ApproveC =  _t('_Appr ove');   420           $s ApproveC =  _t('_Appr ove');
408           $s DisApprove C = _t('_D isapprove' );   421           $s DisApprove C = _t('_D isapprove' );
409     422  
410           
$sDateForm atPhp   =   getParam(' php_date_f ormat');
  423            // $sDateForm atPhp   =   getParam(' php_date_f ormat');
411           // $sDateTime  = date( $ sDateForma tPhp, strt otime( $aR esSQL['Pos tDate'] )  );   424           // $sDateTime  = date( $ sDateForma tPhp, strt otime( $aR esSQL['Pos tDate'] )  );
412           $s DateTime =  LocaledDa taTime($aR esSQL['Pos tDate_UTS' ]);   425           $s DateTime =  LocaledDa taTime($aR esSQL['Pos tDate_UTS' ]);
413     426  
414           $a ProfileRes  = $this - > GetProfi leData($aR esSQL['Own erID']);   427           $a ProfileRes  = $this-> GetProfile Data($aRes SQL['Owner ID']);
    428           $i PostID = ( int)$aResS QL['PostID '];
415              429  
416           $s Author = ' ';   430           $s Author = ' ';
417           if  ($iView== 2) {   431           if  ($iView== 2) {
418                //$aMem  = getProfi leInfo( $a ResSQL['Ow nerID'] );   432                //$aMem  = getProfi leInfo( $a ResSQL['Ow nerID'] );
419                //$sAuth orC = _t(  '_By Autho r', $aMem[ 'NickName' ] );   433                //$sAuth orC = _t(  '_By Autho r', $aMem[ 'NickName' ] );
420                //$sAuth or = $sAut horC; //"{ $sAuthorC} <a class=\ "\" style= \"font-wei ght:bold;\ " href=\"" .getProfil eLink($aRe sSQL['Owne rID'])."\" >{$aProfil eRes['Nick Name']}</a >&nbsp;&nb sp;" ;   434                //$sAuth or = $sAut horC; //"{ $sAuthorC} <a class=\ "\" style= \"font-wei ght:bold;\ " href=\"" .getProfil eLink($aRe sSQL['Owne rID'])."\" >{$aProfil eRes['Nick Name']}</a >&nbsp;&nb sp;" ;
421                $sAuthor  = getProf ileLink($a ResSQL['Ow nerID']);   435                $sAuthor  = getProf ileLink($a ResSQL['Ow nerID']);
422                $sAuthor  = '<a hre f="'.$sAut hor.'">'.$ aProfileRe s['NickNam e'].'</a>' ;   436                $sAuthor  = '<a hre f="'.$sAut hor.'">'.$ aProfileRe s['NickNam e'].'</a>' ;
423           }   437           }
424     438  
425           $s TagsCommas  = $aResSQ L['Tags'];   439           $s TagsCommas  = $aResSQ L['Tags'];
426           $a Tags = spl it(',', $s TagsCommas );   440           $a Tags = spl it(',', $s TagsCommas );
427           $s TagsHrefs  = '';   441           $s TagsHrefs  = '';
428              442  
429           $a User = arr ay('Permal ink'=>$aPr ofileRes[' NickName'] , 'Link'=> $aResSQL[' OwnerID']) ;   443           $a User = arr ay('Permal ink'=>$aPr ofileRes[' NickName'] , 'Link'=> $aResSQL[' OwnerID']) ;
430              444  
431               
432           fo reach( $aT ags as $sT agKey ) {   445           fo reach( $aT ags as $sT agKey ) {
433                $sTagLin k = $this- >genBlogLi nk('search _by_tag',  $aUser, '' , '', $sTa gKey);   446                $sTagLin k = $this- >genBlogLi nk('search _by_tag',  $aUser, '' , '', $sTa gKey);
434                $sTagsHr efs .= <<< EOF   447                $sTagsHr efs .= <<< EOF
435   <a href="{ $sTagLink} " >{$sTagK ey}</a>&nb sp;   448   <a href="{ $sTagLink} " >{$sTagK ey}</a>&nb sp;
436   EOF;   449   EOF;
437           }   450           }
438     451  
439           $s Actions =  '';   452           $s Actions =  '';
440           
$sLink   =   $this->gen BlogFormUr l();
  453            // $sLink   =   $this->gen BlogFormUr l();
    454           $s Link = $th is->genBlo gLink('sho w_member_b log_home',  $aUser);
441           if  ($this->a BlogConf[' visitorID' ]==$aResSQ L['OwnerID '] || $thi s->bAdminM ode==TRUE)  {   455           if  ($this->a BlogConf[' visitorID' ]==$aResSQ L['OwnerID '] || $thi s->bAdminM ode==TRUE)  {
442     456  
443                $sAction s = <<<EOF   457                $sAction s = <<<EOF
444   <div class ="fr_small ">   458   <div class ="fr_small ">
445        <a   href="{$sL ink}"   onclick="j avascript:   UpdateFiel d('EditPos tID','{$ aResSQL[' PostID '] }');docume nt.forms.c ommand_edi t_post.sub mit();retu rn   false;"   style="tex t-transfor m:none;">{ $sEditC}</ a>&nbsp;   459        <a   href="{$sL ink}"   onclick="j avascript:   UpdateFiel d('EditPos tID','{$ i PostID
}');docume nt.forms.c ommand_edi t_post.sub mit();retu rn   false;"   style="tex t-transfor m:none;">{ $sEditC}</ a>&nbsp;
446        <a   href="{$sL ink}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete PostID','{ $ aResSQL[' PostID '] }');Update Field('DOw nerID','{$ aResSQL['O wnerID']}' );document .forms.com mand_delet e_post.sub mit();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteC} </a>   460        <a   href="{$sL ink}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete PostID','{ $ i PostID
}');Update Field('DOw nerID','{$ aResSQL['O wnerID']}' );document .forms.com mand_delet e_post.sub mit();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteC} </a>
447   </div>   461   </div>
448   EOF;   462   EOF;
449           }   463           }
450     464  
451           $s Author = ' ';   465           $s Author = ' ';
452     466  
453           // 339933 col or green   467           // 339933 col or green
454           $s PostText =  ($iView== 2) ? $aRes SQL['PostT ext'] : $a ResSQL['Po stText'];   468           $s PostText =  ($iView== 2) ? $aRes SQL['PostT ext'] : $a ResSQL['Po stText'];
455     469  
456           if  ($iView== 2) $sActio ns='';   470           if  ($iView== 2) $sActio ns='';
457           $s Tags = <<< EOF   471           $s Tags = <<< EOF
458   <div class ="fr_small _gray_cent ered">   472   <div class ="fr_small _gray_cent ered">
459       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}tag _small.png " class="m arg_icon"  alt="{$sTa gsC}" /></ span>{$sTa gsC}:&nbsp ;{$sTagsHr efs}   473       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}tag _small.png " class="m arg_icon"  alt="{$sTa gsC}" /></ span>{$sTa gsC}:&nbsp ;{$sTagsHr efs}
460   </div>   474   </div>
461   EOF;   475   EOF;
462     476  
463           $s FriendStyl e = "";   477           $s FriendStyl e = "";
464           $b Friend = i s_friends(  $this->aB logConf['v isitorID'] , $aResSQL ['OwnerID' ] );   478           $b Friend = i s_friends(  $this->aB logConf['v isitorID'] , $aResSQL ['OwnerID' ] );
465           $b Owner = ($ this->aBlo gConf['vis itorID']== $aResSQL[' OwnerID'])  ? true :  false;   479           $b Owner = ($ this->aBlo gConf['vis itorID']== $aResSQL[' OwnerID'])  ? true :  false;
466           $s User = iss et($aMem[' NickName'] ) ? $aMem[ 'NickName' ] : db_val ue("SELECT  `NickName ` FROM `Pr ofiles` WH ERE `ID`={ $aResSQL[' OwnerID']} ");   480           $s User = iss et($aMem[' NickName'] ) ? $aMem[ 'NickName' ] : db_val ue("SELECT  `NickName ` FROM `Pr ofiles` WH ERE `ID`={ $aResSQL[' OwnerID']} ");
467              481           
468           if ( 'friends ' == $aRes SQL['PostR eadPermiss ion'] && ! $bFriend & & !$bOwner  && !$this ->bAdminMo de ) {   482           if ( 'friends ' == $aRes SQL['PostR eadPermiss ion'] && ! $bFriend & & !$bOwner  && !$this ->bAdminMo de ) {
469                $sFriend Style="1";   483                $sFriend Style="1";
470                $sMsgBox  = MsgBox( _t('_this_ blog_only_ for_friend s'));   484                $sMsgBox  = MsgBox( _t('_this_ blog_only_ for_friend s'));
471                $sPostTe xt = <<<EO F   485                $sPostTe xt = <<<EO F
472   <div class ="clear_bo th"></div>   486   <div class ="clear_bo th"></div>
473       <img s rc="{$site ['icons']} lock.gif"  alt="" cla ss="marg_i con" style ="float:ri ght;positi on:relativ e;" />   487       <img s rc="{$site ['icons']} lock.gif"  alt="" cla ss="marg_i con" style ="float:ri ght;positi on:relativ e;" />
474       {$sMsg Box}   488       {$sMsg Box}
475   <div class ="clear_bo th"></div>   489   <div class ="clear_bo th"></div>
476   EOF;   490   EOF;
477           }   491           }
478              492           
479           $a User = arr ay('Permal ink'=>$sUs er, 'Link' =>$aResSQL ['OwnerID' ]);   493           $a User = arr ay('Permal ink'=>$sUs er, 'Link' =>$aResSQL ['OwnerID' ]);
480            $aPost   =   array('Per malink'=>$ aResSQL['P ostUri'],   'Link'=>$ aResSQL[' PostID '] );   494            $aPost   =   array('Per malink'=>$ aResSQL['P ostUri'],   'Link'=>$ i PostID
);
481           $s PostLink =  $this->ge nBlogLink( 'show_memb er_post',  $aUser, '' , $aPost);   495           $s PostLink =  $this->ge nBlogLink( 'show_memb er_post',  $aUser, '' , $aPost);
482     496  
483           $i Approved =  0; //0 =  not change d; 1 = app ; 2 = disa pp;   497           $i Approved =  0; //0 =  not change d; 1 = app ; 2 = disa pp;
484           if  ($this->b AdminMode= =true && $ _REQUEST[' sa']=='app rove') {   498           if  ($this->b AdminMode= =true && $ _REQUEST[' sa']=='app rove') {
485                //approv e this pos t   499                //approv e this pos t
486                 db_res("UP DATE   `BlogPosts `   SET   `PostStatu s`='approv al'   WHERE   `PostID`=' {$ aResSQL[' PostID '] }'   LIMIT   1");   500                 db_res("UP DATE   `BlogPosts `   SET   `PostStatu s`='approv al'   WHERE   `PostID`=' {$ i PostID
}'   LIMIT   1");
487                $iApprov ed = 1;   501                $iApprov ed = 1;
488           }   502           }
489           if  ($this->b AdminMode= =true && $ _REQUEST[' sa']=='dis approve')  {   503           if  ($this->b AdminMode= =true && $ _REQUEST[' sa']=='dis approve')  {
490                //disapp rove this  post   504                //disapp rove this  post
491                 db_res("UP DATE   `BlogPosts `   SET   `PostStatu s`='disapp roval'   WHERE   `PostID`=' {$ aResSQL[' PostID '] }'   LIMIT   1");   505                 db_res("UP DATE   `BlogPosts `   SET   `PostStatu s`='disapp roval'   WHERE   `PostID`=' {$ i PostID
}'   LIMIT   1");
492                $iApprov ed = 2;   506                $iApprov ed = 2;
493           }   507           }
494     508  
495           if  ($this->b AdminMode= =true) {   509           if  ($this->b AdminMode= =true) {
496                switch ( $iApproved ) {   510                switch ( $iApproved ) {
497                    case  0:   511                    case  0:
498                         $sSAAction  = ($aResS QL['PostSt atus']=='d isapproval ') ? 'appr ove' : 'di sapprove';   512                         $sSAAction  = ($aResS QL['PostSt atus']=='d isapproval ') ? 'appr ove' : 'di sapprove';
499                         $sSACaptio n = ($aRes SQL['PostS tatus']==' disapprova l') ? $sAp proveC : $ sDisApprov eC;   513                         $sSACaptio n = ($aRes SQL['PostS tatus']==' disapprova l') ? $sAp proveC : $ sDisApprov eC;
500                         break;   514                         break;
501                    case  1:   515                    case  1:
502                         $sSAAction  = 'disapp rove';   516                         $sSAAction  = 'disapp rove';
503                         $sSACaptio n = $sDisA pproveC;   517                         $sSACaptio n = $sDisA pproveC;
504                         break;   518                         break;
505                    case  2:   519                    case  2:
506                         $sSAAction  = 'approv e';   520                         $sSAAction  = 'approv e';
507                         $sSACaptio n = $sAppr oveC;   521                         $sSACaptio n = $sAppr oveC;
508                         break;   522                         break;
509                }   523                }
510     524  
511                $sAction s .= <<<EO F   525                $sAction s .= <<<EO F
512   <div class ="fr_small ">   526   <div class ="fr_small ">
513       <a hre f="{$sPost Link}&sa={ $sSAAction }" >{$sSAC aption}</a >&nbsp;&nb sp;&nbsp;   527       <a hre f="{$sPost Link}&sa={ $sSAAction }" >{$sSAC aption}</a >&nbsp;&nb sp;&nbsp;
514   </div>   528   </div>
515   EOF;   529   EOF;
516           }   530           }
517     531  
    532           $s PostCaptio n = htmlsp ecialchars ($aResSQL[ 'PostCapti on']);
518           $s PostCaptio nHref = << <EOF   533           $s PostCaptio nHref = << <EOF
519   <a   class="act ions"   href="
$sPostLink
">{$ aRe s SQL[' PostCaptio n '] }</a>
  534   <a   class="act ions"   href=" { $sPostLink } ">{$
s
PostCaptio n
}</a>
520   EOF;   535   EOF;
521     536  
522           $s PostPhoto  = '';   537           $s PostPhoto  = '';
523           if  ($iView== 3) {   538           if  ($iView== 3) {
524                 $sPostCapt ionHref   =   '<div   class="act ions">'.$ aRe s SQL[' PostCaptio n '] .'</div>';   539                 $sPostCapt ionHref   =   '<div   class="act ions">'.$
s
PostCaptio n
.'</div>';
525     540  
526                if ( $aR esSQL['Pos tPhoto'] )  {   541                if ( $aR esSQL['Pos tPhoto'] )  {
527                    $sSp acerName =  $site['ur l'].$this  -> sSpacer Path;   542                    $sSp acerName =  $site['ur l'].$this  -> sSpacer Path;
528                    $sPo stPhoto =  <<<EOF   543                    $sPo stPhoto =  <<<EOF
529   <div class ="marg_bot h_left">   544   <div class ="marg_bot h_left">
530       <img a lt="{$aRes SQL['PostP hoto']}" s tyle="widt h: {$this- >iThumbSiz e}px; heig ht: {$this ->iThumbSi ze}px; bac kground-im age: url({ $site['blo gImage']}b ig_{$aResS QL['PostPh oto']});"  src="{$sSp acerName}" />   545       <img a lt="{$aRes SQL['PostP hoto']}" s tyle="widt h: {$this- >iThumbSiz e}px; heig ht: {$this ->iThumbSi ze}px; bac kground-im age: url({ $site['blo gImage']}b ig_{$aResS QL['PostPh oto']});"  src="{$sSp acerName}" />
531   </div>   546   </div>
532   EOF;   547   EOF;
533                }   548                }
534           }   549           }
535     550  
536           $s OwnerCatLi nk = $this ->genBlogL ink('show_ member_blo g', array( 'Permalink '=>$sUser,  'Link'=>$ aResSQL['O wnerID']),  array('Pe rmalink'=> $aResSQL[' CategoryUr i'],'Link' =>$aResSQL ['Category ID']));   551           $s OwnerCatLi nk = $this ->genBlogL ink('show_ member_blo g', array( 'Permalink '=>$sUser,  'Link'=>$ aResSQL['O wnerID']),  array('Pe rmalink'=> $aResSQL[' CategoryUr i'],'Link' =>$aResSQL ['Category ID']));
537              552  
    553           $s CategoryNa me = htmls pecialchar s($aResSQL ['Category Name']);
    554  
538           $s BlogPosts  .= <<<EOF   555           $s BlogPosts  .= <<<EOF
539   <div style ="margin-b ottom:10px ;">   556   <div style ="margin-b ottom:10px ;">
540       <div>   557       <div>
541           <d iv class=" cls_res_th umb">   558           <d iv class=" cls_res_th umb">
542                {$sPostC aptionHref }   559                {$sPostC aptionHref }
543           </ div>   560           </ div>
544           {$ sActions}   561           {$ sActions}
545           <d iv class=" clear_both "></div>   562           <d iv class=" clear_both "></div>
546       </div>   563       </div>
547       <div c lass="fr_s mall_gray_ centered">   564       <div c lass="fr_s mall_gray_ centered">
548           {$ sAuthor}   565           {$ sAuthor}
549           <s pan style= "vertical- align:midd le;"><img  src="{$sit e['icons'] }clock.gif " class="m arg_icon"  alt="{$sDa teTime}" / ></span><s pan class= "margined" >{$sDateTi me}</span>   566           <s pan style= "vertical- align:midd le;"><img  src="{$sit e['icons'] }clock.gif " class="m arg_icon"  alt="{$sDa teTime}" / ></span><s pan class= "margined" >{$sDateTi me}</span>
550            <span   style="ver tical-alig n:middle;" ><img   src="{$sit e['icons'] }add_comme nt.gif"   class="mar g_icon"   alt=" {$sAddComm entC}"   title="{$s AddComment C} "   /></span>< span   class="mar gined">{$a ResSQL['Co untComment s']}   {$sComment sC}</span>   567            <span   style="ver tical-alig n:middle;" ><img   src="{$sit e['icons'] }add_comme nt.gif"   class="mar g_icon"   alt="
"   /></span>< span   class="mar gined">{$a ResSQL['Co untComment s']}   {$sComment sC}</span>
551            <span   style="ver tical-alig n:middle;" ><img   src="{$sit e['icons'] }folder_sm all.png"   class="mar g_icon"   alt="{$ aRe s SQL[' CategoryNa me '] }"   /></span>   568            <span   style="ver tical-alig n:middle;" ><img   src="{$sit e['icons'] }folder_sm all.png"   class="mar g_icon"   alt="{$
s
CategoryNa me
}"   /></span>
552            <a   href="
$sOwnerCat Link
">
  569            <a   href=" { $sOwnerCat Link } ">
553                 {$ aRe s SQL[' CategoryNa me '] }   570                 {$
s
CategoryNa me
}
554           </ a>   571           </ a>
555       </div>   572       </div>
556       <div c lass="blog _text{$sFr iendStyle} ">   573       <div c lass="blog _text{$sFr iendStyle} ">
557           {$ sPostPhoto }   574           {$ sPostPhoto }
558           {$ sPostText}   575           {$ sPostText}
559       </div>   576       </div>
560       <div c lass="clea r_both"></ div>   577       <div c lass="clea r_both"></ div>
561       {$sTag s}   578       {$sTag s}
562   </div>   579   </div>
563   EOF;   580   EOF;
564     581  
565           re turn $sBlo gPosts;   582           re turn $sBlo gPosts;
566       }   583       }
567     584  
568       /**   585       /**
569        * Gen erate User  Right Par t for Blog s   586        * Gen erate User  Right Par t for Blog s
570        *   587        *
571        * @pa ram $aBlog sRes - Blo g Array Da ta   588        * @pa ram $aBlog sRes - Blo g Array Da ta
572        * @pa ram $iView  - type of  view(1 is  short vie w, 2 is fu ll view, 3  is post v iew(short) )   589        * @pa ram $iView  - type of  view(1 is  short vie w, 2 is fu ll view, 3  is post v iew(short) )
573        * @re turn HTML  presentati on of data   590        * @re turn HTML  presentati on of data
574        */   591        */
575       functi on GenMemb erDescrAnd Cat($aBlog sRes, $iCa tegID = 0)  {   592       functi on GenMemb erDescrAnd Cat($aBlog sRes, $iCa tegID = 0)  {
576           gl obal $dir;   593           gl obal $dir;
577           gl obal $site ;   594           gl obal $site ;
578     595  
579           $s EditBlogC  = _t('_Edi t');   596           $s EditBlogC  = _t('_Edi t');
580           $s DeleteBlog C = _t('_D elete');   597           $s DeleteBlog C = _t('_D elete');
581           $s SureC = _t ("_Are you  sure");   598           $s SureC = _t ("_Are you  sure");
582           $s ApplyChang esC = _t(' _Apply Cha nges');   599           $s ApplyChang esC = _t(' _Apply Cha nges');
583           $s Descriptio nC = _t('_ Descriptio n');   600           $s Descriptio nC = _t('_ Descriptio n');
584           $s Categories C = _t('_C ategories' );   601           $s Categories C = _t('_C ategories' );
585           $s CategoryC  = _t('_Cat egory');   602           $s CategoryC  = _t('_Cat egory');
586           $s TagsC = _t ('_Tags');   603           $s TagsC = _t ('_Tags');
587           $s EditCatego ryC = _t(' _edit_cate gory');   604           $s EditCatego ryC = _t(' _edit_cate gory');
588           $s AddCategor yC = _t('_ add_catego ry');   605           $s AddCategor yC = _t('_ add_catego ry');
589           $s CommentsC  = _t('_Com ments');   606           $s CommentsC  = _t('_Com ments');
590           $s PostsC = _ t('_Posts' );   607           $s PostsC = _ t('_Posts' );
591     608  
592           $s NewC = ucf irst(_t('_ new'));   609           $s NewC = ucf irst(_t('_ new'));
593     610  
594            $iMemberID   =  
$aBlogsRes ['OwnerID' ];
  611            $iMemberID   =   (int) $aBlogsRes ['OwnerID' ];
595            $sCont   =   get_member _icon($ aBlogsR e s['Own erID '] ,   'left'   );   612            $sCont   =   get_member _icon($ iM e mb erID
,   'left'   );
    613  
    614           $s OwnerBlogL ink = $thi s->genBlog Link('show _member_bl og_home',  array('Per malink'=>$ aBlogsRes[ 'Nickname' ], 'Link'= >$iMemberI D));
596     615  
597            $sOwnerAdd Ap   =   ($ aBlogsR e s['Own erID ']   ==   $this->aBl ogConf['vi sitorID'])   ?   ''   :   "AND   `PostStatu s`='approv al'";   616            $sOwnerAdd Ap   =   ($ iM e mb erID  
==   $this->aBl ogConf['vi sitorID'])   ?   ''   :   "AND   `PostStatu s`='approv al'";
598           // tested, ri ght   617           // tested, ri ght
599           $s CountPostS QL = "   618           $s CountPostS QL = "
600                SELECT C OUNT(*)   619                SELECT C OUNT(*)
601                FROM `Bl ogPosts`   620                FROM `Bl ogPosts`
602                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID`   621                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID`
603                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}  {$sOwnerAd dAp}   622                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}  {$sOwnerAd dAp}
604           ";   623           ";
605     624  
606           $a CountPost  = db_arr(  $sCountPos tSQL );   625           $a CountPost  = db_arr(  $sCountPos tSQL );
607           $i CountPost  = (int)$aC ountPost[0 ];   626           $i CountPost  = (int)$aC ountPost[0 ];
608     627  
609           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;   628           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;
610     629  
611           // tested, ri ght   630           // tested, ri ght
612           $s CountComme ntsSQL = "   631           $s CountComme ntsSQL = "
613                SELECT C OUNT( * )    632                SELECT C OUNT(*) 
614                FROM `"  . $oCmts-> getComment sTableName () . "` AS  `tc`   633                FROM `"  . $oCmts-> getComment sTableName () . "` AS  `tc`
615                INNER JO IN `BlogPo sts` ON `B logPosts`. `PostID` =  `tc`.`cmt _object_id   634                INNER JO IN `BlogPo sts` ON `B logPosts`. `PostID` =  `tc`.`cmt _object_id
616                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID`    635                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID` 
617                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}  {$sOwnerAd dAp}   636                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}  {$sOwnerAd dAp}
618           ";   637           ";
619     638  
620           $a CountComme nts = db_a rr( $sCoun tCommentsS QL );   639           $a CountComme nts = db_a rr( $sCoun tCommentsS QL );
621           $i CountComme nts = (int )$aCountCo mments[0];   640           $i CountComme nts = (int )$aCountCo mments[0];
622     641  
623           $s Categories  = '';   642           $s Categories  = '';
624           $s Categories SQL = "   643           $s Categories SQL = "
625                SELECT *     644                SELECT *  
626                FROM `Bl ogCategori es`   645                FROM `Bl ogCategori es`
627                WHERE `O wnerId` =  {$iMemberI D}   646                WHERE `O wnerId` =  {$iMemberI D}
628           ";   647           ";
629           $v Categories  = db_res(  $sCategor iesSQL );   648           $v Categories  = db_res(  $sCategor iesSQL );
630           $a TagsPost =  array();   649           $a TagsPost =  array();
631           $s TagsVals =  '';   650           $s TagsVals =  '';
632     651  
633           if  ($iCategI D  > 0)   652           if  ($iCategI D  > 0)
634                $sPostsS QL = "SELE CT `Tags`, `PostReadP ermission` ,`BlogCate gories`.`O wnerID` FR OM `BlogPo sts`   653                $sPostsS QL = "SELE CT `Tags`, `PostReadP ermission` ,`BlogCate gories`.`O wnerID` FR OM `BlogPo sts`
635                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID` = ` BlogPosts` .`Category ID`   654                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID` = ` BlogPosts` .`Category ID`
636                    WHER E `BlogCat egories`.` CategoryID ` = {$iCat egID} {$sO wnerAddAp} ";   655                    WHER E `BlogCat egories`.` CategoryID ` = {$iCat egID} {$sO wnerAddAp} ";
637           el se   656           el se
638                $sPostsS QL = "SELE CT `Tags`, `PostReadP ermission` ,`BlogCate gories`.`O wnerID` FR OM `BlogPo sts`   657                $sPostsS QL = "SELE CT `Tags`, `PostReadP ermission` ,`BlogCate gories`.`O wnerID` FR OM `BlogPo sts`
639                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID` = ` BlogPosts` .`Category ID`   658                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID` = ` BlogPosts` .`Category ID`
640                     WHERE   `BlogCateg ories`.`Ow nerID`   =   {$ aBlogsR e s['Own erID '] }   {$sOwnerAd dAp}";   659                     WHERE   `BlogCateg ories`.`Ow nerID`   =   {$ iM e mb erID
}   {$sOwnerAd dAp}";
641     660  
642           $v Tags = db_ res( $sPos tsSQL );   661           $v Tags = db_ res( $sPos tsSQL );
643           $a TagsPost =  array();   662           $a TagsPost =  array();
644           wh ile ( $aPo st = mysql _fetch_ass oc($vTags)  ) {   663           wh ile ( $aPo st = mysql _fetch_ass oc($vTags)  ) {
645                $bFriend  = is_frie nds( $this ->aBlogCon f['visitor ID'], $aPo st['OwnerI D'] );   664                $bFriend  = is_frie nds( $this ->aBlogCon f['visitor ID'], $aPo st['OwnerI D'] );
646                $bOwner  = ($this-> aBlogConf[ 'visitorID ']==$aPost ['OwnerID' ]) ? true  : false;   665                $bOwner  = ($this-> aBlogConf[ 'visitorID ']==$aPost ['OwnerID' ]) ? true  : false;
647                if( 'fri ends' == $ aPost['Pos tReadPermi ssion'] &&  !$bFriend  && !$bOwn er && !$th is->bAdmin Mode ) {   666                if( 'fri ends' == $ aPost['Pos tReadPermi ssion'] &&  !$bFriend  && !$bOwn er && !$th is->bAdmin Mode ) {
648                } else {   667                } else {
649                    $sTa gsCommas =  trim($aPo st['Tags'] );   668                    $sTa gsCommas =  trim($aPo st['Tags'] );
650                    $aTa gs = explo de(',', $s TagsCommas );   669                    $aTa gs = explo de(',', $s TagsCommas );
651                    fore ach( $aTag s as $sTag Key ) {   670                    fore ach( $aTag s as $sTag Key ) {
652                         if ($sTagK ey!='') {   671                         if ($sTagK ey!='') {
653                             if( is set($aTags Post[$sTag Key]) )   672                             if( is set($aTags Post[$sTag Key]) )
654                                 $a TagsPost[$ sTagKey]++ ;   673                                 $a TagsPost[$ sTagKey]++ ;
655                             else   674                             else
656                                 $a TagsPost[$ sTagKey] =  1;   675                                 $a TagsPost[$ sTagKey] =  1;
657                         }   676                         }
658                    }   677                    }
659                }   678                }
660           }   679           }
661           ar sort($aTag sPost);   680           ar sort($aTag sPost);
662           $a TagsPost =  array_sli ce($aTagsP ost, 0, $t his->iTopT agsCnt);   681           $a TagsPost =  array_sli ce($aTagsP ost, 0, $t his->iTopT agsCnt);
663     682  
664            $aProf   =   array('Per malink'=>$ aBlogsRes[ 'Nickname' ],   'Link'=>$ aBlogsR e s['Own erID '] );   683            $aProf   =   array('Per malink'=>$ aBlogsRes[ 'Nickname' ],   'Link'=>$ iM e mb erID
);
665     684  
666           fo reach( $aT agsPost as  $varKey = > $varValu e ) {   685           fo reach( $aT agsPost as  $varKey = > $varValu e ) {
667                $sTagLin k = $this- >genBlogLi nk('search _by_tag',  $aProf, '' , '', $var Key);   686                $sTagLin k = $this- >genBlogLi nk('search _by_tag',  $aProf, '' , '', $var Key);
668                $sTagImg  = '<img s rc="'.$sit e['icons'] .'tag.png"  class="st atic_icon"  alt="'.$v arValue.'"  />';   687                $sTagImg  = '<img s rc="'.$sit e['icons'] .'tag.png"  class="st atic_icon"  alt="'.$v arValue.'"  />';
669                $sTagNam e = '<a cl ass="actio ns" href=" '.$sTagLin k.'" style ="text-tra nsform:cap italize;"  >'.$varKey .'</a>&nbs p;('.$varV alue.')';   688                $sTagNam e = '<a cl ass="actio ns" href=" '.$sTagLin k.'" style ="text-tra nsform:cap italize;"  >'.$varKey .'</a>&nbs p;('.$varV alue.')';
670                $sTagsIm gName = $t his->GenCe nteredActi onsBlock($ sTagImg, $ sTagName);   689                $sTagsIm gName = $t his->GenCe nteredActi onsBlock($ sTagImg, $ sTagName);
671                $sTagsVa ls .= <<<E OF   690                $sTagsVa ls .= <<<E OF
672   <div class ="tag_el">   691   <div class ="tag_el">
673       {$sTag sImgName}   692       {$sTag sImgName}
674   </div>   693   </div>
675   EOF;   694   EOF;
676           }   695           }
677           wh ile ( $aCa tegories =  mysql_fet ch_assoc($ vCategorie s) ) {   696           wh ile ( $aCa tegories =  mysql_fet ch_assoc($ vCategorie s) ) {
678                $sCountP ostCatSQL  = "   697                $sCountP ostCatSQL  = "
679                    SELE CT COUNT(* )   698                    SELE CT COUNT(* )
680                    FROM  `BlogPost s`   699                    FROM  `BlogPost s`
681                    WHER E `BlogPos ts`.`Categ oryID` = { $aCategori es['Catego ryID']}   700                    WHER E `BlogPos ts`.`Categ oryID` = { $aCategori es['Catego ryID']}
682                    {$sO wnerAddAp}   701                    {$sO wnerAddAp}
683                ";   702                ";
684     703  
685                $aCountC atPost = d b_arr( $sC ountPostCa tSQL );   704                $aCountC atPost = d b_arr( $sC ountPostCa tSQL );
686                $iCountC atPost = ( int)$aCoun tCatPost[0 ];   705                $iCountC atPost = ( int)$aCoun tCatPost[0 ];
687     706  
688                $sAbilEd itDelCateg  = '';   707                $sAbilEd itDelCateg  = '';
689                 if   ($this->aB logConf['v isitorID'] ==$ aBlogsR e s['Own erID ']   ||   $this->bAd minMode== TRUE )   {   708                 if   ($this->aB logConf['v isitorID'] ==$ iM e mb erID  
||   $this->bAd minMode== true )   {
690                    $sDe lAbilOnly  = '';   709                    $sDe lAbilOnly  = '';
691                    
$sLink   =   $this->gen BlogFormUr l();
  710                     // $sLink   =   $this->gen BlogFormUr l();
692                    if ( $aCategori es['Catego ryType']== 1) {   711                    if ( $aCategori es['Catego ryType']== 1) {
693                         $sDelAbilO nly = <<<E OF   712                         $sDelAbilO nly = <<<E OF
694   <a   href="{$s
Link}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete CategoryID ','{$aCate gories['Ca tegoryID'] }');docume nt.forms.c ommand_del ete_catego ry.submit( );   }   return   false;">
  713   <a   href="{$s OwnerBlog Link}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete CategoryID ','{$aCate gories['Ca tegoryID'] }');docume nt.forms.c ommand_del ete_catego ry.submit( );   }   return   false;">
695       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_delete. png" style ="border:0  solid;pos ition:stat ic;" alt=" {$sDeleteB logC} {$sC ategoryC}"  /></span>   714       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_delete. png" style ="border:0  solid;pos ition:stat ic;" alt=" {$sDeleteB logC} {$sC ategoryC}"  /></span>
696   </a>   715   </a>
697   EOF;   716   EOF;
698                    }   717                    }
699                    $sAb ilEditDelC ateg = <<< EOF   718                    $sAb ilEditDelC ateg = <<< EOF
700   <a href="{ $_SERVER[' PHP_SELF'] }?action=e dit_catego ry&amp;cat egoryID={$ aCategorie s['Categor yID']}&amp ;ownerID={ $iMemberID }" style=" text-trans form:none; ">   719   <a href="{ $_SERVER[' PHP_SELF'] }?action=e dit_catego ry&amp;cat egoryID={$ aCategorie s['Categor yID']}&amp ;ownerID={ $iMemberID }" style=" text-trans form:none; ">
701       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_edit.pn g" style=" border:0 s olid;posit ion:static ;" alt="{$ sEditCateg oryC}" />< /span>   720       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_edit.pn g" style=" border:0 s olid;posit ion:static ;" alt="{$ sEditCateg oryC}" />< /span>
702   </a>   721   </a>
703   EOF;   722   EOF;
704                    $sAb ilEditDelC ateg .= $s DelAbilOnl y;   723                    $sAb ilEditDelC ateg .= $s DelAbilOnl y;
705                }   724                }
706                $sCatPic  = ($aCate gories['Ca tegoryPhot o'] && fil e_exists($ dir['blogI mage'].'sm all_'.$aCa tegories[' CategoryPh oto']))?$s ite['blogI mage'].'sm all_'.$aCa tegories[' CategoryPh oto']:"{$s ite['icons ']}folder. png";   725                $sCatPic  = ($aCate gories['Ca tegoryPhot o'] && fil e_exists($ dir['blogI mage'].'sm all_'.$aCa tegories[' CategoryPh oto']))?$s ite['blogI mage'].'sm all_'.$aCa tegories[' CategoryPh oto']:"{$s ite['icons ']}folder. png";
707     726  
708                $sCatNam e = $aCate gories['Ca tegoryName '];   727                $sCatNam e = $aCate gories['Ca tegoryName '];
709                $sSpacer Name = $si te['url']. $this->sSp acerPath;   728                $sSpacer Name = $si te['url']. $this->sSp acerPath;
710                   729  
711                    
712                $aCat =  array('Per malink'=>$ aCategorie s['Categor yUri'], 'L ink'=>$aCa tegories[' CategoryID ']);   730                $aCat =  array('Per malink'=>$ aCategorie s['Categor yUri'], 'L ink'=>$aCa tegories[' CategoryID ']);
713                $sCatLin k = $this- >genBlogLi nk('show_m ember_blog ', $aProf,  $aCat);   731                $sCatLin k = $this- >genBlogLi nk('show_m ember_blog ', $aProf,  $aCat);
714     732  
715                $sCatego ries .= << <EOF   733                $sCatego ries .= << <EOF
716   <div class ="pic_cent ered">   734   <div class ="pic_cent ered">
717       <div c lass="clea r_both"></ div>   735       <div c lass="clea r_both"></ div>
718       <div c lass="cls_ res_thumb  small_marg ined" >   736       <div c lass="cls_ res_thumb  small_marg ined" >
719           <d iv class=" thumbnail_ block">   737           <d iv class=" thumbnail_ block">
720                <span st yle="verti cal-align: middle;">   738                <span st yle="verti cal-align: middle;">
721                    <img  class="cl s_categ_ic on" src="{ $sCatPic}"  alt="" />   739                    <img  class="cl s_categ_ic on" src="{ $sCatPic}"  alt="" />
722                </span>   740                </span>
723           </ div>   741           </ div>
724       </div>   742       </div>
725     743  
726       <div c lass="cls_ categ_name ">   744       <div c lass="cls_ categ_name ">
727           <a  class="ac tions" hre f="{$sCatL ink}">{$sC atName}</a >&nbsp;({$ iCountCatP ost})   745           <a  class="ac tions" hre f="{$sCatL ink}">{$sC atName}</a >&nbsp;({$ iCountCatP ost})
728       </div>   746       </div>
729     747  
730       <div c lass="cat_ edit">   748       <div c lass="cat_ edit">
731           <d iv class=" cls_thumb" >   749           <d iv class=" cls_thumb" >
732                <div cla ss="thumbn ail_block" >   750                <div cla ss="thumbn ail_block" >
733                    <spa n style="v ertical-al ign:middle ;">   751                    <spa n style="v ertical-al ign:middle ;">
734                         {$sAbilEdi tDelCateg}   752                         {$sAbilEdi tDelCateg}
735                    </sp an>   753                    </sp an>
736                </div>   754                </div>
737           </ div>   755           </ div>
738       </div>   756       </div>
739     757  
740       <div c lass="clea r_both"></ div>   758       <div c lass="clea r_both"></ div>
741   </div>   759   </div>
742   EOF;   760   EOF;
743           }   761           }
744     762  
745           $s Actions =  '';   763           $s Actions =  '';
746            if   ($this->aB logConf['v isitorID'] ==$ aBlogsR e s['Own erID ']   ||   $this->bAd minMode== TRUE )   {   764            if   ($this->aB logConf['v isitorID'] ==$ iM e mb erID  
||   $this->bAd minMode== true )   {
747                $sDescrA ct = $this ->ActionPr epareForEd it($aBlogs Res['Descr iption']);   765                $sDescrA ct = $this ->ActionPr epareForEd it($aBlogs Res['Descr iption']);
748                $sDescrA ct = str_r eplace( "\ r\n", '',  $sDescrAct  );   766                $sDescrA ct = str_r eplace( "\ r\n", '',  $sDescrAct  );
749                
$sLink   =   $this->gen BlogFormUr l();
  767                 // $sLink   =   $this->gen BlogFormUr l();
750                $sAction s = <<<EOF   768                $sAction s = <<<EOF
751   <div class ="caption_ item">   769   <div class ="caption_ item">
752       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}des cription_e dit.png" c lass="marg _icon" alt ="{$sEditB logC} {$sD escription C}" /></sp an>   770       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}des cription_e dit.png" c lass="marg _icon" alt ="{$sEditB logC} {$sD escription C}" /></sp an>
753        <a   href="{$s
Link}"   onclick="j avascript:   UpdateFiel d('EditBlo gID','{$aB logsRes['I D']}');   UpdateFiel d('Descrip tion','{$s DescrAct}' );   UpdateFiel d('EOwnerI D','{$iMem berID}');   document.g etElementB yId('edite d_blog_div ').style.d isplay   =   'block';   document.g etElementB yId('Small Desc').sty le.display   =   'none';   return   false;"   style="tex t-transfor m:none;">{ $sEditBlog C}</a>&nbs p;
  771        <a   href="{$s OwnerBlog Link}"   onclick="j avascript:   UpdateFiel d('EditBlo gID','{$aB logsRes['I D']}');   UpdateFiel d('Descrip tion','{$s DescrAct}' );   UpdateFiel d('EOwnerI D','{$iMem berID}');   document.g etElementB yId('edite d_blog_div ').style.d isplay   =   'block';   document.g etElementB yId('Small Desc').sty le.display   =   'none';   return   false;"   style="tex t-transfor m:none;">{ $sEditBlog C}</a>&nbs p;
754        <a   href="{$s
Link}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete BlogID','{ $aBlogsRes ['ID']}'); document.f orms.comma nd_delete_ blog.submi t();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteBl ogC}</a>
  772        <a   href="{$s OwnerBlog Link}"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete BlogID','{ $aBlogsRes ['ID']}'); document.f orms.comma nd_delete_ blog.submi t();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteBl ogC}</a>
755   </div>   773   </div>
756   EOF;   774   EOF;
757           }   775           }
758              776  
759            $s Pr o fLink   =   g
e tP r of i
l
e L i nk ($aBlogsRe s[' Own e
r ID ']);
  777           $s Link = $th is->genBlo gFormUrl() ;
    778           $s ProfLink =  getProfil eLink($iMe mberID);
    779            $s Bl o
g D e sc r
i ption   =   htm l sp e c i alchars ($aBlogsRe s[' D e sc r iption ']);
760           $s Descriptio nContent =  <<<EOF   780           $s Descriptio nContent =  <<<EOF
761   <div class ="cls_res_ thumb">   781   <div class ="cls_res_ thumb">
762       <div c lass="marg _both">   782       <div c lass="marg _both">
763           {$ sCont}   783           {$ sCont}
764       </div>   784       </div>
765   </div>   785   </div>
766   <a class=" actions" h ref="{$sPr ofLink}">{ $aBlogsRes ['Nickname ']}</a>   786   <a class=" actions" h ref="{$sPr ofLink}">{ $aBlogsRes ['Nickname ']}</a>
767   <br />{$sP ostsC}: {$ iCountPost }<br />{$s CommentsC} : {$iCount Comments}< br />   787   <br />{$sP ostsC}: {$ iCountPost }<br />{$s CommentsC} : {$iCount Comments}< br />
768   <span clas s="cls_res _info_p22"  id="Small Desc" styl e="display :block;tex t-align:ju stify;">   788   <span clas s="cls_res _info_p22"  id="Small Desc" styl e="display :block;tex t-align:ju stify;">
769        {$ a Blog sRes[' Descriptio n '] }   789        {$ s Blog
Descriptio n
}
770   </span>   790   </span>
771   <div class ="clear_bo th"></div>   791   <div class ="clear_bo th"></div>
772   <div id="e dited_blog _div" styl e="display : none; po sition:rel ative;">   792   <div id="e dited_blog _div" styl e="display : none; po sition:rel ative;">
773       <form  action="{$ sLink}" me thod="post " name="Ed itBlogForm ">   793       <form  action="{$ sLink}" me thod="post " name="Ed itBlogForm ">
774           <i nput type= "hidden" n ame="actio n" id="act ion" value ="edit_blo g" />   794           <i nput type= "hidden" n ame="actio n" id="act ion" value ="edit_blo g" />
775           <i nput type= "hidden" n ame="EditB logID" id= "EditBlogI D" value=" "/>   795           <i nput type= "hidden" n ame="EditB logID" id= "EditBlogI D" value=" "/>
776           <i nput type= "hidden" n ame="EOwne rID" id="E OwnerID" v alue=""/>   796           <i nput type= "hidden" n ame="EOwne rID" id="E OwnerID" v alue=""/>
777            <textarea   name="Desc ription"   id="Descri ption"   rows="3"   cols="3"   style="wid th:95%;hei ght:50px;"   onkeyup="i f(   this.value .length   >   255   )   this.value   =   this.value .substr(   0,   255   );">{$ a Blog sRes[' Descriptio n '] }</textare a>   797            <textarea   name="Desc ription"   id="Descri ption"   rows="3"   cols="3"   style="wid th:95%;hei ght:50px;"   onkeyup="i f(   this.value .length   >   255   )   this.value   =   this.value .substr(   0,   255   );">{$ s Blog
Descriptio n
}</textare a>
778           <d iv style=" text-align :center">< input type ="submit"  value="{$s ApplyChang esC}"/></d iv>   798           <d iv style=" text-align :center">< input type ="submit"  value="{$s ApplyChang esC}"/></d iv>
779       </form >   799       </form >
780   </div>   800   </div>
781   EOF;   801   EOF;
782     802  
783           $s Descriptio nSect = De signBoxCon tent ( _t( $sDescript ionC), $sD escription Content, 1  , $sActio ns);   803           $s Descriptio nSect = De signBoxCon tent ( _t( $sDescript ionC), $sD escription Content, 1  , $sActio ns);
784     804  
785           $s Categories Actions =  '';   805           $s Categories Actions =  '';
786            if   ($this->aB logConf['v isitorID'] ==$ aBlogsR e s['Own erID ']   /*||   $this->bAd minMode==T RUE*/)   {   806            if   ($this->aB logConf['v isitorID'] ==$ iM e mb erID  
/*||   $this->bAd minMode==T RUE*/)   {
787                $sCatego riesAction s = <<<EOF   807                $sCatego riesAction s = <<<EOF
788   <div class ="caption_ item">   808   <div class ="caption_ item">
789       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_add.png " class="m arg_icon"  alt="{$sAd dCategoryC }" /></spa n>   809       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}cat eg_add.png " class="m arg_icon"  alt="{$sAd dCategoryC }" /></spa n>
790       <a hre f="{$_SERV ER['PHP_SE LF']}?acti on=add_cat egory&amp; ownerID={$ iMemberID} " style="t ext-transf orm:none;" >{$sNewC}< /a>   810       <a hre f="{$_SERV ER['PHP_SE LF']}?acti on=add_cat egory&amp; ownerID={$ iMemberID} " style="t ext-transf orm:none;" >{$sNewC}< /a>
791   </div>   811   </div>
792   EOF;   812   EOF;
793           }   813           }
794           $s Categories Sect = Des ignBoxCont ent ( _t($ sCategorie sC), $sCat egories, 1  , $sCateg oriesActio ns);   814           $s Categories Sect = Des ignBoxCont ent ( _t($ sCategorie sC), $sCat egories, 1  , $sCateg oriesActio ns);
795           $s TagsSect =  DesignBox Content (  _t($sTagsC ), $sTagsV als, 1);   815           $s TagsSect =  DesignBox Content (  _t($sTagsC ), $sTagsV als, 1);
796     816  
797           re turn $sDes criptionSe ct . $sCat egoriesSec t . $sTags Sect;   817           re turn $sDes criptionSe ct . $sCat egoriesSec t . $sTags Sect;
798       }   818       }
799     819  
800       /**   820       /**
801        * Gen erate User `s Blog Pa ge   821        * Gen erate User `s Blog Pa ge
802        *   822        *
803        * @pa ram $iUser ID - User  ID   823        * @pa ram $iUser ID - User  ID
804        * @re turn HTML  presentati on of data   824        * @re turn HTML  presentati on of data
805        */   825        */
806       functi on GenMemb erBlog($iU serID = 0)  {   826       functi on GenMemb erBlog($iU serID = 0)  {
807           gl obal $site ;   827           gl obal $site ;
808     828  
809           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   829           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
810           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);   830           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);
811           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   831           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
812     832  
813           $s RetHtml =  '';   833           $s RetHtml =  '';
814           $s BlogPosts  = '';   834           $s BlogPosts  = '';
815           $i MemberID =  $this->de fineUserId ();   835           $i MemberID =  $this->de fineUserId ();
816           if  ($iUserID >0)   836           if  ($iUserID >0)
817                $iMember ID = $iUse rID;   837                $iMember ID = $iUse rID;
818           $i CategoryID  = $this-> defineCate goryId();   838           $i CategoryID  = $this-> defineCate goryId();
819     839  
820           $s EditC = _t ('_Edit');   840           $s EditC = _t ('_Edit');
821           $s DeleteC =  _t('_Delet e');   841           $s DeleteC =  _t('_Delet e');
822           $s SureC = _t ("_Are you  sure");   842           $s SureC = _t ("_Are you  sure");
823           $s PostCommen tC = _t('_ Post Comme nt');   843           $s PostCommen tC = _t('_ Post Comme nt');
824           $s Descriptio nC = _t('_ Descriptio n');   844           $s Descriptio nC = _t('_ Descriptio n');
825           $s AddComment C = _t('_A dd comment ');   845           $s AddComment C = _t('_A dd comment ');
826           $s NewPostC =  _t('_New  Post');   846           $s NewPostC =  _t('_New  Post');
827           $s TagsC = _t ('_Tags');   847           $s TagsC = _t ('_Tags');
828           $s PostsC = _ t('_Posts' );   848           $s PostsC = _ t('_Posts' );
    849           $s HomeC = _t ('_Blogs') ;
    850  
829           $s BlogsSQL =  "   851           $s BlogsSQL =  "
830                SELECT ` Blogs`. *  , `Profile s`.`Nickna me`    852                SELECT ` Blogs`. *  , `Profile s`.`Nickna me` 
831                FROM `Bl ogs`    853                FROM `Bl ogs` 
832                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`   854                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`
833                 WHERE   `Blogs`.`O wnerID`   =  
{$iMemberI D}
  855                 WHERE   `Blogs`.`O wnerID`   =   ' {$iMemberI D} '
834                LIMIT 1   856                LIMIT 1
835           ";   857           ";
836     858  
837           $a BlogsRes =  db_arr( $ sBlogsSQL  );   859           $a BlogsRes =  db_arr( $ sBlogsSQL  );
838           if  (!$aBlogs Res) {   860           if  (!$aBlogs Res) {
839                if ($iMe mberID ==  $iCheckedM emberID) {   861                if ($iMe mberID ==  $iCheckedM emberID) {
840                    retu rn $this-> GenCreateB logForm();   862                    retu rn $this-> GenCreateB logForm();
841                } else {   863                } else {
842                    retu rn MsgBox( _t('_Sorry , nothing  found'));   864                    retu rn MsgBox( _t('_Sorry , nothing  found'));
843                }   865                }
844           }   866           }
845     867  
846           $s CategoryAd don = ($iC ategoryID> 0) ? "AND  `BlogPosts `.`Categor yID` = {$i CategoryID }" : '';   868           $s CategoryAd don = ($iC ategoryID> 0) ? "AND  `BlogPosts `.`Categor yID` = {$i CategoryID }" : '';
847           $s OwnerAddAp  = ($iChec kedMemberI D!=$iMembe rID) ? "AN D `PostSta tus`='appr oval'" : ' ';   869           $s OwnerAddAp  = ($iChec kedMemberI D!=$iMembe rID) ? "AN D `PostSta tus`='appr oval'" : ' ';
848     870  
849           // ////////// //////pagi nation add ition///// ////////// ////////// /   871           // ////////// //////pagi nation add ition///// ////////// ////////// /
850           $s CntSQL = " SELECT COU NT(`BlogPo sts`.`Post ID`) AS `C nt`   872           $s CntSQL = " SELECT COU NT(`BlogPo sts`.`Post ID`) AS `C nt`
851                             FROM ` BlogPosts`   873                             FROM ` BlogPosts`
852                             INNER  JOIN `Blog Categories ` ON `Blog Categories `.`Categor yID`=`Blog Posts`.`Ca tegoryID`   874                             INNER  JOIN `Blog Categories ` ON `Blog Categories `.`Categor yID`=`Blog Posts`.`Ca tegoryID`
853                             WHERE  `BlogCateg ories`.`Ow nerID` = { $iMemberID }   875                             WHERE  `BlogCateg ories`.`Ow nerID` = { $iMemberID }
854                             {$sCat egoryAddon }   876                             {$sCat egoryAddon }
855                             {$sOwn erAddAp}   877                             {$sOwn erAddAp}
856           ";   878           ";
857     879  
858           $i TotalNum =  db_value(  $sCntSQL  );   880           $i TotalNum =  db_value(  $sCntSQL  );
859           if ( !$iTotal Num ) {   881           if ( !$iTotal Num ) {
860                $sBlogPo sts .= Msg Box(_t('_S orry, noth ing found' ));   882                $sBlogPo sts .= Msg Box(_t('_S orry, noth ing found' ));
861           }   883           }
862     884  
863           $i PerPage =  (int)$_GET ['per_page '];   885           $i PerPage =  (int)$_GET ['per_page '];
864           if ( !$iPerPa ge )   886           if ( !$iPerPa ge )
865                $iPerPag e = $this- >iPerPageE lements;   887                $iPerPag e = $this- >iPerPageE lements;
866           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   888           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
867     889  
868           $i CurPage =  (int)$_GET ['page'];   890           $i CurPage =  (int)$_GET ['page'];
869     891  
870           if ( $iCurPag e > $iTota lPages )   892           if ( $iCurPag e > $iTota lPages )
871                $iCurPag e = $iTota lPages;   893                $iCurPag e = $iTota lPages;
872     894  
873           if ( $iCurPag e < 1 )   895           if ( $iCurPag e < 1 )
874                $iCurPag e = 1;   896                $iCurPag e = 1;
875     897  
876           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   898           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
877           $s qlLimit =  "LIMIT {$s LimitFrom} , {$iPerPa ge}";   899           $s qlLimit =  "LIMIT {$s LimitFrom} , {$iPerPa ge}";
878           // ////////// ////////// //////   900           // ////////// ////////// //////
879     901  
880           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;   902           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;
881     903  
882           $s BlogPostsS QL = "   904           $s BlogPostsS QL = "
883                SELECT ` BlogPosts` .*, COUNT( `cmt_id`)  AS `CountC omments`,  `BlogCateg ories`.`Ow nerID`, `B logCategor ies`.`Cate goryName`,  `BlogCate gories`.`C ategoryUri `,   905                SELECT ` BlogPosts` .*, COUNT( `cmt_id`)  AS `CountC omments`,  `BlogCateg ories`.`Ow nerID`, `B logCategor ies`.`Cate goryName`,  `BlogCate gories`.`C ategoryUri `,
884                UNIX_TIM ESTAMP( `B logPosts`. `PostDate`  ) AS `Pos tDate_UTS`   906                UNIX_TIM ESTAMP( `B logPosts`. `PostDate`  ) AS `Pos tDate_UTS`
885                FROM `Bl ogPosts`   907                FROM `Bl ogPosts`
886                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `BlogP osts`.`Pos tID` = `tc `.`cmt_obj ect_id`   908                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON `BlogP osts`.`Pos tID` = `tc `.`cmt_obj ect_id`
887                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D`=`BlogPo sts`.`Cate goryID`   909                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D`=`BlogPo sts`.`Cate goryID`
888                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}   910                WHERE `B logCategor ies`.`Owne rId` = {$i MemberID}
889                {$sCateg oryAddon}   911                {$sCateg oryAddon}
890                {$sOwner AddAp}   912                {$sOwner AddAp}
891                GROUP BY  `BlogPost s`.`PostID `   913                GROUP BY  `BlogPost s`.`PostID `
892                ORDER BY  `PostDate ` DESC, `C ountCommen ts` DESC   914                ORDER BY  `PostDate ` DESC, `C ountCommen ts` DESC
893                {$sqlLim it}   915                {$sqlLim it}
894           ";   916           ";
895     917  
896           $v BlogPosts  = db_res(  $sBlogPost sSQL );   918           $v BlogPosts  = db_res(  $sBlogPost sSQL );
897           $s CurCategor y = '';   919           $s CurCategor y = '';
898           if  ($iCatego ryID>0) {   920           if  ($iCatego ryID>0) {
899                $sBlogCa tegSQL = "   921                $sBlogCa tegSQL = "
900                    SELE CT `BlogCa tegories`. `CategoryN ame`, `Blo gCategorie s`.`Catego ryUri`   922                    SELE CT `BlogCa tegories`. `CategoryN ame`, `Blo gCategorie s`.`Catego ryUri`
901                    FROM  `BlogCate gories`   923                    FROM  `BlogCate gories`
902                    WHER E `BlogCat egories`.` CategoryID ` = '{$iCa tegoryID}'   924                    WHER E `BlogCat egories`.` CategoryID ` = '{$iCa tegoryID}'
903                    LIMI T 1   925                    LIMI T 1
904                ";   926                ";
905                $aBlogCa teg = db_a rr($sBlogC ategSQL);   927                $aBlogCa teg = db_a rr($sBlogC ategSQL);
906                $sCurCat egory = $a BlogCateg[ 'CategoryN ame'];   928                $sCurCat egory = $a BlogCateg[ 'CategoryN ame'];
907                $sCurCat egoryURI =  $aBlogCat eg['Catego ryUri'];   929                $sCurCat egoryURI =  $aBlogCat eg['Catego ryUri'];
908           }   930           }
909     931  
910           wh ile ( $aRe sSQL = mys ql_fetch_a ssoc($vBlo gPosts) )  {   932           wh ile ( $aRe sSQL = mys ql_fetch_a ssoc($vBlo gPosts) )  {
911                if( 'fri ends' == $ aResSQL['P ostReadPer mission']  && !$this- >aBlogConf ['isFriend '] && !$th is->aBlogC onf['isOwn er'] && !$ this->bAdm inMode ) {   933                if( 'fri ends' == $ aResSQL['P ostReadPer mission']  && !$this- >aBlogConf ['isFriend '] && !$th is->aBlogC onf['isOwn er'] && !$ this->bAdm inMode ) {
912                    $sBl ogPosts .=  $this->Ge nPostStrin g($aResSQL );   934                    $sBl ogPosts .=  $this->Ge nPostStrin g($aResSQL );
913                } else {   935                } else {
914                    $sBl ogPosts .=  $this->Ge nPostStrin g($aResSQL );   936                    $sBl ogPosts .=  $this->Ge nPostStrin g($aResSQL );
915                }   937                }
916           }   938           }
917     939  
918           $s NewPost =  '';   940           $s NewPost =  '';
919           if  ($this->a BlogConf[' visitorID' ]==$aBlogs Res['Owner ID'] /*||  $this->bAd minMode==T RUE*/ ) {   941           if  ($this->a BlogConf[' visitorID' ]==$aBlogs Res['Owner ID'] /*||  $this->bAd minMode==T RUE*/ ) {
920                $sNewPos t = <<<EOF   942                $sNewPos t = <<<EOF
921   <div class ="caption_ item">   943   <div class ="caption_ item">
922       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}pos t_new.png"  class="ma rg_icon" a lt="{$sNew PostC}" /> </span>   944       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}pos t_new.png"  class="ma rg_icon" a lt="{$sNew PostC}" /> </span>
923       <a hre f="{$_SERV ER['PHP_SE LF']}?acti on=new_pos t" style=" text-trans form:none; ">{$sNewPo stC}</a>   945       <a hre f="{$_SERV ER['PHP_SE LF']}?acti on=new_pos t" style=" text-trans form:none; ">{$sNewPo stC}</a>
924   </div>   946   </div>
925   EOF;   947   EOF;
926           }   948           }
927     949  
928           $s User = get NickName($ aBlogsRes[ 'OwnerID'] );   950           $s User = get NickName($ aBlogsRes[ 'OwnerID'] );
929           $s OwnerBlogL ink = $thi s->genBlog Link('show _member_bl og_home',  array('Per malink'=>$ sUser, 'Li nk'=>$aBlo gsRes['Own erID']));   951           $s OwnerBlogL ink = $thi s->genBlog Link('show _member_bl og_home',  array('Per malink'=>$ sUser, 'Li nk'=>$aBlo gsRes['Own erID']));
930           $s AsBlog = _ t('_Member s_blog', $ sUser);   952           $s AsBlog = _ t('_Member s_blog', $ sUser);
931     953  
932           // ///////pag ination ad dition//// ////////// ////   954           // ///////pag ination ad dition//// ////////// ////
933           if  ($this->i sPermalink Enabled()= =false) {  //old vari ant   955           if  ($this->i sPermalink Enabled()= =false) {  //old vari ant
934                if( $iTo talPages >  1) {   956                if( $iTo talPages >  1) {
935                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   957                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
936                    $aFi elds = arr ay( 'actio n', 'owner Name', 'ca tegoryUri' , 'ownerID ', 'catego ry' );   958                    $aFi elds = arr ay( 'actio n', 'owner Name', 'ca tegoryUri' , 'ownerID ', 'catego ry' );
937     959  
938                    fore ach( $aFie lds as $vF ield )   960                    fore ach( $aFie lds as $vF ield )
939                         if( isset(  $_GET[$vF ield] ) )   961                         if( isset(  $_GET[$vF ield] ) )
940                             $sRequ est .= "&{ $vField}="  . htmlent ities( pro cess_pass_ data( $_GE T[$vField]  ) );   962                             $sRequ est .= "&{ $vField}="  . htmlent ities( pro cess_pass_ data( $_GE T[$vField]  ) );
941     963  
942                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':   964                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':
943                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >   965                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '&per_pa ge=\' + th is.value;" >
944                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   966                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
945                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   967                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
946                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   968                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
947                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   969                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
948                             </sele ct></div>'  .   970                             </sele ct></div>'  .
949                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );   971                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t . '&page ={page}&pe r_page='.$ iPerPage )  );
950                } else   972                } else
951                    $sPa gination =  '';   973                    $sPa gination =  '';
952           }  else {   974           }  else {
953                if( $iTo talPages >  1)   975                if( $iTo talPages >  1)
954                {   976                {
955                    $sRe quest = (i sset($_REQ UEST['cate goryUri']) ==true) ?  $sOwnerBlo gLink . '/ category/'  . $sCurCa tegoryURI  . '/' : $s OwnerBlogL ink . '/';   977                    $sRe quest = (i sset($_REQ UEST['cate goryUri']) ==true) ?  $sOwnerBlo gLink . '/ category/'  . $sCurCa tegoryURI  . '/' : $s OwnerBlogL ink . '/';
956                    //$s PaginAddon  = '';   978                    //$s PaginAddon  = '';
957                    //$s PaginAddon  = '/' . p rocess_db_ input($_GE T['catUri' ]);   979                    //$s PaginAddon  = '/' . p rocess_db_ input($_GE T['catUri' ]);
958                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );   980                    /*$a Fields = a rray( 'bCl assifiedID ', 'bSubCl assifiedID ', 'catUri ', 'scatUr i' );
959                       981                    
960                    fore ach( $aFie lds as $fi eld )   982                    fore ach( $aFie lds as $fi eld )
961                         if( isset(  $_GET[$fi eld] ) )   983                         if( isset(  $_GET[$fi eld] ) )
962                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/   984                             $sRequ est .= "&{ $field}="  . htmlenti ties( proc ess_pass_d ata( $_GET [$field] )  );*/
963                       985                    
964                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':   986                    $sPa gination =  '<div sty le="text-a lign: cent er; positi on: relati ve;">'._t( "_Results  per page") .':
965                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">   987                             <selec t name="pe r_page" on change="wi ndow.locat ion=\'' .  $sRequest  . '\' + th is.value +  \'/1'.$sP aginAddon. '\';">
966                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>   988                                 <o ption valu e="10"' .  ( $iPerPag e == 10 ?  ' selected ="selected "' : '' )  . '>10</op tion>
967                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>   989                                 <o ption valu e="20"' .  ( $iPerPag e == 20 ?  ' selected ="selected "' : '' )  . '>20</op tion>
968                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>   990                                 <o ption valu e="50"' .  ( $iPerPag e == 50 ?  ' selected ="selected "' : '' )  . '>50</op tion>
969                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>   991                                 <o ption valu e="100"' .  ( $iPerPa ge == 100  ? ' select ed="select ed"' : ''  ) . '>100< /option>
970                             </sele ct></div>'  .   992                             </sele ct></div>'  .
971                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );   993                         genPaginat ion( $iTot alPages, $ iCurPage,  ( $sReques t.$iPerPag e . '/{pag e}' . $sPa ginAddon   ) );
972                }   994                }
973                else   995                else
974                    $sPa gination =  '';   996                    $sPa gination =  '';
975           }   997           }
976           // ////////// ////////// /////   998           // ////////// ////////// /////
977     999  
    1000           $s Home = $th is->genBlo gFormUrl() ;
978           $s CurCategor y = ($sCur Category!= '')?' / '. $sCurCateg ory:'';   1001           $s CurCategor y = ($sCur Category!= '')?' / '. $sCurCateg ory:'';
979           $s BreadCrumb  = <<<EOF   1002           $s BreadCrumb  = <<<EOF
980   <a   href="{$s
OwnerBlogL ink}">{$sA sBlog}</a>   {$sCurCate gory}   -   {$sPostsC}
  1003   <a   href="{$s Home}">{$s HomeC}</a>   -   <a   href="{$s OwnerBlogL ink}">{$sA sBlog}</a>   {$sCurCate gory}   -   {$sPostsC}
981   EOF;   1004   EOF;
982     1005  
983           $s BlogPosts  .= $sPagin ation;   1006           $s BlogPosts  .= $sPagin ation;
984     1007  
985           $s PostsSect  = DesignBo xContent (  $sBreadCr umb, $sBlo gPosts, 1,  $sNewPost );   1008           $s PostsSect  = DesignBo xContent (  $sBreadCr umb, $sBlo gPosts, 1,  $sNewPost );
986     1009  
987           $s RightSect  = $this->G enMemberDe scrAndCat( $aBlogsRes ,$iCategor yID);   1010           $s RightSect  = $this->G enMemberDe scrAndCat( $aBlogsRes ,$iCategor yID);
988     1011  
989           $s RetHtml =  $this->Tem plater($sP ostsSect,  $sRightSec t);   1012           $s RetHtml =  $this->Tem plater($sP ostsSect,  $sRightSec t);
990     1013  
991           re turn $sRet Html;   1014           re turn $sRet Html;
992       }   1015       }
993     1016  
994       /**   1017       /**
995        * SQL : Updating  post by P OSTed data   1018        * SQL : Updating  post by P OSTed data
996        *   1019        *
997        * @re turn MsgBo x of resul t   1020        * @re turn MsgBo x of resul t
998        */   1021        */
999       functi on ActionE ditPost()  {   1022       functi on ActionE ditPost()  {
1000           gl obal $dir;   1023           gl obal $dir;
1001     1024  
1002           $t his->Check Logged();   1025           $t his->Check Logged();
1003     1026  
1004           $s SuccUpdPos t = _t('_S UCC_UPD_PO ST');   1027           $s SuccUpdPos t = _t('_S UCC_UPD_PO ST');
1005           $s FailUpdPos t = _t('_F AIL_UPD_AD V');   1028           $s FailUpdPos t = _t('_F AIL_UPD_AD V');
1006     1029  
1007            $iCategory ID   =   process_db _input(   (int)$_POS T['categor yID']   ) ;   1030            $iCategory ID   =  
(int)$_POS T['categor yID']
;
1008            $sPostCapt ion   =   $this-> process_ html_ db_input($ _POST['cap tion']  
);
  1031            $sPostCapt ion   =  
process_
db_input($ _POST['cap tion'] ,   1 );
1009           
$sPostUri   =   uriGenerat e($sPostCa ption,   'BlogPosts ',   'PostUri') ;
  1032            // $sPostUri   =   uriGenerat e($sPostCa ption,   'BlogPosts ',   'PostUri') ;
1010            $sPostText   =  
process_
db_input($ _POST['blo gText']   );
  1033            $sPostText   =   $this-> process_ html_ db_input($ _POST['blo gText']   );
1011            $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ]  
);
  1034            $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ] ,   1   );
1012            $readPerm   =   process_db _input(   $_POST['re adPerm']  
);
  1035            $readPerm   =   process_db _input(   $_POST['re adPerm'] ,   1   );
1013            $sTagsPerm   =   process_db _input(   $_POST['ta gs']  
);
  1036            $sTagsPerm   =   process_db _input(   $_POST['ta gs'] ,   1   );
1014           $a Tags = exp lodeTags($ sTagsPerm) ;   1037           $a Tags = exp lodeTags($ sTagsPerm) ;
1015           $s TagsPerm =  implode(" ,", $aTags );   1038           $s TagsPerm =  implode(" ,", $aTags );
1016            $iPostID   =   (int) ( $_POST['Ed itedPostID '] ) ;   1039            $iPostID   =   (int)
$_POST['Ed itedPostID ']
;
1017     1040  
1018           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`   1041           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`
1019                                 FR OM `BlogPo sts`   1042                                 FR OM `BlogPo sts`
1020                                 IN NER JOIN ` BlogCatego ries` ON ` BlogCatego ries`.`Cat egoryID`=` BlogPosts` .`Category ID`   1043                                 IN NER JOIN ` BlogCatego ries` ON ` BlogCatego ries`.`Cat egoryID`=` BlogPosts` .`Category ID`
1021                                  WHERE   `PostID`=
{$iPostID}
  1044                                  WHERE   `PostID`= ' {$iPostID} '
1022                             ";   1045                             ";
1023           $P ostID = db _arr($sChe ckPostSQL) ;   1046           $P ostID = db _arr($sChe ckPostSQL) ;
1024            $iPostOwne rID   =  
$PostID['O wnerID'];
  1047            $iPostOwne rID   =   (int) $PostID['O wnerID'];
1025           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {   1048           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {
1026                $sFileNa meExt = '' ;   1049                $sFileNa meExt = '' ;
1027                if ( 0 <  $_FILES[' BlogPic'][ 'size'] &&  0 < strle n( $_FILES ['BlogPic' ]['name']  ) ) {   1050                if ( 0 <  $_FILES[' BlogPic'][ 'size'] &&  0 < strle n( $_FILES ['BlogPic' ]['name']  ) ) {
1028                    $sPh otosSQL =  "SELECT `P ostPhoto`  FROM `Blog Posts` WHE RE `PostID ` = {$iPos tID} LIMIT  1";   1051                    $sPh otosSQL =  "SELECT `P ostPhoto`  FROM `Blog Posts` WHE RE `PostID ` = {$iPos tID} LIMIT  1";
1029                    $aFi les = db_a rr($sPhoto sSQL);   1052                    $aFi les = db_a rr($sPhoto sSQL);
1030                    $sFi leName = $ aFiles['Po stPhoto'];   1053                    $sFi leName = $ aFiles['Po stPhoto'];
1031                    if ( $sFileName =='') {   1054                    if ( $sFileName =='') {
1032                         $sFileName  = 'blog_'  . $iPostI D;   1055                         $sFileName  = 'blog_'  . $iPostI D;
1033                    }   1056                    }
1034                    $sEx t = moveUp loadedImag e( $_FILES , 'BlogPic ', $dir['b logImage']  . $sFileN ame, '', f alse );   1057                    $sEx t = moveUp loadedImag e( $_FILES , 'BlogPic ', $dir['b logImage']  . $sFileN ame, '', f alse );
1035                    if(  strlen( $s Ext ) && ! (int)$sExt  ) {   1058                    if(  strlen( $s Ext ) && ! (int)$sExt  ) {
1036                         $sFileName Ext = $sFi leName.$sE xt;   1059                         $sFileName Ext = $sFi leName.$sE xt;
1037                         imageResiz e( $dir['b logImage']  . $sFileN ame.$sExt,  $dir['blo gImage'] .  'small_'  . $sFileNa me.$sExt,  $this->iIc onSize / 2 , $this->i IconSize /  2);   1060                         imageResiz e( $dir['b logImage']  . $sFileN ame.$sExt,  $dir['blo gImage'] .  'small_'  . $sFileNa me.$sExt,  $this->iIc onSize / 2 , $this->i IconSize /  2);
1038                         imageResiz e( $dir['b logImage']  . $sFileN ame.$sExt,  $dir['blo gImage'] .  'big_' .  $sFileName .$sExt, $t his->iThum bSize, $th is->iThumb Size);   1061                         imageResiz e( $dir['b logImage']  . $sFileN ame.$sExt,  $dir['blo gImage'] .  'big_' .  $sFileName .$sExt, $t his->iThum bSize, $th is->iThumb Size);
1039     1062  
1040                         chmod( $di r['blogIma ge'] . 'sm all_' . $s FileName.$ sExt, 0644  );   1063                         chmod( $di r['blogIma ge'] . 'sm all_' . $s FileName.$ sExt, 0644  );
1041                         chmod( $di r['blogIma ge'] . 'bi g_' . $sFi leName.$sE xt, 0644 ) ;   1064                         chmod( $di r['blogIma ge'] . 'bi g_' . $sFi leName.$sE xt, 0644 ) ;
1042     1065  
1043                         @unlink( $ dir['blogI mage'] . $ sFileName  . $sExt );   1066                         @unlink( $ dir['blogI mage'] . $ sFileName  . $sExt );
1044                    }   1067                    }
1045                }   1068                }
1046                $sAutoAp provalVal  = (getPara m('blogAut oApproval' )=='on') ?  "approval " : "disap proval";   1069                $sAutoAp provalVal  = (getPara m('blogAut oApproval' )=='on') ?  "approval " : "disap proval";
1047                $sPostPi c = ($sFil eNameExt== '') ? '' :  "`PostPho to`='{$sFi leNameExt} ',";   1070                $sPostPi c = ($sFil eNameExt== '') ? '' :  "`PostPho to`='{$sFi leNameExt} ',";
1048                $sQuery  = "   1071                $sQuery  = "
1049                    UPDA TE `BlogPo sts` SET   1072                    UPDA TE `BlogPo sts` SET
1050                    `Cat egoryID`={ $iCategory ID},   1073                    `Cat egoryID`={ $iCategory ID},
1051                    `Pos tCaption`= '{$sPostCa ption}',   1074                    `Pos tCaption`= '{$sPostCa ption}',
1052                    `Pos tText`='{$ sPostText} ',   1075                    `Pos tText`='{$ sPostText} ',
1053                    `Pos tCommentPe rmission`= '{$comment Perm}',   1076                    `Pos tCommentPe rmission`= '{$comment Perm}',
1054                    `Pos tReadPermi ssion`='{$ readPerm}' ,   1077                    `Pos tReadPermi ssion`='{$ readPerm}' ,
1055                    `Tag s`='{$sTag sPerm}',   1078                    `Tag s`='{$sTag sPerm}',
1056                    {$sP ostPic}   1079                    {$sP ostPic}
1057                    `Pos tStatus`=' {$sAutoApp rovalVal}'   1080                    `Pos tStatus`=' {$sAutoApp rovalVal}'
1058                     WHERE   `PostID`=
{$iPostID}
  1081                     WHERE   `PostID`= ' {$iPostID} '
1059                ";   1082                ";
1060     1083  
1061                $vSqlRes  = db_res(  $sQuery ) ;   1084                $vSqlRes  = db_res(  $sQuery ) ;
1062                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd Post) : _t ($sFailUpd Post);   1085                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd Post) : _t ($sFailUpd Post);
1063                reparseO bjTags( 'b log', $iPo stID );   1086                reparseO bjTags( 'b log', $iPo stID );
1064                return M sgBox($sRe t);   1087                return M sgBox($sRe t);
1065           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {   1088           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {
1066                return M sgBox(_t(' _Hacker St ring'));   1089                return M sgBox(_t(' _Hacker St ring'));
1067           }  else {   1090           }  else {
1068                return M sgBox(_t(' _Error Occ ured'));   1091                return M sgBox(_t(' _Error Occ ured'));
1069           }   1092           }
1070       }   1093       }
1071     1094  
1072       functi on ActionD elImg() {   1095       functi on ActionD elImg() {
1073           gl obal $dir;   1096           gl obal $dir;
1074     1097  
1075           $t his->Check Logged();   1098           $t his->Check Logged();
1076     1099  
1077           $s SuccUpdPos t = _t('_S UCC_UPD_PO ST');   1100           $s SuccUpdPos t = _t('_S UCC_UPD_PO ST');
1078           $s FailUpdPos t = _t('_F AIL_UPD_AD V');   1101           $s FailUpdPos t = _t('_F AIL_UPD_AD V');
1079     1102  
1080            $iPostID   =   (int) ( $_REQUEST[ 'post_id'] ) ;   1103            $iPostID   =   (int)
$_REQUEST[ 'post_id']
;
1081     1104  
1082           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`   1105           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`
1083                                 FR OM `BlogPo sts`   1106                                 FR OM `BlogPo sts`
1084                                  L E FT   JOIN   `BlogCateg ories`   ON   `BlogCateg ories`.`Ca tegoryID`= `BlogPosts `.`Categor yID`   1107                                  INN E R   JOIN   `BlogCateg ories`   ON   `BlogCateg ories`.`Ca tegoryID`= `BlogPosts `.`Categor yID`
1085                                  WHERE   `PostID`=
{$iPostID}
  1108                                  WHERE   `PostID`= ' {$iPostID} '
1086                             ";   1109                             ";
1087           $P ostID = db _arr($sChe ckPostSQL) ;   1110           $P ostID = db _arr($sChe ckPostSQL) ;
1088           $i PostOwnerI D = $PostI D['OwnerID '];   1111           $i PostOwnerI D = $PostI D['OwnerID '];
1089     1112  
1090           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {   1113           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {
1091                $sFileNa meExt = '' ;   1114                $sFileNa meExt = '' ;
1092                $sPhotos SQL = "SEL ECT `PostP hoto` FROM  `BlogPost s` WHERE ` PostID` =  {$iPostID}  LIMIT 1";   1115                $sPhotos SQL = "SEL ECT `PostP hoto` FROM  `BlogPost s` WHERE ` PostID` =  {$iPostID}  LIMIT 1";
1093                $aFiles  = db_arr($ sPhotosSQL );   1116                $aFiles  = db_arr($ sPhotosSQL );
1094                $sFileNa me = $aFil es['PostPh oto'];   1117                $sFileNa me = $aFil es['PostPh oto'];
1095                if ($sFi leName=='' ) {   1118                if ($sFi leName=='' ) {
1096                    $sFi leName = ' blog_' . $ iPostID;   1119                    $sFi leName = ' blog_' . $ iPostID;
1097                }   1120                }
1098                $sDFileP ath = "{$d ir['blogIm age']}smal l_{$sFileN ame}";   1121                $sDFileP ath = "{$d ir['blogIm age']}smal l_{$sFileN ame}";
1099                @unlink(  $sDFilePa th );   1122                @unlink(  $sDFilePa th );
1100                $sDFileP ath = "{$d ir['blogIm age']}big_ {$sFileNam e}";   1123                $sDFileP ath = "{$d ir['blogIm age']}big_ {$sFileNam e}";
1101                @unlink(  $sDFilePa th );   1124                @unlink(  $sDFilePa th );
1102     1125  
1103                $sQuery  = "   1126                $sQuery  = "
1104                    UPDA TE `BlogPo sts` SET   1127                    UPDA TE `BlogPo sts` SET
1105                    `Pos tPhoto`=''   1128                    `Pos tPhoto`=''
1106                     WHERE   `PostID`=
{$iPostID}
  1129                     WHERE   `PostID`= ' {$iPostID} '
1107                ";   1130                ";
1108     1131  
1109                $vSqlRes  = db_res(  $sQuery ) ;   1132                $vSqlRes  = db_res(  $sQuery ) ;
1110                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd Post) : _t ($sFailUpd Post);   1133                $sRet =  (mysql_aff ected_rows ()>0) ? _t ($sSuccUpd Post) : _t ($sFailUpd Post);
1111                return M sgBox($sRe t);   1134                return M sgBox($sRe t);
1112           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {   1135           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {
1113                return M sgBox(_t(' _Hacker St ring'));   1136                return M sgBox(_t(' _Hacker St ring'));
1114           }  else {   1137           }  else {
1115                return M sgBox(_t(' _Error Occ ured'));   1138                return M sgBox(_t(' _Error Occ ured'));
1116           }   1139           }
1117       }   1140       }
1118     1141  
1119       /**   1142       /**
1120        * SQL : Delete p ost by POS Ted data   1143        * SQL : Delete p ost by POS Ted data
1121        *   1144        *
1122        * @re turn MsgBo x of resul t   1145        * @re turn MsgBo x of resul t
1123        */   1146        */
1124       functi on ActionD eletePost( ) {   1147       functi on ActionD eletePost( ) {
1125           $t his->Check Logged();   1148           $t his->Check Logged();
1126     1149  
1127            $iPostID   =   (int) ( $_POST['De letePostID '] ) ;   1150            $iPostID   =   (int)
$_POST['De letePostID ']
;
1128     1151  
1129           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`   1152           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`
1130                                 FR OM `BlogPo sts`   1153                                 FR OM `BlogPo sts`
1131                                 LE FT JOIN `B logCategor ies` ON `B logCategor ies`.`Cate goryID`=`B logPosts`. `CategoryI D`   1154                                 LE FT JOIN `B logCategor ies` ON `B logCategor ies`.`Cate goryID`=`B logPosts`. `CategoryI D`
1132                                  WHERE   `PostID`=
{$iPostID}
  1155                                  WHERE   `PostID`= ' {$iPostID} '
1133                             ";   1156                             ";
1134           $P ostID = db _arr($sChe ckPostSQL) ;   1157           $P ostID = db _arr($sChe ckPostSQL) ;
1135            $iPostOwne rID   =  
$PostID['O wnerID'];
  1158            $iPostOwne rID   =   (int) $PostID['O wnerID'];
1136           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {   1159           if  (($this-> aBlogConf[ 'visitorID '] == $iPo stOwnerID  || $this-> bAdminMode ) && $iPos tID > 0) {
1137     1160  
1138                $oCmts =  new BxDol Cmts ('blo gposts', ( int)$iPost ID);   1161                $oCmts =  new BxDol Cmts ('blo gposts', ( int)$iPost ID);
1139                $oCmts-> onObjectDe lete ();   1162                $oCmts-> onObjectDe lete ();
1140     1163  
1141                $sQuery  = "DELETE  FROM `Blog Posts` WHE RE `BlogPo sts`.`Post ID` = {$iP ostID} LIM IT 1";   1164                $sQuery  = "DELETE  FROM `Blog Posts` WHE RE `BlogPo sts`.`Post ID` = {$iP ostID} LIM IT 1";
1142                $vSqlRes  = db_res(  $sQuery ) ;   1165                $vSqlRes  = db_res(  $sQuery ) ;
1143                $sRet =  (mysql_aff ected_rows ()>0) ? _t ('_post_su ccessfully _deleted')  : _t('_fa iled_to_de lete_post' );   1166                $sRet =  (mysql_aff ected_rows ()>0) ? _t ('_post_su ccessfully _deleted')  : _t('_fa iled_to_de lete_post' );
1144                reparseO bjTags( 'b log', $iPo stID );   1167                reparseO bjTags( 'b log', $iPo stID );
1145                return M sgBox($sRe t);   1168                return M sgBox($sRe t);
1146           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {   1169           }  elseif($th is->aBlogC onf['visit orID'] !=  $iPostOwne rID) {
1147                return M sgBox(_t(' _Hacker St ring'));   1170                return M sgBox(_t(' _Hacker St ring'));
1148           }  else {   1171           }  else {
1149                return M sgBox(_t(' _Error Occ ured'));   1172                return M sgBox(_t(' _Error Occ ured'));
1150           }   1173           }
1151       }   1174       }
1152     1175  
1153       /**   1176       /**
1154        * Gen erate User `s Blog Po st Page   1177        * Gen erate User `s Blog Po st Page
1155        *   1178        *
1156        * @re turn HTML  presentati on of data   1179        * @re turn HTML  presentati on of data
1157        */   1180        */
1158       functi on GenPost Page() {   1181       functi on GenPost Page() {
1159           gl obal $site ;   1182           gl obal $site ;
1160           gl obal $aBre adCramp;   1183           gl obal $aBre adCramp;
1161     1184  
1162           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   1185           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
1163           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);   1186           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);
1164           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   1187           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
1165     1188  
1166           $i PostID = - 1;   1189           $i PostID = - 1;
1167           if  (isset($_ REQUEST['p ostUri']))  {   1190           if  (isset($_ REQUEST['p ostUri']))  {
1168                 $sPostUri   =   process_db _input($_R EQUEST['po stUri']
);
  1191                 $sPostUri   =   process_db _input($_R EQUEST['po stUri'] ,   1 );
1169                $sqlQuer y = "SELEC T `PostID`  FROM `Blo gPosts` WH ERE `PostU ri`='{$sPo stUri}'";   1192                $sqlQuer y = "SELEC T `PostID`  FROM `Blo gPosts` WH ERE `PostU ri`='{$sPo stUri}'";
1170                $iPostID  = (int)db _value($sq lQuery);   1193                $iPostID  = (int)db _value($sq lQuery);
1171           }  elseif (is set($_REQU EST['post_ id'])) {   1194           }  elseif (is set($_REQU EST['post_ id'])) {
1172                $iPostID  = (int)$_ REQUEST['p ost_id'];   1195                $iPostID  = (int)$_ REQUEST['p ost_id'];
1173           }   1196           }
1174     1197  
1175           if  ($iPostID  == -1) {   1198           if  ($iPostID  == -1) {
1176                return M sgBox(_t(' _Sorry, no thing foun d'));   1199                return M sgBox(_t(' _Sorry, no thing foun d'));
1177           }   1200           }
1178     1201  
1179           if  ($this->i LastPosted PostID>0)  {   1202           if  ($this->i LastPosted PostID>0)  {
1180                $iPostID  = $this-> iLastPoste dPostID;   1203                $iPostID  = $this-> iLastPoste dPostID;
1181                $this->i LastPosted PostID = - 1;   1204                $this->i LastPosted PostID = - 1;
1182           }   1205           }
1183     1206  
1184           $s CategoryC  = _t( '_Ca tegory' );   1207           $s CategoryC  = _t( '_Ca tegory' );
1185           $s PostC = _t ( '_Post'  );   1208           $s PostC = _t ( '_Post'  );
1186           $s EditC = _t ('_Edit');   1209           $s EditC = _t ('_Edit');
1187           $s DeleteC =  _t('_Delet e');   1210           $s DeleteC =  _t('_Delet e');
1188     1211  
1189           $s RetHtml =  '';   1212           $s RetHtml =  '';
1190     1213  
1191           $s PostedBySQ L = "   1214           $s PostedBySQ L = "
1192                SELECT ` BlogCatego ries`.`Own erID` FROM  `BlogCate gories`   1215                SELECT ` BlogCatego ries`.`Own erID` FROM  `BlogCate gories`
1193                INNER JO IN `BlogPo sts` ON `B logCategor ies`.`Cate goryID`=`B logPosts`. `CategoryI D`   1216                INNER JO IN `BlogPo sts` ON `B logCategor ies`.`Cate goryID`=`B logPosts`. `CategoryI D`
1194                WHERE `B logPosts`. `PostID` =  {$iPostID }   1217                WHERE `B logPosts`. `PostID` =  {$iPostID }
1195                LIMIT 1   1218                LIMIT 1
1196           ";   1219           ";
1197           $a PostBy = d b_arr($sPo stedBySQL) ;   1220           $a PostBy = d b_arr($sPo stedBySQL) ;
1198     1221  
1199           if  (!$aPostB y) {   1222           if  (!$aPostB y) {
1200                return M sgBox(_t(' _No such b log post') );   1223                return M sgBox(_t(' _No such b log post') );
1201           }   1224           }
1202     1225  
1203           $s BlogsSQL =  "   1226           $s BlogsSQL =  "
1204                SELECT ` Blogs`. *  , `Profile s`.`Nickna me`    1227                SELECT ` Blogs`. *  , `Profile s`.`Nickna me` 
1205                FROM `Bl ogs`    1228                FROM `Bl ogs` 
1206                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`   1229                INNER JO IN `Profil es` ON `Bl ogs`.`Owne rID` = `Pr ofiles`.`I D`
1207                WHERE `B logs`.`Own erID` = {$ aPostBy['O wnerID']}   1230                WHERE `B logs`.`Own erID` = {$ aPostBy['O wnerID']}
1208                LIMIT 1   1231                LIMIT 1
1209           ";   1232           ";
1210           $a BlogInfo =  db_arr($s BlogsSQL);   1233           $a BlogInfo =  db_arr($s BlogsSQL);
1211     1234  
1212           if  (!$aBlogI nfo) {   1235           if  (!$aBlogI nfo) {
1213                return M sgBox(_t(' _Sorry, no thing foun d'));   1236                return M sgBox(_t(' _Sorry, no thing foun d'));
1214           }   1237           }
1215     1238  
1216           $s OwnerAddAp  = ($aPost By['OwnerI D'] == $th is->aBlogC onf['visit orID']) ?  '' : "AND  `PostStatu s`='approv al'";   1239           $s OwnerAddAp  = ($aPost By['OwnerI D'] == $th is->aBlogC onf['visit orID']) ?  '' : "AND  `PostStatu s`='approv al'";
1217     1240  
1218           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;   1241           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;
1219     1242  
1220           $s BlogPostSQ L = "   1243           $s BlogPostSQ L = "
1221                     SELECT   `BlogPosts `.*,   COUNT(`cmt _id`)   AS   `CountComm ents`,   `BlogCateg ories`.`Ow nerID`,`Bl ogCategori es`.`Categ oryName`,` BlogCatego ries`.`Cat egoryUri`
  1244                     SELECT   `BlogPosts `.*,   COUNT(`cmt _id`)   AS   `CountComm ents`,   `BlogCateg ories`.`Ow nerID`,`Bl ogCategori es`.`Categ oryName`,` BlogCatego ries`.`Cat egoryUri` ,
    1245                    UNIX _TIMESTAMP ( `BlogPos ts`.`PostD ate` ) AS  `PostDate_ UTS`
1222                    FROM  `BlogPost s`   1246                    FROM  `BlogPost s`
1223                    LEFT  JOIN `" .  $oCmts->g etComments TableName( ) . "` AS  `tc` ON `B logPosts`. `PostID`=` tc`.`cmt_o bject_id`   1247                    LEFT  JOIN `" .  $oCmts->g etComments TableName( ) . "` AS  `tc` ON `B logPosts`. `PostID`=` tc`.`cmt_o bject_id`
1224                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID`=`Bl ogPosts`.` CategoryID `   1248                    INNE R JOIN `Bl ogCategori es` ON `Bl ogCategori es`.`Categ oryID`=`Bl ogPosts`.` CategoryID `
1225                    WHER E `BlogPos ts`.`PostI D` = {$iPo stID} {$sO wnerAddAp}   1249                    WHER E `BlogPos ts`.`PostI D` = {$iPo stID} {$sO wnerAddAp}
1226                    GROU P BY `Blog Posts`.`Po stID`   1250                    GROU P BY `Blog Posts`.`Po stID`
1227           ";  //ORDER B Y `CountCo mments` DE SC, `PostD ate` DESC   1251           ";  //ORDER B Y `CountCo mments` DE SC, `PostD ate` DESC
1228     1252  
1229           $a BlogPost =  db_arr( $ sBlogPostS QL );   1253           $a BlogPost =  db_arr( $ sBlogPostS QL );
1230     1254  
1231           if  (!$aBlogP ost) {   1255           if  (!$aBlogP ost) {
1232                return M sgBox(_t(' _Sorry, no thing foun d'));   1256                return M sgBox(_t(' _Sorry, no thing foun d'));
1233           }   1257           }
1234     1258  
1235           if ( 'friends ' == $aBlo gPost['Pos tReadPermi ssion'] &&  !$this->a BlogConf[' isFriend']  && !$this ->aBlogCon f['isOwner '] && !$th is->bAdmin Mode ) {   1259           if ( 'friends ' == $aBlo gPost['Pos tReadPermi ssion'] &&  !$this->a BlogConf[' isFriend']  && !$this ->aBlogCon f['isOwner '] && !$th is->bAdmin Mode ) {
1236                $sFriend sC .= MsgB ox(_t('_th is_blog_on ly_for_fri ends'));   1260                $sFriend sC .= MsgB ox(_t('_th is_blog_on ly_for_fri ends'));
1237                $sRightS ection = $ this->GenM emberDescr AndCat($aB logInfo);   1261                $sRightS ection = $ this->GenM emberDescr AndCat($aB logInfo);
1238     1262  
1239                $sPostsS ectDB = De signBoxCon tent($sPos tC, $sFrie ndsC);   1263                $sPostsS ectDB = De signBoxCon tent($sPos tC, $sFrie ndsC);
1240                $sPostsS ect = <<<E OF   1264                $sPostsS ect = <<<E OF
1241   <div>   1265   <div>
1242       {$sPos tsSectDB}   1266       {$sPos tsSectDB}
1243   </div>   1267   </div>
1244   <div class ="clear_bo th"></div>   1268   <div class ="clear_bo th"></div>
1245   EOF;   1269   EOF;
1246     1270  
1247                $sRetHtm l .= $this ->Template r($sPostsS ect, $sRig htSection,  1);   1271                $sRetHtm l .= $this ->Template r($sPostsS ect, $sRig htSection,  1);
1248           }  else {   1272           }  else {
1249                $this->o CmtsView =  new BxTem plCmtsView  ('blogpos ts', (int) $iPostID);   1273                $this->o CmtsView =  new BxTem plCmtsView  ('blogpos ts', (int) $iPostID);
1250     1274  
1251                $sPostCo mm = $this ->oCmtsVie w->getExtr aCss();   1275                $sPostCo mm = $this ->oCmtsVie w->getExtr aCss();
1252                $sPostCo mm .= $thi s->oCmtsVi ew->getExt raJs();   1276                $sPostCo mm .= $thi s->oCmtsVi ew->getExt raJs();
1253                $sPostCo mm .= (!$t his->oCmts View->isEn abled()) ?  '' : $thi s->oCmtsVi ew->getCom mentsFirst ();   1277                $sPostCo mm .= (!$t his->oCmts View->isEn abled()) ?  '' : $thi s->oCmtsVi ew->getCom mentsFirst ();
1254                $sPostCo mm = Desig nBoxConten t (_t('_Co mments'),  $sPostComm , 1);   1278                $sPostCo mm = Desig nBoxConten t (_t('_Co mments'),  $sPostComm , 1);
1255     1279  
1256                $sPostSt ring = $th is->GenPos tString($a BlogPost,3 );   1280                $sPostSt ring = $th is->GenPos tString($a BlogPost,3 );
1257                $sRightS ection = $ this->GenM emberDescr AndCat($aB logInfo);   1281                $sRightS ection = $ this->GenM emberDescr AndCat($aB logInfo);
1258     1282  
1259                $sUser =  getNickNa me($aBlogP ost['Owner ID']);   1283                $sUser =  getNickNa me($aBlogP ost['Owner ID']);
1260                $sOwnerC atLink = $ this->genB logLink('s how_member _blog', ar ray('Perma link'=>$sU ser, 'Link '=>$aBlogP ost['Owner ID']), arr ay('Permal ink'=>$aBl ogPost['Ca tegoryUri' ],'Link'=> $aBlogPost ['Category ID']));   1284                $sOwnerC atLink = $ this->genB logLink('s how_member _blog', ar ray('Perma link'=>$sU ser, 'Link '=>$aBlogP ost['Owner ID']), arr ay('Permal ink'=>$aBl ogPost['Ca tegoryUri' ],'Link'=> $aBlogPost ['Category ID']));
1261     1285  
1262                $sOwnerB logLink =  $this->gen BlogLink(' show_membe r_blog_hom e', array( 'Permalink '=>$sUser,  'Link'=>$ aBlogPost[ 'OwnerID'] ));   1286                $sOwnerB logLink =  $this->gen BlogLink(' show_membe r_blog_hom e', array( 'Permalink '=>$sUser,  'Link'=>$ aBlogPost[ 'OwnerID'] ));
1263                $sAsBlog  = _t('_Me mbers_blog ', $sUser) ;   1287                $sAsBlog  = _t('_Me mbers_blog ', $sUser) ;
    1288                $sCatego ryName = h tmlspecial chars($aBl ogPost['Ca tegoryName ']);
    1289                $sPostCa ption = ht mlspecialc hars($aBlo gPost['Pos tCaption'] );
1264                $sBreadC rumb = <<< EOF   1290                $sBreadC rumb = <<< EOF
1265   <a href="{ $sOwnerBlo gLink}">{$ sAsBlog}</ a> /    1291   <a href="{ $sOwnerBlo gLink}">{$ sAsBlog}</ a> / 
1266   <a   href="{$sO wnerCatLin k}">{$ aBlogPo s t[' CategoryNa me '] }</a>   /     1292   <a   href="{$sO wnerCatLin k}">{$
s
CategoryNa me
}</a>   /  
1267   {$ aBlogPo s t[' PostCaptio n '] }   1293   {$
s
PostCaptio n
}
1268   EOF;   1294   EOF;
1269     1295  
1270                $sPostsS ectDB = De signBoxCon tent($sBre adCrumb, $ sPostStrin g, 1);   1296                $sPostsS ectDB = De signBoxCon tent($sBre adCrumb, $ sPostStrin g, 1);
1271                $sPostsS ect = <<<E OF   1297                $sPostsS ect = <<<E OF
1272   <div>   1298   <div>
1273       {$sPos tsSectDB}   1299       {$sPos tsSectDB}
1274   </div>   1300   </div>
1275   <div class ="clear_bo th"></div>   1301   <div class ="clear_bo th"></div>
1276   <div>   1302   <div>
1277       {$sPos tComm}   1303       {$sPos tComm}
1278   </div>   1304   </div>
1279   EOF;   1305   EOF;
1280     1306  
1281                $sRetHtm l = $this- >Templater ($sPostsSe ct, $sRigh tSection);   1307                $sRetHtm l = $this- >Templater ($sPostsSe ct, $sRigh tSection);
1282           }   1308           }
1283     1309  
1284           re turn $sRet Html;   1310           re turn $sRet Html;
1285       }   1311       }
1286     1312  
1287       /**   1313       /**
1288        * Gen erate Form  for NewPo st/EditPos t   1314        * Gen erate Form  for NewPo st/EditPos t
1289        *   1315        *
1290        * @pa ram $iPost ID - Post  ID   1316        * @pa ram $iPost ID - Post  ID
1291        * @pa ram $arrEr r - Array  for PHP va lidating   1317        * @pa ram $arrEr r - Array  for PHP va lidating
1292        * @re turn HTML  presentati on of data   1318        * @re turn HTML  presentati on of data
1293        */   1319        */
1294       functi on AddNewP ostForm($i PostID=0,  $arrErr =  NULL) {   1320       functi on AddNewP ostForm($i PostID=0,  $arrErr =  NULL) {
1295           gl obal $site ;   1321           gl obal $site ;
1296     1322  
1297           $t his->Check Logged();   1323           $t his->Check Logged();
1298     1324  
1299           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   1325           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
1300           $s RestrictRe s = $this- >CheckRest rictionToU se($iCheck edMemberID );   1326           $s RestrictRe s = $this- >CheckRest rictionToU se($iCheck edMemberID );
1301           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   1327           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
1302     1328  
1303           $s PostCaptio nC = _t('_ Post') . '  ' . _t('_ Caption');   1329           $s PostCaptio nC = _t('_ Post') . '  ' . _t('_ Caption');
1304           $s Characters LeftC = _t ('_charact ers_left') ;   1330           $s Characters LeftC = _t ('_charact ers_left') ;
1305           $s PostTextC  = _t('_Pos t') . ' '  . _t('_Tex t');   1331           $s PostTextC  = _t('_Pos t') . ' '  . _t('_Tex t');
1306           $s PleaseSele ctC = _t(' _please_se lect');   1332           $s PleaseSele ctC = _t(' _please_se lect');
1307           $s Associated ImageC = _ t('_associ ated_image ');   1333           $s Associated ImageC = _ t('_associ ated_image ');
1308           $s PostCommen tPerC = _t ('_post_co mment_per' );   1334           $s PostCommen tPerC = _t ('_post_co mment_per' );
1309           $s PublicC =  _t('_publi c');   1335           $s PublicC =  _t('_publi c');
1310           $s FriendsOnl yC = _t('_ friends on ly');   1336           $s FriendsOnl yC = _t('_ friends on ly');
1311           $s PostReadPe rC = _t('_ post_read_ per');   1337           $s PostReadPe rC = _t('_ post_read_ per');
1312           $s AddBlogC =  _t('_Add  Post');   1338           $s AddBlogC =  _t('_Add  Post');
1313           $s CommitC =  _t('_Apply  Changes') ;   1339           $s CommitC =  _t('_Apply  Changes') ;
1314           $s TagsC = _t ('_Tags');   1340           $s TagsC = _t ('_Tags');
1315           $s NewPostC =  _t('_New  Post');   1341           $s NewPostC =  _t('_New  Post');
1316           $s DelImgC =  _t('_Delet e image');   1342           $s DelImgC =  _t('_Delet e image');
1317     1343  
1318           if  ($this->b AdminMode= =false) {   1344           if  ($this->b AdminMode= =false) {
1319                $sBlogsS QL = "   1345                $sBlogsS QL = "
1320                    SELE CT `Blogs` . *   1346                    SELE CT `Blogs` . *
1321                    FROM  `Blogs`    1347                    FROM  `Blogs` 
1322                    WHER E `Blogs`. `OwnerID`  = {$this-> aBlogConf[ 'visitorID ']}   1348                    WHER E `Blogs`. `OwnerID`  = {$this-> aBlogConf[ 'visitorID ']}
1323                    LIMI T 1   1349                    LIMI T 1
1324                ";   1350                ";
1325                $aBlogsR es = db_ar r( $sBlogs SQL );   1351                $aBlogsR es = db_ar r( $sBlogs SQL );
1326                if (!$aB logsRes) {   1352                if (!$aB logsRes) {
1327                    retu rn $this-> GenCreateB logForm();   1353                    retu rn $this-> GenCreateB logForm();
1328                }   1354                }
1329           }   1355           }
1330     1356  
1331           $s RetHtml =  '';   1357           $s RetHtml =  '';
1332     1358  
1333           $s CATIDstyle  = ($arrEr r['Categor yID'] ? 'b lock' : 'n one');   1359           $s CATIDstyle  = ($arrEr r['Categor yID'] ? 'b lock' : 'n one');
1334           $s CPTstyle =  ($arrErr[ 'Caption']  ? 'block'  : 'none') ;   1360           $s CPTstyle =  ($arrErr[ 'Caption']  ? 'block'  : 'none') ;
1335           $s PTstyle =  ($arrErr[' PostText']  ? 'block'  : 'none') ;   1361           $s PTstyle =  ($arrErr[' PostText']  ? 'block'  : 'none') ;
1336           $s CPstyle =  ($arrErr[' CommentPer m'] ? 'blo ck' : 'non e');   1362           $s CPstyle =  ($arrErr[' CommentPer m'] ? 'blo ck' : 'non e');
1337           $s RPstyle =  ($arrErr[' ReadPerm']  ? 'block'  : 'none') ;   1363           $s RPstyle =  ($arrErr[' ReadPerm']  ? 'block'  : 'none') ;
1338     1364  
1339           $s CATIDmsg =  ($arrErr[ 'CategoryI D'] ? _t(  '_'.$arrEr r['Categor yID'] ) :  '' );   1365           $s CATIDmsg =  ($arrErr[ 'CategoryI D'] ? _t(  '_'.$arrEr r['Categor yID'] ) :  '' );
1340           $s CPTmsg = ( $arrErr['C aption'] ?  _t( '_'.$ arrErr['Ca ption'] )  : '' );   1366           $s CPTmsg = ( $arrErr['C aption'] ?  _t( '_'.$ arrErr['Ca ption'] )  : '' );
1341           $s PTmsg = ($ arrErr['Po stText'] ?  _t( '_'.$ arrErr['Po stText'] )  : '' );   1367           $s PTmsg = ($ arrErr['Po stText'] ?  _t( '_'.$ arrErr['Po stText'] )  : '' );
1342           $s CPmsg = ($ arrErr['Co mmentPerm' ] ? _t( '_ '.$arrErr[ 'CommentPe rm'] ) : ' ' );   1368           $s CPmsg = ($ arrErr['Co mmentPerm' ] ? _t( '_ '.$arrErr[ 'CommentPe rm'] ) : ' ' );
1343           $s RPmsg = ($ arrErr['Re adPerm'] ?  _t( '_'.$ arrErr['Re adPerm'] )  : '' );   1369           $s RPmsg = ($ arrErr['Re adPerm'] ?  _t( '_'.$ arrErr['Re adPerm'] )  : '' );
1344     1370  
1345           $s PostCaptio n = '';   1371           $s PostCaptio n = '';
1346           $s PostText =  '';   1372           $s PostText =  '';
1347           $s PostImage  = '';   1373           $s PostImage  = '';
1348           $s PostTags =  '';   1374           $s PostTags =  '';
1349           $s CheckedCom mPermP = ' checked ';   1375           $s CheckedCom mPermP = ' checked ';
1350           $s CheckedRea dPostPermP  = 'checke d ';   1376           $s CheckedRea dPostPermP  = 'checke d ';
1351           $s CheckedCom mPermF = ' ';   1377           $s CheckedCom mPermF = ' ';
1352           $s CheckedRea dPostPermF  = '';   1378           $s CheckedRea dPostPermF  = '';
1353           $s PostPictur e = '';   1379           $s PostPictur e = '';
1354           $s PostPictur eTag = '';   1380           $s PostPictur eTag = '';
1355           $s PostAction  = 'add_po st';   1381           $s PostAction  = 'add_po st';
1356           $i SavedCateg oryID = -1 ;   1382           $i SavedCateg oryID = -1 ;
1357     1383  
1358           if  ($iPostID >0) {   1384           if  ($iPostID >0) {
1359                $sBlogPo stsSQL = " SELECT * F ROM `BlogP osts` WHER E `PostID`  = {$iPost ID} LIMIT  1";   1385                $sBlogPo stsSQL = " SELECT * F ROM `BlogP osts` WHER E `PostID`  = {$iPost ID} LIMIT  1";
1360                $aBlogPo st = db_ar r( $sBlogP ostsSQL );   1386                $aBlogPo st = db_ar r( $sBlogP ostsSQL );
1361                 $sPostCapt ion   =  
$aBlogPost ['PostCapt ion']
;
  1387                 $sPostCapt ion   =   htmlspecia lchars( $aBlogPost ['PostCapt ion'] ) ;
1362                $sPostTe xt = $aBlo gPost['Pos tText'];   1388                $sPostTe xt = $aBlo gPost['Pos tText'];
1363                $sPostIm age = $aBl ogPost['Po stPhoto'];   1389                $sPostIm age = $aBl ogPost['Po stPhoto'];
1364                $sPostTa gs = $aBlo gPost['Tag s'];   1390                $sPostTa gs = $aBlo gPost['Tag s'];
1365                $sPostPi cture = $a BlogPost[' PostPhoto' ];   1391                $sPostPi cture = $a BlogPost[' PostPhoto' ];
1366                $sSpacer Name = $si te['url']. $this -> s SpacerPath ;   1392                $sSpacer Name = $si te['url']. $this -> s SpacerPath ;
1367                if ($sPo stImage !=  '') {   1393                if ($sPo stImage !=  '') {
1368                    $sPo stPictureT ag = '<div  class="ma rg_both_le ft"><img a lt="" styl e="width:  110px; hei ght: 110px ; backgrou nd-image:  url('.$sit e['blogIma ge'].'big_ '.$sPostIm age.');" s rc="'.$sSp acerName.' "/></div>' ;   1394                    $sPo stPictureT ag = '<div  class="ma rg_both_le ft"><img a lt="" styl e="width:  110px; hei ght: 110px ; backgrou nd-image:  url('.$sit e['blogIma ge'].'big_ '.$sPostIm age.');" s rc="'.$sSp acerName.' "/></div>' ;
1369                    $sPo stPictureT ag .= <<<E OF   1395                    $sPo stPictureT ag .= <<<E OF
1370   <a href="{ $_SERVER[' PHP_SELF'] }?action=d el_img&amp ;post_id={ $iPostID}" >{$sDelImg C}</a>   1396   <a href="{ $_SERVER[' PHP_SELF'] }?action=d el_img&amp ;post_id={ $iPostID}" >{$sDelImg C}</a>
1371   EOF;   1397   EOF;
1372     1398  
1373                }   1399                }
1374                $sChecke dCommPerm  = $aBlogPo st['PostCo mmentPermi ssion'];   1400                $sChecke dCommPerm  = $aBlogPo st['PostCo mmentPermi ssion'];
1375                $sChecke dReadPostP erm = $aBl ogPost['Po stReadPerm ission'];   1401                $sChecke dReadPostP erm = $aBl ogPost['Po stReadPerm ission'];
1376                if ($sCh eckedCommP erm=='publ ic')   1402                if ($sCh eckedCommP erm=='publ ic')
1377                    $sCh eckedCommP ermP = 'ch ecked ';   1403                    $sCh eckedCommP ermP = 'ch ecked ';
1378                else   1404                else
1379                    $sCh eckedCommP ermF = 'ch ecked ';   1405                    $sCh eckedCommP ermF = 'ch ecked ';
1380                if ($sCh eckedReadP ostPerm==' public')   1406                if ($sCh eckedReadP ostPerm==' public')
1381                    $sCh eckedReadP ostPermP =  'checked  ';   1407                    $sCh eckedReadP ostPermP =  'checked  ';
1382                else   1408                else
1383                    $sCh eckedReadP ostPermF =  'checked  ';   1409                    $sCh eckedReadP ostPermF =  'checked  ';
1384     1410  
1385                $sAddBlo gC = $sCom mitC;   1411                $sAddBlo gC = $sCom mitC;
1386                $sPostAc tion = 'po st_updated ';   1412                $sPostAc tion = 'po st_updated ';
1387                $sEditId Str = '<in put type=" hidden" na me="Edited PostID" va lue="'.$iP ostID.'" / >';   1413                $sEditId Str = '<in put type=" hidden" na me="Edited PostID" va lue="'.$iP ostID.'" / >';
1388           }  else {   1414           }  else {
1389                 $iSavedCat egoryID   =   process_db _input(   (int)$_ PO ST['catego ryID']   ) ;   1415                 $iSavedCat egoryID   =  
(int)$_ REQUE ST['catego ryID']
;
1390     1416  
1391                 $sPostCapt ion   =   process_db _input(   $_ PO ST['captio n']  
);
  1417                 $sPostCapt ion   =   process_db _input(   $_ REQUE ST['captio n'] ,   1   );
1392                 $sPostText   =  
process_
db_input(   $_ PO ST['blogTe xt']   );
  1418                 $sPostText   =   $this-> process_ html_ db_input(   $_ REQUE ST['blogTe xt']   );
1393                $sPostIm age = '';   1419                $sPostIm age = '';
1394                 $sPostTags   =   process_db _input(   $_ PO ST['tags']  
);
  1420                 $sPostTags   =   process_db _input(   $_ REQUE ST['tags'] ,   1   );
1395                 if   (isset($_P OST['comme ntPerm'])   &&   isset($_ PO ST['readPe rm']))   {   1421                 if   (isset($_P OST['comme ntPerm'])   &&   isset($_ REQUE ST['readPe rm']))   {
1396                    if ( process_db _input($_P OST['comme ntPerm'])= ='public')  {   1422                    if ( process_db _input($_P OST['comme ntPerm'])= ='public')  {
1397                         $sCheckedC ommPermP =  'checked  ';   1423                         $sCheckedC ommPermP =  'checked  ';
1398                    } el se {   1424                    } el se {
1399                         $sCheckedC ommPermF =  'checked  ';   1425                         $sCheckedC ommPermF =  'checked  ';
1400                    }   1426                    }
1401                    if ( process_db _input($_P OST['readP erm'])=='p ublic') {   1427                    if ( process_db _input($_P OST['readP erm'])=='p ublic') {
1402                         $sCheckedR eadPostPer mP = 'chec ked ';   1428                         $sCheckedR eadPostPer mP = 'chec ked ';
1403                    } el se {   1429                    } el se {
1404                         $sCheckedR eadPostPer mF = 'chec ked ';   1430                         $sCheckedR eadPostPer mF = 'chec ked ';
1405                    }   1431                    }
1406                }   1432                }
1407           }   1433           }
1408     1434  
1409           $i Owner = $t his->aBlog Conf['visi torID'];   1435           $i Owner = $t his->aBlog Conf['visi torID'];
1410           if  ($iPostID >0)   1436           if  ($iPostID >0)
1411                $iOwner  = db_value ("SELECT ` OwnerID` F ROM `BlogC ategories`   1437                $iOwner  = db_value ("SELECT ` OwnerID` F ROM `BlogC ategories`
1412                                      INNER JO IN `BlogPo sts` ON `B logPosts`. `CategoryI D` = `Blog Categories `.`Categor yID`    1438                                      INNER JO IN `BlogPo sts` ON `B logPosts`. `CategoryI D` = `Blog Categories `.`Categor yID` 
1413                                      WHERE `B logPosts`. `PostID` =  {$iPostID }");   1439                                      WHERE `B logPosts`. `PostID` =  {$iPostID }");
1414     1440  
1415           // $sCategori es = '';   1441           // $sCategori es = '';
1416           $s Categories SQL = "   1442           $s Categories SQL = "
1417                SELECT *     1443                SELECT *  
1418                FROM `Bl ogCategori es`   1444                FROM `Bl ogCategori es`
1419                WHERE `O wnerId` =  {$iOwner}   1445                WHERE `O wnerId` =  {$iOwner}
1420           ";   1446           ";
1421     1447  
1422           $v Categories  = db_res(  $sCategor iesSQL );   1448           $v Categories  = db_res(  $sCategor iesSQL );
1423           $s CategOptio ns = '';   1449           $s CategOptio ns = '';
1424           wh ile ( $aCa tegories =  mysql_fet ch_assoc($ vCategorie s) ) {   1450           wh ile ( $aCa tegories =  mysql_fet ch_assoc($ vCategorie s) ) {
1425                if ($iSa vedCategor yID>0 && $ iSavedCate goryID==$a Categories ['Category ID'] )   1451                if ($iSa vedCategor yID>0 && $ iSavedCate goryID==$a Categories ['Category ID'] )
1426                    $sSe lected = '  selected= "selected" ';   1452                    $sSe lected = '  selected= "selected" ';
1427                else   1453                else
1428                    $sSe lected = ' ';   1454                    $sSe lected = ' ';
1429                $sCategO ptions .=  '<option v alue="'.$a Categories ['Category ID'].'"'.$ sSelected. '>'.proces s_line_out put(strmax textlen($a Categories ['Category Name'])).' </option>' ."\n";   1455                $sCategO ptions .=  '<option v alue="'.$a Categories ['Category ID'].'"'.$ sSelected. '>'.proces s_line_out put(strmax textlen($a Categories ['Category Name'])).' </option>' ."\n";
1430           }   1456           }
1431     1457  
1432           $s CategPictu re = '<img  src="'.$s ite['icons '].'folder .png" styl e="positio n:static;"  alt="'.$s PleaseSele ctC.'" />' ;   1458           $s CategPictu re = '<img  src="'.$s ite['icons '].'folder .png" styl e="positio n:static;"  alt="'.$s PleaseSele ctC.'" />' ;
1433           $s CategSelec t = '<sele ct name="c ategoryID"  id="categ oryID" >'. $sCategOpt ions.'</se lect>';   1459           $s CategSelec t = '<sele ct name="c ategoryID"  id="categ oryID" >'. $sCategOpt ions.'</se lect>';
1434           $s CategPictS pans = $th is->GenCen teredActio nsBlock($s CategPictu re, $sCate gSelect);   1460           $s CategPictS pans = $th is->GenCen teredActio nsBlock($s CategPictu re, $sCate gSelect);
1435     1461  
1436           // $sFormUrl  = $_SERVER ['PHP_SELF '];   1462           // $sFormUrl  = $_SERVER ['PHP_SELF '];
1437           // $sFormUrl  = $site['u rl'].'blog s/';   1463           // $sFormUrl  = $site['u rl'].'blog s/';
1438           $s Link = $th is->genBlo gFormUrl() ;   1464           $s Link = $th is->genBlo gFormUrl() ;
1439     1465  
1440           $s RetHtml .=  <<<EOF   1466           $s RetHtml .=  <<<EOF
1441   <div class ="category Block">   1467   <div class ="category Block">
1442       <form  action="{$ sLink}" en ctype="mul tipart/for m-data" me thod="post ">   1468       <form  action="{$ sLink}" en ctype="mul tipart/for m-data" me thod="post ">
1443           <d iv class=" margin_bot tom_10">   1469           <d iv class=" margin_bot tom_10">
1444                {$sPostC aptionC} (  <span id= "captCount er">{$this ->aBlogCon f['blogCap tionMaxLen ght']}</sp an> {$sCha ractersLef tC} )   1470                {$sPostC aptionC} (  <span id= "captCount er">{$this ->aBlogCon f['blogCap tionMaxLen ght']}</sp an> {$sCha ractersLef tC} )
1445           </ div>   1471           </ div>
1446           <d iv class=" margin_bot tom_10">   1472           <d iv class=" margin_bot tom_10">
1447                <div cla ss="edit_e rror" styl e="display :{$sCPTsty le}">   1473                <div cla ss="edit_e rror" styl e="display :{$sCPTsty le}">
1448                    {$sC PTmsg}   1474                    {$sC PTmsg}
1449                </div>   1475                </div>
1450                <input t ype="text"  size="70"  name="cap tion" id=" caption" c lass="cate goryCaptio n1" value= "{$sPostCa ption}" on keydown="r eturn char Counter('c aption', ' {$this->aB logConf['b logCaption MaxLenght' ]}', 'capt Counter'); " />   1476                <input t ype="text"  size="70"  name="cap tion" id=" caption" c lass="cate goryCaptio n1" value= "{$sPostCa ption}" on keydown="r eturn char Counter('c aption', ' {$this->aB logConf['b logCaption MaxLenght' ]}', 'capt Counter'); " />
1451           </ div>   1477           </ div>
1452           <d iv class=" margin_bot tom_10">   1478           <d iv class=" margin_bot tom_10">
1453                {$sTagsC }   1479                {$sTagsC }
1454           </ div>   1480           </ div>
1455           <d iv class=" margin_bot tom_10">   1481           <d iv class=" margin_bot tom_10">
1456                <input t ype="text"  size="70"  name="tag s" id="tag s" value=" {$sPostTag s}" />   1482                <input t ype="text"  size="70"  name="tag s" id="tag s" value=" {$sPostTag s}" />
1457           </ div>   1483           </ div>
1458           <d iv class=" margin_bot tom_10">   1484           <d iv class=" margin_bot tom_10">
1459                {$sPostT extC}   1485                {$sPostT extC}
1460           </ div>   1486           </ div>
1461           <d iv class=" blogTextAr eaKeeper">   1487           <d iv class=" blogTextAr eaKeeper">
1462                <div cla ss="edit_e rror" styl e="display :{$sPTstyl e}">   1488                <div cla ss="edit_e rror" styl e="display :{$sPTstyl e}">
1463                    {$sP Tmsg}   1489                    {$sP Tmsg}
1464                </div>   1490                </div>
1465                <textare a name="bl ogText" ro ws="20" co ls="60" cl ass="class fiedsTextA rea" style ="width:80 0px;height :500px;" i d="desc">{ $sPostText }</textare a>   1491                <textare a name="bl ogText" ro ws="20" co ls="60" cl ass="class fiedsTextA rea" style ="width:80 0px;height :500px;" i d="desc">{ $sPostText }</textare a>
1466           </ div>   1492           </ div>
1467           <b r />   1493           <b r />
1468           <d iv class=" clear_both "></div>   1494           <d iv class=" clear_both "></div>
1469           <d iv class=" margin_bot tom_10">   1495           <d iv class=" margin_bot tom_10">
1470                <div cla ss="edit_e rror" styl e="display :{$sCATIDs tyle}">   1496                <div cla ss="edit_e rror" styl e="display :{$sCATIDs tyle}">
1471                    {$sC ATIDmsg}   1497                    {$sC ATIDmsg}
1472                </div>   1498                </div>
1473                {$sCateg PictSpans}   1499                {$sCateg PictSpans}
1474           </ div>   1500           </ div>
1475           <d iv class=" assocImage Block">   1501           <d iv class=" assocImage Block">
1476                <div cla ss="margin _bottom_10 ">   1502                <div cla ss="margin _bottom_10 ">
1477                    {$sA ssociatedI mageC}   1503                    {$sA ssociatedI mageC}
1478                </div>   1504                </div>
1479                <div cla ss="margin _bottom_10 ">   1505                <div cla ss="margin _bottom_10 ">
1480                    <inp ut type="f ile" name= "BlogPic">   1506                    <inp ut type="f ile" name= "BlogPic">
1481                </div>   1507                </div>
1482                {$sPostP ictureTag}   1508                {$sPostP ictureTag}
1483                <div cla ss="clear_ both"></di v>   1509                <div cla ss="clear_ both"></di v>
1484           </ div>   1510           </ div>
1485           <d iv class=" margin_bot tom_10">   1511           <d iv class=" margin_bot tom_10">
1486                <div cla ss="margin ed_left">{ $sPostComm entPerC}   1512                <div cla ss="margin ed_left">{ $sPostComm entPerC}
1487                </div>   1513                </div>
1488                <div cla ss="margin ed_left">   1514                <div cla ss="margin ed_left">
1489                    <div  class="ed it_error"  style="dis play:{$sCP style}">   1515                    <div  class="ed it_error"  style="dis play:{$sCP style}">
1490                         {$sCPmsg}   1516                         {$sCPmsg}
1491                    </di v>   1517                    </di v>
1492                    <inp ut type="r adio" {$sC heckedComm PermP} nam e="comment Perm" valu e="public"  checked=" checked" / >   1518                    <inp ut type="r adio" {$sC heckedComm PermP} nam e="comment Perm" valu e="public"  checked=" checked" / >
1493                    {$sP ublicC}<br  />   1519                    {$sP ublicC}<br  />
1494                    <inp ut type="r adio" {$sC heckedComm PermF} nam e="comment Perm" valu e="friends " />   1520                    <inp ut type="r adio" {$sC heckedComm PermF} nam e="comment Perm" valu e="friends " />
1495                    {$sF riendsOnly C}   1521                    {$sF riendsOnly C}
1496                </div>   1522                </div>
1497                <div cla ss="margin ed_left">{ $sPostRead PerC}   1523                <div cla ss="margin ed_left">{ $sPostRead PerC}
1498                </div>   1524                </div>
1499                <div cla ss="margin ed_left">   1525                <div cla ss="margin ed_left">
1500                    <div  class="ed it_error"  style="dis play:{$sRP style}">   1526                    <div  class="ed it_error"  style="dis play:{$sRP style}">
1501                         {$sRPmsg}   1527                         {$sRPmsg}
1502                    </di v>   1528                    </di v>
1503                    <inp ut type="r adio" {$sC heckedRead PostPermP}  name="rea dPerm" val ue="public " />   1529                    <inp ut type="r adio" {$sC heckedRead PostPermP}  name="rea dPerm" val ue="public " />
1504                    {$sP ublicC}<br  />   1530                    {$sP ublicC}<br  />
1505                    <inp ut type="r adio" {$sC heckedRead PostPermF}  name="rea dPerm" val ue="friend s" />   1531                    <inp ut type="r adio" {$sC heckedRead PostPermF}  name="rea dPerm" val ue="friend s" />
1506                    {$sF riendsOnly C}   1532                    {$sF riendsOnly C}
1507                </div>   1533                </div>
1508                <div cla ss="clear_ both"></di v>   1534                <div cla ss="clear_ both"></di v>
1509           </ div>   1535           </ div>
1510           <! -- <table  cellpaddin g="2" cell spacing="0 " border=" 0">    
1511                <tr>    
1512                    <td  rowspan="2 ">    
1513                         {$sPostCom mentPerC}    
1514                    </td >    
1515                    <td>    
1516                         <div class ="edit_err or" style= "display:{ $sCPstyle} ">    
1517                             {$sCPm sg}    
1518                         </div>    
1519                         <input typ e="radio"  {$sChecked CommPermP}  name="com mentPerm"  value="pub lic" check ed="checke d" />    
1520                    </td >    
1521                    <td>    
1522                         {$sPublicC }    
1523                    </td >    
1524                </tr>    
1525                <tr>    
1526                    <td>    
1527                         <input typ e="radio"  {$sChecked CommPermF}  name="com mentPerm"  value="fri ends" />    
1528                    </td >    
1529                    <td>    
1530                         {$sFriends OnlyC}    
1531                    </td >    
1532                </tr>    
1533                <tr>    
1534                    <td  rowspan="2 ">    
1535                         {$sPostRea dPerC}    
1536                    </td >    
1537                    <td>    
1538                         <div class ="edit_err or" style= "display:{ $sRPstyle} ">    
1539                             {$sRPm sg}    
1540                         </div>    
1541                         <input typ e="radio"  {$sChecked ReadPostPe rmP} name= "readPerm"  value="pu blic" />    
1542                    </td >    
1543                    <td>    
1544                         {$sPublicC }    
1545                    </td >    
1546                </tr>    
1547                <tr>    
1548                    <td>    
1549                         <input typ e="radio"  {$sChecked ReadPostPe rmF} name= "readPerm"  value="fr iends" />    
1550                    </td >    
1551                    <td>    
1552                         {$sFriends OnlyC}    
1553                    </td >    
1554                </tr>    
1555           </ table> -->    
1556           <d iv class=" margin_bot tom_10" st yle="text- align: cen ter;">   1536           <d iv class=" margin_bot tom_10" st yle="text- align: cen ter;">
1557                <input t ype="submi t" value=" {$sAddBlog C}" />   1537                <input t ype="submi t" value=" {$sAddBlog C}" />
1558                <input t ype="hidde n" name="a ction" val ue="{$sPos tAction}"  />   1538                <input t ype="hidde n" name="a ction" val ue="{$sPos tAction}"  />
1559                <input t ype="hidde n" name="s how" value ="blogList " />   1539                <input t ype="hidde n" name="s how" value ="blogList " />
1560                {$sEditI dStr}   1540                {$sEditI dStr}
1561           </ div>   1541           </ div>
1562       </form >   1542       </form >
1563   </div>   1543   </div>
1564   EOF;   1544   EOF;
1565     1545  
1566           re turn Desig nBoxConten t ($sNewPo stC, $sRet Html, 1);   1546           re turn Desig nBoxConten t ($sNewPo stC, $sRet Html, 1);
1567       }   1547       }
1568     1548  
1569       /**   1549       /**
1570        * Com pose Array  of posted  data befo re validat ing (add/d elete a po st)   1550        * Com pose Array  of posted  data befo re validat ing (add/d elete a po st)
1571        *   1551        *
1572        * @re turn Array   1552        * @re turn Array
1573        */   1553        */
1574       functi on GetPost ArrByPostV alues() {   1554       functi on GetPost ArrByPostV alues() {
1575            $iCategory ID   =   process_db _input(   (int)$_POS T['categor yID']   ) ;   1555            $iCategory ID   =  
(int)$_POS T['categor yID']
;
1576            $sPostCapt ion   =   process_db _input(   $_POST['ca ption']  
);
  1556            $sPostCapt ion   =   process_db _input(   $_POST['ca ption'] ,   1   );
1577            $sPostText   =  
process_
db_input(   $_POST['bl ogText']   );
  1557            $sPostText   =   $this-> process_ html_ db_input(   $_POST['bl ogText']   );
1578            $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ]  
);
  1558            $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ] ,   1   );
1579            $readPerm   =   process_db _input(   $_POST['re adPerm']  
);
  1559            $readPerm   =   process_db _input(   $_POST['re adPerm'] ,   1   );
1580            $sTags   =   process_db _input(   $_POST['ta gs']  
);
  1560            $sTags   =   process_db _input(   $_POST['ta gs'] ,   1   );
1581     1561  
1582           $a rr = array ('Category ID' => $iC ategoryID,  'Caption'  => $sPost Caption, ' PostText'  => $sPostT ext,   1562           $a rr = array ('Category ID' => $iC ategoryID,  'Caption'  => $sPost Caption, ' PostText'  => $sPostT ext,
1583                'Comment Perm' => $ commentPer m, 'ReadPe rm' => $re adPerm, 'T ags' => $s Tags);   1563                'Comment Perm' => $ commentPer m, 'ReadPe rm' => $re adPerm, 'T ags' => $s Tags);
1584           re turn $arr;   1564           re turn $arr;
1585       }   1565       }
1586     1566  
1587       /**   1567       /**
1588        * Com pose Array  of errors  during fi lling (val idating)   1568        * Com pose Array  of errors  during fi lling (val idating)
1589        *   1569        *
1590        * @pa ram $arrAd v   Input  Array with  data   1570        * @pa ram $arrAd v   Input  Array with  data
1591        * @re turn Array  with erro rs   1571        * @re turn Array  with erro rs
1592        */   1572        */
1593       functi on GetChec kErrors( $ arrAdv ) {   1573       functi on GetChec kErrors( $ arrAdv ) {
1594           $a rrErr = ar ray();   1574           $a rrErr = ar ray();
1595           fo reach( $ar rAdv as $s FieldName  => $sField Value ) {   1575           fo reach( $ar rAdv as $s FieldName  => $sField Value ) {
1596                switch(  $sFieldNam e ) {   1576                switch(  $sFieldNam e ) {
1597                    case  'Category ID':   1577                    case  'Category ID':
1598                         if( $sFiel dValue < 1 )   1578                         if( $sFiel dValue < 1 )
1599                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   1579                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
1600                    brea k;   1580                    brea k;
1601                    case  'Caption' :   1581                    case  'Caption' :
1602                         if( !strle n($sFieldV alue) )   1582                         if( !strle n($sFieldV alue) )
1603                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   1583                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
1604                    brea k;   1584                    brea k;
1605                    case  'PostText ':   1585                    case  'PostText ':
1606                         if( strlen ($sFieldVa lue) < 50  )   1586                         if( strlen ($sFieldVa lue) < 50  )
1607                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e 50 symbo ls at leas t";   1587                             $arrEr r[ $sField Name ] = " {$sFieldNa me} must b e 50 symbo ls at leas t";
1608                    brea k;   1588                    brea k;
1609                    case  'CommentP erm':   1589                    case  'CommentP erm':
1610                         if( !strle n($sFieldV alue) )   1590                         if( !strle n($sFieldV alue) )
1611                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   1591                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
1612                    brea k;   1592                    brea k;
1613                    case  'ReadPerm ':   1593                    case  'ReadPerm ':
1614                         if( !strle n($sFieldV alue) )   1594                         if( !strle n($sFieldV alue) )
1615                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";   1595                             $arrEr r[ $sField Name ] = " {$sFieldNa me} is req uired";
1616                    brea k;   1596                    brea k;
1617                }   1597                }
1618           }   1598           }
1619           re turn $arrE rr;   1599           re turn $arrE rr;
1620       }   1600       }
1621     1601  
1622       /**   1602       /**
1623        * Add ing a New  Post SQL   1603        * Add ing a New  Post SQL
1624        *   1604        *
1625        * @pa ram $iLast ID - retur ning Last  Inserted I D (SQL) (j ust try)   1605        * @pa ram $iLast ID - retur ning Last  Inserted I D (SQL) (j ust try)
1626        * @re turn HTML  presentati on of data   1606        * @re turn HTML  presentati on of data
1627        */   1607        */
1628       functi on ActionA ddNewPost( &$iLastID)  {   1608       functi on ActionA ddNewPost( &$iLastID)  {
1629           gl obal $dir;   1609           gl obal $dir;
1630     1610  
1631           $t his->Check Logged();   1611           $t his->Check Logged();
1632     1612  
1633            $iCategory ID   =   process_db _input(   (int)$_POS T['categor yID']   ) ;   1613            $iCategory ID   =  
(int)$_POS T['categor yID']
;
1634     1614  
1635           $s CheckPostS QL = "SELE CT `OwnerI D`   1615           $s CheckPostS QL = "SELE CT `OwnerI D`
1636                                 FR OM `BlogCa tegories`   1616                                 FR OM `BlogCa tegories`
1637                                 WH ERE `Categ oryID`={$i CategoryID }   1617                                 WH ERE `Categ oryID`={$i CategoryID }
1638                             ";   1618                             ";
1639           $a CategoryOw ner = db_a rr($sCheck PostSQL);   1619           $a CategoryOw ner = db_a rr($sCheck PostSQL);
1640           $i CategoryOw nerID = $a CategoryOw ner['Owner ID'];   1620           $i CategoryOw nerID = $a CategoryOw ner['Owner ID'];
1641           if  ($this->a BlogConf[' visitorID' ] == $iCat egoryOwner ID && $iCa tegoryID >  0) {   1621           if  ($this->a BlogConf[' visitorID' ] == $iCat egoryOwner ID && $iCa tegoryID >  0) {
1642                 $sPostCapt ion   =   process_db _input(   $_POST['ca ption']  
);
  1622                 $sPostCapt ion   =   process_db _input(   $_POST['ca ption'] ,   1   );
1643                $sPostUr i = uriGen erate($sPo stCaption,  'BlogPost s', 'PostU ri');   1623                $sPostUr i = uriGen erate($sPo stCaption,  'BlogPost s', 'PostU ri');
1644                 $sPostText   =  
process_
db_input(   $_POST['bl ogText']   );
  1624                 $sPostText   =   $this-> process_ html_ db_input(   $_POST['bl ogText']   );
1645                 $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ]  
);
  1625                 $commentPe rm   =   process_db _input(   $_POST['co mmentPerm' ] ,   1   );
1646                 $readPerm   =   process_db _input(   $_POST['re adPerm']  
);
  1626                 $readPerm   =   process_db _input(   $_POST['re adPerm'] ,   1   );
1647                 $sTagsPerm   =   process_db _input(   $_POST['ta gs']  
);
  1627                 $sTagsPerm   =   process_db _input(   $_POST['ta gs'] ,   1   );
1648                $aTags =  explodeTa gs($sTagsP erm);   1628                $aTags =  explodeTa gs($sTagsP erm);
1649                $sTagsPe rm = implo de(",", $a Tags);   1629                $sTagsPe rm = implo de(",", $a Tags);
1650                $queryAc tionAdd =  " INSERT I NTO ";   1630                $queryAc tionAdd =  " INSERT I NTO ";
1651     1631  
1652                $sAutoAp provalVal  = (getPara m('blogAut oApproval' )=='on') ?  "approval " : "disap proval";   1632                $sAutoAp provalVal  = (getPara m('blogAut oApproval' )=='on') ?  "approval " : "disap proval";
1653                $addQuer y = "   1633                $addQuer y = "
1654                    {$qu eryActionA dd} `BlogP osts`   1634                    {$qu eryActionA dd} `BlogP osts`
1655                    SET   1635                    SET
1656                         `CategoryI D` = '{$iC ategoryID} ',   1636                         `CategoryI D` = '{$iC ategoryID} ',
1657                         `PostCapti on` = '{$s PostCaptio n}',   1637                         `PostCapti on` = '{$s PostCaptio n}',
1658                         `PostUri`  = '{$sPost Uri}',   1638                         `PostUri`  = '{$sPost Uri}',
1659                         `PostText`  = '{$sPos tText}',   1639                         `PostText`  = '{$sPos tText}',
1660                         `PostReadP ermission`  = '{$read Perm}',   1640                         `PostReadP ermission`  = '{$read Perm}',
1661                         `PostComme ntPermissi on` = '{$c ommentPerm }',   1641                         `PostComme ntPermissi on` = '{$c ommentPerm }',
1662                         `PostStatu s` = '{$sA utoApprova lVal}',   1642                         `PostStatu s` = '{$sA utoApprova lVal}',
1663                         `Tags` = ' {$sTagsPer m}',   1643                         `Tags` = ' {$sTagsPer m}',
1664                         `PostDate`  = NOW()   1644                         `PostDate`  = NOW()
1665                ";   1645                ";
1666     1646  
1667                $sRet =  _t('_faile d_to_add_p ost');   1647                $sRet =  _t('_faile d_to_add_p ost');
1668                if( db_r es( $addQu ery ) ) {   1648                if( db_r es( $addQu ery ) ) {
1669                    $iLa stId = mys ql_insert_ id();   1649                    $iLa stId = mys ql_insert_ id();
1670                    $thi s->iLastPo stedPostID  = $iLastI d;   1650                    $thi s->iLastPo stedPostID  = $iLastI d;
1671                    if (  0 < $_FIL ES['BlogPi c']['size' ] && 0 < s trlen( $_F ILES['Blog Pic']['nam e'] ) && 0  < $iLastI d ) {   1651                    if (  0 < $_FIL ES['BlogPi c']['size' ] && 0 < s trlen( $_F ILES['Blog Pic']['nam e'] ) && 0  < $iLastI d ) {
1672                         $sFileName  = 'blog_'  . $iLastI d;   1652                         $sFileName  = 'blog_'  . $iLastI d;
1673                         $sExt = mo veUploaded Image( $_F ILES, 'Blo gPic', $di r['blogIma ge'] . $sF ileName, ' ', false ) ;   1653                         $sExt = mo veUploaded Image( $_F ILES, 'Blo gPic', $di r['blogIma ge'] . $sF ileName, ' ', false ) ;
1674                         if( strlen ( $sExt )  && !(int)$ sExt ) {   1654                         if( strlen ( $sExt )  && !(int)$ sExt ) {
1675                             imageR esize( $di r['blogIma ge'] . $sF ileName.$s Ext, $dir[ 'blogImage '] . 'smal l_' . $sFi leName.$sE xt, $this- >iIconSize  / 2, $thi s->iIconSi ze / 2);   1655                             imageR esize( $di r['blogIma ge'] . $sF ileName.$s Ext, $dir[ 'blogImage '] . 'smal l_' . $sFi leName.$sE xt, $this- >iIconSize  / 2, $thi s->iIconSi ze / 2);
1676                             imageR esize( $di r['blogIma ge'] . $sF ileName.$s Ext, $dir[ 'blogImage '] . 'big_ ' . $sFile Name.$sExt , $this->i ThumbSize,  $this->iT humbSize);   1656                             imageR esize( $di r['blogIma ge'] . $sF ileName.$s Ext, $dir[ 'blogImage '] . 'big_ ' . $sFile Name.$sExt , $this->i ThumbSize,  $this->iT humbSize);
1677     1657  
1678                             chmod(  $dir['blo gImage'] .  'small_'  . $sFileNa me . $sExt , 0644 );   1658                             chmod(  $dir['blo gImage'] .  'small_'  . $sFileNa me . $sExt , 0644 );
1679                             chmod(  $dir['blo gImage'] .  'big_' .  $sFileName  . $sExt,  0644 );   1659                             chmod(  $dir['blo gImage'] .  'big_' .  $sFileName  . $sExt,  0644 );
1680     1660  
1681                             $query  = "UPDATE  `BlogPost s` SET `Po stPhoto` =  '" . $sFi leName . $ sExt . "'  WHERE `Pos tID` = '{$ iLastId}'" ;   1661                             $query  = "UPDATE  `BlogPost s` SET `Po stPhoto` =  '" . $sFi leName . $ sExt . "'  WHERE `Pos tID` = '{$ iLastId}'" ;
1682                             db_res ( $query ) ;   1662                             db_res ( $query ) ;
1683                             @unlin k( $dir['b logImage']  . $sFileN ame . $sEx t );   1663                             @unlin k( $dir['b logImage']  . $sFileN ame . $sEx t );
1684                         }   1664                         }
1685                    }   1665                    }
1686                    if ( $iLastId>0 ) {   1666                    if ( $iLastId>0 ) {
1687                         $sRet = _t ('_post_su ccessfully _added');   1667                         $sRet = _t ('_post_su ccessfully _added');
1688                         reparseObj Tags( 'blo g', $iLast Id );   1668                         reparseObj Tags( 'blo g', $iLast Id );
1689                    }   1669                    }
1690                }   1670                }
1691                return M sgBox($sRe t);   1671                return M sgBox($sRe t);
1692           }  elseif($th is->aBlogC onf['visit orID'] !=  $iCategory OwnerID) {   1672           }  elseif($th is->aBlogC onf['visit orID'] !=  $iCategory OwnerID) {
1693                return M sgBox(_t(' _Hacker St ring'));   1673                return M sgBox(_t(' _Hacker St ring'));
1694           }  else {   1674           }  else {
1695                return M sgBox(_t(' _Error Occ ured'));   1675                return M sgBox(_t(' _Error Occ ured'));
1696           }   1676           }
1697       }   1677       }
1698     1678  
1699       /**   1679       /**
1700        * Gen erate a Fo rm to Edit ing/Adding  of Catego ry of Blog   1680        * Gen erate a Fo rm to Edit ing/Adding  of Catego ry of Blog
1701        *   1681        *
1702        * @pa ram $categ oryID - ca tegory ID   1682        * @pa ram $categ oryID - ca tegory ID
1703        * @re turn HTML  presentati on of data   1683        * @re turn HTML  presentati on of data
1704        */   1684        */
1705       functi on GenEdit CategoryFo rm( $iCate goryID = ' ' ) {   1685       functi on GenEdit CategoryFo rm( $iCate goryID = ' ' ) {
1706           gl obal $aBlo gConfig;   1686           gl obal $aBlo gConfig;
1707           gl obal $aBre adCramp;   1687           gl obal $aBre adCramp;
1708           gl obal $site ;   1688           gl obal $site ;
1709     1689  
1710           $t his->Check Logged();   1690           $t his->Check Logged();
1711     1691  
1712           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   1692           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
1713           $s RestrictRe s = $this- >CheckRest rictionToU se($iCheck edMemberID );   1693           $s RestrictRe s = $this- >CheckRest rictionToU se($iCheck edMemberID );
1714           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   1694           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
1715     1695  
1716           $s BlogsSQL =  "   1696           $s BlogsSQL =  "
1717                SELECT ` Blogs`. *   1697                SELECT ` Blogs`. *
1718                FROM `Bl ogs`    1698                FROM `Bl ogs` 
1719                 WHERE   `Blogs`.`O wnerID`   =  
{$ th i s->aBlog C onf['visit o rID '] }
  1699                 WHERE   `Blogs`.`O wnerID`   =   ' {$
i
C heckedMemb e rID
} '
1720                LIMIT 1   1700                LIMIT 1
1721           ";   1701           ";
1722           $a BlogsRes =  db_arr( $ sBlogsSQL  );   1702           $a BlogsRes =  db_arr( $ sBlogsSQL  );
1723           if  (!$aBlogs Res) {   1703           if  (!$aBlogs Res) {
1724                return $ this->GenC reateBlogF orm();   1704                return $ this->GenC reateBlogF orm();
1725           }   1705           }
1726     1706  
1727           $s RetHtml =  '';   1707           $s RetHtml =  '';
1728            if   ($ th i s->aBlog C onf['visit o rID ']   ==   $aBlogsRes ['OwnerID' ]   ||   $this->bAd minMode==t rue)   {   1708            if   ($
i
C heckedMemb e rID  
==   $aBlogsRes ['OwnerID' ]   ||   $this->bAd minMode==t rue)   {
1729                if( $_RE QUEST['act ion'] == ' edit_categ ory' ) {   1709                if( $_RE QUEST['act ion'] == ' edit_categ ory' ) {
1730                    $sCa tegorySQL  = "   1710                    $sCa tegorySQL  = "
1731                         SELECT *    1711                         SELECT * 
1732                         FROM `Blog Categories `   1712                         FROM `Blog Categories `
1733                         WHERE   `CategoryI D`   =  
{$iCategor yID}
  1713                         WHERE   `CategoryI D`   =   ' {$iCategor yID} '
1734                         LIMIT 1   1714                         LIMIT 1
1735                    ";   1715                    ";
1736                    $aCa tegory = d b_arr( $sC ategorySQL  );   1716                    $aCa tegory = d b_arr( $sC ategorySQL  );
1737                     $categCapt ion   =  
$aCategory ['Category Name']
;
  1717                     $categCapt ion   =   htmlspecia lchars( $aCategory ['Category Name'] ) ;
1738                    $cat egImg = $a Category[' CategoryPh oto'];   1718                    $cat egImg = $a Category[' CategoryPh oto'];
1739                } else {   1719                } else {
1740                    $cat egCaption  = '';   1720                    $cat egCaption  = '';
1741                    $cat egDesc = ' ';   1721                    $cat egDesc = ' ';
1742                    $cat egImg = '' ;   1722                    $cat egImg = '' ;
1743                }   1723                }
1744     1724  
1745                $sCatego ryCaptionC  = _t('_ca tegory_cap tion');   1725                $sCatego ryCaptionC  = _t('_ca tegory_cap tion');
1746                $sPlease FillFields C = _t('_p lease_fill _next_fiel ds_first') ;   1726                $sPlease FillFields C = _t('_p lease_fill _next_fiel ds_first') ;
1747     1727  
1748                $sRetHtm l .= <<<EO F   1728                $sRetHtm l .= <<<EO F
1749   <script ty pe="text/j avascript" >   1729   <script ty pe="text/j avascript" >
1750       functi on checkFo rm() {   1730       functi on checkFo rm() {
1751           va r el;   1731           va r el;
1752           va r hasErr =  false;   1732           va r hasErr =  false;
1753           va r fild = " ";   1733           va r fild = " ";
1754     1734  
1755           el  = documen t.getEleme ntById("ca ption");   1735           el  = documen t.getEleme ntById("ca ption");
1756           if ( el.value .length <  3 ) {   1736           if ( el.value .length <  3 ) {
1757                el.style .backgroun dColor = " pink";   1737                el.style .backgroun dColor = " pink";
1758                el.style .border =  "1px solid  silver";   1738                el.style .border =  "1px solid  silver";
1759                hasErr =  true;   1739                hasErr =  true;
1760                fild +=  "{$sCatego ryCaptionC }";   1740                fild +=  "{$sCatego ryCaptionC }";
1761           }  else {   1741           }  else {
1762                el.style .backgroun dColor = " #fff";   1742                el.style .backgroun dColor = " #fff";
1763           }   1743           }
1764     1744  
1765           if  (hasErr)  {   1745           if  (hasErr)  {
1766                alert( " {$sPleaseF illFieldsC }!" + fild  )   1746                alert( " {$sPleaseF illFieldsC }!" + fild  )
1767                return f alse;   1747                return f alse;
1768           }  else {   1748           }  else {
1769                return t rue;   1749                return t rue;
1770           }   1750           }
1771           re turn false ;   1751           re turn false ;
1772       }   1752       }
1773   </script>   1753   </script>
1774   EOF;   1754   EOF;
1775     1755  
1776                $sCatego ryCaptionC  = _t('_ca tegory_cap tion');   1756                $sCatego ryCaptionC  = _t('_ca tegory_cap tion');
1777                $sCharac tersLeftC  = _t('_cha racters_le ft');   1757                $sCharac tersLeftC  = _t('_cha racters_le ft');
1778                //$sCate goryDescri ptionC = _ t('_catego ry_descrip tion');   1758                //$sCate goryDescri ptionC = _ t('_catego ry_descrip tion');
1779                $sAssoci atedImageC  = _t('_as sociated_i mage');   1759                $sAssoci atedImageC  = _t('_as sociated_i mage');
1780                $sApplyC hangesC =  _t('apply  changes');   1760                $sApplyC hangesC =  _t('apply  changes');
1781                $sAddCat egoryC = _ t('_add_ca tegory');   1761                $sAddCat egoryC = _ t('_add_ca tegory');
1782                $sEditCa tegoryC =  _t('_edit_ category') ;   1762                $sEditCa tegoryC =  _t('_edit_ category') ;
1783     1763  
1784                $sBlogPh oto = '';   1764                $sBlogPh oto = '';
1785                if ( $ca tegImg ) {   1765                if ( $ca tegImg ) {
1786                    $sBl ogPhoto =  <<<EOF   1766                    $sBl ogPhoto =  <<<EOF
1787   <div class ="blogPhot o">   1767   <div class ="blogPhot o">
1788           <i mg src="{$ site['blog Image']}bi g_{$categI mg}" alt=" " />   1768           <i mg src="{$ site['blog Image']}bi g_{$categI mg}" alt=" " />
1789   </div>   1769   </div>
1790   EOF;   1770   EOF;
1791                }   1771                }
1792     1772  
1793                $sEditCa tegory = ' ';   1773                $sEditCa tegory = ' ';
1794                if( 'edi t_category ' == $_REQ UEST['acti on']  ) {   1774                if( 'edi t_category ' == $_REQ UEST['acti on']  ) {
1795                    $sEd itCategory  = <<<EOF   1775                    $sEd itCategory  = <<<EOF
1796   <input typ e="submit"  value="{$ sApplyChan gesC}" />   1776   <input typ e="submit"  value="{$ sApplyChan gesC}" />
1797   <input typ e="hidden"  name="act ion" value ="editcate gory" />   1777   <input typ e="hidden"  name="act ion" value ="editcate gory" />
1798   <input typ e="hidden"  name="cat egoryID" v alue="{$iC ategoryID} " />   1778   <input typ e="hidden"  name="cat egoryID" v alue="{$iC ategoryID} " />
1799   <input typ e="hidden"  name="cat egoryPhoto " value="{ $categImg} " />   1779   <input typ e="hidden"  name="cat egoryPhoto " value="{ $categImg} " />
1800   EOF;   1780   EOF;
1801                } else {   1781                } else {
1802                    $sEd itCategory  = <<<EOF   1782                    $sEd itCategory  = <<<EOF
1803   <input typ e="submit"  value="{$ sAddCatego ryC}" />   1783   <input typ e="submit"  value="{$ sAddCatego ryC}" />
1804   <input typ e="hidden"  name="act ion" value ="addcateg ory" />   1784   <input typ e="hidden"  name="act ion" value ="addcateg ory" />
1805   EOF;   1785   EOF;
1806                }   1786                }
1807     1787  
1808                 $iMemberID   =   (int) process_db _input(   $_REQUEST[ 'ownerID'] ) ;   1788                 $iMemberID   =   (int)
$_REQUEST[ 'ownerID']
;
1809                $aUser =  array('Pe rmalink'=> getNickNam e($iMember ID), 'Link '=>$iMembe rID);   1789                $aUser =  array('Pe rmalink'=> getNickNam e($iMember ID), 'Link '=>$iMembe rID);
1810                $sBlogOw nerLink =  $this->gen BlogLink(' show_membe r_blog', $ aUser);   1790                $sBlogOw nerLink =  $this->gen BlogLink(' show_membe r_blog', $ aUser);
1811     1791  
1812                $sCategI mg = '<img  src="'.$s ite['icons '].'folder .png" styl e="positio n:static;"  />';   1792                $sCategI mg = '<img  src="'.$s ite['icons '].'folder .png" styl e="positio n:static;"  />';
1813                $sCategI nput = '<i nput type= "" name="c ategoryCap tion" id=" caption" v alue="'.$c ategCaptio n.'" class ="category Caption1"  onkeydown= "return ch arCounter( \'caption\ ', '.$this ->aBlogCon f['categor yCaptionMa xLenght']. ', \'captC ounter\'); " />';   1793                $sCategI nput = '<i nput type= "" name="c ategoryCap tion" id=" caption" v alue="'.$c ategCaptio n.'" class ="category Caption1"  onkeydown= "return ch arCounter( \'caption\ ', '.$this ->aBlogCon f['categor yCaptionMa xLenght']. ', \'captC ounter\'); " />';
1814                $sCategI nputImg =  $this->Gen CenteredAc tionsBlock ($sCategIm g, $sCateg Input);   1794                $sCategI nputImg =  $this->Gen CenteredAc tionsBlock ($sCategIm g, $sCateg Input);
1815     1795  
1816                $sRetHtm l .= <<<EO F   1796                $sRetHtm l .= <<<EO F
1817   <div>   1797   <div>
1818       <form  action="{$ sBlogOwner Link}" enc type="mult ipart/form -data" met hod="post"  onsubmit= "return ch eckForm(); ">   1798       <form  action="{$ sBlogOwner Link}" enc type="mult ipart/form -data" met hod="post"  onsubmit= "return ch eckForm(); ">
1819           <d iv class=" margin_bot tom_10">   1799           <d iv class=" margin_bot tom_10">
1820                {$sCateg oryCaption C} (<span  id="captCo unter">{$t his->aBlog Conf['cate goryCaptio nMaxLenght ']}</span> {$sCharact ersLeftC})   1800                {$sCateg oryCaption C} (<span  id="captCo unter">{$t his->aBlog Conf['cate goryCaptio nMaxLenght ']}</span> {$sCharact ersLeftC})
1821           </ div>   1801           </ div>
1822           <d iv class=" margin_bot tom_10">   1802           <d iv class=" margin_bot tom_10">
1823                {$sCateg InputImg}   1803                {$sCateg InputImg}
1824           </ div>   1804           </ div>
1825           <d iv class=" assocImage Block">   1805           <d iv class=" assocImage Block">
1826                <div sty le="margin -bottom:5p x;">   1806                <div sty le="margin -bottom:5p x;">
1827                    {$sA ssociatedI mageC}   1807                    {$sA ssociatedI mageC}
1828                </div>   1808                </div>
1829                {$sBlogP hoto}   1809                {$sBlogP hoto}
1830                <div cla ss="margin _bottom_10 ">   1810                <div cla ss="margin _bottom_10 ">
1831                    <inp ut type="f ile" name= "CategPic"  />   1811                    <inp ut type="f ile" name= "CategPic"  />
1832                </div>   1812                </div>
1833                <div cla ss="clear_ both"></di v>   1813                <div cla ss="clear_ both"></di v>
1834           </ div>   1814           </ div>
1835           {$ sEditCateg ory}   1815           {$ sEditCateg ory}
1836           <i nput type= "hidden" n ame="owner ID" value= "{$iMember ID}" />   1816           <i nput type= "hidden" n ame="owner ID" value= "{$iMember ID}" />
1837       </form >   1817       </form >
1838   </div>   1818   </div>
1839   EOF;   1819   EOF;
1840           }  else {   1820           }  else {
1841                $ret .=  _t_err( '_ you_have_n o_permiss_ to_edit' ) ;   1821                $ret .=  _t_err( '_ you_have_n o_permiss_ to_edit' ) ;
1842                $sRetHtm l = $ret;   1822                $sRetHtm l = $ret;
1843           }   1823           }
1844           re turn Desig nBoxConten t ($sEditC ategoryC,  $sRetHtml,  1);   1824           re turn Desig nBoxConten t ($sEditC ategoryC,  $sRetHtml,  1);
1845       }   1825       }
1846     1826  
1847       /**   1827       /**
1848        * Upd ate (Addin g or Editi ng) a Cate gory   1828        * Upd ate (Addin g or Editi ng) a Cate gory
1849        *   1829        *
1850        * @pa ram $bEdit Mode - Upd ate (Editi ng) mode   1830        * @pa ram $bEdit Mode - Upd ate (Editi ng) mode
1851        * @re turn MsgBo x result   1831        * @re turn MsgBo x result
1852        */   1832        */
1853        function   ActionUpda teCategory ($bEditMod e= FALSE )   {   1833        function   ActionUpda teCategory ($bEditMod e= false )   {
1854           gl obal $aBlo gConfig;   1834           gl obal $aBlo gConfig;
1855           gl obal $dir;   1835           gl obal $dir;
1856     1836  
1857           $t his->Check Logged();   1837           $t his->Check Logged();
1858     1838  
1859            $ownerID   =   (int) process_db _input(   $_REQUEST[ 'ownerID'] ) ;   1839            $ownerID   =   (int)
$_REQUEST[ 'ownerID']
;
1860            $iCategory ID   =   process_db _input(   (int)$_POS T['categor yID']   ) ;   1840            $iCategory ID   =  
(int)$_POS T['categor yID']
;
1861     1841  
1862           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`   1842           $s CheckPostS QL = "SELE CT `BlogCa tegories`. `OwnerID`
1863                                 FR OM `BlogCa tegories`   1843                                 FR OM `BlogCa tegories`
1864                                  WHERE   `BlogCateg ories`.`Ca tegoryID`=
{$iCategor yID}
  1844                                  WHERE   `BlogCateg ories`.`Ca tegoryID`= ' {$iCategor yID} '
1865                             ";   1845                             ";
1866           $a CategoryOw ner = db_a rr($sCheck PostSQL);   1846           $a CategoryOw ner = db_a rr($sCheck PostSQL);
1867           $i CategoryOw nerID = $a CategoryOw ner['Owner ID'];   1847           $i CategoryOw nerID = $a CategoryOw ner['Owner ID'];
1868     1848  
1869            if   ((($this-> aBlogConf[ 'visitorID ']   ==   $iCategory OwnerID   ||   $this->bAd minMode== TRUE )   &&   $iCategory ID   >   0   &&   $bEditMode == TRUE )   ||   ($bEditMod e== FALSE   &&   $iCategory ID==0   &&   $ownerID== $this->aBl ogConf['vi sitorID']) )   {   1849            if   ((($this-> aBlogConf[ 'visitorID ']   ==   $iCategory OwnerID   ||   $this->bAd minMode== true )   &&   $iCategory ID   >   0   &&   $bEditMode == true )   ||   ($bEditMod e== false   &&   $iCategory ID==0   &&   $ownerID== $this->aBl ogConf['vi sitorID']) )   {
1870                $ret = ' ';   1850                $ret = ' ';
1871     1851  
1872                 $categoryC aption   =   process_db _input(   $_ PO ST['catego ryCaption' ]
);
  1852                 $categoryC aption   =   process_db _input(   $_ REQUE ST['catego ryCaption' ] ,   1 );
1873                $categor yPhoto = p rocess_db_ input( $_P OST['categ oryPhoto'] );    
1874     1853  
1875                 if   ($bEditMod e== TRUE )   {   1854                 if   ($bEditMod e== true )   {
1876                    $add Query = "   1855                    $add Query = "
1877                         UPDATE `Bl ogCategori es`   1856                         UPDATE `Bl ogCategori es`
1878                         SET   1857                         SET
1879                         `CategoryN ame` = '{$ categoryCa ption}',   1858                         `CategoryN ame` = '{$ categoryCa ption}',
1880                         `Date` = N OW( ) WHER E `Categor yID` = '{$ iCategoryI D}'   1859                         `Date` = N OW() WHERE  `Category ID` = '{$i CategoryID }'
1881                         LIMIT 1   1860                         LIMIT 1
1882                    ";   1861                    ";
1883                } else {   1862                } else {
1884                    $sCa tegoryUri  = uriGener ate($categ oryCaption , 'BlogCat egories',  'CategoryU ri', 150);   1863                    $sCa tegoryUri  = uriGener ate($categ oryCaption , 'BlogCat egories',  'CategoryU ri', 150);
1885                    $add Query = "   1864                    $add Query = "
1886                         INSERT INT O `BlogCat egories`   1865                         INSERT INT O `BlogCat egories`
1887                         SET   1866                         SET
1888                         `OwnerID`  = '{$owner ID}',   1867                         `OwnerID`  = '{$owner ID}',
1889                         `CategoryN ame` = '{$ categoryCa ption}',   1868                         `CategoryN ame` = '{$ categoryCa ption}',
1890                         `CategoryU ri` = '{$s CategoryUr i}',   1869                         `CategoryU ri` = '{$s CategoryUr i}',
1891                         `CategoryP hoto`   =   ' {$category Photo} ',   1870                         `CategoryP hoto`   =   '
',
1892                         `Date` = N OW()   1871                         `Date` = N OW()
1893                    ";   1872                    ";
1894                }   1873                }
1895     1874  
1896                if ($bEd itMode==tr ue) {   1875                if ($bEd itMode==tr ue) {
1897                    $aCa tInfo = db _arr("SELE CT `Catego ryPhoto`,  `CategoryI D` FROM `B logCategor ies` WHERE  `Category ID`= {$iCa tegoryID}" );   1876                    $aCa tInfo = db _arr("SELE CT `Catego ryPhoto`,  `CategoryI D` FROM `B logCategor ies` WHERE  `Category ID`= {$iCa tegoryID}" );
1898                    $sFi leName = $ aCatInfo[' CategoryPh oto'];   1877                    $sFi leName = $ aCatInfo[' CategoryPh oto'];
1899                    if ( $sFileName  == '') {   1878                    if ( $sFileName  == '') {
1900                         $sFileName  = 'catego ry_' . $aC atInfo['Ca tegoryID'] ;   1879                         $sFileName  = 'catego ry_' . $aC atInfo['Ca tegoryID'] ;
1901                    }   1880                    }
1902                }   1881                }
1903     1882  
1904                db_res(  $addQuery  );   1883                db_res(  $addQuery  );
1905                $iID = ( $bEditMode  == true)  ? $iCatego ryID : mys ql_insert_ id();   1884                $iID = ( $bEditMode  == true)  ? $iCatego ryID : mys ql_insert_ id();
1906                if( mysq l_affected _rows() ==  1 || $_FI LES['Categ Pic']['siz e'] > 0) {   1885                if( mysq l_affected _rows() ==  1 || $_FI LES['Categ Pic']['siz e'] > 0) {
1907                    if (  0 < $_FIL ES['CategP ic']['size '] && 0 <  strlen( $_ FILES['Cat egPic']['n ame'] ) )  {   1886                    if (  0 < $_FIL ES['CategP ic']['size '] && 0 <  strlen( $_ FILES['Cat egPic']['n ame'] ) )  {
1908                         if ($bEdit Mode==fals e) {   1887                         if ($bEdit Mode==fals e) {
1909                             $iCate goryID = m ysql_inser t_id();   1888                             $iCate goryID = m ysql_inser t_id();
1910                             $sFile Name = 'ca tegory_' .  $iID;   1889                             $sFile Name = 'ca tegory_' .  $iID;
1911                         }   1890                         }
1912                         //$sFileNa me = 'cate gory_' . $ iLastId;   1891                         //$sFileNa me = 'cate gory_' . $ iLastId;
1913                         $sExt = mo veUploaded Image( $_F ILES, 'Cat egPic', $d ir['blogIm age'] . $s FileName,  '', false  );   1892                         $sExt = mo veUploaded Image( $_F ILES, 'Cat egPic', $d ir['blogIm age'] . $s FileName,  '', false  );
1914                         if ( strle n( $sExt )  && !(int) $sExt ) {   1893                         if ( strle n( $sExt )  && !(int) $sExt ) {
1915                             imageR esize( $di r['blogIma ge'] . $sF ileName .  $sExt, $di r['blogIma ge'] . 'sm all_' . $s FileName .  $sExt, 25 , 25, fals e );   1894                             imageR esize( $di r['blogIma ge'] . $sF ileName .  $sExt, $di r['blogIma ge'] . 'sm all_' . $s FileName .  $sExt, 25 , 25, fals e );
1916                             imageR esize( $di r['blogIma ge'] . $sF ileName .  $sExt, $di r['blogIma ge'] . 'bi g_' . $sFi leName . $ sExt, 150,  150, fals e );   1895                             imageR esize( $di r['blogIma ge'] . $sF ileName .  $sExt, $di r['blogIma ge'] . 'bi g_' . $sFi leName . $ sExt, 150,  150, fals e );
1917     1896  
1918                             chmod(  $dir['blo gImage'] .  'small_'  . $sFileNa me . $sExt , 0644 );   1897                             chmod(  $dir['blo gImage'] .  'small_'  . $sFileNa me . $sExt , 0644 );
1919                             chmod(  $dir['blo gImage'] .  'big_' .  $sFileName  . $sExt,  0644 );   1898                             chmod(  $dir['blo gImage'] .  'big_' .  $sFileName  . $sExt,  0644 );
1920     1899  
1921                             $query  = "UPDATE  `BlogCate gories` SE T `Categor yPhoto` =  '" . $sFil eName . $s Ext . "' W HERE `cate goryID` =  '{$iID}'";   1900                             $query  = "UPDATE  `BlogCate gories` SE T `Categor yPhoto` =  '" . $sFil eName . $s Ext . "' W HERE `cate goryID` =  '{$iID}'";
1922                             db_res ( $query ) ;   1901                             db_res ( $query ) ;
1923     1902  
1924                             @unlin k( $dir['b logImage']  . $sFileN ame . $sEx t );   1903                             @unlin k( $dir['b logImage']  . $sFileN ame . $sEx t );
1925                         }   1904                         }
1926                    }   1905                    }
1927     1906  
1928                    $ret  .= ($bEdi tMode==tru e) ? _t( ' _changes_s uccessfull y_applied'  ) : _t( ' _category_ successful ly_added'  );   1907                    $ret  .= ($bEdi tMode==tru e) ? _t( ' _changes_s uccessfull y_applied'  ) : _t( ' _category_ successful ly_added'  );
1929                } else {   1908                } else {
1930                    $ret  .= _t( '_ failed_to_ add_catego ry' );   1909                    $ret  .= _t( '_ failed_to_ add_catego ry' );
1931                }   1910                }
1932                return M sgBox($ret );   1911                return M sgBox($ret );
1933           }  elseif($th is->aBlogC onf['visit orID'] !=  $iCategory OwnerID) {   1912           }  elseif($th is->aBlogC onf['visit orID'] !=  $iCategory OwnerID) {
1934                return M sgBox(_t(' _Hacker St ring'));   1913                return M sgBox(_t(' _Hacker St ring'));
1935           }  else {   1914           }  else {
1936                return M sgBox(_t(' _Error Occ ured'));   1915                return M sgBox(_t(' _Error Occ ured'));
1937           }   1916           }
1938       }   1917       }
1939     1918  
1940       /**   1919       /**
1941        * Del eting a Ca tegory   1920        * Del eting a Ca tegory
1942        *   1921        *
1943        * @re turn MsgBo x result   1922        * @re turn MsgBo x result
1944        */   1923        */
1945       functi on ActionD eleteCateg ory() {   1924       functi on ActionD eleteCateg ory() {
1946           gl obal $dir;   1925           gl obal $dir;
1947     1926  
1948           $t his->Check Logged();   1927           $t his->Check Logged();
1949     1928  
1950            $iCategID   =   process_db _input(   (int)$_POS T['DeleteC ategoryID' ]   ) ;   1929            $iCategID   =  
(int)$_POS T['DeleteC ategoryID' ]
;
1951     1930  
1952           $a CatType =  db_arr("SE LECT `Cate goryType`, `OwnerID`,  `Category Photo` FRO M `BlogCat egories` W HERE `Cate goryID` =  {$iCategID } LIMIT 1" );   1931           $a CatType =  db_arr("SE LECT `Cate goryType`, `OwnerID`,  `Category Photo` FRO M `BlogCat egories` W HERE `Cate goryID` =  {$iCategID } LIMIT 1" );
1953           if  (($aCatTy pe['Catego ryType'] = = 1 && $aC atType['Ow nerID']==$ this->aBlo gConf['vis itorID'])  || $this-> bAdminMode ) {   1932           if  (($aCatTy pe['Catego ryType'] = = 1 && $aC atType['Ow nerID']==$ this->aBlo gConf['vis itorID'])  || $this-> bAdminMode ) {
1954                $vPosts  = db_res(  "SELECT `P ostID`,`Po stPhoto` F ROM `BlogP osts` WHER E `Categor yID` = {$i CategID}"  );   1933                $vPosts  = db_res(  "SELECT `P ostID`,`Po stPhoto` F ROM `BlogP osts` WHER E `Categor yID` = {$i CategID}"  );
1955                while( $ aBlog = my sql_fetch_ assoc( $vP osts ) ) {   1934                while( $ aBlog = my sql_fetch_ assoc( $vP osts ) ) {
1956                    $iPo stID = $aB log['PostI D'];   1935                    $iPo stID = $aB log['PostI D'];
1957     1936  
1958                    $oCm ts = new B xDolCmts ( 'blogposts ', (int)$i PostID);   1937                    $oCm ts = new B xDolCmts ( 'blogposts ', (int)$i PostID);
1959                    $oCm ts->onObje ctDelete ( );   1938                    $oCm ts->onObje ctDelete ( );
1960     1939  
1961                    $sFi leNamePost  = $aBlog[ 'PostPhoto '];   1940                    $sFi leNamePost  = $aBlog[ 'PostPhoto '];
1962                    if ( $sFileName  != '') {   1941                    if ( $sFileName  != '') {
1963                         @unlink( $ dir['blogI mage'] . ' big_' . $s FileNamePo st );   1942                         @unlink( $ dir['blogI mage'] . ' big_' . $s FileNamePo st );
1964                         @unlink( $ dir['blogI mage'] . ' small_' .  $sFileName Post );   1943                         @unlink( $ dir['blogI mage'] . ' small_' .  $sFileName Post );
1965                    }   1944                    }
1966                }   1945                }
1967     1946  
1968                db_res(  "DELETE FR OM `BlogPo sts` WHERE  `Category ID` = {$iC ategID}" ) ;   1947                db_res(  "DELETE FR OM `BlogPo sts` WHERE  `Category ID` = {$iC ategID}" ) ;
1969                $sQuery  = "DELETE  FROM `Blog Categories ` WHERE `B logCategor ies`.`Cate goryID` =  {$iCategID } LIMIT 1" ;   1948                $sQuery  = "DELETE  FROM `Blog Categories ` WHERE `B logCategor ies`.`Cate goryID` =  {$iCategID } LIMIT 1" ;
1970     1949  
1971                if ($aCa tType['Cat egoryPhoto '] != '')  {   1950                if ($aCa tType['Cat egoryPhoto '] != '')  {
1972                    @unl ink( $dir[ 'blogImage '] . 'big_ ' . $aCatT ype['Categ oryPhoto']  );   1951                    @unl ink( $dir[ 'blogImage '] . 'big_ ' . $aCatT ype['Categ oryPhoto']  );
1973                    @unl ink( $dir[ 'blogImage '] . 'smal l_' . $aCa tType['Cat egoryPhoto '] );   1952                    @unl ink( $dir[ 'blogImage '] . 'smal l_' . $aCa tType['Cat egoryPhoto '] );
1974                }   1953                }
1975     1954  
1976                db_res(  $sQuery );   1955                db_res(  $sQuery );
1977                return M sgBox(_t(' _category_ deleted')) ;   1956                return M sgBox(_t(' _category_ deleted')) ;
1978           }  elseif ($a CatType['O wnerID']!= $this->aBl ogConf['vi sitorID'])  {   1957           }  elseif ($a CatType['O wnerID']!= $this->aBl ogConf['vi sitorID'])  {
1979                return M sgBox(_t(' _Hacker St ring'));   1958                return M sgBox(_t(' _Hacker St ring'));
1980           }  else {   1959           }  else {
1981                return M sgBox(_t(' _category_ delete_fai led'));   1960                return M sgBox(_t(' _category_ delete_fai led'));
1982           }   1961           }
1983       }   1962       }
1984     1963  
1985       /**   1964       /**
1986        * Gen erate a Bl ock of sea rching res ult by Tag  (GET is t agKey)   1965        * Gen erate a Bl ock of sea rching res ult by Tag  (GET is t agKey)
1987        *   1966        *
1988        * @re turn HTML  presentati on of data   1967        * @re turn HTML  presentati on of data
1989        */   1968        */
1990       functi on GenSear chResult()  {   1969       functi on GenSear chResult()  {
1991           gl obal $site ;   1970           gl obal $site ;
1992     1971  
1993           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];   1972           $i CheckedMem berID = $t his->aBlog Conf['visi torID'];
1994           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);   1973           $s RestrictRe s = $this- >CheckRest rictionToV iew($iChec kedMemberI D);
1995           if  ($sRestri ctRes != ' ') return  $sRestrict Res;   1974           if  ($sRestri ctRes != ' ') return  $sRestrict Res;
1996     1975  
1997           $b NoProfileM ode = ( is set($_REQU EST['owner ID']) || i sset($_REQ UEST['owne rName']) )  ? false :  true;   1976           $b NoProfileM ode = ( is set($_REQU EST['owner ID']) || i sset($_REQ UEST['owne rName']) )  ? false :  true;
1998     1977  
1999           $s RetHtml =  '';   1978           $s RetHtml =  '';
2000            $sSearched Tag   =   process_db _input(   $_REQUEST[ 'tagKey']  
);
  1979            $sSearched Tag   =   process_db _input(   $_REQUEST[ 'tagKey'] ,   1   );
2001           $i MemberID =  $this->de fineUserId ();   1980           $i MemberID =  $this->de fineUserId ();
2002     1981  
2003           $s DateFormat Php = getP aram('php_ date_forma t');   1982           $s DateFormat Php = getP aram('php_ date_forma t');
2004           $s TagsC = _t ('_Tags');   1983           $s TagsC = _t ('_Tags');
2005           $s NoBlogC =  _t('_No bl ogs availa ble');   1984           $s NoBlogC =  _t('_No bl ogs availa ble');
2006     1985  
2007           $s BlogPosts  = '';   1986           $s BlogPosts  = '';
2008           $s WhereAddon  = ($iMemb erID>0) ?  "AND `Blog Categories `.`OwnerID ` = {$iMem berID}" :  '' ;   1987           $s WhereAddon  = ($iMemb erID>0) ?  "AND `Blog Categories `.`OwnerID ` = {$iMem berID}" :  '' ;
2009            $sOwnerAdd Ap   =   ($iMemberI D   ==   $ th i s->aBlog C onf['visit o rID '] )   ?   ''   :   "AND   `PostStatu s`='approv al'";   1988            $sOwnerAdd Ap   =   ($iMemberI D   ==   $
i
C heckedMemb e rID
)   ?   ''   :   "AND   `PostStatu s`='approv al'";
2010           $s BlogPostsS QL = "   1989           $s BlogPostsS QL = "
2011                SELECT ` BlogPosts` . * , `Blo gCategorie s`.`Catego ryName`, ` BlogCatego ries`.`Cat egoryUri`,  `BlogCate gories`.`C ategoryID` , `BlogCat egories`.` OwnerID` A S 'OwnID'   1990                SELECT ` BlogPosts` . * , `Blo gCategorie s`.`Catego ryName`, ` BlogCatego ries`.`Cat egoryUri`,  `BlogCate gories`.`C ategoryID` , `BlogCat egories`.` OwnerID` A S 'OwnID'
2012                FROM `Bl ogPosts`    1991                FROM `Bl ogPosts` 
2013                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID`    1992                INNER JO IN `BlogCa tegories`  ON `BlogCa tegories`. `CategoryI D` = `Blog Posts`.`Ca tegoryID` 
2014                WHERE 1    1993                WHERE 1 
2015                {$sWhere Addon}   1994                {$sWhere Addon}
2016                {$sOwner AddAp}   1995                {$sOwner AddAp}
2017           ";   1996           ";
2018           $v BlogPosts  = db_res(  $sBlogPost sSQL );   1997           $v BlogPosts  = db_res(  $sBlogPost sSQL );
2019           wh ile ( $aRe sSQL = mys ql_fetch_a ssoc($vBlo gPosts) )  {   1998           wh ile ( $aRe sSQL = mys ql_fetch_a ssoc($vBlo gPosts) )  {
2020                $sDateTi me = date(  $sDateFor matPhp, st rtotime( $ aResSQL['P ostDate']  ) );   1999                $sDateTi me = date(  $sDateFor matPhp, st rtotime( $ aResSQL['P ostDate']  ) );
2021     2000  
2022                $oCmts =  new BxDol Cmts ('blo gposts', $ aResSQL['P ostID']);   2001                $oCmts =  new BxDol Cmts ('blo gposts', $ aResSQL['P ostID']);
2023                $iCountB logComment s = $oCmts ->getObjec tCommentsC ount ();   2002                $iCountB logComment s = $oCmts ->getObjec tCommentsC ount ();
2024     2003  
2025                $sTagsCo mmas = $aR esSQL['Tag s'];   2004                $sTagsCo mmas = $aR esSQL['Tag s'];
2026                $aTags =  split(',' , $sTagsCo mmas);   2005                $aTags =  split(',' , $sTagsCo mmas);
2027     2006  
2028                if (in_a rray($sSea rchedTag,$ aTags)) {   2007                if (in_a rray($sSea rchedTag,$ aTags)) {
2029                    $sPr ofNickName  = getNick Name($aRes SQL['OwnID ']);   2008                    $sPr ofNickName  = getNick Name($aRes SQL['OwnID ']);
2030                    if ( $iMemberID  > 0){   2009                    if ( $iMemberID  > 0){
2031                         $aUser = a rray('Perm alink'=>$s ProfNickNa me, 'Link' =>$aResSQL ['OwnID']) ;   2010                         $aUser = a rray('Perm alink'=>$s ProfNickNa me, 'Link' =>$aResSQL ['OwnID']) ;
2032                    }   2011                    }
2033                    else {   2012                    else {
2034                         $aUser = ' ';   2013                         $aUser = ' ';
2035                    }   2014                    }
2036     2015  
2037                    fore ach( $aTag s as $sTag Key ) {   2016                    fore ach( $aTag s as $sTag Key ) {
2038                         $sTagLink  = $this->g enBlogLink ('search_b y_tag', $a User, '',  '', $sTagK ey);   2017                         $sTagLink  = $this->g enBlogLink ('search_b y_tag', $a User, '',  '', $sTagK ey);
2039                         $sTagsHref s .= <<<EO F   2018                         $sTagsHref s .= <<<EO F
2040   <a href="{ $sTagLink} " >{$sTagK ey}</a>&nb sp;   2019   <a href="{ $sTagLink} " >{$sTagK ey}</a>&nb sp;
2041   EOF;   2020   EOF;
2042                    }   2021                    }
2043                    $sAc tions = '' ;   2022                    $sAc tions = '' ;
2044                     if   (($ th i s->aBlog C onf['visit o rID '] ==$aBlogsR es['OwnerI D']   ||   $this->bAd minMode== TRUE )   &&   $iMemberID >0)   {   2023                     if   (($
i
C heckedMemb e rID
==$aBlogsR es['OwnerI D']   ||   $this->bAd minMode== true )   &&   $iMemberID >0)   {
2045                         $sLink = $ this->genB logFormUrl ();   2024                         $sLink = $ this->genB logFormUrl ();
2046                         $sActions  = <<<EOF   2025                         $sActions  = <<<EOF
2047   <div class ="fr">   2026   <div class ="fr">
2048            <a   href="
$sLink
"   onclick="j avascript:   UpdateFiel d('EditPos tID','{$aR esSQL['Pos tID']}');d ocument.fo rms.comman d_edit_pos t.submit() ;return   false;"   style="tex t-transfor m:none;">{ $sEditC}</ a>&nbsp;
  2027            <a   href=" { $sLink } "   onclick="j avascript:   UpdateFiel d('EditPos tID','{$aR esSQL['Pos tID']}');d ocument.fo rms.comman d_edit_pos t.submit() ;return   false;"   style="tex t-transfor m:none;">{ $sEditC}</ a>&nbsp;
2049            <a   href="
$sLink
"   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete PostID','{ $aResSQL[' PostID']}' );UpdateFi eld('DOwne rID','{$aB logsRes['O wnerID']}' );document .forms.com mand_delet e_post.sub mit();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteC} </a>
  2028            <a   href=" { $sLink } "   onclick="j avascript:   if   (confirm(' {$sSureC}' ))   {UpdateFie ld('Delete PostID','{ $aResSQL[' PostID']}' );UpdateFi eld('DOwne rID','{$aB logsRes['O wnerID']}' );document .forms.com mand_delet e_post.sub mit();   }   return   false;"   style="tex t-transfor m:none;">{ $sDeleteC} </a>
2050   </div>   2029   </div>
2051   EOF;   2030   EOF;
2052                    }   2031                    }
2053                    $sPr ofileLink  = ($iMembe rID>0) ? ' ' : "<a hr ef=".getPr ofileLink( $aResSQL[' OwnID'])." >".$sProfN ickName."< /a>";   2032                    $sPr ofileLink  = ($iMembe rID>0) ? ' ' : "<a hr ef=".getPr ofileLink( $aResSQL[' OwnID'])." >".$sProfN ickName."< /a>";
2054     2033  
2055                     $bFriend   =   is_friends (   $ th i s->aBlog C onf['visit o rID '] ,   $aResSQL[' OwnID']   );   2034                     $bFriend   =   is_friends (   $
i
C heckedMemb e rID
,   $aResSQL[' OwnID']   );
2056                     $bOwner   =   ($ th i s->aBlog C onf['visit o rID '] ==$aResSQL ['OwnID'])   ?   true   :   false;   2035                     $bOwner   =   ($
i
C heckedMemb e rID
==$aResSQL ['OwnID'])   ?   true   :   false;
2057                    if(  'friends'  == $aResSQ L['PostRea dPermissio n'] && !$b Friend &&  !$bOwner & & !$this-> bAdminMode  ) {   2036                    if(  'friends'  == $aResSQ L['PostRea dPermissio n'] && !$b Friend &&  !$bOwner & & !$this-> bAdminMode  ) {
2058                         $sMsgBox =  MsgBox(_t ('_this_bl og_only_fo r_friends' ));   2037                         $sMsgBox =  MsgBox(_t ('_this_bl og_only_fo r_friends' ));
2059                         $sBlogPost s .= <<<EO F   2038                         $sBlogPost s .= <<<EO F
2060   <div class ="clear_bo th"></div>   2039   <div class ="clear_bo th"></div>
2061       <img s rc="{$site ['icons']} lock.gif"  alt="" cla ss="marg_i con" style ="float:ri ght;positi on:relativ e;" />   2040       <img s rc="{$site ['icons']} lock.gif"  alt="" cla ss="marg_i con" style ="float:ri ght;positi on:relativ e;" />
2062       {$sMsg Box}   2041       {$sMsg Box}
2063   <div class ="clear_bo th"></div>   2042   <div class ="clear_bo th"></div>
2064   EOF;   2043   EOF;
2065                    } el se {   2044                    } el se {
2066                         $aUser = a rray('Perm alink'=>$s ProfNickNa me, 'Link' =>$aResSQL ['OwnID']) ;   2045                         $aUser = a rray('Perm alink'=>$s ProfNickNa me, 'Link' =>$aResSQL ['OwnID']) ;
2067                         $aPost = a rray('Perm alink'=>$a ResSQL['Po stUri'], ' Link'=>$aR esSQL['Pos tID']);   2046                         $aPost = a rray('Perm alink'=>$a ResSQL['Po stUri'], ' Link'=>$aR esSQL['Pos tID']);
2068                         $aCat = ar ray('Perma link'=>$aR esSQL['Cat egoryUri'] , 'Link'=> $aResSQL[' CategoryID ']);   2047                         $aCat = ar ray('Perma link'=>$aR esSQL['Cat egoryUri'] , 'Link'=> $aResSQL[' CategoryID ']);
2069     2048  
2070                         $sPostLink  = $this-> genBlogLin k('show_me mber_post' , $aUser,  '', $aPost );   2049                         $sPostLink  = $this-> genBlogLin k('show_me mber_post' , $aUser,  '', $aPost );
2071                         $sCatLink  = $this->g enBlogLink ('show_mem ber_blog',  $aUser, $ aCat, $aPo st);   2050                         $sCatLink  = $this->g enBlogLink ('show_mem ber_blog',  $aUser, $ aCat, $aPo st);
2072     2051  
    2052                         $sPostCapt ion = html specialcha rs($aResSQ L['PostCap tion']);
    2053                         $sCategory Name = htm lspecialch ars($aResS QL['Catego ryName']);
2073                         $sBlogPost s .= <<<EO F   2054                         $sBlogPost s .= <<<EO F
2074   <div class ="cls_res_ info_p1">   2055   <div class ="cls_res_ info_p1">
2075       <div c lass="cls_ res_thumb" >   2056       <div c lass="cls_ res_thumb" >
2076            <a   class="act ions"   href="
$sPostLink
">
  2057            <a   class="act ions"   href=" { $sPostLink } ">
2077                 {$ aRe s SQL[' PostCaptio n '] }     2058                 {$
s
PostCaptio n
}  
2078           </ a>   2059           </ a>
2079       </div>   2060       </div>
2080       {$sAct ions}   2061       {$sAct ions}
2081       <div c lass="clea r_both"></ div>   2062       <div c lass="clea r_both"></ div>
2082   </div>   2063   </div>
2083   <div class ="fr_small _gray_cent ered">   2064   <div class ="fr_small _gray_cent ered">
2084       {$sPro fileLink}   2065       {$sPro fileLink}
2085       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}clo ck.gif" st yle="posit ion:static ;margin-ri ght:7px;"  alt="{$sDa teTime}" / ></span>{$ sDateTime} &nbsp;   2066       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}clo ck.gif" st yle="posit ion:static ;margin-ri ght:7px;"  alt="{$sDa teTime}" / ></span>{$ sDateTime} &nbsp;
2086       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}add _comment.g if" alt="{ $sAddComme ntC}" titl e="{$sAddC ommentC}"  style="pos ition:stat ic;margin- right:7px; " /></span >{$iCountB logComment s} comment s&nbsp;   2067       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}add _comment.g if" alt="{ $sAddComme ntC}" titl e="{$sAddC ommentC}"  style="pos ition:stat ic;margin- right:7px; " /></span >{$iCountB logComment s} comment s&nbsp;
2087       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}fol der_small. png" style ="position :static;ma rgin-right :7px;" />< /span>   2068       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}fol der_small. png" style ="position :static;ma rgin-right :7px;" />< /span>
2088        <a   href="
$sCatLink
">
  2069        <a   href=" { $sCatLink } ">
2089            {$ aRe s SQL[' CategoryNa me '] }   2070            {$
s
CategoryNa me
}
2090       </a>   2071       </a>
2091   </div>   2072   </div>
2092   <div class ="cls_res_ info_p1">   2073   <div class ="cls_res_ info_p1">
2093       {$aRes SQL['PostT ext']}   2074       {$aRes SQL['PostT ext']}
2094   </div>   2075   </div>
2095   <div class ="cls_res_ info_p1">   2076   <div class ="cls_res_ info_p1">
2096       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}tag _small.png " style="p osition:st atic;margi n-right:7p x;" alt=""  /></span> {$sTagsC}: &nbsp;{$sT agsHrefs}   2077       <span  style="ver tical-alig n:middle;" ><img src= "{$site['i cons']}tag _small.png " style="p osition:st atic;margi n-right:7p x;" alt=""  /></span> {$sTagsC}: &nbsp;{$sT agsHrefs}
2097   </div>   2078   </div>
2098   <br />   2079   <br />
2099   EOF;   2080   EOF;
2100                    }   2081                    }
2101                } else {   2082                } else {
2102                    //re turn MsgBo x(_t('_Sor ry, nothin g found')) ;   2083                    //re turn MsgBo x(_t('_Sor ry, nothin g found')) ;
2103                }   2084                }
2104           }   2085           }
2105     2086  
2106           if  ($sBlogPo sts=='') {   2087           if  ($sBlogPo sts=='') {
2107                $sBlogPo sts = MsgB ox(_t('_So rry, nothi ng found') );   2088                $sBlogPo sts = MsgB ox(_t('_So rry, nothi ng found') );
2108           }   2089           }
2109           $s ContentSec t = Design BoxContent  ($sTagsC. ' - '.$sSe archedTag,  $sBlogPos ts, 1);   2090           $s ContentSec t = Design BoxContent  ($sTagsC. ' - '.$sSe archedTag,  $sBlogPos ts, 1);
2110           if  ($bNoProf ileMode ==  false) {   2091           if  ($bNoProf ileMode ==  false) {
2111                $sRightS ect='';   2092                $sRightS ect='';
2112                if ($iMe mberID>0 & & $a = $th is->GetPro fileData($ iMemberID) ) {   2093                if ($iMe mberID>0 & & $a = $th is->GetPro fileData($ iMemberID) ) {
2113                    $sBl ogsSQL = "   2094                    $sBl ogsSQL = "
2114                         SELECT `Bl ogs`. * ,  `Profiles` .`Nickname   2095                         SELECT `Bl ogs`. * ,  `Profiles` .`Nickname
2115                         FROM `Blog s`    2096                         FROM `Blog s` 
2116                         INNER JOIN  `Profiles ` ON `Blog s`.`OwnerI D` = `Prof iles`.`ID`   2097                         INNER JOIN  `Profiles ` ON `Blog s`.`OwnerI D` = `Prof iles`.`ID`
2117                         WHERE   `Blogs`.`O wnerID`   =  
{$iMemberI D}
  2098                         WHERE   `Blogs`.`O wnerID`   =   ' {$iMemberI D} '
2118                         LIMIT 1   2099                         LIMIT 1
2119                    ";   2100                    ";
2120     2101  
2121                    $aBl ogsRes = d b_arr( $sB logsSQL );   2102                    $aBl ogsRes = d b_arr( $sB logsSQL );
2122                    if ( !$aBlogsRe s) {   2103                    if ( !$aBlogsRe s) {
2123                         $sNoBlogC  = MsgBox($ sNoBlogC);   2104                         $sNoBlogC  = MsgBox($ sNoBlogC);
2124                         $sRetHtml  = <<<EOF   2105                         $sRetHtml  = <<<EOF
2125   <div>   2106   <div>
2126       <div c lass="clea r_both"></ div>   2107       <div c lass="clea r_both"></ div>
2127       <div c lass="{$sW idthClass} ">   2108       <div c lass="{$sW idthClass} ">
2128           {$ sNoBlogC}   2109           {$ sNoBlogC}
2129       </div>   2110       </div>
2130       <div c lass="clea r_both"></ div>   2111       <div c lass="clea r_both"></ div>
2131   </div>   2112   </div>
2132   <div class ="clear_bo th"></div>   2113   <div class ="clear_bo th"></div>
2133   EOF;   2114   EOF;
2134                    } el se {   2115                    } el se {
2135                         $sRightSec t = $this- >GenMember DescrAndCa t($aBlogsR es);   2116                         $sRightSec t = $this- >GenMember DescrAndCa t($aBlogsR es);
2136                         $sWidthCla ss = ($iMe mberID>0)  ? 'cls_inf o_left' :  'cls_res_t humb' ;   2117                         $sWidthCla ss = ($iMe mberID>0)  ? 'cls_inf o_left' :  'cls_res_t humb' ;
2137     2118  
2138                         $sRetHtml  = $this->T emplater($ sContentSe ct, $sRigh tSect, $sW idthClass) ;   2119                         $sRetHtml  = $this->T emplater($ sContentSe ct, $sRigh tSect, $sW idthClass) ;
2139                    }   2120                    }
2140                } else {   2121                } else {
2141                    $sRe tHtml = Ms gBox(_t('_ Profile No t found Ex '));   2122                    $sRe tHtml = Ms gBox(_t('_ Profile No t found Ex '));
2142                }   2123                }
2143           }  else {   2124           }  else {
2144                $sRetHtm l = <<<EOF   2125                $sRetHtm l = <<<EOF
2145   <div>   2126   <div>
2146       <div c lass="clea r_both"></ div>   2127       <div c lass="clea r_both"></ div>
2147       <div c lass="{$sW idthClass} ">   2128       <div c lass="{$sW idthClass} ">
2148           {$ sContentSe ct}   2129           {$ sContentSe ct}
2149       </div>   2130       </div>
2150       <div c lass="clea r_both"></ div>   2131       <div c lass="clea r_both"></ div>
2151   </div>   2132   </div>
2152   <div class ="clear_bo th"></div>   2133   <div class ="clear_bo th"></div>
2153   EOF;   2134   EOF;
2154           }   2135           }
2155           re turn $sRet Html;   2136           re turn $sRet Html;
2156       }   2137       }
2157     2138  
2158       /**   2139       /**
2159        * Gen erate a Fo rm to Crea te Blog   2140        * Gen erate a Fo rm to Crea te Blog
2160        *   2141        *
2161        * @re turn HTML  presentati on of data   2142        * @re turn HTML  presentati on of data
2162        */   2143        */
2163       functi on GenCrea teBlogForm () {   2144       functi on GenCrea teBlogForm () {
2164           $t his->Check Logged();   2145           $t his->Check Logged();
2165     2146  
2166           $s RetHtml =  '';   2147           $s RetHtml =  '';
2167           $s ActionsC =  _t('_Acti ons');   2148           $s ActionsC =  _t('_Acti ons');
2168           $s PleaseCrea teBlogC =  _t('_Pleas e, Create  a Blog');   2149           $s PleaseCrea teBlogC =  _t('_Pleas e, Create  a Blog');
2169           $s NoBlogC =  _t('_No bl ogs availa ble');   2150           $s NoBlogC =  _t('_No bl ogs availa ble');
2170           $s CreateMyBl ogC = _t(' _Create My  Blog');   2151           $s CreateMyBl ogC = _t(' _Create My  Blog');
2171           $s CreateBlog C = _t('_C reate Blog ');   2152           $s CreateBlog C = _t('_C reate Blog ');
2172           $s MyBlogC =  _t('_My Bl og');   2153           $s MyBlogC =  _t('_My Bl og');
2173           $s NewBlogDes cC = _t('_ Write a de scription  for your B log.');   2154           $s NewBlogDes cC = _t('_ Write a de scription  for your B log.');
2174     2155  
2175           $s RetHtml .=  MsgBox($s NoBlogC);   2156           $s RetHtml .=  MsgBox($s NoBlogC);
2176     2157  
2177           if  ($this->a BlogConf[' isOwner'])  {   2158           if  ($this->a BlogConf[' isOwner'])  {
2178                $sRetHtm l = MsgBox ($sPleaseC reateBlogC );   2159                $sRetHtm l = MsgBox ($sPleaseC reateBlogC );
2179                $sLink =  $this->ge nBlogFormU rl();   2160                $sLink =  $this->ge nBlogFormU rl();
2180                $sCreate BlogConten t = <<<EOF   2161                $sCreate BlogConten t = <<<EOF
2181   <div class ="padds">   2162   <div class ="padds">
2182       <a cla ss="action s" onclick ="javascri pt: docume nt.getElem entById('C reateBlogF ormDiv').s tyle.displ ay = 'bloc k';return  false;" hr ef="{$sLin k}">   2163       <a cla ss="action s" onclick ="javascri pt: docume nt.getElem entById('C reateBlogF ormDiv').s tyle.displ ay = 'bloc k';return  false;" hr ef="{$sLin k}">
2183           {$ sCreateMyB logC}   2164           {$ sCreateMyB logC}
2184       </a>   2165       </a>
2185   </div>   2166   </div>
2186   <div id="C reateBlogF ormDiv" st yle="displ ay: none;" >   2167   <div id="C reateBlogF ormDiv" st yle="displ ay: none;" >
2187       <div c lass="padd s">   2168       <div c lass="padd s">
2188           <d iv style=" font-size: 11px;">{$s NewBlogDes cC}</div>   2169           <d iv style=" font-size: 11px;">{$s NewBlogDes cC}</div>
2189       </div>   2170       </div>
2190       <form  action="{$ sLink}" me thod="post " name="Cr eateBlogFo rm">   2171       <form  action="{$ sLink}" me thod="post " name="Cr eateBlogFo rm">
2191           <i nput type= "hidden" n ame="actio n" id="act ion" value ="create_b log" />   2172           <i nput type= "hidden" n ame="actio n" id="act ion" value ="create_b log" />
2192           <t extarea na me="Descri ption" id= "Descripti on" rows=" 3" style=" width:90%; margin-bot tom:10px;"   onkeyup= "if( this. value.leng th > 255 )  this.valu e = this.v alue.subst r( 0, 255  );"></text area>   2173           <t extarea na me="Descri ption" id= "Descripti on" rows=" 3" style=" width:90%; margin-bot tom:10px;"   onkeyup= "if( this. value.leng th > 255 )  this.valu e = this.v alue.subst r( 0, 255  );"></text area>
2193           <i nput type= "submit" v alue="{$sC reateBlogC }"/>   2174           <i nput type= "submit" v alue="{$sC reateBlogC }"/>
2194       </form >   2175       </form >
2195   </div>   2176   </div>
2196   EOF;   2177   EOF;
2197     2178  
2198                $sRetHtm l .= Desig nBoxConten t ( $sActi onsC, $sCr eateBlogCo ntent, 1);   2179                $sRetHtm l .= Desig nBoxConten t ( $sActi onsC, $sCr eateBlogCo ntent, 1);
2199           }   2180           }
2200     2181  
2201           re turn Desig nBoxConten t($sMyBlog C, $sRetHt ml, 1);   2182           re turn Desig nBoxConten t($sMyBlog C, $sRetHt ml, 1);
2202       }   2183       }
2203     2184  
2204       functi on GenCent eredAction sBlock($sP icElement,  $sHrefEle ment) {   2185       functi on GenCent eredAction sBlock($sP icElement,  $sHrefEle ment) {
2205           $s ResElement  = <<<EOF   2186           $s ResElement  = <<<EOF
2206   <span clas s="icon_mi d_mr">{$sP icElement} </span>   2187   <span clas s="icon_mi d_mr">{$sP icElement} </span>
2207   <span>{$sH refElement }</span>   2188   <span>{$sH refElement }</span>
2208   EOF;   2189   EOF;
2209           re turn $sRes Element;   2190           re turn $sRes Element;
2210       }   2191       }
2211     2192  
2212       /**   2193       /**
2213        * Cre ating a Bl og   2194        * Cre ating a Bl og
2214        *   2195        *
2215        * @re turn MsgBo x result   2196        * @re turn MsgBo x result
2216        */   2197        */
2217       functi on ActionC reateBlog( ) {   2198       functi on ActionC reateBlog( ) {
2218           $t his->Check Logged();   2199           $t his->Check Logged();
2219     2200  
2220           $s ErrorC = _ t('_Error  Occured');   2201           $s ErrorC = _ t('_Error  Occured');
2221           $s Uncategori zedC = _t( '_Uncatego rized');   2202           $s Uncategori zedC = _t( '_Uncatego rized');
2222            $sDescript ion   =   $this-> process_ html_ db_input($ _POST['Des cription']  
);
  2203            $sDescript ion   =  
process_
db_input($ _POST['Des cription'] ,   1   );
2223           $i OwnID = $t his->aBlog Conf['visi torID'];   2204           $i OwnID = $t his->aBlog Conf['visi torID'];
    2205  
    2206           $s BlogsSQL =  "
    2207                SELECT ` Blogs`. *
    2208                FROM `Bl ogs` 
    2209                WHERE `B logs`.`Own erID` = '{ $iOwnID}'
    2210                LIMIT 1
    2211           ";
    2212  
    2213           $a BlogsRes =  db_arr( $ sBlogsSQL  );
    2214           if  (!$aBlogs Res) {
2224           $s CategoryUr i = uriGen erate($sUn categorize dC, 'BlogC ategories' , 'Categor yUri', 150 );   2215                $sCatego ryUri = ur iGenerate( $sUncatego rizedC, 'B logCategor ies', 'Cat egoryUri',  150);
2225     2216  
2226           $s Request =  "INSERT IN TO `Blogs`  SET `Owne rID` = '{$ iOwnID}',  `Descripti on` = '{$s Descriptio n}', `Othe r` = 'noth ing' ";   2217                $sReques t = "INSER T INTO `Bl ogs` SET ` OwnerID` =  '{$iOwnID }', `Descr iption` =  '{$sDescri ption}', ` Other` = ' nothing' " ;
2227           db _res($sReq uest, fals e);   2218                db_res($ sRequest,  false);
2228     2219  
2229           if  (mysql_af fected_row s()==1) {   2220                if (mysq l_affected _rows()==1 ) {
2230                $sAddQue ry = "INSE RT INTO `B logCategor ies` SET   2221                    $sAd dQuery = " INSERT INT O `BlogCat egories` S ET
2231                     `OwnerID`   =  
{$iOwnID}
,   `CategoryN ame`   =   '{$sUncate gorizedC}' ,   `CategoryU ri`='{$sCa tegoryUri} ',`Categor yType`   =   '5',
  2222                         `OwnerID`   =   ' {$iOwnID} ' ,   `CategoryN ame`   =   '{$sUncate gorizedC}' ,   `CategoryU ri`='{$sCa tegoryUri} ',`Categor yType`   =   '5',
2232                    `Cat egoryPhoto ` = '', `D ate` = NOW ()";   2223                         `CategoryP hoto` = '' , `Date` =  NOW()";
2233                db_res($ sAddQuery) ;   2224                    db_r es($sAddQu ery);
2234                return $ this->GenM emberBlog( $iOwnID, f alse);   2225                    retu rn $this-> GenMemberB log($iOwnI D, false);
2235           }  else {   2226                } else {
2236                return M sgBox($sEr rorC);   2227                    retu rn MsgBox( $sErrorC);
2237           }   2228                }
    2229           }  else {
    2230                return M sgBox($sEr rorC);
    2231           }
2238       }   2232       }
2239     2233  
2240       /**   2234       /**
2241        * SQL  Get all P rofiles da ta by Prof ile Id   2235        * SQL  Get all P rofiles da ta by Prof ile Id
2242        *   2236        *
2243         * @p aram $iPro fileId   2237         * @p aram $iPro fileId
2244        * @re turn SQL d ata   2238        * @re turn SQL d ata
2245        */   2239        */
2246       functi on GetProf ileData($i ProfileId)  {   2240       functi on GetProf ileData($i ProfileId)  {
2247           re turn getPr ofileInfo(  $iProfile Id );   2241           re turn getPr ofileInfo(  $iProfile Id );
2248       }   2242       }
2249     2243  
2250       /**   2244       /**
2251        * Edi ting a Des cription o f Blog   2245        * Edi ting a Des cription o f Blog
2252        *   2246        *
2253        * @re turn MsgBo x result   2247        * @re turn MsgBo x result
2254        */   2248        */
2255       functi on ActionE ditBlog()  {   2249       functi on ActionE ditBlog()  {
2256           $t his->Check Logged();   2250           $t his->Check Logged();
2257     2251  
2258            $iBlogID   =   (int) ( $_ PO ST['EditBl ogID'] ) ;   2252            $iBlogID   =   (int)
$_ REQUE ST['EditBl ogID']
;
2259     2253  
2260           $s CheckPostS QL = "SELE CT `OwnerI D`   2254           $s CheckPostS QL = "SELE CT `OwnerI D`
2261                                 FR OM `Blogs`   2255                                 FR OM `Blogs`
2262                                  WHERE   `ID`=
{$iBlogID}
  2256                                  WHERE   `ID`= ' {$iBlogID} '
2263                             ";   2257                             ";
2264           $a BlogOwner  = db_arr($ sCheckPost SQL);   2258           $a BlogOwner  = db_arr($ sCheckPost SQL);
2265           $i BlogOwner  = $aBlogOw ner['Owner ID'];   2259           $i BlogOwner  = $aBlogOw ner['Owner ID'];
2266           if  (($this-> aBlogConf[ 'visitorID '] == $iBl ogOwner ||  $this->bA dminMode)  && $iBlogI D > 0) {   2260           if  (($this-> aBlogConf[ 'visitorID '] == $iBl ogOwner ||  $this->bA dminMode)  && $iBlogI D > 0) {
2267                 $sDescript ion   =   process_db _input($_R EQUEST['De scription' ]
);
  2261                 $sDescript ion   =   process_db _input($_R EQUEST['De scription' ] ,   1 );
2268                 $sQuery   =   "UPDATE   `Blogs`   SET   `Descripti on`   =   '{$sDescri ption}'   WHERE   `Blogs`.`I D`   =  
{$iBlogID}  
LIMIT   1";
  2262                 $sQuery   =   "UPDATE   `Blogs`   SET   `Descripti on`   =   '{$sDescri ption}'   WHERE   `Blogs`.`I D`   =   ' {$iBlogID} '   LIMIT   1";
2269                db_res($ sQuery);   2263                db_res($ sQuery);
2270           }  elseif($th is->aBlogC onf['visit orID'] !=  $iBlogOwne r) {   2264           }  elseif($th is->aBlogC onf['visit orID'] !=  $iBlogOwne r) {
2271                return M sgBox(_t(' _Hacker St ring'));   2265                return M sgBox(_t(' _Hacker St ring'));
2272           }  else {   2266           }  else {
2273                return M sgBox(_t(' _Error Occ ured'));   2267                return M sgBox(_t(' _Error Occ ured'));
2274           }   2268           }
2275       }   2269       }
2276     2270  
2277       /**   2271       /**
2278        * Del eting a Fu ll Blog   2272        * Del eting a Fu ll Blog
2279        *   2273        *
2280        * @re turn MsgBo x result   2274        * @re turn MsgBo x result
2281        */   2275        */
2282       functi on ActionD eleteBlogS QL() {   2276       functi on ActionD eleteBlogS QL() {
2283           $t his->Check Logged();   2277           $t his->Check Logged();
2284           gl obal $dir;   2278           gl obal $dir;
2285     2279  
2286           $i BlogID = ( int)$_REQU EST['Delet eBlogID'];   2280           $i BlogID = ( int)$_REQU EST['Delet eBlogID'];
2287     2281  
2288           $s CheckPostS QL = "SELE CT `OwnerI D`   2282           $s CheckPostS QL = "SELE CT `OwnerI D`
2289                                 FR OM `Blogs`   2283                                 FR OM `Blogs`
2290                                  WHERE   `ID`=
{$iBlogID}
  2284                                  WHERE   `ID`= ' {$iBlogID} '
2291                             ";   2285                             ";
2292           $a BlogOwner  = db_arr($ sCheckPost SQL);   2286           $a BlogOwner  = db_arr($ sCheckPost SQL);
2293           $i BlogOwner  = $aBlogOw ner['Owner ID'];   2287           $i BlogOwner  = $aBlogOw ner['Owner ID'];
2294           if  (($this-> aBlogConf[ 'visitorID '] == $iBl ogOwner ||  $this->bA dminMode)  && $iBlogI D > 0) {   2288           if  (($this-> aBlogConf[ 'visitorID '] == $iBl ogOwner ||  $this->bA dminMode)  && $iBlogI D > 0) {
2295                //Clean  blogs   2289                //Clean  blogs
2296                $vBlogCa tegs = db_ res( "SELE CT `Catego ryID`,`Cat egoryPhoto ` FROM `Bl ogCategori es` LEFT J OIN `Blogs ` ON `Blog s`.`OwnerI D` = `Blog Categories `.`OwnerID ` WHERE `B logs`.`ID`  = {$iBlog ID} " );   2290                $vBlogCa tegs = db_ res( "SELE CT `Catego ryID`,`Cat egoryPhoto ` FROM `Bl ogCategori es` LEFT J OIN `Blogs ` ON `Blog s`.`OwnerI D` = `Blog Categories `.`OwnerID ` WHERE `B logs`.`ID`  = {$iBlog ID} " );
2297                while( $ aBlogCateg  = mysql_f etch_assoc ( $vBlogCa tegs ) ) {   2291                while( $ aBlogCateg  = mysql_f etch_assoc ( $vBlogCa tegs ) ) {
2298                    $iCa tegID = $a BlogCateg[ 'CategoryI D'];   2292                    $iCa tegID = $a BlogCateg[ 'CategoryI D'];
2299                    $vPo sts = db_r es( "SELEC T `PostID` ,`PostPhot o` FROM `B logPosts`  WHERE `Cat egoryID` =  {$iCategI D}" );   2293                    $vPo sts = db_r es( "SELEC T `PostID` ,`PostPhot o` FROM `B logPosts`  WHERE `Cat egoryID` =  {$iCategI D}" );
2300                    whil e( $aBlog  = mysql_fe tch_assoc(  $vPosts )  ) {   2294                    whil e( $aBlog  = mysql_fe tch_assoc(  $vPosts )  ) {
2301                         $iPostID =  $aBlog['P ostID'];   2295                         $iPostID =  $aBlog['P ostID'];
2302     2296  
2303                         $oCmts = n ew BxDolCm ts ('blogp osts', (in t)$iPostID );   2297                         $oCmts = n ew BxDolCm ts ('blogp osts', (in t)$iPostID );
2304                         $oCmts->on ObjectDele te ();                2298                         $oCmts->on ObjectDele te ();             
2305                           2299                        
2306                         $sFilePath Post = 'bi g_'.$aBlog ['PostPhot o'];   2300                         $sFilePath Post = 'bi g_'.$aBlog ['PostPhot o'];
2307                         if ($sFile PathPost!= '' && file _exists($d ir['blogIm age'].$sFi lePathPost ) && is_fi le($dir['b logImage'] .$sFilePat hPost))   2301                         if ($sFile PathPost!= '' && file _exists($d ir['blogIm age'].$sFi lePathPost ) && is_fi le($dir['b logImage'] .$sFilePat hPost))
2308                             @unlin k( $dir['b logImage']  . $sFileP athPost );   2302                             @unlin k( $dir['b logImage']  . $sFileP athPost );
2309                         $sFilePath Post = 'sm all_'.$aBl og['PostPh oto'];   2303                         $sFilePath Post = 'sm all_'.$aBl og['PostPh oto'];
2310                         if ($sFile PathPost!= '' && file _exists($d ir['blogIm age'].$sFi lePathPost ) && is_fi le($dir['b logImage'] .$sFilePat hPost))   2304                         if ($sFile PathPost!= '' && file _exists($d ir['blogIm age'].$sFi lePathPost ) && is_fi le($dir['b logImage'] .$sFilePat hPost))
2311                             @unlin k( $dir['b logImage']  . $sFileP athPost );   2305                             @unlin k( $dir['b logImage']  . $sFileP athPost );
2312                    }   2306                    }
2313                    db_r es( "DELET E FROM `Bl ogPosts` W HERE `Cate goryID` =  {$iCategID }" );   2307                    db_r es( "DELET E FROM `Bl ogPosts` W HERE `Cate goryID` =  {$iCategID }" );
2314                    db_r es( "DELET E FROM `Bl ogCategori es` WHERE  `CategoryI D` = {$iCa tegID}" );   2308                    db_r es( "DELET E FROM `Bl ogCategori es` WHERE  `CategoryI D` = {$iCa tegID}" );
2315     2309  
2316                    $sFi lePath = ' big_'.$aBl ogCateg['C ategoryPho to'];   2310                    $sFi lePath = ' big_'.$aBl ogCateg['C ategoryPho to'];
2317                    if ( $sFilePath !='' && fi le_exists( $dir['blog Image'].$s FilePath)  && is_file ($dir['blo gImage'].$ sFilePath) )   2311                    if ( $sFilePath !='' && fi le_exists( $dir['blog Image'].$s FilePath)  && is_file ($dir['blo gImage'].$ sFilePath) )
2318                         @unlink( $ dir['blogI mage'] . $ sFilePath  );   2312                         @unlink( $ dir['blogI mage'] . $ sFilePath  );
2319                    $sFi lePath = ' small_'.$a BlogCateg[ 'CategoryP hoto'];   2313                    $sFi lePath = ' small_'.$a BlogCateg[ 'CategoryP hoto'];
2320                    if ( $sFilePath !='' && fi le_exists( $dir['blog Image'].$s FilePath)  && is_file ($dir['blo gImage'].$ sFilePath) )   2314                    if ( $sFilePath !='' && fi le_exists( $dir['blog Image'].$s FilePath)  && is_file ($dir['blo gImage'].$ sFilePath) )
2321                         @unlink( $ dir['blogI mage'] . $ sFilePath  );   2315                         @unlink( $ dir['blogI mage'] . $ sFilePath  );
2322                }   2316                }
2323                db_res(  "DELETE FR OM `Blogs`  WHERE `ID ` = {$iBlo gID}" );   2317                db_res(  "DELETE FR OM `Blogs`  WHERE `ID ` = {$iBlo gID}" );
2324           }  elseif($th is->aBlogC onf['visit orID'] !=  $iBlogOwne r) {   2318           }  elseif($th is->aBlogC onf['visit orID'] !=  $iBlogOwne r) {
2325                return M sgBox(_t(' _Hacker St ring'));   2319                return M sgBox(_t(' _Hacker St ring'));
2326           }  else {   2320           }  else {
2327                return M sgBox(_t(' _Error Occ ured'));   2321                return M sgBox(_t(' _Error Occ ured'));
2328           }   2322           }
2329       }   2323       }
2330     2324  
2331       functi on ActionP repareForE dit($sInpu t) {   2325       functi on ActionP repareForE dit($sInpu t) {
2332           $s ResJSHTML  = addslash es(htmlspe cialchars( $sInput));   2326           $s ResJSHTML  = addslash es(htmlspe cialchars( $sInput));
2333           $s ResJSHTML  = str_repl ace( "\r\n ", '', $sR esJSHTML ) ;   2327           $s ResJSHTML  = str_repl ace( "\r\n ", '', $sR esJSHTML ) ;
2334           re turn $sRes JSHTML;   2328           re turn $sRes JSHTML;
2335       }   2329       }
2336          2330       
2337       functi on defineU serId() {   2331       functi on defineU serId() {
2338           $i MemberId =  0;   2332           $i MemberId =  0;
2339     2333  
2340           if  (isset($_ REQUEST['o wnerName'] )) {   2334           if  (isset($_ REQUEST['o wnerName'] )) {
2341                 $sNickName   =   process_db _input($_R EQUEST['ow nerName']
);
  2335                 $sNickName   =   process_db _input($_R EQUEST['ow nerName'] ,   1 );
2342                $iMember Id = (int) db_value(" SELECT `ID ` FROM `Pr ofiles` WH ERE `NickN ame`='{$sN ickName}'" );   2336                $iMember Id = (int) db_value(" SELECT `ID ` FROM `Pr ofiles` WH ERE `NickN ame`='{$sN ickName}'" );
2343           }  elseif($_R EQUEST['ow nerID']) {   2337           }  elseif($_R EQUEST['ow nerID']) {
2344                $iMember Id = (int) $_REQUEST[ 'ownerID'] ;   2338                $iMember Id = (int) $_REQUEST[ 'ownerID'] ;
2345           }   2339           }
2346     2340  
2347           if  ($this->i sPermalink Enabled()  && $iMembe rId==0 &&  $_REQUEST[ 'action']  == 'show_m ember_post ') {   2341           if  ($this->i sPermalink Enabled()  && $iMembe rId==0 &&  $_REQUEST[ 'action']  == 'show_m ember_post ') {
2348                //need f ind member ID   2342                //need f ind member ID
2349     2343  
2350                 $sPostUri   =   process_db _input($_R EQUEST['po stUri']
);
  2344                 $sPostUri   =   process_db _input($_R EQUEST['po stUri'] ,   1 );
2351                $sqlQuer y = "SELEC T `PostID`  FROM `Blo gPosts` WH ERE `PostU ri`='{$sPo stUri}'";   2345                $sqlQuer y = "SELEC T `PostID`  FROM `Blo gPosts` WH ERE `PostU ri`='{$sPo stUri}'";
2352                $iPostID  = (int)db _value($sq lQuery);   2346                $iPostID  = (int)db _value($sq lQuery);
2353                $sPosted BySQL = "   2347                $sPosted BySQL = "
2354                    SELE CT `BlogCa tegories`. `OwnerID`  FROM `Blog Categories `   2348                    SELE CT `BlogCa tegories`. `OwnerID`  FROM `Blog Categories `
2355                    INNE R JOIN `Bl ogPosts` O N `BlogCat egories`.` CategoryID `=`BlogPos ts`.`Categ oryID`   2349                    INNE R JOIN `Bl ogPosts` O N `BlogCat egories`.` CategoryID `=`BlogPos ts`.`Categ oryID`
2356                    WHER E `BlogPos ts`.`PostI D` = {$iPo stID}   2350                    WHER E `BlogPos ts`.`PostI D` = {$iPo stID}
2357                    LIMI T 1   2351                    LIMI T 1
2358                ";   2352                ";
2359                $aPostBy  = db_arr( $sPostedBy SQL);   2353                $aPostBy  = db_arr( $sPostedBy SQL);
2360                $iMember Id = $aPos tBy['Owner ID'];   2354                $iMember Id = $aPos tBy['Owner ID'];
2361           }   2355           }
2362           re turn $iMem berId;   2356           re turn $iMem berId;
2363       }   2357       }
2364          2358       
2365       functi on defineC ategoryId( ) {   2359       functi on defineC ategoryId( ) {
2366           $i Cat = 0;   2360           $i Cat = 0;
2367     2361  
2368           if  (isset($_ REQUEST['c ategoryUri '])) {   2362           if  (isset($_ REQUEST['c ategoryUri '])) {
2369                 $sCategory   =   process_db _input($_R EQUEST['ca tegoryUri' ]
);
  2363                 $sCategory   =   process_db _input($_R EQUEST['ca tegoryUri' ] ,   1 );
2370                $iCat =  db_value(" SELECT `Ca tegoryID`  FROM `Blog Categories ` WHERE `C ategoryUri `='{$sCate gory}'");   2364                $iCat =  db_value(" SELECT `Ca tegoryID`  FROM `Blog Categories ` WHERE `C ategoryUri `='{$sCate gory}'");
2371           }  elseif (is set($_REQU EST['categ ory'])) {   2365           }  elseif (is set($_REQU EST['categ ory'])) {
2372                $iCat =  (int)$_REQ UEST['cate gory'];   2366                $iCat =  (int)$_REQ UEST['cate gory'];
2373           }   2367           }
2374     2368  
2375           re turn $iCat ;   2369           re turn $iCat ;
2376       }   2370       }
2377          2371       
2378       functi on isPerma linkEnable d() {   2372       functi on isPerma linkEnable d() {
2379           $b Enabled =  isset($thi s->_isPerm alinkEnabl ed) ? $thi s->_isPerm alinkEnabl ed : ($thi s->_isPerm alinkEnabl ed = (getP aram('perm alinks_blo gs') == 'o n'));   2373           $b Enabled =  isset($thi s->_isPerm alinkEnabl ed) ? $thi s->_isPerm alinkEnabl ed : ($thi s->_isPerm alinkEnabl ed = (getP aram('perm alinks_blo gs') == 'o n'));
2380           if  ($this->b AdminMode)  $bEnabled  = false;   2374           if  ($this->b AdminMode)  $bEnabled  = false;
2381           re turn $bEna bled;   2375           re turn $bEna bled;
2382       }   2376       }
2383          2377       
2384       functi on genBlog FormUrl()  {   2378       functi on genBlog FormUrl()  {
2385           gl obal $site ;   2379           gl obal $site ;
2386           $s MainLink =  ($_SERVER ['PHP_SELF '] != 'pos t_mod_blog .php') ? ' blogs.php'  : $site[' url_admin' ] . 'post_ mod_blog.p hp';   2380           $s MainLink =  ($_SERVER ['PHP_SELF '] != 'pos t_mod_blog .php') ? ' blogs.php'  : $site[' url_admin' ] . 'post_ mod_blog.p hp';
2387           if  ($this->b AdminMode)  $sMainLin k = $site[ 'url_admin '] . 'post _mod_blog. php';   2381           if  ($this->b AdminMode)  $sMainLin k = $site[ 'url_admin '] . 'post _mod_blog. php';
2388     2382  
2389           $s Link = $th is->isPerm alinkEnabl ed() ? $GL OBALS['sit e']['url'] .'blogs/'  : $sMainLi nk ;   2383           $s Link = $th is->isPerm alinkEnabl ed() ? $GL OBALS['sit e']['url'] .'blogs/'  : $sMainLi nk ;
2390           re turn $sLin k;   2384           re turn $sLin k;
2391       }   2385       }
2392          2386       
2393       functi on genBlog Link($sAct ion, $aUse r = array( ), $aCateg ory = arra y(), $aPos t = array( ), $sTag =  '') {                  2387       functi on genBlog Link($sAct ion, $aUse r = array( ), $aCateg ory = arra y(), $aPos t = array( ), $sTag =  '') {               
2394           $s Key = '';   2388           $s Key = '';
2395           $a Service =  array();   2389           $a Service =  array();
2396           if  ($this->i sPermalink Enabled())  {   2390           if  ($this->i sPermalink Enabled())  {
2397                $sKey =  'Permalink ';   2391                $sKey =  'Permalink ';
2398     2392  
2399                $aServic e['User']  = '';   2393                $aServic e['User']  = '';
2400                $aServic e['Categor y'] = 'cat egory/';   2394                $aServic e['Categor y'] = 'cat egory/';
2401                $aServic e['Post']  = '';   2395                $aServic e['Post']  = '';
2402                $aServic e['Tag'] =  '';   2396                $aServic e['Tag'] =  '';
2403           }  else {   2397           }  else {
2404                $sKey =  'Link';   2398                $sKey =  'Link';
2405     2399  
2406                $aServic e['User']  = 'ownerID =';   2400                $aServic e['User']  = 'ownerID =';
2407                $aServic e['Categor y'] = 'cat egory=';   2401                $aServic e['Categor y'] = 'cat egory=';
2408                $aServic e['Post']  = 'post_id =';   2402                $aServic e['Post']  = 'post_id =';
2409                $aServic e['Tag'] =  'tagKey=' ;   2403                $aServic e['Tag'] =  'tagKey=' ;
2410           }   2404           }
2411     2405  
2412           $s MainLink =  $this->ge nBlogFormU rl();   2406           $s MainLink =  $this->ge nBlogFormU rl();
2413     2407  
2414           sw itch($sAct ion) {   2408           sw itch($sAct ion) {
2415                case 'sh ow_member_ blog_home' :   2409                case 'sh ow_member_ blog_home' :
2416                    $aAc tion = arr ay('Permal ink'=>'pos ts/{User}' , 'Link'=> '?action=s how_member _blog&{Use r}');   2410                    $aAc tion = arr ay('Permal ink'=>'pos ts/{User}' , 'Link'=> '?action=s how_member _blog&{Use r}');
2417                    brea k;   2411                    brea k;
2418                case 'sh ow_member_ blog':   2412                case 'sh ow_member_ blog':
2419                    $aAc tion = arr ay('Permal ink'=>'pos ts/{User}/ {Category} ', 'Link'= >'?action= show_membe r_blog&{Us er}&{Categ ory}');   2413                    $aAc tion = arr ay('Permal ink'=>'pos ts/{User}/ {Category} ', 'Link'= >'?action= show_membe r_blog&{Us er}&{Categ ory}');
2420                    brea k;   2414                    brea k;
2421                case 'sh ow_member_ post':   2415                case 'sh ow_member_ post':
2422                    $aAc tion = arr ay('Permal ink'=>'ent ry/{Post}' , 'Link'=> '?action=s how_member _post&{Use r}&{Post}' );   2416                    $aAc tion = arr ay('Permal ink'=>'ent ry/{Post}' , 'Link'=> '?action=s how_member _post&{Use r}&{Post}' );
2423                    brea k;   2417                    brea k;
2424                case 'se arch_by_ta g':   2418                case 'se arch_by_ta g':
2425                    if ( $aUser) {   2419                    if ( $aUser) {
2426                         $aAction =  array('Pe rmalink'=> 'posts/{Us er}/tag/{T ag}', 'Lin k'=>'?acti on=search_ by_tag&{Ta g}&{User}' );   2420                         $aAction =  array('Pe rmalink'=> 'posts/{Us er}/tag/{T ag}', 'Lin k'=>'?acti on=search_ by_tag&{Ta g}&{User}' );
2427                    } el se {   2421                    } el se {
2428                         $aAction =  array('Pe rmalink'=> 'tag/{Tag} ', 'Link'= >'?action= search_by_ tag&{Tag}' );   2422                         $aAction =  array('Pe rmalink'=> 'tag/{Tag} ', 'Link'= >'?action= search_by_ tag&{Tag}' );
2429                    }   2423                    }
2430                    brea k;   2424                    brea k;
2431                default  :   2425                default  :
2432                    brea k;   2426                    brea k;
2433           }   2427           }
2434           $a Final = ar ray();   2428           $a Final = ar ray();
2435     2429  
2436           $a Final['Use r'] = $aUs er ? $aSer vice['User '] . $aUse r[$sKey] :  '';   2430           $a Final['Use r'] = $aUs er ? $aSer vice['User '] . $aUse r[$sKey] :  '';
2437           $a Final['Cat egory'] =  $aCategory  ? $aServi ce['Catego ry'] . $aC ategory[$s Key] : '';   2431           $a Final['Cat egory'] =  $aCategory  ? $aServi ce['Catego ry'] . $aC ategory[$s Key] : '';
2438           $a Final['Pos t'] = $aPo st ? $aSer vice['Post '] . $aPos t[$sKey] :  '';   2432           $a Final['Pos t'] = $aPo st ? $aSer vice['Post '] . $aPos t[$sKey] :  '';
2439           $a Final['Tag '] = strle n($sTag) >  0 ? $aSer vice['Tag' ] . $sTag  : '';   2433           $a Final['Tag '] = strle n($sTag) >  0 ? $aSer vice['Tag' ] . $sTag  : '';
2440     2434  
2441           $s Link = $aA ction[$sKe y];   2435           $s Link = $aA ction[$sKe y];
2442     2436  
2443           fo reach ($aF inal as $s Key => $sV al) {   2437           fo reach ($aF inal as $s Key => $sV al) {
2444                $sLink =  str_repla ce('{'.$sK ey.'}', $s Val, $sLin k);   2438                $sLink =  str_repla ce('{'.$sK ey.'}', $s Val, $sLin k);
2445           }   2439           }
2446     2440  
2447           re turn $sMai nLink.trim ($sLink,'/ &');   2441           re turn $sMai nLink.trim ($sLink,'/ &');
2448       }   2442       }
2449     2443  
2450       functi on GenAnyB lockConten t($sOrder= 'last', $i ProfileID= 0, $sLimit ="LIMIT 5"  ) {   2444       functi on GenAnyB lockConten t($sOrder= 'last', $i ProfileID= 0, $sLimit ="LIMIT 5"  ) {
2451           gl obal $site ;   2445           gl obal $site ;
2452           gl obal $shor t_date_for mat;   2446           gl obal $shor t_date_for mat;
2453     2447  
2454           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );   2448           $p hp_date_fo rmat = get Param( 'ph p_date_for mat' );
2455           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;   2449           $i BlogLimitC hars = (in t)getParam ("max_blog _preview") ;
2456           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );   2450           $s ClockIcon  = getTempl ateIcon( ' clock.gif'  );
2457     2451  
2458           $s OrderS = ' ';   2452           $s OrderS = ' ';
2459           sw itch ($sOr der) {   2453           sw itch ($sOr der) {
2460                case 'la st':   2454                case 'la st':
2461                    $sOr derS = "OR DER BY `Bl ogPosts`.` PostDate`  DESC";    
2462                    brea k;    
2463                case 'la test':   2455                case 'la test':
2464                    $sOr derS = "OR DER BY `Bl ogPosts`.` PostDate`  DESC";   2456                    $sOr derS = "OR DER BY `Bl ogPosts`.` PostDate`  DESC";
2465                    brea k;   2457                    brea k;
2466                case 'ra nd':   2458                case 'ra nd':
2467                    $sOr derS = "OR DER BY RAN D()";   2459                    $sOr derS = "OR DER BY RAN D()";
2468                    brea k;   2460                    brea k;
2469                case 'to p':   2461                case 'to p':
2470                    $sOr derS = "OR DER BY `Co mmentsNum`  DESC";   2462                    $sOr derS = "OR DER BY `Co mmentsNum`  DESC";
2471                    brea k;   2463                    brea k;
2472           }   2464           }
2473           $s ProfileS =  ($iProfil eID>0) ? " `BlogCateg ories`.`Ow nerID`  =  '{$iProfil eID}'" : ' 1';   2465           $s ProfileS =  ($iProfil eID>0) ? " `BlogCateg ories`.`Ow nerID`  =  '{$iProfil eID}'" : ' 1';
2474     2466  
2475           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;   2467           $o Cmts = new  BxDolCmts  ('blogpos ts', 0, 0) ;
2476     2468  
2477           $s Query = "   2469           $s Query = "
2478                SELECT D ISTINCT   2470                SELECT D ISTINCT
2479                    `Blo gPosts`.`P ostID`,   2471                    `Blo gPosts`.`P ostID`,
2480                    `Blo gPosts`.`C ategoryID` ,   2472                    `Blo gPosts`.`C ategoryID` ,
2481                    `Blo gCategorie s`.`OwnerI D`,   2473                    `Blo gCategorie s`.`OwnerI D`,
2482                    `Blo gPosts`.`P ostText`,   2474                    `Blo gPosts`.`P ostText`,
2483                    UNIX _TIMESTAMP ( `BlogPos ts`.`PostD ate` ) AS  `PostDate_ f`,   2475                    UNIX _TIMESTAMP ( `BlogPos ts`.`PostD ate` ) AS  `PostDate_ f`,
2484                    `Blo gPosts`.`P ostCaption `,   2476                    `Blo gPosts`.`P ostCaption `,
2485                    `Blo gPosts`.`P ostUri`,   2477                    `Blo gPosts`.`P ostUri`,
2486                    `Blo gCategorie s`.`Catego ryName`,   2478                    `Blo gCategorie s`.`Catego ryName`,
2487                    `Blo gCategorie s`.`Catego ryUri`,   2479                    `Blo gCategorie s`.`Catego ryUri`,
2488                    `Pro files`.`ID ` AS `Prof ID`,   2480                    `Pro files`.`ID ` AS `Prof ID`,
2489                    `Pro files`.`Ni ckName` AS  `NickName `,   2481                    `Pro files`.`Ni ckName` AS  `NickName `,
2490                    COUN T( `tc`.`c mt_id` ) A S `Comment sNum`   2482                    COUN T( `tc`.`c mt_id` ) A S `Comment sNum`
2491                FROM `Bl ogCategori es`   2483                FROM `Bl ogCategori es`
2492                LEFT JOI N `BlogPos ts`   2484                LEFT JOI N `BlogPos ts`
2493                    ON ` BlogPosts` .`Category ID` = `Blo gCategorie s`.`Catego ryID`   2485                    ON ` BlogPosts` .`Category ID` = `Blo gCategorie s`.`Catego ryID`
2494                INNER JO IN `Profil es`   2486                INNER JO IN `Profil es`
2495                    ON ` BlogCatego ries`.`Own erID` = `P rofiles`.` ID`   2487                    ON ` BlogCatego ries`.`Own erID` = `P rofiles`.` ID`
2496                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON   2488                LEFT JOI N `" . $oC mts->getCo mmentsTabl eName() .  "` AS `tc`  ON
2497                    `Blo gPosts`.`P ostID` = ` tc`.`cmt_o bject_id`   2489                    `Blo gPosts`.`P ostID` = ` tc`.`cmt_o bject_id`
2498                WHERE   2490                WHERE
2499                    {$sP rofileS} A ND   2491                    {$sP rofileS} A ND
2500                    `Blo gPosts`.`P ostReadPer mission` =  'public'  AND   2492                    `Blo gPosts`.`P ostReadPer mission` =  'public'  AND
2501                    `Blo gPosts`.`P ostStatus`  = 'approv al'   2493                    `Blo gPosts`.`P ostStatus`  = 'approv al'
2502                GROUP BY  `BlogPost s`.`PostID `   2494                GROUP BY  `BlogPost s`.`PostID `
2503                {$sOrder S}   2495                {$sOrder S}
2504                {$sLimit }   2496                {$sLimit }
2505           ";   2497           ";
2506     2498  
2507           $r Blogs = db _res( $sQu ery );   2499           $r Blogs = db _res( $sQu ery );
2508     2500  
2509           if ( !mysql_n um_rows( $ rBlogs ) )   2501           if ( !mysql_n um_rows( $ rBlogs ) )
2510                return M sgBox(_t(  '_Sorry, n othing fou nd' ));   2502                return M sgBox(_t(  '_Sorry, n othing fou nd' ));
2511     2503  
2512           $s Blocks = ' ';   2504           $s Blocks = ' ';
2513           wh ile( $aBlo g = mysql_ fetch_asso c( $rBlogs  ) ) {   2505           wh ile( $aBlo g = mysql_ fetch_asso c( $rBlogs  ) ) {
2514                $sLinkMo re = '';   2506                $sLinkMo re = '';
2515     2507  
2516                $aUser =  array('Pe rmalink'=> $aBlog['Ni ckName'],  'Link'=>$a Blog['Owne rID']);   2508                $aUser =  array('Pe rmalink'=> $aBlog['Ni ckName'],  'Link'=>$a Blog['Owne rID']);
2517                $aPost =  array('Pe rmalink'=> $aBlog['Po stUri'], ' Link'=>$aB log['PostI D']);   2509                $aPost =  array('Pe rmalink'=> $aBlog['Po stUri'], ' Link'=>$aB log['PostI D']);
2518                $aCat =  array('Per malink'=>$ aBlog['Cat egoryUri'] , 'Link'=> $aBlog['Ca tegoryID'] );   2510                $aCat =  array('Per malink'=>$ aBlog['Cat egoryUri'] , 'Link'=> $aBlog['Ca tegoryID'] );
2519                   2511                
2520                $sLinkMo reUrl = $t his->genBl ogLink('sh ow_member_ post', $aU ser, '', $ aPost);   2512                $sLinkMo reUrl = $t his->genBl ogLink('sh ow_member_ post', $aU ser, '', $ aPost);
2521                $sCatLin k = $this- >genBlogLi nk('show_m ember_blog ', $aUser,  $aCat);   2513                $sCatLin k = $this- >genBlogLi nk('show_m ember_blog ', $aUser,  $aCat);
2522     2514  
2523                if ( str len( $aBlo g['PostTex t']) > $iB logLimitCh ars ) {   2515                if ( str len( $aBlo g['PostTex t']) > $iB logLimitCh ars ) {
2524                    $sLi nkMore = " ... <a hre f=\"".$sLi nkMoreUrl. "\">"._t(' _Read more ')."</a>";   2516                    $sLi nkMore = " ... <a hre f=\"".$sLi nkMoreUrl. "\">"._t(' _Read more ')."</a>";
2525                }   2517                }
2526     2518  
2527                $sBlogSn ippet = mb _substr( s trip_tags(  $aBlog['P ostText']  ), 0, $iBl ogLimitCha rs ) . $sL inkMore;   2519                $sBlogSn ippet = mb _substr( s trip_tags(  $aBlog['P ostText']  ), 0, $iBl ogLimitCha rs ) . $sL inkMore;
2528                //$sData TimeFormat ted = date ( $php_dat e_format,  $aBlog['Po stDate_f']  );    
2529                $sDataTi meFormatte d = Locale dDataTime(  $aBlog['P ostDate_f' ] );   2520                $sDataTi meFormatte d = Locale dDataTime(  $aBlog['P ostDate_f' ] );
2530                $sCategF  = _t( '_i n Category ', getTemp lateIcon(  'folder_sm all.png' ) , $sCatLin k, $aBlog[ 'CategoryN ame'] );   2521                $sCategF  = _t( '_i n Category ', getTemp lateIcon(  'folder_sm all.png' ) , $sCatLin k, $aBlog[ 'CategoryN ame'] );
2531                $sCommF  = _t( '_co mments N',  getTempla teIcon( 'a dd_comment .gif' ), $ aBlog['Com mentsNum']  );   2522                $sCommF  = _t( '_co mments N',  getTempla teIcon( 'a dd_comment .gif' ), $ aBlog['Com mentsNum']  );
2532     2523  
2533                $sProfil eF = ($iPr ofileID>0)  ? '' : '< span>' . _ t( '_By Au thor', $aB log['NickN ame'], $aB log['NickN ame'] ).'< /span>';   2524                $sProfil eF = ($iPr ofileID>0)  ? '' : '< span>' . _ t( '_By Au thor', $aB log['NickN ame'], $aB log['NickN ame'] ).'< /span>';
2534     2525  
    2526                $sPostCa ption = ht mlspecialc hars($aBlo g['PostCap tion']);
2535                $sBlocks  .= <<<EOF   2527                $sBlocks  .= <<<EOF
2536   <div class ="blogBloc k">   2528   <div class ="blogBloc k">
2537       <div c lass="blog Head">   2529       <div c lass="blog Head">
2538           <a  href="{$s LinkMoreUr l}" class= "bottom_te xt">   2530           <a  href="{$s LinkMoreUr l}" class= "bottom_te xt">
2539                 {$ aBlog[' PostCaptio n '] }   2531                 {$ s PostCaptio n
}
2540           </ a>   2532           </ a>
2541       </div>   2533       </div>
2542       <div c lass="blog Info">   2534       <div c lass="blog Info">
2543           {$ sProfileF}   2535           {$ sProfileF}
2544           <s pan><img s rc="{$sClo ckIcon}" a lt="" />{$ sDataTimeF ormatted}< /span>   2536           <s pan><img s rc="{$sClo ckIcon}" a lt="" />{$ sDataTimeF ormatted}< /span>
2545           <s pan>{$sCat egF} </spa n>   2537           <s pan>{$sCat egF} </spa n>
2546           <s pan>{$sCom mF}</span>   2538           <s pan>{$sCom mF}</span>
2547       </div>   2539       </div>
2548       <div c lass="blog Snippet">   2540       <div c lass="blog Snippet">
2549           {$ sBlogSnipp et}   2541           {$ sBlogSnipp et}
2550       </div>   2542       </div>
2551   </div>   2543   </div>
2552   <div class ="clear_bo th"></div>   2544   <div class ="clear_bo th"></div>
2553   EOF;   2545   EOF;
2554           }   2546           }
2555     2547  
2556           if  ($sBlocks  == '') $s Blocks = M sgBox(_t(' _Sorry, no thing foun d'));   2548           if  ($sBlocks  == '') $s Blocks = M sgBox(_t(' _Sorry, no thing foun d'));
2557           re turn $sBlo cks;   2549           re turn $sBlo cks;
2558       }   2550       }
2559     2551  
2560       functi on Templat er($sPosts Sect, $sRi ghtSect, $ sWidthClas s = 'cls_i nfo_left')  {   2552       functi on Templat er($sPosts Sect, $sRi ghtSect, $ sWidthClas s = 'cls_i nfo_left')  {
2561           $s RetHtml =  <<<EOF   2553           $s RetHtml =  <<<EOF
2562   <div>   2554   <div>
2563       <div c lass="clea r_both"></ div>   2555       <div c lass="clea r_both"></ div>
2564       <div c lass="cls_ info_left" >   2556       <div c lass="cls_ info_left" >
2565           {$ sPostsSect }   2557           {$ sPostsSect }
2566       </div>   2558       </div>
2567       <div c lass="cls_ info">   2559       <div c lass="cls_ info">
2568           {$ sRightSect }   2560           {$ sRightSect }
2569       </div>   2561       </div>
2570       <div c lass="clea r_both"></ div>   2562       <div c lass="clea r_both"></ div>
2571   </div>   2563   </div>
2572   <div class ="clear_bo th"></div>   2564   <div class ="clear_bo th"></div>
2573   EOF;   2565   EOF;
2574           re turn $sRet Html;   2566           re turn $sRet Html;
2575       }   2567       }
2576     2568  
2577       /* com mon featur es functio n   2569       /* com mon featur es functio n
2578       */   2570       */
2579       functi on process _html_db_i nput( $sTe xt ) {   2571       functi on process _html_db_i nput( $sTe xt ) {
2580           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));   2572           re turn addsl ashes( cle ar_xss( tr im( proces s_pass_dat a( $sText  ))));
2581       }   2573       }
    2574       /*func tion proce ss_txt_db_ input( $sT ext ) {
    2575           re turn addsl ashes( str ip_tags( t rim( proce ss_pass_da ta( $sText  ))));
    2576       }*/
    2577       //html specialcha rs output
2582   }   2578   }
2583     2579  
2584   ?>   2580   ?>