| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,60 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 4 |
+// Valid HTML 4.01 Transitional |
|
| 5 |
+// Based on eFiction 1.1 |
|
| 6 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 7 |
+// http://efiction.sourceforge.net/ |
|
| 8 |
+// ---------------------------------------------------------------------- |
|
| 9 |
+// LICENSE |
|
| 10 |
+// |
|
| 11 |
+// This program is free software; you can redistribute it and/or |
|
| 12 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 13 |
+// as published by the Free Software Foundation; either version 2 |
|
| 14 |
+// of the License, or (at your option) any later version. |
|
| 15 |
+// |
|
| 16 |
+// This program is distributed in the hope that it will be useful, |
|
| 17 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 |
+// GNU General Public License for more details. |
|
| 20 |
+// |
|
| 21 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 22 |
+// ---------------------------------------------------------------------- |
|
| 23 |
+$current = "challenges"; |
|
| 24 |
+if(isset($_GET['action']) && ($_GET['action'] == "add" || $_GET['action'] == "edit")) $displayform = 1; |
|
| 25 |
+ |
|
| 26 |
+if(file_exists(_BASEDIR."languages/{$language}_admin.php")) include_once(_BASEDIR."languages/{$language}_admin.php");
|
|
| 27 |
+else include_once(_BASEDIR."languages/en_admin.php"); |
|
| 28 |
+if(file_exists(_BASEDIR."modules/challenges/languages/{$language}.php")) include_once(_BASEDIR."modules/challenges/languages/{$language}.php");
|
|
| 29 |
+else include_once(_BASEDIR."modules/challenges/languages/en.php"); |
|
| 30 |
+$output = "<div id='pagetitle'>"._CHALLENGEADMIN."</div>"; |
|
| 31 |
+if(!isADMIN) accessDenied( ); |
|
| 32 |
+if(isset($_GET['task']) && $_GET['task'] == "recalc") {
|
|
| 33 |
+ $challenges = dbquery("SELECT chalid, characters FROM ".TABLEPREFIX."fanfiction_challenges");
|
|
| 34 |
+ while($c = dbassoc($challenges)) {
|
|
| 35 |
+ unset($newchars, $count, $count1, $count2); |
|
| 36 |
+ $stories = dbquery("SELECT COUNT(sid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE FIND_IN_SET('".$c['chalid']."', challenges) > 0");
|
|
| 37 |
+ list($count1) = dbrow($stories); |
|
| 38 |
+ $series = dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series WHERE FIND_IN_SET('".$c['chalid']."', challenges) > 0");
|
|
| 39 |
+ list($count2) = dbrow($series); |
|
| 40 |
+ $count = $count1 + $count2; |
|
| 41 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_challenges SET responses = '$count' WHERE chalid = $c[chalid]");
|
|
| 42 |
+ } |
|
| 43 |
+ $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 44 |
+} |
|
| 45 |
+if(isset($_POST['submit'])) {
|
|
| 46 |
+ $anonchallenges = $_POST['anonchallenges'] == 1 ? 1 : 0; |
|
| 47 |
+ $result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET anonchallenges = '$anonchallenges' WHERE sitekey = '".SITEKEY."'");
|
|
| 48 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 49 |
+ else $output .= write_error(_ERROR); |
|
| 50 |
+} |
|
| 51 |
+else {
|
|
| 52 |
+ $output .= "<div id=\"settingsform\"><form method=\"POST\" style=\"margin: 1em auto;\" enctype=\"multipart/form-data\" action=\"admin.php?action=modules&admin=true&module=challenges\">"; |
|
| 53 |
+ $output .= "<label for=\"anonchallenges\">"._ANONCHALLENGES.": </label><select name=\"anonchallenges\"> |
|
| 54 |
+ <option value=\"1\"".($anonchallenges == "1" ? " selected" : "").">"._YES."</option> |
|
| 55 |
+ <option value=\"0\"".($anonchallenges == "0" ? " selected" : "").">"._NO."</option> |
|
| 56 |
+ </select><br />"; |
|
| 57 |
+ $output .= "<div id='submitdiv'><INPUT type=\"submit\" id=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form></form></div>"; |
|
| 58 |
+ $output .= write_message("<a href='admin.php?action=modules&admin=true&module=challenges&task=recalc'>"._RECALCCHAL."</a>");
|
|
| 59 |
+} |
|
| 60 |
+?> |