articles
[ class tree: articles ] [ index: articles ] [ all elements ]

Source for file read.php

Documentation is available at read.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package articles
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * Initialization
  10.  */
  11. require_once '../kernel/setup_inc.php';
  12.  
  13. require_onceARTICLES_PKG_PATH.'BitArticle.php' );
  14.  
  15. $gBitSystem->verifyPackage'articles' );
  16.  
  17. if!@BitBase::verifyId$_REQUEST["article_id")) {
  18.     $gBitSystem->fatalErrortra"No article indicated" ));
  19. }
  20.  
  21. include_onceARTICLES_PKG_PATH.'lookup_article_inc.php' );
  22.  
  23. // Check if we actually have some content
  24. if!$gContent->isValid() ) {
  25.     $gBitSystem->fatalErrortra'Article cannot be found' ));
  26. }
  27.  
  28. $gContent->verifyViewPermission();
  29.  
  30. // additionally we need to check if this article is a submission and see if user has perms to view it.
  31. if$gContent->getField'status_id' != ARTICLE_STATUS_APPROVED {
  32.     if!$gContent->hasUserPermission'p_articles_update_submission' || $gContent->hasUserPermission'p_articles_approve_submission' ))) {
  33.         $gBitSystem->fatalErrortra"Permission denied you cannot view this article" ));
  34.     }
  35. }
  36.  
  37. // we also need to check and see if the article is future dated - we will display it if the user can edit it otherwise we pretend it does not exist.
  38. $timestamp $gBitSystem->getUTCTime();
  39. if ( ($gContent->mInfo['publish_date'$timestamp&& !$gContent->hasUpdatePermission() ){
  40.     $gBitSystem->fatalErrortra'Article cannot be found' ));
  41. }
  42.  
  43. $gContent->addHit();
  44. $gBitSmarty->assign_by_ref'article'$gContent->mInfo );
  45.  
  46. // get all the services that want to display something on this page
  47. $displayHash array'perm_name' => 'p_articles_read' );
  48. $gContent->invokeServices'content_display_function'$displayHash );
  49.  
  50. $gBitSmarty->assign_by_ref'topics'$topics );
  51.  
  52. // Comments engine!
  53. if@$gContent->mInfo['allow_comments'== 'y' {
  54.     $comments_vars Array'article' );
  55.     $comments_prefix_var='article:';
  56.     $comments_object_var='article';
  57.     $commentsParentId $gContent->mContentId;
  58.     $comments_return_url $_SERVER['SCRIPT_NAME']."?article_id=".$_REQUEST['article_id'];
  59.     include_onceLIBERTY_PKG_PATH.'comments_inc.php' );
  60. }
  61.  
  62. // Display the Index Template
  63. $gBitSystem->display'bitpackage:articles/read_article.tpl'@$gContent->mInfo['title'array'display_mode' => 'display' ));

Documentation generated on Wed, 29 Jul 2015 13:57:18 +0000 by phpDocumentor 1.5.0-lsces