function install() { global $dblink, $dbserv, $dbuser, $dbpass, $dbname, $dbpref, $dberror, $abxd_version; doSanityChecks(); if (file_exists("config/database.php")) { //TODO: Check for errors when parsing this file (It may be corrupted or wrong or whatever. //If it fails, fail gracefully and instruct the user to fix or delete database.php include "config/database.php"; } else { $dbserv = $_POST['dbserv']; $dbuser = $_POST['dbuser']; $dbpass = $_POST['dbpass']; $dbname = $_POST['dbname']; $dbpref = $_POST['dbpref']; } $convert = $_POST["convert"] == "true"; $convertFrom = $_POST["convertFrom"]; $convertDbName = $_POST["convertDbName"]; $convertDbPrefix = $_POST["convertDbPrefix"]; if (!sqlConnect()) { installationError("Could not connect to the database. Error was: " . $dberror); } $currVersion = getInstalledVersion(); if ($currVersion == $abxd_version) { installationError("The board is already installed and updated (Database version {$currVersion}). You don't need to run the installer!\n"); } if ($currVersion != -1 && $convert) { die("ERROR: You asked to convert a forum database, but an ABXD installation was already found in the installation DB. Converting is only possible when doing a new installation."); } echo "Setting utf8_unicode_ci collation to the database...\n"; query("ALTER DATABASE {$dbname} COLLATE utf8_unicode_ci"); if ($currVersion == -1) { echo "Installing database version {$abxd_version}...\n"; } else { echo "Upgrading database from version {$currVersion} to {$abxd_version}...\n"; } upgrade(); $misc = Query("select * from {misc}"); if (NumRows($misc) == 0) { Query("INSERT INTO `{misc}` (`views`, `hotcount`, `milestone`, `maxuserstext`) VALUES (0, 30, 'Nothing yet.', 'Nobody yet.');"); } Query("UPDATE `{misc}` SET `version` = {0}", $abxd_version); if (!is_dir("config")) { mkdir("config"); } if ($currVersion == -1) { //Stuff to do on new installation (Not upgrade) Import("install/smilies.sql"); if ($convert) { runConverter($convertFrom, $convertDbName, $convertPrefix); } else { Import("install/installDefaults.sql"); } if (file_exists("config/salt.php")) { echo "Not generating new salt.php as it's already present...\n"; } else { echo "Generating new salt.php...\n"; writeConfigSalt(); } } if (!file_exists("config/database.php")) { writeConfigDatabase(); } }
echo " <div class='span4 '>\r\n <div class='stat-block'>\r\n <ul>\r\n <li class='stat-count'><a href='" . implode("", getUpdateVersion("max(file_path)")) . "' target='_blank'><span>" . implode("", getUpdateVersion("max(version)")) . "</span></a><span>User Update Version</span></li>"; if (implode("", getExpirationInfo("updateto")) > (new \DateTime())->format('Y-m-d')) { echo "<li class='stat-percent'><span class='text-success'>" . implode("", getUpdateVersion("max(upddate)")) . "</span></li>"; } else { echo "<li class='stat-percent'><span class='text-error'>" . implode("", getUpdateVersion("max(upddate)")) . "</span></li>"; } echo " </ul>\r\n </div>\r\n </div>"; } else { echo " <div class='span4 '>\r\n <div class='stat-block'>\r\n <ul>\r\n <li class='stat-count'><span>" . Yii::app()->user->name . "</span><span>Unknown Update Version</span></li>\r\n </ul>\r\n </div>\r\n </div>"; } if (!empty(getInstalledVersion("max(au.version)"))) { echo " <div class='span4 '>\r\n <div class='stat-block'>\r\n <ul>\r\n <li class='stat-count'><span>" . implode("", getInstalledVersion("max(au.version)")) . "</span><span>User Installed Version</span></li>"; if (implode("", getExpirationInfo("updateto")) > (new \DateTime())->format('Y-m-d')) { echo "<li class='stat-percent'><span class='text-success'>" . implode("", getInstalledVersion("max(condate)")) . "</span></li>"; } else { echo "<li class='stat-percent'><span class='text-error'>" . implode("", getInstalledVersion("max(condate)")) . "</span></li>"; } echo " </ul>\r\n </div>\r\n </div>"; } else { echo " <div class='span4 '>\r\n <div class='stat-block'>\r\n <ul>\r\n <li class='stat-count'><span>" . Yii::app()->user->name . "</span><span>No info about Installed Version</span></li>\r\n </ul>\r\n </div>\r\n </div>"; } echo " </div>"; echo " <div class='row-fluid'>"; echo " <div class='span8 '>"; $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-th-list"></span>Support system')); echo " <h2>Welcome to Support system</h2>\r\n <p>Use the support system to show informations about your product services.</p>\r\n <ul>\r\n <li>Show your service status</li>\r\n <li>Show the Update version for your program. Click above the version to downloaded it.</li>\r\n <li>Check the installed Update version at your systems</li>\r\n <li>Show the full installation software version. Click above the version to downloaded it.</li>\r\n <li>If you have a custom program Version you can view all needed files and download it</li>\r\n <li>If you need support or help about software, see the <strong>Support Section</strong></li>\r\n <li>At <strong>Files Section</strong> you will find useful files about your product installation</li>\r\n <li>Check the video about product installation</li>\r\n <li>Contact us via contact form for further support</li>\r\n </ul>\r\n <p>(*)Red Color seems that your customer services have been expired. Green Color seems that your customer services are active.</p>\r\n "; $this->endWidget(); echo " </div>"; if (!empty(getExpirationInfo("updateto"))) { echo " <div class='span4 '>\r\n <div class='stat-block'>\r\n <ul>\r\n <li class='stat-count'><a href='" . implode("", getSoftwareVersion("max(file_path)")) . "' target='_blank'><span>" . implode("", getSoftwareVersion("max(filename)")) . "</span></a><span>Software Version</span></li>"; if (implode("", getExpirationInfo("updateto")) > (new \DateTime())->format('Y-m-d')) {
<?php include "install/installer.php"; $sqlConfigured = file_exists("config/database.php"); $upgrade = false; if ($sqlConfigured) { include "config/database.php"; if (!sqlConnect()) { $sqlConfigured = false; } else { if (getInstalledVersion() != -1) { $upgrade = true; } } } ?> <!DOCTYPE html> <html> <head> <title>ABXD installation</title> <link rel="stylesheet" href="css/common.css" type="text/css" /> <link rel="stylesheet" href="themes/abxd30/style.css" type="text/css" /> <script src="js/jquery.js"></script> <script src="install/installer.js"></script> <script type="text/javascript"> var upgrade=<?php echo $upgrade ? "true" : "false"; ?> ; var sqlConfigured=<?php
public function isUpgradeRequired() { return getInstalledVersion() < DB_VERSION; }