Changeset 10962 for freepbx/trunk

Show
Ignore:
Timestamp:
01/14/11 19:30:58 (2 years ago)
Author:
p_lindheimer
Message:

don't use sql() as will probably want to use as part of install_amp, and a few fixes re #4740

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/libraries/config.functions.php

    r10959 r10962  
    111111 
    112112  // php4 constructor 
    113   function freepbx_conf($var) { 
     113  function freepbx_conf() { 
    114114    $this->__construct(); 
    115115  } 
     
    118118  //       a db value incorrectly. 
    119119  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    } 
    121126    foreach($db_raw as $setting) { 
    122127      $this->db_conf_store[$setting['keyword']] = $setting; 
     
    294299  // 
    295300  function define_conf_setting($keyword,$vars,$commit=false) { 
     301    global $amp_conf; 
    296302    $attributes = array( 
    297303      'keyword' => '', 
     
    337343      } 
    338344    } 
    339     if ($attributes != $this->db_conf_store[$keyword]) { 
     345    if ($new_setting || $attributes != $this->db_conf_store[$keyword]) { 
    340346      if (!$new_setting) { 
    341347        unset($attributes['keyword']); 
     
    346352      foreach ($attributes as $key => $val) { 
    347353        $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]; 
    348358      } 
    349359      $this->db_conf_store[$keyword]['modified'] = true; 
     
    408418  // 
    409419  function remove_conf_settings($settings) { 
    410     global $amp_conf; 
     420    global $db,$amp_conf; 
    411421    if (!is_array($settings)) { 
    412422      $settings = array($settings); 
     
    425435    } 
    426436    $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    } 
    428441  } 
    429442