b2evolution PHP Cross Reference Blogging Systems

Source: /skins/edit_comment.main.php - 80 lines - 3008 bytes - Text - Print

Description: This file is the template that includes required css files to display comment edit form

   1  <?php
   2  /**

   3   * This file is the template that includes required css files to display comment edit form

   4   *

   5   * b2evolution - {@link http://b2evolution.net/}

   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   7   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

   8   *

   9   * @package evoskins

  10   *

  11   * @version $Id: edit_comment.main.php 6136 2014-03-08 07:59:48Z manuel $

  12   */
  13  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  14  
  15  global $current_User;
  16  
  17  // comment ID

  18  $comment_ID = param( 'c', 'integer', 0, true );
  19  
  20  if( !is_logged_in() )
  21  { // Redirect to the login page if not logged in and allow anonymous user setting is OFF
  22      $redirect_to = url_add_param( $Blog->gen_blogurl(), 'disp=edit_comment' );
  23      $Messages->add( T_( 'You must log in to edit comments.' ) );
  24      header_redirect( get_login_url( 'cannot edit comments', $redirect_to ), 302 );
  25      // will have exited

  26  }
  27  
  28  if( !$current_User->check_status( 'can_edit_comment' ) )
  29  {
  30      if( $current_User->check_status( 'can_be_validated' ) )
  31      { // user is logged in but his/her account was not activated yet
  32          // Redirect to the account activation page

  33          $Messages->add( T_( 'You must activate your account before you can edit comments. <b>See below:</b>' ) );
  34          header_redirect( get_activate_info_url(), 302 );
  35          // will have exited

  36      }
  37  
  38      // Redirect to the blog url for users without messaging permission

  39      $Messages->add( 'You are not allowed to edit comments!' );
  40      header_redirect( $Blog->gen_blogurl(), 302 );
  41  }
  42  
  43  if( empty( $comment_ID ) )
  44  { // Can't edit a not exisiting comment
  45      $Messages->add( 'Invalid comment edit URL!' );
  46      header_redirect( $Blog->gen_blogurl(), 302 );
  47  }
  48  
  49  $CommentCache = & get_CommentCache();
  50  $edited_Comment = & $CommentCache->get_by_ID( $comment_ID );
  51  $comment_Item = & $edited_Comment->get_Item();
  52  
  53  if( ! $current_User->check_perm( 'comment!CURSTATUS', 'edit', false, $edited_Comment ) )
  54  { // If User has no permission to edit comments with this comment status:
  55      $Messages->add( 'You are not allowed to edit the previously selected comment!' );
  56      header_redirect( $Blog->gen_blogurl(), 302 );
  57  }
  58  
  59  $comment_title = '';
  60  $comment_content = htmlspecialchars_decode( $edited_Comment->content );
  61  
  62  // Format content for editing, if we were not already in editing...

  63  $Plugins_admin = & get_Plugins_admin();
  64  $comment_Item->load_Blog();
  65  $params = array( 'object_type' => 'Comment', 'object_Blog' => & $comment_Item->Blog );
  66  $Plugins_admin->unfilter_contents( $comment_title /* by ref */, $comment_content /* by ref */, $comment_Item->get_renderers_validated(), $params );
  67  
  68  // Require datapicker.css

  69  require_css( 'ui.datepicker.css' );
  70  // Require results.css to display attachments as a result table

  71  require_css( 'results.css' );
  72  
  73  $Item = & $comment_Item;
  74  init_ratings_js( 'blog' );
  75  init_datepicker_js( 'blog' );
  76  
  77  $display_params = array();
  78  
  79  require $ads_current_skin_path.'index.main.php';
  80  ?>

title

Description

title

Description

title

Description

title

title

Body