|
...
|
...
|
@@ -47,7 +47,7 @@ if(isset($_GET['chalid']) && !$chalid) { unset($chalid); $action = false; }
|
|
47
|
47
|
$challenge = dbquery("SELECT uid, catid from ".TABLEPREFIX."fanfiction_challenges WHERE chalid='$chalid' LIMIT 1");
|
|
48
|
48
|
list($chaluid, $catid) = dbrow($challenge);
|
|
49
|
49
|
if(uLEVEL == 3 && $admincats != 0) {
|
|
50
|
|
- $seriescats = explode(",", $catid ?? "");
|
|
|
50
|
+ $seriescats = explode(",", (isset($catid) ? $catid : ""));
|
|
51
|
51
|
$adcats = explode(",", $admincats);
|
|
52
|
52
|
foreach($seriescats as $cat) {
|
|
53
|
53
|
if(in_array($cat, $adcats)) $admin = 1;
|
|
...
|
...
|
@@ -83,13 +83,13 @@ if($action == "remove") {
|
|
83
|
83
|
if(isset($seriesid)) {
|
|
84
|
84
|
$chalinfo =dbquery("SELECT challenges FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$seriesid'");
|
|
85
|
85
|
list($challenges) = dbrow($chalinfo);
|
|
86
|
|
- $challenges = explode(",", $challenges ?? "");
|
|
|
86
|
+ $challenges = explode(",", (isset($challenges) ? $challenges : ""));
|
|
87
|
87
|
$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET challenges = '".implode(",", array_diff($challenges, array((string)$chalid)))."' WHERE seriesid = '".(int)$seriesid."'");
|
|
88
|
88
|
}
|
|
89
|
89
|
else {
|
|
90
|
90
|
$chalinfo = dbquery("SELECT challenges FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid'");
|
|
91
|
91
|
list($challenges) = dbrow($chalinfo);
|
|
92
|
|
- $challenges = explode(",", $challenges ?? "");
|
|
|
92
|
+ $challenges = explode(",", (isset($challenges) ? $challenges : ""));
|
|
93
|
93
|
$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET challenges = '".implode(",", array_diff($challenges, explode(",", $chalid)))."' WHERE sid = '$sid'");
|
|
94
|
94
|
}
|
|
95
|
95
|
if($result && $GLOBALS['dbconnect']->affected_rows > 0) dbquery("UPDATE ".TABLEPREFIX."fanfiction_challenges SET responses = GREATEST(responses - 1, 0) WHERE chalid = '".(int)$chalid."'");
|
|
...
|
...
|
@@ -105,9 +105,9 @@ else if($action == "add" || $action == "edit") {
|
|
105
|
105
|
|
|
106
|
106
|
$output .= "<div id=\"pagetitle\">".($action == "edit" ? _EDITCHALLENGE : _ADDCHALLENGE)."</div>";
|
|
107
|
107
|
if(isset($_POST['submit'])) {
|
|
108
|
|
- $title = escapestring(descript($_POST['title'] ?? '', $allowed_tags));
|
|
109
|
|
- $summary = escapestring(replace_naughty(strip_tags(descript($_POST['summary'] ?? ''), $allowed_tags)));
|
|
110
|
|
- $challenger = escapestring(strip_tags(descript($_POST['challenger'] ?? ''), $allowed_tags));
|
|
|
108
|
+ $title = escapestring(descript((isset($_POST['title']) ? $_POST['title'] : ''), $allowed_tags));
|
|
|
109
|
+ $summary = escapestring(replace_naughty(strip_tags(descript((isset($_POST['summary']) ? $_POST['summary'] : '')), $allowed_tags)));
|
|
|
110
|
+ $challenger = escapestring(strip_tags(descript((isset($_POST['challenger']) ? $_POST['challenger'] : '')), $allowed_tags));
|
|
111
|
111
|
if(!$challenger) $challenger = _ANONYMOUS;
|
|
112
|
112
|
$challengeruid = isset($_POST['challengeruid']) && isNumber($_POST['challengeruid']) ? $_POST['challengeruid'] : 0;
|
|
113
|
113
|
$catid = isset($_POST['catid']) ? array_filter(is_array($_POST['catid']) ? $_POST['catid'] : explode(",", $_POST['catid']), "isNumber") : array( );
|
|
...
|
...
|
@@ -297,9 +297,9 @@ else {
|
|
297
|
297
|
|
|
298
|
298
|
$challenge = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_challenges WHERE chalid = '$chalid' LIMIT 1");
|
|
299
|
299
|
list($chalid, $challenger, $uid, $title, $cat, $chars, $summary, $responses) = dbrow($challenge);
|
|
300
|
|
- $challenger = stripslashes($challenger ?? "");
|
|
301
|
|
- $title = stripslashes($title ?? "");
|
|
302
|
|
- $summary= stripslashes($summary ?? "");
|
|
|
300
|
+ $challenger = stripslashes(isset($challenger) ? $challenger : "");
|
|
|
301
|
+ $title = stripslashes(isset($title) ? $title : "");
|
|
|
302
|
+ $summary= stripslashes(isset($summary) ? $summary : "");
|
|
303
|
303
|
|
|
304
|
304
|
$challenges->newBlock("titleblock");
|
|
305
|
305
|
if(isADMIN || USERUID == $uid) $challenges->assign("adminoptions", "<div class=\"adminoptions\">".($admin ? _ADMINOPTIONS : _OPTIONS).": [<a href=\"challenges.php?action=edit&chalid=$chalid\">"._EDIT."</a>] [<a href=\"challenges.php?action=delete&chalid=$chalid\">"._DELETE."</a>]</div>");
|
|
...
|
...
|
@@ -346,4 +346,4 @@ else {
|
|
346
|
346
|
|
|
347
|
347
|
$tpl->assign("output", $output);
|
|
348
|
348
|
$tpl->printToScreen( );
|
|
349
|
|
-?>
|
|
350
|
349
|
\ No newline at end of file
|
|
|
350
|
+?>
|