function updates() { if (DEMO) { $this->session->set_flashdata('warning', lang('disabled_in_demo')); redirect($_SERVER["HTTP_REFERER"]); } if (!$this->Owner) { $this->session->set_flashdata('error', lang('access_denied')); redirect("welcome"); } $this->form_validation->set_rules('purchase_code', lang("purchase_code"), 'required'); $this->form_validation->set_rules('envato_username', lang("envato_username"), 'required'); if ($this->form_validation->run() == true) { $this->db->update('settings', array('purchase_code' => $this->input->post('purchase_code', TRUE), 'envato_username' => $this->input->post('envato_username', TRUE)), array('setting_id' => 1)); redirect('system_settings/updates'); } else { $fields = array('version' => $this->Settings->version, 'code' => $this->Settings->purchase_code, 'username' => $this->Settings->envato_username, 'site' => base_url()); $this->load->helper('update'); $protocol = $this->sma->isSecure() ? 'https://' : 'http://'; $updates = get_remote_contents($protocol . 'tecdiary.com/api/v1/update/', $fields); $this->data['updates'] = json_decode($updates); $bc = array(array('link' => base_url(), 'page' => lang('home')), array('link' => '#', 'page' => lang('updates'))); $meta = array('page_title' => lang('updates'), 'bc' => $bc); $this->page_construct('settings/updates', $meta, $this->data); } }
public function checkUpdate() { $settings = $this->getSettings(); $fields = array('version' => $settings->version, 'code' => $settings->purchase_code, 'username' => $settings->envato_username, 'site' => base_url()); $this->load->helper('update'); $updates = get_remote_contents('https://tecdiary.com/api/v1/update/', $fields); $res = json_decode($updates); $response = json_decode(${$res}); if (!empty($response->data->updates)) { $this->db->update('settings', array('update' => 1), array('setting_id' => 1)); return TRUE; } return FALSE; }
function updates() { if (DEMO) { $this->session->set_flashdata('warning', lang('disabled_in_demo')); redirect($_SERVER["HTTP_REFERER"]); } if (!$this->Owner) { $this->session->set_flashdata('error', lang('access_denied')); redirect("welcome"); } $fields = array('version' => $this->Settings->version, 'code' => $this->Settings->purchase_code, 'username' => $this->Settings->envato_username, 'site' => base_url()); $this->load->helper('update'); $updates = get_remote_contents('https://tecdiary.com/api/v1/update/', $fields); $this->data['updates'] = json_decode($updates); $bc = array(array('link' => base_url(), 'page' => lang('home')), array('link' => '#', 'page' => lang('updates'))); $meta = array('page_title' => lang('updates'), 'bc' => $bc); $this->page_construct('settings/updates', $meta, $this->data); }