本文整理汇总了PHP中outn函数的典型用法代码示例。如果您正苦于以下问题:PHP outn函数的具体用法?PHP outn怎么用?PHP outn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_all
function upgrade_all($version)
{
// **** Read upgrades/ directory
outn("Checking for upgrades..");
// read versions list from ugprades/
$versions = array();
$dir = opendir(UPGRADE_DIR);
while ($file = readdir($dir)) {
if ($file[0] != "." && is_dir(UPGRADE_DIR . "/" . $file)) {
$versions[] = $file;
}
}
closedir($dir);
// callback to use php's version_compare() to sort
usort($versions, "version_compare_freepbx");
// find versions that are higher than the current version
$starting_version = false;
foreach ($versions as $check_version) {
if (version_compare_freepbx($check_version, $version) > 0) {
// if check_version < version
$starting_version = $check_version;
break;
}
}
// run all upgrades from the list of higher versions
if ($starting_version) {
$pos = array_search($starting_version, $versions);
$upgrades = array_slice($versions, $pos);
// grab the list of versions, starting at $starting_version
out(count($upgrades) . " found");
run_upgrade($upgrades);
/* Set the base version of key modules, currently core and framework, to the
* Version packaged with this tarball, if any. The expectation is that the
* packaging scripts will make these module version numbers the same as the
* release plus a '.0' which can be incremented for bug fixes delivered through
* the online system between main releases.
*
* added if function_exists because if this is being run from framework there is no
* need to reset the base version.
*/
if (function_exists('set_base_version')) {
set_base_version();
}
} else {
out("No upgrades found");
}
}
示例2: install
public function install()
{
$dbh = $this->db;
$sql = "CREATE TABLE IF NOT EXISTS manager (\n\t\t\t`manager_id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,\n\t\t\t`name` VARCHAR( 15 ) NOT NULL ,\n\t\t\t`secret` VARCHAR( 50 ) ,\n\t\t\t`deny` VARCHAR( 255 ) ,\n\t\t\t`permit` VARCHAR( 255 ) ,\n\t\t\t`read` VARCHAR( 255 ) ,\n\t\t\t`write` VARCHAR( 255 )\n\t\t)";
$stmt = $dbh->prepare($sql);
$stmt->execute();
\outn(_("Increasing read field size if needed.."));
$sql = "ALTER TABLE `manager` CHANGE `read` `read` VARCHAR( 255 )";
$stmt = $dbh->prepare($sql);
try {
$stmt->execute();
\out(_("ok"));
} catch (\PDOException $e) {
\out(_("error encountered, not altered"));
}
outn(_("Increasing write field size if needed.."));
$sql = "ALTER TABLE `manager` CHANGE `write` `write` VARCHAR( 255 )";
$stmt = $dbh->prepare($sql);
try {
$stmt->execute();
\out(_("ok"));
} catch (\PDOException $e) {
\out(_("error encountered, not altered"));
}
outn(_("Adding write timeout.."));
$sql = "ALTER TABLE manager ADD writetimeout INT";
$stmt = $dbh->prepare($sql);
try {
$stmt->execute();
\out(_("ok"));
} catch (\PDOException $e) {
//We are ok with 42S21 because we are trying to add a column and it says that column is present.
if ($e->getCode() == '42S21') {
\out(_("Column present"));
} else {
//All other exceptions are bad mmmk
\out($e->getMessage());
throw $e;
}
}
}
示例3: encrypt_passwords
function encrypt_passwords()
{
global $db;
out("Updating passwords..");
$sql = "SELECT * FROM ampusers";
$users = $db->getAll($sql, NULL, DB_FETCHMODE_ASSOC);
if (DB::IsError($users)) {
// Error while getting the users list to update... bad
die($users->getMessage());
} else {
outn("(" . count($users) . " accounts) ");
foreach ($users as $index => $ufields) {
$sql = "UPDATE ampusers SET password_sha1='" . sha1($ufields['password']) . "' WHERE username='" . $ufields['username'] . "'";
$result = $db->query($sql);
if (DB::IsError($result)) {
outn("Error while updating account: " . $ufields['username'] . " (" . $result->getMessage . ")");
}
}
}
out("Done.");
}
示例4: did_migrate
function did_migrate($incoming)
{
global $db;
foreach ($incoming as $key => $val) {
${$key} = $db->escapeSimple($val);
}
// Check to make sure the did is not being used elsewhere
//
$sql = "SELECT * FROM incoming WHERE cidnum = '' AND extension = '{$extension}'";
$existing = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($existing)) {
outn(sprintf(_("ERROR: trying to check if %s already in use"), $extension));
return false;
}
if (empty($existing)) {
$sql = "INSERT INTO incoming (cidnum,extension,destination,faxexten,faxemail,answer,wait,privacyman,alertinfo, ringing, mohclass, description, grppre) values ('{$cidnum}','{$extension}','{$destination}','{$faxexten}','{$faxemail}','{$answer}','{$wait}','{$privacyman}','{$alertinfo}', '{$ringing}', '{$mohclass}', '{$description}', '{$grppre}')";
sql($sql);
return true;
} else {
return false;
}
}
示例5: get_dial_string
function get_dial_string($extnum)
{
global $db;
$ds = '';
$sql = "SELECT value FROM globals WHERE variable = 'E{$extnum}'";
$result = $db->getAll($sql);
if (DB::IsError($result)) {
die($result->getMessage());
}
if (count($result) > 0) {
$exttech = $result[0][0];
switch ($exttech) {
case "SIP":
$ds = "SIP/" . $extnum;
break;
case "IAX2":
$ds = "IAX2/" . $extnum;
break;
case "ZAP":
$sql = "SELECT value FROM globals WHERE variable = 'ZAPCHAN_{$extnum}'";
$zapres = $db->getAll($sql);
if (DB::IsError($zapres)) {
die($zapres->getMessage());
}
if (count($zapres) > 0) {
$zapchannel = $result[0][0];
}
$ds = "Zap/" . $zapchannel;
break;
default:
outn($exttech . "...");
break;
}
}
return $ds;
}
示例6: out
$sql = "SELECT * FROM module_xml";
$confs = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (!DB::IsError($confs)) {
// no error... Already done
out("Not Required");
} else {
$sql = "CREATE TABLE module_xml (\n\t id varchar(20) NOT NULL default 'xml',\n\t time int(11) NOT NULL default '0',\n\t data blob NOT NULL,\n\t PRIMARY KEY (id)\n\t )";
$results = $db->query($sql);
if (DB::IsError($results)) {
die($results->getMessage());
}
out("Done");
}
// Add id filed to table so more key/values can be kept in it
//
outn("Adding id to module_xml table..");
$sql = "SELECT id FROM module_xml";
$confs = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (!DB::IsError($confs)) {
// no error... Already done
out("Not Required");
} else {
$sql = "ALTER TABLE module_xml ADD id VARCHAR( 20 ) NOT NULL DEFAULT 'xml' FIRST";
$results = $db->query($sql);
if (DB::IsError($results)) {
die($results->getMessage());
}
$sql = "ALTER TABLE module_xml ADD PRIMARY KEY ( id )";
$results = $db->query($sql);
if (DB::IsError($results)) {
die($results->getMessage());
示例7: outn
// Version 2.5 upgrade
outn(_("checking for fcode field.."));
$sql = "SELECT `fcode` FROM recordings";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE recordings ADD `fcode` TINYINT( 1 ) DEFAULT 0 ;";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
out(_("OK"));
} else {
out(_("already exists"));
}
outn(_("checking for fcode_pass field.."));
$sql = "SELECT `fcode_pass` FROM recordings";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE recordings ADD `fcode_pass` VARCHAR( 20 ) NULL ;";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
out(_("OK"));
} else {
out(_("already exists"));
}
sql('DELETE FROM recordings WHERE displayname = "__invalid"');
$freepbx_conf =& freepbx_conf::create();
示例8: out
}
if ($foreign_id === false) {
out();
out(_("FAILED migrating route {$lookup} NOT FOUND"));
outn(_("continuing.."));
} else {
$pinset_usage[] = array($pinset['pinsets_id'], $dispname, $foreign_id);
}
}
}
// We new have all the indices, so lets save them
//
$compiled = $db->prepare('INSERT INTO `pinset_usage` (`pinsets_id`, `dispname`, `foreign_id`) values (?,?,?)');
$result = $db->executeMultiple($compiled, $pinset_usage);
if (DB::IsError($result)) {
out("FATAL: " . $result->getDebugInfo() . "\n" . 'error inserting into pinsets_uage table');
} else {
out(_("done"));
outn(_("dropping used_by field.."));
$sql = "ALTER TABLE `pinsets` DROP `used_by`";
$result = $db->query($sql);
if (DB::IsError($result)) {
out(_("no used_by field???"));
} else {
out(_("ok"));
}
}
}
} else {
out(_("already done"));
}
示例9: VARCHAR
CREATE TABLE IF NOT EXISTS `iaxsettings` (
`keyword` VARCHAR (50) NOT NULL default '',
`data` VARCHAR (255) NOT NULL default '',
`seq` TINYINT (1),
`type` TINYINT (1) NOT NULL default '0',
PRIMARY KEY (`keyword`,`seq`,`type`)
)
END;
outn(_("checking for iaxsettings table.."));
$tsql = "SELECT * FROM `iaxsettings` limit 1";
$check = $db->getRow($tsql, DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) {
out(_("none, creating table"));
// table does not exist, create it
sql($sql);
outn(_("populating default codecs.."));
$sip_settings = array(array('ulaw', '1', '0'), array('alaw', '2', '1'), array('slin', '', '2'), array('g726', '', '3'), array('gsm', '3', '4'), array('g729', '', '5'), array('ilbc', '', '6'), array('g723', '', '7'), array('g726aal2', '', '8'), array('adpcm', '', '9'), array('lpc10', '', '10'), array('speex', '', '11'), array('g722', '', '12'));
// Now insert minimal codec rows
$compiled = $db->prepare("INSERT INTO iaxsettings (keyword, data, seq, type) values (?,?,?,'1')");
$result = $db->executeMultiple($compiled, $sip_settings);
if (DB::IsError($result)) {
out(_("fatal error occurred populating defaults, check module"));
} else {
out(_("ulaw, alaw, gsm added"));
}
} else {
out(_("already exists"));
}
/* Convert language to custom field */
$sql = "SELECT MAX(seq) FROM iaxsettings WHERE type = 9";
$seq = sql($sql, 'getOne');
示例10: explode
$include = explode('-', $myinclude['include'], 3);
$include[1] = (int) $include[1];
foreach ($routes as $rt => $route) {
//if we have a trunk with the same name match it and take it out of the list
if ($include[2] == $route['name']) {
$newincludes[] = array('new' => 'outrt-' . $route['route_id'], 'sort' => $route['seq'], 'old' => $myinclude['include']);
//unset the routes so we dont search them again
unset($includes[$inc]);
unset($routes[$rt]);
}
}
}
//alert user of unmigrated routes
foreach ($includes as $include) {
out(_('FAILED to migrating Custom Context route ' . $include['description'] . '. NO MATCH FOUND'));
outn(_("Continuing..."));
}
// We new have all the indices, so lets save them
$sql = $db->prepare('UPDATE customcontexts_includes_list SET include = ?, sort = ? WHERE include = ?');
$result = $db->executeMultiple($sql, $newincludes);
if (DB::IsError($result)) {
out("FATAL: " . $result->getDebugInfo() . "\n" . 'error updating customcontexts_includes_list table. Aborting!');
} else {
//now update the customcontexts_includes table
foreach ($newincludes as $inc => $newinclude) {
unset($newincludes[$inc]['sort']);
}
$sql = $db->prepare('UPDATE customcontexts_includes SET include = ? WHERE include = ?');
$result = $db->executeMultiple($sql, $newincludes);
if (DB::IsError($result)) {
out("FATAL: " . $result->getDebugInfo() . "\n" . 'error updating customcontexts_includes table. Aborting!');
示例11: install
public function install()
{
global $db;
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`owner` int(11) NOT NULL,
`name` varchar(80) NOT NULL,
`type` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_group_entries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`groupid` int(11) NOT NULL,
`user` int(11) NOT NULL,
`displayname` varchar(100) default NULL,
`fname` varchar(100) default NULL,
`lname` varchar(100) default NULL,
`title` varchar(100) default NULL,
`company` varchar(100) default NULL,
`address` varchar(200) default NULL,
PRIMARY KEY (`id`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_entry_numbers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entryid` int(11) NOT NULL,
`number` varchar(100) default NULL,
`extension` varchar(100) default NULL,
`type` varchar(100),
`flags` varchar(100),
PRIMARY KEY (`id`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_entry_images` (
`entryid` int(11) NOT NULL,
`image` LONGBLOB,
`format` VARCHAR(45) NOT NULL,
`gravatar` tinyint(4) NOT NULL DEFAULT "0",
PRIMARY KEY (`entryid`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_entry_xmpps` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entryid` int(11) NOT NULL,
`xmpp` varchar(100) default NULL,
PRIMARY KEY (`id`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_entry_emails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entryid` int(11) NOT NULL,
`email` varchar(100) default NULL,
PRIMARY KEY (`id`)
);';
$sql[] = 'CREATE TABLE IF NOT EXISTS `contactmanager_entry_websites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entryid` int(11) NOT NULL,
`website` varchar(100) default NULL,
PRIMARY KEY (`id`)
);';
foreach ($sql as $statement) {
$check = $db->query($statement);
if (\DB::IsError($check)) {
die_freepbx("Can not execute {$statement} : " . $check->getMessage() . "\n");
}
}
outn(_("checking for title field.."));
$sql = "SELECT `title` FROM contactmanager_group_entries";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (\DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE contactmanager_group_entries ADD `title` varchar(100), ADD `company` varchar(100)";
$result = $db->query($sql);
if (\DB::IsError($result)) {
out(_("ERROR failed to update title field"));
} else {
out(_("OK"));
}
} else {
out(_("already exists"));
}
outn(_("checking for displayname field.."));
$sql = "SELECT `displayname` FROM contactmanager_group_entries";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (\DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE contactmanager_group_entries ADD `displayname` varchar(100)";
$result = $db->query($sql);
if (\DB::IsError($result)) {
out(_("ERROR failed to update displayname field"));
} else {
out(_("OK"));
}
} else {
out(_("already exists"));
}
outn(_("checking for address field.."));
$sql = "SELECT `address` FROM contactmanager_group_entries";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (\DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE contactmanager_group_entries ADD `address` varchar(200)";
$result = $db->query($sql);
if (\DB::IsError($result)) {
//.........这里部分代码省略.........
示例12: outn
echo $text . "<br />";
}
}
if (!function_exists("outn")) {
function outn($text)
{
echo $text;
}
}
$autoincrement = $amp_conf["AMPDBENGINE"] == "sqlite" || $amp_conf["AMPDBENGINE"] == "sqlite3" ? "AUTOINCREMENT" : "AUTO_INCREMENT";
$sql = "CREATE TABLE IF NOT EXISTS manager (\n\t`manager_id` INTEGER NOT NULL PRIMARY KEY {$autoincrement},\n\t`name` VARCHAR( 15 ) NOT NULL ,\n\t`secret` VARCHAR( 50 ) ,\n\t`deny` VARCHAR( 255 ) ,\n\t`permit` VARCHAR( 255 ) ,\n\t`read` VARCHAR( 255 ) ,\n\t`write` VARCHAR( 255 )\n)";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not create `manager` table" . $check->getMessage() . "\n");
}
outn(_("Increasing read field size if needed.."));
$sql = "ALTER TABLE `manager` CHANGE `read` `read` VARCHAR( 255 )";
$result = $db->query($sql);
if (DB::IsError($check)) {
out(_("error encountered, not altered"));
} else {
out(_("ok"));
}
outn(_("Increasing write field size if needed.."));
$sql = "ALTER TABLE `manager` CHANGE `write` `write` VARCHAR( 255 )";
$result = $db->query($sql);
if (DB::IsError($check)) {
out(_("error encountered, not altered"));
} else {
out(_("ok"));
}
示例13: outn
<?php
/* $Id$ */
/* check for old prefix based routing */
outn("Upgrading Call Groups..");
// First update "|" to "-" usage for *-HEAD.
$sql = "update extensions set args = REPLACE(args,'|','-') where args LIKE 'GROUP=%' and args LIKE '%|%'";
$results = $db->query($sql);
if (DB::IsError($results)) {
die($results->getMessage());
}
// get all call groups
$sql = "select extension, args from extensions where args LIKE 'GROUP=%';";
$results = $db->getAll($sql);
if (DB::IsError($results)) {
die($results->getMessage());
}
out(count($results) . " to check...");
if (count($results) > 0) {
// yes, there are ring groups defined
foreach ($results as $key => $value) {
// replace * that are not at the beginning of an extension
$new_extensions = preg_replace("/([0-9*#]+)\\*([0-9#]+)/", "\$1\$2#", $value[1]);
// only replace if changed
if ($new_extensions != $value[1]) {
out("Changing " . $value[1] . " to " . $new_extensions);
$sql = sprintf("update extensions set args = '%s' WHERE extension = '%s' ", $new_extensions, $value['0']) . "AND args LIKE 'GROUP=%'";
// debug("sql = ". $sql);
$update_results = $db->query($sql);
if (DB::IsError($update_results)) {
die($update_results->getMessage());
示例14: outn
<?php
//add AMPEXTENSIONS option to amportal.conf
if (!array_key_exists("AMPEXTENSIONS", $amp_conf)) {
$filename = AMP_CONF;
outn("\n\nUse simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?\n [extensions] ");
$key = trim(fgets(STDIN, 1024));
if (preg_match('/^$/', $key)) {
$amp_conf["AMPEXTENSIONS"] = "extensions";
} else {
$amp_conf["AMPEXTENSIONS"] = $key;
}
// write amportal.conf
write_amportal_conf($filename, $amp_conf);
}
示例15: die
if (DB::IsError($result)) {
die($result->getDebugInfo());
}
out("OK");
}
out(" Processed " . $ctr . " Ring Group(s)");
} else {
// might have the Ring Groups module already installed from a previous beta -- needs new table
$sql = "SELECT COUNT(*) AS RES FROM modules WHERE modulename = 'ringgroups'";
$result = $db->query($sql);
if (DB::IsError($result)) {
die($result->getDebugInfo());
} else {
$row = $result->fetchRow();
if ($row[0] > 0) {
outn(" Ring Groups module in use, creating 'ringgroups' table if needed... ");
// Create the new table first
$sql = "CREATE TABLE IF NOT EXISTS `ringgroups` ( ";
$sql .= "`grpnum` INT NOT NULL , ";
$sql .= "`strategy` VARCHAR( 50 ) NOT NULL , ";
$sql .= "`grptime` SMALLINT NOT NULL , ";
$sql .= "`grppre` VARCHAR( 100 ) NULL , ";
$sql .= "`grplist` VARCHAR( 255 ) NOT NULL , ";
$sql .= "`annmsg` VARCHAR( 255 ) NULL , ";
$sql .= "`postdest` VARCHAR( 255 ) NULL , ";
$sql .= "PRIMARY KEY (`grpnum`) ";
$sql .= ") TYPE = MYISAM ";
$result = $db->query($sql);
if (DB::IsError($result)) {
die($result->getDebugInfo());
}