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

Source for file list.php

Documentation is available at list.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. require_once( ARTICLES_PKG_PATH.'BitArticle.php' );
  13. include_once( ARTICLES_PKG_PATH.'article_filter_inc.php' );
  14.  
  15. // Is package installed and enabled
  16. $gBitSystem->verifyPackage( 'articles' );
  17.  
  18. // Now check permissions to access this page
  19. $gBitSystem->verifyPermission( 'p_articles_read' );
  20.  
  21. // get services set up
  22. $gContent = new BitArticle();
  23. $gContent->invokeServices( 'content_list_function', $_REQUEST );
  24.  
  25. // nuke articles if requested
  26. if( !empty( $_REQUEST['action'] ) ) {
  27.     if( $_REQUEST['action'] == 'remove' && !empty( $_REQUEST['remove_article_id'] ) ) {
  28.         $tmpArt = new BitArticle( $_REQUEST['remove_article_id'] );
  29.         $tmpArt->load();
  30.         // depending on what the status of the article is, we need to check different permissions
  31.         if( $tmpArt->mInfo['status_id'] == ARTICLE_STATUS_PENDING ) {
  32.             $gBitSystem->verifyPermission( 'p_articles_remove_submission' );
  33.         } else {
  34.             $gBitSystem->verifyPermission( 'p_articles_remove' );
  35.         }
  36.  
  37.         if( isset( $_REQUEST["confirm"] ) ) {
  38.             if( $tmpArt->expunge() ) {
  39.                 bit_redirect( ARTICLES_PKG_URL.'list.php?status_id='.( !empty( $_REQUEST['status_id'] ) ? $_REQUEST['status_id'] : '' ) );
  40.             } else {
  41.                 $feedback['error'] = $tmpArt->mErrors;
  42.             }
  43.         }
  44.         $gBitSystem->setBrowserTitle( tra('Confirm removal of'). ' ' .$tmpArt->mInfo['title'] );
  45.         $formHash['remove'] = TRUE;
  46.         $formHash['action'] = 'remove';
  47.         $formHash['status_id'] = ( !empty( $_REQUEST['status_id'] ) ? $_REQUEST['status_id'] : '' );
  48.         $formHash['remove_article_id'] = $_REQUEST['remove_article_id'];
  49.         $msgHash = array(
  50.             'label' => tra('Remove Article'),
  51.             'confirm_item' => $tmpArt->mInfo['title'],
  52.             'warning' => tra('Remove the above article.'),
  53.             'error' => tra('This cannot be undone!'),
  54.         );
  55.         $gBitSystem->confirmDialog( $formHash, $msgHash );
  56.     }
  57. }
  58.  
  59. $article = new BitArticle();
  60. // change the status of an article first
  61. if( !empty( $_REQUEST['action'] ) ) {
  62.     if( !empty( $_REQUEST['article_id'] ) && !empty( $_REQUEST['set_status_id'] ) && $gBitUser->hasPermission( 'p_articles_approve_submission' ) ) {
  63.         $article->setStatus( $_REQUEST['set_status_id'], $_REQUEST['article_id'], $_REQUEST['content_id'] );
  64.     }
  65. }
  66.  
  67. if( empty( $_REQUEST['status_id'] ) || (!(($gBitSystem->isFeatureActive('articles_auto_approve') && $gBitUser->isRegistered()) || $gBitUser->hasPermission( 'p_articles_update_submission' ) || $gBitUser->hasPermission( 'p_articles_admin' ) ) ) ) {
  68.     $_REQUEST['status_id'] = ARTICLE_STATUS_APPROVED;
  69. }
  70. $listArticles = $article->getList( $_REQUEST );
  71.  
  72. $gBitSmarty->assign( 'topics', $topics );
  73.  
  74. $gBitSmarty->assign( 'types', $types );
  75.  
  76. $gBitSmarty->assign( 'listInfo', $_REQUEST['listInfo'] );
  77. $gBitSmarty->assign( 'listpages', $listArticles );
  78.  
  79. // Display the template
  80. $gBitSystem->display( 'bitpackage:articles/list_articles.tpl', tra( "Articles" ), array( 'display_mode' => 'list' ));

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