Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* WHMCS V7.7.x SMS Addons/Modules * * Developer : M.A.S.K ([email protected]..
Decoded Output download
<?php
/* WHMCS V7.7.x SMS Addons/Modules
*
* Developer : M.A.S.K ([email protected])
*
* MASK-ONLINE.ir - https://www.MASK-ONLINE.ir/
*
* Version : 7.7.x
*
* WHMCS (http://sms.MASK-ONLINE.ir/)
* */
if(!defined("WHMCS"))
die("This file cannot be accessed directly");
function whmcssms_config(){
$configarray=array(
"name"=>" WHMCS",
"description"=>" - <li><b> : <a href='https://www.mask-online.ir/' target='_blank'> </a></b></li>",
"version"=>"7.7.x",
"author"=>"<a href='http://sms.mask-online.ir/' target='_blank'><strong> </strong></a><br><a href='https://www.mask-online.ir/' target='_blank'><strong> </strong></a>",
"fields"=>array(
"license"=>array("FriendlyName"=>" :","Type"=>"text","Size"=>"50","Description"=>" .","Default"=>"1-20190318-77-1")),
"language"=>"persian",);
return $configarray;}
function whmcssms_activate(){
$query="CREATE TABLE IF NOT EXISTS `whmcssms_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;";
full_query($query);
$query="CREATE TABLE IF NOT EXISTS `whmcssms_settings` (`id` int(11) NOT NULL AUTO_INCREMENT,`api` varchar(40) CHARACTER SET utf8 NOT NULL,`apiparams` varchar(500) CHARACTER SET utf8 NOT NULL,`wantsmsfield` int(11) DEFAULT NULL,`gsmnumberfield` int(11) DEFAULT 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;";
full_query($query);
$query="INSERT INTO `whmcssms_settings` (`api`, `apiparams`, `wantsmsfield`, `gsmnumberfield`,`dateformat`, `version`) VALUES ('', '', 0, 0,'%y.%m.%d','7.7.x');";
full_query($query);
$query="CREATE TABLE IF NOT EXISTS `whmcssms_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(0) 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;";
full_query($query);
require_once("smsclass.php");
$class=new WHMCSSMS();
$class->checkHooks();
return array('status'=>'success','description'=>' ;)');}
use WHMCS\Database\Capsule;
function whmcssms_deactivate(){
$query="DROP TABLE `whmcssms_templates`";
full_query($query);
$query="DROP TABLE `whmcssms_settings`";
full_query($query);
$query="DROP TABLE `whmcssms_messages`";
full_query($query);
return array('status'=>'success','description'=>' :(');}
function whmcssms_output($vars){
$modulelink=$vars['modulelink'];
$version=$vars['version'];
$LANG=$vars['_lang'];
putenv("TZ=Asia/Tehran");
$class=new WHMCSSMS();
$tab=$_GET['tab'];
$tabItems=[];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=settings',
'name'=>'',
'class'=>($tab=="settings"||empty($tab))?"active":null];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=templates&type=client',
'name'=>' ',
'class'=>((@$_GET['type']=="client")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=templates&type=admin',
'name'=>' ',
'class'=>((@$_GET['type']=="admin")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=sendbulk',
'name'=>' ',
'class'=>(($tab=="sendbulk")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=messages',
'name'=>' ',
'class'=>(($tab=="messages")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=update',
'name'=>'',
'class'=>(($tab=="update")?"active":null)];
echo '
<a href="#"><img src="../modules/addons/whmcssms/whmcssms.jpg" width=100% height="300"></a>
<p></p>
<div id="tabs">
<ul class="nav nav-tabs">';
echo '
<li class="'.(($tab=="settings")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=settings"><i class="fa fa-cog"></i> </a></li>
<li class="'.((@$_GET['type']=="client")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=templates&type=client"><i class="fa fa-users"></i> </a></li>
<li class="'.((@$_GET['type']=="admin")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=templates&type=admin"><i class="fa fa-user"></i> </a></li>
<li class="'.(($tab=="sendbulk")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=sendbulk"><i class="fa fa-envelope"></i> </a></li>
<li class="'.(($tab=="messages")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=messages"><i class="fa fa-comment"></i> </a></li>
<li id="newupdate" class="'.(($tab=="update")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=update"><i class="fa fa-wrench"></i> </a></li>
</ul></div>';
if(!isset($tab)||$tab=="settings"){
if($_POST['params']){
$update=array(
"api"=>$_POST['api'],
"apiparams"=>json_encode($_POST['params']),
'wantsmsfield'=>$_POST['wantsmsfield'],
'gsmnumberfield'=>$_POST['gsmnumberfield'],
'dateformat'=>$_POST['dateformat']);
Capsule::table('whmcssms_settings')->update($update);}
$settings=$class->getSettings();
$apiparams=json_decode($settings['apiparams']);
$result=Capsule::table('tblcustomfields')
->select('id','fieldname')
->where("fieldtype",'like',"tickbox")
->where("showorder",'like',"on")
->get();
$wantsms='';
foreach($result AS $data){
$selected=($data->id==$settings['wantsmsfield'])?'selected="selected"':'';
$wantsms.='<option value="'.$data->id.'"'.$selected.'>'.$data->fieldname.'</option>';}
$result=Capsule::table('tblcustomfields')
->select('id','fieldname')
->where("fieldtype",'like',"text")
->where("showorder",'like',"on")
->get();
$gsmnumber='';
foreach($result AS $key=>$data){
$selected=($data->id==$settings['gsmnumberfield'])?'selected="selected"':'';
$gsmnumber.='<option value="'.$data->id.'"'.$selected.'>'.$data->fieldname.'</option>';}
$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){
$formType='text';
if($field=="pass"){
$formType='password';}
$classersfields.=
'<tr>
<td class="fieldlabel" style="min-width:200px;"><b>'.$LANG[$field].' :</b></td>
<td class="fieldarea"><input type="'.$formType.'" name="params['.$field.']"class="form-control input-inline input-300" size="40" value="'.$apiparams->$field.'" placeholder=" "> .</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:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="api" id="api" class="form-control select-inline">
'.$classersoption.'
</select> .
</td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea"><input type="text" name="params[senderid]" class="form-control input-inline input-300" size="40" value="'.$apiparams->senderid.'" placeholder=" "> : <strong>5000141062</strong></td>
</tr>
'.$classersfields.'
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<textarea type="text" name="params[signature]" class="form-control input-inline input-300" size="40" rows="2" placeholder=" ">'.$apiparams->signature.'</textarea> : <strong> </strong></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="wantsmsfield" class="form-control select-inline">
'.$wantsms.'
</select> . <a href="configcustomfields.php" title=" "><i class="fa fa-question-circle"></i>
</a></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="gsmnumberfield" class="form-control select-inline">
'.$gsmnumber.'
</select> . <a href="configcustomfields.php" title=" "><i class="fa fa-question-circle"></i>
</a></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea"><input type="text" name="dateformat" class="form-control input-inline input-300" size="40" value="'.$settings['dateformat'].'"> : <strong>('.date("Y.m.d").')</strong></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p align="center"><input type="submit" class="btn" value=" " class="button"/></p>
</form>';}
elseif($tab=="templates"){
if(isset($_POST['submit'])){
$result=Capsule::table('whmcssms_templates')
->where("type","like",$_GET['type'])
->get();
foreach($result AS $data){
$id=$data->id;
if($_POST[$id.'_active']=="on"){
$tmp_active=1;
}else{
$tmp_active=0;}
$update=array(
"template"=>$_POST[$id.'_template'],
"active"=>$tmp_active);
if(isset($_POST[$id.'_extra'])){
$update['extra']=trim($_POST[$id.'_extra']);}
if(isset($_POST[$id.'_admingsm'])){
$update['admingsm']=$_POST[$id.'_admingsm'];
$update['admingsm']=str_replace(" ","",$update['admingsm']);}
Capsule::table('whmcssms_templates')
->where('id',$id)
->update($update);}}
echo'<form action="" method="post">
<input type="hidden" name="action" value="save"/>
<div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>';
$result=Capsule::table('whmcssms_templates')
->where("type","like",$_GET['type'])
->get();
foreach($result AS $data){
if($data->active==1){
$active='checked="checked"';
}else{
$active='';}
$desc=($data->description);
if(isset($desc->$LANG['lang'])){
$name=$desc->$LANG['lang'];
}else{
$name=$data->name;}
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"><b>'.$desc.' :</b></td>
<td class="fieldarea">
<textarea class="form-control" cols="50" name="'.$data->id.'_template">'.$data->template.'</textarea>
</td>
</tr>';
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"style="float:right;"> :</td>
<td class="fieldarea"><input type="checkbox" value="on" name="'.$data->id.'_active"'.$active.'> /</td>
</tr>';
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;" style="float:right;"> :</td>
<td class="fieldarea">'.$data->variables.'</td>
</tr>';
if(!empty($data->extra)){
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"> {x} :</td>
<td class="fieldarea">
<input type="text" class="form-control" name="'.$data->id.'_extra" value="'.$data->extra.'">
</td>
</tr>';}
if($_GET['type']=="admin"){
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"> :</td>
<td class="fieldarea">
<input type="text" class="form-control" name="'.$data->id.'_admingsm" value="'.$data->admingsm.'"> { , } . : 09120000000,09350000000</td>
</tr>';}
echo'<tr>
<td colspan="2"><hr></td>
</tr>';}
echo'
</tbody>
</table>
</div>
<p></p>
<p align="center"><button type="submit" name="submit" class="btn btn-primary"> </button></p>
</form>';}
elseif($tab=="sendbulk"){
$settings=$class->getSettings();
if(!empty($_POST['client'])){
$client=$_POST['client'];
foreach($client AS $cl){
$userinf=explode("_",$cl);
$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 '<br><p> : '.$gsmnumber.'</p>';}
if($_POST["debug"]=="ON"){
$debug=1;}}}
$result=Capsule::select("SELECT `a`.`id`,`a`.`firstname`, `a`.`lastname`, `b`.`value` as `gsmnumber`
FROM `tblclients` as `a`
JOIN `tblcustomfieldsvalues` as `b` ON `b`.`relid` = `a`.`id`
JOIN `tblcustomfieldsvalues` as `c` ON `c`.`relid` = `a`.`id`
WHERE `b`.`fieldid` = '".$settings['gsmnumberfield']."'
AND `c`.`fieldid` = '".$settings['wantsmsfield']."'
AND `c`.`value` = 'on' order by `a`.`firstname`");
$clients='';
foreach($result AS $data){
$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" enctype="multipart/form-data">
<input type="hidden" name="action" value="save"/>
<div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea">
<input class="form-control" id="textbox" type="text" placeholder=" ."><br>
<select class="form-control" name="client[]" multiple id="clientdrop" required>
<option value="" disabled> </option>
'.$clients.'
</select>
</td>
</tr>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea">
<textarea class="form-control" cols="70" rows="20" name="message" style="padding:5px" placeholder=" ." required></textarea>
</td>
</tr>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea"><label for="debug"><input type="checkbox" id="debug" name="debug" value="ON"/> .</label></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p align="center"><input type="submit" value=" " class="button"/></p>
</form>';
if(isset($debug)){
echo $class->getLogs();}}
elseif($tab=="messages"){
if(!empty($_GET['deletesms'])){
$smsid=(int)$_GET['deletesms'];
Capsule::table('whmcssms_messages')->where('id',$smsid)->delete();}
echo'
<!--<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.jqueryui.min.css" type="text/css">
<script type="text/javascript">
$(document).ready(function(){
$(".datatable").dataTable();});</script>-->
<div style="text-align:center;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="datatable" border="0" cellspacing="1" cellpadding="3">
<thead>
<tr>
<th><input type="text" name="id" class="form-control input-inline input-100"/></th>
<th><input type="text" name="client" class="form-control input-inline input-300"/></th>
<th><input type="text" name="gsmnumber" class="form-control input-inline input-300"/></th>
<th><input type="text" name="message" class="form-control input-inline input-300"/></th>
<th><input type="date" name="datetime" class="form-control input-inline input-300"/></th>
<th><select class="form-control" name="status"><option></option><option> </option><option> </option></select></th>
<th></th>
</tr>
<tr>
<th>#</th>
<th></th>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th width="20"></th>
</tr>
</thead>
<tbody>';
if($_GET['page']==""){
$page=1;
}elseif(intval($_GET['page'])==0){
$page=1;
}elseif($page<0){
$page=1;
}else{
$page=intval($_GET['page']);}
$nowPage=$page;
$kacar=50;
$start=($page-1)*$kacar;
$sayfaQuery=Capsule::table('whmcssms_messages AS m')
->select('m.*', 'user.firstname', 'user.lastname')
->join('tblclients AS user', 'm.user', '=', 'user.id')
->orderBy('m.datetime', 'desc');
$kayitsayisi=$sayfaQuery->count();
$sql=$sayfaQuery->skip($start)->take($kacar);
$result=$sql->get();
$sayfasayisi=ceil($kayitsayisi/$kacar);
if($page>$sayfasayisi){
$page=$sayfasayisi;}
foreach($result AS $data){
if($data->msgid && $data->status==""){
$status=$class->getReport($data->msgid);
full_query("UPDATE whmcssms_messages SET status = '$status' WHERE id = ".$data->id."");
}else{
$status=$data->status;}
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>'.$LANG[$status].'</td>
<td><a href="addonmodules.php?module=whmcssms&tab=messages&deletesms='.$data->id.'" title=" "><i class="fa fa-minus-circle"></i></a></td></tr>';}
echo'
</tbody>
</table>';
if($sayfasayisi>0){
$pageUrl='addonmodules.php?module=whmcssms&tab=messages&page=';
echo'<ul class="pagination pagination-search pull-right">';
$undoUrl='#';
$undoClass='disabled';
if($nowPage>1){
$undoUrl=$pageUrl.($nowPage-1);
$undoClass='';}
echo'<li class="'.$undoClass.'"><a href="'.$undoUrl.'"><i class="fa fa-angle-left"></i></a></li>';
for($j=1;$j<=$sayfasayisi;$j++){
$active=($nowPage==$j)?' class="active"' : '';
echo'<li'.$active.'><a href="'.$pageUrl.$j.'">'.$j.'</a></li>';}
echo'
<li><a href="#"><i class="fa fa-angle-right"></i></a></li>
</ul>';}
echo'</div><br>';}
elseif($tab=="update"){
$currentversion=file_get_contents("https://www.mask-online.ir/whmcssms/version.txt");
echo'<div style="text-align:center;background-color:whiteSmoke;margin:0px;padding:10px;"><b> WHMCS</b><br> : '.$version.'<br><br><br>';
if($version!=$currentversion){
echo ' . .<br><br> <b></b> .<p></p>';
}else{
echo ' <b></b> .<br><br> .<p></p>';}
echo'</div>';}
$credit=$class->getBalance();
if($credit){
echo'
<p></p><div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<b> : </b>'.$credit.'
</div>';}
echo'
<p></p><div style="text-align:left;">
WHMCS V'.$version.' SMS Addons/Modules <a href="#">'.$settings['api'].'</a><br>';
echo
base64_decode("RGV2ZWxvcGVyIDxhIGhyZWY9Imh0dHA6Ly9zbXMubWFzay1vbmxpbmUuaXIvIiB0YXJnZXQ9Il9ibGFuayI+TUFTSy1PTkxJTkUuaXI8L2E+IDxpIGNsYXNzPSJmYSBmYS1oZWFydCIgc3R5bGU9ImNvbG9yOnJlZDsiPjwvaT4gU3BlY2lhbCBUaGFua3MgPGEgaHJlZj0iaHR0cHM6Ly93aG1jc2NvLmNvbS8iIHRhcmdldD0iX2JsYW5rIj5XSE1DU0NPLmNvbTwvYT4K");
echo'</div>';}
/* WHMCS V7.7.x SMS Addons/Modules - Developer MASK-ONLINE.ir */ ?>
Did this file decode correctly?
Original Code
<?php
/* WHMCS V7.7.x SMS Addons/Modules
*
* Developer : M.A.S.K ([email protected])
*
* MASK-ONLINE.ir - https://www.MASK-ONLINE.ir/
*
* Version : 7.7.x
*
* WHMCS (http://sms.MASK-ONLINE.ir/)
* */
if(!defined("WHMCS"))
die("This file cannot be accessed directly");
function whmcssms_config(){
$configarray=array(
"name"=>" WHMCS",
"description"=>" - <li><b> : <a href='https://www.mask-online.ir/' target='_blank'> </a></b></li>",
"version"=>"7.7.x",
"author"=>"<a href='http://sms.mask-online.ir/' target='_blank'><strong> </strong></a><br><a href='https://www.mask-online.ir/' target='_blank'><strong> </strong></a>",
"fields"=>array(
"license"=>array("FriendlyName"=>" :","Type"=>"text","Size"=>"50","Description"=>" .","Default"=>"1-20190318-77-1")),
"language"=>"persian",);
return $configarray;}
function whmcssms_activate(){
$query="CREATE TABLE IF NOT EXISTS `whmcssms_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;";
full_query($query);
$query="CREATE TABLE IF NOT EXISTS `whmcssms_settings` (`id` int(11) NOT NULL AUTO_INCREMENT,`api` varchar(40) CHARACTER SET utf8 NOT NULL,`apiparams` varchar(500) CHARACTER SET utf8 NOT NULL,`wantsmsfield` int(11) DEFAULT NULL,`gsmnumberfield` int(11) DEFAULT 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;";
full_query($query);
$query="INSERT INTO `whmcssms_settings` (`api`, `apiparams`, `wantsmsfield`, `gsmnumberfield`,`dateformat`, `version`) VALUES ('', '', 0, 0,'%y.%m.%d','7.7.x');";
full_query($query);
$query="CREATE TABLE IF NOT EXISTS `whmcssms_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(0) 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;";
full_query($query);
require_once("smsclass.php");
$class=new WHMCSSMS();
$class->checkHooks();
return array('status'=>'success','description'=>' ;)');}
use WHMCS\Database\Capsule;
function whmcssms_deactivate(){
$query="DROP TABLE `whmcssms_templates`";
full_query($query);
$query="DROP TABLE `whmcssms_settings`";
full_query($query);
$query="DROP TABLE `whmcssms_messages`";
full_query($query);
return array('status'=>'success','description'=>' :(');}
function whmcssms_output($vars){
$modulelink=$vars['modulelink'];
$version=$vars['version'];
$LANG=$vars['_lang'];
putenv("TZ=Asia/Tehran");
$class=new WHMCSSMS();
$tab=$_GET['tab'];
$tabItems=[];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=settings',
'name'=>'',
'class'=>($tab=="settings"||empty($tab))?"active":null];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=templates&type=client',
'name'=>' ',
'class'=>((@$_GET['type']=="client")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=templates&type=admin',
'name'=>' ',
'class'=>((@$_GET['type']=="admin")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=sendbulk',
'name'=>' ',
'class'=>(($tab=="sendbulk")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=messages',
'name'=>' ',
'class'=>(($tab=="messages")?"active":null)];
$tabItems[]=[
'link'=>'addonmodules.php?module=whmcssms&tab=update',
'name'=>'',
'class'=>(($tab=="update")?"active":null)];
echo '
<a href="#"><img src="../modules/addons/whmcssms/whmcssms.jpg" width=100% height="300"></a>
<p></p>
<div id="tabs">
<ul class="nav nav-tabs">';
echo '
<li class="'.(($tab=="settings")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=settings"><i class="fa fa-cog"></i> </a></li>
<li class="'.((@$_GET['type']=="client")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=templates&type=client"><i class="fa fa-users"></i> </a></li>
<li class="'.((@$_GET['type']=="admin")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=templates&type=admin"><i class="fa fa-user"></i> </a></li>
<li class="'.(($tab=="sendbulk")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=sendbulk"><i class="fa fa-envelope"></i> </a></li>
<li class="'.(($tab=="messages")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=messages"><i class="fa fa-comment"></i> </a></li>
<li id="newupdate" class="'.(($tab=="update")?"tabselected":"tab").'"><a href="addonmodules.php?module=whmcssms&tab=update"><i class="fa fa-wrench"></i> </a></li>
</ul></div>';
if(!isset($tab)||$tab=="settings"){
if($_POST['params']){
$update=array(
"api"=>$_POST['api'],
"apiparams"=>json_encode($_POST['params']),
'wantsmsfield'=>$_POST['wantsmsfield'],
'gsmnumberfield'=>$_POST['gsmnumberfield'],
'dateformat'=>$_POST['dateformat']);
Capsule::table('whmcssms_settings')->update($update);}
$settings=$class->getSettings();
$apiparams=json_decode($settings['apiparams']);
$result=Capsule::table('tblcustomfields')
->select('id','fieldname')
->where("fieldtype",'like',"tickbox")
->where("showorder",'like',"on")
->get();
$wantsms='';
foreach($result AS $data){
$selected=($data->id==$settings['wantsmsfield'])?'selected="selected"':'';
$wantsms.='<option value="'.$data->id.'"'.$selected.'>'.$data->fieldname.'</option>';}
$result=Capsule::table('tblcustomfields')
->select('id','fieldname')
->where("fieldtype",'like',"text")
->where("showorder",'like',"on")
->get();
$gsmnumber='';
foreach($result AS $key=>$data){
$selected=($data->id==$settings['gsmnumberfield'])?'selected="selected"':'';
$gsmnumber.='<option value="'.$data->id.'"'.$selected.'>'.$data->fieldname.'</option>';}
$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){
$formType='text';
if($field=="pass"){
$formType='password';}
$classersfields.=
'<tr>
<td class="fieldlabel" style="min-width:200px;"><b>'.$LANG[$field].' :</b></td>
<td class="fieldarea"><input type="'.$formType.'" name="params['.$field.']"class="form-control input-inline input-300" size="40" value="'.$apiparams->$field.'" placeholder=" "> .</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:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="api" id="api" class="form-control select-inline">
'.$classersoption.'
</select> .
</td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea"><input type="text" name="params[senderid]" class="form-control input-inline input-300" size="40" value="'.$apiparams->senderid.'" placeholder=" "> : <strong>5000141062</strong></td>
</tr>
'.$classersfields.'
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<textarea type="text" name="params[signature]" class="form-control input-inline input-300" size="40" rows="2" placeholder=" ">'.$apiparams->signature.'</textarea> : <strong> </strong></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="wantsmsfield" class="form-control select-inline">
'.$wantsms.'
</select> . <a href="configcustomfields.php" title=" "><i class="fa fa-question-circle"></i>
</a></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea">
<select name="gsmnumberfield" class="form-control select-inline">
'.$gsmnumber.'
</select> . <a href="configcustomfields.php" title=" "><i class="fa fa-question-circle"></i>
</a></td>
</tr>
<tr>
<td class="fieldlabel" style="min-width:200px;"><b> :</b></td>
<td class="fieldarea"><input type="text" name="dateformat" class="form-control input-inline input-300" size="40" value="'.$settings['dateformat'].'"> : <strong>('.date("Y.m.d").')</strong></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p align="center"><input type="submit" class="btn" value=" " class="button"/></p>
</form>';}
elseif($tab=="templates"){
if(isset($_POST['submit'])){
$result=Capsule::table('whmcssms_templates')
->where("type","like",$_GET['type'])
->get();
foreach($result AS $data){
$id=$data->id;
if($_POST[$id.'_active']=="on"){
$tmp_active=1;
}else{
$tmp_active=0;}
$update=array(
"template"=>$_POST[$id.'_template'],
"active"=>$tmp_active);
if(isset($_POST[$id.'_extra'])){
$update['extra']=trim($_POST[$id.'_extra']);}
if(isset($_POST[$id.'_admingsm'])){
$update['admingsm']=$_POST[$id.'_admingsm'];
$update['admingsm']=str_replace(" ","",$update['admingsm']);}
Capsule::table('whmcssms_templates')
->where('id',$id)
->update($update);}}
echo'<form action="" method="post">
<input type="hidden" name="action" value="save"/>
<div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>';
$result=Capsule::table('whmcssms_templates')
->where("type","like",$_GET['type'])
->get();
foreach($result AS $data){
if($data->active==1){
$active='checked="checked"';
}else{
$active='';}
$desc=($data->description);
if(isset($desc->$LANG['lang'])){
$name=$desc->$LANG['lang'];
}else{
$name=$data->name;}
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"><b>'.$desc.' :</b></td>
<td class="fieldarea">
<textarea class="form-control" cols="50" name="'.$data->id.'_template">'.$data->template.'</textarea>
</td>
</tr>';
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"style="float:right;"> :</td>
<td class="fieldarea"><input type="checkbox" value="on" name="'.$data->id.'_active"'.$active.'> /</td>
</tr>';
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;" style="float:right;"> :</td>
<td class="fieldarea">'.$data->variables.'</td>
</tr>';
if(!empty($data->extra)){
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"> {x} :</td>
<td class="fieldarea">
<input type="text" class="form-control" name="'.$data->id.'_extra" value="'.$data->extra.'">
</td>
</tr>';}
if($_GET['type']=="admin"){
echo'
<tr>
<td class="fieldlabel" style="max-width:200px;"> :</td>
<td class="fieldarea">
<input type="text" class="form-control" name="'.$data->id.'_admingsm" value="'.$data->admingsm.'"> { , } . : 09120000000,09350000000</td>
</tr>';}
echo'<tr>
<td colspan="2"><hr></td>
</tr>';}
echo'
</tbody>
</table>
</div>
<p></p>
<p align="center"><button type="submit" name="submit" class="btn btn-primary"> </button></p>
</form>';}
elseif($tab=="sendbulk"){
$settings=$class->getSettings();
if(!empty($_POST['client'])){
$client=$_POST['client'];
foreach($client AS $cl){
$userinf=explode("_",$cl);
$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 '<br><p> : '.$gsmnumber.'</p>';}
if($_POST["debug"]=="ON"){
$debug=1;}}}
$result=Capsule::select("SELECT `a`.`id`,`a`.`firstname`, `a`.`lastname`, `b`.`value` as `gsmnumber`
FROM `tblclients` as `a`
JOIN `tblcustomfieldsvalues` as `b` ON `b`.`relid` = `a`.`id`
JOIN `tblcustomfieldsvalues` as `c` ON `c`.`relid` = `a`.`id`
WHERE `b`.`fieldid` = '".$settings['gsmnumberfield']."'
AND `c`.`fieldid` = '".$settings['wantsmsfield']."'
AND `c`.`value` = 'on' order by `a`.`firstname`");
$clients='';
foreach($result AS $data){
$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" enctype="multipart/form-data">
<input type="hidden" name="action" value="save"/>
<div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tbody>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea">
<input class="form-control" id="textbox" type="text" placeholder=" ."><br>
<select class="form-control" name="client[]" multiple id="clientdrop" required>
<option value="" disabled> </option>
'.$clients.'
</select>
</td>
</tr>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea">
<textarea class="form-control" cols="70" rows="20" name="message" style="padding:5px" placeholder=" ." required></textarea>
</td>
</tr>
<tr>
<td class="fieldlabel"><b> :</b></td>
<td class="fieldarea"><label for="debug"><input type="checkbox" id="debug" name="debug" value="ON"/> .</label></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p align="center"><input type="submit" value=" " class="button"/></p>
</form>';
if(isset($debug)){
echo $class->getLogs();}}
elseif($tab=="messages"){
if(!empty($_GET['deletesms'])){
$smsid=(int)$_GET['deletesms'];
Capsule::table('whmcssms_messages')->where('id',$smsid)->delete();}
echo'
<!--<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.jqueryui.min.css" type="text/css">
<script type="text/javascript">
$(document).ready(function(){
$(".datatable").dataTable();});</script>-->
<div style="text-align:center;background-color:whiteSmoke;margin:0px;padding:10px;">
<table class="datatable" border="0" cellspacing="1" cellpadding="3">
<thead>
<tr>
<th><input type="text" name="id" class="form-control input-inline input-100"/></th>
<th><input type="text" name="client" class="form-control input-inline input-300"/></th>
<th><input type="text" name="gsmnumber" class="form-control input-inline input-300"/></th>
<th><input type="text" name="message" class="form-control input-inline input-300"/></th>
<th><input type="date" name="datetime" class="form-control input-inline input-300"/></th>
<th><select class="form-control" name="status"><option></option><option> </option><option> </option></select></th>
<th></th>
</tr>
<tr>
<th>#</th>
<th></th>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th width="20"></th>
</tr>
</thead>
<tbody>';
if($_GET['page']==""){
$page=1;
}elseif(intval($_GET['page'])==0){
$page=1;
}elseif($page<0){
$page=1;
}else{
$page=intval($_GET['page']);}
$nowPage=$page;
$kacar=50;
$start=($page-1)*$kacar;
$sayfaQuery=Capsule::table('whmcssms_messages AS m')
->select('m.*', 'user.firstname', 'user.lastname')
->join('tblclients AS user', 'm.user', '=', 'user.id')
->orderBy('m.datetime', 'desc');
$kayitsayisi=$sayfaQuery->count();
$sql=$sayfaQuery->skip($start)->take($kacar);
$result=$sql->get();
$sayfasayisi=ceil($kayitsayisi/$kacar);
if($page>$sayfasayisi){
$page=$sayfasayisi;}
foreach($result AS $data){
if($data->msgid && $data->status==""){
$status=$class->getReport($data->msgid);
full_query("UPDATE whmcssms_messages SET status = '$status' WHERE id = ".$data->id."");
}else{
$status=$data->status;}
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>'.$LANG[$status].'</td>
<td><a href="addonmodules.php?module=whmcssms&tab=messages&deletesms='.$data->id.'" title=" "><i class="fa fa-minus-circle"></i></a></td></tr>';}
echo'
</tbody>
</table>';
if($sayfasayisi>0){
$pageUrl='addonmodules.php?module=whmcssms&tab=messages&page=';
echo'<ul class="pagination pagination-search pull-right">';
$undoUrl='#';
$undoClass='disabled';
if($nowPage>1){
$undoUrl=$pageUrl.($nowPage-1);
$undoClass='';}
echo'<li class="'.$undoClass.'"><a href="'.$undoUrl.'"><i class="fa fa-angle-left"></i></a></li>';
for($j=1;$j<=$sayfasayisi;$j++){
$active=($nowPage==$j)?' class="active"' : '';
echo'<li'.$active.'><a href="'.$pageUrl.$j.'">'.$j.'</a></li>';}
echo'
<li><a href="#"><i class="fa fa-angle-right"></i></a></li>
</ul>';}
echo'</div><br>';}
elseif($tab=="update"){
$currentversion=file_get_contents("https://www.mask-online.ir/whmcssms/version.txt");
echo'<div style="text-align:center;background-color:whiteSmoke;margin:0px;padding:10px;"><b> WHMCS</b><br> : '.$version.'<br><br><br>';
if($version!=$currentversion){
echo ' . .<br><br> <b></b> .<p></p>';
}else{
echo ' <b></b> .<br><br> .<p></p>';}
echo'</div>';}
$credit=$class->getBalance();
if($credit){
echo'
<p></p><div style="text-align:right;background-color:whiteSmoke;margin:0px;padding:10px;">
<b> : </b>'.$credit.'
</div>';}
echo'
<p></p><div style="text-align:left;">
WHMCS V'.$version.' SMS Addons/Modules <a href="#">'.$settings['api'].'</a><br>';
echo
base64_decode("RGV2ZWxvcGVyIDxhIGhyZWY9Imh0dHA6Ly9zbXMubWFzay1vbmxpbmUuaXIvIiB0YXJnZXQ9Il9ibGFuayI+TUFTSy1PTkxJTkUuaXI8L2E+IDxpIGNsYXNzPSJmYSBmYS1oZWFydCIgc3R5bGU9ImNvbG9yOnJlZDsiPjwvaT4gU3BlY2lhbCBUaGFua3MgPGEgaHJlZj0iaHR0cHM6Ly93aG1jc2NvLmNvbS8iIHRhcmdldD0iX2JsYW5rIj5XSE1DU0NPLmNvbTwvYT4K");
echo'</div>';}
/* WHMCS V7.7.x SMS Addons/Modules - Developer MASK-ONLINE.ir */
Function Calls
None |
Stats
MD5 | b9a07932d65c3254a596f9746101ccfe |
Eval Count | 0 |
Decode Time | 190 ms |