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
+$current = "challenges";
3
+include ("../../header.php");
4
+
5
+//make a new TemplatePower object
6
+if(file_exists( "$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl" );
7
+else $tpl = new TemplatePower(_BASEDIR."default_tpls/default.tpl");
8
+$tpl->assignInclude( "header", "$skindir/header.tpl" );
9
+$tpl->assignInclude( "footer", "$skindir/footer.tpl" );
10
+include(_BASEDIR."includes/pagesetup.php");
11
+include_once(_BASEDIR."languages/".$language."_admin.php");
12
+if(file_exists("languages/".$language.".php")) include_once("languages/".$language.".php");
13
+else include_once("languages/en.php");
14
+if(!isADMIN) accessDenied( );
15
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
16
+include("version.php");
17
+list($currentVersion) = dbrow(dbquery("SELECT version FROM ".TABLEPREFIX."fanfiction_modules WHERE name = 'Challenges' LIMIT 1"));
18
+$currentVersion = explode(".", $currentVersion);
19
+if(empty($currentVersion ) || $currentVersion[1] < 4) {
20
+if($confirm == "yes") {
21
+	if(empty($currentVersion) || $currentVersion[1] == 0) {
22
+		dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/deluser.php\");', 'deluser', 'challenges');");
23
+	}
24
+	else if($currentVersion[1] < 1) {
25
+		dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES('include(_BASEDIR.\"modules/challenges/stats.php\");', 'sitestats', 'challenges');");
26
+	}
27
+	else if($currentVersion[1] < 3) {
28
+		dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_name = 'challenges' AND panel_type = 'A' LIMIT 1");
29
+	}
30
+	$statsOkay = dbquery("SELECT code_id FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_module = 'challenges' AND code_type = 'stats'");
31
+	if(dbnumrows($statsOkay) == 0) dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks`(`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/stats.php\");', 'sitestats', 'challenges');");
32
+	dbquery("UPDATE ".TABLEPREFIX."fanfiction_modules SET version = '1.4' WHERE name = 'Challenges' LIMIT 1");
33
+	$output = write_message(_ACTIONSUCCESSFUL);
34
+}
35
+else if($confirm == "no") {
36
+	$output = write_message(_ACTIONCANCELLED);
37
+}
38
+else {
39
+	$output = write_message(_CONFIRMUPDATE."<br /><a href='update.php?confirm=yes'>"._YES."</a> "._OR." <a href='update.php?confirm=no'>"._NO."</a>");
40
+}
41
+}
42
+else $output .= write_message(_ALREADYUPDATED);
43
+$tpl->assign("output", $output);
44
+$tpl->printToScreen( );
45
+?>
0 46
\ No newline at end of file