Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,45 @@
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
+
24
+
25
+if(!defined("_CHARSET")) exit( );
26
+
27
+// Delete characters
28
+if($action == "characters") {
29
+	$chalquery = dbquery("SELECT characters, chalid FROM ".TABLEPREFIX."fanfiction_challenges WHERE FIND_IN_SET('$charid', characters) > 0");
30
+	while($chal = dbassoc($chalquery)) {
31
+		$newcharlist = array_diff(explode(",", $chal['characters']), array($charid));
32
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_challenges SET characters = '".($newcharlist ? implode(",", $newcharlist) : "")."' WHERE chalid = '$chal[chalid]'");
33
+	}
34
+}
35
+
36
+// Delete categories 
37
+if($action == "categories") {
38
+	$chalquery = dbquery("SELECT catid, chalid FROM ".TABLEPREFIX."fanfiction_challenges WHERE FIND_IN_SET('$catid', catid) > 0");
39
+	while($chal = dbassoc($chalquery)) {
40
+		$newcatlist = array_diff(explode(",", $chal['catid']), array($catid));
41
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_challenges SET catid = '".($newcatlist ? implode(",", $newcatlist) : "")."' WHERE chalid = '$chal[chalid]'");
42
+	}
43
+}
44
+
45
+?>
0 46
\ No newline at end of file