Пример #1
0
    if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) {
        $message = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")) . '</div>';
        $action = 'test';
        $error++;
    }
    if (empty($sendto) || !str_replace('+', '', $sendto)) {
        $message = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")) . '</div>';
        $action = 'test';
        $error++;
    }
    if (!$error) {
        // Make substitutions into message
        complete_substitutions_array($substitutionarrayfortest, $langs);
        $body = make_substitutions($body, $substitutionarrayfortest);
        require_once DOL_DOCUMENT_ROOT . "/core/class/CSMSFile.class.php";
        $smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class);
        // This define OvhSms->login, pass, session and account
        $result = $smsfile->sendfile();
        // This send SMS
        if ($result) {
            $message = '<div class="ok">' . $langs->trans("SmsSuccessfulySent", $smsfrom, $sendto) . '</div>';
        } else {
            $message = '<div class="error">' . $langs->trans("ResultKo") . '<br>' . $smsfile->error . ' ' . $result . '</div>';
        }
        $action = '';
    }
}
/*
 * View
 */
$linuxlike = 1;
Пример #2
0
	}
	if (empty($sendto) || ! str_replace('+','',$sendto))
	{
		$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")).'</div>';
        $action='test';
		$error++;
	}
	if (! $error)
	{
		// Make substitutions into message
        complete_substitutions_array($substitutionarrayfortest, $langs);
	    $body=make_substitutions($body,$substitutionarrayfortest);

		require_once(DOL_DOCUMENT_ROOT."/lib/CSMSFile.class.php");

		$smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class);  // This define OvhSms->login, pass, session and account
		$result=$smsfile->sendfile(); // This send SMS

		if ($result)
		{
			$message='<div class="ok">'.$langs->trans("SmsSuccessfulySent",$smsfrom,$sendto).'</div>';
		}
		else
		{
			$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$smsfile->error.' '.$result.'</div>';
		}

		$action='';
	}
}