--- /dev/null
+<form method="post" action="module.php" name="form">
+
+<table cellpadding=9 cellspacing=0 >
+<tr valign=top>
+ <td align=right><p>forum_displaymode:</td>
+ <td>
+ <?php choose_from_menu ($FORUM_LAYOUT_MODES, "forum_displaymode", $CFG->forum_displaymode, "", "", ""); ?>
+ </td>
+ <td>
+ <?php print_string("configdisplaymode", "forum") ?>
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><p>forum_shortpost:</td>
+ <td>
+ <input name=forum_shortpost type=text size=5 value="<?php p($CFG->forum_shortpost) ?>">
+ </td>
+ <td>
+ <?php print_string("configshortpost", "forum") ?>
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><p>forum_longpost:</td>
+ <td>
+ <input name=forum_longpost type=text size=5 value="<?php p($CFG->forum_longpost) ?>">
+ </td>
+ <td>
+ <?php print_string("configlongpost", "forum") ?>
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><p>forum_manydiscussions:</td>
+ <td>
+ <input name=forum_manydiscussions type=text size=5 value="<?php p($CFG->forum_manydiscussions) ?>">
+ </td>
+ <td>
+ <?php print_string("configmanydiscussions", "forum") ?>
+ </td>
+</tr>
+<tr>
+ <td colspan=3 align=center>
+ <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+</tr>
+</table>
+
+</form>
/// CONSTANTS ///////////////////////////////////////////////////////////
-$FORUM_DEFAULT_DISPLAY_MODE = 3;
-
$FORUM_LAYOUT_MODES = array ( "1" => get_string("modeflatoldestfirst", "forum"),
"-1" => get_string("modeflatnewestfirst", "forum"),
"2" => get_string("modethreaded", "forum"),
"eachuser" => get_string("eachuserforum", "forum"),
"single" => get_string("singleforum", "forum") );
-
$FORUM_OPEN_MODES = array ("2" => get_string("openmode2", "forum"),
"1" => get_string("openmode1", "forum"),
"0" => get_string("openmode0", "forum") );
+if (!isset($CFG->forum_displaymode)) {
+ set_config("forum_display_mode", 3);
+}
-define("FORUM_SHORT_POST", 300); // Less non-HTML characters than this is short
+if (!isset($CFG->forum_shortpost)) {
+ set_config("forum_shortpost", 300); // Less non-HTML characters than this is short
+}
-define("FORUM_LONG_POST", 600); // More non-HTML characters than this is long
+if (!isset($CFG->forum_longpost)) {
+ set_config("forum_longpost", 600); // More non-HTML characters than this is long
+}
-define("FORUM_MANY_DISCUSSIONS", 100);
+if (!isset($CFG->forum_manydiscussions)) {
+ set_config("forum_manydiscussions", 100); // Number of discussions on a page
+}
/// STANDARD FUNCTIONS ///////////////////////////////////////////////////////////
$attachedimages = "";
}
- if ($link and (strlen(strip_tags($post->message)) > FORUM_LONG_POST)) {
+ if ($link and (strlen(strip_tags($post->message)) > $CFG->forum_longpost)) {
// Print shortened version
echo format_text(forum_shorten_post($post->message), $post->format);
$numwords = count_words(strip_tags($post->message));
function forum_shorten_post($message) {
// Given a post object that we already know has a long message
// this function truncates the message nicely to the first
-// sane place between FORUM_LONG_POST and FORUM_SHORT_POST
+// sane place between $CFG->forum_longpost and $CFG->forum_shortpost
+
+ global $CFG;
$i = 0;
$tag = false;
break;
}
if (!$stopzone) {
- if ($count > FORUM_SHORT_POST) {
+ if ($count > $CFG->forum_shortpost) {
$stopzone = true;
}
}
}
function forum_set_display_mode($mode=0) {
- global $USER, $FORUM_DEFAULT_DISPLAY_MODE;
+ global $USER, $CFG;
if ($mode) {
$USER->mode = $mode;
} else if (empty($USER->mode)) {
- $USER->mode = $FORUM_DEFAULT_DISPLAY_MODE;
+ $USER->mode = $CFG->forum_displaymode;
}
}
if (!empty($showall)) {
forum_print_latest_discussions($forum->id, 0, "header");
} else {
- forum_print_latest_discussions($forum->id, FORUM_MANY_DISCUSSIONS, "header");
+ forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, "header");
}
break;
if (!empty($showall)) {
forum_print_latest_discussions($forum->id, 0, "header");
} else {
- forum_print_latest_discussions($forum->id, FORUM_MANY_DISCUSSIONS, "header");
+ forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, "header");
}
break;
if (!empty($showall)) {
forum_print_latest_discussions($forum->id, 0, "header");
} else {
- forum_print_latest_discussions($forum->id, FORUM_MANY_DISCUSSIONS, "header");
+ forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, "header");
}
break;
}