<?php // Content Management System module for PHProjekt (CMS4P). // Copyright ©2002-2005 by Mario A. Valdez-Ramirez // http://www.mariovaldez.net/ // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // You can contact Mario A. Valdez-Ramirez by email // at mario@mariovaldez.org or paper mail at // Olmos 809, San Nicolas, NL. 66495, Mexico. //session_start(); $file = "display"; $path_pre="../"; include_once ($path_pre . "cm/cm_anon.inc.php"); $include_path = $path_pre . "lib/lib.inc.php"; include_once $include_path; include_once ($path_pre . "cm/cm_lib.inc.php"); fcm_load_secdb ($cm_security); echo $cm_print_header; // fcm_show_txtusercomments // Displays all user comments for a page. // This function ignores the value of $cm_max_usercomments. function fcm_show_txtusercomments ($cm_path) { global $cm_text; global $cm_historical_comments, $cm_comments_chronorder; if ((($cm_path) && ($cm_path <> "/")) && (fcm_can_becommented ($cm_path) || $cm_historical_comments)) { $cm_total_comments = 0; if ($cm_comments_chronorder) { $result1 = db_query("select cmdb_directory, cmdb_title, cmdb_author_user, cmdb_date_creation, cmdb_comment, id from " . CM_DB_PREFIX . "cmcomments3 where cmdb_directory like '$cm_path' order by id asc") or db_die(); } else { $result1 = db_query("select cmdb_directory, cmdb_title, cmdb_author_user, cmdb_date_creation, cmdb_comment, id from " . CM_DB_PREFIX . "cmcomments3 where cmdb_directory like '$cm_path' order by id desc") or db_die(); } while ($row1 = db_fetch_row ($result1)) { $cm_authornames = fcm_user_names ($row1[2]); echo "<p class=\"commentsheader\"><strong>$row1[1]</strong> "; echo "<em>" . fcm_htmlentity ($cm_authornames[1] . " " . $cm_authornames[2]) . "</em> - $row1[3]</p>"; echo fcm_process_markup ($row1[4], $cm_path, false); $cm_total_comments++; } echo "<HR>"; } }; if ($cm_path) { $result1 = db_query("select cmdb_title, cmdb_directory, cmdb_content, cmdb_abstract, cmdb_keywords, cmdb_author_user, cmdb_owner_user, cmdb_viewer_group, cmdb_date_creation, cmdb_date_update, cmdb_type from " . CM_DB_PREFIX . "content3 where cmdb_directory like '$cm_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' order by upper(cmdb_title)") or db_die(); $row1 = db_fetch_row($result1); if ($row1[1]) { // If this document exists and user has permission, render it... if (fcm_check_constraints (CM_SEC_DISPLA, $user_kurz, $cm_path)) { $cm_authornames = fcm_user_names ($row1[5]); $cm_ownernames = fcm_user_names ($row1[6]); $cm_groupnames = fcm_group_names ($row1[7]); echo "<p class=\"cms\">" . fcm_curdate_string () . "<br>$cm_path</p>"; fcm_doc_txtsummary ($cm_authornames[1] . " " . $cm_authornames[2], $cm_ownernames[1] . " " . $cm_ownernames[2], $cm_groupnames[1], $row1[8], $row1[9], $row1[0], $row1[4], $row1[3], fcm_mark_visit ($cm_path, CM_HITTYPE_PAGE), fcm_get_updatehits ($cm_path, CM_HITTYPE_PAGE), fcm_getaverage_rating ($cm_path)); if (!stristr ($row1[10], CM_HITTYPE_CONTENTLESS)) { if (fcm_can_usehtml ($cm_path)) { if ($cm_enable_htmledit) { echo fcm_process_markup (fcm_secure_html (fcm_decode_htmlfull ($row1[2])), $cm_path, true); echo "<br>"; } else { echo fcm_process_markup (fcm_htmlentity (fcm_decode_html ($row1[2])), $cm_path, false); } } else { echo fcm_process_markup ($row1[2], $cm_path, false); } } fcm_show_txtusercomments ($cm_path); } else { fcm_message ($cm_text["needaccess2view"], CM_MSGSTYLE_WARNING); } } else { fcm_message ($cm_text["dirnotfound"], CM_MSGSTYLE_ERROR); } } // if we are in the homepage... else { $cm_pppos = strrpos ($cm_path, "/"); if ($cm_pppos == 0) { $cm_tl_path = "/"; } else { $cm_tl_path = substr ($cm_path, 0, $cm_pppos); } // search all root-level documents... $result2 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_viewer_group, cmdb_type, cmdb_logo from " . CM_DB_PREFIX . "content3 where cmdb_parentdir = '$cm_tl_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " order by upper(cmdb_title)") or db_die(); // display all root-level announces... while ($row2 = db_fetch_row($result2)) { if (stristr ($row2[6], CM_HITTYPE_ANNOUNCE)) { fcm_articlelist_box ($row2[1], $row2[0], $row2[3], $row2[4], true, fcm_get_totalcomments ($row2[1]), fcm_get_totalhits ($row2[1], CM_HITTYPE_PAGE), fcm_getaverage_rating ($row2[1]), fcm_is_cleditable ($row2[1], $user_kurz, $row2[6]), true, $row2[7], false); } } // search all root-level documents... $result2 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_viewer_group, cmdb_type, cmdb_logo from " . CM_DB_PREFIX . "content3 where cmdb_parentdir = '$cm_tl_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " order by upper(cmdb_title)") or db_die(); // display all root-level non-announces... while ($row2 = db_fetch_row($result2)) { if (!stristr ($row2[6], CM_HITTYPE_ANNOUNCE)) { fcm_articlelist_box ($row2[1], $row2[0], $row2[3], $row2[4], true, fcm_get_totalcomments ($row2[1]), fcm_get_totalhits ($row2[1], CM_HITTYPE_PAGE), fcm_getaverage_rating ($row2[1]), fcm_is_cleditable ($row2[1], $user_kurz, $row2[6]), false, $row2[7], false); } // search for children documents (deep search), announce type... $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from " . CM_DB_PREFIX . "content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_ANNOUNCE . "%' " . fcm_access_sqldef ($user_kurz) . " order by cmdb_date_update desc") or db_die(); $cm_rowcount = 1; while ($row3 = db_fetch_row($result3)) { //if ($cm_rowcount > $cm_home_maxleafs) { // break; //} fcm_articlelist_box ($row3[1], $row3[0], $row3[3], $row3[4], false, fcm_get_totalcomments ($row3[1]), fcm_get_totalhits ($row3[1], CM_HITTYPE_PAGE), fcm_getaverage_rating ($row3[1]), fcm_is_cleditable ($row3[1], $user_kurz, $row3[5]), true, $row3[6], false); $cm_rowcount++; } // search for children documents (deep search), non-announces... $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from " . CM_DB_PREFIX . "content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' and cmdb_type not like '%" . CM_HITTYPE_ANNOUNCE . "%' " . fcm_access_sqldef ($user_kurz) . " order by cmdb_date_update desc") or db_die(); while ($row3 = db_fetch_row($result3)) { if ($cm_rowcount > $cm_home_maxleafs) { break; } // display if the article is not too old or if we don't have the minimal... if ((fcm_diffdate_days ($row3[4]) <= $cm_home_oldestleafallowed) || ($cm_rowcount <= $cm_home_minleafs)) { fcm_articlelist_box ($row3[1], $row3[0], $row3[3], $row3[4], false, fcm_get_totalcomments ($row3[1]), fcm_get_totalhits ($row3[1], CM_HITTYPE_PAGE), fcm_getaverage_rating ($row3[1]), fcm_is_cleditable ($row3[1], $user_kurz, $row3[5]), false, $row3[6], false); $cm_rowcount++; } else { break; } } } echo "<hr>"; } echo $cm_print_footer; ?>