Browse code

Mod Conversion page reorganization - also with a warning message

Clarissa Walker authored on 2026/09/20 12:36:23
Showing 3 changed files
... ...
@@ -31,6 +31,9 @@ $output .= "<div id='pagetitle'>"._ARCHIVECONV."</div>";
31 31
 if($convert == "convert_mod") {
32 32
 	if(file_exists("admin/convert_mod.php")) include_once("admin/convert_mod.php");
33 33
 }
34
+if($convert == "convert_mod_0900") {
35
+	if(file_exists("admin/convert_mod_0900.php")) include_once("admin/convert_mod_0900.php");
36
+}
34 37
 if($convert == "convert_utf") {
35 38
 	if(file_exists("admin/convert_utf.php")) include_once("admin/convert_utf.php");
36 39
 }
... ...
@@ -44,10 +47,16 @@ if($convert == "convert_1400") {
44 47
 	if(file_exists("admin/convert_1400.php")) include_once("admin/convert_1400.php");
45 48
 }
46 49
 $output .= "
50
+<center>Warning: You should put the archive in maintenance mode before converting the database; it will be very live otherwise!</center>
47 51
 <ul>
48 52
 	<li><a href='admin.php?action=convert&amp;conv=convert_mod'>"._CONVERT_MOD."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERTMOD."</span></A></li>
49 53
 	<li><a href='admin.php?action=convert&amp;conv=convert_utf'>"._CONVERT_UTF."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERTUTF."</span></A></li>
50
-	<li><a href='admin.php?action=convert&amp;conv=convert_0520'>"._CONVERT_0520."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT0520."</span></A></li>
54
+</ul>
55
+<ul>
56
+	<li><a href='admin.php?action=convert&amp;conv=convert_mod_0900'>"._CONVERT_MOD_0900."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERTMOD0900."</span></A></li>
51 57
 	<li><a href='admin.php?action=convert&amp;conv=convert_0900'>"._CONVERT_0900."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT0900."</span></A></li>
58
+</ul>
59
+<ul>
60
+	<li><a href='admin.php?action=convert&amp;conv=convert_0520'>"._CONVERT_0520."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT0520."</span></A></li>
52 61
 	<li><a href='admin.php?action=convert&amp;conv=convert_1400'>"._CONVERT_1400."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT1400."</span></A></li>
53 62
 </ul>";
54 63
new file mode 100644
... ...
@@ -0,0 +1,129 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// eFiction 3.0
4
+// Copyright (c) 2007 by Tammy Keefer
5
+// Valid HTML 4.01 Transitional
6
+// Based on eFiction 1.1
7
+// Copyright (C) 2003 by Rebecca Smallwood.
8
+// http://efiction.sourceforge.net/
9
+// ----------------------------------------------------------------------
10
+// LICENSE
11
+//
12
+// This program is free software; you can redistribute it and/or
13
+// modify it under the terms of the GNU General Public License (GPL)
14
+// as published by the Free Software Foundation; either version 2
15
+// of the License, or (at your option) any later version.
16
+//
17
+// This program is distributed in the hope that it will be useful,
18
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+// GNU General Public License for more details.
21
+//
22
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
+// ----------------------------------------------------------------------
24
+
25
+if(!defined("_CHARSET")) exit( );
26
+$expVer = explode(".", $version);
27
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
28
+
29
+// silly converted update script... just to further convert collation in some tables
30
+
31
+// messy version check, starting with version 3.5.9
32
+if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
33
+if($confirm == "yes") {
34
+	// For converting certain fields to a chosen collation, starting with versions 3.5.9
35
+    if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
36
+		// only if you installed the 'clean' future 3.5.9 version prior
37
+		if (!dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_settings LIKE 'setreg'")))
38
+			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_settings` ADD `setreg` tinyint(1) NOT NULL DEFAULT '1' AFTER `multiplecats`");
39
+		if (!dbassoc(dbquery("SELECT * FROM fanfiction_panels WHERE panel_name = 'convert';"))) {
40
+			dbquery("UPDATE `".TABLEPREFIX."fanfiction_panels` SET panel_order = '12' WHERE panel_name = 'modules'");
41
+			dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels`(`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_hidden`, `panel_type`, `panel_order`) VALUES( 'convert', 'Archive Conversion', '', '1', '0', 'A', '11')");
42
+		}
43
+		// initial UTF-8 conversion
44
+		dbquery("ALTER DATABASE $dbname DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
45
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorfields ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
46
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorinfo ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
47
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorprefs ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
48
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
49
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_blocks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
50
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
51
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_chapters ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
52
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
53
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classes ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
54
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classtypes ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
55
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_coauthors ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
56
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_codeblocks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
57
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_comments ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
58
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
59
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_inseries ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
60
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_log ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
61
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_messages ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
62
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_modules ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
63
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_news ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
64
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_pagelinks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
65
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_panels ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
66
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
67
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_reviews ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
68
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
69
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_settings ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
70
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stats ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
71
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
72
+		// phase two of UTF-8 conversion
73
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorfields CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
74
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorinfo CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
75
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorprefs CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
76
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
77
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_blocks CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
78
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
79
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_chapters CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
80
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
81
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classes CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
82
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classtypes CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
83
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_coauthors CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
84
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_codeblocks CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
85
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_comments CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
86
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
87
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_inseries CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
88
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_log CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
89
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_messages CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
90
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_modules CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
91
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_news CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
92
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_pagelinks CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
93
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_panels CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
94
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
95
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_reviews CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
96
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
97
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_settings CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
98
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stats CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
99
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CONVERT TO CHARSET utf8mb4 COLLATE utf8mb4_0900_bin;");
100
+		// change collation of certain columns
101
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors CHANGE `penname` `penname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '', CHANGE `realname` `realname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
102
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CHANGE `category` `category` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
103
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CHANGE `charname` `charname` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
104
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CHANGE `type` `type` CHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;");
105
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CHANGE `rating` `rating` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
106
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;");
107
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'Untitled', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL;");
108
+		$alltables = dbquery("SHOW TABLES");
109
+	}
110
+	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '$version' WHERE sitekey ='".SITEKEY."'");
111
+	$alltables = dbquery("SHOW TABLES");
112
+	while ($table = dbassoc($alltables)) {
113
+		foreach ($table as $db => $tablename) {
114
+			dbquery("OPTIMIZE TABLE `".$tablename."`");
115
+		}
116
+	}
117
+	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
118
+	else $output .= write_error(_ERROR);
119
+}
120
+else if($confirm == "no") {
121
+	$output .= write_message(_ACTIONCANCELLED);
122
+}
123
+else {
124
+  	$output .= write_message("This setup will be converted to eFiction 3 Mod with Unicode 9.0 Support.  There is no turning back, so you are advised to back up your database before starting! <br />
125
+Are you ready to convert to eFiction 3 Mod with Unicode 9.0 support? <a href='admin.php?action=convert&conv=convert_mod_0900&amp;confirm=yes'>"._YES."</a> "._OR." <a href='admin.php?action=convert&conv=convert_mod_0900&amp;confirm=no'>"._NO."</a>");
126
+}
127
+}
128
+else $output .= write_message(_ALREADYUPDATED);
129
+?>
... ...
@@ -79,10 +79,11 @@ define ("_CONFIRMAUTHORRELEASE", "Are you sure you want to release this author?"
79 79
 define ("_CONFIRMADMINREVOKE", "Are you sure you want to revoke this admin's privileges?");
80 80
 define ("_CONFIRMVALREVOKE", "Are you sure you want to revoke this author's validation?");
81 81
 define ("_CONFIRMVALIDATE", "Are you sure you want to validate this author?");
82
-define ("_CONVERT_MOD", "Convert to eFiction 3 Mod");
82
+define ("_CONVERT_MOD", "Convert to eFiction 3 Mod (Unicode 4.0)");
83
+define ("_CONVERT_MOD_0900", "Convert to eFiction 3 Mod (Unicode 9.0)");
83 84
 define ("_CONVERT_UTF", "Convert back to Unicode 4.0");
84 85
 define ("_CONVERT_0520", "Convert to Unicode 5.2");
85
-define ("_CONVERT_0900", "Convert to Unicode 9.0");
86
+define ("_CONVERT_0900", "Convert back to Unicode 9.0");
86 87
 define ("_CONVERT_1400", "Convert to Unicode 14.0");
87 88
 define ("_COPYRIGHT", "Copyright Footer");
88 89
 define ("_COUNTCATS", "Fix Category Counts");
... ...
@@ -395,10 +396,11 @@ define ("_HELP_CATORDER", "This option will fix errors in the numbering of the c
395 396
 define ("_HELP_PANELORDER", "This option will fix errors in the numbering of the panel order saved in the database.  This will <strong>not</strong> change the order of your panels only correct errors in the database numbering.");
396 397
 define ("_HELP_RECALCSTORIES", "Click here to fix the story count for authors.");
397 398
 define("_HELP_CONVERTMOD", "This converts your current eFiction install to eFiction 3 Mod. This will work to some extent with a database using the latin1 collation as long as you are not using (or attempting to use) any multibyte characters.");
398
-define("_HELP_CONVERTUTF", "This converts your current eFiction 3 Mod install back to supporting Unicode 4.0.");
399
-define("_HELP_CONVERT0520", "This converts your current eFiction 3 Mod install to support Unicode 5.2.");
400
-define("_HELP_CONVERT0900", "This converts your current eFiction 3 Mod install to support Unicode 9.0.");
401
-define("_HELP_CONVERT1400", "This converts your current eFiction 3 Mod install to support Unicode 14.0.");
399
+define("_HELP_CONVERTMOD0900", "This converts your current eFiction install to eFiction 3 Mod but with full Unicode 9.0 support. This will work to some extent with a database using the latin1 collation as long as you are not using (or attempting to use) any multibyte characters.");
400
+define("_HELP_CONVERTUTF", "This converts your current eFiction 3 Mod install back to supporting Unicode 4.0 from either the 5.2, 9.0, or 14.0 database columns comversion. Primarily for use with the 4.0 conversion.");
401
+define("_HELP_CONVERT0520", "This converts some database columns of your current eFiction 3 Mod install to support Unicode 5.2. For use with either Mod conversion.");
402
+define("_HELP_CONVERT0900", "This converts your current eFiction 3 Mod install back to supporting Unicode 9.0 from either the 4.0, 5.2, or 14.0 database columns comversion. Primarily for use with the 9.0 conversion.");
403
+define("_HELP_CONVERT1400", "This converts some database columns of your current eFiction 3 Mod install to support Unicode 14.0. For use with either Mod conversion.");
402 404
 
403 405
 // Log strings
404 406