[ PHPXref.com ] [ Generated: Sun Jul 20 16:35:25 2008 ] [ bBlog 0.7.6 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/bblog/bBlog_plugins/ -> function.getcomments.php (source)

   1  <?php
   2  // block.comments.php - BBlog comments
   3  // block.comments.php - author: Eaden McKee <email@eadz.co.nz>
   4  /*
   5  ** bBlog Weblog http://www.bblog.com/
   6  ** Copyright (C) 2003  Eaden McKee <email@eadz.co.nz>
   7  **
   8  ** This program is free software; you can redistribute it and/or modify
   9  ** it under the terms of the GNU General Public License as published by
  10  ** the Free Software Foundation; either version 2 of the License, or
  11  ** (at your option) any later version.
  12  **
  13  ** This program is distributed in the hope that it will be useful,
  14  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  ** GNU General Public License for more details.
  17  **
  18  ** You should have received a copy of the GNU General Public License
  19  ** along with this program; if not, write to the Free Software
  20  ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21  */
  22  function identify_function_getcomments () {
  23  $help = '
  24  <p>Provides threaded comments. See the default templates for usage examples.';
  25  
  26    return array (
  27      'name'           =>'getcomments',
  28      'type'             =>'function',
  29      'nicename'     =>'Get Comments',
  30      'description'   =>'Gets Comments and trackbacks for a post and threads them',
  31      'authors'        =>'Eaden McKee <eaden@eadz.co.nz>',
  32      'licence'         =>'GPL',
  33      'help'   => $help
  34    );
  35  }
  36  function smarty_function_getcomments ($params, &$bBlog) {
  37      $assign="comments";
  38      $postid=$bBlog->show_post;
  39      $replyto = $_REQUEST['replyto'];
  40      extract($params);
  41  
  42          // first, assign the hidden fields
  43          $commentformhiddenfields = '<input type="hidden" name="do" value="submitcomment" />';
  44          $commentformhiddenfields .='<input type="hidden" name="comment_postid" value="'.$postid.'" />';
  45          if(is_numeric($replyto)) {
  46                $commentformhiddenfields .= '<a name="commentform"></a><input type="hidden" name="replytos" value="'.$replyto.'" />';
  47          }
  48          $bBlog->assign("commentformhiddenfields",$commentformhiddenfields);
  49          $bBlog->assign("commentformaction",$bBlog->_get_entry_permalink($postid));
  50          // are we posting a comment ?
  51          if($_POST['do'] == 'submitcomment' && is_numeric($_POST['comment_postid'])) { // we are indeed!
  52              if(is_numeric($_POST['replytos'])) $rt = $_POST['replytos'];
  53              else $rt =  false;
  54  
  55              $bBlog->new_comment($_POST['comment_postid'],$rt);
  56          }
  57                     
  58          // get the comments.
  59          
  60          /* start loop and get posts*/
  61          $rt = false;
  62          if(is_numeric($_GET['replyto'])) {
  63              $rt = $_GET['replyto'];
  64              $cs = $bBlog->get_comment($postid,$rt);
  65          } else {
  66              $cs = $bBlog->get_comments($postid,FALSE);
  67          }
  68          
  69  
  70  
  71            /* assign loop variable */
  72          $bBlog->assign($assign, $cs);
  73  
  74  
  75  
  76  
  77  }
  78  
  79  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]