This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * **************************************************************************** |
||
4 | * - A Project by Developers TEAM For Xoops - ( https://xoops.org ) |
||
5 | * **************************************************************************** |
||
6 | * XNEWSLETTER - MODULE FOR XOOPS |
||
7 | * Copyright (c) 2007 - 2012 |
||
8 | * Goffy ( wedega.com ) |
||
9 | * |
||
10 | * You may not change or alter any portion of this comment or credits |
||
11 | * of supporting developers from this source code or any supporting |
||
12 | * source code which is considered copyrighted (c) material of the |
||
13 | * original comment or credit authors. |
||
14 | * |
||
15 | * This program is distributed in the hope that it will be useful, |
||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | * GNU General Public License for more details. |
||
19 | * --------------------------------------------------------------------------- |
||
20 | * @copyright Goffy ( wedega.com ) |
||
21 | * @license GPL 2.0 |
||
22 | * @package xnewsletter |
||
23 | * @author Goffy ( [email protected] ) |
||
24 | * |
||
25 | * **************************************************************************** |
||
26 | */ |
||
27 | |||
28 | use Xmf\Request; |
||
29 | |||
30 | $currentFile = basename(__FILE__); |
||
31 | require_once __DIR__ . '/admin_header.php'; |
||
32 | xoops_cp_header(); |
||
33 | |||
34 | // set template |
||
35 | $templateMain = 'xnewsletter_admin_catsubscribers.tpl'; |
||
36 | |||
37 | // We recovered the value of the argument op in the URL$ |
||
38 | $op = Request::getString('op', 'list'); |
||
39 | $cat_id = Request::getInt('cat_id', 0); |
||
40 | |||
41 | $GLOBALS['xoopsTpl']->assign('xnewsletter_url', XNEWSLETTER_URL); |
||
42 | $GLOBALS['xoopsTpl']->assign('xnewsletter_icons_url', XNEWSLETTER_ICONS_URL); |
||
43 | |||
44 | switch ($op) { |
||
45 | case 'list': |
||
46 | default: |
||
47 | $adminObject->displayNavigation($currentFile); |
||
48 | $adminObject->addItemButton(_AM_XNEWSLETTER_NEWCATSUBSCR, '?op=new_catsubscr&cat_id=' . $cat_id, 'add'); |
||
49 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->renderButton('left')); |
||
50 | |||
51 | $limit = $helper->getConfig('adminperpage'); |
||
52 | $catCriteria = new \CriteriaCompo(); |
||
53 | $catCriteria->setSort('cat_id ASC, cat_name'); |
||
54 | $catCriteria->setOrder('ASC'); |
||
55 | $catCount = $helper->getHandler('Cat')->getCount(); |
||
56 | $start = Request::getInt('start', 0); |
||
57 | $catCriteria->setStart($start); |
||
58 | $catCriteria->setLimit($limit); |
||
59 | $catAll = $helper->getHandler('Cat')->getAll($catCriteria); |
||
60 | View Code Duplication | if ($catCount > $limit) { |
|
0 ignored issues
–
show
|
|||
61 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
62 | $pagenav = new \XoopsPageNav($catCount, $limit, $start, 'start', 'op=list'); |
||
63 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
64 | } |
||
65 | |||
66 | if ($catCount > 0) { |
||
67 | $GLOBALS['xoopsTpl']->assign('categories_count', $catCount); |
||
68 | foreach ($catAll as $cat_id => $catObj) { |
||
69 | $cat = $catObj->getValuesCat(); |
||
70 | $cat['subscrCount'] = $helper->getHandler('Catsubscr')->getCount(new \Criteria('catsubscr_catid', $cat_id)); |
||
71 | $GLOBALS['xoopsTpl']->append('categories_list', $cat); |
||
72 | unset($cat); |
||
73 | } |
||
74 | } |
||
75 | break; |
||
76 | case 'list_cat': |
||
77 | $adminObject->displayNavigation($currentFile); |
||
78 | $adminObject->addItemButton(_AM_XNEWSLETTER_CATLIST, '?op=list', 'list'); |
||
79 | $adminObject->addItemButton(_AM_XNEWSLETTER_NEWCATSUBSCR, '?op=new_catsubscr&cat_id=' . $cat_id, 'add'); |
||
80 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->renderButton('left')); |
||
81 | |||
82 | $limit = $helper->getConfig('adminperpage'); |
||
83 | $catsubscrCriteria = new \CriteriaCompo(); |
||
84 | $catsubscrCriteria->add(new \Criteria('catsubscr_catid', $cat_id)); |
||
85 | $catsubscrCriteria->setSort('catsubscr_id ASC, catsubscr_catid'); |
||
86 | $catsubscrCriteria->setOrder('ASC'); |
||
87 | $catsubscrCount = $helper->getHandler('Catsubscr')->getCount($catsubscrCriteria); |
||
88 | $start = Request::getInt('start', 0); |
||
89 | $catsubscrCriteria->setStart($start); |
||
90 | $catsubscrCriteria->setLimit($limit); |
||
91 | $catsubscrAll = $helper->getHandler('Catsubscr')->getAll($catsubscrCriteria); |
||
92 | View Code Duplication | if ($catsubscrCount > $limit) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
93 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
94 | $pagenav = new \XoopsPageNav($catsubscrCount, $limit, $start, 'start', 'op=list_cat&cat_id=' . $cat_id); |
||
95 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
96 | } |
||
97 | $cat = $helper->getHandler('Cat')->get($cat_id); |
||
98 | $cat_name = $cat->getVar('cat_name'); |
||
99 | |||
100 | if ($catsubscrCount > 0) { |
||
101 | $GLOBALS['xoopsTpl']->assign('catsubscr_count', $catsubscrCount); |
||
102 | $class = 'odd'; |
||
103 | foreach ($catsubscrAll as $catsubscr_id => $catsubscrObj) { |
||
104 | $catsubscr = $catsubscrObj->getValuesCatsubscr(); |
||
105 | $catsubscr['cat_name'] = $cat_name; |
||
106 | $subscr_id = $catsubscrObj->getVar('catsubscr_subscrid'); |
||
107 | $subscr = $helper->getHandler('Subscr')->get($subscr_id); |
||
108 | $subscr_email = $subscr ? $subscr->getVar('subscr_email') : ''; |
||
109 | $catsubscr['subscr_email'] = $subscr_email; |
||
110 | if ($catsubscrObj->getVar('catsubscr_quited') > 0) { |
||
111 | $catsubscr_quited = _YES . ' (' . formatTimestamp($catsubscrObj->getVar('catsubscr_quited'), 'M') . ')'; |
||
112 | } else { |
||
113 | $catsubscr_quited = _NO; |
||
114 | } |
||
115 | $catsubscr['quited_text'] = $catsubscr_quited; |
||
116 | $GLOBALS['xoopsTpl']->append('catsubscribers_list', $catsubscr); |
||
117 | unset($cat); |
||
118 | } |
||
119 | } else { |
||
120 | $GLOBALS['xoopsTpl']->assign('error', _AM_XNEWSLETTER_THEREARENT_CATSUBSCR); |
||
121 | } |
||
122 | break; |
||
123 | case 'new_catsubscr': |
||
124 | $adminObject->displayNavigation($currentFile); |
||
125 | $adminObject->addItemButton(_AM_XNEWSLETTER_CATSUBSCRLIST, '?op=list', 'list'); |
||
126 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->renderButton('left')); |
||
127 | |||
128 | $catsubscrObj = $helper->getHandler('Catsubscr')->create(); |
||
129 | if ($cat_id > 0) { |
||
130 | $catsubscrObj->setVar('catsubscr_catid', $cat_id); |
||
131 | } |
||
132 | $form = $catsubscrObj->getForm(); |
||
133 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
134 | break; |
||
135 | case 'save_catsubscr': |
||
136 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
137 | redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
138 | } |
||
139 | View Code Duplication | if (Request::hasVar('catsubscr_id', 'REQUEST')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
140 | $catsubscrObj = $helper->getHandler('Catsubscr')->get($_REQUEST['catsubscr_id']); |
||
141 | } else { |
||
142 | $catsubscrObj = $helper->getHandler('Catsubscr')->create(); |
||
143 | } |
||
144 | |||
145 | $catsubscr_catid = Request::getInt('catsubscr_catid', 0); |
||
146 | $catsubscrObj->setVar('catsubscr_catid', $catsubscr_catid); |
||
147 | $catsubscr_subscrid = Request::getInt('catsubscr_subscrid', 0); |
||
148 | $catsubscrObj->setVar('catsubscr_subscrid', $catsubscr_subscrid); |
||
149 | $catsubscr_quit_now = Request::getInt('catsubscr_quit_now', _XNEWSLETTER_CATSUBSCR_QUIT_NO_VAL_NONE); |
||
150 | if (_XNEWSLETTER_CATSUBSCR_QUIT_NO_VAL_NOW == $catsubscr_quit_now) { |
||
151 | $catsubscrObj->setVar('catsubscr_quited', time()); |
||
152 | } elseif (_XNEWSLETTER_CATSUBSCR_QUIT_NO_VAL_REMOVE == $catsubscr_quit_now) { |
||
153 | $catsubscrObj->setVar('catsubscr_quited', 0); |
||
154 | } |
||
155 | $catsubscrObj->setVar('catsubscr_submitter', Request::getInt('catsubscr_submitter', 0)); |
||
156 | $catsubscrObj->setVar('catsubscr_created', Request::getInt('catsubscr_created', 0)); |
||
157 | |||
158 | if ($helper->getHandler('Catsubscr')->insert($catsubscrObj)) { |
||
159 | //add subscriber to mailinglist |
||
160 | $catsubscrObj_cat = $helper->getHandler('Cat')->get($catsubscr_catid); |
||
161 | View Code Duplication | if ($catsubscrObj_cat->getVar('cat_mailinglist') > 0) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
162 | require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php'; |
||
163 | subscribingMLHandler(_XNEWSLETTER_MAILINGLIST_SUBSCRIBE, $catsubscr_subscrid, $catsubscrObj_cat->getVar('cat_mailinglist')); |
||
164 | } |
||
165 | redirect_header('?op=list', 3, _AM_XNEWSLETTER_FORMOK); |
||
166 | } |
||
167 | |||
168 | $GLOBALS['xoopsTpl']->assign('error', $catsubscrObj->getHtmlErrors()); |
||
169 | $form = $catsubscrObj->getForm(); |
||
170 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
171 | break; |
||
172 | View Code Duplication | case 'edit_catsubscr': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
173 | $adminObject->displayNavigation($currentFile); |
||
174 | $adminObject->addItemButton(_AM_XNEWSLETTER_CATSUBSCRLIST, "?op=list_cat&cat_id={$cat_id}", 'list'); |
||
175 | $adminObject->addItemButton(_AM_XNEWSLETTER_NEWCATSUBSCR, '?op=new_catsubscr', 'add'); |
||
176 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->renderButton('left')); |
||
177 | |||
178 | $catsubscrObj = $helper->getHandler('Catsubscr')->get($_REQUEST['catsubscr_id']); |
||
179 | $form = $catsubscrObj->getForm(); |
||
180 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
181 | break; |
||
182 | case 'delete_catsubscr': |
||
183 | $catsubscrObj = $helper->getHandler('Catsubscr')->get($_REQUEST['catsubscr_id']); |
||
184 | if (true === Request::getBool('ok', false, 'POST')) { |
||
185 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
186 | redirect_header('catsubscr.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
187 | } |
||
188 | if ($helper->getHandler('Catsubscr')->delete($catsubscrObj)) { |
||
189 | // remove subscriber from mailinglist |
||
190 | $subscr_id = $_REQUEST['subscr_id']; |
||
191 | $catsubscrObj_cat = $helper->getHandler('Cat')->get($_REQUEST['cat_id']); |
||
192 | View Code Duplication | if ($catsubscrObj_cat->getVar('cat_mailinglist') > 0) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
193 | require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php'; |
||
194 | subscribingMLHandler(_XNEWSLETTER_MAILINGLIST_UNSUBSCRIBE, $subscr_id, $catsubscrObj_cat->getVar('cat_mailinglist')); |
||
195 | } |
||
196 | redirect_header('catsubscr.php', 3, _AM_XNEWSLETTER_FORMDELOK); |
||
197 | } else { |
||
198 | $GLOBALS['xoopsTpl']->assign('error', $catsubscrObj->getHtmlErrors()); |
||
199 | } |
||
200 | } else { |
||
201 | $confirmtext = str_replace('%c', $_REQUEST['cat_name'], _AM_XNEWSLETTER_CATSUBSCR_SUREDELETE); |
||
202 | $confirmtext = str_replace('%s', $_REQUEST['subscr_email'], $confirmtext); |
||
203 | $confirmtext = str_replace('"', ' ', $confirmtext); |
||
204 | xoops_confirm(['ok' => true, 'catsubscr_id' => $_REQUEST['catsubscr_id'], 'op' => 'delete_catsubscr'], $_SERVER['REQUEST_URI'], sprintf($confirmtext)); |
||
205 | } |
||
206 | break; |
||
207 | } |
||
208 | require_once __DIR__ . '/admin_footer.php'; |
||
209 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.