HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/gestor-horarios.bradford/app/helpers/MY_form_helper.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	function get_status($is_active)
	{
		switch ($is_active) 
		{
			case 1:
				$estado = '<label class="label label-success">Activo</label>';
			break;
			case 0:
				$estado = '<label class="label label-danger">Desactivado</label>';
			break;
		}
		return $estado;
	}
	
	function format_price($price, $prefix="$")
	{
		if(!empty($price))
		{
			$price = $prefix.number_format($price, 2, ',', '.');
		}
		else
		{
			$price = $prefix."0";
		}
		return $price;
	}
	
	function format_rate($rate, $sufix="%")
	{
		
		if(!empty($rate))
		{
			if(!is_float($rate))
			{
				 
			}
			$rate = number_format(($rate * 100), 1).$sufix; 
		}
		else
		{
			$rate = "0".$sufix;
		}
		return $rate;
	}
	
	function set_image_name($file_name)
	{
		$replace = array('.', ' ');
        $nombre_foto = str_replace($replace, '', microtime().'_'.rand(1000,9999));
        $extension  = array_pop(explode('.', $file_name));
        $nombre_foto .=  '_gallery.'.strtolower($extension);
		return $nombre_foto;
	}

	function format_image_name($file)
	{
		$replace    = array(' ', '  ', '-', '´');
        $file_clean = str_replace($replace, '-', $file);
        $file_name  = array_shift(explode('.', $file_clean));
        $file_name =  ''.strtolower($file_name);
		return $file_name;
	}
	
	function set_file_name($file_name)
	{
		$replace = array('.', ' ');
        $nombre_foto = str_replace($replace, '', microtime().rand(1000,9999));
        $extension  = array_pop(explode('.', $file_name));
        $nombre_foto .=  '-attachment.'.$extension;
		return $nombre_foto;
	}
	
	function make_folder($prefix='', $id_carpeta=0, $carpeta_padre='gallery')
	{
		$path = ROOT_PATH_BASE."/$carpeta_padre/$prefix$id_carpeta";
         mkdir($path, 0755, TRUE);
		 return $path;
	}
	
	function ultimoPago($rut)
	{
		require_once ROOT_PATH_BASE.'/app/libraries/nusoap-0.9.5/nusoap.php';
        $wdsl = "http://200.14.251.189/WsLex1.asmx?wsdl"; 
        $client = new nusoap_client($wdsl, true);
        $client->soap_defencoding = 'UTF-8';
        $client->decode_utf8 = false;
		$data['llave'] = '*Gautomata19*';
		$data['rut'] = $rut;
		$result = $client->call("ClienteUltimoPago", $data);
		return  $result['ClienteUltimoPagoResult'];
	}
	
	function formatString($string='')
	{
		$utf8 = iconv("windows-1252", "utf-8", $string);
		return $utf8;
	}
	
	function formatRut( $rut ) {
    	return number_format( substr ( $rut, 0 , -1 ) , 0, "", ".") . '-' . substr ( $rut, strlen($rut) -1 , 1 );
	}
	
	function between($varToCheck, $low, $high) 
    {
		if($varToCheck < $low) return false;
		if($varToCheck > $high && $high != '+') return false;
		return true;
	}
	
		function clean_str_remove($string='')
    {
        $clean_str = preg_replace('~\x{00AD}~u', '', $string);
		$clean_str = $this->remove_bs($clean_str);
		//$clean_str = utf8_encode($clean_str);
		
        //$clean_str = strtolower($clean_str);
        return $clean_str;
    }
	
	function remove_bs($Str) {
	  $StrArr = str_split($Str);
	  $NewStr = '';
	  $permit = array(130,160,161,162,163,164,165);
	  foreach ($StrArr as $Char) {    
	    $CharNo = ord($Char);
		  $Char2 = mb_convert_encoding($Char,'Unicode');
		  //$Char2 = iconv("windows-1252", "Unicode", $Char2);
		//pre('$CharNo:'.$CharNo.' - $CharNo:'.$Char.' - $Char2:'.$Char2);
	    //if (in_array($CharNo, $permit))
	    if ($CharNo == 130) 
	    {
	    	 //$NewStr .= $Char; continue;
	    	 $NewStr .= $Char; 
		}
		
		if ($CharNo >= 160 && $CharNo <= 165) 
	    {
	      $NewStr .= $Char;    
	    }
		
	    if ($CharNo > 31 && $CharNo < 127) 
	    {
	      $NewStr .= $Char;    
	    }
	  }  
		//pre_//die($NewStr);
	  return $NewStr;
	}
	
	function clean_str($string='')
	{
	
		$search = array('á','é','í','ó','ú','ñ','ü','Á','É','Í','Ó','Ú','Ñ','Ü','À','È','Ì','Ò','Ù','à','è','ì','ò','ù','±','°');
	    $replace = array('a','e','i','o','u','n','u','A','E','I','O','U','N','U','A','E','I','O','U','a','e','i','o','u','n','-');
	    $clean_str = str_replace($search, $replace, $string);
	
	    //$search = array('$','$','/','*',')','(','=', "'", '"','!','¡',',',':',';','%','#','@','<','>','+','¿','|','.','?','”',"\t",'“',"\n");
	    //$clean_str = str_replace($search, '', $clean_str);
	
	    $clean_str = strtolower($clean_str);
	    return $clean_str;
	}