public function setLocale() { $locale = $_REQUEST['locale']; $city_id = intval($_REQUEST['city']); $weather = new Weather(); if (in_array($locale, Config::get('allowed_locales'))) { return $this->db->update('users', array('locale' => $locale, $weather->getCityFieldName() => $city_id), array('id' => $this->id)); } return false; }