Exemplo n.º 1
0
 public function captcha2()
 {
     $path = BASEPATH . '../resources/captcha/' . (date('Y') . '/' . date('m') . '/' . date('d'));
     if (!file_exists($path)) {
         mkdir($path, 0777, TRUE);
     }
     $session = new Zend\Session\Container('ZEND_PARANGARI');
     $session->offsetSet('text1', 'value1');
     //$session->set
     $obj = new Zend\Captcha\Image();
     $obj->setImgDir($path);
     $obj->setFont(BASEPATH . '../application/third_party/fonts/LesJoursHeureux.otf');
     $obj->setFontSize(40);
     $obj->setWidth(250);
     $obj->setHeight(100);
     $obj->setDotNoiseLevel(40);
     $obj->setLineNoiseLevel(3);
     $obj->setWordlen(6);
     $obj->setSession($session);
     $string_captcha_ID = $obj->generate();
     echo $string_captcha_ID . "<br/>";
     echo $obj->getWord();
     $obj->isValid($string_captcha_ID);
     Helper_Log::write($_SESSION);
 }
 function filter(eProfilePermission $filter, &$eRols, &$count)
 {
     $eRols = array();
     $count = 0;
     $queryR = $this->db->query($this->filterQuery($filter));
     if ($queryR === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $queryC = $this->db->query($this->filterQuery($filter, TRUE));
     if ($queryC === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $row = $queryC->row_array();
     $count = $row['count'];
     $rows = $queryR->result_array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eRol = new eRol();
             $eRol->parseRow($row);
             $eRols[] = $eRol;
         }
     }
 }
 function filter(filterCompanyBranch $filter, &$eCompanyBranches, &$count = NULL)
 {
     $eCompanyBranches = array();
     $count = 0;
     $queryR = $this->db->query($this->filterQuery($filter));
     if ($queryR === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $queryC = $this->db->query($this->filterQuery($filter, TRUE));
     if ($queryC === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $row = $queryC->row_array();
     $count = $row['count'];
     $rows = $queryR->result_array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eCompanyBranch = new eCompanyBranch();
             $eCompanyBranch->parseRow($row, 'cb_');
             $eCompanyBranches[] = $eCompanyBranch;
         }
     }
 }
 public function listCompanyBranchsByUserProfile($id_user, $id_profile, $isActive = NULL)
 {
     $select_company_branch = $this->buildSelectFields('cb_', 'cb', 'company_branch');
     $sql = '
         SELECT
             ' . $select_company_branch . '
         FROM
             "' . $this->table . '" AS "upcb"
             INNER JOIN "user_profile" AS "up" ON "up"."id" = "upcb"."id_user_profile"
             INNER JOIN "profile" AS "p" ON "p"."id" = "up"."id_profile"
             INNER JOIN "user" AS "u" ON "u"."id" = "up"."id_user"
             INNER JOIN "company_branch" AS "cb" ON "cb"."id" = "upcb"."id_company_branch"
         WHERE 1=1
             AND "p"."id" = ' . $this->db->escape($id_profile) . '
             AND "u"."id" = ' . $this->db->escape($id_user) . '
             ' . (is_null($isActive) ? '' : " AND \"cb\".\"isActive\"='" . $isActive . "'") . '
     ';
     $query = $this->db->query($sql);
     if ($query === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $rows = $query->result_array();
     $eCompanyBranches = array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eCompanyBranch = new eCompanyBranch();
             $eCompanyBranch->parseRow($row, 'cb_');
             $eCompanyBranches[] = $eCompanyBranch;
         }
     }
     return $eCompanyBranches;
 }
Exemplo n.º 5
0
 function listModules($id_parent = NULL, $ORDER_BY = self::ORDER_BY_ORDER, $withIsAdmin = FALSE, $isActive = NULL)
 {
     $where = array('id_parent' => $id_parent);
     if (!$withIsAdmin) {
         $where['isAdmin'] = 0;
     }
     if (!is_null($isActive)) {
         $where['isActive'] = $isActive;
     }
     $this->db->order_by($ORDER_BY == self::ORDER_BY_NAME ? 'name' : "num_order", "asc");
     $query = $this->db->get_where($this->table, $where);
     if ($query === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $rows = $query->result_array();
     $eModules = array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eModule = new eModule();
             $eModule->parseRow($row);
             $eModules[] = $eModule;
         }
     }
     return $eModules;
 }
 public static function isLogin()
 {
     if (Helper_App_Session::isLogin()) {
         $dateBegin = self::getLastActivity();
         $date = DateTime::createFromFormat('Y-m-d H:i:s', self::getLastActivity());
         $dateEnd = strtotime('+1 hour', strtotime(date('Y-m-d H:i:s', $date->date)));
         $eSessionActivity = self::get();
         if (!$eSessionActivity->isEmpty()) {
             Helper_Log::write($eSessionActivity);
             Helper_Log::write($dateBegin);
             Helper_Log::write($date);
             Helper_Log::write($dateEnd);
             //Helper_Log::write(date('Y-m-d H:i:s', self::getLastActivity()));
             //Helper_Log::write(DateTime::createFromFormat('Y-m-d H:i:s', self::getLastActivity()));
             /*if((self::getSessionId()==Helper_App_Session::getSessionID()) && 
               (Helper_Fecha::isValidRangeDate($dateBegin, $dateEnd, date('Y-m-d H:i:s'))) )
               {
                   $eSessionActivity->last_activity = date('Y-m-d H:i:s');
                   self::set($eSessionActivity);
                   return TRUE;
               }
               else
               {
                   $eSessionActivity->inUse = 0;
                   self::set($eSessionActivity);
                   return FALSE;
               }*/
         }
     }
     return FALSE;
 }
 public static function debugAll()
 {
     $MY =& MY_Controller::get_instance();
     $MY->libsession->setSessionGroup(self::$params_session['session_group']);
     $info = array(self::$params_session['session_group'] => $MY->libsession->getAll());
     Helper_Log::write(print_r($info, TRUE));
     Helper_App_Log::write($info, TRUE, Helper_App_Log::LOG_LOGIN);
 }
Exemplo n.º 8
0
 public static function write($var, $isEncode = FALSE, $LOG_TYPE = self::LOG_DEFAULT)
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mUserLog User_Log_Model */
     $mUserLog =& $MY->mUserLog;
     /* @var $mConfigurationSystem Configuration_System_Model */
     $mConfigurationSystem =& $MY->mConfigurationSystem;
     $id_system = Helper_App_Session::getConfigurationSystemId();
     // *******************
     // CONFIGURATION SYSTEM
     // *******************
     $eConfigurationSystem = $mConfigurationSystem->load($id_system);
     $id_user = Helper_App_Session::getUserId();
     $navegador = Helper_App_Session::getBrowser();
     $action = '';
     if ($LOG_TYPE == self::LOG_DEFAULT) {
         $action = 'ACTION_DEFAULT';
     }
     if ($LOG_TYPE == self::LOG_LOGIN) {
         $action = 'ACTION_LOGIN';
     }
     if ($LOG_TYPE == self::LOG_INSERT) {
         $action = 'ACTION_INSERT';
     }
     if ($LOG_TYPE == self::LOG_UPDATE) {
         $action = 'ACTION_UPDATE';
     }
     if ($LOG_TYPE == self::LOG_DELETE) {
         $action = 'ACTION_DELETE';
     }
     Helper_Log::write(print_r($var, true), Helper_Log::LOG_APP);
     if (!empty($eConfigurationSystem->isSaveBinnacle)) {
         if (!empty($id_user)) {
             $eUserLog = new eUserLog();
             $eUserLog->id_user = $id_user;
             $eUserLog->date_time = date('Y-m-d H:i:s');
             $eUserLog->info = $isEncode ? json_encode($var) : $var;
             $eUserLog->action = $action;
             $eUserLog->url = current_url();
             $eUserLog->browser = $navegador->browser . ' ' . $navegador->device_type . ' ' . $navegador->platform_maker . ' ' . $navegador->platform_description . ' de ' . $navegador->platform_bits;
             $eUserLog->ip = $MY->input->ip_address();
             $mUserLog->save($eUserLog);
         }
     }
 }
 public static function buildReport($name_file_jasper, $arrParameter = array(), $type_report = 'pdf')
 {
     $MY =& MY_Controller::get_instance();
     $java = Helper_Config::getBinaryJava();
     $path_jasper_starter = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'jasperstarter' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'jasperstarter.jar';
     $report_jasper = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $name_file_jasper . ".jasper";
     $nombre_temp = preg_split("/[\\/]+/", $name_file_jasper);
     $nombre_jasper = $nombre_temp[sizeof($nombre_temp) - 1];
     //Helper_Log::write($nombre_jasper);
     $file_output = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . ($nombre_jasper . microtime(true));
     //$db_host = $MY->db->hostname;
     $db_host = preg_split('/:/', $MY->db->hostname);
     $db_host = $db_host[0];
     $db_name = $MY->db->database;
     $db_user = $MY->db->username;
     $db_pass = $MY->db->password;
     $db_port = $MY->db->port;
     // ------------------------------------------------------
     // DEFAULT, deben tener todos los reportes --------------
     // ------------------------------------------------------
     $arrParameter['ci_root_path'] = BASEPATH . '../';
     // ------------------------------------------------------
     // ------------------------------------------------------
     $str_parametros = '';
     if (!empty($arrParameter)) {
         foreach ($arrParameter as $parameter => $value) {
             $str_parametros .= (empty($str_parametros) ? '' : ' ') . "{$parameter}=\"{$value}\"";
         }
     }
     if (!empty($db_pass)) {
         $db_pass = "******";
     }
     if (!empty($str_parametros)) {
         $str_parametros = "-P {$str_parametros}";
     }
     $cmd = "\"{$java}\" -Djava.awt.headless=true -jar  {$path_jasper_starter} pr {$report_jasper} -t mysql -u {$db_user} -f {$type_report} -H {$db_host} --db-port {$db_port} -n {$db_name} -o {$file_output} {$db_pass} {$str_parametros}";
     Helper_Log::write($cmd);
     exec($cmd, $output, $err);
     if (!empty($err)) {
         echo "Error de envio: {$cmd}";
         return NULL;
     }
     return $file_output . '.' . $type_report;
 }
Exemplo n.º 10
0
 public static function write($info)
 {
     $MY =& MY_Controller::get_instance();
     //$MY->load->model('user_log_model','mUserLog');
     $id_personal = Helper_App_Session::getUserId();
     Helper_Log::write($info, Helper_Log::LOG_PROCESS);
     /*if( empty($id_personal) )
       {
           
       }
       /*
       else
       {
           $MY->mUserLog->save(array(
               'id_user'   => $id_personal,
               'date_time' => date('Y-m-d H:i:s'),
               'info'      => $info
           ));
       }*/
 }
 function listModulesByRol($id_rol, $id_parent = NULL)
 {
     $select_module = $this->buildSelectFields('m_', 'm', 'module');
     $sql = "\r\n            SELECT \r\n                " . $select_module . "\r\n            FROM \"" . $this->table . "\" AS \"rm\"\r\n                INNER JOIN \"rol\" AS \"r\" ON \"r\".\"id\" = \"rm\".\"id_rol\" \r\n                INNER JOIN \"module\" AS \"m\" ON \"m\".\"id\" = \"rm\".\"id_module\" \r\n            WHERE 1=1\r\n                AND \"r\".\"id\" =  ?\r\n                " . (is_null($id_parent) ? " AND \"m\".\"id_parent\" IS NULL " : " AND \"m\".id_parent = " . $id_parent) . "\r\n            ORDER BY \"m\".\"num_order\" ASC\r\n        ";
     //Helper_Log::write($sql);
     $query = $this->db->query($sql, array($id_rol));
     if ($query === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $rows = $query->result_array();
     $eModules = array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eModule = new eModule();
             $eModule->parseRow($row, 'm_');
             $eModules[] = $eModule;
         }
     }
     return $eModules;
 }
Exemplo n.º 12
0
 function delete($value, $by = 'id')
 {
     $db = $this->getConnection();
     if ($db->delete($this->table, array($by => $value)) === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception($this->messageError(__FUNCTION__, TRUE));
     }
 }
Exemplo n.º 13
0
 public function _resumen_camera()
 {
     $dateBegin = NULL;
     $dateEnd = date('Y-m-d') . ' 00:00:00';
     $arrDataProcess = array();
     /*
      * Inicio del proceso de Resumen de Camaras
      */
     $DateTime_ResumenCamera_Begin = date('Y-m-d H:i:s');
     $cont_P_ResumenCamera = 0;
     while ($cont_P_ResumenCamera < 2) {
         $oRes = Business_Process_Generate::loadResumenCamera($dateEnd, $dateBegin);
         if ($oRes->isSuccess()) {
             break;
         }
         $cont_P_ResumenCamera++;
     }
     if (!$oRes->isSuccess()) {
         Helper_Process_Log::write($oRes->message());
     }
     $arrDataProcess[Helper_Config::getFTTProcessResumenCamera()] = array('isSuccess' => $oRes->isSuccess(), 'message' => $oRes->message(), 'timestamp' => Helper_Fecha::getDiff_DateTime($DateTime_ResumenCamera_Begin));
     /*-----------------------------------------------------------------*/
     Helper_Log::write($arrDataProcess);
     //print_r($arrDataProcess);
 }