類別Articles的繼承圖:

公開方法(Public Methods) | |
| Articles () | |
| getUserArticle ($artId, $userId=-1) | |
| getBlogArticle ($artId, $blogId=-1, $includeHiddenFields=true, $date=-1, $categoryId=-1, $userId=-1, $status=POST_STATUS_ALL, $maxDate=-1) | |
| getBlogArticleByTitle ($artTitle, $blogId=-1, $includeHiddenFields=true, $date=-1, $categoryId=-1, $userId=-1, $status=POST_STATUS_PUBLISHED, $maxDate=-1) | |
| getBlogNextArticle ($article) | |
| getBlogPrevArticle ($article) | |
| searchBlogArticles ($blogId, $searchTerms) | |
| getNumBlogArticles ($blogid, $date=-1, $amount=-1, $categoryId=-1, $status=0, $userId=0, $maxDate=0, $searchTerms="") | |
| getBlogArticles ($blogid, $date=-1, $amount=-1, $categoryId=0, $status=0, $userId=0, $maxDate=0, $searchTerms="", $page=-1) | |
| getArticleIdFromName ($articleName) | |
| getArticlesText ($articleIds) | |
| getBlogArticlesByQuery ($query) | |
| getNumberPostsPerMonth ($blogId) | |
| getNumberPostsPerMonthAdmin ($blogId) | |
| getNumberPostsPerDay ($blogId, $year=null, $month=null) | |
| addPostCategoriesLink ($articleId, $categories) | |
| deletePostCategoriesLink ($articleId) | |
| updatePostCategoriesLink ($articleId, $categories) | |
| addArticle (&$newArticle) | |
| addArticleText ($newArticle) | |
| getArticleText ($articleId) | |
| updateArticleText ($article) | |
| addArticleCustomFields ($artId, $blogId, $fields) | |
| updateArticle ($article) | |
| updateArticleCustomFields ($artId, $blogId, $fields) | |
| updateArticleNumReads ($articleId) | |
| updateArticleNumReadsByName ($articleName) | |
| deleteArticle ($artId, $userId, $blogId, $forever=false) | |
| doesUserOwnArticle ($userinfo, $artid) | |
| getAllArticles ($maxPosts=0, $date=0) | |
| deleteBlogPosts ($blogId) | |
| purgePosts () | |
| getArticleCategories ($articleId, $blogId=-1) | |
| getArticleCategoryIds ($articleId) | |
| setTimeDiff ($timeDiff) | |
公開屬性 | |
| $categories | |
| $comments | |
| $trackbacks | |
| $users | |
| $blogs | |
| $customfields | |
| $_blogInfo | |
| $_blogSettings | |
| $_timeDiff | |
私有方法(Private Methods) | |
| _getBlogArticleFromQuery ($query, $includeHiddenFields) | |
| buildWhere ($blogid, $date=-1, $amount=-1, $categoryId=0, $status=0, $userId=0, $maxDate=0, $searchTerms="") | |
| deleteArticleText ($articleId) | |
| _fillArticleInformation ($query_result, $includeHiddenFields=true) | |
| _fillArticleHeaderInformation ($query_result, $includeHiddenFields=true) | |
定義在 articles.class.php 檔案之第 25 行.
|
|
定義在 articles.class.php 檔案之第 40 行. 參考 cache, 及 Model::Model(). 00041 { 00042 $this->Model(); 00043 $this->categories = new ArticleCategories(); 00044 $this->comments = new ArticleComments(); 00045 $this->trackbacks = new Trackbacks(); 00046 $this->users = new Users(); 00047 $this->blogs = new Blogs(); 00048 $this->customfields = new CustomFieldsValues(); 00049 // fine, this is not very nice but it helps a lot, specially if all the classes 00050 // that need to load articles share the same instance 00051 $this->cache = Array(); 00052 $this->_blogInfo = null; 00053 $this->_timeDiff = 0; 00054 $this->_blogsettings = null; 00055 }
|
|
||||||||||||
|
定義在 articles.class.php 檔案之第 1192 行. 參考 $article, $date, cache, 及 Timestamp::getDateWithOffset(). 01193 { 01194 $id = $query_result['id']; 01195 if( isset($this->cache[$id])) { 01196 return($this->cache[$id]); 01197 } 01198 01199 // this is a little dirty trick or otherwise the old 01200 // that don't have the 'properties' field will not work 01201 // as they will appear to have comments disabled 01202 if( $query_result['properties'] == "" ) { 01203 $tmpArray = Array( 'comments_enabled' => true ); 01204 $query_result['properties'] = serialize($tmpArray); 01205 } 01206 01207 // --- 01208 // this, i do not like... but I couldn't find a more 01209 // "elegant" way to arrange it! This makes this method 01210 // totally dependant on the blog configuration so it basically 01211 // means an additional query every time we fetch an article 01212 // (just in case we didn't have enough!) 01213 // --- 01214 01215 // 01216 // if there's a time difference applied to all dates, then we'd better 01217 // calculate it here!! 01218 // 01219 if( $this->_blogInfo == null ) { 01220 $blogId = $query_result['blog_id']; 01221 $this->_blogInfo = $this->blogs->getBlogInfo( $blogId ); 01222 $this->_blogSettings = $this->_blogInfo->getSettings(); 01223 $this->_timeDiff = $this->_blogSettings->getValue( 'time_offset' ); 01224 } 01225 01226 // we can use this auxiliary function to help us... 01227 $date = Timestamp::getDateWithOffset( $query_result['date'], $this->_timeDiff ); 01228 01229 // postText does not exist here.. maybe a copy/paste problem? 01230 // anyway.. it works without postText, so i'll just set this to 01231 // null. oscar, pls double check.. original code: 01232 // $article = new Article( $postText['topic'], 01233 // $postText['text'], 01234 // NULL, 01235 $article = new Article( NULL, 01236 NULL, 01237 NULL, 01238 $query_result['user_id'], 01239 $query_result['blog_id'], 01240 $query_result['status'], 01241 $query_result['num_reads'], 01242 unserialize($query_result['properties']), 01243 $query_result['slug'], 01244 $query_result['id'] ); 01245 01246 // and fill in all the fields with the information we just got from the db 01247 $article->setDate( $date ); 01248 $article->setTimeOffset( $this->_timeDiff ); 01249 $article->setBlogInfo( $this->_blogInfo ); 01250 $article->setUserInfo( $this->users->getUserInfoFromId( $query_result['user_id'] )); 01251 01252 return $article; 01253 }
|
|
||||||||||||
|
Does exactly the same as _fillUserInformation, so that it can be reused by the different functions that work on articles from the database. This method is private and shouldn't be used outside this class. 定義在 articles.class.php 檔案之第 1121 行. 參考 $article, $blogInfo, $category, $date, cache, getArticleCategories(), getArticleText(), 及 Timestamp::getDateWithOffset(). 被參考於 _getBlogArticleFromQuery(), getAllArticles(), 及 getUserArticle(). 01122 { 01123 $id = $query_result['id']; 01124 if( isset($this->cache[$id])) { 01125 return($this->cache[$id]); 01126 } 01127 01128 // this is a little dirty trick or otherwise the old 01129 // that don't have the 'properties' field will not work 01130 // as they will appear to have comments disabled 01131 if( $query_result['properties'] == "" ) { 01132 $tmpArray = Array( 'comments_enabled' => true ); 01133 $query_result['properties'] = serialize($tmpArray); 01134 } 01135 01136 // --- 01137 // this, i do not like... but I couldn't find a more 01138 // "elegant" way to arrange it! This makes this method 01139 // totally dependant on the blog configuration so it basically 01140 // means an additional query every time we fetch an article 01141 // (just in case we didn't have enough!) 01142 // --- 01143 01144 // 01145 // if there's a time difference applied to all dates, then we'd better 01146 // calculate it here!! 01147 // 01148 $blogId = $query_result['blog_id']; 01149 $blogInfo = $this->blogs->getBlogInfo( $blogId ); 01150 $blogSettings = $blogInfo->getSettings(); 01151 $timeDiff = $blogSettings->getValue( 'time_offset' ); 01152 01153 // we can use this auxiliary function to help us... 01154 $date = Timestamp::getDateWithOffset( $query_result['date'], $timeDiff ); 01155 01156 $articleCategories = $this->getArticleCategories( $query_result['id'], $query_result['blog_id'] ); 01157 $categoryIds = Array(); 01158 foreach( $articleCategories as $category ) 01159 array_push( $categoryIds, $category->getId()); 01160 01161 // get the article text 01162 $postText = $this->getArticleText( $query_result['id'] ); 01163 01164 $article = new Article( $postText['topic'], 01165 $postText['text'], 01166 $categoryIds, 01167 $query_result['user_id'], 01168 $query_result['blog_id'], 01169 $query_result['status'], 01170 $query_result['num_reads'], 01171 unserialize($query_result['properties']), 01172 $query_result['slug'], 01173 $query_result['id'] ); 01174 01175 // and fill in all the fields with the information we just got from the db 01176 $article->setDate( $date ); 01177 $article->setTimeOffset( $timeDiff ); 01178 // get information about the categories of the article 01179 $article->setCategories( $articleCategories ); 01180 $article->setBlogInfo( $blogInfo ); 01181 $article->setUserInfo( $this->users->getUserInfoFromId( $query_result['user_id'] )); 01182 01183 // fill in the cache with the result we just loaded 01184 $this->cache[$query_result['id']] = $article; 01185 01186 return $article; 01187 }
|
|
||||||||||||
|
定義在 articles.class.php 檔案之第 165 行. 參考 $article, $query, $result, _fillArticleInformation(), 及 Model::Execute(). 被參考於 getBlogArticle(), getBlogArticleByTitle(), getBlogNextArticle(), 及 getBlogPrevArticle(). 00166 { 00167 // we send the query and then fetch the first array with the result 00168 $result = $this->Execute( $query ); 00169 00170 if( $result == false ) 00171 return false; 00172 00173 if ( $result->RecordCount() == 0) 00174 return false; 00175 00176 $row = $result->FetchRow( $result ); 00177 00178 $article = $this->_fillArticleInformation( $row, $includeHiddenFields ); 00179 00180 $result->Close(); 00181 00182 return $article; 00183 }
|
|
|
Adds a new article to the database
定義在 articles.class.php 檔案之第 696 行. 參考 $query, $result, addArticleCustomFields(), addArticleText(), addPostCategoriesLink(), 及 Model::Execute(). 00697 { 00698 // first, we build up the query 00699 $query = "INSERT INTO ".$this->getPrefix()."articles( user_id,blog_id,status,date,properties, slug ) 00700 VALUES ( ".$newArticle->getUser().",". 00701 $newArticle->getBlog().",'". 00702 $newArticle->getStatus()."','". 00703 $newArticle->getDate()."','". 00704 serialize($newArticle->getProperties())."','". 00705 $newArticle->getPostSlug()."');"; 00706 // and then we send it to the db 00707 //$this->_db->debug=true; 00708 $result = $this->Execute( $query ); 00709 00710 if( !$result ){ 00711 return false; 00712 } 00713 00714 // get id of the post from the database 00715 $postId = $this->_db->Insert_ID(); 00716 00717 // save the post text 00718 $newArticle->setId( $postId ); 00719 $this->addArticleText( $newArticle ); 00720 00721 // and create the link between the post and its categories? 00722 $this->addPostCategoriesLink( $postId, $newArticle->getCategoryIds()); 00723 00724 // and save the custom fields 00725 $this->addArticleCustomFields( $postId, $newArticle->getBlog(), $newArticle->getFields()); 00726 00727 return $postId; 00728 }
|
|
||||||||||||||||
|
Saves the custom fields of an article
定義在 articles.class.php 檔案之第 803 行. 參考 getValue(). 被參考於 addArticle(). 00804 { 00805 $customFields = new CustomFieldsValues(); 00806 00807 foreach( $fields as $field ) { 00808 $customFields->addCustomFieldValue( $field->getFieldId(), $field->getValue(), $artId, $blogId ); 00809 } 00810 00811 return true; 00812 }
|
|
|
saves the text of an article to the database
定義在 articles.class.php 檔案之第 737 行. 參考 $query, Model::Execute(), Model::getPrefix(), 及 Db::qstr(). 被參考於 addArticle(). 00738 { 00739 $filter = new Textfilter(); 00740 $prefix = $this->getPrefix(); 00741 $query = "INSERT INTO {$prefix}articles_text 00742 (article_id, topic, text, normalized_text, normalized_topic) 00743 VALUES( '".Db::qstr( $newArticle->getId())."', '". 00744 Db::qstr($newArticle->getTopic())."','". 00745 Db::qstr($newArticle->getText(false))."','". 00746 $filter->normalizeText(Db::qstr($newArticle->getText(false)))."', '". 00747 $filter->normalizeText(Db::qstr($newArticle->getTopic()))."')"; 00748 00749 return( $this->Execute( $query )); 00750 }
|
|
||||||||||||
|
adds records to the table that holds the many-to-many relationship between categories and posts in the blog.
定義在 articles.class.php 檔案之第 649 行. 參考 $categories, $query, 及 Model::Execute(). 被參考於 addArticle(), 及 updatePostCategoriesLink(). 00650 { 00651 // nothing to do if the $categories array is not ehem, an array :) 00652 if( !is_array( $categories )) 00653 return true; 00654 00655 foreach( $categories as $categoryId ) { 00656 $query = "INSERT INTO ".$this->getPrefix()."article_categories_link 00657 (article_id, category_id) VALUES ($articleId, $categoryId )"; 00658 $this->Execute( $query ); 00659 } 00660 00661 return true; 00662 }
|
|
||||||||||||||||||||||||||||||||||||
|
builds a WHERE clause for a query 定義在 articles.class.php 檔案之第 255 行. 參考 $date, $query, 及 Model::getPrefix(). 被參考於 getBlogArticles(), 及 getNumBlogArticles(). 00256 { 00257 $postStatus = $status; 00258 $prefix = $this->getPrefix(); 00259 if($blogid == -1){ 00260 $query = "a.blog_id = a.blog_id"; 00261 } 00262 else{ 00263 $query = "a.blog_id = ".Db::qstr($blogid); 00264 } 00265 if( $date != -1 ) { 00266 // consider the time difference 00267 $blogSettings = $this->blogs->getBlogSettings( $blogid ); 00268 $timeDifference = $blogSettings->getValue( "time_offset" ); 00269 $SecondsDiff = $timeDifference * 3600; 00270 $query .= " AND FROM_UNIXTIME(UNIX_TIMESTAMP(a.date)+$SecondsDiff)+0 LIKE '$date%'"; 00271 } 00272 00273 // the common part "c.id = a.category_id" is needed so that 00274 // we don't get one article row as many times as the amount of categories 00275 // we have... due to the sql 'join' operation we're carrying out 00276 if( $categoryId == -1 ) 00277 $query .= " AND c.id = l.category_id AND a.id = l.article_id "; 00278 else { 00279 if( $categoryId > 0 ) 00280 $query .= " AND a.id = l.article_id AND l.category_id = $categoryId AND c.id = l.category_id"; 00281 else { 00282 $query .= " AND c.id = l.category_id AND a.id = l.article_id AND c.in_main_page = 1"; 00283 } 00284 } 00285 00286 if( $status > 0 ) 00287 $query .= " AND a.status = '$postStatus'"; 00288 if( $userId > 0 ) 00289 $query .= " AND a.user_id = ".Db::qstr($userId); 00290 if( $maxDate > 0 ) 00291 $query .= " AND a.date <= '$maxDate'"; 00292 00293 // in case there were some search terms specified as parameters... 00294 if( $searchTerms != "" ) { 00295 // load the class dynamically so that we don't have to waste memory 00296 // if we're not going to need it! 00297 include_once( PLOG_CLASS_PATH."class/dao/searchengine.class.php" ); 00298 $searchEngine = new SearchEngine(); 00299 00300 // prepare the query string 00301 $searchTerms = $searchEngine->_adaptSearchString( $searchTerms ); 00302 $whereString = $searchEngine->_generateSearchArticlesWhereString( $searchTerms ); 00303 00304 // and add it to the current search 00305 $query .=" AND {$whereString} "; 00306 } 00307 00308 if( $categoryId <= 0 ) 00309 $query .= " GROUP BY a.id "; 00310 00311 00312 return $query; 00313 }
|
|
||||||||||||||||||||
|
Removes an article from the database If forever == true, the article is physically removed from the database. Otherwise, the 'status' field is set to 'deleted' Problem is, that MySQL will automatically update the 'date' field because he feels like it... even if we explicitely say date = old_date... grrreat :P Valid article identifier, blog identifier and user identifier are required to remove an article. It was done for security reasons and to make perfectly clear that we are removing an article (so that we wouldn't be deleting the wrong one if there was any bug!)
定義在 articles.class.php 檔案之第 939 行. 參考 $comments, $query, $result, $trackbacks, deleteArticleText(), deletePostCategoriesLink(), 及 Model::Execute(). 被參考於 deleteBlogPosts(), 及 purgePosts(). 00940 { 00941 if( $forever ) { 00942 $query = "DELETE FROM ".$this->getPrefix()."articles WHERE id = ".$artId." AND user_id = ".$userId." AND blog_id = ".$blogId.";"; 00943 // -- text -- 00944 $this->deleteArticleText( $artId ); 00945 // we also have to remove its comments and trackbacks if the article is being deleted forever 00946 // -- comments -- 00947 $comments = new ArticleComments(); 00948 $comments->deletePostComments( $artId ); 00949 // -- trackbacks -- 00950 $trackbacks = new Trackbacks(); 00951 $trackbacks->deletePostTrackbacks( $artId ); 00952 // -- post-to-categories mappings -- 00953 $this->deletePostCategoriesLink( $artId ); 00954 // -- custom fields -- 00955 $customFields = new CustomFieldsValues(); 00956 $customFields->removeArticleCustomFields( $artId ); 00957 } 00958 else { 00959 $query = "UPDATE ".$this->getPrefix()."articles SET date = date, status = 3 WHERE id = ".$artId." AND user_id = ".$userId." AND blog_id = ".$blogId.";"; 00960 } 00961 00962 $result = $this->Execute( $query ); 00963 00964 if( !$result ) 00965 return false; 00966 00967 if( $this->_db->Affected_Rows() == 0 ) 00968 return false; 00969 00970 return true; 00971 }
|
|
|
removes the text of an article
定義在 articles.class.php 檔案之第 981 行. 參考 $articleId, $query, Model::Execute(), 及 Db::qstr(). 被參考於 deleteArticle(). 00982 { 00983 $query = "DELETE FROM ".$this->getPrefix()."articles_text WHERE article_id = '".Db::qstr($articleId)."'"; 00984 00985 return( $this->Execute( $query )); 00986 }
|
|
|
Removes all the posts from the given blog
定義在 articles.class.php 檔案之第 1045 行. 參考 $article, deleteArticle(), 及 getBlogArticles(). 01046 { 01047 $blogArticles = $this->getBlogArticles( $blogId ); 01048 01049 foreach( $blogArticles as $article ) { 01050 // the deleteArticle method will also take care of removing comments and 01051 // trackbacks 01052 $this->deleteArticle( $article->getId(), $article->getUser(), $article->getBlog(), true ); 01053 } 01054 01055 return true; 01056 }
|
|
|
removes the relationship between posts and categories from the database. This method should only be used when removing an article!! 定義在 articles.class.php 檔案之第 668 行. 參考 $query, 及 Model::Execute(). 被參考於 deleteArticle(), 及 updatePostCategoriesLink(). 00669 { 00670 $query = "DELETE FROM ".$this->getPrefix()."article_categories_link 00671 WHERE article_id = $articleId"; 00672 00673 return $this->Execute( $query ); 00674 }
|
|
||||||||||||
|
returns true if the user posted this article/post, or false if he or she doesn't own it
定義在 articles.class.php 檔案之第 996 行. 參考 $article. 00997 { 00998 $article = $this->getArticle( $artid ); 00999 $articleOwnerInfo = $article->getUserInfo(); 01000 01001 if( $articleOwnerInfo->getId() == $userinfo->getId()) 01002 return true; 01003 else 01004 return false; 01005 }
|
|
||||||||||||
|
Returns all the posts in the database or the 'maxPosts' recent ones that have been published (status=='published')
定義在 articles.class.php 檔案之第 1014 行. 參考 $date, $query, $result, _fillArticleInformation(), 及 Model::Execute(). 01015 { 01016 $query = "SELECT * FROM ".$this->getPrefix()."articles WHERE status = 1"; 01017 if( $date > 0 ) 01018 $query .= " AND date < '$date'"; 01019 01020 $query .= " ORDER BY date DESC"; 01021 01022 if( $maxPosts > 0 ) 01023 $query .= " LIMIT 0,".$maxPosts; 01024 01025 $result = $this->Execute( $query ); 01026 01027 if( !$result ) 01028 return false; 01029 01030 $posts = Array(); 01031 while( $row = $result->FetchRow()) { 01032 $posts[] = $this->_fillArticleInformation( $row ); 01033 } 01034 01035 $result->Close(); 01036 01037 return $posts; 01038 }
|
|
||||||||||||
|
returns all the categories that an article has been assigned to 定義在 articles.class.php 檔案之第 1083 行. 參考 $articleId. 被參考於 _fillArticleInformation(). 01084 { 01085 return $this->categories->getArticleCategories( $articleId, $blogId ); 01086 }
|
|
|
returns all the categories that an article has been assigned to 定義在 articles.class.php 檔案之第 1091 行. 參考 $categories, $query, $result, 及 Model::Execute(). 01092 { 01093 $query = "SELECT category_id FROM ".$this->getPrefix()."article_categories_link 01094 WHERE article_id = $articleId"; 01095 01096 $result = $this->Execute( $query ); 01097 01098 // it's impossible that an article has no categories, but 01099 // we'll bear with it... 01100 if( !$result ) 01101 return Array(); 01102 01103 // otherwise, fetch them 01104 $categories = Array(); 01105 while( $row = $result->FetchRow()) { 01106 $categories[] = $row['category_id']; 01107 } 01108 01109 $result->Close(); 01110 01111 return $categories; 01112 }
|
|
|
Takes an article name and returns the id
定義在 articles.class.php 檔案之第 462 行. 00462 { 00463 $query = "SELECT id FROM ".$this->getPrefix()."articles ". 00464 " WHERE slug = '".Db::qstr($articleName)."'"; 00465 00466 $result = $this->Execute($query); 00467 00468 if($row = $result->FetchRow()){ 00469 $result->Close(); 00470 if($row["id"]) 00471 return $row["id"]; 00472 } 00473 return 0; 00474 }
|
|
|
returns the text of a bunch of articles, given their ids
定義在 articles.class.php 檔案之第 485 行. 00486 { 00487 $prefix = $this->getPrefix(); 00488 $query = "SELECT article_id,text,topic FROM {$prefix}articles_text WHERE 00489 article_id IN (".$articleIds.")"; 00490 00491 $result = $this->Execute( $query ); 00492 00493 // it's impossible that an article has no categories, but 00494 // we'll bear with it... 00495 if( !$result ) 00496 return Array(); 00497 00498 // otherwise, fetch them 00499 while ($row = $result->FetchRow()) { 00500 $lastArticleId=$row["article_id"]; 00501 $postTexts[$lastArticleId]=$row; 00502 } 00503 00504 $result->Close(); 00505 00506 return( $postTexts ); 00507 }
|
|
|
returns the text fields of an article
定義在 articles.class.php 檔案之第 758 行. 參考 $articleId, $query, $result, Model::Execute(), 及 Model::getPrefix(). 被參考於 _fillArticleInformation(). 00759 { 00760 $prefix = $this->getPrefix(); 00761 $query = "SELECT text,topic FROM {$prefix}articles_text 00762 WHERE article_id = '".Db::qstr($articleId)."'"; 00763 00764 $result = $this->Execute( $query ); 00765 00766 if( !$result ) 00767 return false; 00768 00769 $row = $result->FetchRow(); 00770 00771 $result->Close(); 00772 00773 return( $row ); 00774 }
|
|
||||||||||||||||||||||||||||||||||||
|
Gets an article from the database, given its id
定義在 articles.class.php 檔案之第 94 行. 參考 $date, $query, _getBlogArticleFromQuery(), 及 Model::getPrefix(). 00095 { 00096 $prefix = $this->getPrefix(); 00097 $query = "SELECT a.id, a.date, 00098 a.user_id,a.blog_id,a.status,a.properties, 00099 a.num_reads, a.slug FROM {$prefix}articles a "; 00100 // thanks jon for the tip :) You're right that the amount of rows will be too big if we don't really need these 00101 // fields! 00102 if($categoryId != -1 && $blogId != -1) { 00103 $query .= ", {$prefix}articles_categories c, {$prefix}article_categories_link l "; 00104 } 00105 00106 $query .= "WHERE a.id = ".Db::qstr($artId); 00107 00108 if( $blogId != -1 ) 00109 $query .= " AND a.blog_id = ".Db::qstr($blogId); 00110 if( $date != -1 && $maxDate == -1 ) { 00111 $query .= " AND a.date+0 LIKE '$date%'"; 00112 } elseif ( $date != -1 && $maxDate != -1 ) { 00113 $query .= " AND a.date+0 >= $date AND a.date+0 <= $maxDate"; 00114 } 00115 if( $userId != -1 ) 00116 $query .= " AND a.user_id = ".Db::qstr($userId); 00117 if( $categoryId != -1 ) 00118 $query .= " AND c.id = ".Db::qstr($categoryId)." AND c.id = l.category_id AND a.id = l.article_id"; 00119 if( $status != POST_STATUS_ALL ) 00120 $query .= " AND a.status = $status;"; 00121 00122 return $this->_getBlogArticleFromQuery( $query, $includeHiddenFields ); 00123 }
|
|
||||||||||||||||||||||||||||||||||||
|
Gets an article from the database, given its slug, this is used with the fancy permalinks
定義在 articles.class.php 檔案之第 |