コード例 #1
0
ファイル: ivr.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * This method will write all of the entry elements with
  * their corresponding attributes
  * @return void
  */
 private function write_entries($ivr_id)
 {
     $query = sprintf("SELECT * FROM ivr_entries WHERE ivr_id={$ivr_id} ORDER BY digits");
     $entries_array = $this->db->queryAll($query);
     if (FS_PDO::isError($entries_array)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return;
     }
     $entries_count = count($entries_array);
     if ($entries_count < 1) {
         return;
     }
     $entries_count = count($entries_array);
     for ($i = 0; $i < $entries_count; $i++) {
         //$this -> comment_array($entries_array[$i]);
         $this->xmlw->startElement('entry');
         $this->xmlw->writeAttribute('action', $entries_array[$i]['action']);
         $this->xmlw->writeAttribute('digits', $entries_array[$i]['digits']);
         if (!empty($entries_array[$i]['params'])) {
             $this->xmlw->writeAttribute('param', $entries_array[$i]['params']);
         }
         $this->xmlw->endElement();
         //</param>
     }
 }
コード例 #2
0
ファイル: lcr.php プロジェクト: u2rafi/fs_curl
 function lcr_lookup(&$obj)
 {
     $obj->comment_array($obj->request);
     $digitstr = $obj->request['destination_number'];
     $digitlen = strlen($digitstr);
     $where_clause = '';
     for ($i = 0; $i < $digitlen; $i++) {
         $where_clause .= sprintf("%s digits='%s' ", $i == 0 ? "WHERE" : "OR", substr($digitstr, 0, $i + 1));
     }
     $query = sprintf("SELECT l.digits, c.Carrier_Name, l.rate, cg.id, cg.gateway, cg.id AS gwid, l.lead_strip, l.trail_strip, l.prefix, l.suffix FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id %s ORDER BY length(digits) DESC, rate;", $where_clause);
     $res = $obj->db->query($query);
     $obj->comment($query);
     if (FS_PDO::isError($res)) {
         $obj->comment($query);
         $obj->comment($this->db->getMessage());
         $obj->file_not_found();
     }
     $carriers = array();
     while ($row = $res->fetchRow()) {
         $carrier_id = $row['gwid'];
         if (array_key_exists($carrier_id, $carriers)) {
             continue;
         }
         $carriers[$carrier_id] = true;
         $datastr = sprintf('sofia/gateway/%s/%s', $row['gateway'], $digitstr);
         $results[] = array('type' => 'action', 'data' => $datastr);
     }
     return $results;
 }
コード例 #3
0
ファイル: acl.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Fetch the ACL data from the database
  *
  * @return array $acl_data
  */
 private function get_acl()
 {
     $query = sprintf('SELECT * FROM acl_lists al JOIN acl_nodes an ON an.list_id=al.id;');
     $acl_data = $this->db->queryAll($query);
     if (FS_PDO::isError($profiles)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return array();
     }
     return $acl_data;
 }
コード例 #4
0
ファイル: console.conf.php プロジェクト: rithyskun/vBilling
	private function get_config() {
		$query = sprintf('SELECT * FROM console_conf');
		$params_array = $this -> db -> queryAll($query);
		$params_count = count($params_array);
		if (FS_PDO::isError($params_array)) {
			$this -> comment($query);
			$this -> comment($this -> db -> getMessage());
			return ;
		}
		return $params_array;
	}
コード例 #5
0
ファイル: dialplan_importer.php プロジェクト: u2rafi/fs_curl
/**
 * Perform Insert Query
 * take MDB2 object and query as params and
 * perform query, setting error flag in the event
 * of a db error.
 * @return null
*/
function run_query($db, $query)
{
    syslog(LOG_INFO, $query);
    $affected = $db->exec($query);
    if (FS_PDO::isError($affected)) {
        if (!defined('UNSUCCESSFUL_QUERY')) {
            define('UNSUCCESSFUL_QUERY', true);
        }
        echo "{$query}<br>\n";
        echo $affected->getMessage() . "\n";
    }
}
コード例 #6
0
ファイル: rss.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Get RSS feed info from DB
  *
  * @return array
  */
 function get_feeds_array()
 {
     $query = sprintf('SELECT * FROM rss_conf ORDER BY priority, local_file;');
     $res = $this->db->query($query);
     if (FS_PDO::isError($res)) {
         return false;
     }
     while ($row = $res->fetchRow()) {
         $feeds_array[] = $row;
     }
     return $feeds_array;
 }
コード例 #7
0
/**
* Allow config files that aren't tied to any module
*
* @param string $conf
* @return bool
*/
private function is_modless_conf($conf) {
	// $this -> comment("conf is $conf");
	$query = sprintf(
		"SELECT COUNT(*) cnt FROM modless_conf WHERE conf_name = '$conf';"
		);
	$res = $this -> db -> query($query);
	if (FS_PDO::isError($res)) {
		// $this -> comment($query);
		// $this -> comment($res -> getMessage());
		return true; //default allow policy
		return false; //comment previous line to default deny
	}
	$row = $res -> fetchRow();
	//$this -> comment($row['cnt']);
	return $row['cnt'];
}
コード例 #8
0
ファイル: limit.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Pull limit params from the db
  * @return array
  */
 private function get_params_array()
 {
     $query = sprintf('SELECT * FROM limit_conf;');
     $res = $this->db->query($query);
     if (FS_PDO::isError($res)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return array();
     }
     $this->comment($res->numRows() . 'rows');
     if ($res->numRows() == 0) {
         return array();
     }
     while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
         $feeds_array[] = $row;
     }
     return $feeds_array;
 }
コード例 #9
0
 /**
  * This method will pull the postloaded modules from the database
  * @return array
  */
 function get_modules_array()
 {
     $query = sprintf("SELECT * FROM post_load_modules_conf WHERE load_module='1' ORDER BY priority;");
     $res = $this->db->query($query);
     if (FS_PDO::isError($res)) {
         $this->comment($query);
         $this->comment($res->getMessage());
         return array();
     }
     $this->comment($res->numRows() . ' rows');
     if ($res->numRows() == 0) {
         return array();
     }
     while ($row = $res->fetchRow()) {
         $feeds_array[] = $row;
     }
     return $feeds_array;
 }
コード例 #10
0
ファイル: lcr.conf.php プロジェクト: u2rafi/fs_curl
 private function get_profiles()
 {
     $query = sprintf('SELECT *, lp.id AS lcr_id FROM lcr_profiles lp
             LEFT JOIN lcr_settings ls ON ls.lcr_id = lp.id
             ORDER BY lp.id;');
     $settings_array = $this->db->queryAll($query);
     $settings_count = count($settings_array);
     if (FS_PDO::isError($settings_array)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return;
     }
     $settings = array();
     for ($i = 0; $i < $settings_count; $i++) {
         $profile = $settings_array[$i]['profile_name'];
         $param = $settings_array[$i]['param_name'];
         $settings[$profile]['id'] = $settings_array[$i]['lcr_id'];
         $settings[$profile][$param] = $settings_array[$i]['param_value'];
     }
     return $settings;
 }
コード例 #11
0
ファイル: voicemail.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Write XML for voicemail email settings
  * @return void
  */
 private function write_email($profile_id)
 {
     $query = sprintf('%s %s %s;', "SELECT * FROM voicemail_email ", "WHERE voicemail_id={$profile_id} ", "ORDER BY voicemail_id, param_name");
     $settings_array = $this->db->queryAll($query);
     $settings_count = count($settings_array);
     if (FS_PDO::isError($settings_array)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return;
     }
     if ($settings_count < 1) {
         return;
     }
     $this->xmlw->startElement('email');
     for ($i = 0; $i < $settings_count; $i++) {
         //$this -> comment_array($settings_array[$i]);
         $this->xmlw->startElement('param');
         $this->xmlw->writeAttribute('name', $settings_array[$i]['param_name']);
         $this->xmlw->writeAttribute('value', $settings_array[$i]['param_value']);
         $this->xmlw->endElement();
         //</param>
     }
     $this->xmlw->endElement();
 }
コード例 #12
0
ファイル: fs_directory.php プロジェクト: u2rafi/fs_curl
 function get_domains($domain = NULL)
 {
     $where = '';
     if ($domain) {
         $where = sprintf("WHERE domain_name='%s'", $domain);
     }
     $query = "SELECT * FROM directory_domains {$where};";
     $this->debug($query);
     $res = $this->db->queryAll($query);
     if (FS_PDO::isError($res)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         $this->comment($this->db->getMessage());
         $this->file_not_found();
     }
     return $res;
 }
コード例 #13
0
ファイル: fs_directory.php プロジェクト: rithyskun/vBilling
	/**
	 * Get all the users' variables
	 */
	private function get_users_vars() {
		$where = '';
		if (! empty ( $this->userid )) {
			$where = sprintf ( 'WHERE directory_id = %d', $this->userid );
		}
		$query = sprintf ( "SELECT * FROM directory_vars %s;", $where );
		// $this->debug ( $query );
		$res = $this->db->queryAll ( $query );
		if (FS_PDO::isError ( $res )) {
			// $this->comment ( $this->db->getMessage () );
			$this->file_not_found ();
		}
		
		$record_count = count ( $res );
		for($i = 0; $i < $record_count; $i ++) {
			$di = $res [$i] ['directory_id'];
			$vn = $res [$i] ['var_name'];
			$this->users_vars [$di] [$vn] = $res [$i] ['var_value'];
		}
	}
コード例 #14
0
ファイル: conference.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Write XML for <caller-controls>
  * This method will write the XML of the array
  * from get_controls_array
  * @return void
  */
 private function write_controls()
 {
     $controls_array = $this->get_controls_array();
     $controls_count = count($controls_array);
     if (FS_PDO::isError($controls_array)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return;
     }
     if ($controls_count < 1) {
         return;
     }
     $this->xmlw->startElement('caller-controls');
     foreach ($controls_array as $group_name => $control_data) {
         $this->xmlw->startElement('group');
         $this->xmlw->writeAttribute('name', $group_name);
         foreach ($control_data as $controls) {
             //$this -> comment_array($controls_array[$i]);
             $this->xmlw->startElement('control');
             $this->xmlw->writeAttribute('action', $controls['action']);
             $this->xmlw->writeAttribute('digits', $controls['digits']);
             if ($controls['data']) {
                 $this->xmlw->writeAttribute('data', $controls['data']);
             }
             $this->xmlw->endElement();
         }
         $this->xmlw->endElement();
     }
     $this->xmlw->endElement();
 }
コード例 #15
0
ファイル: sofia.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Write <domains> XML for current sofia profile
  * @param integer $profile_id id of sofia profile in sofia_conf
  */
 private function write_domains($profile_id)
 {
     $query = "SELECT * FROM sofia_domains WHERE sofia_id={$profile_id}";
     $domain_array = $this->db->queryAll($query);
     $domain_count = count($domain_array);
     if (FS_PDO::isError($domain_array)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         return;
     }
     if ($domain_count < 1) {
         return;
     }
     $this->xmlw->startElement('domains');
     for ($i = 0; $i < $domain_count; $i++) {
         $this->xmlw->startElement('domain');
         $this->xmlw->writeAttribute('name', $domain_array[$i]['domain_name']);
         $this->xmlw->writeAttribute('parse', $domain_array[$i]['parse'] == 1 ? 'true' : 'false');
         $this->xmlw->endElement();
     }
     $this->xmlw->endElement();
 }
コード例 #16
0
ファイル: fs_chatplan.php プロジェクト: u2rafi/fs_curl
    /**
     * This method will pull chatplan from database
     *
     * @param string $context context name for XML chatplan
     * @return array
     */
    private function get_chatplan($context)
    {
        $dp_array = array();
        $dpQuery = sprintf('SELECT
			%1$scontext%1$s,
			%1$sname%1$s as extension,
			%1$sapplication%1$s as application_name,
			%1$sdata%1$s as application_data,
			%1$sfield%1$s as condition_field,
			%1$sexpression%1$s as condition_expression,
			%1$scontinue%1$s as ext_continue,
			%1$stype%1$s
		FROM chatplan
			INNER JOIN chatplan_context USING(chatplan_id)
			INNER JOIN chatplan_extension USING(context_id)
			INNER JOIN chatplan_condition USING(extension_id)
			INNER JOIN chatplan_actions USING(condition_id)
		WHERE context = \'%2$s\'
		ORDER BY chatplan_context.weight,
                 chatplan_extension.weight,
                 chatplan_condition.weight,
                 chatplan_actions.weight', DB_FIELD_QUOTE, $context);
        $this->debug($dpQuery);
        $res = $this->db->query($dpQuery);
        if (FS_PDO::isError($res)) {
            $this->comment($this->db->getMessage());
            $this->file_not_found();
        }
        if ($res->numRows() < 1) {
            $this->debug("nothing to do, let's just return not found");
            $this->file_not_found();
        }
        $condition_number = 0;
        while ($row = $res->fetchRow()) {
            $ct = $row['context'];
            $et = $row['extension'];
            $ec = $row['ext_continue'];
            $app = $row['application_name'];
            $data = $row['application_data'];
            //$app_cdata = $row['app_cdata'];
            $type = $row['type'];
            $cf = $row['condition_field'];
            $ce = $row['condition_expression'];
            //$rcd = $row['re_cdata'];
            $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
            $dp_array[$ct]["{$et};{$ec}"]["{$cf};{$ce};{$cc}"][] = array('type' => $type, 'application' => $app, 'data' => $data, 'is_cdata' => empty($app_cdata) ? '' : $app_cdata);
        }
        return $dp_array;
    }
コード例 #17
0
ファイル: dingaling.conf.php プロジェクト: u2rafi/fs_curl
 /**
  * Write out the XML for the dingaling <settings>
  *@return void
  */
 private function write_settings()
 {
     $query = sprintf('SELECT * FROM dingaling_settings');
     $res = $this->db->queryAll($query);
     if (FS_PDO::isError($res)) {
         $this->comment($query);
         $this->comment($this->db->getMessage());
         $this->file_not_found();
     }
     $setting_count = count($res);
     if ($setting_count > 0) {
         $this->xmlw->startElement('settings');
         for ($i = 0; $i < $setting_count; $i++) {
             $this->xmlw->startElement('param');
             $this->xmlw->writeAttribute('name', $res[$i]['param_name']);
             $this->xmlw->writeAttribute('value', $res[$i]['param_value']);
             $this->xmlw->endElement();
         }
         $this->xmlw->endElement();
     }
 }