2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//check the permission
|
|
|
|
|
if(defined('STDIN')) {
|
|
|
|
|
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
|
|
|
|
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
|
|
|
|
|
$document_root = $matches[1];
|
|
|
|
|
set_include_path($document_root);
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
|
|
|
|
$display_type = 'text'; //html, text
|
2013-06-07 01:09:07 +02:00
|
|
|
|
|
|
|
|
//add multi-lingual support
|
|
|
|
|
require_once "app_languages.php";
|
|
|
|
|
foreach($text as $key => $value) {
|
|
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (permission_exists('upgrade_schema') || if_group("superadmin")) {
|
|
|
|
|
//echo "access granted";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2013-06-07 01:09:07 +02:00
|
|
|
|
|
|
|
|
//add multi-lingual support
|
|
|
|
|
require_once "app_languages.php";
|
|
|
|
|
foreach($text as $key => $value) {
|
|
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-06-07 01:09:07 +02:00
|
|
|
$page["title"] = $text['title-upgrade_schema'];
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
$display_type = 'html'; //html, text
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//set the default
|
|
|
|
|
if (!isset($display_results)) {
|
|
|
|
|
$display_results = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//load the default database into memory and compare it with the active database
|
2013-07-06 09:01:14 +02:00
|
|
|
require_once "resources/schema.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
db_upgrade_schema ($db, $db_type, $db_name, $display_results);
|
|
|
|
|
unset($apps);
|
|
|
|
|
|
|
|
|
|
//upgrade the domains
|
2014-04-27 03:00:07 +02:00
|
|
|
$_SESSION['domain_language_code'] = $_SESSION['domain']['language']['code'];
|
2012-06-04 16:58:40 +02:00
|
|
|
require_once "core/upgrade/upgrade_domains.php";
|
2014-04-27 03:00:07 +02:00
|
|
|
$_SESSION['domain']['language']['code'] = $_SESSION['domain_language_code'];
|
|
|
|
|
unset($_SESSION['domain_language_code']);
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
if ($display_results && $display_type == "html") {
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo "<br />\n";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|