[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/skins/basic/ -> _item_feedback.inc.php (source)

   1  <?php
   2  /**

   3   * This is the template that displays the feedback for a post

   4   * (comments, trackback, pingback...)

   5   *

   6   * You may want to call this file multiple time in a row with different $c $tb $pb params.

   7   * This allow to seprate different kinds of feedbacks instead of displaying them mixed together

   8   *

   9   * This file is not meant to be called directly.

  10   * It is meant to be called by an include in the main.page.php template.

  11   * To display a feedback, you should call a stub AND pass the right parameters

  12   * For example: /blogs/index.php?p=1&more=1&c=1&tb=1&pb=1

  13   * Note: don't code this URL by hand, use the template functions to generate it!

  14   *

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

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

  17   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

  18   *

  19   * @package evoskins

  20   * @subpackage basic

  21   */
  22  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  23  
  24  
  25  // Display filters:

  26  // You can change these and call this template multiple time if you want to separate comments from trackbacks

  27  $disp_comments = 1;                    // Display the comments if requested

  28  $disp_comment_form = 1;            // Display the comments form if comments requested

  29  $disp_trackbacks = 1;                // Display the trackbacks if requested

  30  $disp_trackback_url = 1;        // Display the trackbal URL if trackbacks requested

  31  $disp_pingbacks = 1;        // pingbacks (deprecated)

  32  
  33  
  34  
  35  if( empty($c) )
  36  {    // Comments not requested
  37      $disp_comments = 0;                    // DO NOT Display the comments if not requested

  38      $disp_comment_form = 0;            // DO NOT Display the comments form if not requested

  39  }
  40  
  41  if( empty($tb) || (!$Blog->get( 'allowtrackbacks' )) )
  42  {    // Trackback not requested or not allowed
  43      $disp_trackbacks = 0;                // DO NOT Display the trackbacks if not requested

  44      $disp_trackback_url = 0;        // DO NOT Display the trackback URL if not requested

  45  }
  46  
  47  if( empty($pb) )
  48  {    // Pingback not requested
  49      $disp_pingbacks = 0;                // DO NOT Display the pingbacks if not requested

  50  }
  51  
  52  ?>
  53  <a id="feedbacks"></a>
  54  <?php
  55  
  56  if( ! ($disp_comments || $disp_comment_form || $disp_trackbacks || $disp_trackback_url || $disp_pingbacks ) )
  57  {    // Nothing more to do....
  58      return false;
  59  }
  60  
  61  $type_list = array();
  62  $disp_title = array();
  63  if(  $disp_comments )
  64  {    // We requested to display comments
  65      if( $Item->can_see_comments() )
  66      { // User can see a comments
  67          $type_list[] = "'comment'";
  68          $disp_title[] = T_("Comments");
  69      }
  70      else
  71      { // Use cannot see comments
  72          $disp_comments = false;
  73      }
  74      ?>
  75      <a id="comments"></a>
  76  <?php }
  77  if( $disp_trackbacks ) {
  78      $type_list[] = "'trackback'";
  79      $disp_title[] = T_("Trackbacks"); ?>
  80      <a id="trackbacks"></a>
  81  <?php }
  82  if( $disp_pingbacks ) {
  83      $type_list[] = "'pingback'";
  84      $disp_title[] = T_("Pingbacks"); ?>
  85      <a id="pingbacks"></a>
  86  <?php } ?>
  87  
  88  <?php
  89  if( $disp_trackback_url )
  90  {    // We want to display the trackback URL:
  91      ?>
  92      <h4><?php echo T_('Trackback address for this post:') ?></h4>
  93      <?php
  94      /*

  95       * Trigger plugin event, which could display a captcha form, before generating a whitelisted URL:

  96       * fp> What's the difference between a "whitelisted" URL and a normal trackback URL ??

  97       */
  98      if( ! $Plugins->trigger_event_first_true( 'DisplayTrackbackAddr', array('Item' => & $Item, 'template' => '<code>%url%</code>') ) )
  99      { // No plugin displayed a payload, so we just display the default:
 100          ?>
 101          <code><?php $Item->trackback_url() ?></code>
 102          <?php
 103      }
 104  }
 105  ?>
 106  
 107  <?php
 108  if( $disp_comments || $disp_trackbacks || $disp_pingbacks  )
 109  {
 110      if( $disp_comments )
 111  ?>
 112  
 113  <!-- Title for comments, tbs, pbs... -->
 114  <h4><?php echo implode( ", ", $disp_title) ?>:</h4>
 115  
 116  <?php
 117  $CommentList = & new CommentList( NULL, implode(',', $type_list), array('published'), $Item->ID, '', 'ASC' );
 118  
 119  $CommentList->display_if_empty( array(
 120          'msg_empty' => sprintf( /* TRANS: NO comments/trackabcks/pingbacks/ FOR THIS POST... */
 121                                                  T_('No %s for this post yet...'), implode( "/", $disp_title) ),
 122       ) );
 123  
 124  while( $Comment = & $CommentList->get_next() )
 125  {    // Loop through comments:
 126      ?>
 127      <!-- ========== START of a COMMENT/TB/PB ========== -->
 128      <?php $Comment->anchor() ?>
 129      <h5>
 130      <?php
 131          switch( $Comment->get( 'type' ) )
 132          {
 133              case 'comment': // Display a comment:
 134                  echo T_('Comment from:') ?>
 135                  <?php $Comment->author() ?>
 136                  <?php $Comment->author_url( '', ' &middot; ', '' ) ?>
 137                  <?php break;
 138  
 139              case 'trackback': // Display a trackback:
 140                  echo T_('Trackback from:') ?>
 141                  <?php $Comment->author( 'htmlbody', true ) ?>
 142                  <?php break;
 143  
 144              case 'pingback': // Display a pingback:
 145                  echo T_('Pingback from:') ?>
 146                  <?php $Comment->author( 'htmlbody', true ) ?>
 147                  <?php break;
 148          }
 149  
 150          $Comment->edit_link( ' &middot; ' ) // Link to backoffice for editing
 151      ?>
 152      </h5>
 153      <blockquote>
 154          <small><?php $Comment->date() ?> @ <?php $Comment->time( 'H:i' ) ?></small>
 155          <div><?php $Comment->content() ?></div>
 156      </blockquote>
 157      <!-- ========== END of a COMMENT/TB/PB ========== -->
 158      <?php
 159  }
 160  
 161  if( $disp_comment_form )
 162  {    // We want to display the comments form:
 163      if( $Item->can_comment() )
 164      { // User can leave a comment
 165      ?>
 166      <h4><?php echo T_('Leave a comment') ?>:</h4>
 167  
 168      <?php
 169          $comment_author = isset($_COOKIE[$cookie_name]) ? trim($_COOKIE[$cookie_name]) : '';
 170          $comment_author_email = isset($_COOKIE[$cookie_email]) ? trim($_COOKIE[$cookie_email]) : '';
 171          $comment_author_url = isset($_COOKIE[$cookie_url]) ? trim($_COOKIE[$cookie_url]) : '';
 172      ?>
 173  
 174      <!-- form to add a comment -->
 175      <form action="<?php echo $htsrv_url ?>comment_post.php" method="post">
 176  
 177          <input type="hidden" name="comment_post_ID" value="<?php echo $Item->ID() ?>" />
 178          <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(url_rel_to_same_host(regenerate_url('','','','&'), $htsrv_url)) ?>" />
 179  
 180      <table>
 181          <?php
 182          if( is_logged_in() )
 183          { // User is logged in:
 184              ?>
 185              <tr valign="top" bgcolor="#eeeeee">
 186                  <td align="right"><strong><?php echo T_('User') ?>:</strong></td>
 187                  <td align="left">
 188                      <strong><?php $current_User->preferred_name()?></strong>
 189                      <?php user_profile_link( ' [', ']', T_('Edit profile') ) ?>
 190                      </td>
 191              </tr>
 192              <?php
 193          }
 194          else
 195          { // User is not loggued in:
 196              ?>
 197              <tr valign="top" bgcolor="#eeeeee">
 198                  <td align="right"><label for="author"><strong><?php echo T_('Name') ?>:</strong></label></td>
 199                  <td align="left"><input type="text" name="u" id="author" value="<?php echo $comment_author ?>" size="40" tabindex="1" /></td>
 200              </tr>
 201  
 202              <tr valign="top" bgcolor="#eeeeee">
 203                  <td align="right"><label for="email"><strong><?php echo T_('Email') ?>:</strong></label></td>
 204                  <td align="left"><input type="text" name="i" id="email" value="<?php echo $comment_author_email ?>" size="40" tabindex="2" /><br />
 205                      <small><?php echo T_('Your email address will <strong>not</strong> be displayed on this site.') ?></small>
 206                  </td>
 207              </tr>
 208  
 209              <tr valign="top" bgcolor="#eeeeee">
 210                  <td align="right"><label for="url"><strong><?php echo T_('Site/Url') ?>:</strong></label></td>
 211                  <td align="left"><input type="text" name="o" id="url" value="<?php echo $comment_author_url ?>" size="40" tabindex="3" /><br />
 212                      <small><?php echo T_('Your URL will be displayed.') ?></small>
 213                  </td>
 214              </tr>
 215              <?php
 216              }
 217          ?>
 218  
 219          <tr valign="top" bgcolor="#eeeeee">
 220              <td align="right"><label for="comment"><strong><?php echo T_('Comment text') ?>:</strong></label></td>
 221              <td align="left" width="450"><textarea cols="50" rows="12" name="p" id="comment" tabindex="4"></textarea><br />
 222                  <small><?php echo T_('Allowed XHTML tags'), ': ', htmlspecialchars(str_replace( '><',', ', $comment_allowed_tags)) ?></small>
 223              </td>
 224          </tr>
 225  
 226          <tr valign="top" bgcolor="#eeeeee">
 227              <td align="right"><strong><?php echo T_('Options') ?>:</strong></td>
 228              <td align="left">
 229  
 230              <?php if(substr($comments_use_autobr,0,4) == 'opt-') { ?>
 231                  <input type="checkbox" name="comment_autobr" value="1" <?php if($comments_use_autobr == 'opt-out') echo ' checked="checked"' ?> tabindex="6" id="comment_autobr" /> <label for="comment_autobr"><strong><?php echo T_('Auto-BR') ?></strong></label> <small>(<?php echo T_('Line breaks become &lt;br /&gt;') ?>)</small><br />
 232              <?php }
 233              if( ! is_logged_in() )
 234              { // User is not logged in:
 235                  ?>
 236                  <input type="checkbox" name="comment_cookies" value="1" checked="checked" tabindex="7" id="comment_cookies" /> <label for="comment_cookies"><strong><?php echo T_('Remember me') ?></strong></label> <small><?php echo T_('(Set cookies for name, email &amp; url)') ?></small>
 237                  <?php
 238              } ?>
 239              </td>
 240          </tr>
 241  
 242          <tr valign="top" bgcolor="#eeeeee">
 243              <td colspan="2" align="center">
 244                  <input type="submit" name="submit" value="<?php echo T_('Send comment') ?>" tabindex="8" />
 245              </td>
 246          </tr>
 247      </table>
 248  
 249      </form>
 250  <?php
 251      }
 252  }
 253  ?>
 254  
 255  <?php
 256  }
 257  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics