本文整理汇总了PHP中getversion函数的典型用法代码示例。如果您正苦于以下问题:PHP getversion函数的具体用法?PHP getversion怎么用?PHP getversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getversion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getdoc
function getdoc($name)
{
$version = getversion($name);
$docfile = "mobile/" . $name . "/" . $version . "/guide/index.md";
if (file_exists($docfile)) {
$dirc = "/markdown.php?" . $docfile;
} else {
$dirc = "/markdown.php?mobile/" . $name . "/README.md";
}
return $dirc;
}
示例2: dirname
$htdocs_source = dirname(__FILE__) . "/htdocs/*";
$bin_source = dirname(__FILE__) . "/bin/*";
$agibin_source = dirname(__FILE__) . "/agi-bin/*";
if (!file_exists(dirname($htdocs_source))) {
out(sprintf(_("No directory %s, install script not needed"), dirname($htdocs_source)));
return true;
}
// These are required by libfreepbx.install.php library for upgrade routines
//
define("UPGRADE_DIR", dirname(__FILE__) . "/upgrades/");
define("MODULE_DIR", $amp_conf['AMPWEBROOT'] . '/modules/');
$htdocs_dest = $amp_conf['AMPWEBROOT'];
$bin_dest = isset($amp_conf['AMPBIN']) ? $amp_conf['AMPBIN'] : '/var/lib/asterisk/bin';
$agibin_dest = isset($asterisk_conf['astagidir']) ? $asterisk_conf['astagidir'] : '/var/lib/asterisk/agi-bin';
exec("cp -rf {$htdocs_source} {$htdocs_dest} 2>&1", $out, $ret);
if ($ret != 0) {
framework_print_errors($htdocs_source, $htdocs_dest, $out);
}
exec("cp -rf {$bin_source} {$bin_dest} 2>&1", $out, $ret);
if ($ret != 0) {
framework_print_errors($bin_source, $bin_dest, $out);
}
exec("cp -rf {$agibin_source} {$agibin_dest} 2>&1", $out, $ret);
if ($ret != 0) {
framework_print_errors($agibin_source, $agibin_dest, $out);
}
if (function_exists('upgrade_all')) {
upgrade_all(getversion());
} else {
echo "[ERROR] Function: 'upgrade_all' not present, libfreepbx.install.php seems not to be installed<br>";
}
示例3: getOnlinePackages
/**
* Get online packages
* @return array Array of packages
*/
public function getOnlinePackages()
{
$version = getversion();
// we need to know the freepbx major version we have running (ie: 12.0.1 is 12.0)
preg_match('/(\\d+\\.\\d+)/', $version, $matches);
$base_version = $matches[1];
$xml = $this->getRemoteFile("/sounds-" . $base_version . ".xml");
if (!empty($xml)) {
$soundsobj = simplexml_load_string($xml);
/* Convert to an associative array */
$sounds = json_decode(json_encode($soundsobj), true);
if (empty($sounds) || empty($sounds['sounds']) || empty($sounds['sounds']['package'])) {
return false;
}
$available = $sounds['sounds']['package'];
/* Delete packages that aren't installed */
$sql = "DELETE FROM soundlang_packs WHERE installed IS NULL";
$sth = $this->db->prepare($sql);
$sth->execute();
/* Add / Update package versions */
$sql = "INSERT INTO soundlang_packs (type, module, language, format, version) VALUES (:type, :module, :language, :format, :version) ON DUPLICATE KEY UPDATE version = :version";
$sth = $this->db->prepare($sql);
foreach ($available as $package) {
$res = $sth->execute(array(':type' => $package['type'], ':module' => $package['module'], ':language' => $package['language'], ':format' => $package['format'], ':version' => $package['version']));
}
return true;
} else {
return false;
}
}
示例4: exec
} else {
exec("chmod +x {$agibin_dest}/*");
out(_("done"));
}
/*TODO: (Requirment for #4733)
*
* 1. Update publish.pl to grab a copy of amportal and put it somehwere.
* 2. If we have access to do an md5sum on AMPSBIN/amportal do it and
* compare to the local copy.
* 3. If the md5sum is different or we couldn't check, put amportal in AMPBIN
* 4. If we decided they need a new one, then write out a message that they
* should run amportal to update it.
*/
require_once __DIR__ . '/installlib/installer.class.php';
$installer = new \FreePBX\Install\Installer();
$installer->install_upgrades(getversion());
// We run this each time so that we can add settings if need be
// without requiring a major version bump
//
$installer->freepbx_settings_init(true);
// We now delete the files, this makes sure that if someone had an unprotected system where they have not enabled
// the .htaccess files or otherwise allowed direct access, that these files are not around to possibly cause problems
//
out(_("framework file install done, removing packages from module"));
$rem_files[] = $base_source;
$rem_files[] = dirname(__FILE__) . "/upgrades";
$rem_files[] = dirname(__FILE__) . "/start_asterisk";
$rem_files[] = dirname(__FILE__) . "/install";
$rem_files[] = dirname(__FILE__) . "/installlib";
foreach ($rem_files as $target) {
unset($out);
示例5: build_manifest
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;
}
示例6: document_start
function document_start()
{
if (!defined('RECURSIVE_MELLEL')) {
define('RECURSIVE_MELLEL', TRUE);
if (!defined('DEBUG')) {
define('DEBUG', TRUE);
}
set_time_limit(60 * 5);
if (isset($_REQUEST['list'])) {
$dirs = glob('/var/www/kolchose.org/inge/wiki/data/pages/*');
echo '<h1>No files</h1>';
foreach ($dirs as $dir) {
if (is_file($dir)) {
$new_dir = $dir;
// $new_dir = str_replace('/var/www/kolchose.org/inge/wiki/data/pages/', '', $new_dir);
// $new_dir = str_replace('.txt', '', $new_dir);
$new_dirs[] = $new_dir;
} else {
echo $dir . '<br />';
}
}
unset($dirs);
echo '<h1>Formatation ok?</h1>';
// $test_file = $new_dirs[1];
//
// echo $test_file.'<br />';
#var_dump(
#self::render(file_get_contents($test_file), 'mellelexport');
#);
$i = 0;
foreach ($new_dirs as $file) {
echo $file . '<br />';
self::render(file_get_contents($file), 'mellelexport');
ob_flush();
$i++;
if ($i > 50) {
exit;
}
}
exit;
}
}
plugin_disable('highlight');
if (in_array('highlight', plugin_list())) {
die('ERROR: highlight loaded 1');
}
global $ID;
parent::document_start();
// If older or equal to 2007-06-26, we need to disable caching
$dw_version = preg_replace('/[^\\d]/', '', getversion());
if (version_compare($dw_version, "20070626", "<=")) {
$this->info["cache"] = false;
}
$contentType = class_exists('ZipArchive') ? 'application/zip' : 'text/xml';
$contentFileName = class_exists('ZipArchive') ? noNS($ID) . '.mellel' : 'main.xml';
// TODO configuration
if (class_exists('ZipArchive') and true) {
$contentFileName = date('Y-m-d_') . $contentFileName;
}
// send the content type header, new method after 2007-06-26 (handles caching)
if (!DEBUG) {
if (version_compare($dw_version, "20070626")) {
// store the content type headers in metadata
$headers = array('Content-Type' => $contentType, 'Content-Disposition' => 'attachment; filename="' . $contentFileName . '";');
p_set_metadata($ID, array('format' => array('mellelexport' => $headers)));
} else {
// older method
header('Content-Type: ' . $contentType);
header('Content-Disposition: attachment; filename="' . $contentFileName . '";');
}
} else {
header('Content-Type: text/html; charset=utf-8');
echo '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>';
#<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
echo '<table>';
echo '<tr><th></th><th>Tag<br />(Wiki)</th><th></th><th>Type</th><th></th><th>Args</th><th>Output<br />(Mellel)</th></tr>';
}
}
示例7: get_framework_version
<?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);
示例8: orphan_delete
exit;
}
if (isset($_GET["zarafa-orphan-kill"])) {
orphan_delete();
exit;
}
if (isset($_GET["zarafa-orphan-link"])) {
orphan_link();
exit;
}
if (isset($_GET["zarafa-orphan-scan"])) {
orphan_scan();
exit;
}
if (isset($_GET["getversion"])) {
getversion();
exit;
}
if (isset($_GET["restart"])) {
restart();
exit;
}
if (isset($_GET["status"])) {
status();
exit;
}
if (isset($_GET["CopyToPublic"])) {
CopyToPublic();
exit;
}
if (isset($_GET["unhook-store"])) {
示例9: response
/**
* Respond to client
*/
function response()
{
//prepare body
if (!empty($this->res->body)) {
if ($this->log) {
$this->log->event('Processing Body', $this->res->body);
}
$body = $this->_process_body($this->res->body) . PHP_EOL;
//send length header
$this->add_header('Content-Length', strlen($body));
} else {
$body = '';
$this->add_header('Content-Length', 0);
//no body, just sayin'
}
//report the framework version
$this->add_header('App-Version', getversion());
//send the nonce as a header
$this->add_header('Nonce', $this->res->nonce);
//build response signature
$data = $this->auth->get_data_hash($this->opts['token'], $this->req->headers['url'], $this->router->verb, $this->res->nonce, $body);
$sig = $this->auth->get_signature($data, $this->opts['tokenkey']);
$this->add_header('Signature', $sig);
$this->send_headers();
echo $body;
if ($this->log) {
$this->log->event('Response', $this->res);
}
return true;
}
示例10: document_start
/**
* Initialize the rendering
*/
function document_start()
{
global $ID;
// Reset TOC.
$this->toc = array();
// First, get export mode.
$warning = '';
$this->mode = $this->config->load($warning);
// Load and import CSS files, setup Units
$this->load_css();
$this->setupUnits();
switch ($this->mode) {
case 'ODT template':
// Document based on ODT template.
$this->docHandler = new ODTTemplateDH();
$this->docHandler->setTemplate($this->config->getParam('odt_template'));
$this->docHandler->setDirectory($this->config->getParam('tpl_dir'));
break;
case 'CSS template':
// Document based on DokuWiki CSS template.
$this->docHandler = new CSSTemplateDH();
$media_sel = $this->config->getParam('media_sel');
$template = $this->config->getParam('odt_template');
$directory = $this->config->getParam('tpl_dir');
$template_path = $this->config->getParam('mediadir') . '/' . $directory . "/" . $template;
$this->docHandler->import($template_path, $media_sel, $this->config->getParam('mediadir'));
break;
default:
// Document from scratch.
$this->docHandler = new scratchDH();
break;
}
// Setup page format.
// Set the page format of the current page for calculation ($this->page)
// Change the standard page layout style
$this->page = new pageFormat();
$this->page->setFormat($this->config->getParam('format'), $this->config->getParam('orientation'), $this->config->getParam('margin_top'), $this->config->getParam('margin_right'), $this->config->getParam('margin_bottom'), $this->config->getParam('margin_left'));
$first_page = $this->docHandler->getStyle($this->docHandler->getStyleName('first page'));
if ($first_page != NULL) {
$first_page->setProperty('width', $this->page->getWidth() . 'cm');
$first_page->setProperty('height', $this->page->getHeight() . 'cm');
$first_page->setProperty('margin-top', $this->page->getMarginTop() . 'cm');
$first_page->setProperty('margin-right', $this->page->getMarginRight() . 'cm');
$first_page->setProperty('margin-bottom', $this->page->getMarginBottom() . 'cm');
$first_page->setProperty('margin-left', $this->page->getMarginLeft() . 'cm');
}
// Set title in meta info.
$this->meta->setTitle($ID);
//FIXME article title != book title SOLUTION: overwrite at the end for book
// If older or equal to 2007-06-26, we need to disable caching
$dw_version = preg_replace('/[^\\d]/', '', getversion());
//FIXME DEPRECATED
if (version_compare($dw_version, "20070626", "<=")) {
$this->info["cache"] = false;
}
//$headers = array('Content-Type'=>'text/plain'); p_set_metadata($ID,array('format' => array('odt' => $headers) )); return ; // DEBUG
// send the content type header, new method after 2007-06-26 (handles caching)
$output_filename = str_replace(':', '-', $ID) . ".odt";
if (version_compare($dw_version, "20070626")) {
// store the content type headers in metadata
$headers = array('Content-Type' => 'application/vnd.oasis.opendocument.text', 'Content-Disposition' => 'attachment; filename="' . $output_filename . '";');
p_set_metadata($ID, array('format' => array('odt_page' => $headers)));
} else {
// older method FIXME DEPRECATED
header('Content-Type: application/vnd.oasis.opendocument.text');
header('Content-Disposition: attachment; filename="' . $output_filename . '";');
}
$this->set_page_bookmark($ID);
}
示例11: module_get_annoucements
function module_get_annoucements()
{
global $db;
global $amp_conf;
$fn = generate_module_repo_url("/version-" . getversion() . ".html");
$announcement = file_get_contents_url($fn);
return $announcement;
}
示例12: _
echo _("This allows you to contact the FreePBX channel on IRC.");
?>
<?php
echo _("As IRC is an un-moderated international medium, AMP, FreePBX, Coalescent Systems, or any other party can not be held responsible for the actions or behavior of other people on the network");
?>
<?php
echo _("When you connect to IRC, to assist in support, the IRC client will automatically send the following information to everyone in the #freepbx channel:");
?>
<ul>
<li> <?php
echo _("Your Linux Distribution:");
$ver = irc_getversioninfo();
echo " ({$ver})";
?>
<li> <?php
echo _("Your FreePBX version:");
$ver = getversion();
echo " (" . $ver . ")";
?>
</ul>
<?php
echo _("If you do not want this information to be made public, please use another IRC client, or contact a commercial support provider");
break;
}
?>
示例13: core_get_config
function core_get_config($engine)
{
global $ext;
// is this the best way to pass this?
global $version;
// this is not the best way to pass this, this should be passetd together with $engine
global $engineinfo;
global $amp_conf;
global $core_conf;
global $chan_dahdi;
global $chan_dahdi_loaded;
global $astman;
$modulename = "core";
switch ($engine) {
case "asterisk":
$ast_ge_14 = version_compare($version, '1.4', 'ge');
$ast_lt_16 = version_compare($version, '1.6', 'lt');
$ast_lt_161 = version_compare($version, '1.6.1', 'lt');
// Now add to sip_general_addtional.conf
//
if (isset($core_conf) && is_a($core_conf, "core_conf")) {
$core_conf->addSipGeneral('disallow', 'all');
$core_conf->addSipGeneral('allow', 'ulaw');
$core_conf->addSipGeneral('allow', 'alaw');
$core_conf->addSipGeneral('context', 'from-sip-external');
$core_conf->addSipGeneral('callerid', 'Unknown');
$core_conf->addSipGeneral('notifyringing', 'yes');
if ($ast_ge_14) {
$core_conf->addSipGeneral('notifyhold', 'yes');
$core_conf->addSipGeneral('tos_sip', 'cs3');
// Recommended setting from doc/ip-tos.txt
$core_conf->addSipGeneral('tos_audio', 'ef');
// Recommended setting from doc/ip-tos.txt
$core_conf->addSipGeneral('tos_video', 'af41');
// Recommended setting from doc/ip-tos.txt
$core_conf->addSipGeneral('alwaysauthreject', 'yes');
if ($ast_lt_161) {
$core_conf->addSipGeneral('limitonpeers', 'yes');
}
} else {
$core_conf->addSipGeneral('tos', '0x68');
// This really doesn't do anything with astersk not running as root
}
$useragent = "FPBX-" . getversion() . "({$version})";
$core_conf->addSipGeneral('useragent', $useragent);
$core_conf->addIaxGeneral('disallow', 'all');
$core_conf->addIaxGeneral('allow', 'ulaw');
$core_conf->addIaxGeneral('allow', 'alaw');
$core_conf->addIaxGeneral('allow', 'gsm');
$core_conf->addIaxGeneral('mailboxdetail', 'yes');
if ($ast_ge_14) {
$core_conf->addIaxGeneral('tos', 'ef');
// Recommended setting from doc/ip-tos.txt
}
$fcc = new featurecode($modulename, 'blindxfer');
$code = $fcc->getCodeActive();
unset($fcc);
if ($code != '') {
$core_conf->addFeatureMap('blindxfer', $code);
}
$fcc = new featurecode($modulename, 'atxfer');
$code = $fcc->getCodeActive();
unset($fcc);
if ($code != '') {
$core_conf->addFeatureMap('atxfer', $code);
}
$fcc = new featurecode($modulename, 'automon');
$code = $fcc->getCodeActive();
unset($fcc);
if ($code != '') {
$core_conf->addFeatureMap('automon', $code);
}
$fcc = new featurecode($modulename, 'disconnect');
$code = $fcc->getCodeActive();
unset($fcc);
if ($code != '') {
$core_conf->addFeatureMap('disconnect', $code);
}
$fcc = new featurecode($modulename, 'pickupexten');
$code = $fcc->getCodeActive();
unset($fcc);
if ($code != '') {
$core_conf->addFeatureGeneral('pickupexten', $code);
}
}
// FeatureCodes
$fcc = new featurecode($modulename, 'userlogon');
$fc_userlogon = $fcc->getCodeActive();
unset($fcc);
$fcc = new featurecode($modulename, 'userlogoff');
$fc_userlogoff = $fcc->getCodeActive();
unset($fcc);
$fcc = new featurecode($modulename, 'zapbarge');
$fc_zapbarge = $fcc->getCodeActive();
unset($fcc);
$fcc = new featurecode($modulename, 'chanspy');
$fc_chanspy = $fcc->getCodeActive();
unset($fcc);
$fcc = new featurecode($modulename, 'simu_pstn');
$fc_simu_pstn = $fcc->getCodeActive();
//.........这里部分代码省略.........
示例14: document_start
/**
* Initialize the rendering
*/
function document_start()
{
global $ID;
// Reset TOC.
$this->toc = array();
// First, get export mode.
$warning = '';
$this->mode = $this->determineMode($warning);
switch ($this->mode) {
case 'ODT template':
// Document based on ODT template.
$this->docHandler = new ODTTemplateDH();
$this->docHandler->setTemplate($this->template);
$this->docHandler->setDirectory($this->getConf("tpl_dir"));
break;
default:
// Document from scratch.
$this->docHandler = new scratchDH();
break;
}
// Setup page format.
$this->page = new pageFormat();
$this->page->setFormat('A4', 'portrait');
// Load Styleset.
$this->styleset = new ODTDefaultStyles();
$this->styleset->import();
$this->autostyles = $this->styleset->getAutoStyles($this->page);
$this->styles = $this->styleset->getStyles();
// Set title in meta info.
$this->meta->setTitle($ID);
//FIXME article title != book title SOLUTION: overwrite at the end for book
// If older or equal to 2007-06-26, we need to disable caching
$dw_version = preg_replace('/[^\\d]/', '', getversion());
//FIXME DEPRECATED
if (version_compare($dw_version, "20070626", "<=")) {
$this->info["cache"] = false;
}
//$headers = array('Content-Type'=>'text/plain'); p_set_metadata($ID,array('format' => array('odt' => $headers) )); return ; // DEBUG
// send the content type header, new method after 2007-06-26 (handles caching)
$output_filename = str_replace(':', '-', $ID) . ".odt";
if (version_compare($dw_version, "20070626")) {
// store the content type headers in metadata
$headers = array('Content-Type' => 'application/vnd.oasis.opendocument.text', 'Content-Disposition' => 'attachment; filename="' . $output_filename . '";');
p_set_metadata($ID, array('format' => array('odt_page' => $headers)));
} else {
// older method FIXME DEPRECATED
header('Content-Type: application/vnd.oasis.opendocument.text');
header('Content-Disposition: attachment; filename="' . $output_filename . '";');
}
$this->set_page_bookmark($ID);
}
示例15: genConfig
/**
* Hook Definitions
*/
public function genConfig()
{
//clear before write.
$conf['pjsip.registration.conf'][] = '#include pjsip.registration_custom.conf';
$conf['pjsip.auth.conf'][] = '#include pjsip.auth_custom.conf';
$conf['pjsip.aor.conf'][] = '#include pjsip.aor_custom.conf';
$conf['pjsip.endpoint.conf'][] = '#include pjsip.endpoint_custom.conf';
$conf['pjsip.identify.conf'][] = '#include pjsip.identify_custom.conf';
$conf['pjsip.transports.conf'][] = '#include pjsip.transports_custom.conf';
//$conf['pjsip.notify.conf'][] = '#include pjsip.notify_custom.conf';
// Generate includes
$pjsip = "#include pjsip_custom.conf\n#include pjsip.transports.conf\n#include pjsip.transports_custom_post.conf\n#include pjsip.endpoint.conf\n#include pjsip.endpoint_custom_post.conf\n#include pjsip.aor.conf\n#include pjsip.aor_custom_post.conf\n";
$pjsip .= "#include pjsip.auth.conf\n#include pjsip.auth_custom_post.conf\n#include pjsip.registration.conf\n#include pjsip.registration_custom_post.conf\n#include pjsip.identify.conf\n#include pjsip.identify_custom_post.conf\n";
$conf['pjsip.conf'][] = $pjsip;
$conf = $this->generateEndpoints($conf);
// Transports are a multi-dimensional array, because
// we use it earlier to match extens with transports
// So we need to flatten it to something that can be
// written to a file.
$transports = $this->getTransportConfigs();
foreach ($transports as $transport => $entries) {
$tmparr = array();
foreach ($entries as $key => $val) {
// Check for multiple defintions of the same var (eg, local_net)
if (is_array($val)) {
foreach ($val as $line) {
$tmparr[] = "{$key}={$line}";
}
} else {
$tmparr[] = "{$key}={$val}";
}
}
$conf['pjsip.transports.conf'][$transport] = $tmparr;
}
$conf['pjsip.conf']['global'] = array('type=global', 'user_agent=' . $this->FreePBX->Config->get('SIPUSERAGENT') . '-' . getversion() . "(" . $this->version . ")");
if (!empty($this->_global)) {
foreach ($this->_global as $el) {
$conf['pjsip.conf']['global'][] = "{$el['key']}={$el['value']}";
}
}
$trunks = $this->getAllTrunks();
foreach ($trunks as $trunk) {
$tn = $trunk['trunk_name'];
//prevent....special people
$trunk['sip_server_port'] = !empty($trunk['sip_server_port']) ? $trunk['sip_server_port'] : '5060';
// Checkboxes aren't saved if they're unchecked.
if (!isset($trunk['auth_rejection_permanent'])) {
$trunk['auth_rejection_permanent'] = 'off';
}
$conf['pjsip.registration.conf'][$tn] = array('type' => 'registration', 'transport' => $trunk['transport'], 'outbound_auth' => $tn, 'retry_interval' => $trunk['retry_interval'], 'max_retries' => $trunk['max_retries'], 'expiration' => $trunk['expiration'], 'auth_rejection_permanent' => $trunk['auth_rejection_permanent'] == 'on' ? 'yes' : 'no');
if (!empty($trunk['contact_user'])) {
$conf['pjsip.registration.conf'][$tn]['contact_user'] = $trunk['contact_user'];
}
if (empty($trunk['configmode']) || $trunk['configmode'] == 'simple') {
if (empty($trunk['sip_server'])) {
throw new \Exception('Asterisk will crash if sip_server is blank!');
}
$conf['pjsip.registration.conf'][$tn]['server_uri'] = 'sip:' . $trunk['sip_server'] . ':' . $trunk['sip_server_port'];
$conf['pjsip.registration.conf'][$tn]['client_uri'] = 'sip:' . $trunk['username'] . '@' . $trunk['sip_server'] . ':' . $trunk['sip_server_port'];
} else {
if (empty($trunk['server_uri']) || empty($trunk['client_uri'])) {
throw new \Exception('Asterisk will crash if server_uri or client_uri is blank!');
}
$conf['pjsip.registration.conf'][$tn]['server_uri'] = $trunk['server_uri'];
$conf['pjsip.registration.conf'][$tn]['client_uri'] = $trunk['client_uri'];
}
if (!empty($this->_registration[$tn])) {
foreach ($this->_registration[$tn] as $el) {
$conf["pjsip.registration.conf"][$tn][] = "{$el['key']}={$el['value']}";
}
}
$conf['pjsip.auth.conf'][$tn] = array('type' => 'auth', 'auth_type' => 'userpass', 'password' => $trunk['secret'], 'username' => $trunk['username']);
$conf['pjsip.aor.conf'][$tn] = array('type' => 'aor', 'qualify_frequency' => !empty($trunk['qualify_frequency']) ? $trunk['qualify_frequency'] : 60);
if (empty($trunk['configmode']) || $trunk['configmode'] == 'simple') {
$conf['pjsip.aor.conf'][$tn]['contact'] = 'sip:' . $trunk['username'] . '@' . $trunk['sip_server'] . ':' . $trunk['sip_server_port'];
} else {
$conf['pjsip.aor.conf'][$tn]['contact'] = $trunk['aor_contact'];
}
if (!empty($this->_aor[$tn])) {
foreach ($this->_aor[$tn] as $el) {
$conf["pjsip.aor.conf"][$tn][] = "{$el['key']}={$el['value']}";
}
}
$conf['pjsip.endpoint.conf'][$tn] = array('type' => 'endpoint', 'transport' => !empty($trunk['transport']) ? $trunk['transport'] : 'udp', 'context' => !empty($trunk['context']) ? $trunk['context'] : 'from-pstn', 'disallow' => 'all', 'allow' => str_replace('&', ',', !empty($trunk['codecs']) ? $trunk['codecs'] : 'ulaw'), 'outbound_auth' => $tn, 'aors' => $tn);
if (!empty($this->_endpoint[$tn])) {
foreach ($this->_endpoint[$tn] as $el) {
$conf["pjsip.endpoint.conf"][$tn][] = "{$el['key']}={$el['value']}";
}
}
$conf['pjsip.identify.conf'][$tn] = array('type' => 'identify', 'endpoint' => $tn, 'match' => $trunk['sip_server']);
if (!empty($this->_identify[$tn])) {
foreach ($this->_identify[$tn] as $el) {
$conf["pjsip.identify.conf"][$tn][] = "{$el['key']}={$el['value']}";
}
}
}
//if we have an additional and custom file for sip_notify, write a pjsip_notify.conf
//.........这里部分代码省略.........