submit news
A small pseudo-CAPTCHA is built in, which asks users to calculate
something. Division asks for integers only (but will accept reals
in submissions). It will hinder generic link spam bots, but not
targetted attacks. Enabling the more difficult arithmetic riddles
would just irritate users.
*/
#-- config
define("RSS_INTERNAL_BLOG_CID", 5000);
#-- register hooks
if (defined("GREGARIUS_HOME")) {
rss_set_hook("rss.plugins.admin.activate", "g_plugins_internalblog_install");
rss_set_hook("rss.plugins.configuration", "g_plugin_internalblog_settings");
#-- link to InternalBlog in sidemenu
rss_set_hook("rss.plugins.sidemenu", "g_plugin_internalblog_link_sidemenu");
#-- put link into top/head nav menu (BROKEN)
rss_set_hook("rss.plugins.navelements", "g_plugins_internalblog_link_topmenu");
}
#-- script got invoked directly
else {
chdir("..");
require_once("init.php");
g_plugin_internalblog_interface();
}
#-- admin page
function g_plugin_internalblog_settings() {
#-- config
($cid = rss_plugins_get_option("intblog.cid")) or ($cid = RSS_INTERNAL_BLOG_CID);
#-- save/action
if (rss_plugins_is_submit()) {
#-- item deletion
foreach ($_REQUEST["delete"] as $guid) {
$guid = rss_real_escape_string($guid);
rss_query("DELETE FROM ".getTable("item")." WHERE (cid=$cid) AND (guid='$guid')");
}
// #-- store submitted channel_id for InternalBlog
// if ($cid = (int)$_REQUEST["cid"]) {
// rss_plugins_add_option("intblog.cid", $cid, "string", "", "channel_id for internal blog");
// }
}
#-- list blog posts
print<<
| delete | title | description | $title | $desc | END; } print "
|---|
Entry has been successfully saved.
Go back to the front page to see it.
Or you can now submit another one.
END; $title = $link = $description = $_REQUEST["captcha"] = ""; } } #-- page / form -------------------------------------------------------- if (true) { #-- prepare vars $sqlres = rss_query("SELECT title, descr FROM ".getTable("channels")." WHERE id=$cid"); list($page_title, $page_title2) = rss_fetch_row($sqlres); #-- get fresh captcha do { $formula = g_plugin_internalblog_new_captcha(); } while (g_plugin_internalblog_used_captcha($formula)); #-- output if ($ERROR) { $html_ERROR = "
$ERROR
"; } $title = htmlentities($title); ($link = htmlentities($link)) || ($link = "http://"); $description = htmlentities($description); echo <<You can use this page to submit news items into the local site. They get displayed in the according category. This is meant for link items primarily, and therefore will reject anything without an URL.