public static function updateFromID($metaid, $value) { // Update single meta dataset by using the meta id $update = array("id" => $metaid, "value" => $value); $sql = new SqlManager(); $sql->update("meta", $update); }
public static function save($code, $value, $lang = null) { // Save specific locale value by given key if (!$lang) { $lang = self::getLanguage(); } // Check if locale already exists $sql = new SqlManager(); $sql->setQuery("\n\t\t\tSELECT code FROM locale \n\t\t\tWHERE code = '{{code}}' \n\t\t\tAND language = {{lang}}\n\t\t\tLIMIT 1"); $sql->bindParam('{{code}}', $code); $sql->bindParam('{{lang}}', $lang, "int"); $check = $sql->result(); $loc = array('code' => $sql->escape($code), 'language' => $sql->escape($lang, "int"), 'text' => $sql->escape($value), 'lastchanged' => DateManager::now()); // Either update database or insert new entry for given locale if (!$check['code']) { $loc['created'] = DateManager::now(); $sql->insert("locale", $loc); } else { $sql->update("locale", $loc); } // Refresh cache to make sure new locale entry will be used $cachekey = "locale:" . $lang; Cache::clear($cachekey); self::load($lang); }
public function set($name, $value) { // Set config and update database $sql = new SqlManager(); $set = array("name" => $name, "user_id" => $this->user, "value" => $value); if (isset($this->config[$name])) { $sql->update("config", $set); } else { $sql->insert("config", $set); } $this->config[$name] = $value; }
public static function save($type, $id, $data) { $data['object_type'] = $type; $data['object_id'] = $id; $sql = new SqlManager(); if (!isset($data['id'])) { $sql->insert("version", $data); } else { $sql->setQuery("\n\t\t\t\tSELECT id FROM version\n\t\t\t\tWHERE id = {{id}}\n\t\t\t\tLIMIT 1\n\t\t\t\t"); $sql->bindParam("{{id}}", $data['id']); $check = $sql->result(); if (isset($check['id'])) { $sql->update("version", $data); } else { $sql->insert("version", $data); } } }
public function update(array $data) { // Update user in database from given data array $sql = new SqlManager(); $sql->update("user", $data); }