WHMCS是一套国外流行的域名主机管理软件,跟国内众所周知的IDCSystem一样,主要在用户管理、财务管理、域名接口、服务器管理面板接口等方面设计的非常人性化。WHMCS是一套全面支持域名注册管理解析,主机开通管理,VPS开通管理和服务器管理的一站式管理软件,目前已经被越来越多的中国站长们所熟悉和了解。最近小编发现客户提供我们一个whmcs版本的短信插件不能使用,我们这边并修复了一下,今天小编就以替换短信接口为例告诉大家如何进行二次开发,我们讲解的是whmcs_v7.60版本。
1:下面具体给大家说一下目录的作用 hooks文件夹 主要涉及到各种发送短信的模板代码 例如:AdminLogin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php $hook = array( 'hook' => 'AdminLogin' , 'function' => 'AdminLogin_admin' , 'type' => 'admin' , 'extra' => '' , 'defaultmessage' => '{username},已经登陆后台.' , 'variables' => '{username}' ); if (!function_exists( 'AdminLogin_admin' )){ function AdminLogin_admin($args){ $class = new AktuelSms(); $template = $class->getTemplateDetails(__FUNCTION__); if ($template[ 'active' ] == 0){ return null ; } $settings = $class->getSettings(); if (!$settings[ 'api' ] || !$settings[ 'apiparams' ]){ return null ; } $admingsm = explode( "," ,$template[ 'admingsm' ]); $template[ 'variables' ] = str_replace( " " , "" ,$template[ 'variables' ]); $replacefrom = explode( "," ,$template[ 'variables' ]); $replaceto = array($args[ 'username' ]); $message = str_replace($replacefrom,$replaceto,$template[ 'template' ]); foreach($admingsm as $gsm){ if (!empty($gsm)){ $class->setGsmnumber( trim($gsm)); $class->setUserid(1); $class->setMessage($message); $class->send(); } } } } return $hook; |
2:lang文件夹 主要涉及一些语言的配置 例如chinese.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php $_ADDONLANG[ 'lang' ] = "chinese" ; $_ADDONLANG[ 'newversion' ] = "本插件已经有最新的版本. 请前往 <a href=\"https://github.com/AktuelSistem/WHMCS-SmsModule\">Github page</a> 下载最新版.<br><br>下载上传以后刷新本页面.<br><br>" ; $_ADDONLANG[ 'uptodate' ] = "您的插件已经是最新版." ; $_ADDONLANG[ 'save' ] = "保存" ; $_ADDONLANG[ 'gsmnumberfield' ] = "手机号码字段(自定义用户字段)" ; $_ADDONLANG[ 'wantsmsfield' ] = "订阅短信服务字段(自定义用户字段)" ; $_ADDONLANG[ 'user' ] = "用户名" ; $_ADDONLANG[ 'pass' ] = "密码" ; $_ADDONLANG[ 'apiid' ] = "API ID" ; $_ADDONLANG[ 'email' ] = "Email" ; $_ADDONLANG[ 'countrycode' ] = "国家代码" ; $_ADDONLANG[ 'senderid' ] = "发送人ID(短信标题)" ; $_ADDONLANG[ 'dateformat' ] = "时间格式" ; $_ADDONLANG[ 'sender' ] = "短信接口类型" ; $_ADDONLANG[ 'settings' ] = "设置" ; $_ADDONLANG[ 'signature' ] = "短信签名" ; $_ADDONLANG[ 'clientsmstemplates' ] = "用户短信模版" ; $_ADDONLANG[ 'adminsmstemplates' ] = "管理员短信模版" ; $_ADDONLANG[ 'sendsms' ] = "发送短信" ; $_ADDONLANG[ 'messages' ] = "已发送短信" ; $_ADDONLANG[ 'update' ] = "升级更新" ; $_ADDONLANG[ 'smssent' ] = "<br><br><b>短信发送完毕</b>" ; $_ADDONLANG[ 'client' ] = "接收用户" ; $_ADDONLANG[ 'selectclient' ] = "选择客户" ; $_ADDONLANG[ 'message' ] = "短信内容" ; $_ADDONLANG[ 'debug' ] = "显示输出 log" ; $_ADDONLANG[ 'send' ] = "发送" ; $_ADDONLANG[ 'debugsonuc' ] = "返回结果" ; $_ADDONLANG[ 'gsmnumber' ] = "手机号码" ; $_ADDONLANG[ 'datetime' ] = "发送时间" ; $_ADDONLANG[ 'status' ] = "状态" ; $_ADDONLANG[ 'delete' ] = "删除" ; $_ADDONLANG[ 'parameter' ] = "可用参数标签:" ; $_ADDONLANG[ 'active' ] = "激活" ; $_ADDONLANG[ 'ekstra' ] = "扩展 {x}" ; $_ADDONLANG[ 'admingsm' ] = "管理员手机号码" ; $_ADDONLANG[ 'admingsmornek' ] = "手机号码示例:13800138000" ; $_ADDONLANG[ 'credit' ] = "短信可用余额" ; $_ADDONLANG[ 'error' ] = "错误" ; $_ADDONLANG[ 'pending' ] = "配置中" ; $_ADDONLANG[ 'sent' ] = "发送中" ; $_ADDONLANG[ 'success' ] = "成功" ; $_ADDONLANG[ 'authkey' ] = "Authentication Key" ; $_ADDONLANG[ 'route' ] = "SMS 发送线路 (例如: 4)" ; $_ADDONLANG[ 'flash' ] = "彩信 (Yes=1/No=0)" ; $_ADDONLANG[ 'unicode' ] = "Unicode编码SMS (Yes=1/No=0)" ; $_ADDONLANG[ 'ignoreNdnc' ] = "忽略 NDNC 号码? (Yes=1/No=0)" ; |
3:senders文件夹 主要涉及到短信的配置 例如smsbao.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<?php /*短信宝接口 2016-10-21 http://www.smsbao.com */ class smsbao extends AktuelSms implements SmsSenderInterface{ function __construct($message,$gsmnumber){ $ this ->message = $ this ->utilmessage($message); $ this ->gsmnumber = $ this ->utilgsmnumber($gsmnumber); } function send(){ if ($ this ->gsmnumber == "numbererror" ){ $log[] = ( "Number format error." .$ this ->gsmnumber); $error[] = ( "Number format error." .$ this ->gsmnumber); return null ; } $params = $ this ->getParams(); $ this ->gsmnumber = substr($ this ->gsmnumber,-11); $result = file_get_contents( 'http://www.smsbao.com/sms?u=' .$params->user. '&p=' .md5($params->pass). '&m=' .$ this ->gsmnumber. '&c=' .urlencode($ this ->message). '&' ); $result = explode( " " ,$result); if ($result[0] == "0" ) { $log[] = ( "信息发送成功." ); } elseif($result[0] == "30" ) { $log[] = ( "密码错误." ); $error[] = ( "密码错误." ); } elseif($result[0] == "40" ) { $log[] = ( "账号不存在." ); $error[] = ( "账号不存在." ); } elseif($result[0] == "41" ) { $log[] = ( "余额不足." ); $error[] = ( "余额不足." ); } elseif($result[0] == "42" ) { $log[] = ( "帐号过期." ); $error[] = ( "帐号过期." ); } elseif($result[0] == "43" ) { $log[] = ( "IP地址限制" ); $error[] = ( "IP地址限制." ); } elseif($result[0] == "50" ) { $log[] = ( "内容含有敏感词." ); $error[] = ( "内容含有敏感词." ); } elseif($result[0] == "51" ) { $log[] = ( "手机号码不正确." ); $error[] = ( "手机号码不正确." ); } return array( 'log' => $log, 'error' => $error, 'msgid' => $result[0], ); } function balance(){ $params = $ this ->getParams(); if ($params->user && $params->pass) { $result = @file_get_contents( 'http://www.smsbao.com/query?u=' .$params->user. '&p=' .md5($params->pass). '&' ); $result = explode( ',' ,$result); if ($result[0] != '' ) { $remain = (int)$result[1]; $str = sprintf( '短信宝增值平台 剩余:%d 条' , $remain); return $str; } else { return null ; } } else { return null ; } } function report($msgid){ return "success" ; } //You can spesifically convert your gsm number. See netgsm for example function utilgsmnumber($number){ return $number; } //You can spesifically convert your message function utilmessage($message){ return $message; } } return array( 'value' => 'smsbao' , 'label' => '短信宝' , 'fields' => array( 'user' , 'pass' ) ); |
4:aktuel_sms.php文件则是控制后台短信配置,激活相关的文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
<?php /* WHMCS SMS Addon with GNU/GPL Licence * AktuelHost - http://www.aktuelhost.com * * * Developed at Aktuel Sistem ve Bilgi Teknolojileri (www.aktuelsistem.com) * Licence: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.txt) * */ if (!defined( "WHMCS" )) die( "This file cannot be accessed directly" ); function aktuel_sms_config() { $configarray = array( "name" => "SMS 短信服务平台" , "description" => "WHMCS 短信服务平台中文版" , "version" => "1.1.8(20161021)" , "author" => "imnpc" , "language" => "chinese" , ); return $configarray; } function aktuel_sms_activate() { $query = "CREATE TABLE IF NOT EXISTS `mod_aktuelsms_messages` (`id` int(11) NOT NULL AUTO_INCREMENT,`sender` varchar(40) NOT NULL,`to` varchar(15) DEFAULT NULL,`text` text,`msgid` varchar(50) DEFAULT NULL,`status` varchar(10) DEFAULT NULL,`errors` text,`logs` text,`user` int(11) DEFAULT NULL,`datetime` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;" ; mysql_query($query); $query = "CREATE TABLE IF NOT EXISTS `mod_aktuelsms_settings` (`id` int(11) NOT NULL AUTO_INCREMENT,`api` varchar(40) CHARACTER SET utf8 NOT NULL,`apiparams` varchar(500) CHARACTER SET utf8 NOT NULL,`dateformat` varchar(12) CHARACTER SET utf8 DEFAULT NULL,`version` varchar(6) CHARACTER SET utf8 DEFAULT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;" ; mysql_query($query); $query = "INSERT INTO `mod_aktuelsms_settings` (`api`, `apiparams`,`dateformat`, `version`) VALUES ('', '','%y.%m.%d','1.1.8');" ; mysql_query($query); $query = "CREATE TABLE IF NOT EXISTS `mod_aktuelsms_templates` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(50) CHARACTER SET utf8 NOT NULL,`type` enum('client','admin') CHARACTER SET utf8 NOT NULL,`admingsm` varchar(255) CHARACTER SET utf8 NOT NULL,`template` varchar(240) CHARACTER SET utf8 NOT NULL,`variables` varchar(500) CHARACTER SET utf8 NOT NULL,`active` tinyint(1) NOT NULL,`extra` varchar(3) CHARACTER SET utf8 NOT NULL,`description` text CHARACTER SET utf8,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;" ; mysql_query($query); //Creating hooks require_once( "smsclass.php" ); $class = new AktuelSms(); $class->checkHooks(); return array( 'status' => 'success' , 'description' => 'SMS 短信服务平台激活成功.' ); } function aktuel_sms_deactivate() { $query = "DROP TABLE `mod_aktuelsms_templates`" ; mysql_query($query); $query = "DROP TABLE `mod_aktuelsms_settings`" ; mysql_query($query); $query = "DROP TABLE `mod_aktuelsms_messages`" ; mysql_query($query); return array( 'status' => 'success' , 'description' => 'SMS 短信服务平台已经禁用.' ); } function aktuel_sms_upgrade($vars) { $version = $vars[ 'version' ]; switch ($version){ case "1" : case "1.0.1" : $sql = "ALTER TABLE `mod_aktuelsms_messages` ADD `errors` TEXT NULL AFTER `status` ;ALTER TABLE `mod_aktuelsms_templates` ADD `description` TEXT NULL ;ALTER TABLE `mod_aktuelsms_messages` ADD `logs` TEXT NULL AFTER `errors` ;" ; mysql_query($sql); case "1.1" : $sql = "ALTER TABLE `mod_aktuelsms_settings` CHANGE `apiparams` `apiparams` VARCHAR( 500 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ;" ; mysql_query($sql); case "1.1.1" : case "1.1.2" : $sql = "UPDATE `mod_aktuelsms_settings` SET dateformat = '%y.%m.%d';" ; mysql_query($sql); case "1.1.3" : case "1.1.4" : $sql = "ALTER TABLE `mod_aktuelsms_templates` CHANGE `name` `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `type` `type` ENUM( 'client', 'admin' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `admingsm` `admingsm` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `template` `template` VARCHAR( 240 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `variables` `variables` VARCHAR( 500 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `extra` `extra` VARCHAR( 3 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;" ; mysql_query($sql); $sql = "ALTER TABLE `mod_aktuelsms_settings` CHANGE `api` `api` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `apiparams` `apiparams` VARCHAR( 500 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `dateformat` `dateformat` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `version` `version` VARCHAR( 6 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;" ; mysql_query($sql); $sql = "ALTER TABLE `mod_aktuelsms_messages` CHANGE `sender` `sender` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,CHANGE `to` `to` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `text` `text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `msgid` `msgid` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `status` `status` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `errors` `errors` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,CHANGE `logs` `logs` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;" ; mysql_query($sql); $sql = "ALTER TABLE `mod_aktuelsms_templates` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" ; mysql_query($sql); $sql = "ALTER TABLE `mod_aktuelsms_settings` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" ; mysql_query($sql); $sql = "ALTER TABLE `mod_aktuelsms_messages` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" ; mysql_query($sql); case "1.1.5" : case "1.1.6" : case "1.1.7" : break ; } $class = new AktuelSms(); $class->checkHooks(); } function aktuel_sms_output($vars){ $modulelink = $vars[ 'modulelink' ]; $version = $vars[ 'version' ]; $LANG = $vars[ '_lang' ]; //putenv("TZ=Europe/Istanbul"); $class = new AktuelSms(); $tab = $_GET[ 'tab' ]; echo ' <div id="clienttabs"> <ul class="nav nav-tabs admin-tabs"> <li class="' . (($tab == "settings ")?" active ":" tab ") . '" ><a href= "addonmodules.php?module=aktuel_sms&tab=settings" >'.$LANG[ 'settings' ]. '</a></li> <li class="' . ((@$_GET[ 'type' ] == "client ")?" active ":" tab ") . '" ><a href= "addonmodules.php?module=aktuel_sms&tab=templates&type=client" >'.$LANG[ 'clientsmstemplates' ]. '</a></li> <li class="' . ((@$_GET[ 'type' ] == "admin ")?" active ":" tab ") . '" ><a href= "addonmodules.php?module=aktuel_sms&tab=templates&type=admin" >'.$LANG[ 'adminsmstemplates' ]. '</a></li> <li class="' . (($tab == "sendbulk ")?" active ":" tab ") . '" ><a href= "addonmodules.php?module=aktuel_sms&tab=sendbulk" >'.$LANG[ 'sendsms' ]. '</a></li> <li class="' . (($tab == "messages ")?" active ":" tab ") . '" ><a href= "addonmodules.php?module=aktuel_sms&tab=messages" >'.$LANG[ 'messages' ]. '</a></li> </ul> </div> ' ; if (!isset($tab) || $tab == "settings" ) { /* UPDATE SETTINGS */ if ($_POST[ 'params' ]) { $update = array( "api" => $_POST[ 'api' ], "apiparams" => json_encode($_POST[ 'params' ]), 'dateformat' => $_POST[ 'dateformat' ] ); update_query( "mod_aktuelsms_settings" , $update, "" ); } /* UPDATE SETTINGS */ $settings = $class->getSettings(); $apiparams = json_decode($settings[ 'apiparams' ]); $classers = $class->getSenders(); $classersoption = '' ; $classersfields = '' ; foreach($classers as $classer){ $classersoption .= '<option value="' .$classer[ 'value' ]. '" ' . (($settings[ 'api' ] == $classer[ 'value' ])? "selected=\"selected\"" : "" ) . '>' .$classer[ 'label' ]. '</option>' ; if ($settings[ 'api' ] == $classer[ 'value' ]){ foreach($classer[ 'fields' ] as $field){ $classersfields .= '<tr> <td class="fieldlabel" width="30%">' .$LANG[$field]. '</td> <td class="fieldarea"><input type="text" name="params[' .$field. ']" size="40" value="' . $apiparams->$field . '"></td> </tr>' ; } } } echo ' <script type="text/javascript"> $(document).ready(function(){ $("#api").change(function(){ $("#form").submit(); }); }); </script> <form action="" method="post" id="form"> <input type="hidden" name="action" value="save" /> <div style="text-align: left;background-color: whiteSmoke;margin: 0px;padding: 10px;border: 1px solid #ddd;"> <table class="form" width="100%" border="0" cellspacing="2" cellpadding="3"> <tbody> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'sender' ]. '</td> <td class="fieldarea"> <select name="api" id="api"> ' .$classersoption. ' </select> </td> </tr> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'senderid' ]. '</td> <td class="fieldarea"><input type="text" name="params[senderid]" size="40" value="' . $apiparams->senderid . '"> e.g: WHMCS</td> </tr> ' .$classersfields. ' <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'signature' ]. '</td> <td class="fieldarea"><input type="text" name="params[signature]" size="40" value="' . $apiparams->signature . '"> e.g: www.whmcs.com</td> </tr> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'dateformat' ]. '</td> <td class="fieldarea"><input type="text" name="dateformat" size="40" value="' . $settings[ 'dateformat' ] . '"> e.g: %y.%m.%d (2016.01.18)</td> </tr> </tbody> </table> </div> <br/> <p align="center"><input type="submit" value="' .$LANG[ 'save' ]. '" class="btn btn-primary" /></p> </form> ' ; } elseif ($tab == "templates" ) { if ($_POST[ 'submit' ]) { $where = array( "type" => array( "sqltype" => "LIKE" , "value" => $_GET[ 'type' ])); $result = select_query( "mod_aktuelsms_templates" , "*" , $where); while ($data = mysql_fetch_array($result)) { if ($_POST[$data[ 'id' ] . '_active' ] == "on" ) { $tmp_active = 1; } else { $tmp_active = 0; } $update = array( "template" => $_POST[$data[ 'id' ] . '_template' ], "active" => $tmp_active ); if (isset($_POST[$data[ 'id' ] . '_extra' ])){ $update[ 'extra' ]= trim($_POST[$data[ 'id' ] . '_extra' ]); } if (isset($_POST[$data[ 'id' ] . '_admingsm' ])){ $update[ 'admingsm' ]= $_POST[$data[ 'id' ] . '_admingsm' ]; $update[ 'admingsm' ] = str_replace( " " , "" ,$update[ 'admingsm' ]); } update_query( "mod_aktuelsms_templates" , $update, "id = " . $data[ 'id' ]); } } echo '<form action="" method="post"> <input type="hidden" name="action" value="save" /> <div style="text-align: left;background-color: whiteSmoke;margin: 0px;padding: 10px;border: 1px solid #ddd;"> <table class="form" width="100%" border="0" cellspacing="2" cellpadding="3"> <tbody>' ; $where = array( "type" => array( "sqltype" => "LIKE" , "value" => $_GET[ 'type' ])); $result = select_query( "mod_aktuelsms_templates" , "*" , $where); while ($data = mysql_fetch_array($result)) { if ($data[ 'active' ] == 1) { $active = 'checked = "checked"' ; } else { $active = '' ; } $desc = json_decode($data[ 'description' ]); if (isset($desc->$LANG[ 'lang' ])){ $name = $desc->$LANG[ 'lang' ]; } else { $name = $data[ 'name' ]; } echo ' <tr> <td class="fieldlabel" width="30%">' . $name . '</td> <td class="fieldarea"> <textarea cols="50" name="' . $data[ 'id' ] . '_template">' . $data[ 'template' ] . '</textarea> </td> </tr>' ; echo ' <tr> <td class="fieldlabel" width="30%" style="float:right;">' .$LANG[ 'active' ]. '</td> <td><input type="checkbox" value="on" name="' . $data[ 'id' ] . '_active" ' . $active . '></td> </tr> ' ; echo ' <tr> <td class="fieldlabel" width="30%" style="float:right;">' .$LANG[ 'parameter' ]. '</td> <td>' . $data[ 'variables' ] . '</td> </tr> ' ; if (!empty($data[ 'extra' ])){ echo ' <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'ekstra' ]. '</td> <td class="fieldarea"> <input type="text" name="' .$data[ 'id' ]. '_extra" value="' .$data[ 'extra' ]. '"> </td> </tr> ' ; } if ($_GET[ 'type' ] == "admin" ){ echo ' <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'admingsm' ]. '</td> <td class="fieldarea"> <input type="text" name="' .$data[ 'id' ]. '_admingsm" value="' .$data[ 'admingsm' ]. '"> ' .$LANG[ 'admingsmornek' ]. ' </td> </tr> ' ; } echo '<tr> <td colspan="2"><hr></td> </tr>' ; } echo ' </tbody> </table> </div> <br/> <p align="center"><input type="submit" name="submit" value="' .$LANG[ 'save' ]. '" class="btn btn-primary" /></p> </form>' ; } elseif ($tab == "messages" ) { if (!empty($_GET[ 'deletesms' ])){ $smsid = (int) $_GET[ 'deletesms' ]; $sql = "DELETE FROM mod_aktuelsms_messages WHERE id = '$smsid'" ; mysql_query($sql); } echo ' <!--<script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script> <link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" type="text/css"> <link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables_themeroller.css" type="text/css"> <script type="text/javascript"> $(document).ready(function(){ $(".datatable").dataTable(); }); </script>--> <div style="text-align: left;background-color: whiteSmoke;margin: 0px;padding: 10px;border: 1px solid #ddd;"> <table class="datatable" border="0" cellspacing="1" cellpadding="3"> <thead> <tr> <th>#</th> <th>' .$LANG[ 'client' ]. '</th> <th>' .$LANG[ 'gsmnumber' ]. '</th> <th>' .$LANG[ 'message' ]. '</th> <th>' .$LANG[ 'datetime' ]. '</th> <th>' .$LANG[ 'status' ]. '</th> <th width="20"></th> </tr> </thead> <tbody> ' ; // Getting pagination values. $page = isset($_GET[ 'page' ]) ? (int)$_GET[ 'page' ] : 1; $limit = (isset($_GET[ 'limit' ]) && $_GET[ 'limit' ]<=50) ? (int)$_GET[ 'limit' ] : 10; $start = ($page > 1) ? ($page*$limit)-$limit : 0; $order = isset($_GET[ 'order' ]) ? $_GET[ 'order' ] : 'DESC' ; /* Getting messages order by date desc */ $sql = "SELECT `m`.*,`user`.`firstname`,`user`.`lastname` FROM `mod_aktuelsms_messages` as `m` JOIN `tblclients` as `user` ON `m`.`user` = `user`.`id` ORDER BY `m`.`datetime` {$order} limit {$start},{$limit}" ; $result = mysql_query($sql); $i = 0; //Getting total records $total = "SELECT count(id) as toplam FROM `mod_aktuelsms_messages`" ; $sonuc = mysql_query($total); $sonuc = mysql_fetch_array($sonuc); $toplam = $sonuc[ 'toplam' ]; //Page calculation $sayfa = ceil($toplam/$limit); while ($data = mysql_fetch_array($result)) { if ($data[ 'msgid' ] && $data[ 'status' ] == "" ||$data[ 'status' ] == "未发送" ||$data[ 'status' ] == "发送成功" ){ $status = $class->getReport($data[ 'msgid' ]); mysql_query( "UPDATE mod_aktuelsms_messages SET status = '$status' WHERE id = " .$data[ 'id' ]. "" ); } else { $status = $data[ 'status' ]; } $i++; echo '<tr> <td>' .$data[ 'id' ]. '</td> <td><a href="clientssummary.php?userid=' .$data[ 'user' ]. '">' .$data[ 'firstname' ]. ' ' .$data[ 'lastname' ]. '</a></td> <td>' .$data[ 'to' ]. '</td> <td>' .$data[ 'text' ]. '</td> <td>' .$data[ 'datetime' ]. '</td> <td>' .$data[ 'status' ]. '</td> <td><a href="addonmodules.php?module=aktuel_sms&tab=messages&deletesms=' .$data[ 'id' ]. '" title="' .$LANG[ 'delete' ]. '"><img src="images/delete.gif" width="16" height="16" border="0" alt="Delete"></a></td></tr>' ; } /* Getting messages order by date desc */ echo ' </tbody> </table> ' ; $list= "" ; for ($a=1;$a<=$sayfa;$a++) { $selected = ($page==$a) ? 'selected="selected"' : '' ; $list.= "<option value='addonmodules.php?module=aktuel_sms&tab=messages&page={$a}&limit={$limit}&order={$order}' {$selected}>{$a}</option>" ; } echo "<select onchange=\"this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);\">{$list}</select></div>" ; } elseif($tab== "sendbulk" ) { $settings = $class->getSettings(); if (!empty($_POST[ 'client' ])){ $userinf = explode( "_" ,$_POST[ 'client' ]); $userid = $userinf[0]; $gsmnumber = $userinf[1]; $class->setGsmnumber($gsmnumber); $class->setMessage($_POST[ 'message' ]); $class->setUserid($userid); $result = $class->send(); if ($result == false ){ echo $class->getErrors(); } else { echo $LANG[ 'smssent' ]. ' ' .$gsmnumber; } if ($_POST[ "debug" ] == "ON" ){ $debug = 1; } } $userSql = "SELECT `id`,`firstname`, `lastname`, `phonenumber` as `gsmnumber` FROM `tblclients` ORDER BY `tblclients`.`id` ASC" ; $clients = '' ; $result = mysql_query($userSql); while ($data = mysql_fetch_array($result)) { $clients .= '<option value="' .$data[ 'id' ]. '_' .$data[ 'gsmnumber' ]. '">' .$data[ 'firstname' ]. ' ' .$data[ 'lastname' ]. ' (#' .$data[ 'id' ]. ')</option>' ; } echo ' <script> jQuery.fn.filterByText = function(textbox, selectSingleMatch) { return this.each(function() { var select = this; var options = []; $(select).find("option").each(function() { options.push({value: $(this).val(), text: $(this).text()}); }); $(select).data("options", options); $(textbox).bind("change keyup", function() { var options = $(select).empty().scrollTop(0).data("options"); var search = $.trim($(this).val()); var regex = new RegExp(search,"gi"); $.each(options, function(i) { var option = options[i]; if(option.text.match(regex) !== null) { $(select).append( $("<option>").text(option.text).val(option.value) ); } }); if (selectSingleMatch === true && $(select).children().length === 1) { $(select).children().get(0).selected = true; } }); }); }; $(function() { $("#clientdrop").filterByText($("#textbox"), true); }); </script>' ; echo '<form action="" method="post"> <input type="hidden" name="action" value="save" /> <div style="text-align: left;background-color: whiteSmoke;margin: 0px;padding: 10px;border: 1px solid #ddd;"> <table class="form" width="100%" border="0" cellspacing="2" cellpadding="3"> <tbody> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'client' ]. '</td> <td class="fieldarea"> <input id="textbox" type="text" placeholder="请输入用户名筛选" style="width:498px;padding:5px"><br> <select name="client" multiple id="clientdrop" style="width:512px;padding:5px"> <option value="">' .$LANG[ 'selectclient' ]. '</option> ' . $clients . ' </select> </td> </tr> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'mesaj' ]. '</td> <td class="fieldarea"> <textarea cols="70" rows="20" name="message" style="width:498px;padding:5px"></textarea> </td> </tr> <tr> <td class="fieldlabel" width="30%">' .$LANG[ 'debug' ]. '</td> <td class="fieldlabel"><input type="checkbox" name="debug" value="ON"></td> </tr> </tbody> </table> </div> <br/> <p align="center"><input type="submit" value="' .$LANG[ 'send' ]. '" class="btn btn-primary" /></p> </form>' ; if (isset($debug)){ echo $class->getLogs(); } } $credit = $class->getBalance(); if ($credit){ echo ' <div style="text-align: left;background-color: whiteSmoke;margin: 0px;padding: 10px;border: 1px solid #ddd;"> <b>' .$LANG[ 'credit' ]. ':</b> ' .$credit. ' </div>' ; } } |
经过上面的替换,短信宝的短信平台已经替换成功了,可以正常使用了。进行测试发送:
报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。
另外:完整的whmcsv7.60系统短信宝插件,点击此链接 下载及查看安装流程。
最新更新
电商类
CMS类
微信类