[Pkg-voip-commits] r5518 - /freepbx-modules/trunk/modules/core/functions.inc.php

tzafrir-guest at alioth.debian.org tzafrir-guest at alioth.debian.org
Wed Apr 9 09:56:22 UTC 2008


Author: tzafrir-guest
Date: Wed Apr  9 09:56:22 2008
New Revision: 5518

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=5518
Log:
Reverting changes in source files that are included in patches.

Modified:
    freepbx-modules/trunk/modules/core/functions.inc.php

Modified: freepbx-modules/trunk/modules/core/functions.inc.php
URL: http://svn.debian.org/wsvn/pkg-voip/freepbx-modules/trunk/modules/core/functions.inc.php?rev=5518&op=diff
==============================================================================
--- freepbx-modules/trunk/modules/core/functions.inc.php (original)
+++ freepbx-modules/trunk/modules/core/functions.inc.php Wed Apr  9 09:56:22 2008
@@ -1802,9 +1802,20 @@
 	
 	if ($amp_conf["AMPDBENGINE"] == "sqlite3")
 	{
-		$possible_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT_%' ORDER BY variable,value","getAll");
-		$disabled_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUTDISABLE_%' ORDER BY variable,value","getAll");
-		$unique_trunks = array_diff($possible_trunks, $disabled_trunks);
+		// TODO: sqlite work arround - diego
+		// TODO: WILL NOT WORK, need to remove the usage of SUBSTRING
+		// need to reorder the trunks in PHP code
+		$sqlstr  = "SELECT t.variable, t.value, d.value state FROM `globals` t ";
+		$sqlstr .= "JOIN (SELECT x.variable, x.value FROM globals x WHERE x.variable LIKE 'OUTDISABLE\_%') d ";
+		$sqlstr .= "ON substring(t.variable,5) = substring(d.variable,12) WHERE t.variable LIKE 'OUT\_%' ";
+		$sqlstr .= "UNION ALL ";
+		$sqlstr .= "SELECT v.variable, v.value, concat(substring(v.value,1,0),'off') state  FROM `globals` v ";
+		$sqlstr .= "WHERE v.variable LIKE 'OUT\_%' AND concat('OUTDISABLE_',substring(v.variable,5)) NOT IN ";
+		$sqlstr .= " ( SELECT variable from globals WHERE variable LIKE 'OUTDISABLE\_%' ) ";
+		$sqlstr .= "ORDER BY variable";
+
+		//$unique_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT_%' ORDER BY variable","getAll"); 
+		$unique_trunks = sql($sqlstr,"getAll"); 
 	}
 	else
 	{
@@ -2690,13 +2701,6 @@
 	$filename = isset($asterisk_conf["astetcdir"]) && $asterisk_conf["astetcdir"] != '' ? rtrim($asterisk_conf["astetcdir"],DIRECTORY_SEPARATOR) : "/etc/asterisk";
 	$filename .= "/indications.conf";
 	$fd = fopen($filename, "w");
-
-	if ( ($fd = fopen($filename, "w")) === FALSE) {
-		// TODO: Also add errno information.
-		echo "Failed to open indications file for writing: $filename.<br>\n";
-		return;
-	}
-
 	fwrite($fd, "[general]\ncountry=".$result['value']."\n\n");
 
 	$zonelist = general_get_zonelist();




More information about the Pkg-voip-commits mailing list