Fix to cure uninitialized variable warnings whenever schema is called.
Also many minor warning bug fixes in schema.php Might as well take the plunge and go to default show warnings. Uninitialized variable and small bug fixes install fusionpbx
This commit is contained in:
@@ -49,6 +49,7 @@
|
|||||||
$db_create = '';
|
$db_create = '';
|
||||||
$db_create_username = '';
|
$db_create_username = '';
|
||||||
$db_create_password = '';
|
$db_create_password = '';
|
||||||
|
$db = NULL;
|
||||||
|
|
||||||
//detect the iso country code from the locale
|
//detect the iso country code from the locale
|
||||||
//$locale = Locale::getDefault();
|
//$locale = Locale::getDefault();
|
||||||
@@ -133,7 +134,7 @@
|
|||||||
$onload = '';
|
$onload = '';
|
||||||
|
|
||||||
//buffer the content
|
//buffer the content
|
||||||
ob_end_clean(); //clean the buffer
|
if (sizeof(ob_get_status())!=0) ob_end_clean(); //clean the buffer
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$messages = array();
|
$messages = array();
|
||||||
@@ -243,7 +244,7 @@
|
|||||||
include "resources/page_parts/install_config_database.php";
|
include "resources/page_parts/install_config_database.php";
|
||||||
}
|
}
|
||||||
elseif($install_step == 'execute'){
|
elseif($install_step == 'execute'){
|
||||||
echo "<p><b>".$text['header-installing']."</b></p>\n";
|
echo "<p><b>".$text['header-installing'][$install_language]."</b></p>\n";
|
||||||
//$protocol = 'http';
|
//$protocol = 'http';
|
||||||
//if($_SERVER['HTTPS']) { $protocol = 'https'; }
|
//if($_SERVER['HTTPS']) { $protocol = 'https'; }
|
||||||
//echo "<iframe src='$protocol://$domain_name/core/install/install_first_time.php' style='border:solid 1px #000;width:100%;height:auto'></iframe>";
|
//echo "<iframe src='$protocol://$domain_name/core/install/install_first_time.php' style='border:solid 1px #000;width:100%;height:auto'></iframe>";
|
||||||
@@ -364,4 +365,4 @@
|
|||||||
//send the content to the browser and then clear the variable
|
//send the content to the browser and then clear the variable
|
||||||
echo $content;
|
echo $content;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ include "root.php";
|
|||||||
$this->write_progress("\tExecuting config.php");
|
$this->write_progress("\tExecuting config.php");
|
||||||
require $this->config_php;
|
require $this->config_php;
|
||||||
global $db;
|
global $db;
|
||||||
$db = $this->dbh;
|
|
||||||
$this->create_database();
|
$this->create_database();
|
||||||
|
$db = $this->dbh;
|
||||||
$this->create_domain();
|
$this->create_domain();
|
||||||
$this->create_superuser();
|
$this->create_superuser();
|
||||||
$this->app_defaults();
|
$this->app_defaults();
|
||||||
@@ -193,8 +193,8 @@ include "root.php";
|
|||||||
$tmp_config .= " //show errors\n";
|
$tmp_config .= " //show errors\n";
|
||||||
$tmp_config .= " ini_set('display_errors', '1');\n";
|
$tmp_config .= " ini_set('display_errors', '1');\n";
|
||||||
$tmp_config .= " //error_reporting (E_ALL); // Report everything\n";
|
$tmp_config .= " //error_reporting (E_ALL); // Report everything\n";
|
||||||
$tmp_config .= " //error_reporting (E_ALL ^ E_NOTICE); // Report everything\n";
|
$tmp_config .= " error_reporting (E_ALL ^ E_NOTICE); // Report everything\n";
|
||||||
$tmp_config .= " error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings";
|
$tmp_config .= " //error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings";
|
||||||
$tmp_config .= "\n";
|
$tmp_config .= "\n";
|
||||||
$tmp_config .= "?>";
|
$tmp_config .= "?>";
|
||||||
|
|
||||||
@@ -727,6 +727,8 @@ include "root.php";
|
|||||||
$salt = generate_password('20', '4');
|
$salt = generate_password('20', '4');
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->admin_uuid = $result['user_uuid'];
|
$this->admin_uuid = $result['user_uuid'];
|
||||||
|
$user_uuid = $result['user_uuid'];
|
||||||
|
$_SESSION["user_uuid"] = $this->admin_uuid;
|
||||||
$this->write_progress("... superuser exists as '" . $this->admin_uuid . "', updating password");
|
$this->write_progress("... superuser exists as '" . $this->admin_uuid . "', updating password");
|
||||||
$sql = "update v_users ";
|
$sql = "update v_users ";
|
||||||
$sql .= "set password = '".md5($salt.$this->admin_password)."' ";
|
$sql .= "set password = '".md5($salt.$this->admin_password)."' ";
|
||||||
@@ -739,7 +741,7 @@ include "root.php";
|
|||||||
$this->write_progress("\t... creating super user");
|
$this->write_progress("\t... creating super user");
|
||||||
//add a user and then add the user to the superadmin group
|
//add a user and then add the user to the superadmin group
|
||||||
//prepare the values
|
//prepare the values
|
||||||
$this->admin_uuid = uuid();
|
$user_uuid = $this->admin_uuid = uuid();
|
||||||
$contact_uuid = uuid();
|
$contact_uuid = uuid();
|
||||||
//set a sessiong variable
|
//set a sessiong variable
|
||||||
$_SESSION["user_uuid"] = $user_uuid;
|
$_SESSION["user_uuid"] = $user_uuid;
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ if (!class_exists('schema')) {
|
|||||||
$sql = '';
|
$sql = '';
|
||||||
$sql_schema = '';
|
$sql_schema = '';
|
||||||
foreach ($this->apps as $app) {
|
foreach ($this->apps as $app) {
|
||||||
if (count($app['db'])) {
|
if (isset($app['db']) && count($app['db'])) {
|
||||||
foreach ($app['db'] as $row) {
|
foreach ($app['db'] as $row) {
|
||||||
//create the sql string
|
//create the sql string
|
||||||
$table_name = $row['table'];
|
$table_name = $row['table'];
|
||||||
$sql = "CREATE TABLE " . $row['table'] . " (\n";
|
$sql = "CREATE TABLE " . $row['table'] . " (\n";
|
||||||
$field_count = 0;
|
$field_count = 0;
|
||||||
foreach ($row['fields'] as $field) {
|
foreach ($row['fields'] as $field) {
|
||||||
if ($field['deprecated'] == "true") {
|
if (isset($field['deprecated']) and ($field['deprecated'] == "true")) {
|
||||||
//skip this field
|
//skip this field
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -84,10 +84,10 @@ if (!class_exists('schema')) {
|
|||||||
else {
|
else {
|
||||||
$sql .= $field['type'];
|
$sql .= $field['type'];
|
||||||
}
|
}
|
||||||
if ($field['key']['type'] == "primary") {
|
if (isset($field['key']) && isset($field['key']['type']) && ($field['key']['type'] == "primary")) {
|
||||||
$sql .= " PRIMARY KEY";
|
$sql .= " PRIMARY KEY";
|
||||||
}
|
}
|
||||||
if ($field['key']['type'] == "foreign") {
|
if (isset($field['key']) && isset($field['key']['type']) && ($field['key']['type'] == "foreign")) {
|
||||||
if ($this->db_type == "pgsql") {
|
if ($this->db_type == "pgsql") {
|
||||||
//$sql .= " references ".$field['key']['reference']['table']."(".$field['key']['reference']['field'].")";
|
//$sql .= " references ".$field['key']['reference']['table']."(".$field['key']['reference']['field'].")";
|
||||||
}
|
}
|
||||||
@@ -456,10 +456,11 @@ if (!class_exists('schema')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//datatase schema
|
//datatase schema
|
||||||
public function schema ($format) {
|
public function schema ($format = '') {
|
||||||
|
|
||||||
//set the global variable
|
//set the global variable
|
||||||
global $upgrade_data_types, $text;
|
global $db, $upgrade_data_types, $text,$output_format;
|
||||||
|
if ($format=='') $format = $output_format;
|
||||||
|
|
||||||
//get the db variables
|
//get the db variables
|
||||||
$config = new config;
|
$config = new config;
|
||||||
@@ -520,7 +521,7 @@ if (!class_exists('schema')) {
|
|||||||
//update the app db array add exists true or false
|
//update the app db array add exists true or false
|
||||||
$sql = '';
|
$sql = '';
|
||||||
foreach ($apps as $x => &$app) {
|
foreach ($apps as $x => &$app) {
|
||||||
foreach ($app['db'] as $y => &$row) {
|
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||||
if (is_array($row['table'])) {
|
if (is_array($row['table'])) {
|
||||||
$table_name = $row['table']['text'];
|
$table_name = $row['table']['text'];
|
||||||
}
|
}
|
||||||
@@ -571,7 +572,7 @@ if (!class_exists('schema')) {
|
|||||||
|
|
||||||
//add missing tables and fields
|
//add missing tables and fields
|
||||||
foreach ($apps as $x => &$app) {
|
foreach ($apps as $x => &$app) {
|
||||||
foreach ($app['db'] as $y => &$row) {
|
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||||
if (is_array($row['table'])) {
|
if (is_array($row['table'])) {
|
||||||
$table_name = $row['table']['text'];
|
$table_name = $row['table']['text'];
|
||||||
if (!$this->db_table_exists($db_type, $db_name, $row['table']['text'])) {
|
if (!$this->db_table_exists($db_type, $db_name, $row['table']['text'])) {
|
||||||
@@ -707,7 +708,7 @@ if (!class_exists('schema')) {
|
|||||||
}
|
}
|
||||||
//rebuild and populate the table
|
//rebuild and populate the table
|
||||||
foreach ($apps as $x => &$app) {
|
foreach ($apps as $x => &$app) {
|
||||||
foreach ($app['db'] as $y => &$row) {
|
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||||
if (is_array($row['table'])) {
|
if (is_array($row['table'])) {
|
||||||
$table_name = $row['table']['text'];
|
$table_name = $row['table']['text'];
|
||||||
}
|
}
|
||||||
@@ -764,7 +765,7 @@ if (!class_exists('schema')) {
|
|||||||
//build the html while looping through the app db array
|
//build the html while looping through the app db array
|
||||||
$sql = '';
|
$sql = '';
|
||||||
foreach ($apps as &$app) {
|
foreach ($apps as &$app) {
|
||||||
foreach ($app['db'] as $row) {
|
if (isset($app['db'])) foreach ($app['db'] as $row) {
|
||||||
if (is_array($row['table'])) {
|
if (is_array($row['table'])) {
|
||||||
$table_name = $row['table']['text'];
|
$table_name = $row['table']['text'];
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -23,8 +23,8 @@
|
|||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
//error_reporting(E_ALL ^ E_NOTICE); //hide notices
|
error_reporting(E_ALL ^ E_NOTICE); //hide notices
|
||||||
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
|
//error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
|
||||||
//error_reporting(E_ALL);
|
//error_reporting(E_ALL);
|
||||||
|
|
||||||
//session handling
|
//session handling
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
ini_set("session.cookie_httponly", True);
|
ini_set("session.cookie_httponly", True);
|
||||||
session_start();
|
session_start();
|
||||||
//regenerate sessions to avoid session id attacks such as session fixation
|
//regenerate sessions to avoid session id attacks such as session fixation
|
||||||
if ($_SESSION['security']['session_rotate']['boolean'] == "true") {
|
if (array_key_exists('security',$_SESSION) and $_SESSION['security']['session_rotate']['boolean'] == "true") {
|
||||||
$_SESSION['session']['last_activity'] = time();
|
$_SESSION['session']['last_activity'] = time();
|
||||||
if (!isset($_SESSION['session']['created'])) {
|
if (!isset($_SESSION['session']['created'])) {
|
||||||
$_SESSION['session']['created'] = time();
|
$_SESSION['session']['created'] = time();
|
||||||
|
|||||||
Reference in New Issue
Block a user