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

Source for file edit.php

Documentation is available at edit.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package blogs
  5.  * @subpackage functions
  6.  * @copyright (c) 2004-2006, bitweaver.org
  7.  *  Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  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. include_once( BLOGS_PKG_PATH.'BitBlog.php' );
  17.  
  18. $gBitSystem->verifyPackage( 'blogs' );
  19.  
  20. require_once( BLOGS_PKG_PATH.'lookup_blog_inc.php');
  21.  
  22. // Now check permissions to access this page
  23. if( $gContent->isValid() ) {
  24.     $gContent->verifyUpdatePermission();
  25. } else {
  26.     $gContent->verifyCreatePermission();
  27. }
  28.  
  29. if (isset($_REQUEST['preview'])) {
  30.     //all this should prolly be moved to a BitBlog::preparePreview method and the tpls cleaned - but this works for now -wjames5
  31.     $gBitSmarty->assign('title', $_REQUEST["title"]);
  32.     $gBitSmarty->assign('edit', $_REQUEST["edit"]);
  33.     $gBitSmarty->assign('parsed', $gContent->parseData( $_REQUEST["edit"], $_REQUEST["format_guid"]));
  34.     $gBitSmarty->assign('user_name', $gBitUser->getDisplayName());
  35.     $gBitSmarty->assign('created', $gBitSystem->getUTCTime());
  36.     $gBitSmarty->assign('use_find', isset($_REQUEST["use_find"]) ? 'y' : 'n');
  37.     $gBitSmarty->assign('use_title', isset($_REQUEST["use_title"]) ? 'y' : 'n');
  38.     $gBitSmarty->assign('allow_comments', isset($_REQUEST["allow_comments"]) ? 'y' : 'n');
  39.     $gBitSmarty->assign('max_posts', $_REQUEST["max_posts"]);
  40.     //$gBitSmarty->assign('heading', $heading);
  41.     $gContent->invokeServices('content_preview_function');
  42. } else {
  43.     $gContent->invokeServices('content_edit_function');
  44. }
  45.  
  46. if (isset($_REQUEST['save_blog'])) {
  47.     if( $gContent->store( $_REQUEST ) ) {
  48.         bit_redirect( $gContent->getDisplayUrl() );
  49.     } else {
  50.         $gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors );
  51.     }
  52. }
  53.  
  54. $gBitSystem->setBrowserTitle( tra( 'Edit Blog' ).' - '.$gContent->getTitle() );
  55.  
  56. $gBitSmarty->assign( 'textarea_label', 'Blog Description' );
  57.  
  58. $gBitSmarty->assign_by_ref('gContent', $gContent);
  59. $gBitSystem->display( 'bitpackage:blogs/edit_blog.tpl', NULL, array( 'display_mode' => 'edit' ));
  60.  
  61. ?>

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