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

Source for file crosspost.php

Documentation is available at crosspost.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package blogs
  5.  * @subpackage functions
  6.  *
  7.  * @copyright Copyright (c) 2004-2006, bitweaver.org
  8.  *  All Rights Reserved. See below for details and a complete list of authors.
  9.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  10.  */
  11.  
  12. /**
  13.  * required setup
  14.  */
  15. require_once( '../kernel/setup_inc.php' );
  16.  
  17. $gBitSystem->verifyPackage( 'blogs' );
  18. $gBitSystem->verifyPermission( 'p_blogs_admin' );
  19.  
  20. require_once( BLOGS_PKG_PATH.'lookup_post_inc.php' );
  21. require_once( BLOGS_PKG_PATH.'BitBlog.php');
  22. $gBlog = new BitBlog();
  23.  
  24. $gBitUser->verifyTicket();
  25.  
  26. //if crosspost save store it and send us to the post's page
  27. if( isset( $_REQUEST['crosspost_post']) || isset($_REQUEST['save_post_exit'] ) ) {
  28.     $crosspost_note = isset( $_REQUEST['crosspost_note'] )? $_REQUEST['crosspost_note']:NULL;
  29.     if( $gContent->isValid() && $gContent->storePostMap( $gContent->mInfo, $_REQUEST['blog_content_id'], $crosspost_note ) ) {
  30.         $gContent->load();
  31.         bit_redirect( $gContent->getDisplayUrl() );
  32.     }
  33. }
  34.  
  35. // nuke crosspost if requested
  36. if( !empty( $_REQUEST['action']) && ($_REQUEST['action'] == 'remove') && $gContent->isValid() ) {
  37.     // confirm first
  38.     if( isset( $_REQUEST["confirm"] ) ) {
  39.         //remove it, then relaod the crossposting form
  40.         if ( $gContent->expungePostMap( $gContent->mInfo['content_id'], array( $_REQUEST["blog_content_id"] ) ) ){
  41.             $gContent->load();
  42.         }else{
  43.             $feedback['error'] = $gContent->mErrors;
  44.         }
  45.     }else{
  46.         $gBitSystem->setBrowserTitle( tra('Confirm removal of') . ' ' . $gContent->getTitle()); // crossposting from Blog \''.'addblognamehere'.'\'' );
  47.         $formHash['remove'] = TRUE;
  48.         $formHash['action'] = 'remove';
  49.         $formHash['post_id'] = $_REQUEST['post_id'];
  50.         $formHash['blog_content_id'] = $_REQUEST['blog_content_id'];
  51.         $msgHash = array(
  52.             'label' => 'Remove Crossposting of Blog Post:',
  53.             'confirm_item' => $gContent->getTitle(),
  54.             'warning' => tra('This will remove the crossposting of the above blog post.'), // from the blog \''.'addblognamehere'.'\'),
  55.             'error' => tra('This cannot be undone!'),
  56.         );
  57.         $gBitSystem->confirmDialog( $formHash, $msgHash );
  58.     }
  59. }elseif( isset( $_REQUEST["blog_content_id"] )){
  60.     //if we are not removing the post but have received a blog_content_id then we want to edit its note, so load it up
  61.     $crosspost = $gContent->loadPostMap( $gContent->mInfo['content_id'], $_REQUEST["blog_content_id"] );
  62.     $gBitSmarty->assign('crosspost', $crosspost);
  63.     $gBitSmarty->assign('blog_content_id', $_REQUEST['blog_content_id'] );
  64. }
  65.  
  66. $post_id = $gContent->mPostId;
  67. $gBitSmarty->assign('post_id', $gContent->mPostId );
  68. $parsed_data = $gContent->parseData();
  69. $gBitSmarty->assign('parsed_data', $parsed_data);
  70. $gBitSmarty->assign('post_info', $gContent->mInfo );
  71.  
  72. // Get List of available blogs
  73. $listHash = array();
  74. $listHash['sort_mode'] = 'title_desc';
  75. if( !$gBitUser->hasPermission( 'p_blogs_admin' )) {
  76.     $blogs = $gBlog->getList( $listHash );
  77.     $listHash['user_id'] = $gBitUser->mUserId;
  78.     $listHash['content_perm_name'] = 'p_blogs_post';
  79. }
  80. $blogs = $gBlog->getList( $listHash );
  81. $availableBlogs = array();
  82. foreach( array_keys( $blogs ) as $blogContentId ) {
  83.     $availableBlogs[$blogContentId] = $blogs[$blogContentId]['title'];
  84. }
  85. $gBitSmarty->assign( 'availableBlogs', $availableBlogs );
  86.  
  87. $gBitSmarty->assign_by_ref('blogs', $blogs['data']);
  88.  
  89. $gBitSystem->display( 'bitpackage:blogs/crosspost.tpl', tra("Crosspost Blog Post") , array( 'display_mode' => 'display' ));
  90. ?>

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