Leave possibility to run script without sending SMS (just display)
Benjamin Renard

Benjamin Renard commited on 2015-01-07 09:39:48
Showing 1 changed files, with 8 additions and 3 deletions.

... ...
@@ -25,15 +25,15 @@ if (isset($options["c"]) && $options["c"]!==false) {
25 25
 }
26 26
 else die("You must provide cine code with -c=XXX parameter.\n");
27 27
 
28
+$send_to=false;
29
+$mail_domain=false;
28 30
 if (isset($options["t"]) && $options["t"]!==false) {
29 31
 	$send_to=$options["t"];
30
-}
31
-else die("You must provide phone number with -t=XXXX parameter.\n");
32
-
33 32
 	if (isset($options["d"]) && $options["d"]!==false) {
34 33
 		$mail_domain=$options["d"];
35 34
 	}
36 35
 	else die("You must provide SMS mail domain with -d=domain.tld parameter.\n");
36
+}
37 37
 
38 38
 try {
39 39
 	$helper = new AlloHelper;
... ...
@@ -106,6 +106,7 @@ foreach($fmovies as $m => $ps){
106 106
 // Remove accents
107 107
 $msg=$msg=withoutAccents($msg);
108 108
 
109
+if ($send_to && $mail_domain) {
109 110
 	// Format mail
110 111
 	$mail="$send_to@$mail_domain";
111 112
 
... ...
@@ -114,3 +115,7 @@ echo "Send to $mail :\n\n$msg";
114 115
 
115 116
 	// Send message
116 117
 	mail($mail,'',$msg);
118
+}
119
+else {
120
+	echo "$msg";
121
+}
117 122