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

Source for file send_post.php

Documentation is available at send_post.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  
  5.  * @package blogs
  6.  * @subpackage functions
  7.  */
  8.  
  9. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  10. // All Rights Reserved. See below for details and a complete list of authors.
  11. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  12.  
  13. // Make sure all defines get created as fully qualified URI's
  14. $_REQUEST['uri_mode'] = TRUE;
  15.  
  16. /**
  17.  * required setup
  18.  */
  19. require_once( '../kernel/setup_inc.php' );
  20.  
  21. include_once( BLOGS_PKG_PATH.'BitBlogPost.php' );
  22.  
  23. $gBitSystem->verifyPermission( 'p_blogs_send_post' );
  24.  
  25. if (!isset($_REQUEST["post_id"])) {
  26.     $gBitSystem->fatalError( tra( 'No post indicated' ));
  27. }
  28.  
  29. include_once( BLOGS_PKG_PATH.'lookup_post_inc.php' );
  30. // make sure this user can see the post to avoid emailing post to self to circumvent the perm
  31. $gContent->verifyViewPermission();
  32.  
  33. $gBitSmarty->assign('post_info', $gContent->mInfo );
  34.  
  35. //Build absolute URI for this
  36. $parts = parse_url($_SERVER['REQUEST_URI']);
  37. /*OLD with blog_id - might later want to reincorporate blog_id but will have to start in the view_blog_post.tpl -wjames5
  38. $uri = httpPrefix(). $parts['path'] . '?blog_id=' . $gContent->mInfo['blog_id'] . '&post_id=' . $gContent->mInfo['post_id'];
  39. $uri2 = httpPrefix(). $parts['path'] . '/' . $gContent->mInfo['blog_id'] . '/' . $gContent->mInfo['post_id'];
  40. */
  41. $uri = httpPrefix(). $parts['path'] . '?post_id=' . $gContent->mInfo['post_id'];
  42. $uri2 = httpPrefix(). $parts['path'] . '/' . $gContent->mInfo['post_id'];
  43. $gBitSmarty->assign('uri', $uri);
  44. $gBitSmarty->assign('uri2', $uri2);
  45.  
  46. $gBitSmarty->assign( 'parsed_data', $gContent->parseData() );
  47.  
  48. if ($gBitSystem->isFeatureActive( 'blog_posts_comments' )) {
  49.     $comments_vars = array(
  50.         'post_id',
  51.         'offset',
  52.         'find',
  53.         'sort_mode'
  54.     );
  55.  
  56.     $comments_return_url = $_SERVER['SCRIPT_NAME']."?post_id=".$gContent->mPostId;
  57.     $commentsParentId = $gContent->mContentId;
  58.     $comments_prefix_var = 'post:';
  59.     $comments_object_var = 'post_id';
  60.     include_once ( LIBERTY_PKG_PATH.'comments_inc.php' );
  61. }
  62.  
  63. if (!isset($_REQUEST['addresses'])) {
  64.     $_REQUEST['addresses'] = '';
  65. }
  66.  
  67. $gBitSmarty->assign('addresses', $_REQUEST['addresses']);
  68. $gBitSmarty->assign('sent', 'n');
  69.  
  70. if (isset($_REQUEST['send'])) {
  71.     $emails = explode(',', $_REQUEST['addresses']);
  72.  
  73.     $foo = parse_url($_SERVER["REQUEST_URI"]);
  74.     $machine = $gContent->getDisplayUrl();
  75.  
  76.     foreach ($emails as $email) {
  77.         $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
  78.  
  79.         $gBitSmarty->assign('mail_user', $gBitUser->getDisplayName() );
  80.         $gBitSmarty->assign('mail_title', $gContent->mInfo['title'] ? $gContent->mInfo['title'] : date("d/m/Y [h:i]", $gContent->mInfo['created']));
  81.         $gBitSmarty->assign('mail_machine', $machine);
  82.         $mail_data = $gBitSmarty->fetch('bitpackage:blogs/blogs_send_link.tpl');
  83.         @mail($email, tra('Post recommendation at'). ' ' . $_SERVER["SERVER_NAME"], $mail_data,
  84.             "From: ".$gBitSystem->getConfig( 'site_sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n");
  85.     }
  86.  
  87.     $gBitSmarty->assign('sent', 'y');
  88. }
  89. $gBitSystem->setBrowserTitle("Send Blog Post: ".$gContent->mInfo['title']);
  90.  
  91. // Display the template
  92. $gBitSystem->display( 'bitpackage:blogs/send_blog_post.tpl', NULL, array( 'display_mode' => 'display' ));
  93.  
  94. ?>

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