|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
XOOPS - PHP Content Management System |
|
4
|
|
|
Copyright (c) 2012 XOOPS.org |
|
5
|
|
|
<https://xoops.org> |
|
6
|
|
|
This program is free software; you can redistribute it and/or modify |
|
7
|
|
|
it under the terms of the GNU General Public License as published by |
|
8
|
|
|
the Free Software Foundation; either version 2 of the License, or |
|
9
|
|
|
(at your option) any later version. |
|
10
|
|
|
|
|
11
|
|
|
You may not change or alter any portion of this comment or credits |
|
12
|
|
|
of supporting developers from this source code or any supporting |
|
13
|
|
|
source code which is considered copyrighted (c) material of the |
|
14
|
|
|
original comment or credit authors. |
|
15
|
|
|
|
|
16
|
|
|
This program is distributed in the hope that it will be useful, |
|
17
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
GNU General Public License for more details. |
|
20
|
|
|
|
|
21
|
|
|
You should have received a copy of the GNU General Public License |
|
22
|
|
|
along with this program; if not, write to the Free Software |
|
23
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* XOOPS Poll Module results mailer preload |
|
28
|
|
|
* |
|
29
|
|
|
* @copyright :: {@link https://xoops.org XOOPS Project} |
|
30
|
|
|
* @license :: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
31
|
|
|
* @package :: xoopspoll |
|
32
|
|
|
* @subpackage:: preloads |
|
33
|
|
|
* @since :: 1.4 |
|
34
|
|
|
* @author :: zyspec <[email protected]> |
|
35
|
|
|
**/ |
|
36
|
|
|
|
|
37
|
|
|
use XoopsModules\Xoopspoll; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Class XoopspollCorePreload |
|
41
|
|
|
*/ |
|
42
|
|
|
class XoopspollCorePreload extends \XoopsPreloadItem |
|
43
|
|
|
{ |
|
44
|
|
|
// to add PSR-4 autoloader |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param $args |
|
48
|
|
|
*/ |
|
49
|
|
|
public static function eventCoreIncludeCommonEnd($args) |
|
50
|
|
|
{ |
|
51
|
|
|
require __DIR__ . '/autoloader.php'; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* plugin class for Xoops preload for index page start |
|
56
|
|
|
* @param $args |
|
57
|
|
|
*/ |
|
58
|
|
|
public static function eventCoreIndexStart($args) |
|
|
|
|
|
|
59
|
|
|
{ |
|
60
|
|
|
// check once per user session if expired poll email has been sent |
|
61
|
|
|
if (empty($_SESSION['pollChecked'])) { |
|
62
|
|
|
$pollHandler = \XoopsModules\Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
63
|
|
|
$pollHandler->mailResults(); //send the results of any polls that have ended |
|
64
|
|
|
unset($pollHandler); |
|
65
|
|
|
$_SESSION['pollChecked'] = 1; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.