Go to the documentation of this file.
    8 require_once( CH_DIRECTORY_PATH_CLASSES . 
'ChWsbDb.php' );
 
   19         parent::__construct();
 
   21         $this->_oConfig = $oConfig;
 
   26         $sSql = 
"SELECT `ID` AS `id`, `Name` AS `name` FROM `sys_acl_actions` WHERE `Name`='use blog' OR `Name`='view blog'";
 
   27         return $this->
getAll($sSql);
 
   34             FROM `{$this->_oConfig->sSQLPostsTable}` 
   35             WHERE `PostID`='{$iPostID}' 
   43             SELECT `PostCaption`, `PostUri` 
   44             FROM `{$this->_oConfig->sSQLPostsTable}` 
   54             FROM `{$this->_oConfig->sSQLPostsTable}` 
   55             WHERE `PostUri`='{$sPostUri}' 
   63             SELECT COUNT(DISTINCT(`{$this->_oConfig->sSQLBlogsTable}`.`ID`)) AS 'Cnt' 
   64             FROM `{$this->_oConfig->sSQLBlogsTable}` 
   65             INNER JOIN `{$this->_oConfig->sSQLPostsTable}` ON `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID` 
   66             WHERE {$sStatusFilter} 
   68         return $this->
getOne($sBlogsSQL);
 
   74             SELECT `{$this->_oConfig->sSQLBlogsTable}`.`ID`, `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID`, `{$this->_oConfig->sSQLBlogsTable}`.`Description`, COUNT(`{$this->_oConfig->sSQLPostsTable}`.`PostID`) AS 'PostCount' 
   75             FROM `{$this->_oConfig->sSQLBlogsTable}` 
   76             INNER JOIN `{$this->_oConfig->sSQLPostsTable}` ON `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID` 
   77             WHERE {$sStatusFilter} 
   78             GROUP BY `{$this->_oConfig->sSQLBlogsTable}`.`ID` 
   79             ORDER BY `PostCount` DESC 
   82         $vBlogsRes = 
db_res($sBlogsSQL);
 
   89             SELECT `{$this->_oConfig->sSQLBlogsTable}`.`ID`, `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID`, `{$this->_oConfig->sSQLBlogsTable}`.`Description`, COUNT(`{$this->_oConfig->sSQLPostsTable}`.`PostID`) AS 'PostCount' 
   90             FROM `{$this->_oConfig->sSQLBlogsTable}` 
   91             INNER JOIN `{$this->_oConfig->sSQLPostsTable}` ON `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID` 
   92             WHERE {$sStatusFilter} 
   93             GROUP BY `{$this->_oConfig->sSQLBlogsTable}`.`ID` 
   94             ORDER BY `PostDate` DESC 
   98         $vBlogsRes = 
db_res( $sBlogsSQL );
 
  104         $sCategJoin = $sCategFilter = 
'';
 
  105         if ($sCategoryName != 
'') {
 
  107                 LEFT JOIN `{$this->_oConfig->sSQLCategoriesTable}` ON `{$this->_oConfig->sSQLCategoriesTable}`.`ID` = `{$this->_oConfig->sSQLPostsTable}`.`PostID` 
  110                 AND `{$this->_oConfig->sSQLCategoriesTable}`.`Category` = '{$sCategoryName}' AND {$this->_oConfig->sSQLCategoriesTable}`.`Type`='ch_blogs' 
  117             FROM `{$this->_oConfig->sSQLPostsTable}` 
  120                 `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = {$iMemberID} 
  124         $vTags = 
db_res($sPostsSQL);
 
  130         $sCategJoin = $sCategFilter = 
'';
 
  131         if ($sCategoryName != 
'') {
 
  133                 LEFT JOIN `{$this->_oConfig->sSQLCategoriesTable}` ON `{$this->_oConfig->sSQLCategoriesTable}`.`ID` = `{$this->_oConfig->sSQLPostsTable}`.`PostID` 
  136                 AND `{$this->_oConfig->sSQLCategoriesTable}`.`Category` = '{$sCategoryName}' AND `{$this->_oConfig->sSQLCategoriesTable}`.`Type`='ch_blogs' 
  142             FROM `{$this->_oConfig->sSQLPostsTable}` 
  147                 AND `{$this->_oConfig->sSQLPostsTable}`.`OwnerID`='{$iOwnerID}' 
  148             ORDER BY `PostDate` ASC 
  150         $vPostsInCat = 
db_res($sPostsSQL);
 
  153         while ($aPost = $vPostsInCat->fetch()) {
 
  154             $aPosts[] = (int)$aPost[
'PostID'];
 
  162             LEFT JOIN `{$this->_oConfig->sSQLCategoriesTable}` ON `{$this->_oConfig->sSQLCategoriesTable}`.`ID` = `{$this->_oConfig->sSQLPostsTable}`.`PostID` 
  165             AND `{$this->_oConfig->sSQLCategoriesTable}`.`Category` = '{$sCategoryName}' AND `{$this->_oConfig->sSQLCategoriesTable}`.`Type`='ch_blogs' 
  168         $sCountPostCatSQL = 
" 
  170             FROM `{$this->_oConfig->sSQLPostsTable}` 
  174             AND `{$this->_oConfig->sSQLPostsTable}`.`OwnerID`='{$iOwnerID}' 
  178         $iCountCatPost = (int)$this->
getOne($sCountPostCatSQL);
 
  179         return $iCountCatPost;
 
  185             SELECT `{$this->_oConfig->sSQLPostsTable}`.* 
  186             FROM `{$this->_oConfig->sSQLPostsTable}` 
  187             WHERE `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = {$iMemberID} AND `{$this->_oConfig->sSQLPostsTable}`.`Featured`='1' 
  188             ORDER BY `PostDate` DESC 
  190         $vFeaturedPosts = 
db_res($sFeaturedSQL);
 
  191         return $vFeaturedPosts;
 
  197             UPDATE `{$this->_oConfig->sSQLPostsTable}` 
  198             SET `PostStatus`='{$sStatus}' 
  199             WHERE `PostID`='{$iPostID}' 
  201         return $this->
query($sUpdateSQL);
 
  207             SELECT * FROM `{$this->_oConfig->sSQLBlogsTable}` 
  208             WHERE `{$this->_oConfig->sSQLBlogsTable}`.`OwnerID` = ? 
  212         return $this->
getRow($sBlogsSQL, [$iMemberID]);
 
  218             SELECT `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` 
  219             FROM `{$this->_oConfig->sSQLPostsTable}` 
  220             WHERE `PostID`='{$iPostID}' 
  222         $iOwnerID = $this->
getOne($sCheckPostSQL);
 
  230             FROM `{$this->_oConfig->sSQLBlogsTable}` 
  231             WHERE `ID`='{$iBlogID}' 
  233         $iOwnerID = $this->
getOne($sCheckSQL);
 
  239         $sPhotosSQL = 
"SELECT `PostPhoto` FROM `{$this->_oConfig->sSQLPostsTable}` WHERE `PostID` = '{$iPostID}' LIMIT 1";
 
  240         $sFileName = $this->
getOne($sPhotosSQL);
 
  247             UPDATE `{$this->_oConfig->sSQLPostsTable}` SET 
  248             `PostPhoto`='{$sPhotoFilename}' 
  249             WHERE `PostID`='{$iPostID}' 
  252         $vSqlRes = 
db_res($sUpdateSQL);
 
  258         $sDelSQL = 
"DELETE FROM `{$this->_oConfig->sSQLPostsTable}` WHERE `{$this->_oConfig->sSQLPostsTable}`.`PostID` = '{$iPostID}' LIMIT 1";
 
  259         $vSqlRes = 
db_res($sDelSQL);
 
  265         $sPostIdSQL = 
"SELECT `PostID` FROM `{$this->_oConfig->sSQLPostsTable}` WHERE `PostUri`='{$sPostUri}'";
 
  266         $iPostID = (int)$this->
getOne($sPostIdSQL);
 
  271         $sPostUriSQL = 
"SELECT `PostUri` FROM `{$this->_oConfig->sSQLPostsTable}` WHERE `PostID`='{$iPostID}'";
 
  272         $sPostUri = $this->
getOne($sPostUriSQL);
 
  278         $sAllBlogPostInfoSQL = 
" 
  279             SELECT `{$this->_oConfig->sSQLPostsTable}`. * , `{$this->_oConfig->sSQLPostsTable}`.`PostCaption` 
  280             FROM `{$this->_oConfig->sSQLPostsTable}` 
  281             WHERE `{$this->_oConfig->sSQLPostsTable}`.`PostID` = ? 
  285         $aAllBlogPostInfo = $this->
getRow($sAllBlogPostInfoSQL, [$iPostID]);
 
  286         return $aAllBlogPostInfo;
 
  291         $sBlogPostsSQL = 
"SELECT * FROM `{$this->_oConfig->sSQLPostsTable}` WHERE `PostID` = ? LIMIT 1";
 
  292         $aBlogPost = $this->
getRow($sBlogPostsSQL, [$iPostID]);
 
  300             FROM `{$this->_oConfig->sSQLPostsTable}` 
  301             WHERE `PostID`='{$iPostID}' 
  303         $iFeatured = $this->
getOne($sCheckSQL);
 
  311             FROM `{$this->_oConfig->sSQLPostsTable}` 
  312             WHERE `PostID`='{$iPostID}' 
  320         $iPostID = $aParams[
'postID'];
 
  324             UPDATE `{$this->_oConfig->sSQLPostsTable}` 
  326                 `Featured`='{$sStatus}' 
  328                 `PostID`='{$iPostID}' 
  330         $this->
query($sUpdateSQL);
 
  335         $iBlogID = $aParams[
'blogID'];
 
  336         $sDesc = $aParams[
'description'];
 
  339             UPDATE `{$this->_oConfig->sSQLBlogsTable}` 
  341                 `Description` = '{$sDesc}' 
  343                 `{$this->_oConfig->sSQLBlogsTable}`.`ID` = '{$iBlogID}' 
  346         $this->
query($sUpdateSQL);
 
  351         $sDelSQL = 
"DELETE FROM `{$this->_oConfig->sSQLBlogsTable}` WHERE `ID` = '{$iBlogID}'";
 
  352         $this->
query($sDelSQL);
 
  357         $sCheckSQL = 
"SELECT `ID` FROM `Profiles` WHERE `NickName`='{$sNickName}'";
 
  358         $iMemberID = (int)$this->
getOne($sCheckSQL);
 
  365                 SELECT DISTINCT `{$this->_oConfig->sSQLPostsTable}`.`PostID` AS 'UnitID', 
  366                     `{$this->_oConfig->sSQLPostsTable}`.`OwnerID`, 
  367                     `{$this->_oConfig->sSQLPostsTable}`.`PostCaption` AS 'UnitTitle', 
  368                     `{$this->_oConfig->sSQLPostsTable}`.`PostUri` AS 'UnitUri', 
  369                     `{$this->_oConfig->sSQLPostsTable}`.`PostText` AS 'UnitDesc', 
  370                     `PostDate` AS 'UnitDateTimeUTS', 
  371                     `{$this->_oConfig->sSQLPostsTable}`.`PostPhoto` AS 'UnitIcon' 
  372                 FROM `{$this->_oConfig->sSQLPostsTable}` 
  373                 WHERE `{$this->_oConfig->sSQLPostsTable}`.`PostStatus` = 'approval' 
  374                 AND `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = '{$iPID}' 
  375                 ORDER BY `{$this->_oConfig->sSQLPostsTable}`.`PostDate` DESC 
  378         $aRssUnits = $this->
getAll($sUnitsSQL);
 
  387             SELECT `{$this->_oConfig->sSQLPostsTable}`.*, DAYOFMONTH(FROM_UNIXTIME(`{$this->_oConfig->sSQLPostsTable}`.`PostDate`)) AS `Day` 
  388             FROM `{$this->_oConfig->sSQLPostsTable}` 
  390                 `{$this->_oConfig->sSQLPostsTable}`.`PostDate` >= UNIX_TIMESTAMP('{$iYear}-{$iMonth}-1') 
  391                 AND `{$this->_oConfig->sSQLPostsTable}`.`PostDate` < UNIX_TIMESTAMP('{$iNextYear}-{$iNextMonth}-1') 
  399                 SELECT COUNT(`{$this->_oConfig->sSQLPostsTable}`.`PostID`) 
  400                 FROM `{$this->_oConfig->sSQLPostsTable}` 
  401                 WHERE `{$this->_oConfig->sSQLPostsTable}`.`PostStatus` = 'approval' 
  402                 AND `{$this->_oConfig->sSQLPostsTable}`.`OwnerID` = '{$iPID}' 
  404         return (
int)$this->
getOne($sUnitsSQL);
 
  409         return (
int)$this->
getOne(
"SELECT `ID` FROM `sys_options_cats` WHERE `name` = 'Blogs' LIMIT 1");
 
  
getPostsCntInCategory($sCategoryName, $sStatusFilter, $iOwnerID)
getOwnerByBlogID($iBlogID)
getPostPhotoByID($iPostID)
setPostStatus($iPostID, $sStatus='disapproval')
getAllBlogsCnt($sStatusFilter)
performUpdateFeatureStatus($aParams)
getTagsInfo($iMemberID, $sStatusFilter, $sCategoryName)
getAll($sQuery, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
getMemberIDByNickname($sNickName)
performUpdatePostWithPhoto($iPostID, $sPhotoFilename='')
getFeaturedPosts($iMemberID)
getPostCaptionByUri($sPostUri)
getRow($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
query($sQuery, $aBindings=[])
getPostCaptionByID($iPostID)
getPostIDByUri($sPostUri)
getFeaturedStatus($iPostID)
getOne($sQuery, $aBindings=[], $iIndex=0)
getJustPostInfo($iPostID)
getBlogPostsByMonth($iYear, $iMonth, $iNextYear, $iNextMonth, $sStatus='approval')
getPostsInCategory($sStatusFilter, $sCategoryName, $iOwnerID)
getTopBlogs($sStatusFilter, $sqlLimit)
getLastBlogs($sStatusFilter, $sqlLimit)
db_res($query, $bindings=[])
performUpdateBlog($aParams)
getPostCaptionAndUriByID($iPostID)
getPostOwnerByID($iPostID)
Attr AllowedRel this is empty
getActiveStatus($iPostID)
escape($sText, $bReal=true)