Changeset 10962 for freepbx/trunk
- Timestamp:
- 01/14/11 19:30:58 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/libraries/config.functions.php
r10959 r10962 111 111 112 112 // php4 constructor 113 function freepbx_conf( $var) {113 function freepbx_conf() { 114 114 $this->__construct(); 115 115 } … … 118 118 // a db value incorrectly. 119 119 function __construct() { 120 $db_raw = sql('SELECT * from freepbx_settings', 'getAll', DB_FETCHMODE_ASSOC); 120 global $db; 121 $sql = 'SELECT * from freepbx_settings'; 122 $db_raw = $db->getAll($sql, DB_FETCHMODE_ASSOC); 123 if(DB::IsError($result)) { 124 die_freepbx(_('fatal error reading freepbx_settings')); 125 } 121 126 foreach($db_raw as $setting) { 122 127 $this->db_conf_store[$setting['keyword']] = $setting; … … 294 299 // 295 300 function define_conf_setting($keyword,$vars,$commit=false) { 301 global $amp_conf; 296 302 $attributes = array( 297 303 'keyword' => '', … … 337 343 } 338 344 } 339 if ($ attributes != $this->db_conf_store[$keyword]) {345 if ($new_setting || $attributes != $this->db_conf_store[$keyword]) { 340 346 if (!$new_setting) { 341 347 unset($attributes['keyword']); … … 346 352 foreach ($attributes as $key => $val) { 347 353 $this->db_conf_store[$keyword][$key] = $val; 354 } 355 if ($new_setting) { 356 $this->conf[$keyword] =& $this->db_conf_store[$keyword]['value']; 357 $amp_conf[$keyword] =& $this->conf[$keyword]; 348 358 } 349 359 $this->db_conf_store[$keyword]['modified'] = true; … … 408 418 // 409 419 function remove_conf_settings($settings) { 410 global $ amp_conf;420 global $db,$amp_conf; 411 421 if (!is_array($settings)) { 412 422 $settings = array($settings); … … 425 435 } 426 436 $sql = "DELETE FROM freepbx_settings WHERE keyword in ('".implode("','",$settings)."')"; 427 sql($sql); 437 $result = $db->query($sql); 438 if(DB::IsError($result)) { 439 die_freepbx(_('fatal error deleting rows from freepbx_settings: ').$sql); 440 } 428 441 } 429 442
