This commit is contained in:
markjcrane 2016-04-02 08:23:18 -06:00
commit 827c9d5a50
9 changed files with 218 additions and 201 deletions

View File

@ -61,18 +61,18 @@ else {
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th id='th_filler' style='display: none; padding: 0px;'>".img_spacer('21px', '1px', 'none')."</th>\n";
echo "<th id='th_filler' style='display: none; padding: 0px;'>".img_spacer('21px', '1px')."</th>\n";
echo "<th width='20%'>".$text['label-time_user']."</th>\n";
echo "<th width='20%'>".$text['label-time_start']."</th>\n";
echo "<th width='20%'>".$text['label-time_duration']."</th>\n";
echo "<th width='40%'>".$text['label-time_description']."</th>\n";
echo "<td class='list_control_icons' nowrap>";
echo img_spacer('25px', '1px', 'none');
echo img_spacer('25px', '1px');
if (permission_exists('contact_time_add')) {
echo "<a href='contact_time_edit.php?contact_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo img_spacer('25px', '1px', 'none');
echo img_spacer('25px', '1px');
}
echo "</td>\n";
echo "</tr>\n";

View File

@ -760,7 +760,7 @@ else {
//end the row
echo "</tr>\n";
if ($index != 999) {
echo "<tr><td colspan='7' style='margin: 0; padding: 0;'><img src='about:blank;' style='width: 100%; height: 1px; border-bottom: 1px solid #e5e9f0; margin: 0; padding: 0; display: block;'></td></tr>";
echo "<tr><td colspan='7' style='margin: 0; padding: 0;'>".(img_spacer('100%', '1px', 'border-bottom: 1px solid #e5e9f0; margin: 0; padding: 0; display: block;'))."</td></tr>";
}
//increment the value
$x++;

View File

@ -427,7 +427,7 @@ else {
}
else {
if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
echo " <img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' style='background: ".$row['default_setting_value']."; width: 15px; height: 15px; margin-right: 4px; vertical-align: middle; border: 1px solid ".(color_adjust($row['default_setting_value'], -0.18))."; padding: -1px;'>";
echo " ".(img_spacer('15px', '15px', 'background: '.$row['default_setting_value'].'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['default_setting_value'], -0.18)).'; padding: -1px;'));
echo "<span style=\"font-family: 'Courier New'; line-height: 6pt;\">".htmlspecialchars($row['default_setting_value'])."</span>\n";
}
else {

View File

@ -224,13 +224,13 @@ if (sizeof($_REQUEST) > 1) {
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
}
}
elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
else if ($category == "domain" && $subcategory == "template" && $name == "name" ) {
echo " ".ucwords($row['domain_setting_value']);
}
else if ($category == "domain" && $subcategory == "time_format" && $name == "text" ) {
switch ($row['domain_setting_value'] == '12h') {
case '12h': echo " ".$text['label-12-hour']; break;
case '24h': echo " ".$text['label-24-hour']; break;
switch ($row['domain_setting_value']) {
case '12h': echo $text['label-12-hour']; break;
case '24h': echo $text['label-24-hour']; break;
}
}
else if (
@ -247,16 +247,13 @@ if (sizeof($_REQUEST) > 1) {
}
else {
if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
$border = (
substr_count(strtolower($row['domain_setting_value']), '#fff') > 0 ||
substr_count(strtolower($row['domain_setting_value']), '#ffffff') > 0 ||
substr_count(str_replace(' ','',strtolower($row['domain_setting_value'])), '255,255,255,') > 0
) ? "border: 1px solid #ccc; padding: -1px;" : null;
echo " <img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' style='background: ".$row['domain_setting_value']."; width: 15px; height: 15px; margin-right: 4px; vertical-align: middle; ".$border."'>";
echo " ".(img_spacer('15px', '15px', 'background: '.$row['domain_setting_value'].'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['domain_setting_value'], -0.18)).'; padding: -1px;'));
echo "<span style=\"font-family: 'Courier New'; line-height: 6pt;\">".htmlspecialchars($row['domain_setting_value'])."</span>\n";
}
else {
echo " ".htmlspecialchars($row['domain_setting_value'])."\n";
}
echo " ".htmlspecialchars($row['domain_setting_value']);
}
echo " &nbsp;\n";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center;'>\n";
echo " <a href='?domain_id=".$row['domain_uuid']."&id[]=".$row['domain_setting_uuid']."&enabled=".(($row['domain_setting_enabled'] == 'true') ? 'false' : 'true')."'>".$text['label-'.$row['domain_setting_enabled']]."</a>\n";

View File

@ -332,12 +332,20 @@ include "root.php";
if ($this->global_settings->db_create()) {
//attempt to create new Postgres role and database
$this->write_progress("\tCreating database");
$db_create_username = $this->global_settings->db_create_username();
$db_create_password = $this->global_settings->db_create_password();
$db_host = $this->global_settings->db_host();
$db_port = $this->global_settings->db_port();
if(strlen($db_create_username) == 0){
$db_create_username = $this->global_settings->db_username();
$db_create_password = $this->global_settings->db_password();
}
if (strlen($db_host) == 0) {
$db_host = 'localhost';
}
try {
if (strlen($this->global_settings->db_host()) > 0) {
$this->dbh = new PDO("pgsql:host={$this->global_settings->db_host()} port={$this->global_settings->db_port()} user={$this->global_settings->db_create_username()} password={$this->global_settings->db_create_password()} dbname=template1");
} else {
$this->dbh = new PDO("pgsql:host=localhost port={$this->global_settings->db_port()} user={$this->global_settings->db_create_username()} password={$this->global_settings->db_create_password()} dbname=template1");
}
$this->dbh = new PDO("pgsql:host=$db_host port=$db_port user=$db_create_username password=$db_create_password dbname=template1");
} catch (PDOException $error) {
throw new Exception("error connecting to database in order to create: " . $error->getMessage());
}
@ -346,11 +354,12 @@ include "root.php";
if($this->dbh->exec("CREATE DATABASE {$this->global_settings->db_name()}") === false) {
throw new Exception("Failed to create database {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo()));
}
if($this->global_settings->db_username() != $this->global_settings->db_create_username()){
if($this->global_settings->db_username() != $db_create_username){
if($this->dbh->exec("CREATE USER {$this->global_settings->db_username()} WITH PASSWORD '{$this->global_settings->db_password()}'") === false){
throw new Exception("Failed to create user {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo()));
// user may be already exists
// throw new Exception("Failed to create user {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo()));
}
if($this->dbh->exec("GRANT ALL ON {$this->global_settings->db_name()} TO {$this->global_settings->db_username()}") === false){
if($this->dbh->exec("GRANT ALL ON DATABASE {$this->global_settings->db_name()} TO {$this->global_settings->db_username()}") === false){
throw new Exception("Failed to create user {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo()));
}
}
@ -410,128 +419,148 @@ include "root.php";
}
protected function create_database_mysql() {
//database connection
$connect_string;
if (strlen($this->global_settings->db_host()) == 0 && strlen($this->global_settings->db_port()) == 0) {
//if both host and port are empty use the unix socket
$connect_string = "mysql:host=$this->global_settings->db_host();unix_socket=/var/run/mysqld/mysqld.sock;";
}
elseif (strlen($this->global_settings->db_port()) == 0) {
//leave out port if it is empty
$connect_string = "mysql:host=$this->global_settings->db_host();";
}
else {
$connect_string = "mysql:host=$this->global_settings->db_host();port=$this->global_settings->db_port();";
}
//database connection
$connect_string;
if (strlen($this->global_settings->db_host()) == 0 && strlen($this->global_settings->db_port()) == 0) {
//if both host and port are empty use the unix socket
$connect_string = "mysql:host={$this->global_settings->db_host()};unix_socket=/var/run/mysqld/mysqld.sock;";
}
elseif (strlen($this->global_settings->db_port()) == 0) {
//leave out port if it is empty
$connect_string = "mysql:host={$this->global_settings->db_host()};";
}
else {
$connect_string = "mysql:host={$this->global_settings->db_host()};port={$this->global_settings->db_port()};";
}
//create the table, user and set the permissions only if the db_create_username was provided
if ($this->global_settings->db_create_username()) {
//if we need create new database
if ($this->global_settings->db_create()) {
//attempt to create new user and database
$this->write_progress("\tCreating database");
$db_create_username = $this->global_settings->db_create_username();
$db_create_password = $this->global_settings->db_create_password();
if(strlen($db_create_username) == 0){
$db_create_username = $this->global_settings->db_username();
$db_create_password = $this->global_settings->db_password();
}
//connect to MySQL
try {
$this->dbh = new PDO($connect_string, $this->global_settings->db_create_username(), $this->global_settings->db_create_password(), array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$this->dbh = new PDO($connect_string, $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
}
catch (PDOException $error) {
throw new Exception("error connecting to database for ccreate: " . $error->getMessage() . "\n" . $sql );
throw new Exception("error connecting to database for create: " . $error->getMessage() . "\n" . $sql );
}
//select the mysql database
try {
$this->dbh->query("USE mysql;");
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//create user and set the permissions
try {
$tmp_sql = "CREATE USER '".$this->global_settings->db_username()."'@'%' IDENTIFIED BY '".$this->global_settings->db_password()."'; ";
$this->dbh->query($tmp_sql);
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//select the mysql database
try {
$this->dbh->query("USE mysql;");
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//set account to unlimited use
try {
if ($this->global_settings->db_host() == "localhost" || $this->global_settings->db_host() == "127.0.0.1") {
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'localhost' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'127.0.0.1' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
//create user if we use separeate user to access and create
if($this->global_settings->db_username() != $db_create_username) {
//create user and set the permissions
try {
$tmp_sql = "CREATE USER '".$this->global_settings->db_username()."'@'%' IDENTIFIED BY '".$this->global_settings->db_password()."'; ";
$this->dbh->query($tmp_sql);
}
else {
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'".$this->global_settings->db_host()."' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
catch (PDOException $error) {
// ignore error here because user may already exists
// (e.g. reinstall can be done via remove db)
// throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//create the database and set the create user with permissions
try {
$tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->global_settings->db_name()."; ";
$this->dbh->query($tmp_sql);
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//set account to unlimited use
try {
if ($this->global_settings->db_host() == "localhost" || $this->global_settings->db_host() == "127.0.0.1") {
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'localhost' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
//set user permissions
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'127.0.0.1' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
}
else {
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'".$this->global_settings->db_host()."' ";
$tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
}
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
}
//create the database and set the create user with permissions
try {
$tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->global_settings->db_name()."; ";
$this->dbh->query($tmp_sql);
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//set user permissions
if($this->global_settings->db_username() != $db_create_username) {
try {
$this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->global_settings->db_name().".* TO '".$this->global_settings->db_username()."'@'%'; ");
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
}
//make the changes active
try {
$tmp_sql = "FLUSH PRIVILEGES; ";
$this->dbh->query($tmp_sql);
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
$this->dbh = null;
} //if (strlen($this->global_settings->db_create_username()) > 0)
//make the changes active
try {
$tmp_sql = "FLUSH PRIVILEGES; ";
$this->dbh->query($tmp_sql);
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
$this->dbh = null;
}
$this->write_progress("\tInstalling data to database");
$this->write_progress("\tInstalling data to database");
//select the database
try {
$this->dbh = new PDO($connect_string, $this->global_settings->db_username(), db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
}
catch (PDOException $error) {
throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql );
}
try {
$this->dbh->query("USE ".$this->global_settings->db_name().";");
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//connect to the database
try {
$this->dbh = new PDO($connect_string, $this->global_settings->db_username(), $this->global_settings->db_password(), array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
}
catch (PDOException $error) {
throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql );
}
//add the database structure
require_once "resources/classes/schema.php";
$schema = new schema;
$schema->db = $this->dbh;
$schema->db_type = $this->global_settings->db_type();
$schema->sql();
$schema->exec();
//select the database
try {
$this->dbh->query("USE ".$this->global_settings->db_name().";");
}
catch (PDOException $error) {
throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql );
}
//add the defaults data into the database
//get the contents of the sql file
//add the database structure
require_once "resources/classes/schema.php";
$schema = new schema;
$schema->db = $this->dbh;
$schema->db_type = $this->global_settings->db_type();
$schema->sql();
$schema->exec();
//add the defaults data into the database
//get the contents of the sql file
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql')){
$filename = "/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql";
}
@ -540,28 +569,28 @@ include "root.php";
}
$file_contents = file_get_contents($filename);
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//loop line by line through all the lines of sql code
$string_array = explode("\n", $file_contents);
$x = 0;
foreach($string_array as $sql) {
if (strlen($sql) > 3) {
try {
if ($this->debug) {
$this->write_debug( $sql."\n");
}
$this->dbh->query($sql);
}
catch (PDOException $error) {
//echo "error on line $x: " . $error->getMessage() . " sql: $sql<br/>";
//die();
//loop line by line through all the lines of sql code
$string_array = explode("\n", $file_contents);
$x = 0;
foreach($string_array as $sql) {
if (strlen($sql) > 3) {
try {
if ($this->debug) {
$this->write_debug( $sql."\n");
}
$this->dbh->query($sql);
}
catch (PDOException $error) {
//echo "error on line $x: " . $error->getMessage() . " sql: $sql<br/>";
//die();
}
$x++;
}
unset ($file_contents, $sql);
$x++;
}
unset ($file_contents, $sql);
}
protected function create_domain() {
@ -1000,7 +1029,7 @@ include "root.php";
$_SESSION['event_socket_ip_address'] = $this->global_settings->event_host;
$_SESSION['event_socket_port'] = $this->global_settings->event_port;
$_SESSION['event_socket_password'] = $this->global_settings->event_password;
//get the groups assigned to the user and then set the groups in $_SESSION["groups"]
$sql = "SELECT * FROM v_group_users ";
$sql .= "where domain_uuid=:domain_uuid ";
@ -1012,7 +1041,7 @@ include "root.php";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$_SESSION["groups"] = $result;
unset($sql, $row_count, $prep_statement);
//get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions']
$x = 0;
$sql = "select distinct(permission_name) from v_group_permissions ";
@ -1031,7 +1060,7 @@ include "root.php";
$prep_statement_sub->execute();
$_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement_sub);
//include the config.php
$db_type = $this->global_settings->db_type();
$db_path = $this->global_settings->db_path();
@ -1040,23 +1069,23 @@ include "root.php";
$db_name = $this->global_settings->db_name();
$db_username = $this->global_settings->db_username();
$db_password = $this->global_settings->db_password();
//add the database structure
require_once "resources/classes/schema.php";
$schema = new schema;
echo $schema->schema();
//run all app_defaults.php files
$default_language = $this->install_language;
$domain = new domains;
$domain->upgrade();
//synchronize the config with the saved settings
save_switch_xml();
//do not show the apply settings reminder on the login page
$_SESSION["reload_xml"] = false;
//clear the menu
$_SESSION["menu"] = "";

View File

@ -52,7 +52,7 @@ include "root.php";
}else{
throw new Exception("Could not work out where to put the config.lua");
}
$this->config_lua = normalize_path_to_os($this->config_lua);
$this->config_lua = normalize_path($this->config_lua);
}
//utility Functions
@ -244,46 +244,46 @@ include "root.php";
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($this->global_settings->switch_sounds_dir()) > 0) {
$tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n");
$tmp .= normalize_path(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n");
}
if (strlen($this->global_settings->switch_phrases_vdir()) > 0) {
$tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n");
$tmp .= normalize_path(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n");
}
if (strlen($this->global_settings->switch_db_dir()) > 0) {
$tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n");
$tmp .= normalize_path(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n");
}
if (strlen($this->global_settings->switch_recordings_dir()) > 0) {
$tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n");
$tmp .= normalize_path(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n");
}
if (strlen($this->global_settings->switch_storage_dir()) > 0) {
$tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n");
$tmp .= normalize_path(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n");
}
if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) {
$tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n");
$tmp .= normalize_path(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n");
}
if (strlen($this->global_settings->switch_script_dir()) > 0) {
$tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n");
$tmp .= normalize_path(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n");
}
$tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n");
$tmp .= normalize_path(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$tmp .= " php_bin = \"php.exe\";\n";
}
else {
$tmp .= " php_bin = \"php\";\n";
}
$tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= normalize_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= "\n";
if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) {
$tmp .= "--database information\n";
$tmp .= " database = {}\n";
$tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n";
$tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n";
$tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n");
$tmp .= " database.type = \"".$this->global_settings->db_type()."\";\n";
$tmp .= " database.name = \"".$this->global_settings->db_name()."\";\n";
$tmp .= normalize_path(" database.path = [[".$this->global_settings->db_path()."]];\n");
if (strlen($dsn_name) > 0) {
$tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n";
$tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n";
$tmp .= " database.system = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n";
$tmp .= " database.switch = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n";
}
elseif ($this->global_settings->db_type() == "pgsql") {
$db_host = $this->global_settings->db_host();
@ -294,41 +294,41 @@ include "root.php";
else {
$host_type = "host";
}
$tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n";
$tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n";
$tmp .= " database.system = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n";
$tmp .= " database.switch = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n";
}
elseif ($this->global_settings->db_type() == "sqlite") {
$tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n";
$tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
$tmp .= " database.system = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n";
$tmp .= " database.switch = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
}
elseif ($this->global_settings->db_type() == "mysql") {
$tmp .= " database[\"system\"] = \"\";\n";
$tmp .= " database[\"switch\"] = \"\";\n";
$tmp .= " database.system = \"\";\n";
$tmp .= " database.switch = \"\";\n";
}
$tmp .= "\n";
}
$tmp .= "--set defaults\n";
$tmp .= " expire = {}\n";
$tmp .= " expire[\"directory\"] = \"3600\";\n";
$tmp .= " expire[\"dialplan\"] = \"3600\";\n";
$tmp .= " expire[\"languages\"] = \"3600\";\n";
$tmp .= " expire[\"sofia.conf\"] = \"3600\";\n";
$tmp .= " expire[\"acl.conf\"] = \"3600\";\n";
$tmp .= " expire.directory = \"3600\";\n";
$tmp .= " expire.dialplan = \"3600\";\n";
$tmp .= " expire.languages = \"3600\";\n";
$tmp .= " expire.sofia_conf = \"3600\";\n";
$tmp .= " expire.acl_conf = \"3600\";\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler[\"fs_path\"] = false;\n";
$tmp .= " xml_handler.fs_path = false;\n";
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug[\"params\"] = false;\n";
$tmp .= " debug[\"sql\"] = false;\n";
$tmp .= " debug[\"xml_request\"] = false;\n";
$tmp .= " debug[\"xml_string\"] = false;\n";
$tmp .= " debug[\"cache\"] = false;\n";
$tmp .= " debug.params = false;\n";
$tmp .= " debug.sql = false;\n";
$tmp .= " debug.xml_request = false;\n";
$tmp .= " debug.xml_string = false;\n";
$tmp .= " debug.cache = false;\n";
$tmp .= "\n";
$tmp .= "--additional info\n";
$tmp .= " domain_count = ".$this->global_settings->domain_count().";\n";
$tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n");
$tmp .= normalize_path(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n");
if (isset($_SESSION['domain']['dial_string']['text'])) {
$tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n";
}

View File

@ -142,15 +142,9 @@
echo " Create Database Options\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='none'";
if($db_create_option=='none') { echo " checked='checked'"; }
echo "/>Do not create database</label>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='same'";
if($db_create_option=='same') { echo " checked='checked'"; }
echo "/>Create database using above username/password</label>\n";
echo " <label class='radio'><input type='radio' name='create_db_option' value='user'";
if($db_create_option=='user') { echo " checked='checked'"; }
echo "/>Create database using below username/password</label>\n";
if($db_create=='1') { $checked = "checked='checked'"; } else { $checked = ''; }
echo " <input type='checkbox' name='db_create' value='1' $checked />&nbsp;";
echo "Create the database\n";
echo "<br />\n";
echo "Choose whether to create the database\n";
echo "</td>\n";

View File

@ -200,8 +200,8 @@ else {
}
else if ($category == "domain" && $subcategory == "time_format" && $name == "text" ) {
switch ($row['user_setting_value']) {
case '12h': echo " ".$text['label-12-hour']; break;
case '24h': echo " ".$text['label-24-hour']; break;
case '12h': echo $text['label-12-hour']; break;
case '24h': echo $text['label-24-hour']; break;
}
}
else if (
@ -218,16 +218,13 @@ else {
}
else {
if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
$border = (
substr_count(strtolower($row['user_setting_value']), '#fff') > 0 ||
substr_count(strtolower($row['user_setting_value']), '#ffffff') > 0 ||
substr_count(str_replace(' ','',strtolower($row['user_setting_value'])), '255,255,255,') > 0
) ? "border: 1px solid #ccc; padding: -1px;" : null;
echo " <img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' style='background: ".$row['user_setting_value']."; width: 15px; height: 15px; margin-right: 4px; vertical-align: middle; ".$border."'>";
echo " ".(img_spacer('15px', '15px', 'background: '.$row['user_setting_value'].'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['user_setting_value'], -0.18)).'; padding: -1px;'));
echo "<span style=\"font-family: 'Courier New'; line-height: 6pt;\">".htmlspecialchars($row['user_setting_value'])."</span>\n";
}
else {
echo " ".htmlspecialchars($row['user_setting_value'])."\n";
}
echo " ".htmlspecialchars($row['user_setting_value']);
}
echo " &nbsp;\n";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center;'>\n";
echo " <a href='?user_id=".$row['user_uuid']."&id[]=".$row['user_setting_uuid']."&enabled=".(($row['user_setting_enabled'] == 'true') ? 'false' : 'true')."'>".$text['label-'.$row['user_setting_enabled']]."</a>\n";

View File

@ -1566,8 +1566,8 @@ function number_pad($number,$n) {
//transparent gif
if (!function_exists('img_spacer')) {
function img_spacer($width = '1px', $height = '1px', $border = 'none') {
return "<img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' style='width: ".$width."; height: ".$height."; border: ".$border.";'>";
function img_spacer($width = '1px', $height = '1px', $custom = null) {
return "<img src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' style='width: ".$width."; height: ".$height."; ".$custom."'>";
}
}