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/proveedores.bradford/application/helpers/utilities_helper.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function limpiacaracteres($str){
	$res = str_replace('ñ', 'n', $str);
	$res = str_replace('/', ' ', $str);
	$res = str_replace('á', 'a', $res);
	$res = str_replace('é', 'e', $res);
	$res = str_replace('í', 'i', $res);
	$res = str_replace('ó', 'o', $res);
	$res = str_replace('ú', 'u', $res);
	$res = preg_replace('([^A-Za-z0-9 ])', '', $res);
	return $res;
}
function format_price($price, $prefix = "$")
{
	if (!empty($price)) {
		$price = $prefix . number_format($price, 0, ',', '.');
	} else {
		$price = $prefix . "0";
	}
	return $price;
}

function format_miles($price)
{
	if (!empty($price)) {
		$price = number_format($price, 0, ',', '.');
	} else {
		$price =  "0";
	}
	return $price;
}

function rut($rut)
{
	return number_format(substr($rut, 0, -1), 0, "", ".") . '-' . substr($rut, strlen($rut) - 1, 1);
}

function enviar_correo($data_mail, $debug = FALSE)
{
	//$data_mail['para'] = '';
	//$data_mail['remitente'] = "";
	//$data_mail['usuario']   = "";
	$CI =& get_instance();
	$config['mailtype'] = 'html';
	$config['charset'] = 'utf-8';
	
	$CI->load->library('email', $config);
	$config = array(
		'mailtype' => 'html', // Establece el tipo de correo a HTML
		'charset'  => 'utf-8',
		'priority' => '1'
	);
	$CI->email->initialize($config);

	if(!empty($data_mail['attach']))
	{
		$CI->email->clear(TRUE);
		foreach ($data_mail['attach'] as $key => $value)
		{
			$CI->email->attach($value['path'], 'attachment', $value['file_name']);   
		}
	}
	$CI->email->to($data_mail['para']); 
	$CI->email->from($data_mail['remitente'], $data_mail['usuario']);
	if(!empty($data_mail['bcc_remitente']))
	{
		$CI->email->bcc($data_mail['bcc_remitente']);
	}
	$CI->email->subject($data_mail['asunto']);
	$CI->email->message($data_mail['mensaje']);
	
	$CI->email->send();
	if($debug)
	{
		echo $CI->email->print_debugger();
	}
}

function reportExcel($data, $filename, $url = '')
{
	$CI = &get_instance();
	$CI->load->library('spreadsheets');
	#GENERA ARCHIVO PARA EXPORTAR LA DATA A EXCEL
	$path = $CI->spreadsheets->export($data);
	#SE VALIDA SI EXISTE ARCHIVO TEMPORAL
	if (file_exists($path)) {
		$CI->load->helper('download');
		force_download($filename . '.xlsx', file_get_contents($path));
	} else {
		$CI->session->set_flashdata("error_title", "Error Interno");
		$CI->session->set_flashdata("error", "Error al exportar los datos. Intente nuevamente si problema persiste contacte a soporte");
		
		redirect(base_url($url));
	}
}