Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/erp/htdocs/custom/smspubli/class/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/erp/htdocs/custom/smspubli/class/smspubli.class.php
<?php
	class Smspubli extends CommonObject{
		var $expe='';
		var $dest='';
		var $message='';
		var $deferred='';
		var $priority='';
		var $class='';
		var $error;
        var $timeDrift = 0;
		
		function Smspubli($DB) {
		
		}
		
		function SmsSenderList() {
			global $conf;
			$frm = new stdClass();
			$frm->number = $conf->global->SMSPUBLI_SMSFROM;
			return array($frm);
		}
		
		function SmsSend() {
			
			global $langs, $conf, $db;
			$langs->load("smspubli@smspubli");
			$to = str_replace('+','',$this->dest); //Without 00
			if(!preg_match('/^[0-9]+$/', $to)) {
				$this->error = $langs->trans('errorRecipient');
				return 0;
			}
			$customsms= '';
			$socid=intval($_GET['id']);
			$type= $_GET['type'];

			if($socid>0) {
				$customsms = 'socid='.$socid;
			}
			
			$api = $conf->global->SMSPUBLI_APIKEY;

			if ((preg_match("/^[0-9]{8}$/", $to )) || (preg_match("/^[0-9]{11}$/", $to )) ){

				$wsdl   = "https://apisvr.dps-lat.com/ws/server.wsdl";
				$client = new \SoapClient($wsdl, array('trace'=>1));  // The trace param will show you errors stack
				
				// web service input params
				$request_param = array(
					"Mensaje" => $this->message ,
					"UsuarioEnvia" => $conf->global->SMSPUBLI_SMSFROM,
					"CodigoTipoMensaje" => '99',
					"Destino" =>  $to,
					"FechaHoraEnvio" =>  date('d-m-Y H:i:s')
				);
				$event = $client->__soapCall("SendSMS", $request_param );
				$sql  = "Insert into ".MAIN_DB_PREFIX."sms_log (type, fk_object,telephone, message,result) Values( '". $type ."',". $socid .",'".$to."','".$this->message."',".$event.") ";
				$resp = $db->query($sql);
				if ($event == 0 ){
					return 1;
				}else{
					$this->error = $event;
					dol_syslog(get_class($this)."::SmsSend ".print_r($event, true), LOG_ERR);
					return 0;	
				}

			}else{
				$this->error = $langs->trans('errorRecipient');
				return 0;
			}
		}

	}
?>

Hry