X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=web%2Fapp%2Fdata%2Fmodules%2Fsql%2Fmw_data_config.php;fp=web%2Fapp%2Fdata%2Fmodules%2Fsql%2Fmw_data_config.php;h=0000000000000000000000000000000000000000;hb=36ed114046cbe3d72a3589230e9f306a54fcc79d;hp=ca45faac16b88f212dadba44c261e92a1bab7ebd;hpb=281c96e95451269f2614684b8de5be25862c8374;p=mtweb diff --git a/web/app/data/modules/sql/mw_data_config.php b/web/app/data/modules/sql/mw_data_config.php deleted file mode 100644 index ca45faa..0000000 --- a/web/app/data/modules/sql/mw_data_config.php +++ /dev/null @@ -1,70 +0,0 @@ -sgbd(); - $value = false; - try{ - if(isset($key)){ - $value = ""; - $sql = "SELECT `value` FROM #--config WHERE `key`=".$this->eq($key); - $rst = $sgbd->query($sql); - if($v_rst = $sgbd->fetch_assoc($rst)) $value = $v_rst["value"]; - $sgbd->free_result($rst); - } - else{ - $value = array(); - $sql = "SELECT * FROM #--config"; - $rst = $sgbd->query($sql); - while($v_rst = $sgbd->fetch_assoc($rst)) $value[$v_rst["key"]] = $v_rst["value"]; - $sgbd->free_result($rst); - } - } - catch(Exception $e) { $value = false; } - return $value; - } - - function config_exists($key){ - $sgbd = $this->sgbd(); - $exists = false; - try{ - $sql = "SELECT count(*) as n FROM #--config WHERE `key`=".$this->eq($key); - $rst = $sgbd->query($sql); - if($v_rst = $sgbd->fetch_assoc($rst)) $exists = $v_rst["n"]; - $sgbd->free_result($rst); - } - catch(Exception $e) { $exists = false; } - return $exists; - } - - function set_config($key, $value){ - $sgbd = $this->sgbd(); - if(($exists = $this->config_exists($key)) === false) return false; - try{ - if($exists) $sql = - "UPDATE #--config" - ." SET `value`=".$this->eq($value) - ." WHERE `key`=".$this->eq($key); - else $sql = - "INSERT INTO #--config" - ." VALUES(NULL, ".$this->eq($key).", ".$this->eq($value).")"; - $sgbd->query($sql); - } - catch(Exception $e) { return false; } - return true; - } - - function del_config($key){ - $sgbd = $this->sgbd(); - try{ - $sql = "DELETE FROM #--config WHERE `key`=".$this->eq($key); - $sgbd->query($sql); - } - catch(Exception $e) { return false; } - return true; - } - - } - -?> \ No newline at end of file