Ejemplo n.º 1
0
 public static function add($option, $value = '', $type = false, $group = false)
 {
     if ($option !== '') {
         if ($group == false) {
             $group = Options::group($option);
         }
         if ($type == false) {
             $type = Options::type($option);
         }
         $db = Database::getDatabase();
         $db->query('REPLACE INTO options (`key`, `value`, `type`, `group`) VALUES (:key:, :value:, :type:, :group:)', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
         return $db->affectedRows();
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 public static function add($option, $value = '', $type = false, $group = false)
 {
     $db = Database::getDatabase();
     /*if ($value == '') $value = Options::value($option);*/
     if ($type == false) {
         $type = Options::type($option);
     }
     if ($group == false) {
         $group = Options::group($option);
     }
     if (Options::exists($option)) {
         $db->query('UPDATE
                        options
                        SET
                        `value`=:value:, `type`=:type:, `group`=:group:
                        WHERE
                        `key`=:key:', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
         /*echo "Update option";*/
     } else {
         $db->query('INSERT INTO
                     options
                     (`key`, `value`, `type`, `group`)
                     VALUES
                     (:key:, :value:, :type:, :group:)', array('key' => $option, 'value' => $value, 'type' => $type, 'group' => $group));
         /*echo "Inserted new option";*/
     }
     return $db->affectedRows();
 }