1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
require_once __DIR__ . '/../../../include/cp_header.php'; |
4
|
|
|
include __DIR__ . '/../../../class/xoopsformloader.php'; |
5
|
|
|
require_once __DIR__ . '/admin_header.php'; |
6
|
|
|
|
7
|
|
|
function extgalleryLastVersion() |
8
|
|
|
{ |
9
|
|
|
//return @file_get_contents("http://www.zoullou.net/extcal.version"); //the Website is not longer working |
|
|
|
|
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @return bool |
14
|
|
|
*/ |
15
|
|
|
function isUpToDate() |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
$version = extgalleryLastVersion(); |
|
|
|
|
18
|
|
|
|
19
|
|
|
return $GLOBALS['xoopsModule']->getVar('version') >= $version; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
if (isset($_GET['op'])) { |
23
|
|
|
$op = $_GET['op']; |
24
|
|
|
} else { |
25
|
|
|
$op = 'default'; |
26
|
|
|
if (isset($_POST['op'])) { |
27
|
|
|
$op = $_POST['op']; |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
$fct = 'default'; |
31
|
|
|
if (isset($_GET['fct'])) { |
32
|
|
|
$fct = $_GET['fct']; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
switch ($op) { |
36
|
|
|
case 'notification': |
37
|
|
|
switch ($fct) { |
38
|
|
|
case 'send': |
39
|
|
View Code Duplication |
if (!$GLOBALS['xoopsSecurity']->check()) { |
|
|
|
|
40
|
|
|
redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
41
|
|
|
} |
42
|
|
|
xoops_cp_header(); |
43
|
|
|
adminMenu(1); |
44
|
|
|
|
45
|
|
|
$myts = MyTextSanitizer::getInstance(); |
46
|
|
|
$xoopsMailer = xoops_getMailer(); |
47
|
|
|
// $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
|
|
|
|
48
|
|
|
// $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE); |
|
|
|
|
49
|
|
|
// $eventMemberHandler = xoops_getModuleHandler(_EXTCAL_CLS_MEMBER, _EXTCAL_MODULE); |
|
|
|
|
50
|
|
|
$extcalTime = ExtcalTime::getHandler(); |
51
|
|
|
$extcalConfig = ExtcalConfig::getHandler(); |
52
|
|
|
$xoopsModuleConfig = $extcalConfig->getModuleConfig(); |
53
|
|
|
|
54
|
|
|
$event = $eventHandler->getEvent($_POST['event_id'], $xoopsUser, true); |
55
|
|
|
$cat = $catHandler->getCat($event->getVar('cat_id'), $xoopsUser, 'all'); |
56
|
|
|
|
57
|
|
|
$xoopsMailer->setToUsers($eventMemberHandler->getMembers($_POST['event_id'])); |
58
|
|
|
$xoopsMailer->setFromName($myts->oopsStripSlashesGPC($_POST['mail_fromname'])); |
59
|
|
|
$xoopsMailer->setFromEmail($myts->oopsStripSlashesGPC($_POST['mail_fromemail'])); |
60
|
|
|
$xoopsMailer->setSubject($myts->oopsStripSlashesGPC($_POST['mail_subject'])); |
61
|
|
|
$xoopsMailer->setBody($myts->oopsStripSlashesGPC($_POST['mail_body'])); |
62
|
|
|
if (in_array('mail', $_POST['mail_send_to'])) { |
63
|
|
|
$xoopsMailer->useMail(); |
64
|
|
|
} |
65
|
|
|
if (empty($_POST['mail_inactive']) && in_array('pm', $_POST['mail_send_to'])) { |
66
|
|
|
$xoopsMailer->usePM(); |
67
|
|
|
} |
68
|
|
|
$tag = array( |
69
|
|
|
'EV_CAT' => $cat->getVar('cat_name'), |
70
|
|
|
'EV_TITLE' => $event->getVar('event_title'), |
71
|
|
|
'EV_START' => $extcalTime->getFormatedDate($xoopsModuleConfig['date_long'], $event->getVar('event_start')), |
72
|
|
|
'EV_END' => $extcalTime->getFormatedDate($xoopsModuleConfig['date_long'], $event->getVar('event_end')), |
73
|
|
|
'EV_LINK' => XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'), |
74
|
|
|
); |
75
|
|
|
$xoopsMailer->assign($tag); |
76
|
|
|
$xoopsMailer->send(true); |
77
|
|
|
echo $xoopsMailer->getSuccess(); |
78
|
|
|
echo $xoopsMailer->getErrors(); |
79
|
|
|
|
80
|
|
|
xoops_cp_footer(); |
81
|
|
|
|
82
|
|
|
break; |
83
|
|
|
|
84
|
|
|
case 'default': |
85
|
|
|
default: |
86
|
|
|
xoops_cp_header(); |
87
|
|
|
$fromemail = !empty($xoopsConfig['adminmail']) ? $xoopsConfig['adminmail'] : $xoopsUser->getVar('email', 'E'); |
88
|
|
|
$subjectCaption = _AM_EXTCAL_SUBJECT |
89
|
|
|
. "<br><br><span style='font-size:x-small;font-weight:bold;'>" |
90
|
|
|
. _AM_EXTCAL_USEFUL_TAGS |
91
|
|
|
. "</span><br><span style='font-size:x-small;font-weight:normal;'>" |
92
|
|
|
. _AM_EXTCAL_MAILTAGS6 |
93
|
|
|
. '<br>' |
94
|
|
|
. _AM_EXTCAL_MAILTAGS2 |
95
|
|
|
. '</span> '; |
96
|
|
|
$bodyCaption = _AM_EXTCAL_BODY |
97
|
|
|
. "<br><br><span style='font-size:x-small;font-weight:bold;'>" |
98
|
|
|
. _AM_EXTCAL_USEFUL_TAGS |
99
|
|
|
. "</span><br><span style='font-size:x-small;font-weight:normal;'>" |
100
|
|
|
. _AM_EXTCAL_MAILTAGS1 |
101
|
|
|
. '<br>' |
102
|
|
|
. _AM_EXTCAL_MAILTAGS2 |
103
|
|
|
. '<br>' |
104
|
|
|
. _AM_EXTCAL_MAILTAGS3 |
105
|
|
|
. '<br>' |
106
|
|
|
. _AM_EXTCAL_MAILTAGS4 |
107
|
|
|
. '<br>' |
108
|
|
|
. _AM_EXTCAL_MAILTAGS5 |
109
|
|
|
. '<br>' |
110
|
|
|
. _AM_EXTCAL_MAILTAGS6 |
111
|
|
|
. '<br>' |
112
|
|
|
. _AM_EXTCAL_MAILTAGS7 |
113
|
|
|
. '<br>' |
114
|
|
|
. _AM_EXTCAL_MAILTAGS8 |
115
|
|
|
. '<br>' |
116
|
|
|
. _AM_EXTCAL_MAILTAGS9 |
117
|
|
|
. '</span> '; |
118
|
|
|
$toCheckBbox = new XoopsFormCheckBox(_AM_EXTCAL_SEND_TO, 'mail_send_to', 'mail'); |
119
|
|
|
$toCheckBox->addOption('mail', _AM_EXTCAL_EMAIL); |
120
|
|
|
$toCheckBox->addOption('pm', _AM_EXTCAL_PM); |
121
|
|
|
|
122
|
|
|
echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>'; |
123
|
|
|
echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>'; |
124
|
|
|
echo _AM_EXTCAL_INFO_SEND_NOTIF; |
125
|
|
|
echo '</fieldset><br>'; |
126
|
|
|
$form = new XoopsThemeForm(_AM_EXTCAL_SEND_NOTIFICATION, 'mailusers', 'index.php?op=notification&fct=send', 'post', true); |
127
|
|
|
$form->addElement(new XoopsFormText(_AM_EXTCAL_FROM_NAME, 'mail_fromname', 30, 255, $xoopsConfig['sitename']), true); |
128
|
|
|
$form->addElement(new XoopsFormText(_AM_EXTCAL_FROM_EMAIL, 'mail_fromemail', 30, 255, $fromemail), true); |
129
|
|
|
$form->addElement(new XoopsFormText($subjectCaption, 'mail_subject', 50, 255, _AM_EXTCAL_SEND_NOTIFICATION_SUBJECT), true); |
130
|
|
|
$form->addElement(new XoopsFormTextArea($bodyCaption, 'mail_body', _AM_EXTCAL_SEND_NOTIFICATION_BODY, 10), true); |
131
|
|
|
$form->addElement($toCheckBox, true); |
132
|
|
|
$form->addElement(new XoopsFormHidden('event_id', $_GET['event_id']), false); |
133
|
|
|
$form->addElement(new XoopsFormButton('', 'mail_submit', _SUBMIT, 'submit')); |
134
|
|
|
$form->display(); |
135
|
|
|
echo '</fieldset>'; |
136
|
|
|
|
137
|
|
|
xoops_cp_footer(); |
138
|
|
|
|
139
|
|
|
break; |
140
|
|
|
} |
141
|
|
|
break; |
142
|
|
|
|
143
|
|
|
default: |
144
|
|
|
case 'default': |
145
|
|
|
// @author Gregory Mage (Aka Mage) |
146
|
|
|
//*************************************************************************************** |
147
|
|
|
xoops_cp_header(); |
148
|
|
|
// require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php"; |
149
|
|
|
// $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
|
|
|
|
150
|
|
|
// $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE); |
|
|
|
|
151
|
|
|
$adminObject = \Xmf\Module\Admin::getInstance(); |
152
|
|
|
$adminObject->addInfoBox(_MI_EXTCAL_DASHBOARD); |
153
|
|
|
$adminObject->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, '<infolabel>' . _AM_EXTCAL_INDEX_CATEGORIES . '</infolabel>', $catHandler->getCount(), 'Green'); |
154
|
|
|
$adminObject->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, '<infolabel>' . _AM_EXTCAL_INDEX_EVENT . '</infolabel>', $eventHandler->getCount(new Criteria('event_approved', 1)), 'Green'); |
155
|
|
|
$adminObject->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, '<infolabel>' . _AM_EXTCAL_INDEX_PENDING . '</infolabel>', $eventHandler->getCount(new Criteria('event_approved', 0)), 'Red'); |
156
|
|
|
$criteriaCompo = new CriteriaCompo(); |
157
|
|
|
$criteriaCompo->add(new Criteria('event_approved', 1)); |
158
|
|
|
$criteriaCompo->add(new Criteria('event_start', time(), '>=')); |
159
|
|
|
$adminObject->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, '<infolabel>' . _AM_EXTCAL_INDEX_APPROVED . '</infolabel><infotext>', $eventHandler->getCount($criteriaCompo) . '</infotext>', 'Green'); |
160
|
|
|
|
161
|
|
|
$adminObject->addConfigBoxLine(); |
162
|
|
|
$adminObject->addConfigBoxLine(_AM_EXTCAL_PEAR_PATH); |
163
|
|
|
$adminObject->addConfigBoxLine(_EXTCAL_PEAR_ROOT, 'folder'); |
164
|
|
|
|
165
|
|
|
//JJD |
166
|
|
|
// $adminObject->addConfigBoxLine(XOOPS_ROOT_PATH,'folder'); |
|
|
|
|
167
|
|
|
|
168
|
|
|
// $adminObject->addLineConfigLabel(_AM_EXTCAL_CONFIG_PHP, $xoopsModule->getInfo("min_php"), 'php'); |
|
|
|
|
169
|
|
|
// $adminObject->addLineConfigLabel(_AM_EXTCAL_CONFIG_XOOPS, $xoopsModule->getInfo("min_xoops"), 'xoops'); |
|
|
|
|
170
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
171
|
|
|
$adminObject->displayIndex(); |
172
|
|
|
//*************************************************************************************** |
173
|
|
|
$pendingEvent = $eventHandler->objectToArray($eventHandler->getPendingEvent(), array('cat_id')); |
174
|
|
|
$eventHandler->formatEventsDate($pendingEvent, 'd/m/Y'); |
175
|
|
|
|
176
|
|
|
echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_PENDING_EVENT . '</legend>'; |
177
|
|
|
echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>'; |
178
|
|
|
// echo '<img src="../assets/images/icons/on.png" > '._AM_EXTCAL_INFO_APPROVE_PENDING_EVENT.'<br>'; |
|
|
|
|
179
|
|
|
echo '<img src=' . $pathIcon16 . '/edit.png> ' . _AM_EXTCAL_INFO_EDIT_PENDING_EVENT . '<br>'; |
180
|
|
|
echo '<img src=' . $pathIcon16 . '/delete.png> ' . _AM_EXTCAL_INFO_DELETE_PENDING_EVENT . '<br>'; |
181
|
|
|
echo '</fieldset><br>'; |
182
|
|
|
|
183
|
|
|
echo '<table class="outer" style="width:100%;">'; |
184
|
|
|
echo '<tr style="text-align:center;">'; |
185
|
|
|
echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>'; |
186
|
|
|
echo '<th>' . _AM_EXTCAL_TITLE . '</th>'; |
187
|
|
|
echo '<th>' . _AM_EXTCAL_START_DATE . '</th>'; |
188
|
|
|
echo '<th>' . _AM_EXTCAL_ACTION . '</th>'; |
189
|
|
|
echo '</tr>'; |
190
|
|
|
|
191
|
|
|
if (count($pendingEvent) > 0) { |
192
|
|
|
$i = 0; |
193
|
|
|
foreach ($pendingEvent as $event) { |
194
|
|
|
$class = (++$i % 2 == 0) ? 'even' : 'odd'; |
195
|
|
|
echo '<tr style="text-align:center;" class="' . $class . '">'; |
196
|
|
|
echo '<td>' . $event['cat']['cat_name'] . '</td>'; |
197
|
|
|
echo '<td>' . $event['event_title'] . '</td>'; |
198
|
|
|
echo '<td>' . $event['formated_event_start'] . '</td>'; |
199
|
|
|
echo '<td style="width:10%; text-align:center;">'; |
200
|
|
|
echo '<a href="event.php?op=modify&event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/edit.png></a> '; |
201
|
|
|
echo '<a href="event.php?op=delete&event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/delete.png></a>'; |
202
|
|
|
echo '</td>'; |
203
|
|
|
echo '</tr>'; |
204
|
|
|
} |
205
|
|
|
} else { |
206
|
|
|
echo '<tr><td colspan="4">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>'; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
echo '</table></fieldset><br>'; |
210
|
|
|
|
211
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
212
|
|
|
|
213
|
|
|
break; |
214
|
|
|
} |
215
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.