0) { header("Cache-Control: must-revalidate"); header("Expires: " . gmdate ("D, d M Y H:i:s", time() + ($cm_timecache2)) . " GMT"); } echo $cm_html_header; // fcm_show_usercomments // Displays user comments for a page. If no comments are found, it displays // an invitation to write a comment. function fcm_show_usercomments ($cm_path, $cm_ucpage = 1) { global $cm_text; global $cm_max_usercomments; global $cm_historical_comments, $cm_comments_chronorder; if ((($cm_path) && ($cm_path <> "/")) && (fcm_can_becommented ($cm_path) || $cm_historical_comments)) { // Find total comments... $result1 = db_query("select count(id) from " . CM_DB_PREFIX . "cmcomments3 where cmdb_directory like '$cm_path'") or db_die(); $row1 = db_fetch_row ($result1); $cm_total_comments = $row1[0]; // Calculate first and last comments in this page, checking boundaries... $cm_first_comment = ((($cm_ucpage - 1) * $cm_max_usercomments) + 1); if (($cm_total_comments < $cm_first_comment) || ($cm_ucpage == 0)) { $cm_ucpage = 1; $cm_first_comment = 1; } $cm_last_comment = ($cm_first_comment + $cm_max_usercomments - 1); $cm_cur_comment = 1; // Get all comments... 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(); } // Start to browse, showing only the comments in this page... while (($row1 = db_fetch_row ($result1)) && ($cm_cur_comment <= $cm_last_comment)) { if ($cm_cur_comment >= $cm_first_comment) { $cm_authornames = fcm_user_names ($row1[2]); echo ""; echo "
\n"; echo "$row1[1]"; echo "\n"; echo "" . fcm_htmlentity ($cm_authornames[1] . " " . $cm_authornames[2]) . " - $row1[3]"; echo "
\n"; echo fcm_process_markup ($row1[4], $cm_path, false); echo "
\n"; } $cm_cur_comment++; } echo "
"; } echo "
\n"; $cm_last_page = (ceil ($cm_total_comments / $cm_max_usercomments )); if ($cm_last_page > 1) { for ($cm_ucp = 1; $cm_ucp <= $cm_last_page; $cm_ucp++) { if ($cm_ucpage == $cm_ucp) { echo "[$cm_ucp] "; } else { echo "$cm_ucp "; } } echo "
\n"; } if (fcm_can_becommented ($cm_path)) { echo "{$cm_text["postacommentabout"]}

\n"; echo "
"; } }; // Codebase and config version mismatch verification. if ($cm_codebaseversion != $cm_currentversion) { if (fcm_user_is_superuser($user_kurz)) { fcm_message ($cm_text["configversionerror1"] . " " . $cm_text["configversionerror2"], CM_MSGSTYLE_WARNING); } else { fcm_message ($cm_text["configversionerror1"], CM_MSGSTYLE_WARNING); } fcm_add_logentry ("", $user_kurz, CM_APPLOG_ERROR, "Configuration file doesnt match codebase version."); } if ($cm_path && !($cm_path == "/")) { // if we are not in the homepage... $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, cmdb_logo 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]); $cm_validops = fcm_check_validops ($user_kurz, $cm_path); fcm_title_nav2 ($cm_path, $cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), $cm_validops[CM_SEC_DISPLA], fcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path))); fcm_doc_summary ($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 ($cm_validops[CM_SEC_CHANGE]) { fcm_warn_logoimage ($cm_path, $row1[11], $cm_enable_verifylogo); } if (!stristr ($row1[10], CM_HITTYPE_CONTENTLESS)) { if (fcm_can_usehtml ($cm_path)) { if ($cm_enable_htmledit) { echo "
"; echo fcm_process_markup (fcm_secure_html (fcm_decode_htmlfull ($row1[2])), $cm_path, true); echo "
"; } else { echo "
"; echo fcm_process_markup (fcm_htmlentity (fcm_decode_html ($row1[2])), $cm_path, false); echo "
"; } } else { echo "
"; echo fcm_process_markup ($row1[2], $cm_path, false); echo "
"; } } fcm_show_userratings ($cm_path); fcm_show_usercomments ($cm_path, $cm_uccp); fcm_title_nav2 ($cm_path, $cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), $cm_validops[CM_SEC_DISPLA], fcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path))); } else { // if user has no permissions... fcm_title_nav2 ("", false, false, false, false, false, false, false); fcm_message ($cm_text["needaccess2view"], CM_MSGSTYLE_WARNING); fcm_add_logentry ("", $user_kurz, CM_APPLOG_ERROR, "Error when displaying page. Not enough permissions."); } } else { // if document don't exist... fcm_title_nav2 ("", false, false, false, false, false, false, false); fcm_message ($cm_text["dirnotfound"], CM_MSGSTYLE_ERROR); fcm_add_logentry ("", $user_kurz, CM_APPLOG_ERROR, "Error when displaying page. Dir not found."); } } // if we are in the homepage... else { $cm_validops = fcm_check_validops ($user_kurz, $cm_path); fcm_title_nav2 ($cm_path, $cm_validops[CM_SEC_CREATE], $cm_validops[CM_SEC_DELETE], $cm_validops[CM_SEC_CHANGE], $cm_validops[CM_SEC_DISPLA], ($cm_validops[CM_SEC_COMMEN] && fcm_can_becommented ($cm_path)), $cm_validops[CM_SEC_DISPLA], fcm_user_is_superuser($user_kurz), ($cm_validops[CM_SEC_COMMEN] && fcm_can_berated ($cm_path))); $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... echo "
\n"; $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 "\n"; echo "\"\""; echo "\n"; fcm_load_synd (false, true, false); fcm_display_synd (false, true, false); echo "
\n"; } echo $cm_html_footer; ?>