diff options
author | mcrane <mctch@yahoo.com> | 2009-08-10 20:53:36 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-08-10 20:53:36 -0600 |
commit | d27a83d678c19eb4237e193bb4eddffc4a83247c (patch) | |
tree | 11b344f0afb0b3e1f7c13fae591ffbad5c56ba56 | |
parent | ab5412cec92a1644d1cc9aba540d3f1987971341 (diff) | |
download | pfsense-packages-d27a83d678c19eb4237e193bb4eddffc4a83247c.tar.gz pfsense-packages-d27a83d678c19eb4237e193bb4eddffc4a83247c.tar.bz2 pfsense-packages-d27a83d678c19eb4237e193bb4eddffc4a83247c.zip |
FreeSWITCH dev package add a web interface update button to the status page to update the gui.
-rw-r--r-- | config/freeswitch_dev/v_config.inc | 171 | ||||
-rw-r--r-- | config/freeswitch_dev/v_status.tmp | 35 |
2 files changed, 123 insertions, 83 deletions
diff --git a/config/freeswitch_dev/v_config.inc b/config/freeswitch_dev/v_config.inc index b255e72c..aa2a26dc 100644 --- a/config/freeswitch_dev/v_config.inc +++ b/config/freeswitch_dev/v_config.inc @@ -33,12 +33,7 @@ require_once('config.inc'); require_once('globals.inc'); require_once('service-utils.inc'); -//global variables - $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0]; - foreach($v_settings_array as $name => $value) { - $$name = $value; - } - + //preferences $v_label_show = true; $v_path_show = true; @@ -52,7 +47,7 @@ function v_settings() $config['installedpackages']['freeswitchsettings']['config'][0]['tmp_dir'] = '/tmp'; $config['installedpackages']['freeswitchsettings']['config'][0]['bin_dir'] = '/usr/local/bin'; $config['installedpackages']['freeswitchsettings']['config'][0]['v_startup_script_dir'] = '/usr/local/etc/rc.d'; - $config['installedpackages']['freeswitchsettings']['config'][0]['v_package_version'] = "0.9.7.19"; + $config['installedpackages']['freeswitchsettings']['config'][0]['v_package_version'] = "0.9.7.20"; $config['installedpackages']['freeswitchsettings']['config'][0]['v_build_version'] = "1.0.4"; $config['installedpackages']['freeswitchsettings']['config'][0]['v_build_revision'] = "Release"; $config['installedpackages']['freeswitchsettings']['config'][0]['v_label'] = 'FreeSWITCH'; //FreeSWITCH (TM) http://www.freeswitch.org/ @@ -74,85 +69,97 @@ function v_settings() $config['installedpackages']['freeswitchsettings']['config'][0]['v_download_path'] = 'http://www.pfsense.com/packages/config/freeswitch_dev/'; } +//Update the settings +// v_settings(); +// write_config(); +$v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0]; +foreach($v_settings_array as $name => $value) { + $$name = $value; +} function build_menu() { - global $config; - $v_relative_url = $config['installedpackages']['freeswitchsettings']['config'][0]['v_relative_url']; - - //$script_name_array = split ("/", $_SERVER["SCRIPT_NAME"]); - //$script_name = $script_name_array[count($script_name_array)-1]; - //echo "script_name: ".$script_name."<br />"; - - $tab_array = array(); - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_settings.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Settings"), $menu_selected, $v_relative_url."/v_settings.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_details_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Dialplan"), $menu_selected, $v_relative_url."/v_dialplan_includes.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Extensions"), $menu_selected, $v_relative_url."/v_extensions.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_features.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_options_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_modules.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Features"), $menu_selected, $v_relative_url."/v_features.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Gateways"), $menu_selected, $v_relative_url."/v_gateways.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profiles.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profile_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Profiles"), $menu_selected, $v_relative_url."/v_profiles.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_details_edit.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Public"), $menu_selected, $v_relative_url."/v_public_includes.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_status.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Status"), $menu_selected, $v_relative_url."/v_status.php"); - unset($menu_selected); - - $menu_selected = false; - if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_vars.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Vars"), $menu_selected, $v_relative_url."/v_vars.php"); - unset($menu_selected); - - display_top_tabs($tab_array); + global $v_menu_tab_show; + + if ($v_menu_tab_show) { + global $config; + $v_relative_url = $config['installedpackages']['freeswitchsettings']['config'][0]['v_relative_url']; + + //$script_name_array = split ("/", $_SERVER["SCRIPT_NAME"]); + //$script_name = $script_name_array[count($script_name_array)-1]; + //echo "script_name: ".$script_name."<br />"; + + $tab_array = array(); + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_settings.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Settings"), $menu_selected, $v_relative_url."/v_settings.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_details_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Dialplan"), $menu_selected, $v_relative_url."/v_dialplan_includes.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Extensions"), $menu_selected, $v_relative_url."/v_extensions.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_features.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_options_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_modules.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Features"), $menu_selected, $v_relative_url."/v_features.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Gateways"), $menu_selected, $v_relative_url."/v_gateways.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profiles.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profile_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Profiles"), $menu_selected, $v_relative_url."/v_profiles.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_details_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Public"), $menu_selected, $v_relative_url."/v_public_includes.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_status.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Status"), $menu_selected, $v_relative_url."/v_status.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_vars.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Vars"), $menu_selected, $v_relative_url."/v_vars.php"); + unset($menu_selected); + + display_top_tabs($tab_array); + } + } diff --git a/config/freeswitch_dev/v_status.tmp b/config/freeswitch_dev/v_status.tmp index 7193c18f..03b96fcc 100644 --- a/config/freeswitch_dev/v_status.tmp +++ b/config/freeswitch_dev/v_status.tmp @@ -58,6 +58,26 @@ if ($_GET['a'] == "download") { exit; } +if ($_GET['a'] == "update") { + if ($_GET['t'] == "gui_phase_1") { + + //chdir('/tmp/'); + chdir($v_parent_dir.'/pkg/'); + exec("fetch ".$v_download_path."v_config.inc"); + //exec("cp ".$tmp_dir."/v_config.tmp ".$v_parent_dir."/pkg/v_config.php"); + //unlink_if_exists($tmp_dir."/v_config.tmp"); + + header( 'Location: v_status.php?a=update&s=gui_phase_2' ) ; + } +} + +if ($_GET['a'] == "update") { + if ($_GET['t'] == "gui_phase_2") { + v_install_phase_2(); //needs to run on the new page so that it uses the new v_config.inc file + header( 'Location: v_status.php?savemsg=Update+Completed.' ) ; + } +} + if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { $tmp = '/root/backup/'; @@ -289,11 +309,24 @@ echo "<b>Call Detail Records</b><br />\n"; echo $v_log_dir."/cdr-csv/Master.csv<br /><br />\n"; echo "</td>\n"; echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='v_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n"; +echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='v_status.php?a=download&t=cdrcsv';\" />\n"; +echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br /><br />\n\n"; +echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; +echo "<tr>\n"; +echo "<td width='50%'>\n"; +echo "<b>Web Interface</b><br />\n"; +echo Use the following button to update the web interface.<br /><br />\n"; +echo "</td>\n"; +echo "<td width='50%' align='right'>\n"; +echo " <input type='button' value='update' onclick=\"document.location.href='v_status.php?a=update&t=gui_phase_1';\" />\n"; +echo "</td>\n"; +echo "</tr>\n"; +echo "</table>\n"; +echo "<br /><br />\n\n"; echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; echo "<tr>\n"; |