"._EDITSHOUT."";
if(isset($_POST['submit'])) {
$shout_message = trim($_POST['shout_message']);
$shout_message = preg_replace("/^(.{200}).*$/", "$1", $shout_message);
$shout_message = preg_replace("/[^\s]{25}/", "$1\n", $shout_message);
$search = array("\"", "'", "\\", '\"', "\'", "<", ">", " ", "\n");
$replace = array(""", "'", "\", """, "'", "<", ">", " ", " ");
$shout_message = str_replace($search, $replace, replace_naughty(trim($shout_message)));
$shout_message = str_replace("\n", "
", $shout_message);
$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_shoutbox SET shout_message = '$shout_message' WHERE shout_id = '".$_GET['shout_id']."' LIMIT 1");
if($result) $output .= write_message(_ACTIONSUCCESSFUL);
}
$shoutquery = dbquery("SELECT shout_message FROM ".TABLEPREFIX."fanfiction_shoutbox WHERE shout_id = '".$_GET['shout_id']."' LIMIT 1");
$shout = dbassoc($shoutquery);
if($shout) {
$output .= "
";
}
else {
$output .= write_error(_NORESULTS);
}
}
if(isset($_POST['submitopts'])) {
$blocks['shoutbox']['shoutdate'] = !empty($_POST['customshoutdate']) ? descript(strip_tags($_POST['customshoutdate'])) : descript(strip_tags($_POST['shoutdate']));
$blocks['shoutbox']['shoutlimit'] = isset($_POST['shoutlimit']) && isNumber($_POST['shoutlimit']) ? $_POST['shoutlimit'] : 10;
$blocks['shoutbox']['guestshouts'] = isset($_POST['guestshouts']) && $_POST['guestshouts'] == _YES ? 1 : 0;
save_blocks($blocks);
}
$defaults = array("m/d/y h:i a", "d/m/y G:i:s", "m-d-y h:i a", "d-m-y G:i:s", "m.d.y h:i a", "d.m.y G:i:s", "M j, Y h:i a", "M j, Y G:i:s", "d M, Y h:i a", "d M, Y G:i:s");
$output .= "";
$shouts = dbquery("SELECT shouts.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_shoutbox as shouts LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = shouts.shout_name ORDER BY shout_datestamp DESC");
$totalshouts = dbnumrows($shouts);
$shouts = dbquery("SELECT shouts.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_shoutbox as shouts LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = shouts.shout_name ORDER BY shout_datestamp DESC LIMIT $offset, $itemsperpage");
if($totalshouts > 0) {
$output .= "";
$output .= "";
if(!empty($blocks['shoutbox']['shoutdate'])) $shoutdate = $blocks['shoutbox']['shoutdate'];
else $shoutdate = $dateformat." ".$timeformat;
while($shout = dbassoc($shouts)) {
if(isNumber($shout['shout_name']) && isset($shout['penname'])) $shoutname = "
".$shout['penname']."";
else if(isset($shout['shout_name'])) $shoutname = $shout['shout_name'];
else $shout = _GUEST; // Just in case.
$output .= "
$shoutname\n
".stripslashes($shout['shout_message'])."\n
".date("$shoutdate", $shout['shout_datestamp'])." ["._DELETE."] ["._EDIT."] \n
";
}
$output .= "
";
if($totalshouts > $itemsperpage) $output .= build_pagelinks("admin.php?action=blocks&admin=shoutbox&", $totalshouts, $offset);
}
else $output .= write_message(_NOSHOUTS);
?>