Make the domain and schema work with the PHP classes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//application details
|
//application details
|
||||||
$apps[$x]['name'] = "Upgrade";
|
$apps[$x]['name'] = "Upgrade";
|
||||||
$apps[$x]['uuid'] = "8b1d7eb5-1009-052c-e1a8-d1f4887a3f5c";
|
$apps[$x]['uuid'] = "8b1d7eb5-1009-052c-e1a8-d1f4887a3f5c";
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
$apps[$x]['description']['de-de'] = "";
|
$apps[$x]['description']['de-de'] = "";
|
||||||
$apps[$x]['description']['de-ch'] = "";
|
$apps[$x]['description']['de-ch'] = "";
|
||||||
$apps[$x]['description']['de-at'] = "";
|
$apps[$x]['description']['de-at'] = "";
|
||||||
$apps[$x]['description']['fr-fr'] = "Mise à jour du Schéma de la base de données";
|
$apps[$x]['description']['fr-fr'] = "Mise %uFFFD jour du Sch%uFFFDma de la base de donn%uFFFDes";
|
||||||
$apps[$x]['description']['fr-ca'] = "";
|
$apps[$x]['description']['fr-ca'] = "";
|
||||||
$apps[$x]['description']['fr-ch'] = "";
|
$apps[$x]['description']['fr-ch'] = "";
|
||||||
$apps[$x]['description']['pt-pt'] = "Atualizar o esquema da base de dados.";
|
$apps[$x]['description']['pt-pt'] = "Atualizar o esquema da base de dados.";
|
||||||
@@ -174,4 +175,5 @@
|
|||||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||||
*/
|
*/
|
||||||
?>
|
|
||||||
|
?>
|
||||||
@@ -190,11 +190,9 @@
|
|||||||
$text['message-upgrade']['pt-pt'] = "Actualização Efectuada";
|
$text['message-upgrade']['pt-pt'] = "Actualização Efectuada";
|
||||||
$text['message-upgrade']['fr-fr'] = "Mis à jour";
|
$text['message-upgrade']['fr-fr'] = "Mis à jour";
|
||||||
|
|
||||||
/******************/
|
|
||||||
|
|
||||||
$text['login-message_text']['en-us'] = "Keep up with the FusionPBX project by configuring your preferences in the newly added <a href=''/core/notifications/notification_edit.php''>Notifications</a> section, under the System menu!";
|
$text['login-message_text']['en-us'] = "Keep up with the FusionPBX project by configuring your preferences in the newly added <a href=''/core/notifications/notification_edit.php''>Notifications</a> section, under the System menu!";
|
||||||
$text['login-message_text']['es-cl'] = "Manténgase al día con el proyecto FusionPBX configurando sus preferencias en la sección <a href=''/core/notifications/notification_edit.php''>Notificaciones</a> acaba de agregar, en el menú del sistema!";
|
$text['login-message_text']['es-cl'] = "Manténgase al día con el proyecto FusionPBX configurando sus preferencias en la sección <a href=''/core/notifications/notification_edit.php''>Notificaciones</a> acaba de agregar, en el menú del sistema!";
|
||||||
$text['login-message_text']['pt-pt'] = "Mantenha-se com o projeto FusionPBX configurando suas preferências na seção <a href=''/core/notifications/notification_edit.php''>Notificações</a> recém-adicionado, no menu Sistema!";
|
$text['login-message_text']['pt-pt'] = "Mantenha-se com o projeto FusionPBX configurando suas preferências na seção <a href=''/core/notifications/notification_edit.php''>Notificações</a> recém-adicionado, no menu Sistema!";
|
||||||
$text['login-message_text']['fr-fr'] = "Tenez-vous au projet FusionPBX en configurant vos préférences dans la section <a href=''/core/notifications/notification_edit.php''>Notifications</a> nouvellement ajouté, dans le menu du système!";
|
$text['login-message_text']['fr-fr'] = "Tenez-vous au projet FusionPBX en configurant vos préférences dans la section <a href=''/core/notifications/notification_edit.php''>Notifications</a> nouvellement ajouté, dans le menu du système!";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
+13
-18
@@ -64,28 +64,23 @@ if (sizeof($_POST) > 0) {
|
|||||||
$response_message = $text['message-upgrade_svn'];
|
$response_message = $text['message-upgrade_svn'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the default database into memory and compare it with the active database
|
// load an array of the database schema and compare it with the active database
|
||||||
if ($do["schema"] && permission_exists("upgrade_schema")) {
|
if ($do["schema"] && permission_exists("upgrade_schema")) {
|
||||||
$included = true;
|
|
||||||
$response_output = "return";
|
|
||||||
$response_format = "html";
|
|
||||||
$upgrade_data_types = check_str($do["data_types"]);
|
|
||||||
require_once "core/upgrade/upgrade_schema.php";
|
|
||||||
if ($response_upgrade_schema != '') {
|
|
||||||
$_SESSION["response_upgrade_schema"] = $response_upgrade_schema;
|
|
||||||
}
|
|
||||||
unset($apps);
|
|
||||||
$response_message = $text['message-upgrade_schema'];
|
$response_message = $text['message-upgrade_schema'];
|
||||||
|
|
||||||
|
$upgrade_data_types = check_str($do["data_types"]);
|
||||||
|
require_once "resources/classes/schema.php";
|
||||||
|
$obj = new schema();
|
||||||
|
$_SESSION["schema"]["response"] = $obj->schema("html");
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the apps defaults
|
// process the apps defaults
|
||||||
if ($do["apps"] && permission_exists("upgrade_apps")) {
|
if ($do["apps"] && permission_exists("upgrade_apps")) {
|
||||||
$included = true;
|
|
||||||
$domain_language_code = $_SESSION['domain']['language']['code'];
|
|
||||||
require_once "core/upgrade/upgrade_domains.php";
|
|
||||||
$_SESSION['domain']['language']['code'] = $domain_language_code;
|
|
||||||
unset($domain_language_code);
|
|
||||||
$response_message = $text['message-upgrade_apps'];
|
$response_message = $text['message-upgrade_apps'];
|
||||||
|
|
||||||
|
require_once "resources/classes/domains.php";
|
||||||
|
$domain = new domains;
|
||||||
|
$domain->upgrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore defaults of the selected menu
|
// restore defaults of the selected menu
|
||||||
@@ -260,12 +255,12 @@ if ($_SESSION["response_svn_update"] != '') {
|
|||||||
|
|
||||||
|
|
||||||
// output result of upgrade schema
|
// output result of upgrade schema
|
||||||
if ($_SESSION["response_upgrade_schema"] != '') {
|
if ($_SESSION["schema"]["response"] != '') {
|
||||||
echo "<br /><br /><br />";
|
echo "<br /><br /><br />";
|
||||||
echo "<b>".$text['header-upgrade_schema_results']."</b>";
|
echo "<b>".$text['header-upgrade_schema_results']."</b>";
|
||||||
echo "<br /><br />";
|
echo "<br /><br />";
|
||||||
echo $_SESSION["response_upgrade_schema"];
|
echo $_SESSION["schema"]["response"];
|
||||||
unset($_SESSION["response_upgrade_schema"]);
|
unset($_SESSION["schema"]["response"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|||||||
+19
-35
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -32,13 +32,7 @@
|
|||||||
set_include_path($document_root);
|
set_include_path($document_root);
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||||
$response_format = 'text'; //html, text
|
$format = 'text'; //html, text
|
||||||
|
|
||||||
//add multi-lingual support
|
|
||||||
require_once "app_languages.php";
|
|
||||||
foreach($text as $key => $value) {
|
|
||||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
include "root.php";
|
include "root.php";
|
||||||
@@ -51,39 +45,28 @@
|
|||||||
echo "access denied";
|
echo "access denied";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$format = 'html';
|
||||||
//add multi-lingual support
|
|
||||||
require_once "app_languages.php";
|
|
||||||
foreach($text as $key => $value) {
|
|
||||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the default
|
//add multi-lingual support
|
||||||
if (!isset($response_output)) {
|
require_once "app_languages.php";
|
||||||
$response_output = "echo";
|
foreach($text as $key => $value) {
|
||||||
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||||
}
|
}
|
||||||
|
|
||||||
//include the header
|
//show the title
|
||||||
if ($response_output == "echo") {
|
if ($format == 'text') {
|
||||||
require_once "resources/header.php";
|
echo "\n";
|
||||||
|
echo $text['label-upgrade']."\n";
|
||||||
|
echo "-----------------------------------------\n";
|
||||||
|
echo "\n";
|
||||||
|
echo $text['label-database']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($response_format == 'text') {
|
|
||||||
echo "\n";
|
|
||||||
echo $text['label-upgrade']."\n";
|
|
||||||
echo "-----------------------------------------\n";
|
|
||||||
echo "\n";
|
|
||||||
echo $text['label-database']."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
//make sure the database schema and installation have performed all necessary tasks
|
//make sure the database schema and installation have performed all necessary tasks
|
||||||
$display_results = false;
|
|
||||||
$display_type = 'none';
|
|
||||||
require_once "resources/classes/schema.php";
|
require_once "resources/classes/schema.php";
|
||||||
$obj = new schema;
|
$obj = new schema;
|
||||||
$obj->schema($db, $db_type, $db_name, $display_type);
|
echo $obj->schema("text");
|
||||||
|
|
||||||
//run all app_defaults.php files
|
//run all app_defaults.php files
|
||||||
require_once "resources/classes/domains.php";
|
require_once "resources/classes/domains.php";
|
||||||
@@ -91,7 +74,7 @@ if ($response_format == 'text') {
|
|||||||
$domain->upgrade();
|
$domain->upgrade();
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
if ($response_format == 'html') {
|
if ($format == 'html') {
|
||||||
echo "<div align='center'>\n";
|
echo "<div align='center'>\n";
|
||||||
echo "<table width='40%'>\n";
|
echo "<table width='40%'>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
@@ -111,12 +94,13 @@ if ($response_format == 'text') {
|
|||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
}
|
}
|
||||||
elseif ($response_format == 'text') {
|
elseif ($format == 'text') {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
if ($response_output == "echo") {
|
if ($format == "html") {
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
set_include_path($document_root);
|
set_include_path($document_root);
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||||
$display_type = 'text'; //html, text
|
$format = 'text'; //html, text
|
||||||
}
|
}
|
||||||
else if (!$included) {
|
else if (!$included) {
|
||||||
include "root.php";
|
include "root.php";
|
||||||
@@ -48,6 +48,7 @@
|
|||||||
echo "access denied";
|
echo "access denied";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$format = 'html'; //html, text
|
||||||
}
|
}
|
||||||
|
|
||||||
//run all app_defaults.php files
|
//run all app_defaults.php files
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
// set included, if not
|
// set included, if not
|
||||||
if (!isset($included)) { $included = false; }
|
if (!isset($included)) { $included = false; }
|
||||||
|
|
||||||
|
|
||||||
//check the permission
|
//check the permission
|
||||||
if(defined('STDIN')) {
|
if(defined('STDIN')) {
|
||||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
set_include_path($document_root);
|
set_include_path($document_root);
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||||
$response_format = 'text'; //html, text
|
$format = 'text'; //html, text
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
require_once "app_languages.php";
|
require_once "app_languages.php";
|
||||||
@@ -57,31 +56,18 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
|
||||||
require_once "app_languages.php";
|
|
||||||
foreach($text as $key => $value) {
|
|
||||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once "resources/header.php";
|
require_once "resources/header.php";
|
||||||
$document['title'] = $text['title-upgrade_schema'];
|
$document['title'] = $text['title-upgrade_schema'];
|
||||||
|
|
||||||
$response_format = 'html'; //html, text
|
$format = 'html'; //html, text
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the default
|
//get the database schema put it into an array then compare and update the database as needed.
|
||||||
if (!isset($response_output)) {
|
|
||||||
$response_output = "echo";
|
|
||||||
}
|
|
||||||
|
|
||||||
//load the default database into memory and compare it with the active database
|
|
||||||
require_once "resources/classes/schema.php";
|
require_once "resources/classes/schema.php";
|
||||||
$obj = new schema;
|
$obj = new schema;
|
||||||
$obj->schema($db, $db_type, $db_name, $response_output);
|
echo $obj->schema($format);
|
||||||
unset($apps);
|
|
||||||
|
|
||||||
|
if (!$included && $format == 'html') {
|
||||||
if (!$included && $response_output == 'echo' && $response_format == 'html') {
|
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2013
|
Copyright (C) 2013 - 2014
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -445,16 +445,23 @@ include "root.php";
|
|||||||
}
|
}
|
||||||
|
|
||||||
//datatase schema
|
//datatase schema
|
||||||
public function schema ($db, $db_type, $db_name, $response_output) {
|
public function schema ($format) {
|
||||||
//set the global variables
|
|
||||||
global $db;
|
//set the global variable
|
||||||
global $text; // pulls in language variable array
|
global $db, $db_type, $db_name, $db_username, $db_password;
|
||||||
global $response_format;
|
global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
|
||||||
global $upgrade_data_types;
|
|
||||||
|
|
||||||
//get the PROJECT PATH
|
//get the PROJECT PATH
|
||||||
include "root.php";
|
include "root.php";
|
||||||
|
|
||||||
|
//add multi-lingual support
|
||||||
|
if (!isset($text)) {
|
||||||
|
require "core/upgrade/app_languages.php";
|
||||||
|
foreach($text as $key => $value) {
|
||||||
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//PHP PDO check if table or column exists
|
//PHP PDO check if table or column exists
|
||||||
//check if table exists
|
//check if table exists
|
||||||
// SELECT * FROM sqlite_master WHERE type='table' AND name='v_cdr'
|
// SELECT * FROM sqlite_master WHERE type='table' AND name='v_cdr'
|
||||||
@@ -709,7 +716,7 @@ include "root.php";
|
|||||||
$response = '';
|
$response = '';
|
||||||
|
|
||||||
//display results as html
|
//display results as html
|
||||||
if ($response_output != '' && $response_format == "html") {
|
if ($format == "html") {
|
||||||
//show the database type
|
//show the database type
|
||||||
$response .= "<strong>".$text['header-database_type'].": ".$db_type. "</strong><br /><br />";
|
$response .= "<strong>".$text['header-database_type'].": ".$db_type. "</strong><br /><br />";
|
||||||
//start the table
|
//start the table
|
||||||
@@ -812,11 +819,11 @@ include "root.php";
|
|||||||
|
|
||||||
//loop line by line through all the lines of sql code
|
//loop line by line through all the lines of sql code
|
||||||
$x = 0;
|
$x = 0;
|
||||||
if (strlen($sql_update) == 0 && $response_format == "text") {
|
if (strlen($sql_update) == 0 && $format == "text") {
|
||||||
$response .= " ".$text['label-schema'].": ".$text['label-no_change']."\n";
|
$response .= " ".$text['label-schema'].": ".$text['label-no_change']."\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($response_format == "text") {
|
if ($format == "text") {
|
||||||
$response .= " ".$text['label-schema'].":\n";
|
$response .= " ".$text['label-schema'].":\n";
|
||||||
}
|
}
|
||||||
//$db->beginTransaction();
|
//$db->beginTransaction();
|
||||||
@@ -825,14 +832,12 @@ include "root.php";
|
|||||||
if (strlen(trim($sql))) {
|
if (strlen(trim($sql))) {
|
||||||
try {
|
try {
|
||||||
$db->query(trim($sql));
|
$db->query(trim($sql));
|
||||||
if ($response_format == "text") {
|
if ($format == "text") {
|
||||||
$response .= " $sql\n";
|
$response .= " $sql\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDOException $error) {
|
catch (PDOException $error) {
|
||||||
if ($response_output != '') {
|
$response .= " error: " . $error->getMessage() . " sql: $sql<br/>";
|
||||||
$response .= " error: " . $error->getMessage() . " sql: $sql<br/>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -842,12 +847,12 @@ include "root.php";
|
|||||||
}
|
}
|
||||||
|
|
||||||
//handle response
|
//handle response
|
||||||
if ($response_output == "echo") {
|
//if ($output == "echo") {
|
||||||
echo $response;
|
// echo $response;
|
||||||
}
|
//}
|
||||||
else if ($response_output == "return") {
|
//else if ($output == "return") {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
//}
|
||||||
|
|
||||||
} //end function
|
} //end function
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user