public function index() { if (!empty($_POST)) { if ($this->isConfigChangeable()) { foreach ($_POST as $post_key => $value) { $parts = explode('/', $post_key); $social = $parts[0]; $key = $parts[1]; Api_key::inst()->where(array('social' => $social, 'key' => $key))->update('value', $value ? $value : NULL); } $this->addFlash(lang('api_update_success'), 'success'); } else { } } $api_keys = Api_key::inst()->get(); $this->template->set('api_keys', $api_keys); $this->template->render(); }
protected function _prepare_url($second = null) { $venueId = $this->_get_venueid_from_url(); $keys = Api_key::inst()->value('foursquare'); $json_url = 'http://api.foursquare.com/v2/venues/' . $venueId; if ($second) { $json_url .= '/tips'; } $data = array('sort' => 'recent', 'client_id' => $keys['client_id'], 'client_secret' => $keys['client_secret'], 'limit' => 500, 'v' => date('Ymd', now())); return $json_url . '?' . http_build_query($data); }