maj syntaxe accolades, maj jQuery, correction layout contact
[mtweb] / web / app / data / modules / xml / mw_data_config.php
index 98d4607..359a16c 100644 (file)
@@ -1,28 +1,27 @@
 <?php
 
-  class mw_data_config extends mw_data
-  {
+  class mw_data_config extends mw_data{
 
-    function config($key = null)
-    { $sgbd = $this->sgbd();
+    function config($key = null){
+      $sgbd = $this->sgbd();
       $value = false;
-      if($rst = $sgbd->open_data("config"))
-      { if(isset($key))
-        { while($v_rst = $sgbd->fetch_data($rst))
-          { if(isset($v_rst))
-            { if($v_rst["key"] == $key)
-              { $value = $v_rst["value"];
+      if($rst = $sgbd->open_data("config")){
+        if(isset($key)){
+          while($v_rst = $sgbd->fetch_data($rst)){
+            if(isset($v_rst)){
+              if($v_rst["key"] == $key){
+                $value = $v_rst["value"];
               }
             }
             else $value = null;
           }
         }
-        else
-        { $value = array();
-          while($v_rst = $sgbd->fetch_data($rst))
-          { if(isset($v_rst))
-            { if(is_array($v_rst)) foreach($v_rst as $key => $_value)
-              { $value[$key] = $_value;
+        else{
+          $value = array();
+          while($v_rst = $sgbd->fetch_data($rst)){
+            if(isset($v_rst)){
+              if(is_array($v_rst)) foreach($v_rst as $key => $_value){
+                $value[$key] = $_value;
                 break;
               }
             }
       return $value;
     }
 
-    function config_exists($key)
-    { $sgbd = $this->sgbd();
+    function config_exists($key){
+      $sgbd = $this->sgbd();
       $exists = 0;
-      if($rst = $sgbd->open_data("config"))
-      { while($v_rst = $sgbd->fetch_data($rst))
-        { if(isset($v_rst))
-          { if(isset($v_rst[$key])) $exists++;
+      if($rst = $sgbd->open_data("config")){
+        while($v_rst = $sgbd->fetch_data($rst)){
+          if(isset($v_rst)){
+            if(isset($v_rst[$key])) $exists++;
           }
-          else
-          { $exists = false;
+          else{
+            $exists = false;
             break;
           }
         }
       return $exists;
     }
 
-    function set_config($key, $value)
-    { $sgbd = $this->sgbd();
+    function set_config($key, $value){
+      $sgbd = $this->sgbd();
       $FOUND = false;
-      if($rst = $sgbd->open_data("config"))
-      { while($v_rst = $sgbd->fetch_data($rst))
-        { if(isset($v_rst))
-          { if(array_key_exists($key, $v_rst))
-            { $FOUND = $sgbd->set_data("config", $v_rst["id"], array($key => $value));
+      if($rst = $sgbd->open_data("config")){
+        while($v_rst = $sgbd->fetch_data($rst)){
+          if(isset($v_rst)){
+            if(array_key_exists($key, $v_rst)){
+              $FOUND = $sgbd->set_data("config", $v_rst["id"], array($key => $value));
               break;
             }
           }
-          else
-          { $FOUND = null;
+          else{
+            $FOUND = null;
             break;
           }
         }
         $sgbd->close_data($rst);
       }
       else $FOUND = null;
-      if(isset($FOUND))
-      { if($FOUND) return true;
-        else
-        { if($sgbd->add_data("config", array($key => $value))) return true;
+      if(isset($FOUND)){
+        if($FOUND) return true;
+        else{
+          if($sgbd->add_data("config", array($key => $value))) return true;
         }
       }
       return false;
     }
 
-    function del_config($key)
-    { $ids = array();
+    function del_config($key){
+      $ids = array();
       $sgbd = $this->sgbd();
-      if($rst = $sgbd->open_data("config"))
-      { while($v_rst = $sgbd->fetch_data($rst))
-        { if(isset($v_rst))
-          { if(isset($v_rst[$key]) && isset($v_rst["id"]))
-            { $ids[] = $v_rst["id"];
+      if($rst = $sgbd->open_data("config")){
+        while($v_rst = $sgbd->fetch_data($rst)){
+          if(isset($v_rst)){
+            if(isset($v_rst[$key]) && isset($v_rst["id"])){
+              $ids[] = $v_rst["id"];
             }
           }
           else $ids = false;