es_sms.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class sms_sender
  10. {
  11. var $sms;
  12. public function __construct()
  13. {
  14. $sms_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."sms where is_effect = 1");
  15. if($sms_info)
  16. {
  17. $sms_info['config'] = unserialize($sms_info['config']);
  18. require_once APP_ROOT_PATH."system/sms/".$sms_info['class_name']."_sms.php";
  19. $sms_class = $sms_info['class_name']."_sms";
  20. $this->sms = new $sms_class($sms_info);
  21. }
  22. }
  23. public function sendSms($mobiles,$content,$sendTime='',$is_adv=0)
  24. {
  25. if(app_conf("SMS_ON")==0)
  26. {
  27. return array(
  28. "status" => 0,
  29. "msg" => '网站未开启短信功能',
  30. );
  31. }
  32. if(!is_array($mobiles))
  33. $mobiles = preg_split("/[ ,]/i",$mobiles);
  34. if(count($mobiles) > 0 )
  35. {
  36. if(!$this->sms)
  37. {
  38. $result['status'] = 0;
  39. }
  40. else
  41. {
  42. $result = $this->sms->sendSms($mobiles,$content,$sendTime,$is_adv);
  43. }
  44. }
  45. else
  46. {
  47. $result['status'] = 0;
  48. $result['msg'] = "没有发送的手机号";
  49. }
  50. return $result;
  51. }
  52. }
  53. ?>