예제 #1
0
 public function index()
 {
     $this->load->view('layout/header');
     $error = $this->session->flashdata('message');
     $this->load->view('element/message', ['success' => $error]);
     $filter = $this->input->get(['from', 'till', 'groups']);
     $from = $filter['from'] ?: date('Y-m-01', strtotime('-1 month'));
     $till = $filter['till'] ?: date('Y-m-t');
     $responseData = [];
     $step = 500;
     $offset = 0;
     do {
         $response = $this->moneyzaurus->transactionsList($offset, $step, $from, $till, null, null, null);
         if ($response['code'] == 200 && $response['data']['success']) {
             $count = $response['data']['count'];
             $responseData = array_merge($responseData, $response['data']['data']);
             $offset += $step;
         } else {
             break;
         }
     } while ($count >= $step);
     $filterGroups = $filter['groups'] ?: [];
     $data = $this->prepareChartData($responseData, $filterGroups, $from, $till);
     $this->load->view('page/chart', ['data' => $data, 'from' => $from, 'till' => $till]);
     $this->load->view('layout/footer');
 }
예제 #2
0
 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     $session = new CI_Session();
     // Check logged in key
     $sessionValue = $session->userdata($config->get("CodeIgniterAuthenticator.logged_in_key", "loggedin"));
     if (!$sessionValue || $sessionValue === "false") {
         return false;
     }
     // Extend config with session prefixed sessions
     $sessionConfig = array();
     $configPrefix = $config->get("CodeIgniterAuthenticator.config_prefix", "moxiemanager");
     if ($configPrefix) {
         $allData = $session->all_userdata();
         foreach ($allData as $key => $value) {
             if (strpos($key, $configPrefix) === 0) {
                 $sessionConfig[substr($key, strlen($configPrefix) + 1)] = $value;
             }
         }
     }
     // Extend the config with the session config
     $config->extend($sessionConfig);
     // Replace ${user} with all config items
     $key = $config->get("CodeIgniterAuthenticator.user_key");
     if ($key) {
         $value = $session->userdata($key);
         $config->replaceVariable("user", $value);
         $user->setName($value);
     }
     return true;
 }
 /**
  * Setea el menu
  */
 public function setCollapse()
 {
     $menu_collapse = $this->session->userdata("menu_collapse");
     if ($menu_collapse) {
         $this->session->set_userdata("menu_collapse", false);
     } else {
         $this->session->set_userdata("menu_collapse", true);
     }
 }
 /**
  * 
  * @return string
  */
 public function render($html_object)
 {
     $menu_collapse = $this->session->userdata("menu_collapse");
     if ($menu_collapse) {
         return "";
     } else {
         return $this->_returnClass($html_object);
     }
 }
예제 #5
0
 public function logout()
 {
     $response = $this->moneyzaurus->authenticateLogout();
     if ($response['code'] == 200) {
         if ($response['data']['success']) {
             $this->session->set_flashdata('success', 'Bye!');
         }
     }
     redirect('');
 }
 /**
  * 
  * @return string
  */
 public function render()
 {
     $html = "";
     $lista = $this->usuario_rol_model->listarRolesPorUsuario($this->_session->userdata("session_idUsuario"));
     if (count($lista) > 0) {
         foreach ($lista as $rol) {
             $html .= "<li>" . "<a href=\"#\">" . "<i ></i> " . $rol["rol_c_nombre"] . "</a>" . "</li>";
         }
     }
     return $html;
 }
 /**
  * 
  * @return string
  */
 public function render()
 {
     $html = "";
     $lista = $this->usuario_region_model->listarPorUsuario($this->_session->userdata("session_idUsuario"));
     if (count($lista) > 0) {
         foreach ($lista as $usuario_region) {
             $nombre_region = new Direccion_Nombre_Region();
             $nombre_region->setId($usuario_region["id_region"]);
             $html .= "<li>" . "<a href=\"#\">" . "<i ></i> " . $nombre_region . "</a>" . "</li>";
         }
     }
     return $html;
 }
예제 #8
0
 public function index()
 {
     $this->load->library('prediction');
     $money = $this->input->get('money');
     $date = $this->input->get('date');
     $months = $this->input->get('months');
     $data = $this->prediction->setTransactions($this->getAllTransactions($months ?: 3))->getData($money, $date);
     $this->load->view('layout/header');
     $error = $this->session->flashdata('message');
     $this->load->view('element/message', ['success' => $error]);
     $this->load->view('page/manager', $data);
     $this->load->view('layout/footer');
 }
예제 #9
0
 function sess_destroy()
 {
     //write your update here
     $this->CI->db->update('u_user', array('status_login' => 0), array('username' => 'admin'));
     //call the parent
     parent::sess_destroy();
 }
예제 #10
0
 /**
  * sess_update()
  *
  * Do not update an existing session on ajax or xajax calls
  *
  * @access    public
  * @return    void
  */
 public function sess_update()
 {
     $CI =& get_instance();
     if (!$CI->input->is_ajax_request()) {
         parent::sess_update();
     }
 }
예제 #11
0
 /**
  * Update an existing session
  *
  * Updates an existing Code Igniter session.
  *
  * @access	public
  * @param	none
  * @return	none
  */
 function sess_update()
 {
     if (!$this->CI->input->is_ajax_request()) {
         $CI =& get_instance();
         $this->db = $CI->load->database('default', TRUE);
         $old_session_id = $this->userdata('session_id');
         $user_id = FALSE;
         // Get user ID if logged in
         if ($this->is_authenticated()) {
             $user_id = $this->get_user_id();
         }
         parent::sess_update();
         // Updated associated session ID in the user's database entry but only if the user has not logged in elsewhere
         if ($user_id && $old_session_id == $this->userinfo->session_id) {
             $user_table = '';
             $user_field = '';
             switch ($this->get_usertype()) {
                 case USER_TYPE_FRONT:
                     $this->db->update('student', array('session_id' => $this->get_session_id()), array('moodle_id' => $user_id));
                     break;
                 case USER_TYPE_ADMIN:
                     $this->db->update('administrator', array('session_id' => $this->get_session_id()), array('admin_id' => $user_id));
                     break;
                 default:
             }
             // Update session ID for this request
             $this->userinfo->session_id = $this->get_session_id();
         }
     }
 }
예제 #12
0
 function sess_update()
 {
     //Listen to HTTP_X_REQUESTED_WITH
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] !== 'XMLHttpRequest') {
         parent::sess_update();
     }
 }
예제 #13
0
 /**
  * Update an existing session
  *
  * @access    public
  * @return    void
  */
 function sess_update()
 {
     // Skip session update if this is an AJAX call. This is a bug in CI, see https://github.com/bcit-ci/CodeIgniter/issues/154
     if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
         parent::sess_update();
     }
 }
 function sess_update()
 {
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
         // This is not an ajax call
         parent::sess_update();
     }
 }
예제 #15
0
 function sess_update()
 {
     // Do NOT update an existing session on AJAX calls.
     if (!$this->CI->input->is_ajax_request()) {
         return parent::sess_update();
     }
 }
예제 #16
0
 public function index()
 {
     $this->load->view('layout/header');
     $error = $this->session->flashdata('message');
     $this->load->view('element/message', ['success' => $error]);
     $offset = 0;
     $limit = 100;
     $filter = $this->input->get(['item', 'group', 'price', 'from', 'till']);
     $response = $this->moneyzaurus->transactionsList($offset, $limit, $filter['from'], $filter['till'], $filter['item'], $filter['group'], $filter['price'] * 100);
     if ($response['code'] == 200) {
         if ($response['data']['success']) {
             $this->load->view('page/data', ['count' => $response['data']['count'], 'data' => $response['data']['data'], 'filter' => $filter]);
         }
     }
     $this->load->view('layout/footer');
 }
 /**
 * Update an existing session
 *
 * @access    public
 * @return    void
 */
 function sess_update()
 {
     // skip the session update if this is an AJAX call!
     if (!IS_AJAX) {
         parent::sess_update();
     }
 }
예제 #18
0
 public function _set_cookie($cookie_data = NULL)
 {
     if ($this->memory_only) {
         return;
     }
     parent::_set_cookie($cookie_data);
 }
예제 #19
0
 function sess_update()
 {
     /* Listen to HTTP_X_REQUESTED_WITH */
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] !== 'XMLHttpRequest') {
         /* This is NOT an ajax call */
         parent::sess_update();
     }
 }
 function __construct()
 {
     parent::__construct();
     $CI =& get_instance();
     $this->_model = $CI;
     $this->_model->load->database();
     $this->_model->load->model("muser");
 }
예제 #21
0
 public function sess_destroy()
 {
     if (ENVIRONMENT === 'testing') {
         log_message('debug', 'Session: calling session_destroy() skipped under testing.');
         return;
     }
     parent::sess_destroy();
 }
예제 #22
0
 protected function _ci_init_vars()
 {
     parent::_ci_init_vars();
     // An added feature: Keep all the flash data on AJAX requests.
     if (IS_AJAX_REQUEST) {
         $this->keep_flashdata();
     }
 }
예제 #23
0
파일: auth.php 프로젝트: HaiLeader/jsen
 public function __construct()
 {
     parent::__construct();
     $CI =& get_instance();
     $CI->load->helper('url');
     $CI->load->library('session');
     $CI->load->database();
 }
예제 #24
0
 public function sess_destroy()
 {
     if (isset($this->userdata['session_id']) && isset($this->userdata['userid'])) {
         $this->ci =& get_instance();
         $this->ci->load->model('opt_log_model');
         $this->ci->opt_log_model->log('logout');
     }
     parent::sess_destroy();
 }
예제 #25
0
	function __construct($param = array())
	{
		parent::__construct();
		$this->CI =& get_instance();
		$this->_setinstance($param, 'cookie');
		$this->_setinstance($param, 'secure');
		$this->_setinstance($param, 'regenerate');
		$this->_session();
	}
 /**
  * @param string $file_name
  * @return boolean
  */
 public function upload($file_name)
 {
     $path = $this->_nuevoDirectorio();
     $config = array('upload_path' => $path, 'allowed_types' => 'gif|jpg|png|bmp|doc|docx|pdf|xls|xlsx|txt|ppt|pptx|csv', 'max_size' => '0', 'max_width' => '0', 'max_height' => '0');
     $this->upload = new CI_Upload($config);
     if (!$this->upload->do_upload($file_name)) {
         rmdir($path);
         $this->_error = $this->upload->display_errors();
         return false;
     } else {
         $data = $this->upload->data();
         $relative_path = str_replace(realpath(BASEPATH . "../"), "", realpath($data["full_path"]));
         $relative_path = substr($relative_path, 1, strlen($relative_path));
         $insert = array("arch_c_tamano" => $data["file_size"], "arch_c_nombre" => $relative_path, "arch_c_mime" => $data["file_type"], "arch_c_hash" => $this->_fileHash(), "arch_f_fecha" => DATE("Y-m-d H:i:s"), "usu_ia_id" => $this->session->userdata('session_idUsuario'));
         $this->_archivo_model->query()->insert($insert);
         return true;
     }
 }
예제 #27
0
 function sess_update()
 {
     // We return right away meaning we never update our sessions.
     return true;
     // skip the session update if this is an AJAX call!
     if (!IS_AJAX && !IS_FLASH) {
         parent::sess_update();
     }
 }
예제 #28
0
 /**
  * Encode array of image info to string and save in session
  * @param array $images
  * @return $this
  */
 protected function setTemplateImages(array $images)
 {
     $this->templateImages = $images;
     $images = $this->valuesHandler->input('array', $images);
     $this->session->set_userdata($this->sessionKeys['template_images'], $images);
     $this->session->set_userdata('theme_images_deletion_queue', $images);
     // to delete extra files
     return $this;
 }
예제 #29
0
 /**
  * Update an existing session
  *
  * @access    public
  * @return    void
  */
 function sess_update()
 {
     // skip the session update if this is an AJAX call! This is a bug in CI; see:
     // https://github.com/EllisLab/CodeIgniter/issues/154
     // http://codeigniter.com/forums/viewthread/102456/P15
     if (!$this->CI->input->is_ajax_request()) {
         parent::sess_update();
     }
 }
 public function __construct()
 {
     $CI = get_instance();
     //Extend the session class so that it doesnt create a session cookie and row in db if the request comes from commandline
     if ($CI->input->is_cli_request()) {
         return;
     }
     parent::__construct();
 }