예제 #1
0
 public function save()
 {
     $query = "INSERT INTO " . self::TABLE_NAME . " (setting_id, value) VALUES (?, ?)\n                  ON DUPLICATE KEY UPDATE value = ?";
     return DBCore::doUpdateQuery($query, "sss", array($this->id, $this->value, $this->value));
 }
예제 #2
0
파일: User.php 프로젝트: asymptix/framework
 /**
  * Updates users avatar image file path in the DB.
  *
  * @param string $newAvatarFileName New filename.
  *
  * @return boolean Success flag.
  */
 public function updateAvatar($newAvatarFileName)
 {
     $currentAvatarFileName = $this->avatar;
     if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS . $currentAvatarFileName)) {
         unlink(Config::DIR_AVATARS . $currentAvatarFileName);
     }
     if (file_exists(Config::DIR_AVATARS . $newAvatarFileName)) {
         $query = "UPDATE " . self::TABLE_NAME . " SET avatar = ?" . " WHERE " . self::ID_FIELD_NAME . " = ?";
         if (DBCore::doUpdateQuery($query, "si", array($newAvatarFileName, $this->id))) {
             $this->avatar = $newAvatarFileName;
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
예제 #3
0
 /**
  * Saves removement flag to the database.
  *
  * @return integer Returns the number of affected rows on success, and -1 if
  *            the last query failed.
  */
 public function saveRemovementFlag()
 {
     $this->changeUpdateTime();
     return DBCore::doUpdateQuery("UPDATE " . static::TABLE_NAME . "\n                SET removed = ?,\n                    update_time = ?,\n                    update_user_id = ?\n             WHERE " . static::ID_FIELD_NAME . " = ?\n             LIMIT 1", "isii", array($this->removed, $this->updateTime, $this->updateUserId, $this->id));
 }