コード例 #1
0
ファイル: install.php プロジェクト: bitplus/fusionpbx
 #set_error_handler("error_handler");
 try {
     require_once "resources/classes/global_settings.php";
     $global_settings = new global_settings($detect_switch, $domain_name);
     if (is_null($global_settings)) {
         throw new Exception("Error global_settings came back with null");
     }
     require_once "resources/classes/install_fusionpbx.php";
     $system = new install_fusionpbx($global_settings);
     $system->admin_username = $admin_username;
     $system->admin_password = $admin_password;
     $system->default_country = $install_default_country;
     $system->install_language = $install_language;
     $system->template_name = $install_template_name;
     require_once "resources/classes/install_switch.php";
     $switch = new install_switch($global_settings);
     //$switch->debug = true;
     //$system->debug = true;
     $switch->echo_progress = true;
     $system->echo_progress = true;
     $system->install_phase_1();
     $switch->install_phase_1();
     $system->install_phase_2();
     $switch->install_phase_2();
 } catch (Exception $e) {
     echo "</pre>\n";
     echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
     try {
         require_once "resources/classes/install_fusionpbx.php";
         $system = new install_fusionpbx($global_settings);
         $system->remove_config();
コード例 #2
0
ファイル: index.php プロジェクト: williambhadley/fusionpbx
         $_SESSION["response_source_update"] = $response_source_update;
         foreach ($response_source_update as $response_line) {
             if (substr_count($response_line, "Updating ") > 0 || substr_count($response_line, "Already up-to-date.") > 0) {
                 $update_failed = false;
             }
         }
     }
     if ($update_failed) {
         $_SESSION["message_delay"] = 3500;
         $_SESSION["message_mood"] = 'negative';
         $response_message = $text['message-upgrade_source_failed'];
     } else {
         //update scripts folder, if allowed (default)
         if ($_SESSION['switch']['scripts']['dir'] != '') {
             //copy the files and directories from resources/install
             $obj = new install_switch();
             $obj->upgrade();
             //set the message
             $response_message = $text['message-upgrade_source_scripts'];
         } else {
             //set the message
             $response_message = $text['message-upgrade_source'];
         }
     }
 }
 // load an array of the database schema and compare it with the active database
 if ($do["schema"] && permission_exists("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();
コード例 #3
0
    $included = false;
}
//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);
    require_once "resources/require.php";
    $_SERVER["DOCUMENT_ROOT"] = $document_root;
    $format = 'text';
    //html, text
} else {
    if (!$included) {
        include "root.php";
        require_once "resources/require.php";
        require_once "resources/check_auth.php";
        if (permission_exists('upgrade_switch') || if_group("superadmin")) {
            //echo "access granted";
        } else {
            echo "access denied";
            exit;
        }
        $format = 'html';
        //html, text
    }
}
//run switch upgrade
require_once "resources/classes/install_switch.php";
$switch = new install_switch();
$switch->upgrade();
コード例 #4
0
ファイル: domains.php プロジェクト: stefanomarty/fusionpbx
 public function upgrade()
 {
     //set the global variable
     global $db;
     //get the db variables
     $config = new config();
     $config_exists = $config->exists();
     $config_path = $config->find();
     $config->get();
     $db_type = $config->db_type;
     $db_name = $config->db_name;
     $db_username = $config->db_username;
     $db_password = $config->db_password;
     $db_host = $config->db_host;
     $db_path = $config->db_path;
     $db_port = $config->db_port;
     //get the PROJECT PATH
     include "root.php";
     //get the list of installed apps from the core and app directories (note: GLOB_BRACE doesn't work on some systems)
     $config_list_1 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
     $config_list_2 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_menu.php");
     $config_list = array_merge((array) $config_list_1, (array) $config_list_2);
     unset($config_list_1, $config_list_2);
     $x = 0;
     foreach ($config_list as &$config_path) {
         include $config_path;
         $x++;
     }
     //get the domain_uuid
     $sql = "select * from v_domains ";
     $prep_statement = $db->prepare($sql);
     $prep_statement->execute();
     $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     foreach ($result as $row) {
         if (count($result) == 1) {
             $_SESSION["domain_uuid"] = $row["domain_uuid"];
             $_SESSION["domain_name"] = $row['domain_name'];
         } else {
             if (lower_case($row['domain_name']) == lower_case($domain_array[0]) || lower_case($row['domain_name']) == lower_case('www.' . $domain_array[0])) {
                 $_SESSION["domain_uuid"] = $row["domain_uuid"];
                 $_SESSION["domain_name"] = $row['domain_name'];
             }
             $_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
             $_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
         }
     }
     unset($result, $prep_statement);
     //get the default settings
     $sql = "select * from v_default_settings ";
     $sql .= "where default_setting_enabled = 'true' ";
     $prep_statement = $db->prepare($sql);
     $prep_statement->execute();
     $result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     //loop through all domains
     $sql = "select * from v_domains ";
     $v_prep_statement = $db->prepare(check_sql($sql));
     $v_prep_statement->execute();
     $main_result = $v_prep_statement->fetchAll(PDO::FETCH_ASSOC);
     $domain_count = count($main_result);
     $domains_processed = 1;
     foreach ($main_result as &$row) {
         //get the values from database and set them as php variables
         $domain_uuid = $row["domain_uuid"];
         $domain_name = $row["domain_name"];
         //get the context
         $context = $domain_name;
         //show the domain when display_type is set to text
         if ($display_type == "text") {
             echo "\n";
             echo $domain_name;
             echo "\n";
         }
         //get the default settings - this needs to be done to reset the session values back to the defaults for each domain in the loop
         foreach ($result_defaults_settings as $row) {
             $name = $row['default_setting_name'];
             $category = $row['default_setting_category'];
             $subcategory = $row['default_setting_subcategory'];
             if (strlen($subcategory) == 0) {
                 if ($name == "array") {
                     $_SESSION[$category][] = $row['default_setting_value'];
                 } else {
                     $_SESSION[$category][$name] = $row['default_setting_value'];
                 }
             } else {
                 if ($name == "array") {
                     $_SESSION[$category][$subcategory][] = $row['default_setting_value'];
                 } else {
                     $_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid'];
                     $_SESSION[$category][$subcategory][$name] = $row['default_setting_value'];
                 }
             }
         }
         //get the domains settings
         $sql = "select * from v_domain_settings ";
         $sql .= "where domain_uuid = '" . $domain_uuid . "' ";
         $sql .= "and domain_setting_enabled = 'true' ";
         $prep_statement = $db->prepare($sql);
         $prep_statement->execute();
         $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
         foreach ($result as $row) {
             $name = $row['domain_setting_name'];
             $category = $row['domain_setting_category'];
             $subcategory = $row['domain_setting_subcategory'];
             if (strlen($subcategory) == 0) {
                 //$$category[$name] = $row['domain_setting_value'];
                 $_SESSION[$category][$name] = $row['domain_setting_value'];
             } else {
                 //$$category[$subcategory][$name] = $row['domain_setting_value'];
                 $_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
             }
         }
         //get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
         $default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
         foreach ($default_list as &$default_path) {
             include $default_path;
         }
         //track of the number of domains processed
         $domains_processed++;
     }
     unset($v_prep_statement);
     //synchronize the dialplan
     if (function_exists('save_dialplan_xml')) {
         save_dialplan_xml();
     }
     //update config.lua
     require_once "core/install/resources/classes/install_switch.php";
     $switch = new install_switch();
     $switch->create_config_lua();
     //clear the session variables
     unset($_SESSION['domain']);
     unset($_SESSION['switch']);
 }
コード例 #5
0
 try {
     require_once "resources/classes/install_fusionpbx.php";
     $system = new install_fusionpbx($domain_name, null, $switch_detect);
     $domain_uuid = $system->domain_uuid();
     $system->admin_username = $admin_username;
     $system->admin_password = $admin_password;
     $system->default_country = $install_default_country;
     $system->install_language = $install_language;
     $system->template_name = $install_template_name;
     foreach ($_POST as $key => $value) {
         if (substr($key, 0, 3) == "db_") {
             $system->{$key} = $value;
         }
     }
     require_once "resources/classes/install_switch.php";
     $switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
     //$switch->debug = true;
     //$system->debug = true;
     $system->install();
     $switch->install();
     $system->app_defaults();
     $switch_detect->restart_switch();
 } catch (Exception $e) {
     echo "</pre>\n";
     echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
     try {
         require_once "resources/classes/install_fusionpbx.php";
         $system = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
         $system->remove_config();
     } catch (Exception $e) {
         echo "<p><b>Failed to remove config:</b> " . $e->getMessage() . "</p>\n";