Changeset 1690
- Timestamp:
- 04/21/06 16:46:22 (7 years ago)
- Files:
-
- freepbx/trunk/amp_conf/bin/retrieve_conf (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/config.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/bin/retrieve_conf
r1684 r1690 3 3 4 4 define("AMP_CONF", "/etc/amportal.conf"); 5 define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 5 6 6 7 function out($text) { … … 39 40 foreach ($file as $line) { 40 41 if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\%-]*)\"?\s*([;#].*)?/",$line,$matches)) { 42 $conf[ $matches[1] ] = $matches[2]; 43 } 44 } 45 return $conf; 46 } 47 48 function parse_asterisk_conf2($filename) { 49 $file = file($filename); 50 foreach ($file as $line) { 51 if (preg_match("/^\s*([a-zA-Z0-9]+)\s* => \s*(.*)\s*([;#].*)?/",$line,$matches)) { 41 52 $conf[ $matches[1] ] = $matches[2]; 42 53 } … … 123 134 $amp_conf = parse_amportal_conf2(AMP_CONF); 124 135 if (count($amp_conf) == 0) { 136 fatal("FAILED"); 137 } 138 out("OK"); 139 140 outn("Reading ".ASTERISK_CONF.".."); 141 $asterisk_conf = parse_asterisk_conf2(ASTERISK_CONF); 142 if (count($asterisk_conf) == 0) { 125 143 fatal("FAILED"); 126 144 } … … 300 318 301 319 function write_file($filename,$contents) { 302 if ($fd = fopen("/etc/asterisk/".$filename, "w")) { 320 global $asterisk_conf; 321 if ($fd = fopen($asterisk_conf['astetcdir'].'/'.$filename, "w")) { 303 322 fwrite($fd, $contents); 304 323 fclose($fd); freepbx/trunk/amp_conf/htdocs/admin/config.php
r1542 r1690 26 26 // get settings 27 27 $amp_conf = parse_amportal_conf("/etc/amportal.conf"); 28 28 $asterisk_conf = parse_asterisk_conf("/etc/asterisk/asterisk.conf"); 29 29 30 include 'header_auth.php'; 30 31
