mariovaldez.net

MV.net forums
It is currently 14 Jul 2016, 00:45

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
PostPosted: 08 Jul 2003, 13:28 
Here's a patch to include recently modified documents in the summary page of phprojekt version 4.

Add to the bottom of summary.php
Code:
// Summary for New Articles
// Added by Mark Coudriet
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 ("cm_lib.inc.php");
fcm_load_secdb ($cm_security);
$summary_maxleafs = 1; // more control over max leafs
$days_old = 10; // articles newer than n days will be displayed
$expired = mktime (0,0,0,date("m")  ,date("d") - $days_old ,date("Y"));
$expired = date("Y-m-d H:i:s", $expired);
echo $cm_html_header;


 $cm_validops = fcm_check_validops ($user_kurz, $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 "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"maincontent\" width=\"100%\" valign=\"top\">\n";
  $result2 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_viewer_group, cmdb_type, cmdb_logo from content3 where cmdb_parentdir = '$cm_tl_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "' 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 content3 where cmdb_parentdir = '$cm_tl_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "'  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)) {
     if (($b/2) == round($b/2)) { $color = "#B7D3FC";$b++; } else { $color = "#C9C7BA";$b++; } // change colour for each entry
     echo "<div style=\"background-color: $color;\">";
      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);
     echo "</div>";
     }
    // search for children documents (deep search)...
    $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "'  order by cmdb_date_update desc") or db_die();
    $cm_rowcount = 1;
    // display announces first, only max allowed...
    while ($row3 = db_fetch_row($result3)) {
      if ($cm_rowcount > $summary_maxleafs) {
        break;
      }
      if (stristr ($row3[5], CM_HITTYPE_ANNOUNCE)) {
        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)...
    $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "' order by cmdb_date_update desc") or db_die();
    // display non-announces, only max allowed...
    while ($row3 = db_fetch_row($result3)) {
       if (($b/2) == round($b/2)) { $color = "#D2ECFF";$b++; } else { $color = "#EBEBEE";$b++; } // change colour for each entry
      if ($cm_rowcount > $summary_maxleafs) {
        break;
      }
      if (!stristr ($row3[5], CM_HITTYPE_ANNOUNCE)) {
       echo "<div style=\"background-color: $color;\">";
        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++;
        echo "</div>";
      }
    }
  }
// End Added


Then add this to the summary folder in phprojekt.
This is an edited copy of the original cm_lib_inc.php that the content management module uses.
file name is cm_lib_inc.php
[code]
<?php
// Content Management System module for PHProjekt (CMS4P).
// Copyright ©2002, 2003 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.


// Set error reporting level.
error_reporting(E_ALL & ~E_NOTICE);

// Set code version (not the config version).
$cm_codebaseversion = "0.6.0b8";
$cm_codebasedetails = array (0, 6, 0, "b", "8");

// Set paths.
$cm_langpath = $path_pre."cm/lang";
$cm_libpath = $path_pre."cm/lib";
$cm_docpath = $path_pre."cm/doc";
$cm_imgpath = $path_pre."cm/img";
$cm_cfgpath = $path_pre."cm/cm_config.inc.php";

// Load config file.
if (is_readable ("$cm_cfgpath")) include ("$cm_cfgpath");
else { die ("panic: cm_config.inc.php doesn't exist!! Did you backup it after installation? ..."); }

// set charset
if (eregi('pl|cz|hu|si',$langua)) { $lcfg="iso-8859-2"; }
elseif ($langua=="jp") { $lcfg = "euc-jp"; }
elseif ($langua=="sk") { $lcfg = "iso-8859-2"; } // previously windows-1250
elseif ($langua=="ru") { $lcfg = "iso-8859-5"; } // previously windows-1251
//elseif ($langua=="ru") { $lcfg = "koi8-r"; } // Russian alternative
elseif ($langua=="tw") { $lcfg = "big5"; }
elseif ($langua=="zh") { $lcfg = "gb2312"; }
else { $lcfg="iso-8859-1"; }
if ($lcfg <> "") { $lang_cfg = "<meta http-equiv='Content-Type' content='text/html; charset=$lcfg'>"; }

// Load language strings file.
$cm_languages = array ("es" => 1, "en" => 1, "nl" => 1, "de" => 1, "fr" => 1, "ct" => 1);
if (array_key_exists (strtolower ($langua), $cm_languages)) {
$cm_langua = strtolower ($langua);
include("$cm_langpath/$cm_langua.inc.php");
}
else { $cm_langua = "en"; include("$cm_langpath/en.inc.php"); }

// Check if we are in safe-mode...
if (ini_get ("safe_mode")) {
$cm_safemode = true;
}
else {
$cm_safemode = false;
}

// Define User-Agent string...
$cm_tmpsoftwarename = explode (" ", $HTTP_SERVER_VARS["SERVER_SOFTWARE"]);
$cm_mod_useragent = "User-Agent: CMS4P/$cm_codebaseversion Phprojekt/$version " . $cm_tmpsoftwarename[0] . " " . ucwords ($db_type) . "/unknown";

// Load filetypes, mimetypes and images file.
include_once ($path_pre . "cm/cm_filetypes.inc.php");
include_once ($path_pre . "cm/cm_mimetypes.inc.php");
include_once ($path_pre . "cm/cm_images.inc.php");

// Include the constraints matrix functions.
include_once ($path_pre . "cm/cm_constraints.inc.php");

// Get the user-agent...
$cm_http_useragent = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
$cm_php_self = $HTTP_SERVER_VARS["PHP_SELF"];
$cm_server_name = $HTTP_SERVER_VARS["SERVER_NAME"];

// Set CSS file.
$css_style = $path_pre . "cm/cm-style.css";
$css_txt_style = $path_pre . "cm/cm-styletxt.css";

// Define default HTML header, footer and tabs coding.
$cm_html_header = "<html><head>\n<title>{$cm_text["contentmanagement"]}</title>\n
<link rel=stylesheet type=\"text/css\" href=\"$css_style\">\n$lang_cfg\n</head>\n
<body bgcolor=\"$bgcolor3\" leftmargin=\"20\" topmargin=\"20\" rightmargin=\"20\" bottommargin=\"20\">\n";
$cm_html_footer = "<table align=\"right\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n
<tr><td class=\"footertext\">$user_kurz ($langua, $cm_langua, $lcfg): $cm_currentversion</td></tr></table>\n</body></html>\n";
$cm_print_header = "<html><head>\n<title>{$cm_text["contentmanagement"]}</title>
<link rel=stylesheet type=\"text/css\" href=\"$css_txt_style\">\n$lang_cfg\n</head>\n
\n<body>\n";
$cm_print_footer = "<p class=\"footertext\">$user_kurz ($langua, $cm_langua, $lcfg): $cm_currentversion</p>\n</body></html>\n";
$cm_nav_mouseover="";
// Legacy definitions for PP3.3 navigation.
//$cm_nav_pre1="<td class=\"cms\"><img src='$img_path/links2.gif' border='0'></td>";
$cm_nav_pre1="<td><img src='../../img/theme/border/fronttopleft.gif' border=0 align=top><div style='background-color: white;'><br><br><br></div></td>";
$cm_nav_pre2="<td class=\"cms\"><img src='$img_path/links.gif' border='0'></td>";
//$cm_nav_post1="<td class=\"cms\"><img src='$img_path/rechts2.gif' border='0'>&nbsp;</td>";
$cm_nav_post1="<td class=\"cms\"></td>";
$cm_nav_post2="<td class=\"cms\"><img src='$img_path/rechts.gif' border='0'>&nbsp;</td>";
$cm_nav_slicer="";

// Define some constants.
define ("CM_MSGSTYLE_WARNING", 1);
define ("CM_MSGSTYLE_ERROR", 2);
define ("CM_MSGSTYLE_INFORMATION", 3);
define ("CM_MSGSTYLE_QUESTION", 4);
define ("CM_HITTYPE_PAGE", "p");
define ("CM_HITTYPE_FILE", "f");
define ("CM_HITTYPE_ELINK", "l");
define ("CM_HITTYPE_SYND", "s");
define ("CM_HITTYPE_CONTENTLESS", "b");
define ("CM_HITTYPE_ANNOUNCE", "w");
define ("CM_MIN_RATE", 1); //This must be higher than 0
define ("CM_MAX_RATE", 5);
define ("CM_APPLOG_ADD_ROOT", 1);
define ("CM_APPLOG_ADD_PAGE", 2);
define ("CM_APPLOG_DEL_PAGE", 3);
define ("CM_APPLOG_EDIT_PAGE", 4);
define ("CM_APPLOG_POST_COMMENT", 5);
define ("CM_APPLOG_ERROR", 6);
define ("CM_APPLOG_GET_SYND", 7);
define ("CM_APPLOG_FILE", 8);
define ("CM_APPLOG_EDIT_SECURITY", 10);
define ("CM_APPLOG_INFO", 11);
define ("CM_APPLOG_CHECKER", 12);
define ("CM_APPLOG_RATE_PAGE", 13);
define ("CM_APPLOG_EDIT_SYND", 14);
define ("CM_MAX_LOGO_SIZE", 20480);
define ("CM_DEFAULT_MARKUP", "#SHORTINDEX#");
define ("CM_MAX_SYNDLEN", 60);



// fcm_user_groups
// Build an array of the group the user belongs to.
// If the setup is groupless, an empty array is returned.
function fcm_user_groups ($cm_username) {
global $groups;
$cm_groups = array ();
if ($groups) {
$cm_row_count = 0;
$result2 = db_query ("select ID, kurz from users where kurz = '$cm_username'") or db_die();
$row2 = db_fetch_row ($result2);
$result1 = db_query ("select user_ID, gruppen.kurz from grup_user, gruppen where
grup_user.user_ID = '$row2[0]' and
grup_user.grup_ID = gruppen.ID") or db_die();
while ($row1 = db_fetch_row ($result1)) {
$cm_groups[$cm_row_count] = $row1[1];
$cm_row_count++;
}
}
return ($cm_groups);
};


// fcm_access_sqldef
// Build a SQL string of conditions to restrict the query to the groups
// the user belongs to.
// This string is concatenated to the SQL query after all other conditions.
function fcm_access_sqldef ($cm_username) {
$cm_access_def = "";
if (!fcm_check_anyglobal (CM_SEC_DISPLA, $cm_username, CM_SEC_SDIR)) {
$cm_user_groups = fcm_user_groups ($cm_username);
foreach ($cm_user_groups as $cm_cur_acc_group) {
$cm_access_def .= " or cmdb_viewer_group = '$cm_cur_acc_group'";
}
if ($cm_access_def) {
$cm_access_def = " and (" . substr ($cm_access_def, 4) . " or cmdb_viewer_group = '')";
}
}
return ($cm_access_def);
};


// fcm_doc_summary
// Displays the summary at the beginning of all pages.
// You must already have the information, this function only display data,
// don't search for it.
function fcm_doc_summary ($cm_uauthor, $cm_uowner, $cm_gviewer, $cm_dcreation, $cm_dupdate, $cm_title, $cm_keywords, $cm_summary, $cm_totalvisits, $cm_updatevisits, $cm_rating) {
global $cm_text, $cm_imgpath;
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"docdataborder\">\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n";
echo "<tr><td><h3 class=\"docdatatitle\">$cm_title</h3>";
echo "</td><td class=\"docdatabody\" valign=\"top\" rowspan=\"2\" nowrap>";
echo "<strong>{$cm_text["owner"]}:</strong> " . fcm_unspecialchars ($cm_uowner) . "<br>";
echo "<strong>{$cm_text["visibleto"]}:</strong> " . fcm_unspecialchars ($cm_gviewer) . "<br>";
echo "<strong>{$cm_text["update"]}:</strong> " . substr ($cm_dupdate, 0, 10) . "<br>";
echo "<strong>{$cm_text["visits"]}:</strong> " . $cm_totalvisits . " / " . $cm_updatevisits . "<br>";
if ($cm_rating) {
echo "<strong>{$cm_text["averagerating"]}:</strong> " . str_repeat ("<img src=\"$cm_imgpath/ratestar2.gif\" width=\"8\" height=\"8\" border=\"0\" alt=\"*\">", $cm_rating) . " (" . round ($cm_rating, 1) . ")";
}
echo "</td></tr>\n";
echo "<tr><td class=\"docdatabody\">";
if ($cm_summary) {
echo "$cm_summary<br>";
}
echo "</td></tr>";
echo "</table>\n";
echo "</td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
}


// fcm_doc_txtsummary
// Displays the summary at the beginning of all pages.
// You must already have the information, this function only display data,
// don't search for it. This is the printable version.
function fcm_doc_txtsummary ($cm_uauthor, $cm_uowner, $cm_gviewer, $cm_dcreation, $cm_dupdate, $cm_title, $cm_keywords, $cm_summary, $cm_totalvisits, $cm_updatevisits, $cm_rating) {
global $cm_text, $cm_imgpath;
echo "<h3 class=\"docdatatitle\">$cm_title</h3>";
echo "<p class=\"docdatabody\"><strong>{$cm_text["owner"]}:</strong> " . fcm_unspecialchars ($cm_uowner) . "<br>";
echo "<strong>{$cm_text["visibleto"]}:</strong> " . fcm_unspecialchars ($cm_gviewer) . "<br>";
echo "<strong>{$cm_text["update"]}:</strong> " . substr ($cm_dupdate, 0, 10) . "<br>";
echo "<strong>{$cm_text["visits"]}:</strong> " . $cm_totalvisits . " / " . $cm_updatevisits . "<br>";
if ($cm_rating) {
echo "<strong>{$cm_text["averagerating"]}:</strong> " . str_repeat ("*", $cm_rating) . " (" . round ($cm_rating, 1) . ")";
}
if ($cm_summary) {
echo "<br>$cm_summary";
}
echo "</p>";
}


// fcm_bread_crumbs
// Generates the bread crumbs navigation links for a given page/directory.
function fcm_bread_crumbs ($cm_path, $cm_crumb_separator, $cm_crumb_active) {
global $cm_text;
$cm_crumb_separator = fcm_htmlentity ($cm_crumb_separator);
if ($cm_crumb_active) {
$cm_breadcrumbs_str = "<A class=\"cms\" HREF=\"display.php?cm_path=\">{$cm_text["root"]}</A>";
}
else {
$cm_breadcrumbs_str = $cm_text["root"];
}
$cm_displaynodes = explode ("/", substr ($cm_path, 1));
$cm_displaypath = "";
foreach ($cm_displaynodes as $cm_path_node) {
$cm_displaypath .= "/" . $cm_path_node;
$result1 = db_query("select cmdb_directory, cmdb_short_title, cmdb_abstract from content3 where cmdb_directory like '$cm_displaypath'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[1]) {
if ($cm_crumb_active) {
$cm_breadcrumbs_str .= " $cm_crumb_separator <A class=\"cms\" HREF=\"display.php?cm_path=$cm_displaypath\" TITLE=\"" . substr ($row1[2], 0, 70) . "...\">$row1[1]</A>";
}
else {
$cm_breadcrumbs_str .= " $cm_crumb_separator $row1[1]";
}
}
else {
if ($cm_crumb_active) {
$cm_breadcrumbs_str .= " $cm_crumb_separator <A class=\"cms\" HREF=\"display.php?cm_path=$cm_displaypath\" TITLE=\"" . substr ($row1[2], 0, 70) . "...\">$cm_path_node</A>";
}
else {
$cm_breadcrumbs_str .= " $cm_crumb_separator $cm_path_node";
}
}
}
return ($cm_breadcrumbs_str);
}


// fcm_title_nav2
// Displays the navigation bars. You must already have the information, this
// function won't search for it. You must call it with the path of the page, and
// permissions for current user in the current location. Usually you can get these
// values from the array returned from fcm_check_validops function.
function fcm_title_nav2 ($cm_path, $cm_cancreate = false, $cm_candelete = false, $cm_canedit = false, $cm_canview = false, $cm_canpost = false, $cm_canprint = false, $cm_issuperuser = false, $cm_canrate = false) {
global $cm_text, $cm_imgpath, $cm_control_iconwidth, $cm_control_iconheight, $cm_image_filename, $cm_icon_set, $cm_text_icons;
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"navborder\">\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo "<tr><td class=\"navbody\">&nbsp;";
echo fcm_bread_crumbs ($cm_path, ">", true);
//echo "</td><td class=\"navbody\" align=\"right\">";
// Begin Modified by Mark Coudriet
echo "</td><td class=\"navbody\" align=\"right\"><a href=\"http://www.mylafinancial.org/\" target=\"_new\">New Window</a>&nbsp;&nbsp;";
// End Modified
if ($cm_text_icons) {
if ($cm_issuperuser) {
echo "&nbsp;<A class=\"cms\" HREF=\"console.php\">{$cm_text["enterconsole"]}</A>&nbsp;\n";
}
if ($cm_canprint) {
echo "&nbsp;<A class=\"cms\" HREF=\"print.php?cm_path=$cm_path\" TARGET=\"_blank\">{$cm_text["printablepage"]}</A>&nbsp;\n";
}
echo "&nbsp;<A class=\"cms\" HREF=\"listing.php?cm_path=$cm_path&cm_fdn=0&cm_hdet=1\">{$cm_text["listdirs"]}</A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"search.php?cm_path=$cm_path\">{$cm_text["search"]}</A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"statshits.php?cm_path=$cm_path\">{$cm_text["stats"]}</A>&nbsp;\n";
if ($cm_canpost) {
echo "&nbsp;<A class=\"cms\" HREF=\"usercomment.php?cm_path=$cm_path\">{$cm_text["postcomment"]}</A>&nbsp;\n";
}
if ($cm_canrate) {
echo "&nbsp;<A class=\"cms\" HREF=\"userrating.php?cm_path=$cm_path\">{$cm_text["rateabout"]}</A>&nbsp;\n";
}
echo "</td></tr>\n";
echo "<tr><td class=\"navbody\" align=\"right\" colspan=\"2\">\n";
if ($cm_canedit) {
echo "&nbsp;<A class=\"cms\" HREF=\"edit.php?cm_path=$cm_path\">{$cm_text["editdoc"]}</A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"fileman.php?cm_path=$cm_path\">{$cm_text["managefiles"]}</A>&nbsp;\n";
}
if ($cm_candelete) {
echo "&nbsp;<A class=\"cms\" HREF=\"delete.php?cm_path=$cm_path\">{$cm_text["deletedoc"]}</A>&nbsp;\n";
}
if ($cm_cancreate) {
echo "&nbsp;<A class=\"cms\" HREF=\"create.php?cm_path=$cm_path\">{$cm_text["createdoc"]}</A>&nbsp;\n";
}
}
else {
if ($cm_issuperuser) {
echo "&nbsp;<A class=\"cms\" HREF=\"console.php\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_console"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["enterconsole"]}\" title=\"{$cm_text["enterconsole"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_canprint) {
echo "&nbsp;<A class=\"cms\" HREF=\"print.php?cm_path=$cm_path\" TARGET=\"_blank\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_print"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["printablepage"]}\" title=\"{$cm_text["printablepage"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
echo "&nbsp;<A class=\"cms\" HREF=\"listing.php?cm_path=$cm_path&cm_fdn=0&cm_hdet=1\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_dirlist"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["listdirs"]}\" title=\"{$cm_text["listdirs"]}\" class=\"pngimg\"></A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"search.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_search"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["search"]}\" title=\"{$cm_text["search"]}\" class=\"pngimg\"></A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"statshits.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_stats"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["stats"]}\" title=\"{$cm_text["stats"]}\" class=\"pngimg\"></A>&nbsp;\n";
if ($cm_canpost) {
echo "&nbsp;<A class=\"cms\" HREF=\"usercomment.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_comments"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["postcomment"]}\" title=\"{$cm_text["postcomment"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_canrate) {
echo "&nbsp;<A class=\"cms\" HREF=\"userrating.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_rate"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["rateabout"]}\" title=\"{$cm_text["rateabout"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
echo "</td></tr>\n";
echo "<tr><td class=\"navbody\" align=\"right\" colspan=\"2\">\n";
if ($cm_canedit) {
echo "&nbsp;<A class=\"cms\" HREF=\"edit.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_edit"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["editdoc"]}\" title=\"{$cm_text["editdoc"]}\" class=\"pngimg\"></A>&nbsp;\n";
echo "&nbsp;<A class=\"cms\" HREF=\"fileman.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_fileman"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["managefiles"]}\" title=\"{$cm_text["managefiles"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_candelete) {
echo "&nbsp;<A class=\"cms\" HREF=\"delete.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_delete"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["deletedoc"]}\" title=\"{$cm_text["deletedoc"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_cancreate) {
echo "&nbsp;<A class=\"cms\" HREF=\"create.php?cm_path=$cm_path\"><img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["nav_new"]}\" width=\"$cm_control_iconwidth\" height=\"$cm_control_iconheight\" border=\"0\" alt=\"{$cm_text["createdoc"]}\" title=\"{$cm_text["createdoc"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
}
echo "</td></tr>\n";
echo "</table>\n";
echo "</td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
};


// fcm_articlelist_box
// Displays the title and summary of a page, usually for the index listings.
// You must have already the information, this function won't search it.
// You must call it with the path, title, abstract, date (usually last update),
// total comments, total visits and if the page is a header (usually only for
// the first level directories).
function fcm_articlelist_box ($cm_path, $cm_boxtitle, $cm_boxabstract, $cm_boxdate, $cm_isheader, $cm_comments = 0, $cm_visits = 0, $cm_rating = 0, $cm_iscontentless = false, $cm_isannounce = false, $cm_logoimage = "", $cm_show_crumbs = false) {
global $cm_text, $cm_imgpath, $cm_doclogo_width, $cm_doclogo_height;
if ($cm_isannounce) {
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist3border\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist3body\">\n";
}
elseif ($cm_isheader) {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\">\n";
}
else {
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\">\n";
}
if ($cm_logoimage) {
$cm_logo_status = fcm_check_logoimage ($cm_path, $cm_logoimage);
if (!(($cm_logo_status[0] & 16) || ($cm_logo_status[0] & 64))) {
if ($cm_iscontentless) {
echo "<IMG SRC=\"../cm/getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\">";
}
else {
echo "<A class=\"cms\" HREF=\"../cm/display.php?cm_path=$cm_path\"><IMG SRC=\"../cm/getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\"></A>";
}
if ($cm_isheader) {
echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist1body\">\n";
}
elseif ($cm_isannounce) {
echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist3body\">\n";
}
else {
echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist2body\">\n";
}
}
}
if (!$cm_boxtitle) {
$cm_boxtitle = "{$cm_text["untitled"]} ($cm_path)";
}
if ($cm_iscontentless) {
echo "<strong>$cm_boxtitle</strong>\n";
}
else {
echo "<strong><A class=\"cms\" HREF=\"../cm/display.php?cm_path=$cm_path\">$cm_boxtitle</A></strong>\n";
}
if (!$cm_isheader) {
echo " [ " . substr ($cm_boxdate, 0, 10) . "&nbsp;";
if ($cm_comments && !$cm_iscontentless) {
echo "|&nbsp;{$cm_text["totalcomments"]}: $cm_comments ";
}
if ($cm_visits && !$cm_iscontentless) {
echo "|&nbsp;{$cm_text["visits"]}: $cm_visits ";
}
if ($cm_rating && !$cm_iscontentless) {
echo "|&nbsp;" . str_repeat ("<img src=\"$cm_imgpath/ratestar2.gif\" width=\"8\" height=\"8\" border=\"0\" alt=\"*\">", $cm_rating);
}
echo " ] <br>\n";
}

// Modified by Mark Coudriet - Date: May 13, 2003 -- Added star image and some nbsp
echo "&nbsp;&nbsp;&nbsp;$cm_boxabstract<br>\n";
//echo "<img src=\"../cm/img/ratestar2.gif\" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cm_boxabstract\n";

if ($cm_show_crumbs) {
echo "<span class=\"searchcrumb\">" . fcm_bread_crumbs ($cm_path, ">", false) . "</span>";
}
echo "</td></tr></table>";
echo "</td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"2\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"2\" border=\"0\" alt=\"\"></td></tr></table>\n";
};


// fcm_echo_articlelist_box
// Similar to fcm_articlelist_box, this function won't display it but will
// store the HTML code in a string, to be included later in a page. This is
// used when interpreting the content of a page.
function fcm_echo_articlelist_box ($cm_path, $cm_boxtitle, $cm_boxabstract, $cm_boxdate, $cm_comments = 0, $cm_visits = 0, $cm_rating = 0, $cm_iscontentless = false, $cm_isannounce = false, $cm_logoimage = "") {
global $cm_text, $cm_imgpath, $cm_doclogo_width, $cm_doclogo_height;
$cm_boxstring = "";
if ($cm_isannounce) {
$cm_boxstring .= "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist3border\">\n";
$cm_boxstring .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist3body\">\n";
}
else {
$cm_boxstring .= "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist2border\">\n";
$cm_boxstring .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist2body\">\n";
}
if ($cm_logoimage) {
$cm_logo_status = fcm_check_logoimage ($cm_path, $cm_logoimage);
if (!(($cm_logo_status[0] & 16) || ($cm_logo_status[0] & 64))) {
if ($cm_iscontentless) {
$cm_boxstring .= "<IMG SRC=\"getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\">";
}
else {
$cm_boxstring .= "<A class=\"cms\" HREF=\"display.php?cm_path=$cm_path\"><IMG SRC=\"getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\"></A>";
}
if ($cm_isannounce) {
$cm_boxstring .= "</td><td width=\"100%\" valign=\"top\" class=\"doclist3body\">\n";
}
else {
$cm_boxstring .= "</td><td width=\"100%\" valign=\"top\" class=\"doclist2body\">\n";
}
}
}
if (!$cm_boxtitle) {
$cm_boxtitle = "{$cm_text["untitled"]} ($cm_path)";
}
if ($cm_iscontentless) {
$cm_boxstring .= "<strong>$cm_boxtitle</strong>\n";
}
else {
$cm_boxstring .= "<strong><A class=\"cms\" HREF=\"display.php?cm_path=$cm_path\">$cm_boxtitle</A></strong>\n";
}
$cm_boxstring .= " [ " . substr ($cm_boxdate, 0, 10) . "&nbsp;";
if ($cm_comments && !$cm_iscontentless) {
$cm_boxstring .= "|&nbsp;{$cm_text["totalcomments"]}: $cm_comments ";
}
if ($cm_visits && !$cm_iscontentless) {
$cm_boxstring .= "|&nbsp;{$cm_text["visits"]}: $cm_visits ";
}
if ($cm_rating && !$cm_iscontentless) {
$cm_boxstring .= "|&nbsp;" . str_repeat ("<img src=\"$cm_imgpath/ratestar2.gif\" width=\"8\" height=\"8\" border=\"0\" alt=\"*\">", $cm_rating);
}
$cm_boxstring .= " ] <br>\n";
$cm_boxstring .= "&nbsp;&nbsp;&nbsp;$cm_boxabstract<br>\n";
if ($cm_show_crumbs) {
$cm_boxstring .= "<span class=\"searchcrumb\">" . fcm_bread_crumbs ($cm_path, ">", false) . "</span>";
}
$cm_boxstring .= "</td></tr></table>";
$cm_boxstring .= "</td></tr></table>\n";
$cm_boxstring .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
return $cm_boxstring;
};


// fcm_message
// Displays a message for the user. According to the category, it will display
// the message in a colored box (colors are controled by the CSS file) and an
// icon.
function fcm_message ($cm_message, $cm_msgstyle) {
global $cm_text, $cm_imgpath, $cm_msg_iconwidth, $cm_msg_iconheight, $cm_image_filename, $cm_icon_set;
switch ($cm_msgstyle) {
case CM_MSGSTYLE_INFORMATION:
$cm_msg_borderclass = "infomessageboxborder";
$cm_msg_class = "infomessagebox";
$cm_msg_icon = $cm_image_filename[$cm_icon_set]["dialog_info"];
$cm_msg_iconalt = $cm_text["iconaltinfo"];
break;
case CM_MSGSTYLE_WARNING:
$cm_msg_borderclass = "warningmessageboxborder";
$cm_msg_class = "warningmessagebox";
$cm_msg_icon = $cm_image_filename[$cm_icon_set]["dialog_warning"];
$cm_msg_iconalt = $cm_text["iconaltwarn"];
break;
case CM_MSGSTYLE_ERROR:
$cm_msg_borderclass = "errormessageboxborder";
$cm_msg_class = "errormessagebox";
$cm_msg_icon = $cm_image_filename[$cm_icon_set]["dialog_error"];
$cm_msg_iconalt = $cm_text["iconalterror"];
break;
case CM_MSGSTYLE_QUESTION:
$cm_msg_borderclass = "infomessageboxborder";
$cm_msg_class = "infomessagebox";
$cm_msg_icon = $cm_image_filename[$cm_icon_set]["dialog_question"];
$cm_msg_iconalt = $cm_text["iconaltquestion"];
break;
default:
$cm_msg_borderclass = "defaultmessageboxborder";
$cm_msg_class = "defaultmessagebox";
$cm_msg_icon = $cm_image_filename[$cm_icon_set]["dialog_default"];
$cm_msg_iconalt = $cm_text["iconaltinfo"];
}
echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"$cm_msg_borderclass\">";
echo "<table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"$cm_msg_class\">\n";
echo "<img src=\"$cm_imgpath/$cm_msg_icon\" width=\"$cm_msg_iconwidth\" height=\"$cm_msg_iconheight\" border=\"0\" alt=\"$cm_msg_iconalt\" class=\"pngimg\">";
echo "</td><td class=\"$cm_msg_class\">\n";
echo "$cm_message";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"10\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"10\" border=\"0\" alt=\"\"></td></tr></table>\n";
};


// fcm_conv_multiline
// Searches for $cm_mksymbol in $cm_source_string, if found outputs $cm_delimiter
// and change state of $cm_laststate. Next time searches for $cm_mksymbol in
// $cm_source_string and if found outputs $cm_delimiter2.
// Used for markup that starts and ends with the same code and spans several
// lines (like PREFORMATED).
function fcm_conv_multiline ($cm_source_string, $cm_delimiter, $cm_delimiter2, $cm_mksymbol, &$cm_laststate)
{
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol);
if ($cm_mkpos === 0) {
if ($cm_laststate) {
$cm_laststate = false;
return substr ($cm_source_string, strlen ($cm_mksymbol)) . $cm_delimiter2;
}
else {
$cm_laststate = true;
return $cm_delimiter . substr ($cm_source_string, strlen ($cm_mksymbol));
}
}
return $cm_source_string;
};


// fcm_conv_block
// Searches for $cm_mksymbol in $cm_source_string only at the beginning of string,
// if found outputs $cm_delimiter before and after $cm_source_string. If
// $cm_mksymbol is empty, just outputs the delimiters and the string.
// Used for markup that requires only a code at the beginning of the line.
function fcm_conv_block ($cm_source_string, $cm_delimiter, $cm_delimiter2, $cm_mksymbol)
{
if (($cm_source_string == "") || ($cm_source_string == "\r") || ($cm_source_string == "\n")) {
return "";
}
if ($cm_mksymbol == "") {
return $cm_delimiter . $cm_source_string . $cm_delimiter2;
}
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol);
if ($cm_mkpos === 0) {
return $cm_delimiter . substr ($cm_source_string, strlen ($cm_mksymbol)) . $cm_delimiter2;
}
return $cm_source_string;
};


// fcm_conv_inline
// Searches for $cm_mksymbol1 and $cm_mksymbol2 in $cm_source_string. If found
// outputs $cm_delimiter before and $cm_delimiter2 after the positions of the
// markup code. If only one markup code is found, it's ignored.
// The markup codes (mksymbols) must be asymetric two-characters strings.
// Used for markup that opens and closes around a segment of a string (like bold,
// italics, etc).
function fcm_conv_inline ($cm_source_string, $cm_delimiter, $cm_delimiter2, $cm_mksymbol1, $cm_mksymbol2)
{
if (($cm_source_string == "") || ($cm_source_string == "\r") || ($cm_source_string == "\n")) {
return "";
}
$cm_convstr = "";
$cm_a = 0;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
while (($cm_b !== false) && ($cm_c !== false)) {
$cm_convstr .= substr ($cm_source_string, $cm_a, $cm_b - $cm_a + 1);
$cm_convstr .= $cm_delimiter;
$cm_convstr .= substr ($cm_source_string, $cm_b + 2, $cm_c - $cm_b - 2);
$cm_convstr .= $cm_delimiter2;
$cm_a = $cm_c + 1;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
}
$cm_convstr .= substr ($cm_source_string, $cm_a);
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
};


// fcm_conv_emoticons
// Searches for emoticons in $cm_source_string. If found outputs image tags
// according to a predefined array.
function fcm_conv_emoticons ($cm_source_string)
{
global $cm_imgpath, $cm_emoticon_iconwidth, $cm_emoticon_iconheight, $cm_convert_emoticons, $cm_image_filename, $cm_icon_set;
if ($cm_convert_emoticons) {
if (($cm_source_string == "") || ($cm_source_string == "\r") || ($cm_source_string == "\n")) {
return "";
}
$cm_emoticons = array (" :)", " :P", " :p", " :(", " :'(", " :,(", " =)", " ;)", " :O", " :o", " :D", " :\\", " :/", " :|");
$cm_emotimages = array ($cm_image_filename[$cm_icon_set]["emoticon_smile"], $cm_image_filename[$cm_icon_set]["emoticon_tongue"], $cm_image_filename[$cm_icon_set]["emoticon_tongue"], $cm_image_filename[$cm_icon_set]["emoticon_sad"], $cm_image_filename[$cm_icon_set]["emoticon_cry"], $cm_image_filename[$cm_icon_set]["emoticon_cry"], $cm_image_filename[$cm_icon_set]["emoticon_happy"], $cm_image_filename[$cm_icon_set]["emoticon_wink"], $cm_image_filename[$cm_icon_set]["emoticon_oh"], $cm_image_filename[$cm_icon_set]["emoticon_oh"], $cm_image_filename[$cm_icon_set]["emoticon_laugh"], $cm_image_filename[$cm_icon_set]["emoticon_wry"], $cm_image_filename[$cm_icon_set]["emoticon_wry"], $cm_image_filename[$cm_icon_set]["emoticon_serious"]);
for ($cm_ci = 0; $cm_ci < count ($cm_emoticons); $cm_ci++) {
$cm_source_string = str_replace ($cm_emoticons[$cm_ci], " <img src=\"$cm_imgpath/$cm_emotimages[$cm_ci]\" alt=\"$cm_emoticons[$cm_ci]\" width=\"$cm_emoticon_iconwidth\" height=\"$cm_emoticon_iconheight\" border=\"0\" class=\"pngimg\">", $cm_source_string);
}
}
return $cm_source_string;
};


// fcm_conv_images
// Searches for $cm_mksymbol1 and $cm_mksymbol2 in $cm_source_string. If found
// outputs image tags with the data from the enclosed markup code. The enclosed
// data is split in two by $cm_mksymbol3 (if exist). The first part is used as
// URL and the second (if exist) as alternate text. If the first part begins
// with a dot, then the URL is constructed as local with $cm_currentpath.
// If only one markup code is found, it's ignored.
// The markup codes (mksymbols) must be asymetric two-characters strings.
// Used for markup of images that opens and closes around a segment of a string.
function fcm_conv_images ($cm_currentpath, $cm_source_string, $cm_mksymbol1, $cm_mksymbol2, $cm_mksymbol3)
{
global $cm_mainroot;
$cm_convstr = "";
$cm_imgurl = "";
$cm_islocal = false;
$cm_a = 0;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
$cm_d = strpos ($cm_source_string, $cm_mksymbol3, $cm_b);
while (($cm_b !== false) && ($cm_c !== false)) {
if (($cm_d !== false) && ($cm_d < $cm_c)) {
$cm_imgurl = substr ($cm_source_string, ($cm_b + 2), ($cm_d - $cm_b - 2));
if ($cm_imgurl{0} == ".") {
$cm_islocal = true;
$cm_imgurl = substr ($cm_imgurl, 1);
}
$cm_imgtitle = substr ($cm_source_string, ($cm_d + 1), ($cm_c - $cm_d - 1));
}
else {
$cm_imgurl = substr ($cm_source_string, ($cm_b + 2), ($cm_c - $cm_b - 2));
if ($cm_imgurl{0} == ".") {
$cm_islocal = true;
$cm_imgurl = substr ($cm_imgurl, 1);
}
$cm_imgtitle = "";
}
$cm_convstr .= substr ($cm_source_string, $cm_a, $cm_b - $cm_a);
if (substr ($cm_imgurl, -1) == ",") {
$cm_imgurl = substr ($cm_imgurl, 0, -1);
}
if ($cm_islocal) {
$cm_convstr .= "<IMG SRC=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($cm_imgurl) . "\" ALT=\"" . $cm_imgtitle . "\"" . ">";
}
else {
$cm_convstr .= "<IMG SRC=\"redir.php?cm_elink=" . fcm_urlencode ($cm_imgurl) . "\" ALT=\"" . $cm_imgtitle . "\"" . ">";
}
$cm_a = $cm_c + 2;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
$cm_d = strpos ($cm_source_string, $cm_mksymbol3, $cm_b);
}
$cm_convstr .= substr ($cm_source_string, $cm_a);
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
};


// fcm_conv_links
// Searches for $cm_mksymbol1 and $cm_mksymbol2 in $cm_source_string. If found
// outputs link tags with the data from the enclosed markup code. The enclosed
// data is split in two by $cm_mksymbol3 (if exist). The first part is used as
// URL and the second (if exist) as link text. If the first part begins
// with a dot, then the URL is constructed as local with $cm_currentpath.
// If the second part is absent, then the link text is the URL.
// If only one markup code is found, it's ignored. If $cm_newwin is set, the
// created link uses a _blank target to open it in a new window.
// The markup codes (mksymbols) must be asymetric two-characters strings.
// Used for markup of links that opens and closes around a segment of a string.
function fcm_conv_links ($cm_currentpath, $cm_source_string, $cm_mksymbol1, $cm_mksymbol2, $cm_mksymbol3, $cm_newwin)
{
global $cm_mainroot;
$cm_convstr = "";
$cm_linkurl = "";
$cm_linktitle = "";
$cm_islocal = false;
$cm_isredirable = false;
$cm_a = 0;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
$cm_d = strpos ($cm_source_string, $cm_mksymbol3, $cm_b);
while (($cm_b !== false) && ($cm_c !== false)) {
if (($cm_d !== false) && ($cm_d < $cm_c)) {
$cm_linkurl = substr ($cm_source_string, ($cm_b + 2), ($cm_d - $cm_b - 2));
if ($cm_linkurl{0} == ".") {
$cm_islocal = true;
$cm_linkurl = substr ($cm_linkurl, 1);
}
$cm_linktitle = substr ($cm_source_string, ($cm_d + 1), ($cm_c - $cm_d - 1));
}
else {
$cm_linkurl = substr ($cm_source_string, ($cm_b + 2), ($cm_c - $cm_b - 2));
if ($cm_linkurl{0} == ".") {
$cm_islocal = true;
$cm_linktitle = substr ($cm_linkurl, 1);
$cm_linkurl = substr ($cm_linkurl, 1);
}
else {
$cm_linktitle = $cm_linkurl;
}
}
$cm_convstr .= substr ($cm_source_string, $cm_a, $cm_b - $cm_a);
if (substr ($cm_linkurl, -1) == ",") {
$cm_linkurl = substr ($cm_linkurl, 0, -1);
}
if (substr ($cm_linktitle, -1) == ",") {
$cm_linktitle = substr ($cm_linktitle, 0, -1);
}
if (eregi ('http:|https:', $cm_linkurl)) {
$cm_isredirable = true;
}
if ($cm_islocal) {
if ($cm_newwin) {
$cm_convstr .= "<A class=\"gcms\" HREF=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\" target=\"_blank\">" . $cm_linktitle . "</A>";
}
else {
$cm_convstr .= "<A class=\"gcms\" HREF=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\">" . $cm_linktitle . "</A>";
}
}
else {
if ($cm_isredirable) {
if ($cm_newwin) {
$cm_convstr .= "<A class=\"gcms\" HREF=\"redir.php?cm_elink=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\" target=\"_blank\">" . $cm_linktitle . "</A>";
}
else {
$cm_convstr .= "<A class=\"gcms\" HREF=\"redir.php?cm_elink=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\">" . $cm_linktitle . "</A>";
}
}
else {
if ($cm_newwin) {
$cm_convstr .= "<A class=\"gcms\" HREF=\"" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\" target=\"_blank\">" . $cm_linktitle . "</A>";
}
else {
$cm_convstr .= "<A class=\"gcms\" HREF=\"" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\">" . $cm_linktitle . "</A>";
}
}
}
$cm_a = $cm_c + 2;
$cm_b = strpos ($cm_source_string, $cm_mksymbol1, $cm_a);
$cm_c = strpos ($cm_source_string, $cm_mksymbol2, $cm_a);
$cm_d = strpos ($cm_source_string, $cm_mksymbol3, $cm_b);
}
$cm_convstr .= substr ($cm_source_string, $cm_a);
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
};


// fcm_conv_index
// Searches $cm_mksymbol in $cm_source_string. If found, query the database
// searching for the next lower-level directories and calls fcm_echo_articlelist_box
// to create an index listing of pages. If no page is found, then just output
// a "no docs available". If $cm_level is zero it will search all lower directories,
// otherwise it will show only the next level. (The exception are announces, which are
// always displayed regardless of the level).
function fcm_conv_index ($cm_currentpath, $cm_source_string, $cm_mksymbol, $cm_level) {
global $cm_text;
global $user_kurz;
$cm_convstr = "";
$cm_mkpos = str


Report this post
Top
  
Reply with quote  
PostPosted: 15 Jul 2003, 07:26 
Please use this code over the earlier post to have new documents from the CMS module appear in the phprojekt summary page.

Insert at the bottom of summary.php around line 368:

Code:
echo "<div style=\"vertical-align:bottom; color:red; font-style: italic; font-size:24px;\">NEW ARTICLES</div>";
// Summary for New Articles
// Content Management System module for PHProjekt (CMS4P).
// Original Code by Mario A. Valdez-Ramirez
// Copyright ©2002, 2003 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/
// Added/Modified by Mark Coudriet
// iPsymon@yahoo.com
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);
$summary_maxleafs = 1;
$days_old = 10;
$expired = mktime (0,0,0, date("m")  ,date("d") - $days_old ,date("Y"));
$expired = date("Y-m-d H:i:s", $expired);
echo $cm_html_header;


 $cm_validops = fcm_check_validops ($user_kurz, $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 "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"maincontent\" width=\"100%\" valign=\"top\">\n";
  $result2 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_viewer_group, cmdb_type, cmdb_logo from content3 where cmdb_parentdir = '$cm_tl_path' and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "' 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, true);
    }
  }
  // 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 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) && ($row2[4] > $expired)) {
      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, true);
     }
    // search for children documents (deep search)...
    $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "'  order by cmdb_date_update desc") or db_die();
    $cm_rowcount = 1;
    // display announces first, only max allowed...
    while ($row3 = db_fetch_row($result3)) {
      if ($cm_rowcount > $summary_maxleafs) {
        break;
      }
      if (stristr ($row3[5], CM_HITTYPE_ANNOUNCE)) {
        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, true);
        $cm_rowcount++;
      }
    }
    // search for children documents (deep search)...
    $result3 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type, cmdb_logo from content3 where (cmdb_parentdir like '$row2[1]' or cmdb_parentdir like '$row2[1]/%') and cmdb_type like '%" . CM_HITTYPE_PAGE . "%' " . fcm_access_sqldef ($user_kurz) . " and cmdb_date_update > '" . $expired . "' order by cmdb_date_update desc") or db_die();
    // display non-announces, only max allowed...
    while ($row3 = db_fetch_row($result3)) {
      if ($cm_rowcount > $summary_maxleafs) {
        break;
      }
      if (!stristr ($row3[5], CM_HITTYPE_ANNOUNCE)) {
              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, true);
        $cm_rowcount++;
 
      }
    }
  }
echo "</td></tr></table>";
// End Added


Comment out the function fcm_articlelist_box in cm_lib_inc.php and replace it with this function:
Code:
// fcm_articlelist_box
// Displays the title and summary of a page, usually for the index listings.
// You must have already the information, this function won't search it.
// You must call it with the path, title, abstract, date (usually last update),
// total comments, total visits and if the page is a header (usually only for
// the first level directories).
// Modified by Mark Coudriet
// Added $summary variable to end of fcm_aritclelist_box passed by reference variables
function fcm_articlelist_box ($cm_path, $cm_boxtitle, $cm_boxabstract, $cm_boxdate, $cm_isheader, $cm_comments = 0, $cm_visits = 0, $cm_rating = 0, $cm_iscontentless = false, $cm_isannounce = false, $cm_logoimage = "", $cm_show_crumbs = false, $summary) {
  global $cm_text, $cm_imgpath, $cm_doclogo_width, $cm_doclogo_height;
  global $cm_mainroot;
  // Added $summary if statement
  if ($summary) { $long_path = "../cm/"; }
  else          { $long_path = ""; }
  // Added $long_path variable in all href & img src paths
  if ($cm_isannounce) {
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist3border\">\n";
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist3body\">\n";
  }
  elseif ($cm_isheader) {
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist1border\">\n";
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist1body\">\n";
  }
  else {
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"doclist2border\">\n";
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td valign=\"top\" class=\"doclist2body\">\n";
  }
  if ($cm_logoimage) {
    $cm_logo_status = fcm_check_logoimage ($cm_path, $cm_logoimage);
    if (!(($cm_logo_status[0] & 16) || ($cm_logo_status[0] & 64))) {
      if ($cm_iscontentless) {
        echo "<IMG SRC=\"". $long_path ."getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\">";
      }
      else {
        echo "<A class=\"cms\" HREF=\"". $long_path ."display.php?cm_path=$cm_path\"><IMG SRC=\"". $long_path ."getfile.php?cm_path=$cm_path&cm_file=" . fcm_urlencode ($cm_logoimage) . "\" BORDER=\"0\" ALT=\"$cm_boxtitle\" WIDTH=\"" . $cm_logo_status[3] . "\" HEIGHT=\"" . $cm_logo_status[4] . "\"></A>";
      }
      if ($cm_isheader) {
        echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist1body\">\n";
      }
      elseif ($cm_isannounce) {
        echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist3body\">\n";
      }
      else {
        echo "</td><td width=\"100%\" valign=\"top\" class=\"doclist2body\">\n";
      }
    }
  }
  if (!$cm_boxtitle) {
    $cm_boxtitle = "{$cm_text["untitled"]} ($cm_path)";
  }
  if ($cm_iscontentless) {
    echo "<strong>$cm_boxtitle</strong>\n";
  }
  else {
    echo "<strong><A class=\"cms\" HREF=\"". $long_path ."display.php?cm_path=$cm_path\">$cm_boxtitle</A></strong>\n";
  }
  if (!$cm_isheader) {
    echo " [ " . substr ($cm_boxdate, 0, 10) . "&nbsp;";
    if ($cm_comments && !$cm_iscontentless) {
      echo "|&nbsp;{$cm_text["totalcomments"]}: $cm_comments ";
    }
    if ($cm_visits && !$cm_iscontentless) {
      echo "|&nbsp;{$cm_text["visits"]}: $cm_visits ";
    }
    if ($cm_rating && !$cm_iscontentless) {
      echo "|&nbsp;" . str_repeat ("<img src=\"$cm_imgpath/ratestar2.gif\" width=\"8\" height=\"8\" border=\"0\" alt=\"*\">", $cm_rating);
    }
    echo " ] <br>\n";
  }
  echo "&nbsp;&nbsp;&nbsp;$cm_boxabstract<br>\n";
  if ($cm_show_crumbs) {
    echo "<span class=\"searchcrumb\">" . fcm_bread_crumbs ($cm_path, ">", false) . "</span>";
  }
  echo "</td></tr></table>";
  echo "</td></tr></table>\n";
  echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"cms\" height=\"2\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"2\" border=\"0\" alt=\"\"></td></tr></table>\n";
};


Again this is much cleaner & I fixed some bugs...

Cheers,

Mark Coudriet


Report this post
Top
  
Reply with quote  
 Post subject: Patch for summary...
PostPosted: 16 Jul 2003, 18:56 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Mark:

Hi. Thanks a lot for sharing your code. I have not posted any answer because I've been a bit busy (another project, my job, my taxes, and a security review on the CMS code).

By the way, I hope to release the last beta of 0.6.0 this Friday (with your changes) and then the final 0.6.0 next week.

Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Not a problem
PostPosted: 17 Jul 2003, 08:44 
Not a problem! :D

Actually you get ALOT accomplished in such a short time, plus answer many questions on this board and the phprojekt board as well.

I'm amazed!!!!

Mark Coudriet


Report this post
Top
  
Reply with quote  
 Post subject: Summary lisrting...
PostPosted: 28 Jul 2003, 13:05 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Mark:

Hi. I've recoded your idea in the latest beta version (hopefully the last beta) 0.6.0beta10.

To minimize installation hassles, now there is a cm/cm_summary.inc.php file to be included by summary/summary.php (just like index.php and lib/show_modules.inc.php do).

This new inclusion file looks for the more recent articles (how old is something configurable from the admin console of the CMS), showing the special announces first, then the rest of the articles.

In this case I preserved the look and feel of Phprojekt for this listing. This was done for practical reasons and because somehow I feel it integrates better (otherwise it would be too disruptive). By look and feel I mean the flat colored, non-graphical appearance of Phprojekt (this is not bad). Also, this uses the colors set in the currently selected Phprojekt theme.

The practical reason is that by the time the article listing is build, the header of the HTML page has already been created, and a CSS file can only be referenced in the HEAD of the HTML file. I don't want the CMS module to generate ill-formed HTML code.

I have to think both in flexibility and in easy of installarion issues (and easy of code maintenance). I hope I ended up with a suitable solution. Of course I'm open to suggestions, comments and code. :)


Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: I agree!!!
PostPosted: 29 Jul 2003, 14:10 
I completely agree with you. :lol:

Actually I'm not using the different colors either, just haven't taken them out of the code yet. I only put them in initially for fun. :P

I'll install the new version tommorrow & test it!

Best Regards,
Mark Coudriet


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group