32. File Comparison Report

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

32.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc\classes BxDolBlogs.php Mon May 12 07:03:58 2008 UTC
2 Dolphin-v.6.1.2\inc\classes BxDolBlogs.php Mon Jun 16 05:18:35 2008 UTC

32.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 32 5062
Changed 26 69
Inserted 4 21
Removed 1 1

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

32.4 Active regular expressions

No regular expressions were active.

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