--- a/admin/blocks.php +++ b/admin/blocks.php @@ -1,98 +1,102 @@ -<?php -// ---------------------------------------------------------------------- -// eFiction 3.0 -// Copyright (c) 2007 by Tammy Keefer -// Valid HTML 4.01 Transitional -// Based on eFiction 1.1 -// Copyright (C) 2003 by Rebecca Smallwood. -// http://efiction.sourceforge.net/ -// ---------------------------------------------------------------------- -// LICENSE -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License (GPL) -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// To read the license please visit http://www.gnu.org/copyleft/gpl.html -// ---------------------------------------------------------------------- - -if(!defined("_CHARSET")) exit( ); - -function save_blocks( $blocks ) { - - foreach($blocks as $block =>$value) { - unset($blockvars); - if((isset($_GET['admin']) && $_GET['admin'] != $block) || (isset($_GET['init']) && $_GET['init'] != $block)) continue; - foreach($value as $var=>$val) { - if($var != "name" && $var != "title" && $var != "file" && $var != "status") $blockvars[$var] = $val; - } - dbquery("UPDATE ".TABLEPREFIX."fanfiction_blocks SET block_name = '$block', block_title = '".escapestring($value['title'])."', block_file = '".$value['file']."', block_status = '".$value['status']."', block_variables = '".(isset($blockvars) ? addslashes(serialize($blockvars)) : "")."' WHERE block_name = '$block'"); - } -} -if(isset($_GET['admin'])) $admin = $_GET['admin']; -else $admin = false; -$content = ""; - - if($admin) { - $output .= "<div id='pagetitle'>"._ADMIN." - ".(isset($blocks[$_GET['admin']]['title']) ? $blocks[$_GET['admin']]['title'] : "")."</div>"; - include("blocks/".$_GET['admin']."/admin.php"); - save_blocks( $blocks ); - } - if(isset($_GET['init'])) { - if(file_exists("blocks/".$_GET['init']."/init.php")) include("blocks/".$_GET['init']."/init.php"); - else return _ERROR; - save_blocks( $blocks ); - } - if(isset($_POST['submit']) && empty($admin)) { - $x = 1; - while(isset($_POST[$x])) { - // activate inactive blocks. - if(isset($blocks[$_POST[$x]])) { - $blocks[$_POST[$x]]['title'] = descript($_POST[$x."_title"]); - $blocks[$_POST[$x]]["status"] = $_POST[$x."_status"]; - } - $x++; - } - save_blocks( $blocks ); - $output .= write_message(_ACTIONSUCCESSFUL); - } -// In case the skin has already overridden the block settings or we've just changed the settings. -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} - unset($content); - -if(empty($admin)) { - $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks\"><center><table class=\"tblborder\" cellpadding=\"3\"><tr><th>"._NAME."</th><th>"._TITLE."</th><th>"._STATUS."</th><th>"._ADMIN."</th></tr>"; - $x = 1; - $directory = opendir("blocks"); - while($filename = readdir($directory)) { - if($filename=="." || $filename==".." || !is_dir("blocks/".$filename)) continue; - $output .= "<tr><td class=\"tblborder\"><input type=\"hidden\" name=\"$x\" value=\"$filename\">$filename</td>"; - if(isset($blocks[$filename]['file'])) $output .= "<td class=\"tblborder\"><input name=\"{$x}_title\" type=\"text\" class=\"textbox\" value=\"".stripslashes($blocks[$filename]['title'])."\"><input name=\"{$x}_file\" type=\"hidden\" value=\"".$blocks[$filename]['file']."\"></td> - <td class=\"tblborder\"><select name=\"{$x}_status\"> - <option value=\"0\"".(!$blocks[$filename]['status'] ? " selected" : "").">"._INACTIVE."</option> - <option value=\"1\"".($blocks[$filename]['status'] == 1? " selected" : "").">"._ACTIVE."</option> - <option value=\"2\"".($blocks[$filename]['status'] == 2 ? " selected" : "").">"._INDEXONLY."</option> - </select></td> - <td class=\"tblborder\">".(file_exists("blocks/$filename/admin.php") ? "<a href=\"admin.php?action=blocks&admin=$filename\">"._OPTIONS."</a>" : _NONE); - else $output .= "<td class=\"tblborder\" colspan=\"3\" align=\"center\"><a href=\"admin.php?action=blocks&init=$filename\">"._INITIALIZE."</a>"; - $output .= "</td></tr>"; - $x++; - } - closedir($directory); - $output .= "</table><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>"; -} -// Now load the skin settings back in. - if(file_exists("$skindir/variables.php")) include("$skindir/variables.php"); +<?php +// ---------------------------------------------------------------------- +// eFiction 3.0 +// Copyright (c) 2007 by Tammy Keefer +// Valid HTML 4.01 Transitional +// Based on eFiction 1.1 +// Copyright (C) 2003 by Rebecca Smallwood. +// http://efiction.sourceforge.net/ +// ---------------------------------------------------------------------- +// LICENSE +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License (GPL) +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// To read the license please visit http://www.gnu.org/copyleft/gpl.html +// ---------------------------------------------------------------------- + +if(!defined("_CHARSET")) exit( ); + +function save_blocks( $blocks ) { + + foreach($blocks as $block =>$value) { + unset($blockvars); + if((isset($_GET['admin']) && $_GET['admin'] != $block) || (isset($_GET['init']) && $_GET['init'] != $block)) continue; + foreach($value as $var=>$val) { + if($var != "name" && $var != "title" && $var != "file" && $var != "status") $blockvars[$var] = $val; + } + dbquery("UPDATE ".TABLEPREFIX."fanfiction_blocks SET block_name = '$block', block_title = '".escapestring($value['title'])."', block_file = '".$value['file']."', block_status = '".$value['status']."', block_variables = '".(isset($blockvars) ? addslashes(serialize($blockvars)) : "")."' WHERE block_name = '$block'"); + } +} +if(isset($_GET['admin'])) $admin = $_GET['admin']; +else $admin = false; +$content = ""; + + if($admin) { + $output .= "<div id='pagetitle'>"._ADMIN." - ".(isset($blocks[$_GET['admin']]['title']) ? $blocks[$_GET['admin']]['title'] : "")."</div>"; + include("blocks/".$_GET['admin']."/admin.php"); + save_blocks( $blocks ); + } + if(isset($_GET['init'])) { + if(file_exists("blocks/".$_GET['init']."/init.php")) include("blocks/".$_GET['init']."/init.php"); + else return _ERROR; + save_blocks( $blocks ); + } + if(isset($_POST['submit']) && empty($admin)) { + $x = 1; + while(isset($_POST[$x])) { + // activate inactive blocks. + if(isset($blocks[$_POST[$x]])) { + $blocks[$_POST[$x]]['title'] = descript($_POST[$x."_title"]); + $blocks[$_POST[$x]]["status"] = $_POST[$x."_status"]; + } + $x++; + } + save_blocks( $blocks ); + $output .= write_message(_ACTIONSUCCESSFUL); + } +// In case the skin has already overridden the block settings or we've just changed the settings. +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks"); +while($block = dbassoc($blockquery)) { + + if($block['block_variables']) { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} + unset($content); + +if(empty($admin)) { + $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks\"><center><table class=\"tblborder\" cellpadding=\"3\"><tr><th>"._NAME."</th><th>"._TITLE."</th><th>"._STATUS."</th><th>"._ADMIN."</th></tr>"; + $x = 1; + $directory = opendir("blocks"); + while($filename = readdir($directory)) { + if($filename=="." || $filename==".." || !is_dir("blocks/".$filename)) continue; + $output .= "<tr><td class=\"tblborder\"><input type=\"hidden\" name=\"$x\" value=\"$filename\">$filename</td>"; + if(isset($blocks[$filename]['file'])) $output .= "<td class=\"tblborder\"><input name=\"{$x}_title\" type=\"text\" class=\"textbox\" value=\"".stripslashes($blocks[$filename]['title'])."\"><input name=\"{$x}_file\" type=\"hidden\" value=\"".$blocks[$filename]['file']."\"></td> + <td class=\"tblborder\"><select name=\"{$x}_status\"> + <option value=\"0\"".(!$blocks[$filename]['status'] ? " selected" : "").">"._INACTIVE."</option> + <option value=\"1\"".($blocks[$filename]['status'] == 1? " selected" : "").">"._ACTIVE."</option> + <option value=\"2\"".($blocks[$filename]['status'] == 2 ? " selected" : "").">"._INDEXONLY."</option> + </select></td> + <td class=\"tblborder\">".(file_exists("blocks/$filename/admin.php") ? "<a href=\"admin.php?action=blocks&admin=$filename\">"._OPTIONS."</a>" : _NONE); + else $output .= "<td class=\"tblborder\" colspan=\"3\" align=\"center\"><a href=\"admin.php?action=blocks&init=$filename\">"._INITIALIZE."</a>"; + $output .= "</td></tr>"; + $x++; + } + closedir($directory); + $output .= "</table><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>"; +} +// Now load the skin settings back in. + if(file_exists("$skindir/variables.php")) include("$skindir/variables.php"); ?>
--- a/admin/stories.php +++ b/admin/stories.php @@ -1,241 +1,241 @@ -<?php - -// ---------------------------------------------------------------------- -// eFiction 3.2 -// Copyright (c) 2007 by Tammy Keefer -// Valid HTML 4.01 Transitional -// Based on eFiction 1.1 -// Copyright (C) 2003 by Rebecca Smallwood. -// http://efiction.sourceforge.net/ -// ---------------------------------------------------------------------- -// LICENSE -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License (GPL) -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// To read the license please visit http://www.gnu.org/copyleft/gpl.html -// ---------------------------------------------------------------------- - -if(!defined("_CHARSET")) exit( ); -function featured( ) { - global $tableprefix; - - if($_GET['retire']) - mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']); - if($_GET['feature']) - mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']); - $fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured"; - $fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( )); - $output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>"; - if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>"; - while($story = mysql_fetch_array($fresult)) { - $output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>"; - } - $output .= "</table>"._FEATUREDNOTE; - return $output; -} -// end featured - -function submitted() -{ - global $tableprefix, $admincats, $allowed_tags; - $output .= "<center><h4>"._SUBMITTED."</h4></center>"; - $query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".$tableprefix."fanfiction_chapters as chapter, ".$tableprefix."fanfiction_authors as author) LEFT JOIN ".$tableprefix."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC"; - $result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( )); - $output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>"; - $array = explode(",", $admincats); - while ($story = mysql_fetch_assoc($result)) - { - unset($catstring); - $result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')"); - while($cats = mysql_fetch_array($result3)) { - $catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>"; - } - if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) { - $output .= "<tr class=\"tblborder\">"; - $output .= "<td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">".$story['storytitle']."</a>"; - if($story['title']) $output .= " <b>:</b> <a href=\"viewstory.php?sid=".$story['sid']."&chapter=".$story['inorder']."\">".$story['title']."</a>"; - $output .= "<td class=\"tblborder\"><a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td>"; - $output .= "<td class=\"tblborder\">".(is_array($catstring) ? implode(", ", $catstring) : "")."</td>"; - $output .= "<td class=\"tblborder\"><a href=\"admin.php?action=validate&chapid=".$story['chapid']."\">"._VALIDATE."</a> | "._DELETE.": <a href=\"stories.php?action=delete&chapid=".$story['chapid']."&sid=".$story['sid']."&admin=1&uid=".$story['uid']."\">"._CHAPTER."</a> "._OR." <a href=\"stories.php?action=delete&sid=".$story['sid']."&admin=1\">"._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._NOLETTER."</a></td></tr>"; - } - } - $output .= "</table>"; - - return $output; -} -// end submitted function - -function validate( ) { - global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson; - - $output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>"; - if($_GET['validate'] == "yes") { - $storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter, ".$tableprefix."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1"); - list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery); - if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) { - include("includes/emailer.php"); - if($validated != "1") { - mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'"); - $categories = explode(",", $catid); - include("functions.php"); - foreach($categories as $cat) { - categoryitems($cat, 1); - } - if($alertson) { - $subject = _NEWSTORYAT; - $mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid); - $favorites = mysql_query("SELECT author.uid, email, penname FROM ".$tableprefix."fanfiction_favauth as fav, ".$tableprefix."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid"); - while($favuser = mysql_fetch_array($favorites)) { - sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html"); - } - } - } - else if($alertson) { - $subject = _STORYALERT; - $mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder); - $favorites = mysql_query("SELECT author.uid, penname, email FROM ".$tableprefix."fanfiction_favstor as fav, ".$tableprefix."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid"); - while($favuser = mysql_fetch_array($favorites)) { - sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html"); - } - } - mysql_query("UPDATE ".$tableprefix."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'"); - mysql_query("UPDATE ".$tableprefix."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'"); - $output .= "<center><b>"._STORYVALIDATED."</b></center>"; - } - else - $output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN." "._TRYAGAIN."</center><br /><br />"; - } - else { - $result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid"); - $story = mysql_fetch_array($result); - $output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />"; - $output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title']; - $output .= "<br />"; - $result3 = mysql_query("SELECT catid, category FROM ".$tableprefix."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')"); - $catstring = ""; - $count = 0; - while($cats = mysql_fetch_array($result3)) { - if($count > 0) $catstring .= ", "; - $catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>"; - $categories[] = $cats['catid']; - $count++; - } - $output .= "<b>"._CATEGORY.":</b> $catstring<br />"; - - $output .= "<b>"._GENRES.":</b> ".(isset($story['gid']) ? preg_replace("/,/", ", ", $story['gid']) : _NONE); - $output .= "<br />"; - $output .= "<b>"._RATING.":</b> ".$story['rid']."<br />"; - if($story['wid'] != "") - { - $output .= "<b>"._WARNINGS.":</b> ".(isset($story['wid']) ? preg_replace("/,/", ", ", $story['wid']) : _NONE); - $output .= "<br />"; - } - $output .= "<b>"._CHARACTERS.":</b> ".$story['charid']; - $output .= "<br />"; - $output .= "<b>"._SUMMARY.":</b> ".$story['storysummary']."<br />"; - $output .= "<a href=\"admin.php?action=validate&sid=".$story['sid']."&chapid=".$story['chapid']."&validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editstory&sid=$story[sid]&admin=1\">"._EDIT." - "._STORY."</a> | <a href=\"stories.php?action=delete&sid=$story[sid]\">"._DELETE." - "._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=$story[uid]&chapid=$story[chapid]', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=$story[uid]&chapid=$story[chapid]',400, 300, 'yes')\">"._NOLETTER."</a><br />"; - if($store == "files") - { - $file = "$storiespath/".$story['uid']."/".$story['chapid'].".txt"; - $log_file = fopen($file, "r"); - $file_contents = fread($log_file, filesize($file)); - $storytext .= $file_contents; - fclose($log_file); - } - else if($store == "mysql") - { - $storytext .= $story['storytext']; - } - if(strpos($story, "<br>") === false && strpos($story, "<p>") === false && strpos($story, "<br />") === false) $storytext = nl2br($storytext); - $storytext = format_story($storytext, $allowed_tags); - $output .= $storytext; - $output .= "<br /><br />"; - $output .= "<a href=\"admin.php?action=validate&sid=".$story['sid']."&chapid=".$story['chapid']."&validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editchapter&chapid=".$story['chapid']."&admin=1\">"._EDIT." - "._CHAPTER."</a> | <a href=\"stories.php?action=delete&chapid=".$story['chapid']."&sid=".$story['sid']."&admin=1&uid=".$story['uid']."\">"._DELETE." - "._CHAPTER."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."',400, 300, 'yes')\">"._NOLETTER."</a><br />"; - } - return $output; -} -// end validate - -function yesletter( ) { - global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags; - - if($_POST['submit']) { - - if($adminemail) - $ademail = $adminemail; - else - $ademail = $siteemail; - $subject = stripinput($_POST['subject']); - $letter = nl2br(stripinput($_POST['letter'])); - - include("includes/emailer.php"); - $result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html"); - - if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>"; - else echo "<div style='text-align: center;'>"._ERROR."</div>"; - } - else { - $authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1"); - $author = mysql_fetch_array($authorquery); - $storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1"); - $story = mysql_fetch_array($storyquery); - $letter = file_get_contents("messages/thankyou.txt"); - echo "<body>"; - echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>"; - echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>"; - echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=yesletter\"> - <tr><td>To:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author['email']."\"></td></tr> - <tr><td>From:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr> - <tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr> - <tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>"; - } - exit( ); -} -// end yesletter - -function noletter( ) { - global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags, $adminloggedin; - if($_POST['submit']) - { - if($adminemail) - $ademail = $adminemail; - else - $ademail = $siteemail; - $subject = stripinput($_POST['subject']); - $letter = nl2br(stripinput($_POST['letter'])); - - include("includes/emailer.php"); - $result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html"); - - if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>"; - else echo "<div style='text-align: center;'>"._ERROR."</div>"; - } - else - { - $authorquery = mysql_query("SELECT email,penname FROM ".$tableprefix."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1"); - $author = mysql_fetch_array($authorquery); - $storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".$tableprefix."fanfiction_stories as story, ".$tableprefix."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1"); - $story = mysql_fetch_array($storyquery); - $letter = file_get_contents("messages/nothankyou.txt"); - echo "<body>"; - echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>"; - echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>"; - echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=noletter\"> - <tr><td>To:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author[email]."\"></td></tr> - <tr><td>From:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr> - <tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr> - <tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>"; - } - exit( ); -} -// end noletter - +<?php + +// ---------------------------------------------------------------------- +// eFiction 3.2 +// Copyright (c) 2007 by Tammy Keefer +// Valid HTML 4.01 Transitional +// Based on eFiction 1.1 +// Copyright (C) 2003 by Rebecca Smallwood. +// http://efiction.sourceforge.net/ +// ---------------------------------------------------------------------- +// LICENSE +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License (GPL) +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// To read the license please visit http://www.gnu.org/copyleft/gpl.html +// ---------------------------------------------------------------------- + +if(!defined("_CHARSET")) exit( ); +function featured( ) { + global $tableprefix; + + if($_GET['retire']) + mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']); + if($_GET['feature']) + mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']); + $fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured"; + $fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( )); + $output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>"; + if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>"; + while($story = mysql_fetch_array($fresult)) { + $output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>"; + } + $output .= "</table>"._FEATUREDNOTE; + return $output; +} +// end featured + +function submitted() +{ + global $tableprefix, $admincats, $allowed_tags; + $output .= "<center><h4>"._SUBMITTED."</h4></center>"; + $query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author) LEFT JOIN ".TABLEPREFIX."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC"; + $result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( )); + $output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>"; + $array = explode(",", $admincats); + while ($story = mysql_fetch_assoc($result)) + { + unset($catstring); + $result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')"); + while($cats = mysql_fetch_array($result3)) { + $catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>"; + } + if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) { + $output .= "<tr class=\"tblborder\">"; + $output .= "<td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">".$story['storytitle']."</a>"; + if($story['title']) $output .= " <b>:</b> <a href=\"viewstory.php?sid=".$story['sid']."&chapter=".$story['inorder']."\">".$story['title']."</a>"; + $output .= "<td class=\"tblborder\"><a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td>"; + $output .= "<td class=\"tblborder\">".(is_array($catstring) ? implode(", ", $catstring) : "")."</td>"; + $output .= "<td class=\"tblborder\"><a href=\"admin.php?action=validate&chapid=".$story['chapid']."\">"._VALIDATE."</a> | "._DELETE.": <a href=\"stories.php?action=delete&chapid=".$story['chapid']."&sid=".$story['sid']."&admin=1&uid=".$story['uid']."\">"._CHAPTER."</a> "._OR." <a href=\"stories.php?action=delete&sid=".$story['sid']."&admin=1\">"._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 500, 400, 'yes')\">"._NOLETTER."</a></td></tr>"; + } + } + $output .= "</table>"; + + return $output; +} +// end submitted function + +function validate( ) { + global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson; + + $output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>"; + if($_GET['validate'] == "yes") { + $storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1"); + list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery); + if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) { + include("includes/emailer.php"); + if($validated != "1") { + mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'"); + $categories = explode(",", $catid); + include("functions.php"); + foreach($categories as $cat) { + categoryitems($cat, 1); + } + if($alertson) { + $subject = _NEWSTORYAT; + $mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid); + $favorites = mysql_query("SELECT author.uid, email, penname FROM ".TABLEPREFIX."fanfiction_favauth as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid"); + while($favuser = mysql_fetch_array($favorites)) { + sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html"); + } + } + } + else if($alertson) { + $subject = _STORYALERT; + $mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder); + $favorites = mysql_query("SELECT author.uid, penname, email FROM ".TABLEPREFIX."fanfiction_favstor as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid"); + while($favuser = mysql_fetch_array($favorites)) { + sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html"); + } + } + mysql_query("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'"); + mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'"); + $output .= "<center><b>"._STORYVALIDATED."</b></center>"; + } + else + $output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN." "._TRYAGAIN."</center><br /><br />"; + } + else { + $result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid"); + $story = mysql_fetch_array($result); + $output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />"; + $output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title']; + $output .= "<br />"; + $result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')"); + $catstring = ""; + $count = 0; + while($cats = mysql_fetch_array($result3)) { + if($count > 0) $catstring .= ", "; + $catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>"; + $categories[] = $cats['catid']; + $count++; + } + $output .= "<b>"._CATEGORY.":</b> $catstring<br />"; + + $output .= "<b>"._GENRES.":</b> ".(isset($story['gid']) ? preg_replace("/,/", ", ", $story['gid']) : _NONE); + $output .= "<br />"; + $output .= "<b>"._RATING.":</b> ".$story['rid']."<br />"; + if($story['wid'] != "") + { + $output .= "<b>"._WARNINGS.":</b> ".(isset($story['wid']) ? preg_replace("/,/", ", ", $story['wid']) : _NONE); + $output .= "<br />"; + } + $output .= "<b>"._CHARACTERS.":</b> ".$story['charid']; + $output .= "<br />"; + $output .= "<b>"._SUMMARY.":</b> ".$story['storysummary']."<br />"; + $output .= "<a href=\"admin.php?action=validate&sid=".$story['sid']."&chapid=".$story['chapid']."&validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editstory&sid=$story[sid]&admin=1\">"._EDIT." - "._STORY."</a> | <a href=\"stories.php?action=delete&sid=$story[sid]\">"._DELETE." - "._STORY."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=$story[uid]&chapid=$story[chapid]', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=$story[uid]&chapid=$story[chapid]',400, 300, 'yes')\">"._NOLETTER."</a><br />"; + if($store == "files") + { + $file = "$storiespath/".$story['uid']."/".$story['chapid'].".txt"; + $log_file = fopen($file, "r"); + $file_contents = fread($log_file, filesize($file)); + $storytext .= $file_contents; + fclose($log_file); + } + else if($store == "mysql") + { + $storytext .= $story['storytext']; + } + if(strpos($story, "<br>") === false && strpos($story, "<p>") === false && strpos($story, "<br />") === false) $storytext = nl2br($storytext); + $storytext = format_story($storytext, $allowed_tags); + $output .= $storytext; + $output .= "<br /><br />"; + $output .= "<a href=\"admin.php?action=validate&sid=".$story['sid']."&chapid=".$story['chapid']."&validate=yes\">"._VALIDATE."</a> | <a href=\"stories.php?action=editchapter&chapid=".$story['chapid']."&admin=1\">"._EDIT." - "._CHAPTER."</a> | <a href=\"stories.php?action=delete&chapid=".$story['chapid']."&sid=".$story['sid']."&admin=1&uid=".$story['uid']."\">"._DELETE." - "._CHAPTER."</a> | <a href=\"javascript:pop('admin.php?action=yesletter&uid=".$story['uid']."&chapid=".$story['chapid']."', 400, 300, 'yes')\">"._YESLETTER."</a> | <a href=\"javascript:pop('admin.php?action=noletter&uid=".$story['uid']."&chapid=".$story['chapid']."',400, 300, 'yes')\">"._NOLETTER."</a><br />"; + } + return $output; +} +// end validate + +function yesletter( ) { + global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags; + + if($_POST['submit']) { + + if($adminemail) + $ademail = $adminemail; + else + $ademail = $siteemail; + $subject = stripinput($_POST['subject']); + $letter = nl2br(stripinput($_POST['letter'])); + + include("includes/emailer.php"); + $result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html"); + + if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>"; + else echo "<div style='text-align: center;'>"._ERROR."</div>"; + } + else { + $authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1"); + $author = mysql_fetch_array($authorquery); + $storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1"); + $story = mysql_fetch_array($storyquery); + $letter = file_get_contents("messages/thankyou.txt"); + echo "<body>"; + echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>"; + echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>"; + echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=yesletter\"> + <tr><td>To:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author['email']."\"></td></tr> + <tr><td>From:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr> + <tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr> + <tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>"; + } + exit( ); +} +// end yesletter + +function noletter( ) { + global $tableprefix, $level, $adminemail, $sitename, $siteemail, $allowed_tags, $adminloggedin; + if($_POST['submit']) + { + if($adminemail) + $ademail = $adminemail; + else + $ademail = $siteemail; + $subject = stripinput($_POST['subject']); + $letter = nl2br(stripinput($_POST['letter'])); + + include("includes/emailer.php"); + $result = sendemail($_POST['email'], $_POST['email'], $adminname, $ademail, $subject, $letter, "html"); + + if($result) echo "<div style='text-align: center;'>"._EMAILSENT."</div>"; + else echo "<div style='text-align: center;'>"._ERROR."</div>"; + } + else + { + $authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1"); + $author = mysql_fetch_array($authorquery); + $storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1"); + $story = mysql_fetch_array($storyquery); + $letter = file_get_contents("messages/nothankyou.txt"); + echo "<body>"; + echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>"; + echo "<tr><td>"._BY.":</td><td>".$author['penname']."</td></tr>"; + echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=noletter\"> + <tr><td>To:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$author[email]."\"></td></tr> + <tr><td>From:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"ademail\" value=\"$adminemail\"></td></tr> + <tr><td>Subject:</td><td><INPUT type=\"text\" class=\"textbox=\" name=\"subject\" value=\"Your Submission to $sitename\"></td></tr> + <tr><td colspan=\"2\"><textarea class=\"textbox\" name=\"letter\" cols=\"50\" rows=\"8\">$letter</TEXTAREA></td></tr><tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></td></tr></table></body></html>"; + } + exit( ); +} +// end noletter + ?>
--- a/blocks/categories/admin.php +++ b/blocks/categories/admin.php @@ -1,64 +1,67 @@ -<?php - -// ---------------------------------------------------------------------- -// eFiction 3.2 -// Copyright (c) 2007 by Tammy Keefer -// Valid HTML 4.01 Transitional -// Based on eFiction 1.1 -// Copyright (C) 2003 by Rebecca Smallwood. -// http://efiction.sourceforge.net/ -// ---------------------------------------------------------------------- -// LICENSE -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License (GPL) -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// To read the license please visit http://www.gnu.org/copyleft/gpl.html -// ---------------------------------------------------------------------- - -if(!defined("_CHARSET")) exit( ); - - - -global $language; -$content = ""; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'categories'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -if(empty($blocks['categories']['tpl'])) { - include("blocks/".$blocks['categories']['file']); - $tpl->gotoBlock("_ROOT"); -} -if(file_exists("blocks/categories/{$language}.php")) include("blocks/categories/{$language}.php"); -else include("blocks/categories/en.php"); - if(isset($_POST['submit'])) { - $blocks['categories']['columns'] = $_POST['columns']; - $blocks['categories']['template'] = $_POST['template']; - $output .= "<center>"._ACTIONSUCCESSFUL."</center>"; - save_blocks( $blocks ); - } - else { - $template = (!empty($blocks['categories']['template']) ? $blocks['categories']['template'] : "{image} {link} [{count}] {description}"); - if(empty($blocks['categories']['tpl'])) $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; - $output .= "<div><form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=categories\"> - <textarea name=\"template\" id=\"template\" rows=\"5\" cols=\"40\">$template</textarea><br />"; - if($tinyMCE) - $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\"><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; - $output .= "<select name=\"columns\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['columns']) ? " selected" : "").">"._ONECOLUMN."</option> - <option value=\"1\"".(!empty($blocks['categories']['columns']) ? " selected" : "").">"._MULTICOLUMN."</option></select> - <select name=\"tpl\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['tpl']) ? " selected" : "").">"._DEFAULT."</option> - <option value=\"1\"".(!empty($blocks['categories']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br /> - <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form><div style='clear: both;'> </div>".write_message(_CATBLOCKNOTE)."</div>"; - } +<?php + +// ---------------------------------------------------------------------- +// eFiction 3.2 +// Copyright (c) 2007 by Tammy Keefer +// Valid HTML 4.01 Transitional +// Based on eFiction 1.1 +// Copyright (C) 2003 by Rebecca Smallwood. +// http://efiction.sourceforge.net/ +// ---------------------------------------------------------------------- +// LICENSE +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License (GPL) +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// To read the license please visit http://www.gnu.org/copyleft/gpl.html +// ---------------------------------------------------------------------- + +if(!defined("_CHARSET")) exit( ); + + + +global $language; +$content = ""; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'categories'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +if(empty($blocks['categories']['tpl'])) { + include("blocks/".$blocks['categories']['file']); + $tpl->gotoBlock("_ROOT"); +} +if(file_exists("blocks/categories/{$language}.php")) include("blocks/categories/{$language}.php"); +else include("blocks/categories/en.php"); + if(isset($_POST['submit'])) { + $blocks['categories']['columns'] = $_POST['columns']; + $blocks['categories']['template'] = $_POST['template']; + $output .= "<center>"._ACTIONSUCCESSFUL."</center>"; + save_blocks( $blocks ); + } + else { + $template = (!empty($blocks['categories']['template']) ? $blocks['categories']['template'] : "{image} {link} [{count}] {description}"); + if(empty($blocks['categories']['tpl'])) $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; + $output .= "<div><form method=\"POST\" id=\"settingsform\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=categories\"> + <textarea name=\"template\" id=\"template\" rows=\"5\" cols=\"40\">$template</textarea><br />"; + if($tinyMCE) + $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\"><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; + $output .= "<select name=\"columns\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['columns']) ? " selected" : "").">"._ONECOLUMN."</option> + <option value=\"1\"".(!empty($blocks['categories']['columns']) ? " selected" : "").">"._MULTICOLUMN."</option></select> + <select name=\"tpl\" class=\"textbox\" style='margin: 3px;'><option value=\"0\"".(empty($blocks['categories']['tpl']) ? " selected" : "").">"._DEFAULT."</option> + <option value=\"1\"".(!empty($blocks['categories']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br /> + <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form><div style='clear: both;'> </div>".write_message(_CATBLOCKNOTE)."</div>"; + } ?>
--- a/blocks/countdown/admin.php +++ b/blocks/countdown/admin.php @@ -1,31 +1,34 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language, $numupdated; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'countdown'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -include("blocks/countdown/block.php"); - if(isset($_POST['submit'])) { - if(!empty($_POST['target'])) $blocks['countdown']['target'] = escapestring($_POST['target']); - else unset($blocks['countdown']['target']); - if(!empty($_POST['CDformat'])) $blocks['countdown']['CDformat'] = escapestring($_POST['CDformat']); - else unset($blocks['countdown']['CDformat']); - if(!empty($_POST['finish'])) $blocks['countdown']['CDfinal'] = escapestring($_POST['finish']); - else unset($blocks['countdown']['CDfinal']); - $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; - save_blocks( $blocks ); - } - else { - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".$content."</div><br /></div>"; - $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=countdown\"> - <div><label for=\"target\">"._TARGETDATE.":</label><input type=\"text\" class=\"textbox\" name=\"target\" id=\"target\" value=\"".(!empty($blocks['countdown']['target']) ? $blocks['countdown']['target'] : date("m/d/Y G:H"))."\"></div> - <div><label for=\"CDformat\">"._FORMATCOUNT.":</label><input type=\"text\" class=\"textbox\" name=\"CDformat\" id=\"CDformat\" size=\"40\" value=\"".(empty($blocks['countdown']['CDformat']) ? _COUNTDOWNFORMAT : $blocks['countdown']['CDformat'])."\"></div> - <div><label for=\"finish\">"._FINISHMESSAGE.":</label><input type=\"text\" class=\"textbox\" name=\"finish\" id=\"finish\" size=\"40\" value=\"".(empty($blocks['countdown']['finish']) ? _COUNTDOWNOVER : $blocks['countdown']['finish'])."\"></div> - <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._DATENOTE."</div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language, $numupdated; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'countdown'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +include("blocks/countdown/block.php"); + if(isset($_POST['submit'])) { + if(!empty($_POST['target'])) $blocks['countdown']['target'] = escapestring($_POST['target']); + else unset($blocks['countdown']['target']); + if(!empty($_POST['CDformat'])) $blocks['countdown']['CDformat'] = escapestring($_POST['CDformat']); + else unset($blocks['countdown']['CDformat']); + if(!empty($_POST['finish'])) $blocks['countdown']['CDfinal'] = escapestring($_POST['finish']); + else unset($blocks['countdown']['CDfinal']); + $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; + save_blocks( $blocks ); + } + else { + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".$content."</div><br /></div>"; + $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=countdown\"> + <div><label for=\"target\">"._TARGETDATE.":</label><input type=\"text\" class=\"textbox\" name=\"target\" id=\"target\" value=\"".(!empty($blocks['countdown']['target']) ? $blocks['countdown']['target'] : date("m/d/Y G:H"))."\"></div> + <div><label for=\"CDformat\">"._FORMATCOUNT.":</label><input type=\"text\" class=\"textbox\" name=\"CDformat\" id=\"CDformat\" size=\"40\" value=\"".(empty($blocks['countdown']['CDformat']) ? _COUNTDOWNFORMAT : $blocks['countdown']['CDformat'])."\"></div> + <div><label for=\"finish\">"._FINISHMESSAGE.":</label><input type=\"text\" class=\"textbox\" name=\"finish\" id=\"finish\" size=\"40\" value=\"".(empty($blocks['countdown']['finish']) ? _COUNTDOWNOVER : $blocks['countdown']['finish'])."\"></div> + <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._DATENOTE."</div>"; + } ?>
--- a/blocks/featured/admin.php +++ b/blocks/featured/admin.php @@ -1,33 +1,36 @@ -<?php -if(!defined("_CHARSET")) exit( ); -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'featured'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -include("blocks/".$blocks['featured']['file']); -if($use_tpl) $tpl->gotoBlock("_ROOT"); - if(isset($_POST['submit'])) { - if($_POST['tpl']) $blocks['featured']['tpl'] = 1; - else unset($blocks['featured']['tpl']); - if($_POST['allowtags']) $blocks['featured']['allowtags'] = 1; - else unset($blocks['featured']['allowtags']); - if($_POST['sumlength'] && isNumber($_POST['sumlength'])) $blocks['featured']['sumlength'] = $_POST['sumlength']; - else unset($blocks['featured']['sumlength']); - $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; - save_blocks( $blocks ); - unset($admin); - } - else { - $output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">".($use_tpl ? _NATPL : $content)."</div><br /></div>"; - $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=featured\"> - <label for=\"tpl\">"._FORMAT.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(!isset($blocks['featured']['tpl']) || !$blocks['featured']['tpl'] ? " selected" : "").">"._DEFAULT."</option> - <option value=\"1\"".(isset($blocks['featured']['tpl']) && $blocks['featured']['tpl'] ? " selected" : "").">"._USETPL."</option></select><br /> - <label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(!isset($blocks['featured']['allowtags']) || !$blocks['featured']['allowtags'] ? " selected" : "").">"._STRIPTAGS."</option> - <option value=\"1\"".(isset($blocks['featured']['allowtags']) && $blocks['featured']['allowtags'] ? " selected" : "").">"._ALLOWTAGS."</option></select><br /> - <label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(isset($blocks['featured']['sumlength']) ? $blocks['featured']['sumlength'] : "")."\"><br /> - <INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'featured'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +include("blocks/".$blocks['featured']['file']); +if($use_tpl) $tpl->gotoBlock("_ROOT"); + if(isset($_POST['submit'])) { + if($_POST['tpl']) $blocks['featured']['tpl'] = 1; + else unset($blocks['featured']['tpl']); + if($_POST['allowtags']) $blocks['featured']['allowtags'] = 1; + else unset($blocks['featured']['allowtags']); + if($_POST['sumlength'] && isNumber($_POST['sumlength'])) $blocks['featured']['sumlength'] = $_POST['sumlength']; + else unset($blocks['featured']['sumlength']); + $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; + save_blocks( $blocks ); + unset($admin); + } + else { + $output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">".($use_tpl ? _NATPL : $content)."</div><br /></div>"; + $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=featured\"> + <label for=\"tpl\">"._FORMAT.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(!isset($blocks['featured']['tpl']) || !$blocks['featured']['tpl'] ? " selected" : "").">"._DEFAULT."</option> + <option value=\"1\"".(isset($blocks['featured']['tpl']) && $blocks['featured']['tpl'] ? " selected" : "").">"._USETPL."</option></select><br /> + <label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(!isset($blocks['featured']['allowtags']) || !$blocks['featured']['allowtags'] ? " selected" : "").">"._STRIPTAGS."</option> + <option value=\"1\"".(isset($blocks['featured']['allowtags']) && $blocks['featured']['allowtags'] ? " selected" : "").">"._ALLOWTAGS."</option></select><br /> + <label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(isset($blocks['featured']['sumlength']) ? $blocks['featured']['sumlength'] : "")."\"><br /> + <INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; + } ?>
--- a/blocks/info/admin.php +++ b/blocks/info/admin.php @@ -1,35 +1,38 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'info'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -include("blocks/info/info.php"); -if(file_exists("blocks/info/{$language}.php")) include_once("blocks/info/{$language}.php"); -else include_once("blocks/info/en.php"); - if(isset($_POST['submit'])) { - $blocks['info']['style'] = !empty($_POST['style']) && isNumber($_POST['style']) ? $_POST['style'] : 0; - if($_POST['template'] != _NARTEXT) $blocks['info']['template'] = $_POST['template']; - $output .= "<center>"._ACTIONSUCCESSFUL."</center>"; - save_blocks( $blocks ); - } - else { - $style = isset($blocks['info']['style']) ? $blocks['info']['style'] : 0; - if(empty($blocks['info']['template']) && $style == 1) $template = _NARTEXT; - else if($style == 1) $template = $blocks['info']['template']; - else $template = ""; - $output .= "<div style='margin: 1em auto; width: 80%;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"text-align: left; padding: 4px; margin: 0 auto;\">$content</div><br />"; - $output .= "<form method='POST' enctype='multipart/form-data' name='blockadmin' action='admin.php?action=blocks&admin=info'> - <label for='template'>"._TEMPLATE.":</label><br /><textarea name='template' rows='5' cols='50' style='width: 100%;'>$template</textarea>"; - if($tinyMCE) $output .= "<div style='display: block; margin: 0; padding: 0;'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; - $output .= "<label for='style'>"._DISPLAY.": </label><select name='style'class='textbox' ><option value='0'".(!$style ? " selected" : "").">"._CHART."</option> - <option value='1'".($style == 1 ? " selected" : "").">"._NARRATIVE."</option> - <option value='2'".($style == 2 ? " selected" : "").">"._VARIABLES."</option></select><br /> - <INPUT type='submit' class='button' name='submit' value='"._SUBMIT."'></form></div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'info'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +include("blocks/info/info.php"); +if(file_exists("blocks/info/{$language}.php")) include_once("blocks/info/{$language}.php"); +else include_once("blocks/info/en.php"); + if(isset($_POST['submit'])) { + $blocks['info']['style'] = !empty($_POST['style']) && isNumber($_POST['style']) ? $_POST['style'] : 0; + if($_POST['template'] != _NARTEXT) $blocks['info']['template'] = $_POST['template']; + $output .= "<center>"._ACTIONSUCCESSFUL."</center>"; + save_blocks( $blocks ); + } + else { + $style = isset($blocks['info']['style']) ? $blocks['info']['style'] : 0; + if(empty($blocks['info']['template']) && $style == 1) $template = _NARTEXT; + else if($style == 1) $template = $blocks['info']['template']; + else $template = ""; + $output .= "<div style='margin: 1em auto; width: 80%;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"text-align: left; padding: 4px; margin: 0 auto;\">$content</div><br />"; + $output .= "<form method='POST' enctype='multipart/form-data' name='blockadmin' action='admin.php?action=blocks&admin=info'> + <label for='template'>"._TEMPLATE.":</label><br /><textarea name='template' rows='5' cols='50' style='width: 100%;'>$template</textarea>"; + if($tinyMCE) $output .= "<div style='display: block; margin: 0; padding: 0;'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; + $output .= "<label for='style'>"._DISPLAY.": </label><select name='style'class='textbox' ><option value='0'".(!$style ? " selected" : "").">"._CHART."</option> + <option value='1'".($style == 1 ? " selected" : "").">"._NARRATIVE."</option> + <option value='2'".($style == 2 ? " selected" : "").">"._VARIABLES."</option></select><br /> + <INPUT type='submit' class='button' name='submit' value='"._SUBMIT."'></form></div>"; + } ?>
--- a/blocks/login/admin.php +++ b/blocks/login/admin.php @@ -1,43 +1,46 @@ -<?php -if(!defined("_CHARSET")) exit( ); -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'login'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -global $language; -// Set $loggedin to 0 to see the block -include("blocks/login/login.php"); -// Then set it back to 1. -if(file_exists("blocks/login/$language.php")) include("blocks/login/$language.php"); -else include("blocks/login/en.php"); - if(isset($_POST['submit'])) { - $blocks['login']['acctlink'] = $_POST['acctlink']; - if(empty($_POST['form'])) unset($blocks['login']['form']); - else $blocks['login']['form'] = $_POST['form']; - $blocks['login']['template'] = addslashes(descript($_POST['template'])); - save_blocks( $blocks ); - unset($_GET['admin']); - $output .= write_message(_ACTIONSUCCESSFUL); - } - else { - if(empty($blocks['login']['template'])) $template = ""; - else $template = $blocks['login']['template']; - $output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">$content</div></div><br />"; - $output .= _LOGINNOTE."<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=login\"> - <div><label for=\"template\">"._TEMPLATE.":</label><span style='clear: left;'> </span></div> - <div class=\"shorttextarea\"><textarea name=\"template\" rows=\"5\" style=\"width: 100%;\" cols=\"40\">".stripslashes($template)."</textarea>"; - if($tinyMCE) - $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; - $output .= "</div> - <label for=\"form\">"._DEFAULTOPTS.":</label> <select name=\"form\" id=\"form\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['form']) ? " selected" : "").">"._SHORT."</option> - <option value=\"1\"".(!empty($blocks['login']['form']) ? " selected" : "").">"._LONG."</option> - </select><br /> - <label for=\"acctlink\">"._ACCTLINK."</label> <select name=\"acctlink\" id=\"acctlink\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['acctlink']) ? " selected" : "").">"._NO."</option> - <option value=\"1\"".(!empty($blocks['login']['acctlink']) ? " selected" : "").">"._YES."</option> - </select><br /> - <INPUT type=\"submit\" class=\"button\" id=\"submit\" name=\"submit\" value=\""._SUBMIT."\"></form></div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'login'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +global $language; +// Set $loggedin to 0 to see the block +include("blocks/login/login.php"); +// Then set it back to 1. +if(file_exists("blocks/login/$language.php")) include("blocks/login/$language.php"); +else include("blocks/login/en.php"); + if(isset($_POST['submit'])) { + $blocks['login']['acctlink'] = $_POST['acctlink']; + if(empty($_POST['form'])) unset($blocks['login']['form']); + else $blocks['login']['form'] = $_POST['form']; + $blocks['login']['template'] = addslashes(descript($_POST['template'])); + save_blocks( $blocks ); + unset($_GET['admin']); + $output .= write_message(_ACTIONSUCCESSFUL); + } + else { + if(empty($blocks['login']['template'])) $template = ""; + else $template = $blocks['login']['template']; + $output .= "<div style='text-align: center;'><span class='label'>"._CURRENT.":</span><br /><div class=\"tblborder\" style=\"width: 80%; text-align: left; margin: 1ex auto;\">$content</div></div><br />"; + $output .= _LOGINNOTE."<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=login\"> + <div><label for=\"template\">"._TEMPLATE.":</label><span style='clear: left;'> </span></div> + <div class=\"shorttextarea\"><textarea name=\"template\" rows=\"5\" style=\"width: 100%;\" cols=\"40\">".stripslashes($template)."</textarea>"; + if($tinyMCE) + $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('template');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; + $output .= "</div> + <label for=\"form\">"._DEFAULTOPTS.":</label> <select name=\"form\" id=\"form\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['form']) ? " selected" : "").">"._SHORT."</option> + <option value=\"1\"".(!empty($blocks['login']['form']) ? " selected" : "").">"._LONG."</option> + </select><br /> + <label for=\"acctlink\">"._ACCTLINK."</label> <select name=\"acctlink\" id=\"acctlink\" class=\"textbox\" ><option value=\"0\"".(empty($blocks['login']['acctlink']) ? " selected" : "").">"._NO."</option> + <option value=\"1\"".(!empty($blocks['login']['acctlink']) ? " selected" : "").">"._YES."</option> + </select><br /> + <INPUT type=\"submit\" class=\"button\" id=\"submit\" name=\"submit\" value=\""._SUBMIT."\"></form></div>"; + } ?>
--- a/blocks/menu/admin.php +++ b/blocks/menu/admin.php @@ -1,84 +1,87 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language, $pagelinks; -$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC"); -if(!isset($current)) $current = ""; - - $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'"); - while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; - } - $content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array(); - -while($link = dbassoc($linkquery)) { - $tpl->assignGlobal($link['link_name'], "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>"); - $pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>"); -} -include("blocks/".$blocks[$admin]['file']); -if(file_exists("blocks/menu/{$language}.php")) include("blocks/menu/{$language}.php"); -else include("blocks/menu/en.php"); - if(isset($_GET['up'])) { - $pos = array_search($_GET['up'], $blocks[$admin]['content']); - if($pos >= 1) { - $blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos - 1]; - $blocks[$admin]['content'][$pos - 1] = $_GET['up']; - $blocks[$admin]['content'] = $blocks[$admin]['content']; - save_blocks( $blocks ); - } - } - if(isset($_GET['down'])) { - $pos = array_search($_GET['down'], $blocks[$admin]['content']); - if($pos <= count($blocks[$admin]['content'])) { - $blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos + 1]; - $blocks[$admin]['content'][$pos + 1] = $_GET['down']; - $blocks[$admin]['content'] = $blocks[$admin]['content']; - save_blocks( $blocks ); - } - } - if(isset($_POST['submit'])) { - $newcontent = array( ); - for($x = 0; $x <= count($pagelinks); $x++) { - if(isset($_POST["content_$x"])) $newcontent[] = $_POST["content_$x"]; - } - $blocks[$admin]['content'] = $newcontent; - $blocks[$admin]['style'] = isset($_POST['style']) && !empty($_POST['style']) ? 1 : 0; - save_blocks( $blocks ); - } - if($admin){ - $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'"); - while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; - } - $content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array(); - $output .= "<div style=\"width: 300px; margin: 0 auto;\"><form method=\"POST\" enctype=\"multipart/form-data\"action=\"admin.php?action=blocks&admin=$admin\"> - <table class=\"tblborder\" width=\"100%\"><tr><th>"._TITLE."</th><th colspan=\"2\">"._MOVE."</th></tr>"; - $count = 1; - if(is_array($content)) { - foreach($content as $link) { - $output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" checked name=\"content_$count\" value=\"$link\">".$pagelinks["$link"]['link']."</td> - <td class='tblborder' width=\"15\">".($count > 1 ? "<a href=\"admin.php?action=blocks&admin=$admin&up=$link\"><img src=\"images/arrowup.gif\" width=\"13\" height=\"18\" alt=\""._UP."\" title=\""._UP."\" border=\"0\"></a>" : "")."</td> - <td class='tblborder' width=\"15\">".($count < sizeof($blocks[$admin]['content']) ? "<a href=\"admin.php?action=blocks&admin=$admin&down=$link\"><img src=\"images/arrowdown.gif\" width=\"13\" height=\"18\" alt=\""._DOWN."\" title=\""._DOWN."\" border=\"0\"></a>" : "")."</td></tr>"; - $count++; - } - } - foreach($pagelinks as $page => $link) { - if(!is_array($content) || !in_array($page, $content)) { - $output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" name=\"content_$count\" value=\"$page\">".$link['link']."</td> - <td class='tblborder' colspan=\"2\"> </td></tr>"; - $count++; - } - } - $output .= "</table><br /><div style=\"text-align: center;\"> - <label for=\"style\">"._STYLE.":</label> <SELECT name=\"style\" id=\"style\"> - <option value=\"1\"".(!empty($blocks["menu"]['style']) ? " selected" : "").">"._NOLIST."</option> - <option value=\"0\"".(empty($blocks['menu']['style']) ? " selected" : "").">"._LISTFORMAT."</option> - </select><br /><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language, $pagelinks; +$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC"); +if(!isset($current)) $current = ""; + + $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'"); + while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; + } + $content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array(); + +while($link = dbassoc($linkquery)) { + $tpl->assignGlobal($link['link_name'], "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>"); + $pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\""._BASEDIR.$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>"); +} +include("blocks/".$blocks[$admin]['file']); +if(file_exists("blocks/menu/{$language}.php")) include("blocks/menu/{$language}.php"); +else include("blocks/menu/en.php"); + if(isset($_GET['up'])) { + $pos = array_search($_GET['up'], $blocks[$admin]['content']); + if($pos >= 1) { + $blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos - 1]; + $blocks[$admin]['content'][$pos - 1] = $_GET['up']; + $blocks[$admin]['content'] = $blocks[$admin]['content']; + save_blocks( $blocks ); + } + } + if(isset($_GET['down'])) { + $pos = array_search($_GET['down'], $blocks[$admin]['content']); + if($pos <= count($blocks[$admin]['content'])) { + $blocks[$admin]['content'][$pos] = $blocks[$admin]['content'][$pos + 1]; + $blocks[$admin]['content'][$pos + 1] = $_GET['down']; + $blocks[$admin]['content'] = $blocks[$admin]['content']; + save_blocks( $blocks ); + } + } + if(isset($_POST['submit'])) { + $newcontent = array( ); + for($x = 0; $x <= count($pagelinks); $x++) { + if(isset($_POST["content_$x"])) $newcontent[] = $_POST["content_$x"]; + } + $blocks[$admin]['content'] = $newcontent; + $blocks[$admin]['style'] = isset($_POST['style']) && !empty($_POST['style']) ? 1 : 0; + save_blocks( $blocks ); + } + if($admin){ + $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = '$admin'"); + while($block = dbassoc($blockquery)) { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; + } + $content = isset($blocks[$admin]['content']) ? $blocks[$admin]['content'] : array(); + $output .= "<div style=\"width: 300px; margin: 0 auto;\"><form method=\"POST\" enctype=\"multipart/form-data\"action=\"admin.php?action=blocks&admin=$admin\"> + <table class=\"tblborder\" width=\"100%\"><tr><th>"._TITLE."</th><th colspan=\"2\">"._MOVE."</th></tr>"; + $count = 1; + if(is_array($content)) { + foreach($content as $link) { + $output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" checked name=\"content_$count\" value=\"$link\">".$pagelinks["$link"]['link']."</td> + <td class='tblborder' width=\"15\">".($count > 1 ? "<a href=\"admin.php?action=blocks&admin=$admin&up=$link\"><img src=\"images/arrowup.gif\" width=\"13\" height=\"18\" alt=\""._UP."\" title=\""._UP."\" border=\"0\"></a>" : "")."</td> + <td class='tblborder' width=\"15\">".($count < sizeof($blocks[$admin]['content']) ? "<a href=\"admin.php?action=blocks&admin=$admin&down=$link\"><img src=\"images/arrowdown.gif\" width=\"13\" height=\"18\" alt=\""._DOWN."\" title=\""._DOWN."\" border=\"0\"></a>" : "")."</td></tr>"; + $count++; + } + } + foreach($pagelinks as $page => $link) { + if(!is_array($content) || !in_array($page, $content)) { + $output .= "<tr><td class='tblborder'><input type=\"checkbox\" class=\"checkbox\" name=\"content_$count\" value=\"$page\">".$link['link']."</td> + <td class='tblborder' colspan=\"2\"> </td></tr>"; + $count++; + } + } + $output .= "</table><br /><div style=\"text-align: center;\"> + <label for=\"style\">"._STYLE.":</label> <SELECT name=\"style\" id=\"style\"> + <option value=\"1\"".(!empty($blocks["menu"]['style']) ? " selected" : "").">"._NOLIST."</option> + <option value=\"0\"".(empty($blocks['menu']['style']) ? " selected" : "").">"._LISTFORMAT."</option> + </select><br /><br /><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></div>"; + } ?>
--- a/blocks/news/admin.php +++ b/blocks/news/admin.php @@ -1,28 +1,31 @@ -<?php -if(!defined("_CHARSET")) exit( ); -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'news'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -global $language, $numupdated; -include("blocks/".$blocks['news']['file']); - if(isset($_POST['submit'])) { - if(isset($_POST['num']) && isNumber($_POST['num'])) $blocks['news']['num'] = $_POST['num']; - else $blocks['news']['num'] = 1; - if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['news']['sumlength'] = $_POST['sumlength']; - else unset($blocks['news']['sumlength']); - $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; - save_blocks( $blocks ); - } - else { - if(!isset($blocks['news']['sumlength'])) $blocks['news']['sumlength'] = ""; - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; - $output .= "<div><div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=news\"> - <div><label for=\"num\">"._NUMNEWS.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['news']['num']."\"></div> - <div><label for=\"num\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"6\" value=\"".$blocks['news']['sumlength']."\"></div> - <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='clear: both;'></div></div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'news'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +global $language, $numupdated; +include("blocks/".$blocks['news']['file']); + if(isset($_POST['submit'])) { + if(isset($_POST['num']) && isNumber($_POST['num'])) $blocks['news']['num'] = $_POST['num']; + else $blocks['news']['num'] = 1; + if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['news']['sumlength'] = $_POST['sumlength']; + else unset($blocks['news']['sumlength']); + $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; + save_blocks( $blocks ); + } + else { + if(!isset($blocks['news']['sumlength'])) $blocks['news']['sumlength'] = ""; + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; + $output .= "<div><div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=news\"> + <div><label for=\"num\">"._NUMNEWS.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['news']['num']."\"></div> + <div><label for=\"num\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"6\" value=\"".$blocks['news']['sumlength']."\"></div> + <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='clear: both;'></div></div>"; + } ?>
--- a/blocks/poll/admin.php +++ b/blocks/poll/admin.php @@ -1,61 +1,64 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language, $tinyMCE, $allowed_tags; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'poll'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -include("blocks/".$blocks['poll']['file']); - if(isset($_GET['delete']) && isNumber($_GET['delete'])) { - $delete = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_id = '$_GET[delete]' LIMIT 1"); - if($delete) $output .= write_message(_ACTIONSUCCESSFUL); - } - if(isset($_POST['close_current'])) { - $final = ""; - foreach($pollopts as $num => $opt) { - if(strlen($final) > 0) $final .= "#"; - $n = $num + 1; - $final .= (isset($results[$n]) ? $results[$n] : "0"); - } - $closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = NOW( ) WHERE poll_id = '".$currentpoll['poll_id']."'"); - if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`"); - $output .= write_message(_ACTIONSUCCESSFUL); - } - if(isset($_POST['submit'])) { - $poll_question = escapestring(descript(stripslashes($_POST['poll_question']))); - $opts = explode("\r\n", ltrim(strip_tags(preg_replace( '!<p>!iU', "\r\n", stripslashes(trim($_POST['poll_opts']))), preg_replace("!<p>!iu", "", $allowed_tags)))); - $new_opts = array( ); - foreach($opts as $opt) { - if(strlen(trim(preg_replace("! !", " ", $opt))) > 0) $new_opts[] = $opt; - } - $new_opts = escapestring(implode("|#|", $new_opts)); - $newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', NOW( ))"); - include("blocks/".$blocks['poll']['file']); - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; - } - if($currentpoll && !isset($_POST['close_current'])) { - include("blocks/".$blocks['poll']['file']); - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; - $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\" style='text-align: center;'><INPUT type=\"submit\" class=\"button\" name=\"close_current\" value=\""._CLOSEPOLL."\"></form>"; - } - else { - $output .= "<div style='width: 400px; margin: 1em auto; text-align: center;'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\"> - <label for=\"poll_question\">"._POLLQUESTION."</label><textarea name='poll_question' cols='40' id='poll_question' rows='5'></textarea><br />"; - if($tinyMCE) - $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('poll_question');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; - $output .= "<label for=\"poll_opts\">"._POLLOPTS."</label><textarea name='poll_opts' id='poll_opts' class='mceNoEditor' cols='40' rows='5'></textarea><br />"; - $output .= "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></div>"; - } - $oldpolls = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC"); - if(dbnumrows($oldpolls)) { - $output .= "<table class='tblborder' style='width: 400px; margin: 1em auto; text-align: center;'><tr><th>"._POLLQUESTION."</th><th>"._OPTIONS."</th></tr>"; - while($poll = dbassoc($oldpolls)) { - $output .= "<tr><td class='tblborder'>".stripslashes($poll['poll_question'])."</td><td class='tblborder'><a href='admin.php?action=blocks&admin=poll&delete=".$poll['poll_id']."'>"._DELETE."</a></td></tr>"; - } - $output .= "</table><br />"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language, $tinyMCE, $allowed_tags; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'poll'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +include("blocks/".$blocks['poll']['file']); + if(isset($_GET['delete']) && isNumber($_GET['delete'])) { + $delete = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_id = '$_GET[delete]' LIMIT 1"); + if($delete) $output .= write_message(_ACTIONSUCCESSFUL); + } + if(isset($_POST['close_current'])) { + $final = ""; + foreach($pollopts as $num => $opt) { + if(strlen($final) > 0) $final .= "#"; + $n = $num + 1; + $final .= (isset($results[$n]) ? $results[$n] : "0"); + } + $closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = NOW( ) WHERE poll_id = '".$currentpoll['poll_id']."'"); + if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`"); + $output .= write_message(_ACTIONSUCCESSFUL); + } + if(isset($_POST['submit'])) { + $poll_question = escapestring(descript(stripslashes($_POST['poll_question']))); + $opts = explode("\r\n", ltrim(strip_tags(preg_replace( '!<p>!iU', "\r\n", stripslashes(trim($_POST['poll_opts']))), preg_replace("!<p>!iu", "", $allowed_tags)))); + $new_opts = array( ); + foreach($opts as $opt) { + if(strlen(trim(preg_replace("! !", " ", $opt))) > 0) $new_opts[] = $opt; + } + $new_opts = escapestring(implode("|#|", $new_opts)); + $newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', NOW( ))"); + include("blocks/".$blocks['poll']['file']); + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; + } + if($currentpoll && !isset($_POST['close_current'])) { + include("blocks/".$blocks['poll']['file']); + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>"; + $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\" style='text-align: center;'><INPUT type=\"submit\" class=\"button\" name=\"close_current\" value=\""._CLOSEPOLL."\"></form>"; + } + else { + $output .= "<div style='width: 400px; margin: 1em auto; text-align: center;'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=poll\"> + <label for=\"poll_question\">"._POLLQUESTION."</label><textarea name='poll_question' cols='40' id='poll_question' rows='5'></textarea><br />"; + if($tinyMCE) + $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('poll_question');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>"; + $output .= "<label for=\"poll_opts\">"._POLLOPTS."</label><textarea name='poll_opts' id='poll_opts' class='mceNoEditor' cols='40' rows='5'></textarea><br />"; + $output .= "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form></div>"; + } + $oldpolls = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC"); + if(dbnumrows($oldpolls)) { + $output .= "<table class='tblborder' style='width: 400px; margin: 1em auto; text-align: center;'><tr><th>"._POLLQUESTION."</th><th>"._OPTIONS."</th></tr>"; + while($poll = dbassoc($oldpolls)) { + $output .= "<tr><td class='tblborder'>".stripslashes($poll['poll_question'])."</td><td class='tblborder'><a href='admin.php?action=blocks&admin=poll&delete=".$poll['poll_id']."'>"._DELETE."</a></td></tr>"; + } + $output .= "</table><br />"; + } ?>
--- a/blocks/random/admin.php +++ b/blocks/random/admin.php @@ -1,34 +1,37 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'random'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -include("blocks/".$blocks['random']['file']); -if(!empty($blocks['random']['tpl'])) $tpl->gotoBlock("_ROOT"); - if(isset($_POST['submit'])) { - if($_POST['tpl']) $blocks['random']['tpl'] = 1; - else unset($blocks['random']['tpl']); - if($_POST['allowtags']) $blocks['random']['allowtags'] = 1; - else unset($blocks['random']['allowtags']); - if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['random']['sumlength'] = $_POST['sumlength']; - else unset($blocks['random']['sumlength']); - $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; - save_blocks( $blocks ); - } - else { - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 1ex auto; text-align: left;\">".(!empty($blocks['random']['tpl']) ? _NATPL : $content)."</div><br /></div>"; - $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=random\"> - <label for=\"tpl\">"._BLOCKTYPE.":</label><select class=\"textbox\" name=\"tpl\" id=\"tpl\"><option value=\"0\"".(empty($blocks['random']['tpl']) ? " selected" : "").">"._DEFAULT."</option> - <option value=\"1\"".(!empty($blocks['random']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br /> - <label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['random']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option> - <option value=\"1\"".(!empty($blocks['random']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select><br /> - <label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['random']['sumlength']) ? $blocks['random']['sumlength'] : "")."\"><br /> - <INPUT type=\"submit\" name=\"submit\" id=\"submit\" class=\"button\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'random'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +include("blocks/".$blocks['random']['file']); +if(!empty($blocks['random']['tpl'])) $tpl->gotoBlock("_ROOT"); + if(isset($_POST['submit'])) { + if($_POST['tpl']) $blocks['random']['tpl'] = 1; + else unset($blocks['random']['tpl']); + if($_POST['allowtags']) $blocks['random']['allowtags'] = 1; + else unset($blocks['random']['allowtags']); + if(isset($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['random']['sumlength'] = $_POST['sumlength']; + else unset($blocks['random']['sumlength']); + $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; + save_blocks( $blocks ); + } + else { + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 1ex auto; text-align: left;\">".(!empty($blocks['random']['tpl']) ? _NATPL : $content)."</div><br /></div>"; + $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=random\"> + <label for=\"tpl\">"._BLOCKTYPE.":</label><select class=\"textbox\" name=\"tpl\" id=\"tpl\"><option value=\"0\"".(empty($blocks['random']['tpl']) ? " selected" : "").">"._DEFAULT."</option> + <option value=\"1\"".(!empty($blocks['random']['tpl']) ? " selected" : "").">"._USETPL."</option></select><br /> + <label for=\"allowtags\">"._TAGS.":</label><select class=\"textbox\" name=\"allowtags\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['random']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option> + <option value=\"1\"".(!empty($blocks['random']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select><br /> + <label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['random']['sumlength']) ? $blocks['random']['sumlength'] : "")."\"><br /> + <INPUT type=\"submit\" name=\"submit\" id=\"submit\" class=\"button\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; + } ?>
--- a/blocks/recent/admin.php +++ b/blocks/recent/admin.php @@ -1,38 +1,41 @@ -<?php -if(!defined("_CHARSET")) exit( ); - -global $language, $numupdated; -$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'recent'"); -while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); - $blocks[$block['block_name']]['title'] = $block['block_title']; - $blocks[$block['block_name']]['file'] = $block['block_file']; - $blocks[$block['block_name']]['status'] = $block['block_status']; -} -if(empty($blocks['recent']['tpl'])) include("blocks/".$blocks['recent']['file']); -if(file_exists("blocks/recent/".$language.".php")) include("blocks/recent/".$language.".php"); -else include("blocks/recent/en.php"); - if(isset($_POST['submit'])) { - if(!empty($_POST['tpl'])) $blocks['recent']['tpl'] = 1; - else unset($blocks['recent']['tpl']); - if(!empty($_POST['allowtags'])) $blocks['recent']['allowtags'] = 1; - else unset($blocks['recent']['allowtags']); - if(!empty($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['recent']['sumlength'] = $_POST['sumlength']; - else unset($blocks['recent']['sumlength']); - if(!empty($_POST['num']) && isNumber($_POST['num'])) $blocks['recent']['num'] = $_POST['num']; - else $blocks['recent']['num'] = 1; - $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; - save_blocks( $blocks ); - } - else { - $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".(!empty($blocks['recent']['tpl']) ? _NATPL : $content)."</div><br /></div>"; - $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=recent\"> - <div><label for=\"tpl\">"._BLOCKTYPE.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(empty($blocks['recent']['tpl']) ? " selected" : "").">"._DEFAULT."</option> - <option value=\"1\"".(!empty($blocks['recent']['tpl']) ? " selected" : "").">"._USETPL."</option></select></div> - <div><label for=\"allowtags\">"._TAGS.":</label><select name=\"allowtags\" class=\"textbox\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['recent']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option> - <option value=\"1\"".(!empty($blocks['recent']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select></div> - <div><label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['recent']['sumlength']) ? $blocks['recent']['sumlength'] : "")."\"></div> - <div><label for=\"num\">"._NUMUPDATED.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['recent']['num']."\"></div> - <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; - } +<?php +if(!defined("_CHARSET")) exit( ); + +global $language, $numupdated; +$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks WHERE block_name = 'recent'"); +while($block = dbassoc($blockquery)) { + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } + $blocks[$block['block_name']]['title'] = $block['block_title']; + $blocks[$block['block_name']]['file'] = $block['block_file']; + $blocks[$block['block_name']]['status'] = $block['block_status']; +} +if(empty($blocks['recent']['tpl'])) include("blocks/".$blocks['recent']['file']); +if(file_exists("blocks/recent/".$language.".php")) include("blocks/recent/".$language.".php"); +else include("blocks/recent/en.php"); + if(isset($_POST['submit'])) { + if(!empty($_POST['tpl'])) $blocks['recent']['tpl'] = 1; + else unset($blocks['recent']['tpl']); + if(!empty($_POST['allowtags'])) $blocks['recent']['allowtags'] = 1; + else unset($blocks['recent']['allowtags']); + if(!empty($_POST['sumlength']) && isNumber($_POST['sumlength'])) $blocks['recent']['sumlength'] = $_POST['sumlength']; + else unset($blocks['recent']['sumlength']); + if(!empty($_POST['num']) && isNumber($_POST['num'])) $blocks['recent']['num'] = $_POST['num']; + else $blocks['recent']['num'] = 1; + $output .= "<div style='text-align: center;'>"._ACTIONSUCCESSFUL."</div>"; + save_blocks( $blocks ); + } + else { + $output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 80%; margin: 0 auto; text-align: left;\">".(!empty($blocks['recent']['tpl']) ? _NATPL : $content)."</div><br /></div>"; + $output .= "<div id='settingsform'><form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=blocks&admin=recent\"> + <div><label for=\"tpl\">"._BLOCKTYPE.":</label><select name=\"tpl\" class=\"textbox\" id=\"tpl\"><option value=\"0\"".(empty($blocks['recent']['tpl']) ? " selected" : "").">"._DEFAULT."</option> + <option value=\"1\"".(!empty($blocks['recent']['tpl']) ? " selected" : "").">"._USETPL."</option></select></div> + <div><label for=\"allowtags\">"._TAGS.":</label><select name=\"allowtags\" class=\"textbox\" id=\"allowtags\"><option value=\"0\"".(empty($blocks['recent']['allowtags']) ? " selected" : "").">"._STRIPTAGS."</option> + <option value=\"1\"".(!empty($blocks['recent']['allowtags']) ? " selected" : "").">"._ALLOWTAGS."</option></select></div> + <div><label for=\"sumlength\">"._SUMLENGTH.":</label><input type=\"text\" class=\"textbox\" name=\"sumlength\" id=\"sumlength\" size=\"4\" value=\"".(!empty($blocks['recent']['sumlength']) ? $blocks['recent']['sumlength'] : "")."\"></div> + <div><label for=\"num\">"._NUMUPDATED.":</label><input type=\"text\" class=\"textbox\" name=\"num\" id=\"num\" size=\"4\" value=\"".$blocks['recent']['num']."\"></div> + <INPUT type=\"submit\" name=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\"></form></div><div style='text-align: center;'>"._SUMNOTE."</div>"; + } ?>
--- a/header.php +++ b/header.php @@ -81,6 +81,7 @@ define("STORIESPATH", $settings['storiespath']); unset($settings['storiespath']); foreach($settings as $var => $val) { + if (is_NULL($val)) $val = ''; $$var = stripslashes($val); $settings[$var] = htmlspecialchars($val); } @@ -158,7 +159,10 @@ $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks"); while($block = dbassoc($blockquery)) { - $blocks[$block['block_name']] = unserialize($block['block_variables']); + if ($block['block_variables']) + { + $blocks[$block['block_name']] = unserialize($block['block_variables']); + } $blocks[$block['block_name']]['title'] = $block['block_title']; $blocks[$block['block_name']]['file'] = $block['block_file']; $blocks[$block['block_name']]['status'] = $block['block_status']; @@ -215,11 +219,7 @@ echo "<title>$titleinfo</title>"; // ---------- Favicon --------- -if (file_exists($skindir."/images/favicon.ico")) -{ - echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n"; -} -elseif (file_exists(_BASEDIR."favicon.ico")) +if (file_exists(_BASEDIR."favicon.ico")) { echo "<link rel='icon' href='"._BASEDIR."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='"._BASEDIR."favicon.ico' type='image/xicon' />\n"; }