示例#1
0
 /**
  * @throws OptimiseException on problems during creation of tmp dir
  */
 public static function createPath()
 {
     $path = new Path(tempnam(sys_get_temp_dir(), 'OPT'));
     //TODO check the return in case of errors this return false on failure
     unlink($path->getPath());
     //remove file to create a dir
     if (file_exists($path->getPath())) {
         throw new OptimiseException('problem during creation of tmp dir (the directory already exists)');
     }
     if (!@mkdir($path->getPath())) {
         throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');
     }
     if (!is_dir($path->getPath())) {
         throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)');
     }
     return $path;
 }
示例#2
0
 function modulos()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/graficos');
     $this->upload_path = $path->getPath() . '/';
 }
示例#3
0
 function Catalogo()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/inventario');
     $this->upload_path = $path->getPath();
 }
示例#4
0
 function sinvactu()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
 }
示例#5
0
 function logo()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->helper('download');
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('base_url'));
     $path->append('images');
     echo $this->upload_path = $path->getPath() . '/';
 }
示例#6
0
 function Publicidad()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('publicidad');
     $this->upload_path = $path->getPath() . '/';
     //$this->datasis->modulo_id(907,1);
 }
示例#7
0
 function logo()
 {
     parent::Controller();
     $this->load->library('rapyd');
     $this->load->helper('download');
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('base_url'));
     $path->append('images');
     $this->upload_path = $path->getPath() . '/';
     $this->write = is_writable('images');
 }
示例#8
0
 function cargasinv()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $this->load->library('encrypt');
     $this->load->helper('string');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path1 = reduce_double_slashes(FCPATH . '/uploads/archivos');
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
 }
示例#9
0
 function Publicidad()
 {
     parent::Controller();
     $this->id_modulo = '91A';
     $this->load->library('rapyd');
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('publicidad');
     $this->upload_path = $path->getPath() . '/';
     $this->rel_path = reduce_double_slashes(str_replace($this->config->item('base_url'), '', $this->upload_path));
     $this->write = is_writable($this->rel_path);
     if (!is_writable($this->rel_path)) {
         show_error('No se puede escribir en el directorio ' . $this->rel_path . ', debe ajustar los permisos');
     }
 }
示例#10
0
 function load()
 {
     $this->load->library('path');
     $this->load->helper('html');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
     $this->rapyd->load('dataform');
     $form = new DataForm($this->url . 'load/process');
     $form->title('Importar Archivos');
     $form->explica1 = new containerField('', "<p style='color:blue;background-color:C6DAF6;align:center'>Para cargar un nuevo archivo de data seleccionelo en el el bot&oacute;n Examinar y luego presione enviar.</p>");
     $form->container = new containerField('adver', 'Solo archivos en formato EXCEL 97, asegurese de que la informacion que desea importar este en la hoja 1.');
     $form->archivo = new uploadField('Archivo', 'archivo');
     $form->archivo->upload_path = '';
     $form->archivo->allowed_types = 'xls';
     $form->archivo->delete_file = false;
     $form->archivo->upload_root = '/tmp';
     $form->archivo->rule = 'required';
     $form->archivo->append('Solo archivos en formato xls (Excel 97-2003)');
     $form->submit('btnsubmit', 'Enviar');
     $form->build_form();
     $rti = '';
     if ($form->on_success()) {
         $idtabla = intval($this->datasis->dameval('SELECT MAX(id_tabla) AS maxid FROM ' . $this->tabla));
         $idtabla++;
         $arch = '/tmp/' . $form->archivo->upload_data['file_name'];
         $rt = $this->_xlsread($arch, $idtabla);
         $rti = "<p>{$rt}</p>";
     }
     $lista = array();
     $mSQL = 'SELECT id_tabla,COUNT(*) AS cana  FROM ' . $this->tabla . ' GROUP BY id_tabla ORDER BY id_tabla DESC LIMIT 10';
     $query = $this->db->query($mSQL);
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $lista[] = anchor($this->url . 'procesar/' . $row->id_tabla, 'Tabla: ' . $row->id_tabla . ' (' . $row->cana . ' registros).');
         }
         $listaul = '<h2>Tablas ya importadas</h2>' . ul($lista);
     } else {
         $listaul = '';
     }
     $data['content'] = $rti . $form->output . $listaul;
     $data['title'] = heading('Importaci&oacute;n de data desde archivos');
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
示例#11
0
 function _post_delete($do)
 {
     $nombre = $do->get('nombre');
     $chek = $this->datasis->dameval("SELECT COUNT(*) FROM sinvfot WHERE nombre='{$nombre}'");
     if ($chek <= 0) {
         $path = new Path();
         $path->setPath($_SERVER['DOCUMENT_ROOT']);
         $path->append($this->upload_path);
         $path->append($nombre);
         unlink($path->getPath());
     }
 }
示例#12
0
 function cerberus()
 {
     $this->load->helper('string');
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/fnomina');
     $upload_path = reduce_double_slashes('../' . $path->getPath() . '/');
     $query = $this->db->query('SELECT id,sid,ip,usr,pwd FROM cerberus WHERE activo="S"');
     foreach ($query->result() as $row) {
         $id = $row->sid;
         $ip = $row->ip;
         $usr = $row->usr;
         $pwd = $row->pwd;
         $link = mysql_connect($ip, $usr, $pwd) or die('Maquina fuera de linea');
         mysql_select_db('datasis') or die('Base de datos no seleccionable');
         $mSQL = "SELECT id,codigo, nacional, cedula,fecha,hora,foto FROM cer_cacc WHERE id>{$id} ORDER BY id";
         $result = mysql_query($mSQL, $link);
         $num_rows = mysql_num_rows($result);
         if ($num_rows > 0) {
             while ($data = mysql_fetch_assoc($result)) {
                 $fnombre = $data['codigo'] . '-' . preg_replace('/[^0-9]+/', '', $data['fecha'] . $data['hora']) . '.jpg';
                 //echo $fnombre.br();
                 file_put_contents($upload_path . $fnombre, $data['foto']);
                 $sid = $data['id'];
                 unset($data['foto']);
                 unset($data['id']);
                 $sql = $this->db->insert_string('cacc', $data);
                 $ban = $this->db->simple_query($sql);
                 if (!$ban) {
                     memowrite($sql, 'accesos');
                 }
             }
             $data = array('sid' => $sid);
             $sql = $this->db->update_string('cerberus', $data, 'id=' . $row->id);
             $ban = $this->db->simple_query($sql);
             if (!$ban) {
                 memowrite($sql, 'accesos');
             }
         }
     }
 }
示例#13
0
 function load($numero)
 {
     $this->rapyd->load("dataform");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
     $link = site_url('supervisor/subexls/deshacer');
     $form = new DataForm("supervisor/subexls/read/ITFAC2/{$numero}");
     $form->title('Cargar Archivo de Retenciones (xls)');
     $form->archivo = new uploadField("Archivo", "archivo");
     $form->archivo->upload_path = $this->upload_path;
     $form->archivo->allowed_types = "xls";
     $form->archivo->delete_file = false;
     $form->archivo->rule = "required";
     $form->submit("btnsubmit", "Cargar");
     $form->build_form();
     $salida = anchor($this->url . "dataedit/show/{$numero}", "Ir Atras");
     $data['content'] = $form->output . $salida;
     $data['title'] = "<h1>Cargar archivo de retenciones</h1>";
     $data["head"] = script("jquery.pack.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
示例#14
0
 function imagenes($contenedor)
 {
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/crm');
     $upload_path = $path->getPath() . '/';
     $this->rapyd->load('dataedit');
     $edit = new DataEdit('Imagenes', $this->prefijo . 'adjuntos');
     $edit->back_save = true;
     $edit->back_delete = true;
     $edit->back_cancel = true;
     $edit->back_cancel_save = true;
     $edit->back_cancel_delete = true;
     if (empty($this->crm_back)) {
         $edit->back_url = site_url('crm/contenedor/dataedit/show/' . $contenedor);
     } else {
         $edit->back_url = $this->crm_back;
     }
     $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario'));
     $edit->contenedor = new autoUpdateField('contenedor', $contenedor, $contenedor);
     $edit->fecha = new dateField('Fecha', 'fecha', 'd/m/Y');
     $edit->fecha->rule = 'required';
     $edit->fecha->size = 10;
     $edit->fecha->maxlength = 8;
     $edit->fecha->insertValue = date('Y-m-d');
     $edit->descripcion = new inputField('Descripci&oacute;n', 'descripcion');
     $edit->descripcion->rule = 'trim|required|max_length[200]';
     $edit->nombre = new uploadField('Archivo', 'nombre');
     $edit->nombre->upload_path = $upload_path;
     $edit->nombre->rule = 'required';
     $edit->nombre->allowed_types = 'jpg';
     //$edit->img->thumb = array (63,91);
     $edit->buttons('modify', 'save', 'undo', 'delete', 'back');
     $edit->build();
     $data['content'] = $edit->output;
     $data['title'] = '<h1>Imagenes</h1>';
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
示例#15
0
 public function testCanGetPath()
 {
     $path = new Path($this->sampleFilePath);
     $this->assertEquals($this->sampleFilePath, $path->getPath());
 }
示例#16
0
 /**
  * @param Path $path
  */
 public function startsWith(Path $path)
 {
     $probe = null;
     $result = null;
     if ($this->separator != $path->getSeparator()) {
         throw new \Exception("The path separators for {$this} and {$path} must be equal for both parts in method " . __METHOD__);
     }
     $pathString = $path->getPath();
     $pathDepth = $path->getDepth();
     if ($pathDepth == 0) {
         return true;
     } elseif ($pathDepth > $this->depth) {
         return false;
     } elseif ($pathDepth == $this->depth) {
         $probe = $this->getPath();
     } else {
         $pathString .= $this->separator;
         $length = strlen($pathString);
         $probe = substr($this->getPath(), 0, $length);
     }
     if ($this->caseSensitive) {
         $result = strcmp($probe, $pathString) == 0;
     } else {
         $result = strcasecmp($probe, $pathString) == 0;
     }
     return $result;
 }
示例#17
0
 function load()
 {
     $this->load->library('path');
     $this->load->helper('html');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
     $this->rapyd->load('dataform');
     $form = new DataForm('ventas/metas/load/process');
     $form->title('Cargar Metas (xls)');
     $list = array('<b>C</b>: El nombre del negocio (' . $this->datasis->traevalor('TITULO1') . ').', '<b>F</b>: El c&oacute;digo del producto.', '<b>H</b>: La meta en toneladas para el mes 1.', '<b>I</b>: La meta en toneladas para el mes 2 (Colocar en cero si no se tiene).', '<b>J</b>: La meta en toneladas para el mes 3 (Colocar en cero si no se tiene).');
     $form->container = new containerField("adver", "Asegurese de que el formato este en <b>Excel 97-2003</b> y contenga las siguientes columnas: " . ul($list));
     $form->archivo = new uploadField('Archivo', 'archivo');
     $form->archivo->upload_path = '';
     $form->archivo->allowed_types = 'xls';
     $form->archivo->delete_file = false;
     $form->archivo->upload_root = '/tmp';
     $form->archivo->rule = 'required';
     $form->archivo->append('Solo archivos en formato xls (Excel 97-2003)');
     $accion = "javascript:window.location='" . site_url('ventas/metas/filteredgrid') . "'";
     $form->button('btn_pfl', 'Regresar', $accion, 'TR');
     $form->submit('btnsubmit', 'Enviar');
     $form->build_form();
     $rti = '';
     if ($form->on_success()) {
         $arch = '/tmp/' . $form->archivo->upload_data['file_name'];
         $rt = $this->_nread($arch);
         $rti = "<p>{$rt}</p>";
     }
     $data['content'] = $rti . $form->output;
     $data['title'] = heading('Carga metas desde Archivo Excel');
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
示例#18
0
 function load()
 {
     $this->datasis->modulo_id(143, 1);
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
     $this->rapyd->load('dataform');
     $form = new DataForm('ventas/pfaclite/load/insert');
     $form->title('Cargar Archivo de Productos (xls)');
     $form->archivo = new uploadField('Archivo', 'archivo');
     $form->archivo->upload_path = '';
     $form->archivo->allowed_types = 'xls';
     $form->archivo->delete_file = false;
     $form->archivo->upload_root = '/tmp';
     $form->archivo->rule = 'required';
     $form->archivo->append("Solo archivos en formato xls (Excel 97-2003)");
     $accion = "javascript:window.location='" . site_url('ventas/pfaclite/filteredgrid') . "'";
     $form->button('btn_pfl', 'Regresar', $accion, 'TR');
     $form->submit('btnsubmit', 'Enviar');
     $form->build_form();
     $rti = '';
     if ($form->on_success()) {
         $arch = '/tmp/' . $form->archivo->upload_data['file_name'];
         $rt = $this->nread($arch);
         $rti = "<p>{$rt}</p>";
     }
     $data['content'] = $rti . $form->output;
     $data['title'] = heading('Cargar Pedido desde Excel');
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas_lite', $data);
 }