186. File Comparison Report

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

186.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\inc\classes BxDolBlogs.php Wed Mar 5 05:31:24 2008 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolBlogs.php Sat Apr 26 08:19:14 2008 UTC

186.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 171 3946
Changed 100 354
Inserted 50 442
Removed 20 74

186.3 Comparison options

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

186.4 Active regular expressions

No regular expressions were active.

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