mariovaldez.net

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

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
PostPosted: 13 Mar 2003, 08:01 
Here are some changes that will enable the uploaded files to be kept on another server. This is good for installations where redundancy is necessary. To find all the altered code just search for the string "Psymon"
( Put $cm_mainroot = "//ServerIP/NetworkShare"; in cm_config.inc.php )
+++++++++++++++++++++++++++++++++++++++++++++++
<?php
// cm_lib.inc.php
// Content Management 0.5.0 module for PHProjekt, version 3.3.
// Copyright ©2002, 2003 by Mario A. Valdez-Ramirez (mario@mariovaldez.org)
// 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.


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


// 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="charset=iso-8859-2"; }
elseif ($langua=="ru") { $lcfg="charset=windows-1251"; }
elseif ($langua=="tw") { $lcfg = "charset=big5"; }
elseif ($langua=="zh") { $lcfg = "charset=gb2312"; }
if ($lcfg <> "") { $lang_cfg = "<meta http-equiv='Content-Type' content='text/html; $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)) {
$langua = strtolower ($langua);
include("$cm_langpath/$langua.inc.php");
}
else { $langua = "en"; include("$cm_langpath/en.inc.php"); }


// 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");
// 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>$user_kurz : $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 = "$user_kurz : $cm_currentversion\n</body></html>\n";
$cm_nav_mouseover="";


$cm_nav_pre1="<td><img src='$img_path/links2.gif' border='0'></td>";
$cm_nav_pre2="<td><img src='$img_path/links.gif' border='0'></td>";
$cm_nav_post1="<td><img src='$img_path/rechts2.gif' border='0'>&nbsp;</td>";
$cm_nav_post2="<td><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_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_UPLOAD_FILE, 8);
define (CM_APPLOG_DELETE_FILE, 9);
define (CM_APPLOG_EDIT_SECURITY, 10);
define (CM_APPLOG_INFO, 11);
define (CM_APPLOG_CHECKER, 12);
define (CM_APPLOG_RATE_PAGE, 13);




// 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=\"docsummaryborder\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"docsummary\">\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n";
echo "<tr><td>";
echo "<h3>$cm_title</h3>";
echo "</td><td 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>";
if ($cm_summary) {
//Modified by Psymon
//For system messages
if ($cm_title=="Special Bar:")
{ $tdColor=preg_split("/:/",$cm_summary,-1,PREG_SPLIT_NO_EMPTY);
echo "$tdColor[1]<br>";
}
else { echo "$cm_summary<br>"; }

}
echo "</td></tr>";
echo "</table>\n";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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>$cm_title</h3>";
echo "<p><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) {
global $cm_text;
$cm_crumb_separator = fcm_htmlentity ($cm_crumb_separator);
$cm_breadcrumbs_str = "<A HREF=\"display.php?cm_path=\">{$cm_text["root"]}</A>";
$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]) {
$cm_breadcrumbs_str .= " $cm_crumb_separator <A HREF=\"display.php?cm_path=$cm_displaypath\" TITLE=\"$row1[2]\">$row1[1]</A>";
}
else {
$cm_breadcrumbs_str .= " $cm_crumb_separator <A HREF=\"display.php?cm_path=$cm_displaypath\" TITLE=\"$row1[2]\">$cm_path_node</A>";
}
}
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, $cm_candelete, $cm_canedit, $cm_canview, $cm_canpost, $cm_canprint, $cm_isadmin) {
global $cm_text, $cm_imgpath, $cm_control_iconwidth, $cm_control_iconheight, $cm_userroot, $cm_image_filename, $cm_icon_set;
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"navbarborder\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"navbar\">\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo "<tr><td>";
echo "&nbsp;<STRONG>";
echo fcm_bread_crumbs ($cm_path, ">");
echo "</STRONG>";
echo "</td><td align=\"right\">";
if ($cm_isadmin) {
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_canprint) {
echo "&nbsp;<A 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 HREF=\"listing.php?cm_path=$cm_path\"><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 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 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 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
echo "</td></tr>\n";
echo "<tr><td align=\"right\" colspan=\"2\">\n";
if ($cm_canedit) {
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_candelete) {
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
if ($cm_cancreate) {
echo "&nbsp;<A 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"]}\" class=\"pngimg\"></A>&nbsp;\n";
}
echo "</td></tr>\n";
echo "</table>\n";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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) {
global $cm_text, $cm_imgpath;
if ($cm_isheader) {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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=\"headdoclistborder\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"headdoclist\">\n";
}
else {
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"bodydoclistborder\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"bodydoclist\">\n";
}
if (!$cm_boxtitle) {
$cm_boxtitle = "{$cm_text["untitled"]} ($cm_path)";
}
//Modified by Psymon
//For system messages
if ($cm_boxtitle=="Special Bar:")
{ echo "<table width=\"100%\" style='border:2px outset aqua'><tr><td background=\"../../img/box/sidebox-title-bg.gif\" style=\"border: 5px outset;\" nowrap><strong><A HREF=\"display.php?cm_path=$cm_path\">&nbsp;&nbsp;$cm_boxtitle</A></strong></td>\n";

}

else { echo "<strong><A HREF=\"display.php?cm_path=$cm_path\">$cm_boxtitle</A></strong>\n"; }


if (!$cm_isheader) {
echo " [ " . substr ($cm_boxdate, 0, 10) . "&nbsp;";
if ($cm_comments) {
echo "|&nbsp;{$cm_text["totalcomments"]}: $cm_comments ";
}
if ($cm_visits) {
echo "|&nbsp;{$cm_text["visits"]}: $cm_visits ";
}
if ($cm_rating) {
echo "|&nbsp;" . str_repeat ("<img src=\"$cm_imgpath/ratestar2.gif\" width=\"8\" height=\"8\" border=\"0\" alt=\"*\">", $cm_rating);
}
echo " ] <br>\n";
}
//Modified by Psymon
//For system messages
if ($cm_boxtitle=="Special Bar:")
{ $tdColor=preg_split("/:/",$cm_boxabstract,-1,PREG_SPLIT_NO_EMPTY);
echo "<td width=\"80%\" $tdColor[0] style=\"border: 5px inset;\">";
echo "<marquee scrollamount=1 scrolldelay=1 vspace=4><b><i><font size=\"3\" color=\"white\">$tdColor[1]</font></i></b></marquee>\n";
echo "</td></tr></table>";
}
else { echo "$cm_boxabstract\n"; }

echo "</td></tr></table>";
echo "</td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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) {
global $cm_text, $cm_imgpath;
$cm_boxstring = "";
$cm_boxstring .= "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"bodydoclistborder\">\n";
$cm_boxstring .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"bodydoclist\">\n";
if (!$cm_boxtitle) {
$cm_boxtitle = "{$cm_text["untitled"]} ($cm_path)";
}
$cm_boxstring .= "<strong><A HREF=\"display.php?cm_path=$cm_path\">$cm_boxtitle</A></strong>\n";
$cm_boxstring .= " [ " . substr ($cm_boxdate, 0, 10) . "&nbsp;";
if ($cm_comments) {
$cm_boxstring .= "|&nbsp;{$cm_text["totalcomments"]}: $cm_comments ";
}
if ($cm_visits) {
$cm_boxstring .= "|&nbsp;{$cm_text["visits"]}: $cm_visits ";
}
if ($cm_rating) {
$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 .= "$cm_boxabstract\n";
$cm_boxstring .= "</td></tr></table>";
$cm_boxstring .= "</td></tr></table>\n";
$cm_boxstring .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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=\"2\"><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 "&nbsp;<strong>$cm_message</strong>&nbsp;";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td 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;

// Added By Psymon
$file = substr ($cm_delimitstring, ($cm_b + 2), ($cm_d - $cm_b - 2));
$file = "/" . substr ($file, 1);
$file = substr ($file, 0, -2);
// end added
// Disabled & Added By Psymon
//$cm_convstr .= "<IMG SRC=\"" . fcm_urlencode ($cm_imgurl) . "\" ALT=\"" . $cm_imgtitle . "\"" . ">";
$cm_convstr .="<IMG SRC=\"getfile.php?cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($file) . "\" BORDER=\"0\" ALT=\"" . $cm_imgtitle . "\">";
// end added


$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_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} == ".") {
// Disabled & Added By Psymon
//$cm_imgurl = $cm_mainroot . $cm_currentpath . "/" . 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} == ".") {
// Disabled & Added By Psymon
//$cm_imgurl = $cm_mainroot . $cm_currentpath . "/" . 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);
}

// Disabled & Added By Psymon
// For inline images
//$cm_convstr .= "<IMG SRC=\"" . fcm_urlencode ($cm_imgurl) . "\" ALT=\"" . $cm_imgtitle . "\"" . ">";
$newURL=preg_split("|.|", $cm_imgurl, 1, PREG_SPLIT_NO_EMPTY);
$newURL[0] = substr ($newURL[0], 1);
$cm_convstr .="<IMG SRC=\"getfile.php?cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($newURL[0]) . "\" BORDER=\"0\" ALT=\"" . $cm_imgtitle . "\">";
// end added

$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_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 ($cm_islocal) {
if ($cm_newwin) {
$cm_convstr .= "<A 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 HREF=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\">" . $cm_linktitle . "</A>";
}
}
else {
if ($cm_newwin) {
$cm_convstr .= "<A HREF=\"redir.php?cm_elink=" . $cm_linkurl . "\" TITLE=\"" . $cm_linkurl . "\" target=\"_blank\">" . $cm_linktitle . "</A>";
}
else {
$cm_convstr .= "<A HREF=\"redir.php?cm_elink=" . $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".
function fcm_conv_index ($cm_currentpath, $cm_source_string, $cm_mksymbol) {
global $cm_text;
global $user_kurz;
$cm_convstr = "";
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol, 0);
if ($cm_mkpos !== false) {
$cm_pppos = strrpos ($cm_currentpath, "/");
if ($cm_pppos == 0) {
$cm_tl_path = "/";
}
else {
$cm_tl_path = substr ($cm_currentpath, 0, $cm_pppos);
}

// Modified by Psymon
// Added and cmdb_directory not like '$cm_currentpath/%/%' for single directory travel
$result2 = db_query("select cmdb_title, cmdb_directory, cmdb_parentdir, cmdb_abstract, cmdb_date_update, cmdb_type from content3 where cmdb_directory like '$cm_currentpath/%' and cmdb_directory not like '$cm_currentpath/%/%' and cmdb_type like '%p%' " . fcm_access_sqldef ($user_kurz) . "order by cmdb_date_update desc") or db_die();

while ($row2 = db_fetch_row($result2))
{
$cm_convstr .= fcm_echo_articlelist_box ($row2[1], $row2[0], $row2[3], $row2[4], fcm_get_totalcomments ($row2[1]), fcm_get_totalhits ($row2[1], CM_HITTYPE_PAGE), fcm_getaverage_rating ($row2[1]));
}
if (!$cm_convstr) {
$cm_convstr .= "<P>{$cm_text["nodocsunderthis"]}</P>";
}
}
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
};


// fcm_conv_fileindex
// Searches $cm_mksymbol in $cm_source_string. If found, reads the page's
// directory and creates a file listing with icons. If no files are found,
// outputs nothing.
function fcm_conv_fileindex ($cm_currentpath, $cm_source_string, $cm_mksymbol)
{
global $cm_text;
global $cm_mainroot, $cm_jpegprefix_file, $cm_show_thumbsinlisting, $cm_imgpath;
global $cm_file_iconname, $cm_filelist_iconwidth, $cm_filelist_iconheight, $cm_icon_set;
$cm_indexpath = $cm_mainroot . $cm_currentpath . "/";
$cm_convstr = "";
$cm_sorteddir = array ();
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol, 0);
if (($cm_mkpos !== false) && (file_exists ($cm_indexpath))) {
$cm_convstr .= "<TABLE ALIGN=\"center\" BORDER=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
$cm_convstr .= "<TR><td>&nbsp;</td><td align=\"center\">{$cm_text["filename"]}</td><td align=\"center\">{$cm_text["filesize"]}</td><td align=\"center\">{$cm_text["filedate"]}</td><td align=\"center\">{$cm_text["filehits"]}</td></TR>";
$cm_dirhandle = opendir($cm_indexpath);
while (($file = readdir($cm_dirhandle)) != false)
$cm_sorteddir[count($cm_sorteddir)] = $file;
closedir($cm_dirhandle);
natcasesort($cm_sorteddir);
foreach ($cm_sorteddir as $file) {
if ($file != "." && $file != ".." && ((!eregi ("^" . $cm_jpegprefix_file, strtolower ($file))) || ($cm_show_thumbsinlisting))) {
$cm_fileext = (string) substr (strrchr (strtolower ($file), "."), 1);
if (isset ($cm_file_iconname[$cm_icon_set][$cm_fileext])) {
$cm_fileicon = $cm_file_iconname[$cm_icon_set][$cm_fileext];
}
else {
$cm_fileicon = $cm_file_iconname[$cm_icon_set]["default"];
}

// Modified by Psymon
// Added if statement for file ext
if ($cm_fileext) {
$cm_convstr .= "<TR><TD><img src=\"$cm_imgpath/$cm_fileicon\" alt=\"\" width=\"$cm_filelist_iconwidth\" height=\"$cm_filelist_iconheight\" border=\"0\" class=\"pngimg\"></TD>";
$cm_convstr .= "<TD><A HREF=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($file) . "\">" . $file . "</A></TD>";
$cm_convstr .= "<TD>" . round (filesize ($cm_indexpath . $file) / 1024) . " k</TD>";
$cm_convstr .= "<TD>" . date ("Y-m-d H:i:s", filemtime ($cm_indexpath . $file)) . "</TD>";
$cm_convstr .= "<TD align=\"right\">" . fcm_get_updatehits ($cm_currentpath . "/" . $file, CM_HITTYPE_FILE) . "</TD></TR>";
}
// END Modified
}
}
$cm_convstr .= "</TABLE>";
}
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
};


// fcm_conv_album
// Searches $cm_mksymbol in $cm_source_string. If found, reads the page's
// directory, check if there are JPEG images, and creates a thumbnail for
// every picture found. If the thumbnail file already exist it won't create
// a new one. Then creates a table with the thumbnails and links to the
// original JPEG pictures. If no files are found, outputs nothing.
function fcm_conv_album ($cm_currentpath, $cm_source_string, $cm_mksymbol)
{
global $cm_text;
global $cm_mainroot, $cm_enable_gd, $cm_jpeg_truecolors, $cm_jpegprefix_file, $cm_jpeg_maxX, $cm_jpeg_maxY;
global $cm_album_cols, $cm_jpeg_quality, $cm_jpeg_prettynames;
$cm_indexpath = $cm_mainroot . $cm_currentpath . "/";
$cm_convstr = "";
$cm_sorteddir = array ();
$cm_imgpos = 1;
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol, 0);
if ($cm_enable_gd) {
if (($cm_mkpos !== false) && (file_exists ($cm_indexpath))) {
$cm_dirhandle = opendir($cm_indexpath);
while (($file = readdir($cm_dirhandle)) != false)
$cm_sorteddir[count($cm_sorteddir)] = $file;
closedir($cm_dirhandle);
natcasesort($cm_sorteddir);
$cm_convstr .= "<TABLE ALIGN=\"center\" BORDER=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n";
foreach ($cm_sorteddir as $file) {
set_time_limit (60);
if (($file != ".") && ($file != "..") && eregi ("\.jpg$", strtolower ($file)) && (!eregi ("^" . $cm_jpegprefix_file, strtolower ($file)))) {
$jpeg_dimensions = getimagesize ($cm_indexpath . $file);
$jpeg_oldX = $jpeg_dimensions [0];
$jpeg_oldY = $jpeg_dimensions [1];
$cm_img_data = $jpeg_oldX . "x" . $jpeg_oldY . ", ";
$cm_img_data .= round (filesize ($cm_indexpath . $file) / 1024) . " k ";
$cm_img_altdata = $cm_img_data;
$cm_img_data .= "<BR>" . $cm_text["filehits"] . " " . fcm_get_updatehits ($cm_currentpath . "/" . $file, CM_HITTYPE_FILE);

if ($cm_imgpos == 1)
$cm_convstr .= "<TR>\n";
$cm_convstr .= "<TD ALIGN=\"center\"><A HREF=\"getfile.php?cm_s=1&cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($file) . "\">";
$cm_convstr .= "<IMG SRC=\"getfile.php?cm_path=$cm_currentpath&cm_file=" . fcm_urlencode ($cm_jpegprefix_file . $file) . "\" BORDER=\"0\" ALT=\"" . $cm_img_altdata . "\">";
$cm_convstr .= "</A><BR>";
if ($cm_jpeg_prettynames) {
$cm_convstr .= ucwords (strtr (basename (strtolower ($file), ".jpg"), "_-&%", " ")) . "<BR>$cm_img_data</TD>\n";
}
else {
$cm_convstr .= $file . "<BR>$cm_img_data</TD>\n";
}
if ($cm_imgpos == $cm_album_cols) {
$cm_convstr .= "</TR>\n";
$cm_imgpos = 1;
}
else {
$cm_imgpos++;
}

if (!file_exists ($cm_indexpath . $cm_jpegprefix_file . $file)) {
$jpeg_newX = $jpeg_oldX;
$jpeg_newY = $jpeg_oldY;
$outjpeg = fopen($cm_indexpath . $cm_jpegprefix_file . $file, "w");
$outjpeg = fclose($outjpeg);
if (function_exists ("imagecreatefromjpeg") && function_exists ("imagejpeg")) {
$jpeg_Xratio = ($jpeg_oldX / $cm_jpeg_maxX);
$jpeg_Yratio = ($jpeg_oldY / $cm_jpeg_maxY);
if ($jpeg_Xratio > $jpeg_Yratio) {
$jpeg_newX = round ($jpeg_oldX / $jpeg_Xratio);
$jpeg_newY = round ($jpeg_oldY / $jpeg_Xratio);
$reduction_ratio = round ((1/$jpeg_Xratio) * 100);
}
else {
$jpeg_newX = round ($jpeg_oldX / $jpeg_Yratio);
$jpeg_newY = round ($jpeg_oldY / $jpeg_Yratio);
$reduction_ratio = round ((1/$jpeg_Yratio) * 100);
}
if ($cm_jpeg_truecolors) {
$swap_jpeg = imagecreatetruecolor ($jpeg_newX, $jpeg_newY);
}
else {
$swap_jpeg = imagecreate ($jpeg_newX, $jpeg_newY);
}
$orig_jpeg = imagecreatefromjpeg($cm_indexpath . $file);
if ($orig_jpeg) {
if ($cm_jpeg_truecolors) {
imagecopyresampled ($swap_jpeg, $orig_jpeg, 0, 0, 0, 0, $jpeg_newX, $jpeg_newY, $jpeg_oldX, $jpeg_oldY);
}
else {
imagecopyresized ($swap_jpeg, $orig_jpeg, 0, 0, 0, 0, $jpeg_newX, $jpeg_newY, $jpeg_oldX, $jpeg_oldY);
}
if ($swap_jpeg)
imageinterlace ($swap_jpeg, 1);
imagejpeg ($swap_jpeg, $cm_indexpath . $cm_jpegprefix_file . $file, $cm_jpeg_quality);
}
}
}
}
}
$cm_convstr .= "</TABLE>";
}
if ($cm_convstr) {
return $cm_convstr;
}
else {
return $cm_source_string;
}
}
else {
return $cm_source_string;
}
};


// fcm_conv_list
// Searches for $cm_mksymbol1 in $cm_source_string, if found outputs $cm_delimiter1
// and change the "depth" of $cm_laststate to +1.
// Searches for $cm_mksymbol2 in $cm_source_string, if found outputs $cm_delimiter2
// and change the "depth" of $cm_laststate to -1 only if its value is >0.
// The original idea for this function courtesy of Stephen Reindl (sreindl@stephenreindl.de).
function fcm_conv_list ($cm_source_string, $cm_delimiter1, $cm_delimiter2, $cm_mksymbol1, $cm_mksymbol2, &$cm_laststate)
{
$cm_mkpos1 = strpos ($cm_source_string, $cm_mksymbol1);
$cm_mkpos2 = strpos ($cm_source_string, $cm_mksymbol2);
if ($cm_mkpos1 === 0) {
$cm_laststate++;
return substr ($cm_source_string, strlen ($cm_mksymbol1)) . $cm_delimiter1;
}
if ($cm_mkpos2 === 0) {
if ($cm_laststate > 0) {
$cm_laststate--;
return substr ($cm_source_string, strlen ($cm_mksymbol2)) . $cm_delimiter2;
}
}
return $cm_source_string;
};


// fcm_conv_listitem
// Searches for $cm_mksymbol in $cm_source_string, if found outputs $cm_delimiter.
function fcm_conv_listitem ($cm_source_string, $cm_delimiter, $cm_mksymbol)
{
$cm_mkpos = strpos ($cm_source_string, $cm_mksymbol);
if ($cm_mkpos === 0) {
return $cm_delimiter . substr ($cm_source_string, strlen ($cm_mksymbol));
}
return $cm_source_string;
};


// fcm_process_markup
// Split $cm_markup_string in lines and call every markup-processing function to
// convert the markup code to HTML code.
function fcm_process_markup ($cm_markup_string, $cm_currentpath, $cm_disable_format = false)
{
global $cm_enable_gd;
$cm_lines = explode ("\n", $cm_markup_string);
$cm_mk = "";
$cm_multi = false;
$cm_olist = 0;
$cm_ulist = 0;
foreach ($cm_lines as $cm_currentline) {
$cm_origline = $cm_currentline;
if (!$cm_disable_format) {
$cm_currentline = fcm_conv_multiline ($cm_currentline, "<PRE>", "</PRE>", "___", $cm_multi);
$cm_currentline = fcm_conv_block ($cm_currentline, "<H1>", "</H1>", "= ");
$cm_currentline = fcm_conv_block ($cm_currentline, "<H2>", "</H2>", "== ");
$cm_currentline = fcm_conv_block ($cm_currentline, "<H3>", "</H3>", "=== ");
$cm_currentline = fcm_conv_block ($cm_currentline, "<H4>", "</H4>", "==== ");
$cm_currentline = fcm_conv_block ($cm_currentline, "<H5>", "</H5>", "===== ");
$cm_currentline = fcm_conv_block ($cm_currentline, "<H6>", "</H6>", "====== ");
$cm_currentline = fcm_conv_list ($cm_currentline, "<UL>", "</UL>", "*[", "*]", $cm_ulist);
$cm_currentline = fcm_conv_list ($cm_currentline, "<OL>", "</OL>", "#[", "#]", $cm_olist);
if ($cm_ulist > 0) {
$cm_currentline = fcm_conv_listitem ($cm_currentline, "<LI>", "*-");
}
if ($cm_olist > 0) {
$cm_currentline = fcm_conv_listitem ($cm_currentline, "<LI>", "#-");
}
if (($cm_currentline == $cm_origline) && ($cm_multi == false)) {
$cm_currentline = fcm_conv_block ($cm_currentline, "<P>", "</P>", "");
}
$cm_currentline = fcm_conv_inline ($cm_currentline, "<STRONG>", "</STRONG>", " *", "* ");
$cm_currentline = fcm_conv_inline ($cm_currentline, "<EM>", "</EM>", " _", "_ ");
$cm_currentline = fcm_conv_links ($cm_currentpath, $cm_currentline, "[[", "]]", " ", false);
$cm_currentline = fcm_conv_links ($cm_currentpath, $cm_currentline, "{{", "}}", " ", true);
$cm_currentline = fcm_conv_images ($cm_currentpath, $cm_currentline, "((", "))", " ");
}
$cm_currentline = fcm_conv_inline ($cm_currentline, "<DIV class=\"boxedpara\">", "</DIV>", " %", "% ");
$cm_currentline = fcm_conv_index ($cm_currentpath, $cm_currentline, "#INDEX#");
$cm_currentline = fcm_conv_fileindex ($cm_currentpath, $cm_currentline, "#FILES#");
if ($cm_enable_gd) {
$cm_currentline = fcm_conv_album ($cm_currentpath, $cm_currentline, "#ALBUM#");
}
else {
$cm_currentline = fcm_conv_fileindex ($cm_currentpath, $cm_currentline, "#ALBUM#");
}
$cm_currentline = fcm_conv_emoticons ($cm_currentline);
$cm_mk = $cm_mk . $cm_currentline . "\n";
}
return $cm_mk;
};


// fcm_mark_visit
// Add a hit to the hit count of a page. If the page don't have yet a hit count,
// creates one. this modify both the Total-hits and Hits-since-update.
// Returns the total hits.
function fcm_mark_visit ($cm_visitedpath, $cm_hit_type) {
global $dbIDnull;
if ($cm_visitedpath) {
$result1 = db_query("select cmdb_directory, cmdb_totalhits, cmdb_updatehits from cmhits3 where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
$cm_totalhits = $row1[1] + 1;
$cm_updatehits = $row1[2] + 1;
$result2 = db_query("update cmhits3 set cmdb_totalhits='$cm_totalhits', cmdb_updatehits='$cm_updatehits' where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
}
else {
$result2 = db_query("insert into cmhits3 values($dbIDnull,'$cm_hit_type','$cm_visitedpath','1','1')") or db_die();
$cm_totalhits = 1;
$cm_updatehits = 1;
}
return ($cm_totalhits);
}
};


// fcm_reset_updatedvisit
// Reset the hits-count of the page. Only the Hits-since-update counter is
// modified.
function fcm_reset_updatedvisit ($cm_visitedpath, $cm_hit_type) {
global $dbIDnull;
if ($cm_visitedpath) {
$result1 = db_query("select cmdb_directory from cmhits3 where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
$result2 = db_query("update cmhits3 set cmdb_updatehits='0' where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
}
else {
$result2 = db_query("insert into cmhits3 values($dbIDnull,'$cm_hit_type','$cm_visitedpath','0','0')") or db_die();
}
}
};


// fcm_get_totalhits
// Returns the Total-hits of a page.
function fcm_get_totalhits ($cm_visitedpath, $cm_hit_type) {
if ($cm_visitedpath) {
$result1 = db_query("select cmdb_directory, cmdb_totalhits from cmhits3 where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
return ($row1[1]);
}
return (0);
}
};


// fcm_get_updatehits
// Returns the Hits-since-update count of a page.
function fcm_get_updatehits ($cm_visitedpath, $cm_hit_type) {
if ($cm_visitedpath) {
$result1 = db_query("select cmdb_directory, cmdb_updatehits from cmhits3 where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
return ($row1[1]);
}
return (0);
}
};


// fcm_delete_hitrecord
// Deletes the hits record of a page from the database.
// Usually used when deleting a page.
function fcm_delete_hitrecord ($cm_visitedpath, $cm_hit_type) {
if ($cm_visitedpath) {
$result1 = db_query("delete from cmhits3 where cmdb_directory like '$cm_visitedpath' and cmdb_type like '%$cm_hit_type%'") or db_die();
}
};


// fcm_add_logentry
// Adds an entry to the event log table.
// $cm_logged_operation is a CM_APPLOG_ constant.
function fcm_add_logentry ($cm_logged_path, $cm_logged_user, $cm_logged_operation, $cm_logged_desc) {
global $dbIDnull;
$cm_logged_date = fcm_curdate_string ();
$cm_logged_desc = substr ($cm_logged_desc, 0, 255);
$result2 = db_query("insert into cmapplog3 values($dbIDnull,'$cm_logged_date',$cm_logged_operation,'$cm_logged_user','$cm_logged_path','$cm_logged_desc')") or db_die();
};


// fcm_can_berated
// Returns true if the given directory/page has rating enabled.
function fcm_can_berated ($cm_ratedpath) {
if ($cm_ratedpath) {
$result1 = db_query("select cmdb_directory, cmdb_rated from content3 where cmdb_directory like '$cm_ratedpath'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[1] == 1) {
return (true);
}
}
return (false);
};


// fcm_set_rating
// Set the rating of a directory given by an user.
// If the directory-user record does not exist yet, it is created. If it exists,
// is modified (only if the config value $cm_can_rerate is TRUE).
// It does return TRUE if the rating was recorded/changed, otherwise, it returns FALSE.
function fcm_set_rating ($cm_ratedpath, $cm_user_rating, $cm_rating_user) {
global $dbIDnull, $cm_can_rerate;
if (($cm_ratedpath) && (fcm_can_berated ($cm_ratedpath))) {
if (fcm_get_userrating ($cm_ratedpath, $cm_rating_user) > 0) {
if ($cm_can_rerate) {
$result2 = db_query("update cmrating3 set cmdb_rate=$cm_user_rating where cmdb_directory='$cm_ratedpath' and cmdb_author_user='$cm_rating_user'") or db_die();
return (true);
}
else {
return (false);
}
}
else {
$result2 = db_query("insert into cmrating3 values($dbIDnull,'$cm_ratedpath',$cm_user_rating,'$cm_rating_user')") or db_die();
return (true);
}
}
else {
return (false);
}
};


// fcm_get_rating
// Returns the number of users that have given a certain value to a page/directory.
function fcm_get_rating ($cm_ratedpath, $cm_user_rating) {
if (($cm_ratedpath) && (fcm_can_berated ($cm_ratedpath))) {
$result1 = db_query("select count(cmdb_directory) from cmrating3 where cmdb_directory like '$cm_ratedpath' and cmdb_rate=$cm_user_rating") or db_die();
$row1 = db_fetch_row($result1);
return ($row1[0]);
}
else {
return (0);
}
};


// fcm_get_userrating
// Returns the rating given by an user to a page/directory.
// If the user has not rated the page/directory, 0 is returned.
function fcm_get_userrating ($cm_ratedpath, $cm_rating_user) {
if (($cm_ratedpath) && (fcm_can_berated ($cm_ratedpath))) {
$result1 = db_query("select cmdb_rate from cmrating3 where cmdb_directory like '$cm_ratedpath' and cmdb_author_user='$cm_rating_user'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
return ($row1[0]);
}
else {
return (0);
}
}
};


// fcm_getaverage_rating
// Returns the average rating of a page/directory.
function fcm_getaverage_rating ($cm_ratedpath) {
if (($cm_ratedpath) && (fcm_can_berated ($cm_ratedpath))) {
$result1 = db_query("select avg(cmdb_rate) from cmrating3 where cmdb_directory like '$cm_ratedpath'") or db_die();
$row1 = db_fetch_row($result1);
return ($row1[0]);
}
else {
return (0);
}
};


// fcm_delete_rating
// Deletes all records related to a page/directory from the rating table.
function fcm_delete_rating ($cm_ratedpath) {
if ($cm_ratedpath) {
$result1 = db_query("delete from cmrating3 where cmdb_directory like '$cm_ratedpath'") or db_die();
}
};


// fcm_storerdf
// Opens a connection to a web server, gets a RDF/RSS page, extract the titles
// and urls from the XML code, encode the data and store it in an array,
// serialize the array data and store it in the database.
function fcm_storerdf ($cm_rdfurl, $cm_rdftitle, $cm_rdftime2live) {
global $dbIDnull;
$result1 = db_query("select cmdb_type, cmdb_title, cmdb_date_update from content3 where cmdb_type like '%s%' and cmdb_title like '$cm_rdftitle'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
$cm_date_diff = round ((date( "U" ) - mktime(substr($row1[2],11,2), substr($row1[2],14,2), substr($row1[2],17,2), substr($row1[2],5,2), substr($row1[2],8,2), substr($row1[2],0,4))) / 60);
if (($cm_date_diff <= $cm_rdftime2live) && ($cm_rdftime2live !== 0)) {
return;
}
}
$cm_rdf_content = "";
$cm_urlparts = parse_url ($cm_rdfurl);
set_time_limit (60);
$cm_fp = fsockopen ($cm_urlparts ["host"], "80", $errno, $errstr, 50);
if ($cm_fp) {
if (!$cm_urlparts["query"]) {
fputs($cm_fp, "GET " . $cm_urlparts["path"] . " HTTP/1.0\r\nHost: " . $cm_urlparts["host"] . "\r\n\r\n");
}
else {
fputs($cm_fp, "GET " . $cm_urlparts["path"] . "?" . $cm_urlparts["query"] . " HTTP/1.0\r\nHost: " . $cm_urlparts["host"] . "\r\n\r\n");
}
while (!feof($cm_fp)) {
$cm_rdf_content .= fgets ($cm_fp, 128);
}
$cm_rdf_data = $cm_rdf_content;
$cm_rdf_data = eregi_replace ("<?xml.*/channel>", "", $cm_rdf_data);
$cm_rdf_data = eregi_replace ("<image.*/image>", "", $cm_rdf_data);
$cm_rdf_data = eregi_replace ("</rdf.*", "", $cm_rdf_data);
$cm_rdf_data = rtrim ($cm_rdf_data);
$cm_rdf_items = explode ("</item>", $cm_rdf_data);
for ($cm_ci = 0; $cm_ci < count ($cm_rdf_items); $cm_ci++) {
$cm_rdf_links[$cm_ci][0] = eregi_replace (".*<title>", "", $cm_rdf_items[$cm_ci]);
$cm_rdf_links[$cm_ci][0] = eregi_replace ("</title>.*", "", $cm_rdf_links[$cm_ci][0]);
$cm_rdf_links[$cm_ci][1] = eregi_replace (".*<link>", "", $cm_rdf_items[$cm_ci]);
$cm_rdf_links[$cm_ci][1] = eregi_replace ("</link>.*", "", $cm_rdf_links[$cm_ci][1]);
$cm_rdf_links[$cm_ci][0] = fcm_htmlentity ($cm_rdf_links[$cm_ci][0], ENT_QUOTES);
$cm_rdf_links[$cm_ci][1] = urlencode ($cm_rdf_links[$cm_ci][1]);
}
$cm_rdf_content = addslashes (serialize ($cm_rdf_links));
}
$cm_pub_date = fcm_curdate_string ();
if ($row1[0]) {
$result2 = db_query("update content3 set cmdb_date_creation='$cm_pub_date', cmdb_date_update='$cm_pub_date', cmdb_content='$cm_rdf_content', cmdb_rated=0, cmdb_commented=0, cmdb_short_title='', cmdb_logo='', cmdb_version=1, cmdb_sign='', cmdb_enable_html=0 where cmdb_type like '%s%' and cmdb_title like '$cm_rdftitle'") or db_die();
}
else {
$result2 = db_query("insert into content3 values($dbIDnull,'s','$cm_rdfurl',null,'$cm_rdftitle',null,null,null,null,null,null,null,null,'$cm_pub_date','$cm_pub_date',null,null,'$cm_rdf_content',0,0,'','',1,'',0)") or db_die();
}
fcm_add_logentry ("", "", CM_APPLOG_GET_SYND, "Got syndication feed $cm_rdftitle");
}


// fcm_readrdf
// Reads the RSS/RDF data from the database, unserialize, decode, and store in
// an array, then return the array (bidimensional array, first column is the
// title, second column is the URL).
function fcm_readrdf ($cm_rdftitle, $cm_max_links) {
$cm_rdf_links = array ();
$cm_rdf_sellinks = array ();
$result1 = db_query("select cmdb_type, cmdb_title, cmdb_date_update, cmdb_content from content3 where cmdb_type like '%s%' and cmdb_title like '$cm_rdftitle'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[0]) {
$cm_rdf_links = unserialize (stripslashes ($row1[3]));
if ($cm_max_links > count ($cm_rdf_links)) {
$cm_max_links = count ($cm_rdf_links) - 1;
}
for ($cm_ci = 0; $cm_ci < $cm_max_links; $cm_ci++) {
$cm_rdf_sellinks[$cm_ci][0] = fcm_unhtmlentities ($cm_rdf_links[$cm_ci][0]);
$cm_rdf_sellinks[$cm_ci][1] = urldecode ($cm_rdf_links[$cm_ci][1]);
}
}
return ($cm_rdf_sellinks);
}


// fcm_display_rdfbox
// Creates a box with a list of links from the RDF/RSS array.
function fcm_display_rdfbox ($cm_rdftitle, $cm_rdfdata) {
global $cm_imgpath;
echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"5\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n";
echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"syndicatedboxborder\">";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\"><tr><td class=\"syndicatedboxhead\">\n";
echo "&nbsp;<strong>$cm_rdftitle</strong>&nbsp;\n";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"syndicatedboxborder\">";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\"><tr><td class=\"syndicatedboxbody\">\n";
echo "<ul class=\"syndicatedlist\">\n";
foreach ($cm_rdfdata as $cm_ci) {
echo "<li class=\"syndicateditem\"><a href=\"redir.php?cm_elink=$cm_ci[1]\" target=\"_blank\">$cm_ci[0]</a></li>\n";
}
echo "</ul>\n";
echo "</td></tr></table></td></tr></table>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"10\"><img src=\"$cm_imgpath/t.gif\" width=\"1\" height=\"10\" border=\"0\" alt=\"\"></td></tr></table>\n";
};


// fcm_display_txtrdfbox
// Creates a list with a list of links from the RDF/RSS array.
function fcm_display_txtrdfbox ($cm_rdftitle, $cm_rdfdata) {
global $cm_imgpath;
echo "&nbsp;<strong>$cm_rdftitle</strong>&nbsp;\n";
echo "<ul class=\"syndicatedlist\">\n";
foreach ($cm_rdfdata as $cm_ci) {
echo "<li class=\"syndicateditem\"><a href=\"redir.php?cm_elink=$cm_ci[1]\" target=\"_blank\">$cm_ci[0]</a></li>\n";
}
echo "</ul>\n";
};


// fcm_can_becommented
// Returns true if the given directory/page has user comments enabled.
function fcm_can_becommented ($cm_commentpath) {
if ($cm_commentpath) {
$result1 = db_query("select cmdb_directory, cmdb_commented from content3 where cmdb_directory like '$cm_commentpath'") or db_die();
$row1 = db_fetch_row($result1);
if ($row1[1] == 1) {
return (true);
}
}
return (false);
};


// fcm_get_totalcomments
// Returns the number of user comments of a given page/directory.
function fcm_get_totalcomments ($cm_commentedpath) {
if (($cm_commentedpath) && (fcm_can_becommented ($cm_commentedpath))) {
$result1 = db_query("select count(cmdb_directory) from cmcomments3 where cmdb_directory like '$cm_commentedpath'") or db_die();
$row1 = db_fetch_row($result1);
return ($row1[0]);
}
else {
return (0);
}
};


// fcm_show_usercomments
// Displays all user comments for a page. If no comments are found, it displays
// an invitation to write a comment.
function fcm_show_usercomments ($cm_path) {
global $cm_text;
global $cm_max_usercomments;
if (($cm_path) && ($cm_path <> "/") && fcm_can_becommented ($cm_path)) {
$cm_total_comments = 0;
$result1 = db_query("select cmdb_directory, cmdb_title, cmdb_author_user, cmdb_date_creation, cmdb_comment from cmcomments3 where cmdb_directory like '$cm_path'") or db_die();
while (($row1 = db_fetch_row ($result1)) && ($cm_total_comments < $cm_max_usercomments)) {
$cm_authornames = fcm_user_names ($row1[2]);
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
echo "<tr class=\"usercommentshead\"><td>\n";
echo "<strong>$row1[1]</strong>";
echo "</td><td align=\"right\">\n";
echo "<em>" . fcm_htmlentity ($cm_authornames[1] . " " . $cm_authornames[2]) . "</em> - $row1[3]";
echo "</td></tr><tr class=\"usercommentsbody\"><td colspan=\"2\">\n";
echo fcm_process_markup ($row1[4], $cm_path, false);
echo "</td></tr></table>\n";
$cm_total_comments++;
}
if ($cm_total_comments < 1) {
echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"usercommentshead\">\n";
echo "{$cm_text["bethefirstperson"]} <A HREF=\"usercomment.php?cm_path=$cm_path\">{$cm_text["postingacomment"]}</A> {$cm_text["


Report this post
Top
  
Reply with quote  
PostPosted: 17 Mar 2003, 05:39 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Ok, Psymon, I've reviewed your modifications. Good ideas. Just to be sure I'm getting the idea right, I have some questions/comments.

First, it seems not all the cm_lib.inc.php file was posted, so, are all your modifications there or are some parts missing?

In the function fcm_articlelist_box, you created an option to display special announces. Two similar features have been asked before: content-less items (short announces, warnings, etc) and important/special items (just like the one you coded).

I've thought both features can be set at creation time by using a checkbox in the creation form, then (in the first case) setting the cmdb_type field to some special value. In the second case, maybe by adding an extra field to the content3 table or maybe using also the cmdb_type field. And the appearance of the important/special item would be set by the CSS style-sheet.

But don't take me wrong, the way you did it looked great, but I'm a bit picky on using non-standard HTML tags (both Mozilla and IE display it, but Opera and older Netscape don't). In addition, I cannot use string detection to set/unset the feature, because it would be language dependent. So, I'm recoding your concept.

In the function fcm_conv_inline, you added some code that I'm not sure what does it do. I don't know if that code is finished but it broke the inline code parsing. If you are trying to change the way the inline markup is decoded, please tell me so I can help you out.

In function fcm_conv_images, you added code to download the inline images with getfile.php. That's a bug fix, actually. The getfile.php script should be used since version 0.4.5, but somehow I missed it (and nobody complained either). The original purpose of the getfile.php was precisely to be able to take the root directory out of the Phprojekt path. I'm recoding it.

In function fcm_conv_index, you made a modification some people were also asking for: to display only the immediate lower directories and not all lower dirs. This is especially useful for very deep structures. I was thinking on adding this as a markup option (#INDEX1# for example to display only one level, #INDEX3# to display 3 levels, etc.) and leave #INDEX# as with the original behavior. Of course I can get some feedback on this (markups are supposed to be quite stable, that’s why I was thinking on leaving the original behavior for #INDEX#).

In function fcm_conv_fileindex you added a condition so files without extensions are not displayed. As in Unix is very common to don't use extensions with some files (like README, INSTALL, etc) the module always shows files regardless if they have or not extension. Maybe you have a particular need (or preference) to hide files without extensions, if so, please tell me, so I can think more about why and how to include that option.

So, Psymon, thanks a lot for your contribution, I'll be including some things in the next release of the CM module. Of course you'll be fully credited for your ideas and concepts.

Moreover, don't hesitate to make more comments. Also, any user of the CM module is welcome to make comments on these or any other idea.

Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Feedback
PostPosted: 19 Mar 2003, 08:26 
I'm just starting out with PHP and coding in particular so please forgive my novice qualities...=]

fcm_conv_inline - I did that originally for the tag #Album# to display correctly. It was one of my first modifications, so like the novice that I am I failed to document it properly. I haven't noticed the inline parser being broke. I will go back and check to see if it is not working correctly. One thing to remember is that my files are not stored locally, so for locally stored files it could be quite true that the parser is broken.

fcm_conv_fileindex - I added this so that directories would not be displayed in the file listing when you manage files.

All that you have said is definately the way to go. YOUR WORK is very appreciated! I consider your addon the most valuable one that has been created.

Hopefully as my methods improve I can be of greater help to others, just as you are. =]

Psymon


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.  [ 3 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