|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* oledrion |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
|
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
17
|
|
|
* @author Hossein Azizabadi ([email protected]) |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
/* |
|
|
|
|
|
|
23
|
|
|
$information = array(); |
|
24
|
|
|
$information['to'] = '9365965795'; |
|
25
|
|
|
$information['text'] = 'ewrewr we sdf sdfdsf sdfasda sd asd asd'; |
|
26
|
|
|
$sms = Oledrion_sms::sendSms($information); |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
class Oledrion_sms |
|
|
|
|
|
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* |
|
33
|
|
|
* @return string |
|
34
|
|
|
*/ |
|
35
|
|
|
public static function getSmsGateway() |
|
36
|
|
|
{ |
|
37
|
|
|
return OLEDRION_SMS_GATEWAY; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string $smsGatewayName |
|
42
|
|
|
* @return string |
|
43
|
|
|
*/ |
|
44
|
|
|
public static function getSmsGatewayPath($smsGatewayName) |
|
45
|
|
|
{ |
|
46
|
|
|
return OLEDRION_CLASS_PATH . 'sms' . '/' . $smsGatewayName; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param string $smsGatewayName |
|
51
|
|
|
* @return string |
|
52
|
|
|
*/ |
|
53
|
|
|
public static function getSmsGatewayFullClassPath($smsGatewayName) |
|
54
|
|
|
{ |
|
55
|
|
|
$smsGatewayPath = self::getSmsGatewayPath($smsGatewayName); |
|
56
|
|
|
|
|
57
|
|
|
return $smsGatewayPath . '/' . 'sms.php'; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param string $smsGatewayName |
|
62
|
|
|
*/ |
|
63
|
|
|
public static function includeSmsGatewayClass($smsGatewayName) |
|
64
|
|
|
{ |
|
65
|
|
|
$smsGatewayClassPath = self::getSmsGatewayFullClassPath($smsGatewayName); |
|
66
|
|
|
require_once $smsGatewayClassPath; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @param string $smsGatewayName |
|
71
|
|
|
* @return array |
|
72
|
|
|
*/ |
|
73
|
|
|
public static function getSmsGatewayOption($smsGatewayName) |
|
74
|
|
|
{ |
|
75
|
|
|
$option = array(); |
|
76
|
|
|
$smsGatewayPath = self::getSmsGatewayPath($smsGatewayName); |
|
77
|
|
|
require_once $smsGatewayPath . '/' . 'option.php'; |
|
78
|
|
|
|
|
79
|
|
|
return $option; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @param array $information |
|
84
|
|
|
* @return string |
|
85
|
|
|
* @internal param string $smsGatewayName |
|
86
|
|
|
*/ |
|
87
|
|
|
public static function sendSms($information = array()) |
|
88
|
|
|
{ |
|
89
|
|
|
$smsGatewayName = self::getSmsGateway(); |
|
90
|
|
|
$option = self::getSmsGatewayOption($smsGatewayName); |
|
91
|
|
|
self::includeSmsGatewayClass($smsGatewayName); |
|
92
|
|
|
|
|
93
|
|
|
return sms::sendSms($information, $option); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.