if (!empty($contents['HEADER']) && is_array($contents['HEADER'])) { foreach ($contents['HEADER'] as $key => $val) { $final["gen__" . $key] = $val; $gen_settings[$key] = ""; } } if (!empty($final)) { if (!function_exists('voicemail_update_settings')) { include __DIR__ . '/functions.inc.php'; } voicemail_update_settings("settings", "", "", $final); } unlink($aed . '/vm_email.inc'); } if (file_exists($aed . '/vm_general.inc')) { $contents = FreePBX::LoadConfig()->getConfig('vm_general.inc'); $final = array(); if (!empty($contents['HEADER']) && is_array($contents['HEADER'])) { foreach ($contents['HEADER'] as $key => $val) { $final["gen__" . $key] = $val; $gen_settings[$key] = ""; } } if (!empty($final)) { if (!function_exists('voicemail_update_settings')) { include __DIR__ . '/functions.inc.php'; } voicemail_update_settings("settings", "", "", $final); } unlink($aed . '/vm_general.inc'); }
private function loadChownConf() { $etcdir = \FreePBX::Config()->get('ASTETCDIR'); if (!file_exists($etcdir . '/freepbx_chown.conf')) { return; } $conf = \FreePBX::LoadConfig()->getConfig("freepbx_chown.conf"); if (isset($conf['blacklist'])) { if (isset($conf['blacklist']['item'])) { $conf['blacklist']['item'] = is_array($conf['blacklist']['item']) ? $conf['blacklist']['item'] : array($conf['blacklist']['item']); foreach ($conf['blacklist']['item'] as $item) { $this->blacklist['files'][] = $item; } } if (isset($conf['blacklist']['directory'])) { $conf['blacklist']['directory'] = is_array($conf['blacklist']['directory']) ? $conf['blacklist']['directory'] : array($conf['blacklist']['directory']); foreach ($conf['blacklist']['directory'] as $dir) { $dir = rtrim($dir, '/'); $this->blacklist['dirs'][] = $dir; } } } $this->modfiles['byconfig'] = array(); if (isset($conf['custom'])) { if (isset($conf['custom']['file'])) { $conf['custom']['file'] = is_array($conf['custom']['file']) ? $conf['custom']['file'] : array($conf['custom']['file']); foreach ($conf['custom']['file'] as $file) { $file = $this->parse_conf_line($file); if ($file === false) { continue; } $this->modfiles['byconfig'][] = array('type' => 'file', 'path' => $file['path'], 'perms' => $file['perms'], 'owner' => $file['owner'], 'group' => $file['group']); } } if (isset($conf['custom']['dir'])) { $conf['custom']['dir'] = is_array($conf['custom']['dir']) ? $conf['custom']['dir'] : array($conf['custom']['dir']); foreach ($conf['custom']['dir'] as $dir) { $dir = $this->parse_conf_line($dir); if ($dir === false) { continue; } $this->modfiles['byconfig'][] = array('type' => 'dir', 'path' => $dir['path'], 'perms' => $dir['perms'], 'owner' => $dir['owner'], 'group' => $dir['group'], 'always' => true); } } if (isset($conf['custom'][''])) { $conf['custom']['rdir'] = is_array($conf['custom']['rdir']) ? $conf['custom']['rdir'] : array($conf['custom']['rdir']); foreach ($conf['custom']['rdir'] as $rdir) { $rdir = $this->parse_conf_line($rdir); if ($rdir === false) { continue; } $this->modfiles['byconfig'][] = array('type' => 'rdir', 'path' => $rdir['path'], 'perms' => $rdir['perms'], 'owner' => $rdir['owner'], 'group' => $rdir['group'], 'always' => true); } } if (isset($conf['custom'][''])) { $conf['custom']['execdir'] = is_array($conf['custom']['execdir']) ? $conf['custom']['execdir'] : array($conf['custom']['execdir']); foreach ($conf['custom']['execdir'] as $edir) { $edir = $this->parse_conf_line($rdir); if ($edir === false) { continue; } $this->modfiles['byconfig'][] = array('type' => 'execdir', 'path' => $edir['path'], 'perms' => $edir['perms'], 'owner' => $edir['owner'], 'group' => $edir['group'], 'always' => true); } } } }
$freepbx_conf->define_conf_setting('HTTPSESSIONINACTIVITY', $set); // HTTPBINDADDRESS $set['value'] = 15000; $set['defaultval'] =& $set['value']; $set['name'] = 'Session Keep Alive'; $set['description'] = 'Specifies the number of milliseconds to wait for the next HTTP request over a persistent connection. Set to 0 to disable persistent HTTP connections.'; $set['emptyok'] = 1; $set['options'] = array(0, 65536); $set['type'] = CONF_TYPE_INT; $set['level'] = 4; $set['readonly'] = 0; $freepbx_conf->define_conf_setting('HTTPSESSIONKEEPALIVE', $set); $freepbx_conf->commit_conf_settings(); $migrate = array("sessionlimit" => "HTTPSESSIONLIMIT", "session_inactivity" => "HTTPSESSIONINACTIVITY", "session_keep_alive" => "HTTPSESSIONKEEPALIVE"); if (file_exists($amp_conf['ASTETCDIR'] . '/http_custom.conf')) { $data = FreePBX::LoadConfig()->getConfig('http_custom.conf'); $contents = file_get_contents($amp_conf['ASTETCDIR'] . '/http_custom.conf'); if (!empty($data['HEADER']) && is_array($data['HEADER'])) { foreach ($data['HEADER'] as $key => $value) { if (!isset($migrate[$key])) { continue; } outn(sprintf(_("Migrating http setting '%s' to Advanced Settings..."), $key)); $contents = preg_replace('/' . $key . '\\s*=\\s*' . $value . '.*\\n/', '', $contents); $freepbx_conf->update($migrate[$key], $value); out(_("Done")); } } file_put_contents($amp_conf['ASTETCDIR'] . '/http_custom.conf', $contents); } //
function sipsettings_check_custom_files() { global $amp_conf; $errors = array(); $custom_files[] = "sip_nat.conf"; $custom_files[] = "sip_general_custom.conf"; $custom_files[] = "sip_custom.conf"; foreach ($custom_files as $file) { if (file_exists($amp_conf['ASTETCDIR'] . "/" . $file)) { $sip_conf = \FreePBX::LoadConfig()->getConfig($file); $sip_conf = is_array($sip_conf) ? $sip_conf : array(); foreach ($sip_conf as $section => $item) { // If setting is an array, then it is a subsection // if (!is_array($item)) { $msg = sprintf(_("Settings in %s may override these. Those settings should be removed."), "<b>{$file}</b>"); $errors[] = array('js' => '', 'div' => $msg); break; } } } } return $errors; }