function tag_values() { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = isset($_GET) && !empty($_GET) ? $_GET : array(); $responsedata = $this->tags_model->call_get_tag_values($parameters); $res = $this->parametric_lib->build_fancytree_tagvalues($responsedata, NULL, array('lazy' => false, 'folder' => false)); header('Content-Type: application/json'); echo json_encode($res, true); } }
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 widget_options($meta_key = null, $post_id = null) { if (!$this->users->logged_in()) { r_direct_login(); } elseif ($meta_key) { $delimiter = $this->application->get_config('metakey_delimiter', 'template'); $keys = array(); $meta_key = urldecode($meta_key); $is_statistics = false; $widget_key = extract_metakey($meta_key, $delimiter); $exist = file_exists(FCPATH . '\\application\\views\\widgets\\' . $widget_key); if ($exist) { $folder = $widget_key; $widget_key = $meta_key; } else { $keys = $this->statistics_lib->extract_statistics_key($widget_key); $folder = element('type', $keys); $is_statistics = true; } $method = $this->input->server('REQUEST_METHOD'); if ($method == 'POST') { header('Content-Type: application/json'); $parameters = $_POST; $widget = array('post_id' => $post_id, 'meta_key' => $meta_key, 'meta_value' => serialize($parameters)); if ($this->widgets_model->get_widgetoptions(array('post_id' => $post_id, 'meta_key' => $meta_key))) { $res = $this->widgets_model->update_widgetoptions($post_id, $meta_key, $widget); } else { $res = $this->widgets_model->save_widgetoptions($widget); } 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 { if ($is_statistics) { $data['modal_title'] = element('type', $keys) . " Options"; } else { $data['modal_title'] = 'Widget Options'; } $data['modal_content'] = 'widgets/' . $folder . '/options'; $data['widget_key'] = $widget_key; $data['meta_key'] = $meta_key; echo $this->load->view('template/modal-widget-options', $data); } } else { } }
function get_tag_values() { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $tags = $this->tags_model->call_get_tag_values($parameters); header('Content-Type: application/json'); echo json_encode($tags, true); } }
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 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 index() { if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } else { $post_data = isset($_POST) && !empty($_POST) ? $_POST : array(); if ($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 { //set the flash data error message if there is one $data['title'] = 'Index Page'; $data['js'] = array('js/dashboard.js'); $data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message'); $data['main_content'] = 'dashboard/index'; $data['tools'] = array('edit' => 'dashboard/tools-edit'); $this->load->view('dashboard/template', $data); } } }
function index() { header('Content-Type: application/json'); if (!$this->users->logged_in()) { //redirect them to the login page r_direct_login(); } else { if ($this->query->method() == 'POST') { $parameters = isset($_POST) && !empty($_POST) ? $_POST : array(); $results = $this->search_model->call_term_expand($parameters); $data['results'] = $results == false ? array() : $results; $data['message'] = $results == false ? $this->config->item('error_start_delimiter', 'search') . lang('search_error_message') . $this->config->item('error_end_delimiter', 'search') : $this->session->flashdata('message'); $results = array_get_value(element('source', parameters), $results); echo json_encode($results, true); } elseif ($this->query->method() == 'GET') { $parameters = isset($_GET) && !empty($_GET) ? $_GET : array(); $results = $this->search_model->call_term_expand($parameters); $data['results'] = $results == false ? array() : $results; $data['message'] = $results == false ? $this->config->item('error_start_delimiter', 'search') . lang('search_error_message') . $this->config->item('error_end_delimiter', 'search') : $this->session->flashdata('message'); $results = array_get_value(element('source', parameters), $results); echo json_encode($results, true); } } }
function logout() { $this->data['title'] = "Logout"; //log the user out $logout = $this->users->logout(); //redirect them to the login page $this->session->set_flashdata('message', $this->notification->messages()); r_direct_login(); }
function query() { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $query_settings_sess = $this->application->get_session_userdata('current_search'); $query_parameters = $this->application->get_config('query', 'actions'); $search_settings = $this->usermeta_model->get_usermeta(0, array('meta_key' => 'settings_search')); $um_search_settings = array_merge($query_parameters, $search_settings, $parameters); $raw = $this->idol->QueryAction($um_search_settings); $raw = array_get_value($raw, 'autn:hit'); $results = clean_json_response($raw); header('Content-Type: application/json'); echo json_encode($results, true); } }
function timeline() { header('Content-Type: application/json'); if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $query_data = array_key_exists('data', $parameters) ? element('data', $parameters) : $parameters; $settings = $this->statistics_model->get_settings(element('widget_key', $parameters)); $visual = array_key_exists('visual', $settings) ? element('visual', $settings) : array($query_data); $timeline = $this->statistics_model->get_timeline($query_data); $visual = array_merge($visual, $timeline); $settings = array_merge((array) $settings, array('visual' => $visual)); echo json_encode($settings, JSON_NUMERIC_CHECK); } }
function search($start = null) { if (!$this->users->logged_in()) { r_direct_login(); } else { $parameters = array(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $parameters = $_POST; } elseif ($this->input->server('REQUEST_METHOD') === 'GET') { $parameters = $_GET; } $search_results = $this->idol->QueryAction($parameters); $message = $this->notification->errors() ? $this->notification->errors() : ($this->notification->messages() ? $this->notification->messages() : $this->session->flashdata('message')); if (!empty($search_results)) { $results = clean_json_response($search_results); $responsedata = get_responsedata($results); $data['responsedata'] = $responsedata; $data['template'] = element('template', $parameters); $data['search_parameters'] = $parameters; $template = isset($parameters['template']) ? $parameters['template']['name'] : 'document-template-chat'; echo $this->load->view('template/' . $template, $data); } else { echo 'No results...'; } } }
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 edit($id = null) { if (!$this->users->logged_in()) { r_direct_login(); } elseif ($this->users->is_admin() && $id) { $method = $this->input->server('REQUEST_METHOD'); $server = (object) $this->servers_model->get_server($id)->row(); $this->form_validation->set_rules('server', $this->lang->line('create_server_validation_url_label'), 'required|prep_url|valid_url_format|url_exists'); if ($method == 'POST') { header('Content-Type: application/json'); if ($this->form_validation->run() === TRUE) { $data = array('server' => $this->input->post('server'), 'port' => $this->input->post('port'), 'username' => $this->input->post('username'), 'password' => $this->input->post('password')); } if ($this->form_validation->run() == true && $this->servers_model->update_server($id, $data)) { $this->session->set_flashdata('message', $this->notification->messages()); echo json_encode(array('response' => 'success', 'message' => $this->notification->messages(), 'redirect' => base_url('servers')), 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 { //set the flash data error message if there is one $this->data['message'] = validation_errors() ? validation_errors() : ($this->notification->errors() ? $this->notification->errors() : $this->session->flashdata('message')); //pass the user to the view $this->data['id'] = $server->id; $this->data['server'] = array('name' => 'server', 'id' => 'server', 'class' => 'form-control', 'type' => 'text', 'value' => $this->form_validation->set_value('server', $server->server)); $this->data['port'] = array('name' => 'port', 'id' => 'port', 'class' => 'form-control', 'type' => 'text', 'value' => $this->form_validation->set_value('port', $server->port)); $this->data['username'] = array('name' => 'username', 'id' => 'username', 'class' => 'form-control', 'type' => 'text', 'value' => $this->form_validation->set_value('username', $server->username)); $this->data['password'] = array('name' => 'password', 'id' => 'password', 'class' => 'form-control', 'type' => 'password', 'value' => $this->form_validation->set_value('phone', $server->password)); $this->data['title'] = 'Edit Server'; $this->data['js'] = array('js/servers.js'); $this->data['main_content'] = 'servers/edit'; $this->load->view('servers/template', $this->data); } } else { r_direct('dashboard'); } }
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'); } }