http://www.fsf.org/ or write * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */ /* MAIN FILE FOR COMMENTATOR cmsdAm PLUGIN */ /* Variables that we can use $comments_per_page number of comments for each page $comments_td_color[0] background color number 1 $comments_td_color[1] background color 2 */ /* Variables that we probably can use $PageMaxRows number of comments for each pagee $users cmsdam users class instance $cms cmsdam cms class instance $page page number $section section name $client_ip IP addres of the client */ include ("plugins/commentator/configure.php"); Class CmsDam_Commentator /* This class is the core of cmsdam_commentator */ { var $comments; // comments array var $page_comments; // comments array after paginator var $total_ncomments; // total comment numbers var $page_ncomments; // comment numbers for page $page function CmsDam_Commentator() { // CmsDam_Commentator Constructor $this->CmsDam_Commentator_List(); } function CmsDam_Comment_limiter($conf) { // This function is the commentator limiter // Global $conf, $PageMaxRows, $cms, $page, $section, $client_ip; // TODO: Implement this method!! return true; } function CmsDam_Commentator_Add($comment_text) { // Add a comment for the present section Global $conf, $PageMaxRows, $cms, $page, $section, $client_ip; if (!$this->CmsDam_Comment_limiter($conf)) { // Comment limiter check failed! // Are u trying to flood us?!!! return false; } if (strlen(trim($comment_text)) <= 1) { // Text check return true; } // echo "DEBUG: Comment: $comment_text"; if (!$cms->sections->comment_add ($comment_text)) { // Add comment $cms->logs->log_note(5, "WARNING: Commentator plugin: error adding comment for section \"$section\", text: $comment_text"); return false; } $cms->logs->log_note(7, "NOTE: Commentator plugin: comment added for section \"$section\", text: $comment_text"); return true; } function CmsDam_Commentator_List() { Global $PageMaxRows, $cms, $page, $section, $client_ip; $conf = new CmsDam_Commentator_Conf; // echo "DEBUG: comments_inputname " . $conf->comments_inputname; if (isset($PageMaxRows) && ($PageMaxRows > 0)) { // $PageMaxRows overrides $comments_per_page (conf file) $conf->comments_per_page = $PageMaxRows; } $cms->dbms->DB_connect(); if ($cms->dbms->db_connected != 1) { // DB not connected $cms->logs->log_note(4, "WARNING: Commentator plugin: error connetting to the DB!"); return false; } $inputname = $conf->comments_inputname; Global $$inputname; // echo "DEBUG: comments_inputname: " . $$inputname; if (isset($$inputname) && strlen($$inputname) > 0) { // A comment was added $this->CmsDam_Commentator_Add($$inputname); } // Comments array for section $section $this->comments = $cms->sections->comment_getarray(); $this->total_ncomments = count ($this->comments); // Number of comment pages for section $section $pages = $cms->paginator->paginator_pages ($conf->comments_per_page, $this->comments); if ($pages < 1) $pages = 1; if (($page <= 0) || ($page > $pages) || (!$page)) { // Page number is not valid $page = 1; } // Paginator!! $this->page_comments=$cms->paginator->paginator_array($conf->comments_per_page,$page,$this->comments); $this->page_ncomments = count ($this->page_comments); ?>

\n"; ?> \n"; ?>

 <<\n"; } else { // This is not the first page echo "sections->section_uri("$section", 1) . "&page=" . ($page - 1) . "#commentator\"> <<\n"; } echo "

Pagina di

>> \n"; } else { // This is not the last page echo "sections->section_uri("$section", 1) . "&page=" . ($page + 1) . "#commentator\">>> \n"; } echo "

page_ncomments; $i++) { // Paginator comments cycle $color_bg = $conf->comments_td_color[$i % 2]; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
Utente Commento Data
\n"; $username = $users->user_namebyid($this->page_comments[$i][2]); echo "" . $username . "\n"; echo "" . $this->page_comments[$i][1] . "\n"; echo "" . $this->page_comments[$i][4] . "
\n"; $cms->log_note(9, "USELESS NOTE: Commentator plugin: comments read ok for section \"$section\""); ?>
comments_submitimage) && (trim(strlen($conf->comments_submitimage)) >= 1)) { echo ''; } else { echo ''; } ?>