当前位置: 首页>>代码示例>>PHP>>正文


PHP die_freepbx函数代码示例

本文整理汇总了PHP中die_freepbx函数的典型用法代码示例。如果您正苦于以下问题:PHP die_freepbx函数的具体用法?PHP die_freepbx怎么用?PHP die_freepbx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了die_freepbx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install()
 {
     $sql = "CREATE TABLE IF NOT EXISTS miscapps (miscapps_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, ext VARCHAR( 50 ) , description VARCHAR( 50 ) , dest VARCHAR( 255 ))";
     $q = $this->db->prepare($sql);
     $q = $q->execute();
     unset($sql);
     unset($q);
     //Migration... Is this still needed
     global $db;
     $results = array();
     $sql = "SELECT miscapps_id, dest FROM miscapps";
     $results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
     if (!\DB::IsError($results)) {
         // error - table must not be there
         foreach ($results as $result) {
             $old_dest = $result['dest'];
             $this->id = $result['miscapps_id'];
             $new_dest = merge_ext_followme(trim($old_dest));
             if ($new_dest != $old_dest) {
                 $sql = "UPDATE miscapps SET dest = '{$new_dest}' WHERE miscapps_id = {$miscapps_id}  AND dest = '{$old_dest}'";
                 $results = $db->query($sql);
                 if (DB::IsError($results)) {
                     die_freepbx($results->getMessage());
                 }
             }
         }
     }
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:28,代码来源:Miscapps.class.php

示例2: DbConnect

function DbConnect()
{
    $options = array();
    if (DB_TYPE == "postgres") {
        $datasource = 'pgsql://' . USER . ':' . PASS . '@' . HOST . '/' . DBNAME;
    } else {
        if (DB_TYPE == "sqlite3") {
            /* on centos this extension is not loaded by default */
            if (!extension_loaded('sqlite3') && !extension_loaded('SQLITE3')) {
                dl('sqlite3.so');
            }
            if (!@(require_once 'DB/sqlite3.php')) {
                die_freepbx("Your PHP installation has no PEAR/SQLite3 support. Please install php-sqlite3 and php-pear.");
            }
            $datasource = "sqlite3:///asteriskcdr.db?mode=0666";
            $options = array('debug' => 4, 'portability' => DB_PORTABILITY_NUMROWS);
        } else {
            $datasource = DB_TYPE . '://' . USER . ':' . PASS . '@' . HOST . '/' . DBNAME;
        }
    }
    if (!empty($options)) {
        $db = DB::connect($datasource, $options);
    } else {
        $db = DB::connect($datasource);
    }
    // attempt connection
    if (DB::isError($db)) {
        die($db->getDebugInfo());
    }
    return $db;
}
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:defines.php

示例3: setcid_edit

function setcid_edit($cid_id, $description, $cid_name, $cid_num, $dest)
{
    global $db;
    $sql = "UPDATE setcid SET " . "description = '" . $db->escapeSimple($description) . "', " . "cid_name = '" . $db->escapeSimple($cid_name) . "', " . "cid_num = '" . $db->escapeSimple($cid_num) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE cid_id = " . $db->escapeSimple($cid_id);
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die_freepbx($result->getMessage() . $sql);
    }
}
开发者ID:hardikk,项目名称:HNH,代码行数:9,代码来源:functions.inc.php

示例4: contactdir_get_all_server_types

function contactdir_get_all_server_types()
{
    global $db;
    $sql = "select * from contactdir_server_types";
    $results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
    if (DB::IsError($results)) {
        die_freepbx($result->getDebugInfo());
    }
    return $results;
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:10,代码来源:functions.inc.php

示例5: legacy_extensions_del

function legacy_extensions_del($context, $exten)
{
    global $db;
    $sql = "DELETE FROM extensions WHERE context = '" . $db->escapeSimple($context) . "' AND `extension` = '" . $db->escapeSimple($exten) . "'";
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die_freepbx($sql . "<br>\n" . $result->getMessage());
    }
    return $result;
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:10,代码来源:legacy.functions.php

示例6: ttsengines_get_all_engines

function ttsengines_get_all_engines()
{
    global $db;
    $sql = "select * from ttsengines";
    $results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
    if (DB::IsError($results)) {
        die_freepbx($result->getDebugInfo());
    }
    return $results;
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:10,代码来源:functions.inc.php

示例7: __construct

 /**
  * Connecting to the Database object
  * If you pass nothing to this it will assume the default database
  *
  * Otherwise you can send it parameters that match PDO parameter settings:
  * PDO::__construct ( string $dsn [, string $username [, string $password [, array $options ]]] )
  *
  * You will then be returned a PDO Database object that you can work with
  * to manipulate databases outside of FreePBX, a good example of this is with
  * CDRs where the module has to connect to the external CDR Database
  */
 public function __construct()
 {
     $args = func_get_args();
     if (is_object($args[0]) && get_class($args[0]) == "FreePBX") {
         $this->FreePBX = $args[0];
         array_shift($args);
     }
     if (class_exists("FreePBX")) {
         $amp_conf = \FreePBX::$conf;
     } else {
         if (is_array($args[0]) && !empty($args[0])) {
             $amp_conf = $args[0];
             array_shift($args);
         } else {
             throw new \Exception("FreePBX class does not exist, and no amp_conf found.");
         }
     }
     //Isset, not empty and is a string that's the only valid DSN we will accept here
     if (isset($args[0]) && !empty($args[0]) && is_string($args[0])) {
         $dsn = $args[0];
     } else {
         if (empty($amp_conf['AMPDBSOCK'])) {
             $host = !empty($amp_conf['AMPDBHOST']) ? $amp_conf['AMPDBHOST'] : 'localhost';
             $dsn = $amp_conf['AMPDBENGINE'] . ":host=" . $host . ";dbname=" . $amp_conf['AMPDBNAME'] . ";charset=utf8";
         } else {
             $dsn = $amp_conf['AMPDBENGINE'] . ":unix_socket=" . $amp_conf['AMPDBSOCK'] . ";dbname=" . $amp_conf['AMPDBNAME'] . ";charset=utf8";
         }
     }
     if (isset($args[1]) && !empty($args[0]) && is_string($args[0])) {
         $username = $args[1];
     } else {
         $username = $amp_conf['AMPDBUSER'];
     }
     if (isset($args[2]) && !empty($args[0]) && is_string($args[0])) {
         $password = $args[2];
     } else {
         $password = $amp_conf['AMPDBPASS'];
     }
     $options = isset($args[3]) ? $args[3] : array();
     if (version_compare(PHP_VERSION, '5.3.6', '<')) {
         $options[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
     }
     try {
         if (!empty($options)) {
             parent::__construct($dsn, $username, $password, $options);
         } else {
             parent::__construct($dsn, $username, $password);
         }
     } catch (\Exception $e) {
         die_freepbx($e->getMessage(), $e);
     }
     $this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
 }
开发者ID:powerpbx,项目名称:framework,代码行数:64,代码来源:Database.class.php

示例8: parse

 function parse($strInputXML)
 {
     $this->resParser = xml_parser_create();
     xml_set_object($this->resParser, $this);
     xml_set_element_handler($this->resParser, "tagOpen", "tagClosed");
     xml_set_character_data_handler($this->resParser, "tagData");
     $this->strXmlData = xml_parse($this->resParser, $strInputXML);
     if (!$this->strXmlData) {
         die_freepbx(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->resParser)), xml_get_current_line_number($this->resParser)));
     }
     xml_parser_free($this->resParser);
     return $this->arrOutput;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:13,代码来源:xml2Array.class.php

示例9: presencestate_item_del

function presencestate_item_del($id)
{
    global $db;
    $sql = 'DELETE FROM presencestate_prefs WHERE `item_id` = ?';
    $ret = $db->query($sql, array($id));
    if (DB::isError($ret)) {
        die_freepbx("Could not delete presence state.\n");
    }
    $sql = 'DELETE FROM presencestate_list WHERE `id` = ?';
    $ret = $db->query($sql, array($id));
    if (DB::isError($ret)) {
        die_freepbx("Could not delete presence state.\n");
    }
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:14,代码来源:functions.inc.php

示例10: __construct

 /**
  * Connecting to the Database object
  * If you pass nothing to this it will assume the default database
  *
  * Otherwise you can send it parameters that match PDO parameter settings:
  * PDO::__construct ( string $dsn [, string $username [, string $password [, array $options ]]] )
  *
  * You will then be returned a PDO Database object that you can work with
  * to manipulate databases outside of FreePBX, a good example of this is with
  * CDRs where the module has to connect to the external CDR Database
  */
 public function __construct()
 {
     $args = func_get_args();
     if (is_object($args[0]) && get_class($args[0]) == "FreePBX") {
         $this->FreePBX = $args[0];
         array_shift($args);
     }
     $amp_conf = FreePBX::$conf;
     //Isset, not empty and is a string that's the only valid DSN we will accept here
     if (isset($args[0]) && !empty($args[0]) && is_string($args[0])) {
         $dsn = $args[0];
     } else {
         $host = !empty($amp_conf['AMPDBHOST']) ? $amp_conf['AMPDBHOST'] : 'localhost';
         //Note: charset=utf8 requires php 5.3.6 (http://php.net/manual/en/mysqlinfo.concepts.charset.php)
         $dsn = "mysql:host=" . $host . ";dbname=" . $amp_conf['AMPDBNAME'] . ";charset=utf8";
     }
     if (isset($args[1]) && !empty($args[0]) && is_string($args[0])) {
         $username = $args[1];
     } else {
         $username = $amp_conf['AMPDBUSER'];
     }
     if (isset($args[2]) && !empty($args[0]) && is_string($args[0])) {
         $password = $args[2];
     } else {
         $password = $amp_conf['AMPDBPASS'];
     }
     $options = isset($args[3]) ? $args[3] : array();
     if (version_compare(PHP_VERSION, '5.3.6', '<')) {
         $options[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
     }
     try {
         if (!empty($options)) {
             parent::__construct($dsn, $username, $password, $options);
         } else {
             parent::__construct($dsn, $username, $password);
         }
     } catch (\Exception $e) {
         die_freepbx($e->getMessage(), $e);
     }
     $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:52,代码来源:Database.class.php

示例11: getAmpUser

 function getAmpUser($username)
 {
     global $db;
     $sql = "SELECT username, password_sha1, extension_low, extension_high, deptname, sections FROM ampusers WHERE username = '" . $db->escapeSimple($username) . "'";
     $results = $db->getAll($sql);
     if ($db->IsError($results)) {
         die_freepbx($sql . "<br>\n" . $results->getMessage());
     }
     if (count($results) > 0) {
         $user = array();
         $user["username"] = $results[0][0];
         $user["password_sha1"] = $results[0][1];
         $user["extension_low"] = $results[0][2];
         $user["extension_high"] = $results[0][3];
         $user["deptname"] = $results[0][4];
         $user["sections"] = explode(";", $results[0][5]);
         return $user;
     } else {
         return false;
     }
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:21,代码来源:ampuser.class.php

示例12: sql

function sql($sql, $type = "query", $fetchmode = null)
{
    global $db;
    $results = $db->{$type}($sql, $fetchmode);
    /* FUTURE
    	switch($type) {
    		case "query":
    			$results = $db->$type($sql);
    			break;
    		case "getAssoc":
    			$results = $db->$type($sql,false,array(),$fetchmode);
    			break;
    		default:
    			$results = $db->$type($sql,array(),$fetchmode);
    			break;
    	}
    	*/
    if (DB::IsError($results)) {
        die_freepbx($results->getDebugInfo() . "SQL - <br /> {$sql}");
    }
    return $results;
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:22,代码来源:sql.functions.php

示例13: languages_edit

function languages_edit($language_id, $description, $lang_code, $dest)
{
    global $db;
    $sql = "UPDATE languages SET " . "description = '" . $db->escapeSimple($description) . "', " . "lang_code = '" . $db->escapeSimple($lang_code) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE language_id = " . $db->escapeSimple($language_id);
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die_freepbx($result->getMessage() . $sql);
    }
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:9,代码来源:functions.inc.php

示例14: callrecording_edit

function callrecording_edit($callrecording_id, $description, $callrecording_mode, $dest)
{
    global $db;
    $sql = "UPDATE callrecording SET " . "description = '" . $db->escapeSimple($description) . "', " . "callrecording_mode = '" . $db->escapeSimple($callrecording_mode) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE callrecording_id = " . $db->escapeSimple($callrecording_id);
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die_freepbx($result->getMessage() . $sql);
    }
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:9,代码来源:functions.inc.php

示例15: DATE_SUB

	if((!$rule_match['status']) || (!$rule_match['number'])){
		if($debug)
		{
			print "Searching Superfecta Cache ... ";
		}
		
		//clear old cache
		$sql = "DELETE FROM superfectacache WHERE dateentered < DATE_SUB(NOW(),INTERVAL ".(isset($run_param['Cache_Timeout'])?$run_param['Cache_Timeout']:$source_param['Cache_Timeout']['default'])." DAY)";
		$db->query($sql);
		
		//query cache
		$sql = "SELECT callerid FROM superfectacache WHERE number = '$thenumber'";
		$sres = $db->getOne($sql);
		if (DB::IsError($sres))
		{
			die_freepbx( "Error: " . $sres->getMessage() .  "<br>");
		}
		
		//check to see if there is a valid return and that it's not numeric
		if(($sres != '') && !is_numeric($sres))
		{
			$caller_id = $sres;
			$cache_found = true;
		}
		else if($debug)
		{
			print "not found<br>\n";
		}
	}elseif($debug){
		print "Matched cache exclusion rule: '".$rule_match['pattern']."' with: '".$rule_match['number']."'<br>\nSkipping cache 
lookup.<br>\n";
开发者ID:roverwolf,项目名称:Caller-ID-Superfecta,代码行数:31,代码来源:source-Superfecta_Cache.php


注:本文中的die_freepbx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。