includes/comment.php
changeset 326 ab66d6d1f1f4
parent 322 5f1cd51bf1be
child 328 dc838fd61a06
child 456 e133d321fce4
equal deleted inserted replaced
314:474f8be55943 326:ab66d6d1f1f4
     1 <?php
     1 <?php
     2 
     2 
     3 /*
     3 /*
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     5  * Version 1.1.1
     5  * Version 1.0.3 (Dyrad)
     6  * Copyright (C) 2006-2007 Dan Fuhry
     6  * Copyright (C) 2006-2007 Dan Fuhry
     7  *
     7  *
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    10  *
    10  *
    52   function __construct($page_id, $namespace)
    52   function __construct($page_id, $namespace)
    53   {
    53   {
    54     global $db, $session, $paths, $template, $plugins; // Common objects
    54     global $db, $session, $paths, $template, $plugins; // Common objects
    55     
    55     
    56     // Initialize permissions
    56     // Initialize permissions
    57     if ( $page_id == $paths->cpage['urlname_nons'] && $namespace == $paths->namespace )
    57     if ( $page_id == $paths->page_id && $namespace == $paths->namespace )
    58       $this->perms =& $GLOBALS['session'];
    58       $this->perms =& $GLOBALS['session'];
    59     else
    59     else
    60       $this->perms = $session->fetch_page_acl($page_id, $namespace);
    60       $this->perms = $session->fetch_page_acl($page_id, $namespace);
    61     
    61     
    62     $this->page_id = $db->escape($page_id);
    62     $this->page_id = $db->escape($page_id);
   111                                  ON (u.user_id=c.user_id)
   111                                  ON (u.user_id=c.user_id)
   112                                LEFT JOIN '.table_prefix.'buddies AS b
   112                                LEFT JOIN '.table_prefix.'buddies AS b
   113                                  ON ( ( b.user_id=' . $session->user_id.' AND b.buddy_user_id=c.user_id ) OR b.user_id IS NULL)
   113                                  ON ( ( b.user_id=' . $session->user_id.' AND b.buddy_user_id=c.user_id ) OR b.user_id IS NULL)
   114                                WHERE page_id=\'' . $this->page_id . '\'
   114                                WHERE page_id=\'' . $this->page_id . '\'
   115                                  AND namespace=\'' . $this->namespace . '\'
   115                                  AND namespace=\'' . $this->namespace . '\'
   116                                GROUP BY c.comment_id
   116                                GROUP BY c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature,b.buddy_id,b.is_friend
   117                                ORDER BY c.time ASC;');
   117                                ORDER BY c.time ASC;');
   118         $count_appr = 0;
   118         $count_appr = 0;
   119         $count_total = 0;
   119         $count_total = 0;
   120         $count_unappr = 0;
   120         $count_unappr = 0;
   121         $ret['comments'] = Array();
   121         $ret['comments'] = Array();