function index() { $this->output->cache(0); if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } elseif ($this->users->is_admin()) { $data['parameters'] = $_POST; echo $this->load->view('synonyms/popover-form', $data); } else { r_direct('search'); } }
function delete_widget($widget_key = null) { if (!$this->users->logged_in()) { r_direct_login(); } elseif ($widget_key) { header('Content-Type: application/json'); $res = $this->widgets_model->delete_widgetoptions($widget_key); if ($res) { $this->session->set_flashdata('message', $this->notification->messages()); echo json_encode(array('response' => 'success', 'message' => $this->notification->messages()), true); } else { $message = validation_errors() ? validation_errors() : ($this->notification->errors() ? $this->notification->errors() : $this->session->flashdata('message')); $this->session->set_flashdata('message', $message); echo json_encode(array('response' => 'danger', 'message' => $message), true); } } else { r_direct('dashboard'); } }
function activate($id, $code = false) { if ($code !== false) { $activation = $this->users->activate($id, $code); } else { if ($this->users->is_admin()) { $activation = $this->users->activate($id); } } if ($activation) { //redirect them to the auth page $this->session->set_flashdata('message', $this->notification->messages()); r_direct(); } else { //redirect them to the forgot password page $this->session->set_flashdata('message', $this->notification->errors()); r_direct('user/forgot_password'); } }
function delete($id = null) { if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } elseif ($id) { $file = $this->uploads_model->delete_file($id); $message = $this->notification->errors() ? $this->notification->errors() : ($this->notification->messages() ? $this->notification->messages() : $this->session->flashdata('message')); header('Content-Type: application/json'); if ($file) { echo json_encode(array('response' => 'success', 'message' => $message), true); } else { echo json_encode(array('response' => 'danger', 'message' => $message), true); } } else { r_direct('dashboard'); } }
function options() { $post_data = isset($_POST) && !empty($_POST) ? $_POST : array(); if (!$this->users->logged_in()) { r_direct_login(); } elseif ($this->users->is_admin() && !empty($post_data)) { $usermeta = array(); $usermeta[element('meta_key', $post_data)] = $post_data; $meta = $this->usermeta_model->save_usermeta(0, $usermeta); header('Content-Type: application/json'); echo json_encode($meta, true); } else { r_direct(); } }
function delete($key = null) { if (!$this->users->logged_in()) { r_direct_login(); } elseif ($key) { $statistics = $this->statistics_model->delete_statistics($key); $message = $this->notification->errors() ? $this->notification->errors() : $this->notification->messages(); header('Content-Type: application/json'); if ($statistics) { echo json_encode(array('response' => 'success', 'message' => $message, 'redirect' => base_url('statistics')), true); } else { echo json_encode(array('response' => 'danger', 'message' => $message), true); } } else { r_direct('dashboard'); } }
function modal() { if (!$this->users->logged_in()) { r_direct_login(); } else { $get_data = $_GET; $path = element('path', $get_data); if ($path) { $data['data'] = $get_data; echo $this->load->view(urldecode($path), $data); } else { r_direct('dashboard'); } } }
function status() { $parameters = isset($_POST) && !empty($_POST) ? $_POST : array(); if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } elseif ($this->users->is_admin()) { $status = $this->status->get_status(); header('Content-Type: application/json'); echo json_encode($status, JSON_NUMERIC_CHECK); } else { r_direct('dashboard'); } }
function restapisimulator($action = null) { if (!$this->users->logged_in()) { r_direct_login(); } elseif ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; $response = $this->restapisimulator_model->run($parameters); header('Content-Type: application/json'); echo json_encode($response, true); } else { $actions = $this->application->get_config('actions', 'actions'); if (!$action) { $action = array_keys($actions)[0]; } if (!$action) { r_direct('dashboard'); } else { $action_ = $this->application->get_config($action, 'actions'); $data['title'] = 'Rest API Simulator'; $data['js'] = array('js/restapisimulator.js'); //$data['tool'] = 'restapisimulator'; $data['action'] = $action_; $data['actions'] = $actions; $data['main_content'] = 'tools/pages/restapisimulator'; $this->load->view('tools/template', $data); } } }
function view($id = null) { if (!$this->users->logged_in() && $id) { r_direct(); } else { $this->data['title'] = "View Server"; $this->data['js'] = array('js/servers.js'); $server = (object) $this->servers_model->get_server($id)->row(); $message = ''; if (!$server) { $message = $this->notification->errors() ? $this->notification->errors() : $this->session->flashdata('message'); } $status = $this->status->get_status((array) $server); $indexer_status = $this->status->indexer_get_status((array) $server); if (!$indexer_status || !$status) { $message = $this->status->errors() ? $this->status->errors() : $this->session->flashdata('message'); } $this->data['message'] = $message; $this->data['server'] = $server; $this->data['status'] = $status; $this->data['indexer_status'] = $indexer_status; $this->data['main_content'] = 'servers/view'; $this->load->view('servers/template', $this->data); } }
function edit_rule($key = null, $id = null) { $this->output->cache(0); if (!$this->users->logged_in()) { r_direct_login(); } elseif ($this->input->server('REQUEST_METHOD') === 'POST') { $rule = $this->uri->segment(3); $post_data = isset($_POST) && !empty($_POST) ? $_POST : array(); $rule = $this->rules_model->update_rule($rule, $post_data); header('Content-Type: application/json'); echo json_encode($rule, true); } elseif ($this->uri->segment(3)) { $data['modal_title'] = 'Edit Rule'; $data['modal_content'] = 'widgets/' . $key . '/edit'; $data['parameters'] = array('komodel' => 'new Profile(["#smrt"])', 'id' => $id); echo $this->load->view('template/modal', $data); } else { r_direct(); } }
function delete($id = null) { if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } elseif ($this->users->is_admin() && $id) { $group = $this->users->delete_group($id); $message = $this->notification->errors() ? $this->notification->errors() : $this->notification->messages(); header('Content-Type: application/json'); if ($group) { echo json_encode(array('response' => 'success', 'message' => $message, 'redirect' => base_url('departments')), true); } else { echo json_encode(array('response' => 'danger', 'message' => $message, 'redirect' => base_url('departments')), true); } } else { r_direct('dashboard'); } }