Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix #827

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions www/app/pages/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ public function __construct() {
\App\Application::RedirectError();
return false;
}
$sms = System::getOptions("sms");
$this->_tvars['issms'] = $sms['smstype']>0;
$options = System::getOptions("common");

$this->_tvars['issms'] = $options['smstype']>0;
$this->_tvars['isbot'] = strlen($options['tbtoken'])>0;

$form = $this->add(new Form('sendform'));
$form->add(new TextInput('email')) ;
$form->add(new SubmitButton('sendemail'))->onClick($this, 'sendEmail');
$form->add(new TextInput('phone')) ;
$form->add(new SubmitButton('sendphone'))->onClick($this, 'sendSms');
$form->add(new TextInput('chat_id')) ;
$form->add(new SubmitButton('sendbot'))->onClick($this, 'sendBot');

}

Expand All @@ -53,10 +57,22 @@ public function sendEmail($sender) {
}

}

public function sendSms($sender) {
$phone = trim( $this->sendform->phone->getText() );
try{
\App\Entity\sendSMS::sendSMS($phone,"test sms");
\App\Entity\Subscribe::sendSMS($phone,"test sms");
} catch(\Exception $e) {

$this->setError($e->getMessage()) ;
}

}

public function sendBot($sender) {
$chat_id = trim( $this->sendform->chat_id->getText() );
try{
\App\Entity\Subscribe::sendBot($chat_id,"test bot");
} catch(\Exception $e) {

$this->setError($e->getMessage()) ;
Expand Down
21 changes: 18 additions & 3 deletions www/templates/pages/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

</head>
<body>
<h2>Адміністрування</h2>

<div class="row">

<div class="col-12 col-lg-5 col-xl-3 " >
<h2>Адміністрування</h2>
<div class="col-12 col-lg-4 col-xl-3 " >

<form zippy="sendform" >
<div class="form-group">
Expand All @@ -34,9 +35,23 @@ <h5>Перевірка відправки SMS</h5>

</div>
{{/issms}}
{{#isbot}}
<div class="form-group">
<h5>Перевірка відправки в телеграм</h5>
</div>
<div class="form-group">
<label for="chat_id">Chat ID</label>
<input class="form-control" type="text" zippy="chat_id">
</div>
<div class="form-group">
<input zippy="sendbot" type="submit" value="Відправити" class="btn btn-primary ">

</div>
{{/isbot}}
</form>

</div>
</div>

</div>
<script>
function check_sendemail(ele){
Expand Down