public function getContent($section) { if (!class_exists('TimeUtils')) { include dirname(__DIR__) . '/classes/TimeUtils.class.php'; } if (!defined('DASHBOARD_FREEPBX_BRAND')) { if (!empty($_SESSION['DASHBOARD_FREEPBX_BRAND'])) { define('DASHBOARD_FREEPBX_BRAND', $_SESSION['DASHBOARD_FREEPBX_BRAND']); } else { define('DASHBOARD_FREEPBX_BRAND', \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND")); } } else { $_SESSION['DASHBOARD_FREEPBX_BRAND'] = DASHBOARD_FREEPBX_BRAND; } $brand = DASHBOARD_FREEPBX_BRAND; if (\FreePBX::Config()->get("FREEPBX_SYSTEM_IDENT")) { $idline = sprintf(_("<strong>'%s'</strong><br><i>(You can change this name in Advanced Settings)</i>"), \FreePBX::Config()->get("FREEPBX_SYSTEM_IDENT")); } else { $idline = ""; } try { $getsi = \FreePBX::create()->Dashboard->getSysInfo(); } catch (\Exception $e) { } $since = time() - $getsi['timestamp']; $notifications = $this->getNotifications(isset($_COOKIE['dashboardShowAll']) && $_COOKIE['dashboardShowAll'] == "true"); $nots = $notifications['nots']; $alerts = $this->getAlerts($nots); return load_view(dirname(__DIR__) . '/views/sections/overview.php', array("showAllMessage" => $notifications['showAllMessage'], "nots" => $nots, "alerts" => $alerts, "brand" => $brand, "idline" => $idline, "version" => get_framework_version(), "since" => $since, "services" => $this->getSummary())); }
function build_manifest() { $ret = array("manifest_version" => 10, "hostname" => php_uname("n"), "fpbx_db" => "", "mysql" => "", "astdb" => "", "fpbx_cdrdb" => "", "name" => $this->b['name'], "ctime" => $this->b['_ctime'], "pbx_framework_version" => get_framework_version(), "backup_version" => modules_getversion('backup'), "pbx_version" => getversion(), "hooks" => array('pre_backup' => $this->b['prebu_hook'], 'post_backup' => $this->b['postbu_hook'], 'pre_restore' => $this->b['prere_hook'], 'post_restore' => $this->b['postre_hook'])); // Actually generate the file list $ret["file_list"] = $this->getDirContents($this->b['_tmpdir']); // Remove the mysql/astdb files, add them seperatly foreach ($ret['file_list'] as $key => $file) { if (is_array($file)) { // It's a subdirectory. Ignore. continue; } // Is it the astdb? We don't report that as part of // the file manifest, so people can chose to restore // or not restore it individually. if ($file == 'astdb') { unset($ret['file_list'][$key]); $ret['astdb'] = 'astdb'; continue; } // Is it a MySQL dump? if (strpos($file, 'mysql-') === 0) { //get server id $s = substr($file, 6); $s = substr($s, 0, -4); //get exclude foreach ($this->b['items'] as $i) { if ($i['type'] == 'mysql' && $i['path'] == 'server-' . $s) { $exclude = $i['exclude']; break; } } //build array on this server $ret['mysql'][$s] = array('file' => $file, 'host' => backup__($this->s[$s]['host']), 'port' => backup__($this->s[$s]['port']), 'name' => backup__($this->s[$s]['name']), 'dbname' => backup__($this->s[$s]['dbname']), 'exclude' => $exclude); //if this server is freepbx's primary server datastore, record that if ($ret['mysql'][$s]['dbname'] == $this->amp_conf['AMPDBNAME']) { //localhost and 127.0.0.1 are intergangeable, so test both scenarios if (in_array(strtolower($ret['mysql'][$s]['host']), array('localhost', '127.0.0.1')) && in_array(strtolower($this->amp_conf['AMPDBHOST']), array('localhost', '127.0.0.1')) || $ret['mysql'][$s]['host'] == $this->amp_conf['AMPDBHOST']) { $ret['fpbx_db'] = 'mysql-' . $s; unset($ret['file_list'][$key]); } //if this server is freepbx's primary cdr server datastore, record that } elseif ($ret['mysql'][$s]['dbname'] == $this->amp_conf['CDRDBNAME']) { //localhost and 127.0.0.1 are intergangeable, so test both scenarios if (in_array(strtolower($ret['mysql'][$s]['host']), array('localhost', '127.0.0.1')) && in_array(strtolower($this->amp_conf['CDRDBHOST']), array('localhost', '127.0.0.1')) || $ret['mysql'][$s]['host'] == $this->amp_conf['CDRDBHOST']) { $ret['fpbx_cdrdb'] = 'mysql-' . $s; unset($ret['file_list'][$key]); } } continue; } // Also exclude random .lock files left around. if ($file == '.lock') { unset($ret['file_list'][$key]); // Yes, I know, I'm the last thing in the loop. Consistancy! continue; } } $ret['file_count'] = count($ret['file_list'], COUNT_RECURSIVE); $ret['mysql_count'] = $ret['mysql'] ? count($ret['mysql']) : 0; $ret['astdb_count'] = $ret['astdb'] ? count($ret['astdb']) : 0; $ret['ftime'] = time(); //finish time $this->b['manifest'] = $ret; }
// can't go online if external management is on $online = isset($_REQUEST['online']) && !EXTERNAL_PACKAGE_MANAGEMENT ? 1 : 0; // fix php errors from undefined variable. Not sure if we can just change the reference below to use // online since it changes values so just setting to what we decided it is here. $moduleaction = isset($_REQUEST['moduleaction']) ? $_REQUEST['moduleaction'] : false; /* moduleaction is an array with the key as the module name, and possible values: downloadinstall - download and install (used when a module is not locally installed) upgrade - download and install (used when a module is locally installed) install - install/upgrade locally available module enable - enable local module disable - disable local module uninstall - uninstall local module */ $freepbx_version = get_framework_version(); $freepbx_version = $freepbx_version ? $freepbx_version : getversion(); $freepbx_help_url = "http://www.freepbx.org/freepbx-help-system?freepbx_version=" . urlencode($freepbx_version); if (!$quietmode) { ?> <script type="text/javascript" src="common/tabber-minimized.js"></script> <script type="text/javascript"> function toggleInfoPane(pane) { var style = document.getElementById(pane).style; if (style.display == 'none' || style.display == '') { style.display = 'block'; } else { style.display = 'none'; } } function check_upgrade_all() {
<?php global $amp_conf; $html = ''; $version = get_framework_version(); $version = $version ? $version : getversion(); $version_tag = '?load_version=' . urlencode($version); if ($amp_conf['FORCE_JS_CSS_IMG_DOWNLOAD']) { $this_time_append = '.' . time(); $version_tag .= $this_time_append; } else { $this_time_append = ''; } // Brandable logos in footer //fpbx logo $html .= '<div class="col-md-4"> <a target="_blank" href="' . $amp_conf['BRAND_IMAGE_FREEPBX_LINK_FOOT'] . '" >' . '<img id="footer_logo1" src="' . $amp_conf['BRAND_IMAGE_FREEPBX_FOOT'] . $version_tag . '" alt="' . $amp_conf['BRAND_FREEPBX_ALT_FOOT'] . '"/> </a> </div>'; //text $html .= '<div class="col-md-4" id="footer_text">'; $html .= sprintf(_('%s is a registered trademark of'), '<a href="http://www.freepbx.org" target="_blank">FreePBX</a>') . br() . '<a href="http://www.freepbx.org/copyright.html" target="_blank"> Sangoma Technologies Inc.</a>' . br(); $html .= sprintf(_('%s %s is licensed under the %s'), 'FreePBX', $version, '<a href="http://www.gnu.org/copyleft/gpl.html" target="_blank"> GPL</a>') . br(); $html .= '<a href="http://www.freepbx.org/copyright.html" target="_blank">Copyright© 2007-' . date('Y', time()) . '</a>'; //module license if (!empty($active_modules[$module_name]['license'])) { $html .= br() . sprintf(_('Current module licensed under %s'), trim($active_modules[$module_name]['license'])); } //benchmarking if (isset($amp_conf['DEVEL']) && $amp_conf['DEVEL']) { $benchmark_time = number_format(microtime_float() - $benchmark_starttime, 4);
function framework_include_js($module_name, $module_page) { global $amp_conf, $active_modules; $version = get_framework_version(); $version_tag = '?load_version=' . urlencode($version); if ($amp_conf['FORCE_JS_CSS_IMG_DOWNLOAD']) { $this_time_append = '.' . time(); $version_tag .= $this_time_append; } else { $this_time_append = ''; } $html = ''; if (is_file('modules/' . $module_name . '/' . $module_name . '.js')) { $html .= '<script type="text/javascript" src="?handler=file&module=' . $module_name . '&file=' . $module_name . '.js' . $mod_version_tag . '"></script>'; } if (isset($module_page) && $module_page != $module_name && is_file('modules/' . $module_name . '/' . $module_page . '.js')) { $html .= '<script type="text/javascript" src="?handler=file&module=' . $module_name . '&file=' . $module_page . '.js' . $mod_version_tag . '"></script>'; } // Check assets/js and then assets/js/page_name for any js files which will have been symlinked to // assets/module_name/js/* // $js_dir = 'modules/' . $module_name . '/assets/js'; if (is_dir($js_dir)) { $file_list = scandir($js_dir); foreach ($file_list as $file) { if (substr($file, -3) == '.js' && is_file("{$js_dir}/{$file}")) { $html .= '<script type="text/javascript"' . ' src="assets/' . $module_name . '/js/' . $file . '"></script>'; } } unset($file_list); $js_subdir = "{$js_dir}/{$module_page}"; if ($module_page != '' && is_dir($js_subdir)) { $file_list = scandir($js_subdir); foreach ($file_list as $p_file) { if (substr($p_file, -3) == '.js' && is_file("{$js_subdir}/{$p_file}")) { $html .= '<script type="text/javascript" ' . ' src="assets/' . $module_name . '/js/' . $module_page . '/' . $p_file . '"></script>'; } } } } // DEPCRETATED but still supported: // Note - include all the module js files first, then the page specific files, //in case a page specific file requires a module level file $js_dir = "modules/{$module_name}/js"; if (is_dir($js_dir)) { $file_list = scandir($js_dir); foreach ($file_list as $file) { if (substr($file, -3) == '.js' && is_file("{$js_dir}/{$file}")) { $html .= '<script type="text/javascript"' . ' src="?handler=file&module=' . $module_name . '&file=' . $js_dir . '/' . $file . $mod_version_tag . '"></script>'; } } unset($file_list); $js_subdir = "{$js_dir}/{$module_page}"; if ($module_page != '' && is_dir($js_subdir)) { $sd = opendir($js_subdir); $file_list = array(); while ($p_file = readdir($sd)) { $file_list[] = $p_file; } sort($file_list); foreach ($file_list as $p_file) { if (substr($p_file, -3) == '.js' && is_file("{$js_subdir}/{$p_file}")) { $html .= '<script type="text/javascript" src="?handler=file&module=' . $module_name . '&file=' . $js_subdir . '/' . $p_file . $mod_version_tag . '"></script>'; } } } } return $html; }
//footer //add javascript //localized strings and other javascript values that need to be set dynamically //TODO: this should be done via callbacks so that all modules can hook in to it $fpbx['conf'] = $amp_conf; $clean = array('AMPASTERISKUSER', 'AMPASTERISKGROUP', 'AMPASTERISKWEBGROUP', 'AMPASTERISKWEBUSER', 'AMPDBENGINE', 'AMPDBHOST', 'AMPDBNAME', 'AMPDBPASS', 'AMPDBUSER', 'AMPDEVGROUP', 'AMPDEVUSER', 'AMPMGRPASS', 'AMPMGRUSER', 'AMPVMUMASK', 'ARI_ADMIN_PASSWORD', 'ARI_ADMIN_USERNAME', 'ASTMANAGERHOST', 'ASTMANAGERPORT', 'ASTMANAGERPROXYPORT', 'CDRDBHOST', 'CDRDBNAME', 'CDRDBPASS', 'CDRDBPORT', 'CDRDBTABLENAME', 'CDRDBTYPE', 'CDRDBUSER', 'FOPPASSWORD', 'FOPSORT'); foreach ($clean as $var) { if (isset($fpbx['conf'][$var])) { unset($fpbx['conf'][$var]); } } $modulef = module_functions::create(); $fpbx['conf']['text_dir'] = isset($_COOKIE['lang']) && in_array($_COOKIE['lang'], array('he_IL')) ? 'rtl' : 'ltr'; $fpbx['conf']['uniqueid'] = sql('SELECT data FROM module_xml WHERE id = "installid"', 'getOne'); $fpbx['conf']['dist'] = $modulef->_distro_id(); $fpbx['conf']['ver'] = get_framework_version(); $fpbx['conf']['reload_needed'] = $reload_needed; $fpbx['conf']['brandid'] = $modulef->_brandid(); //TODO: This eventually should be provided by each individual module, rather than be hardcoded $fpbx['conf']['modules']['sysadmin']['deployment_id'] = $modulef->_deploymentid(); $fpbx['conf']['modules']['sysadmin']['zendid'] = function_exists('sysadmin_get_zendid') ? sysadmin_get_zendid() : null; $fpbx['msg']['framework']['reload_unidentified_error'] = _(" error(s) occurred, you should view the notification log on the dashboard or main screen to check for more details."); $fpbx['msg']['framework']['close'] = _("Close"); $fpbx['msg']['framework']['continuemsg'] = _("Continue"); //continue is a resorved word! $fpbx['msg']['framework']['cancel'] = _("Cancel"); $fpbx['msg']['framework']['retry'] = _("Retry"); $fpbx['msg']['framework']['update'] = _("Update"); $fpbx['msg']['framework']['save'] = _("Save"); $fpbx['msg']['framework']['bademail'] = _("Invalid email address"); $fpbx['msg']['framework']['updatenotifications'] = _("Update Notifications");