-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.php
71 lines (59 loc) · 2.08 KB
/
controller.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
<?php
/**
* Advanced Contact Form package for Concrete5
* Copyright Copyright 2017-2020, Alex Borisov
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Alex Borisov <[email protected]>
* @package Concrete\Package\ab_contact_form
*/
namespace Concrete\Package\AbContactForm;
use Concrete\Core\Package\Package;
use Concrete\Core\Block\BlockType\BlockType;
use Concrete\Core\Captcha\Library;
class Controller extends Package {
protected $pkgHandle = 'ab_contact_form';
protected $appVersionRequired = '8.3.0';
protected $pkgVersion = '2.1.1';
protected $pkgAutoloaderMapCoreExtensions = true;
public function getPackageDescription()
{
return t('Add contact form with advanced security features');
}
public function getPackageName()
{
return t("Advanced Contact Form");
}
public function install()
{
$pkg = parent::install();
BlockType::installBlockType('ab_contact_form', $pkg);
if (is_null(Library::getByHandle('ab_captcha'))) {
Library::add('ab_captcha', t('Customized Securimage Captcha'), $pkg);
Library::getByHandle('ab_captcha')->activate();
}
}
public function uninstall()
{
$pkg = parent::uninstall();
$db = $this->app->make('database')->connection();
$q = 'DROP TABLE IF EXISTS btAbContactFormSpam';
$v = [''];
$db->executeQuery($q, $v);
if (!is_null(Library::getByHandle('ab_captcha'))) {
Library::getByHandle('ab_captcha')->delete();
}
}
}