Add support for Unicode conversion to eFiction 3 Mod - this is to be done in the Archive Conversion page of the Admin Panel
Add support for Unicode conversion to eFiction 3 Mod - this is to be done in the Archive Conversion page of the Admin Panel

file:b/admin/convert.php (new)
--- /dev/null
+++ b/admin/convert.php
@@ -1,1 +1,50 @@
+<?php
+// ----------------------------------------------------------------------
+// eFiction 3.0
+// Copyright (c) 2007 by Tammy Keefer
+// Valid HTML 4.01 Transitional
+// Based on eFiction 1.1
+// Copyright (C) 2003 by Rebecca Smallwood.
+// http://efiction.sourceforge.net/
+// ----------------------------------------------------------------------
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License (GPL)
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
+// ----------------------------------------------------------------------
 
+if(!defined("_CHARSET")) exit( );
+
+// converted maintenance page
+
+$convert = isset($_GET['conv']) ? $_GET['conv'] : false;
+$output .= "<div id='pagetitle'>"._ARCHIVECONV."</div>";
+if($convert == "convert_mod") {
+	if(file_exists("admin/convert_mod.php")) include_once("admin/convert_mod.php");
+}
+if($convert == "convert_utf") {
+	if(file_exists("admin/convert_utf.php")) include_once("admin/convert_utf.php");
+}
+if($convert == "convert_0900") {
+	if(file_exists("admin/convert_0900.php")) include_once("admin/convert_0900.php");
+}
+if($convert == "convert_1400") {
+	if(file_exists("admin/convert_1400.php")) include_once("admin/convert_1400.php");
+}
+$output .= "
+<ul>
+	<li><a href='admin.php?action=convert&amp;conv=convert_mod'>"._CONVERT_MOD."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERTMOD."</span></A></li>
+	<li><a href='admin.php?action=convert&amp;conv=convert_utf'>"._CONVERT_UTF."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERTUTF."</span></A></li>
+	<li><a href='admin.php?action=convert&amp;conv=convert_0900'>"._CONVERT_0900."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT0900."</span></A></li>
+	<li><a href='admin.php?action=convert&amp;conv=convert_1400'>"._CONVERT_1400."</a>  <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONVERT1400."</span></A></li>
+</ul>";
+

--- /dev/null
+++ b/admin/convert_0900.php
@@ -1,1 +1,65 @@
+<?php
+// ----------------------------------------------------------------------
+// eFiction 3.0
+// Copyright (c) 2007 by Tammy Keefer
+// Valid HTML 4.01 Transitional
+// Based on eFiction 1.1
+// Copyright (C) 2003 by Rebecca Smallwood.
+// http://efiction.sourceforge.net/
+// ----------------------------------------------------------------------
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License (GPL)
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
+// ----------------------------------------------------------------------
 
+if(!defined("_CHARSET")) exit( );
+$expVer = explode(".", $version);
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
+
+// silly converted update script... just to further convert collation in some tables
+
+// messy version check, starting with version 3.5.9
+if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+if($confirm == "yes") {
+	// For converting certain fields to a chosen collation, starting with versions 3.5.9
+    if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+		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 '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CHANGE `category` `category` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CHANGE `charname` `charname` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CHANGE `type` `type` CHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CHANGE `rating` `rating` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '';");
+		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;");
+		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;");
+		$alltables = dbquery("SHOW TABLES");
+	}
+	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '$version' WHERE sitekey ='".SITEKEY."'");
+	$alltables = dbquery("SHOW TABLES");
+	while ($table = dbassoc($alltables)) {
+		foreach ($table as $db => $tablename) {
+			dbquery("OPTIMIZE TABLE `".$tablename."`");
+		}
+	}
+	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
+	else $output .= write_error(_ERROR);
+}
+else if($confirm == "no") {
+	$output .= write_message(_ACTIONCANCELLED);
+}
+else {
+  	$output .= write_message("Some fields in this setup will be converted to Unicode 9.0.  You should run the eFiction 3 Mod conversion first.  You are advised to back up your database before starting! <br />
+Are you ready to convert to Unicode 9.0? <a href='admin.php?action=convert&conv=convert_0900&amp;confirm=yes'>"._YES."</a> "._OR." <a href='admin.php?action=convert&conv=convert_0900&amp;confirm=no'>"._NO."</a>");
+}
+}
+else $output .= write_message(_ALREADYUPDATED);
+?>
+

--- /dev/null
+++ b/admin/convert_1400.php
@@ -1,1 +1,65 @@
+<?php
+// ----------------------------------------------------------------------
+// eFiction 3.0
+// Copyright (c) 2007 by Tammy Keefer
+// Valid HTML 4.01 Transitional
+// Based on eFiction 1.1
+// Copyright (C) 2003 by Rebecca Smallwood.
+// http://efiction.sourceforge.net/
+// ----------------------------------------------------------------------
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License (GPL)
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
+// ----------------------------------------------------------------------
 
+if(!defined("_CHARSET")) exit( );
+$expVer = explode(".", $version);
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
+
+// silly converted update script... just to further convert collation in some tables
+
+// messy version check, starting with version 3.5.9
+if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+if($confirm == "yes") {
+	// For converting certain fields to a chosen collation, starting with versions 3.5.9
+    if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors CHANGE `penname` `penname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '', CHANGE `realname` `realname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CHANGE `category` `category` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CHANGE `charname` `charname` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CHANGE `type` `type` CHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CHANGE `rating` `rating` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT '', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NOT NULL DEFAULT 'Untitled', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci NULL DEFAULT NULL;");
+		$alltables = dbquery("SHOW TABLES");
+	}
+	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '$version' WHERE sitekey ='".SITEKEY."'");
+	$alltables = dbquery("SHOW TABLES");
+	while ($table = dbassoc($alltables)) {
+		foreach ($table as $db => $tablename) {
+			dbquery("OPTIMIZE TABLE `".$tablename."`");
+		}
+	}
+	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
+	else $output .= write_error(_ERROR);
+}
+else if($confirm == "no") {
+	$output .= write_message(_ACTIONCANCELLED);
+}
+else {
+  	$output .= write_message("Some fields in this setup will be converted to Unicode 14.0.  You should run the eFiction 3 Mod conversion first.  You are advised to back up your database before starting! <br />
+Are you ready to convert to Unicode 14.0? <a href='admin.php?action=convert&conv=convert_1400&amp;confirm=yes'>"._YES."</a> "._OR." <a href='admin.php?action=convert&conv=convert_1400&amp;confirm=no'>"._NO."</a>");
+}
+}
+else $output .= write_message(_ALREADYUPDATED);
+?>
+

--- /dev/null
+++ b/admin/convert_mod.php
@@ -1,1 +1,92 @@
+<?php
+// ----------------------------------------------------------------------
+// eFiction 3.0
+// Copyright (c) 2007 by Tammy Keefer
+// Valid HTML 4.01 Transitional
+// Based on eFiction 1.1
+// Copyright (C) 2003 by Rebecca Smallwood.
+// http://efiction.sourceforge.net/
+// ----------------------------------------------------------------------
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License (GPL)
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
+// ----------------------------------------------------------------------
 
+if(!defined("_CHARSET")) exit( );
+$expVer = explode(".", $version);
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
+
+// silly converted update script... just to convert collation and engine type in some tables
+
+// messy version check, starting with version 3.5.9
+if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+if($confirm == "yes") {
+	// For converting to eFiction 3 Mod, starting with versions 3.5.9
+	if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorfields ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorinfo ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorprefs ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_blocks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_chapters ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classes ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_classtypes ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_coauthors ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_codeblocks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_comments ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_inseries ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_log ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_messages ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_modules ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_news ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_pagelinks ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_panels ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_reviews ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_settings ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stats ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors CHANGE `penname` `penname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', CHANGE `realname` `realname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CHANGE `category` `category` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CHANGE `charname` `charname` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CHANGE `type` `type` CHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CHANGE `rating` `rating` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Untitled', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;");
+		$alltables = dbquery("SHOW TABLES");
+	}
+	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '$version' WHERE sitekey ='".SITEKEY."'");
+	$alltables = dbquery("SHOW TABLES");
+	while ($table = dbassoc($alltables)) {
+		foreach ($table as $db => $tablename) {
+			dbquery("OPTIMIZE TABLE `".$tablename."`");
+		}
+	}
+	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
+	else $output .= write_error(_ERROR);
+}
+else if($confirm == "no") {
+	$output .= write_message(_ACTIONCANCELLED);
+}
+else {
+  	$output .= write_message("This setup will be converted to eFiction 3 Mod.  There is no turning back, so you are advised to back up your database before starting! <br />
+Are you ready to convert to eFiction 3 Mod? <a href='admin.php?action=convert&conv=convert_mod&amp;confirm=yes'>"._YES."</a> "._OR." <a href='admin.php?action=convert&conv=convert_mod&amp;confirm=no'>"._NO."</a>");
+}
+}
+else $output .= write_message(_ALREADYUPDATED);
+?>
+

--- /dev/null
+++ b/admin/convert_utf.php
@@ -1,1 +1,65 @@
+<?php
+// ----------------------------------------------------------------------
+// eFiction 3.0
+// Copyright (c) 2007 by Tammy Keefer
+// Valid HTML 4.01 Transitional
+// Based on eFiction 1.1
+// Copyright (C) 2003 by Rebecca Smallwood.
+// http://efiction.sourceforge.net/
+// ----------------------------------------------------------------------
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License (GPL)
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
+// ----------------------------------------------------------------------
 
+if(!defined("_CHARSET")) exit( );
+$expVer = explode(".", $version);
+$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
+
+// silly converted update script... just to further convert collation in some tables
+
+// messy version check, starting with version 3.5.9
+if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+if($confirm == "yes") {
+	// For converting certain fields to a chosen collation, starting with versions 3.5.9
+    if($expVer[0] == 3 && ($expVer[1] == 5 || $expVer[1] >=6 && (!isset($expVer[2]) || $expVer[2] == 9 || $expVer[2] > 0))) {
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authors CHANGE `penname` `penname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', CHANGE `realname` `realname` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_categories CHANGE `category` `category` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_characters CHANGE `charname` `charname` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_favorites CHANGE `type` `type` CHAR(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_ratings CHANGE `rating` `rating` VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;");
+		dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CHANGE `title` `title` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Untitled', CHANGE `summary` `summary` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;");
+		$alltables = dbquery("SHOW TABLES");
+	}
+	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '$version' WHERE sitekey ='".SITEKEY."'");
+	$alltables = dbquery("SHOW TABLES");
+	while ($table = dbassoc($alltables)) {
+		foreach ($table as $db => $tablename) {
+			dbquery("OPTIMIZE TABLE `".$tablename."`");
+		}
+	}
+	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
+	else $output .= write_error(_ERROR);
+}
+else if($confirm == "no") {
+	$output .= write_message(_ACTIONCANCELLED);
+}
+else {
+  	$output .= write_message("Some fields in this setup will be converted back to Unicode 4.0.  You should run the eFiction 3 Mod conversion first.  You are advised to back up your database before starting! <br />
+Are you ready to convert back to Unicode 4.0? <a href='admin.php?action=convert&conv=convert_utf&amp;confirm=yes'>"._YES."</a> "._OR." <a href='admin.php?action=convert&conv=convert_utf&amp;confirm=no'>"._NO."</a>");
+}
+}
+else $output .= write_message(_ALREADYUPDATED);
+?>
+

--- a/docs/panels.sql
+++ b/docs/panels.sql
@@ -73,7 +73,8 @@
 ('skins', 'Skins', '', 3, 6, 0, 'A'),
 ('authorfields', 'Profile Information', '', 1, 9, 0, 'A'),
 ('manual', 'Admin Manual', '', '3', '6', '0', 'A'),
-('modules', 'Modules', '', 1, '11', 0, 'A'),
-('maintenance', 'Archive Maintenance', '', 1, 10, 0, 'A');
+('modules', 'Modules', '', 1, '12', 0, 'A'),
+('maintenance', 'Archive Maintenance', '', 1, 10, 0, 'A'),
+('convert', 'Archive Conversion', '', 1, 11, 0, 'A');
 
 

--- a/install/install.php
+++ b/install/install.php
@@ -472,8 +472,9 @@
 					array("skins", "Skins", "", "3", "6", "0", "A"),
 					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
 					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
+					array("convert", "Archive Conversion", "", "1", "11", "0", "A"),
 					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
-					array('modules', 'Modules', '', 1, "11", 0, 'A')
+					array('modules', 'Modules', '', 1, "12", 0, 'A')
 				);
 				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>" . _RESULT . "</th></tr>";
 				foreach ($panellist as $panel)

--- a/languages/en_admin.php
+++ b/languages/en_admin.php
@@ -33,6 +33,7 @@
 define ("_ALREADYINSTALLED", "That module is already installed.");
 define ("_ANONREV", "Anonymous Reviews");
 define ("_ANONREVIEWS", "Allow anonymous reviews");
+define ("_ARCHIVECONV", "Archive Conversion");
 define ("_ARCHIVEMAINT", "Archive Maintentance");
 define ("_AUTHORRELEASED", "The author has been removed from the admin created list, and an e-mail has been sent to them with their temporary password. <br /><br /><a href=\"admin.php?action=members\">Back to Members Maintenance</a>");
 define ("_AUTHORSONLY", "Authors Only");
@@ -78,6 +79,10 @@
 define ("_CONFIRMADMINREVOKE", "Are you sure you want to revoke this admin's privileges?");
 define ("_CONFIRMVALREVOKE", "Are you sure you want to revoke this author's validation?");
 define ("_CONFIRMVALIDATE", "Are you sure you want to validate this author?");
+define ("_CONVERT_MOD", "Convert to eFiction 3 Mod");
+define ("_CONVERT_UTF", "Convert back to Unicode 4.0");
+define ("_CONVERT_0900", "Convert to Unicode 9.0");
+define ("_CONVERT_1400", "Convert to Unicode 14.0");
 define ("_COPYRIGHT", "Copyright Footer");
 define ("_COUNTCATS", "Fix Category Counts");
 define ("_CURRENTVERSION", "The current version of eFiction is ");
@@ -388,6 +393,10 @@
 define ("_HELP_CATORDER", "This option will fix errors in the numbering of the category order saved in the database.  This will <strong>not</strong> change the order of your categories only correct errors in the database numbering.");
 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.");
 define ("_HELP_RECALCSTORIES", "Click here to fix the story count for authors.");
+define("_HELP_CONVERTMOD", "This converts your current eFiction install to eFiction 3 Mod.");
+define("_HELP_CONVERTUTF", "This converts your current eFiction 3 Mod install back to supporting Unicode 4.0.");
+define("_HELP_CONVERT0900", "This converts your current eFiction 3 Mod install to support Unicode 9.0.");
+define("_HELP_CONVERT1400", "This converts your current eFiction 3 Mod install to support Unicode 14.0.");
 
 // Log strings