public static function update_user_info($user, $info) {
		if(!is_array($info)) {
			throw new OsimoException(OSIMO_EXPECTED_ARRAY, "Expected array for second argument to update_user_info");
		}
		
		$userID = 0;
		if(is_numeric($user)) {
			$userID = $user;
		} elseif(is_object($user) && $user instanceof OsimoUser) {
			$userID = $user->id;
		}
		
		$info = OsimoDB::escape($info, true);
		$result = get('db')->update('users')->set($info)->where("id = %d", $userID)->update();
		if(!$result) {
			throw new OsimoException(USER_UPDATE_FAIL, "There was an error updating the information for this user");
		}
	}
Ejemplo n.º 2
0
 private function parseWhere()
 {
     if (isset($this->where['vars'])) {
         return call_user_func_array('sprintf', array_merge((array) $this->where['str'], OsimoDB::escape($this->where['vars'], true)));
     }
     return $this->where['str'];
 }