"section_help", "block" => "section_block", "admin" => "section_admin"); // global variables: $_section = array("status" => array(2 => "enabled: always", 1 => "enabled: custom", 0 => "disabled"), "timout" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100), "post" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100), "dump" => array(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -20, -25, -30)); function section_help() { ?>

When submitting new stories, every story is assigned a section or category. Sections can be maintained from the administration pages.

For moderation purpose, you can specify a post, dump and expiration thresholds for each available section according to type and urgency level of a section. This is useful considering the fact that some sections do not really "expire" and stay interesting and active as time passes by, whereas news-related stories are only considered "hot" over a short period of time.

name) ."\">$_section->name (". check_output($_section->stories, 0) .")\n"; } $block[0]["subject"] = "Sections"; $block[0]["content"] = $content; $block[0]["info"] = "Section list"; return $block; } function section_add() { global $_section; $output .= "
\n"; $output .= "

\n"; $output .= " Section name:
\n"; $output .= " \n"; $output .= "

\n"; $output .= "

\n"; $output .= " Post threshold:
\n"; $output .= " \n"; $output .= "

\n"; $output .= "

\n"; $output .= " Dump threshold:
\n"; $output .= " \n"; $output .= "

\n"; $output .= "

\n"; $output .= " Timout threshold:
\n"; $output .= " \n"; $output .= "

\n"; $output .= " \n"; $output .= "
\n"; print $output; } function section_add_save($edit) { db_query("INSERT INTO sections (name, post, dump, timout) VALUES ('". check_input($edit[name]) ."', '". check_input($edit[post]) ."', '". check_input($edit[dump]) ."', '". check_input($edit[timout]) ."')"); } function section_delete($name) { db_query("DELETE FROM sections WHERE name = '$name'"); } function section_display() { global $_section; $status = $_section[status]; $timout = $_section[timout]; $post = $_section[post]; $dump = $_section[dump]; // Perform query: $result = db_query("SELECT * FROM sections ORDER BY name"); // Generate output: $output .= "
\n"; $output .= "\n"; $output .= " \n"; while ($_section = db_fetch_object($result)) { foreach ($status as $key=>$value) $options0 .= "\n"; foreach ($post as $value) $options1 .= "\n"; foreach ($dump as $value) $options2 .= "\n"; foreach ($timout as $value) $options3 .= "\n"; $output .= " \n"; unset($options0); unset($options1); unset($options2); unset($options3); } $output .= "
section namestatuspost thresholddump thresholdexpiration thresholdoperations
". check_output($_section->name) ."name) ."\">delete
\n"; $output .= "\n"; $output .= "
\n"; print $output; } function section_display_save($edit) { foreach ($edit as $key=>$value) { db_query("UPDATE sections SET status = '". check_input($value[status]) ."', post = '". check_input($value[post]) ."', dump = '". check_input($value[dump]) ."', timout = '". check_input($value[timout]) ."' WHERE name = '". check_input($key) ."'"); } } function section_admin() { global $op, $edit, $name; print "add new section | overview | help
\n"; switch($op) { case "add": section_add(); break; case "help": section_help(); break; case "delete": section_delete(check_input($name)); section_display(); break; case "Add section": section_add_save($edit); section_display(); break; case "Save sections": section_display_save($edit); // fall through default: section_display(); } } ?>