1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/** |
3
|
|
|
* MyLinks category.php |
4
|
|
|
* |
5
|
|
|
* Xoops mylinks - a multicategory links module |
6
|
|
|
* |
7
|
|
|
* @copyright:: The XOOPS Project http://sourceforge.net/projects/xoops/ |
8
|
|
|
* @license:: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
9
|
|
|
* @package:: mylinks |
10
|
|
|
* @subpackage:: admin |
11
|
|
|
* @since:: unknown |
12
|
|
|
* @author:: Thatware - http://thatware.org/ |
13
|
|
|
*/ |
14
|
|
|
// ------------------------------------------------------------------------- // |
15
|
|
|
// XOOPS - PHP Content Management System // |
16
|
|
|
// <http://www.xoops.org/> // |
17
|
|
|
// ------------------------------------------------------------------------- // |
18
|
|
|
// Based on: // |
19
|
|
|
// myPHPNUKE Web Portal System - http://myphpnuke.com/ // |
20
|
|
|
// PHP-NUKE Web Portal System - http://phpnuke.org/ // |
21
|
|
|
// Thatware - http://thatware.org/ // |
22
|
|
|
// ------------------------------------------------------------------------- // |
23
|
|
|
// This program is free software; you can redistribute it and/or modify // |
24
|
|
|
// it under the terms of the GNU General Public License as published by // |
25
|
|
|
// the Free Software Foundation; either version 2 of the License, or // |
26
|
|
|
// (at your option) any later version. // |
27
|
|
|
// // |
28
|
|
|
// This program is distributed in the hope that it will be useful, // |
29
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
30
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
31
|
|
|
// GNU General Public License for more details. // |
32
|
|
|
// // |
33
|
|
|
// You should have received a copy of the GNU General Public License // |
34
|
|
|
// along with this program; if not, write to the Free Software // |
35
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
36
|
|
|
// ------------------------------------------------------------------------- // |
37
|
|
|
|
38
|
|
|
include 'admin_header.php'; |
39
|
|
|
xoops_loadLanguage('main', $xoopsModule->getVar('dirname')); |
40
|
|
|
include_once '../class/utility.php'; |
41
|
|
|
//xoops_load('utility', $xoopsModule->getVar('dirname')); |
|
|
|
|
42
|
|
|
|
43
|
|
|
include '../include/functions.php'; |
44
|
|
|
include_once XOOPS_ROOT_PATH . '/class/tree.php'; |
45
|
|
|
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
46
|
|
|
include_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
47
|
|
|
//include_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
|
|
|
48
|
|
|
|
49
|
|
|
$myts =& MyTextSanitizer::getInstance(); |
50
|
|
|
//$eh = new ErrorHandler; |
|
|
|
|
51
|
|
|
|
52
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
53
|
|
|
$catObjs = $mylinksCatHandler->getAll(); |
54
|
|
|
$myCatTree = new XoopsObjectTree($catObjs, 'cid', 'pid'); |
55
|
|
|
|
56
|
|
|
function listNewLinks() |
57
|
|
|
{ |
58
|
|
|
global $xoopsDB, $myts, $myCatTree, $xoopsModule; |
|
|
|
|
59
|
|
|
// List links waiting for validation |
60
|
|
|
$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/'); |
61
|
|
|
$result = $xoopsDB->query('SELECT lid, cid, title, url, logourl, submitter FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE status='0' ORDER BY date DESC"); |
62
|
|
|
$numrows = $xoopsDB->getRowsNum($result); |
63
|
|
|
xoops_cp_header(); |
64
|
|
|
|
65
|
|
|
$indexAdmin = new ModuleAdmin(); |
66
|
|
|
echo $indexAdmin->addNavigation('main.php?op=listNewLinks'); |
67
|
|
|
|
68
|
|
|
//@TODO: change to use XoopsForm |
69
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
70
|
|
|
." <tr><th colspan='7'>" . sprintf(_MD_MYLINKS_LINKSWAITING, $numrows) . "<br></th></tr>\n"; |
71
|
|
|
if ( $numrows > 0 ) { |
72
|
|
|
while (list($lid, $cid, $title, $url, $logourl, $submitterid) = $xoopsDB->fetchRow($result)) { |
73
|
|
|
$result2 = $xoopsDB->query('SELECT description FROM ' . $xoopsDB->prefix('mylinks_text') . " WHERE lid='{$lid}'"); |
74
|
|
|
list($description) = $xoopsDB->fetchRow($result2); |
75
|
|
|
$title = $myts->htmlSpecialChars($title); |
76
|
|
|
$url = $myts->htmlSpecialChars($url); |
77
|
|
|
// $url = urldecode($url); |
|
|
|
|
78
|
|
|
// $logourl = $myts->htmlSpecialChars($logourl); |
|
|
|
|
79
|
|
|
// $logourl = urldecode($logourl); |
|
|
|
|
80
|
|
|
$description = $myts->htmlSpecialChars($description); |
81
|
|
|
$submitter = XoopsUser::getUnameFromId($submitterid); |
82
|
|
|
echo " <tr><td>\n" |
83
|
|
|
." <form action='main.php' method='post'>\n" |
84
|
|
|
." <table style='width: 80%;'>\n" |
85
|
|
|
." <tr><td style='text-align: right; nowrap='nowrap'>" . _MD_MYLINKS_SUBMITTER . "</td>\n" |
86
|
|
|
." <td><a href=\"".XOOPS_URL . '/userinfo.php?uid=' . $submitterid . "\">$submitter</a></td>\n" |
87
|
|
|
." </tr>\n" |
88
|
|
|
." <tr><td style='text-align: right;' nowrap='nowrap'>" . _MD_MYLINKS_SITETITLE . "</td>\n" |
89
|
|
|
." <td><input type='text' name='title' size='50' maxlength='100' value='{$title}'></td>\n" |
90
|
|
|
." </tr>\n" |
91
|
|
|
." <tr><td style='text-align: right;' nowrap='nowrap'>" . _MD_MYLINKS_SITEURL . "</td>\n" |
92
|
|
|
." <td><input type='text' name='url' size='50' maxlength='250' value='{$url}'> \n" |
93
|
|
|
." [ <a href='" . preg_replace('/javascript:/si', 'java script:', $url) . "' target='_blank'>" . _MD_MYLINKS_VISIT . "</a> ]\n" |
94
|
|
|
." </td>\n" |
95
|
|
|
." </tr>\n" |
96
|
|
|
." <tr><td style='text-align: right;' nowrap'nowrap'>" . _MD_MYLINKS_CATEGORYC . "</td>\n" |
97
|
|
|
. ' <td>' . $myCatTree->makeSelBox('cid', 'title', '- ', $cid) . "</td>\n" |
98
|
|
|
." </tr>\n" |
99
|
|
|
." <tr><td style='text-align: right; vertical-align: top;' nowrap='nowrap'>" . _MD_MYLINKS_DESCRIPTIONC . "</td>\n" |
100
|
|
|
." <td><textarea name='description' cols='60' rows='5'>{$description}</textarea></td>\n" |
101
|
|
|
." </tr>\n" |
102
|
|
|
." <tr><td style='text-align: right; nowrap='nowrap'>" . _MD_MYLINKS_SHOTIMAGE . "</td>\n" |
103
|
|
|
." <td><select size='1' name='logourl'><option value=' '>------</option>"; |
104
|
|
|
foreach ($linkimg_array as $image){ |
105
|
|
|
echo "<option value='{$image}'>{$image}</option>"; |
106
|
|
|
} |
107
|
|
|
$shotdir = '<strong>' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/</strong>'; |
108
|
|
|
echo "</select></td>\n" |
109
|
|
|
." </tr>\n" |
110
|
|
|
. ' <tr><td></td><td>' . sprintf(_MD_MYLINKS_SHOTMUST, $shotdir) . "</td></tr>\n" |
111
|
|
|
." </table>\n" |
112
|
|
|
." <br><input type='hidden' name='op' value='approve'>\n" |
113
|
|
|
." <input type='hidden' name='lid' value='{$lid}'>\n" |
114
|
|
|
." <input type='submit' value='" . _MD_MYLINKS_APPROVE . "'>\n" |
115
|
|
|
." </form>\n"; |
116
|
|
|
echo " <form action='main.php?op=delNewLink&lid={$lid}' method='post'><input type='submit' value='" . _DELETE . "'></form>\n" |
117
|
|
|
." <br><br>\n" |
118
|
|
|
." </td></tr>\n"; |
119
|
|
|
} |
120
|
|
|
} else { |
121
|
|
|
echo " <tr><td colspan='7' class='odd bold italic'>" . _MD_MYLINKS_NOSUBMITTED . "</td></tr>\n"; |
122
|
|
|
} |
123
|
|
|
echo "</table>\n"; |
124
|
|
|
|
125
|
|
|
include 'admin_footer.php'; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
function linksConfigMenu() |
129
|
|
|
{ |
130
|
|
|
global $xoopsDB, $myts, $myCatTree, $xoopsModule; |
|
|
|
|
131
|
|
|
|
132
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
133
|
|
|
$catCount = $mylinksCatHandler->getCount(); |
134
|
|
|
$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/'); |
135
|
|
|
|
136
|
|
|
xoops_cp_header(); |
137
|
|
|
$indexAdmin = new ModuleAdmin(); |
138
|
|
|
echo $indexAdmin->addNavigation('main.php?op=linksConfigMenu'); |
139
|
|
|
|
140
|
|
|
// echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>\n"; |
141
|
|
|
|
142
|
|
|
// If there is a category, display add a New Link table |
143
|
|
|
//@TODO: change to use XoopsForm |
144
|
|
|
if ($catCount) { |
145
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
146
|
|
|
." <tr><th style='font-size: larger;'>" . _MD_MYLINKS_ADDNEWLINK . "</th></tr>\n" |
147
|
|
|
." <tr class='odd'><td style='padding: 0 10em;'>\n" |
148
|
|
|
." <form method='post' action='main.php'>\n" |
149
|
|
|
." <table style='width: 80%;'>\n" |
150
|
|
|
." <tr>\n" |
151
|
|
|
." <td style='text-align: right;'>" . _MD_MYLINKS_SITETITLE . "</td>\n" |
152
|
|
|
." <td><input type='text' name='title' size='50' maxlength='100'></td>\n" |
153
|
|
|
." </tr>\n" |
154
|
|
|
." <tr>\n" |
155
|
|
|
." <td style='text-align: right;' nowrap='nowrap'>" . _MD_MYLINKS_SITEURL . "</td>\n" |
156
|
|
|
." <td><input type='text' name='url' size='50' maxlength='250' value='http://'></td>\n" |
157
|
|
|
." </tr>\n" |
158
|
|
|
." <tr>\n" |
159
|
|
|
." <td style='text-align: right;' nowrap='nowrap'>" . _MD_MYLINKS_CATEGORYC . "</td>\n" |
160
|
|
|
." <td>\n" |
161
|
|
|
. ' ' . $myCatTree->makeSelBox('cid', 'title') . "\n" |
162
|
|
|
." </td>\n" |
163
|
|
|
." </tr>\n" |
164
|
|
|
." <tr>\n" |
165
|
|
|
." <td style='text-align: right; vertical-align: top;' nowrap='nowrap'>" . _MD_MYLINKS_DESCRIPTIONC . "</td>\n" |
166
|
|
|
. ' <td>'; |
167
|
|
|
xoopsCodeTarea('descarea', 60, 8); |
168
|
|
|
xoopsSmilies('descarea'); |
169
|
|
|
echo " </td>\n" |
170
|
|
|
." </tr>\n" |
171
|
|
|
." <tr>\n" |
172
|
|
|
." <td style='text-align: right; nowrap='nowrap'>" . _MD_MYLINKS_SHOTIMAGE . "</td>\n" |
173
|
|
|
." <td><select size='1' name='logourl'><option value=' '>------</option>"; |
174
|
|
|
foreach ($linkimg_array as $image) { |
175
|
|
|
echo "<option value='{$image}'>{$image}</option>"; |
176
|
|
|
} |
177
|
|
|
echo "</select></td>\n" |
178
|
|
|
." </tr>\n"; |
179
|
|
|
$shotdir = '<strong>' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/</strong>'; |
180
|
|
|
echo ' <tr><td></td><td>' . sprintf(_MD_MYLINKS_SHOTMUST, $shotdir) . "</td></tr>\n" |
181
|
|
|
. " </table><br>\n" |
182
|
|
|
. " <div style='text-align: center;'>\n" |
183
|
|
|
. " <input type='hidden' name='op' value='addLink'>\n" |
184
|
|
|
. " <input type='submit' class='button' value='" . _ADD . "'>\n" |
185
|
|
|
. " </div>\n" |
186
|
|
|
. " </form>\n" |
187
|
|
|
. " </td></tr>\n" |
188
|
|
|
. "</table>\n" |
189
|
|
|
. "<br>\n"; |
190
|
|
|
|
191
|
|
|
// Modify Link |
192
|
|
|
$result2 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . ''); |
193
|
|
|
list($numLinks) = $xoopsDB->fetchRow($result2); |
194
|
|
|
if ( $numLinks ) { |
195
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
196
|
|
|
." <tr><th style='font-size: larger;'>" . _MD_MYLINKS_MODLINK . "</th></tr>\n" |
197
|
|
|
." <tr class='odd'><td style='text-align: center;'>\n" |
198
|
|
|
." <form method='get' action='main.php'>\n" |
199
|
|
|
. ' ' . _MD_MYLINKS_LINKID . "\n" |
200
|
|
|
." <input type='text' name='lid' size='12' maxlength='11'>\n" |
201
|
|
|
." <input type='hidden' name='fct' value='mylinks'>\n" |
202
|
|
|
." <input type='hidden' name='op' value='modLink'><br><br>\n" |
203
|
|
|
." <input type='submit' value='" . _MD_MYLINKS_MODIFY . "'>\n" |
204
|
|
|
." </form>\n" |
205
|
|
|
." </td></tr>\n" |
206
|
|
|
. '</table>'; |
207
|
|
|
} |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
// Add a New Main Category |
211
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
212
|
|
|
." <tr><th style='font-size: larger;'>" . _MD_MYLINKS_ADDMAIN . "</th></tr>\n" |
213
|
|
|
." <tr class='odd'><td style='text-align: center;'>\n" |
214
|
|
|
." <form method='post' action='main.php'>\n" |
215
|
|
|
. ' ' . _MD_MYLINKS_TITLEC . "\n" |
216
|
|
|
." <input type='text' name='title' size='30' maxlength='50'><br>\n" |
217
|
|
|
. ' ' . _MD_MYLINKS_IMGURL . "<br>\n" |
218
|
|
|
." <input type='text' name='imgurl' size='100' maxlength='150' value='http://'><br><br>\n" |
219
|
|
|
." <input type='hidden' name='cid' value='0'>\n" |
220
|
|
|
." <input type='hidden' name='op' value='addCat'>\n" |
221
|
|
|
." <input type='submit' value='" . _ADD . "'><br>\n" |
222
|
|
|
." </form>\n" |
223
|
|
|
." </td></tr>\n"; |
224
|
|
|
if (!$catCount) { |
225
|
|
|
echo " <tr><th style='font-size: larger;'>" . _MD_MYLINKS_IMPORTCATHDR . "</th></tr>\n" |
226
|
|
|
." <tr class='even'><td style='text-align: center;'>\n" |
227
|
|
|
." <form method='post' action='main.php'>\n" |
228
|
|
|
. ' ' . _MD_MYLINKS_IMPORTCATS . "<br>\n" |
229
|
|
|
." <input type='hidden' name='op' value='importCats'>\n" |
230
|
|
|
." <input type='hidden' name='ok' value='0'>\n" |
231
|
|
|
." <input style='margin: .5em 0em;' type='submit' value='" . _SUBMIT . "'><br>\n" |
232
|
|
|
." </form>\n" |
233
|
|
|
. ' </td></tr>' |
234
|
|
|
."</table>\n" |
235
|
|
|
."<br>\n"; |
236
|
|
|
} |
237
|
|
|
// Add a New Sub-Category |
238
|
|
View Code Duplication |
if ($catCount) { |
|
|
|
|
239
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
240
|
|
|
." <tr><th style='font-size: larger;'>" . _MD_MYLINKS_ADDSUB . "</th></tr>\n" |
241
|
|
|
." <tr class='odd'><td style='text-align: center;'>\n" |
242
|
|
|
." <form method='post' action='main.php'>\n" |
243
|
|
|
. ' ' . _MD_MYLINKS_TITLEC . "\n" |
244
|
|
|
." <input type='text' name='title' size='30' maxlength='50'> " . _MD_MYLINKS_IN . " \n" |
245
|
|
|
. ' ' . $myCatTree->makeSelBox('pid', 'title') . "\n" |
246
|
|
|
." <input type='hidden' name='op' value='addCat'><br><br>\n" |
247
|
|
|
." <input type='submit' value='" . _ADD . "'><br>\n" |
248
|
|
|
." </form>\n" |
249
|
|
|
." </td></tr>\n" |
250
|
|
|
."</table>\n" |
251
|
|
|
. '<br>'; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
// Modify Category Table Display |
255
|
|
View Code Duplication |
if ($catCount) { |
|
|
|
|
256
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
257
|
|
|
." <tr><th style='font-size: larger;'>" . _MD_MYLINKS_MODCAT . "</th></tr>\n" |
258
|
|
|
." <tr class='odd'><td style='text-align: center;'>\n" |
259
|
|
|
." <form method='get' action='main.php'>\n" |
260
|
|
|
// ." <h4>" . _MD_MYLINKS_MODCAT . "</h4><br>\n" |
261
|
|
|
. ' ' . _MD_MYLINKS_CATEGORYC . "\n" |
262
|
|
|
. ' ' . $myCatTree->makeSelBox('cid', 'title') . "\n" |
263
|
|
|
." <br><br>\n" |
264
|
|
|
." <input type='hidden' name='op' value='modCat'>\n" |
265
|
|
|
." <input type='submit' value='" . _MD_MYLINKS_MODIFY . "'>\n" |
266
|
|
|
." </form>\n" |
267
|
|
|
." </td></tr>\n" |
268
|
|
|
."</table>\n" |
269
|
|
|
."<br>\n"; |
270
|
|
|
} |
271
|
|
|
include 'admin_footer.php'; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
function modLink() |
|
|
|
|
275
|
|
|
{ |
276
|
|
|
global $xoopsDB, $myts, $myCatTree, $xoopsModule; |
|
|
|
|
277
|
|
|
|
278
|
|
|
$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/'); |
279
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
280
|
|
|
$bknrptid = mylinksUtility::mylinks_cleanVars($_GET, 'bknrptid', 0, 'int', array('min'=>0)); |
|
|
|
|
281
|
|
|
|
282
|
|
|
xoops_cp_header(); |
283
|
|
|
|
284
|
|
|
$result = $xoopsDB->query('SELECT cid, title, url, logourl FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE lid={$lid}"); |
285
|
|
|
if (!result) { |
286
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
287
|
|
|
exit(); |
|
|
|
|
288
|
|
|
} |
289
|
|
|
list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); |
290
|
|
|
|
291
|
|
|
$title = $myts->htmlSpecialChars($myts->stripSlashesGPC($title)); |
292
|
|
|
$url = $myts->htmlSpecialChars($myts->stripSlashesGPC($url)); |
293
|
|
|
$logourl = $myts->htmlSpecialChars($myts->stripSlashesGPC($logourl)); |
294
|
|
|
//$url = urldecode($url); |
|
|
|
|
295
|
|
|
//$logourl = urldecode($logourl); |
|
|
|
|
296
|
|
|
$result2 = $xoopsDB->query('SELECT description FROM ' . $xoopsDB->prefix('mylinks_text') . " WHERE lid={$lid}"); |
297
|
|
|
list($description) = $xoopsDB->fetchRow($result2); |
298
|
|
|
$GLOBALS['description'] = $myts->htmlSpecialChars($myts->stripSlashesGPC($description)); |
299
|
|
|
|
300
|
|
|
echo '<h4>' . _MD_MYLINKS_WEBLINKSCONF . '</h4>' |
301
|
|
|
. "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>" |
302
|
|
|
. " <tr><th colspan='2'>" . _MD_MYLINKS_MODLINK . "</th></tr>\n" |
303
|
|
|
. " <tr class='odd'>\n" |
304
|
|
|
. " <td>\n" |
305
|
|
|
. " <form method='post' action='main.php' style='display: inline;'>\n" |
306
|
|
|
. " <table>\n" |
307
|
|
|
. ' <tr><td>' . _MD_MYLINKS_LINKID . "</td><td style='font-weight: bold;'>{$lid}</td></tr>\n" |
308
|
|
|
. ' <tr><td>' . _MD_MYLINKS_SITETITLE . "</td><td><input type='text' name='title' value='{$title}' size='50' maxlength='100'></td></tr>\n" |
309
|
|
|
. ' <tr><td>' . _MD_MYLINKS_SITEURL . "</td><td><input type='text' name='url' value='{$url}' size='50' maxlength='250'></td></tr>\n" |
310
|
|
|
. " <tr><td style='vertical-align: top;'>" . _MD_MYLINKS_DESCRIPTIONC . '</td><td>'; |
311
|
|
|
xoopsCodeTarea('description', 60, 8); |
312
|
|
|
xoopsSmilies('description'); |
313
|
|
|
echo "</td></tr>\n" |
314
|
|
|
. ' <tr><td>' . _MD_MYLINKS_CATEGORYC . '</td><td>' |
315
|
|
|
. '' . $myCatTree->makeSelBox('cid', 'title', '- ', $cid) . '' |
316
|
|
|
." </td></tr>\n" |
317
|
|
|
. ' <tr><td>' . _MD_MYLINKS_SHOTIMAGE . '</td><td>' |
318
|
|
|
."<select size='1' name='logourl'>" |
319
|
|
|
."<option value=' '>------</option>"; |
320
|
|
|
foreach ($linkimg_array as $image) { |
321
|
|
|
$opt_selected = ( $image == $logourl ) ? " selected='selected'" : ''; |
322
|
|
|
echo "<option value='{$image}'{$opt_selected}>{$image}</option>"; |
323
|
|
|
} |
324
|
|
|
echo '</select>' |
325
|
|
|
. "</td></tr>\n"; |
326
|
|
|
|
327
|
|
|
$shotdir = '<strong>' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/images/shots/</strong>'; |
328
|
|
|
echo ' <tr><td> </td><td>' . sprintf(_MD_MYLINKS_SHOTMUST, $shotdir) . "</td></tr>\n" |
329
|
|
|
. ' </table>' |
330
|
|
|
. " <br><br><input type='hidden' name='lid' value='{$lid}'>\n" |
331
|
|
|
. " <input type='hidden' name='bknrptid' value='{$bknrptid}'>\n" |
332
|
|
|
. " <input type='hidden' name='op' value='modLinkS'>\n" |
333
|
|
|
. " <input type='submit' value='" . _MD_MYLINKS_MODIFY . "'>" |
334
|
|
|
. " </form>\n" |
335
|
|
|
. " <form action='main.php?op=delLink&lid={$lid}' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _DELETE . "'></form>\n" |
336
|
|
|
. " <form action='main.php?op=linksConfigMenu' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _CANCEL . "'></form>\n" |
337
|
|
|
. ' <hr>'; |
338
|
|
|
|
339
|
|
|
$result5=$xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_votedata') . " WHERE lid='{$lid}'"); |
340
|
|
|
list($totalvotes) = $xoopsDB->fetchRow($result5); |
341
|
|
|
echo " <table style='width: 100%;'>\n" |
342
|
|
|
." <tr><td colspan='7' style='font-weight: bold;'>" . sprintf(_MD_MYLINKS_TOTALVOTES , $totalvotes) . "<br><br></td></tr>\n"; |
343
|
|
|
// Show Registered Users Votes |
344
|
|
|
$result5=$xoopsDB->query('SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ' . $xoopsDB->prefix('mylinks_votedata') . " WHERE lid='{$lid}' AND ratinguser >0 ORDER BY ratingtimestamp DESC"); |
345
|
|
|
$votes = $xoopsDB->getRowsNum($result5); |
346
|
|
|
echo " <tr><td colspan='7' style='font-weight: bold;'><br><br>" . sprintf(_MD_MYLINKS_USERTOTALVOTES, $votes) . "<br><br></td></tr>\n"; |
347
|
|
|
echo " <tr>\n" |
348
|
|
|
. ' <th>' . _MD_MYLINKS_USER . " </th>\n" |
349
|
|
|
. ' <th>' . _MD_MYLINKS_IP . " </th>\n" |
350
|
|
|
. ' <th>' . _MD_MYLINKS_RATING . " </th>\n" |
351
|
|
|
. ' <th>' . _MD_MYLINKS_USERAVG . " </th>\n" |
352
|
|
|
. ' <th>' . _MD_MYLINKS_TOTALRATE . " </th>\n" |
353
|
|
|
. ' <th>' . _MD_MYLINKS_DATE . " </th>\n" |
354
|
|
|
. ' <th>' . _DELETE . "</td>\n" |
355
|
|
|
." </tr>\n"; |
356
|
|
|
if ( 0 == $votes ) { |
357
|
|
|
echo " <tr><td style='text-align: center;' colspan='7'>" . _MD_MYLINKS_NOREGVOTES . "<br></td></tr>\n"; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
$x = 0; |
361
|
|
|
$colorswitch = '#DDDDDD'; |
362
|
|
|
|
363
|
|
|
while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp)=$xoopsDB->fetchRow($result5)) { |
364
|
|
|
// $ratingtimestamp = formatTimestamp($ratingtimestamp); |
|
|
|
|
365
|
|
|
//Individual user information |
366
|
|
|
//v3.11 changed to let SQL do calculations instead of PHP |
367
|
|
|
$result2 = $xoopsDB->query('SELECT COUNT(), FORMAT(AVG(rating),2) FROM ' . $xoopsDB->prefix('mylinks_votedata') . " WHERE ratinguser = '$ratinguser'"); |
368
|
|
|
list($uservotes, $useravgrating) = $xoopsDB->fetchRow($result2); |
369
|
|
|
// $useravgrating = ($rating2) ? sprintf("%01.2f", ($useravgrating / $uservotes)) : 0; |
|
|
|
|
370
|
|
|
/* |
371
|
|
|
$result2=$xoopsDB->query("SELECT rating FROM ".$xoopsDB->prefix("mylinks_votedata")." WHERE ratinguser = '$ratinguser'"); |
372
|
|
|
$uservotes = $xoopsDB->getRowsNum($result2); |
373
|
|
|
$useravgrating = 0; |
374
|
|
|
while ( list($rating2) = $xoopsDB->fetchRow($result2) ) { |
375
|
|
|
$useravgrating = $useravgrating + $rating2; |
376
|
|
|
} |
377
|
|
|
$useravgrating = sprintf("%01.2f", ($useravgrating / $uservotes)); |
378
|
|
|
*/ |
379
|
|
|
$ratingusername = XoopsUser::getUnameFromId($ratinguser); |
380
|
|
|
echo " <tr>\n" |
381
|
|
|
." <td style='background-color: {$colorswitch};'>{$ratingusername}</td>\n" |
382
|
|
|
." <td style='background-color: {$colorswitch};'>{$ratinghostname}</td>\n" |
383
|
|
|
." <td style='background-color: {$colorswitch};'>{$rating}</td>\n" |
384
|
|
|
." <td style='background-color: {$colorswitch};'>{$useravgrating}</td>\n" |
385
|
|
|
." <td style='background-color: {$colorswitch};'>{$uservotes}</td>\n" |
386
|
|
|
." <td style='background-color: {$colorswitch};'>{$ratingtimestamp}</td>\n" |
387
|
|
|
." <td style='background-color: {$colorswitch}; text-align: center; font-weight: bold;'>\n" |
388
|
|
|
." <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X'></form>\n" |
389
|
|
|
." </td>\n" |
390
|
|
|
." </tr>\n"; |
391
|
|
|
$x++; |
392
|
|
|
$colorswitch = ($colorswitch == '#DDDDDD') ? '#FFFFFF' : '#DDDDDD'; |
393
|
|
|
} |
394
|
|
|
// Show Unregistered Users Votes |
395
|
|
|
$result5=$xoopsDB->query('SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM ' . $xoopsDB->prefix('mylinks_votedata') . " WHERE lid ='{$lid}' AND ratinguser='0' ORDER BY ratingtimestamp DESC"); |
396
|
|
|
$votes = $xoopsDB->getRowsNum($result5); |
397
|
|
|
echo " <tr><td colspan='7' style='font-weight: bold;'><br><br>" . sprintf(_MD_MYLINKS_ANONTOTALVOTES , $votes) . "<br><br></td></tr>\n" |
398
|
|
|
." <tr>\n" |
399
|
|
|
." <th colspan='2'>" . _MD_MYLINKS_IP . " </th>\n" |
400
|
|
|
." <th colspan='3' style='font-weight: bold;'>" . _MD_MYLINKS_RATING . " </th>\n" |
401
|
|
|
." <th style='font-weight: bold;'>" . _MD_MYLINKS_DATE . " </th>\n" |
402
|
|
|
." <th style='text-align: center; font-weight: bold;'>" . _DELETE . "<br></th>\n" |
403
|
|
|
." </tr>\n"; |
404
|
|
|
if ( 0 == $votes ) { |
405
|
|
|
echo " <tr><td colspan='7' style='text-align: center;'>" . _MD_MYLINKS_NOUNREGVOTES . "<br></td></tr>\n"; |
406
|
|
|
} |
407
|
|
|
$x = 0; |
408
|
|
|
$colorswitch = '#DDDDDD'; |
409
|
|
|
while ( list($ratingid, $rating, $ratinghostname, $ratingtimestamp)=$xoopsDB->fetchRow($result5) ) { |
410
|
|
|
$formatted_date = formatTimestamp($ratingtimestamp); |
411
|
|
|
echo " <tr>\n" |
412
|
|
|
." <td colspan='2' style='background-color: {$colorswitch}'>{$ratinghostname}</td>\n" |
413
|
|
|
." <td colspan='3' style='background-color: {$colorswitch}'>{$rating}</td>\n" |
414
|
|
|
." <td style='background-color: {$colorswitch}'>{$formatted_date}</td>\n" |
415
|
|
|
." <td style='background-color: {$colorswitch} text-align: center; font-weight: bold;'>\n" |
416
|
|
|
." <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X'></form>\n" |
417
|
|
|
. ' </td>' |
418
|
|
|
. ' </tr>'; |
419
|
|
|
$x++; |
420
|
|
|
$colorswitch = ($colorswitch == '#DDDDDD') ? '#FFFFFF' : '#DDDDDD'; |
421
|
|
|
} |
422
|
|
|
echo " <tr><td colspan='7'> <br></td></tr>\n" |
423
|
|
|
." </table>\n" |
424
|
|
|
." </td>\n" |
425
|
|
|
." </tr>\n" |
426
|
|
|
."</table>\n"; |
427
|
|
|
include 'admin_footer.php'; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
function delVote() |
|
|
|
|
431
|
|
|
{ |
432
|
|
|
global $xoopsDB; |
|
|
|
|
433
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
434
|
|
|
$rid = mylinksUtility::mylinks_cleanVars($_POST, 'rid', 0, 'int', array('min'=>0)); |
|
|
|
|
435
|
|
|
|
436
|
|
|
$sql = sprintf('DELETE FROM %s WHERE ratingid = %u', $xoopsDB->prefix('mylinks_votedata'), $rid); |
437
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
438
|
|
|
if (!result) { |
439
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
440
|
|
|
exit(); |
|
|
|
|
441
|
|
|
} |
442
|
|
|
updaterating($lid); |
|
|
|
|
443
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_VOTEDELETED); |
444
|
|
|
exit(); |
|
|
|
|
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
function listBrokenLinks() |
|
|
|
|
448
|
|
|
{ |
449
|
|
|
global $xoopsDB, $xoopsModule, $pathIcon16, $myts; |
|
|
|
|
450
|
|
|
|
451
|
|
|
$result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('mylinks_broken') . ' GROUP BY lid ORDER BY reportid DESC'); |
452
|
|
|
$totalBrokenLinks = $xoopsDB->getRowsNum($result); |
453
|
|
|
xoops_cp_header(); |
454
|
|
|
|
455
|
|
|
$indexAdmin = new ModuleAdmin(); |
456
|
|
|
echo $indexAdmin->addNavigation('main.php?op=listBrokenLinks'); |
457
|
|
|
$GLOBALS['xoTheme']->addStylesheet(mylinksGetStylePath('mylinks.css', 'include')); |
458
|
|
|
// echo "<link rel='stylesheet' href='" . $GLOBALS['xoops']->url('browse.php?modules/mylinks/include/mylinks.css') . "' type='text/css'>"; |
|
|
|
|
459
|
|
|
|
460
|
|
|
echo "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
461
|
|
|
. ' <tr><th>' . sprintf(_MD_MYLINKS_BROKENREPORTS, $totalBrokenLinks) . "<br></th></tr>\n" |
462
|
|
|
. " <tr class='odd'><td>\n"; |
463
|
|
|
|
464
|
|
|
if ( 0 == $totalBrokenLinks ) { |
465
|
|
|
echo " <span class='italic bold'>" . _MD_MYLINKS_NOBROKEN . '</span>'; |
466
|
|
|
} else { |
467
|
|
|
$colorswitch = '#DDDDDD'; |
468
|
|
|
echo "<img src='{$pathIcon16}/on.png' alt='" ._MD_MYLINKS_IGNOREDESC . "'> = "._MD_MYLINKS_IGNOREDESC . '<br>' |
469
|
|
|
. "<img src='{$pathIcon16}/edit.png' alt='" . _EDIT . "'> = " . _MD_MYLINKS_EDITDESC . '<br>' |
470
|
|
|
. "<img src='{$pathIcon16}/delete.png' alt='" . _DELETE . "'> = ". _MD_MYLINKS_DELETEDESC . '<br>' |
471
|
|
|
. " <table class='center width100'>\n" |
472
|
|
|
// ." <tr><th colspan='6'>" . _MD_MYLINKS_DELETEDESC . "</th><tr>" |
473
|
|
|
. " <tr>\n" |
474
|
|
|
. ' <th>' . _MD_MYLINKS_LINKNAME . "</th>\n" |
475
|
|
|
. ' <th>' . _MD_MYLINKS_REPORTER . "</th>\n" |
476
|
|
|
. ' <th>' . _MD_MYLINKS_LINKSUBMITTER . "</th>\n" |
477
|
|
|
. ' <th>' . _MD_MYLINKS_ACTIONS . "</th>\n" |
478
|
|
|
. " </tr>\n"; |
479
|
|
|
|
480
|
|
|
$formToken = $GLOBALS['xoopsSecurity']->getTokenHTML(); |
481
|
|
|
|
482
|
|
|
while ( list($reportid, $lid, $sender, $ip)=$xoopsDB->fetchRow($result) ) { |
483
|
|
|
$result2 = $xoopsDB->query('SELECT title, url, submitter FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE lid={$lid}"); |
484
|
|
|
if ( 0 != $sender ) { |
485
|
|
|
$result3 = $xoopsDB->query('SELECT uname, email FROM ' . $xoopsDB->prefix('users') . " WHERE uid={$sender}"); |
486
|
|
|
list($uname, $email) = $xoopsDB->fetchRow($result3); |
487
|
|
|
} |
488
|
|
|
list($title, $url, $ownerid) = $xoopsDB->fetchRow($result2); |
489
|
|
|
$title = $myts->stripSlashesGPC($title); |
490
|
|
|
// $url=urldecode($url); |
|
|
|
|
491
|
|
|
$result4 = $xoopsDB->query('SELECT uname, email FROM ' . $xoopsDB->prefix('users') . " WHERE uid='{$ownerid}'"); |
492
|
|
|
list($owner, $owneremail) = $xoopsDB->fetchRow($result4); |
493
|
|
|
echo " <tr>\n" |
494
|
|
|
." <td style='background-color: {$colorswitch}'><a href=$url target='_blank'>{$title}</a></td>\n"; |
495
|
|
|
if ( $email=='' ) { |
496
|
|
|
echo " <td style='background-color: {$colorswitch};'>{$sender} ({$ip})"; |
497
|
|
|
} else { |
498
|
|
|
echo " <td style='background-color: {$colorswitch};'><a href='mailto:{$email}'>{$uname}</a> ({$ip})"; |
|
|
|
|
499
|
|
|
} |
500
|
|
|
echo " </td>\n"; |
501
|
|
|
if ( '' == $owneremail ) { |
502
|
|
|
echo " <td style='background-color: {$colorswitch};'>{$owner}"; |
503
|
|
|
} else { |
504
|
|
|
echo " <td style='background-color: {$colorswitch};'><a href='mailto:{$owneremail}'>{$owner}</a>\n"; |
505
|
|
|
} |
506
|
|
|
echo " <td style='text-align: center; background-color: {$colorswitch};'>\n" |
507
|
|
|
// ." <a href='main.php?op=ignoreBrokenLinks&lid={$lid}'><img src=". $pathIcon16 ."/on.png alt='" . _AM_MYLINKS_IGNORE . "' title='" . _AM_MYLINKS_IGNORE . "'></a>\n" |
508
|
|
|
// ." <a href='main.php?op=modLink&lid={$lid}&bknrptid={$reportid}'><img src=". $pathIcon16 ."/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>\n" |
509
|
|
|
// ." <a href='main.php?op=delBrokenLinks&lid={$lid}'><img src=". $pathIcon16 ."/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>\n" |
510
|
|
|
. " <form class='inline' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\n" |
511
|
|
|
. " <input type='hidden' name='op' value='ignoreBrokenLinks'>\n" |
512
|
|
|
. " <input type='hidden' name='bknrptid' value='{$reportid}'>\n" |
513
|
|
|
. " {$formToken}\n" |
514
|
|
|
. " <input type='button' title='" . _MD_MYLINKS_IGNOREDESC . "' alt='" . _AM_MYLINKS_IGNORE . "' id='image-button-on' onclick='this.form.submit();'>\n" |
515
|
|
|
. " </form>\n" |
516
|
|
|
. " <form class='inline' action='" . $_SERVER['PHP_SELF'] . "'?op=modLink&lid={$lid} method='get'>\n" |
517
|
|
|
. " <input type='hidden' name='op' value='modLink'>\n" |
518
|
|
|
. " <input type='hidden' name='bknrptid' value='{$reportid}'>\n" |
519
|
|
|
. " <input type='hidden' name='lid' value={$lid}>\n" |
520
|
|
|
. " <input type='button' title='" . _MD_MYLINKS_EDITDESC . "' alt='" . _EDIT . "' id='image-button-edit' onclick='this.form.submit();'>\n" |
521
|
|
|
. " </form>\n" |
522
|
|
|
. " <form class='inline' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\n" |
523
|
|
|
. " <input type='hidden' name='op' value='delBrokenLinks'>\n" |
524
|
|
|
. " <input type='hidden' name='lid' value='{$lid}'>\n" |
525
|
|
|
. " {$formToken}\n" |
526
|
|
|
. " <input type='button' title='" . _MD_MYLINKS_DELETEDESC . "' alt='" . _DELETE . "' id='image-button-delete' onclick='this.form.submit();'>\n" |
527
|
|
|
. " </form>\n" |
528
|
|
|
. " </td>\n" |
529
|
|
|
. " </tr>\n"; |
530
|
|
|
|
531
|
|
|
$colorswitch = ($colorswitch == '#DDDDDD') ? '#FFFFFF' : '#DDDDDD'; |
532
|
|
|
} |
533
|
|
|
echo " </table>\n"; |
534
|
|
|
} |
535
|
|
|
|
536
|
|
|
echo '</td></tr></table>'; |
537
|
|
|
include 'admin_footer.php'; |
538
|
|
|
} |
539
|
|
|
|
540
|
|
|
function delBrokenLinks() |
|
|
|
|
541
|
|
|
{ |
542
|
|
|
global $xoopsDB; |
|
|
|
|
543
|
|
|
|
544
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
545
|
|
|
|
546
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid = %u', $xoopsDB->prefix('mylinks_broken'), $lid); |
547
|
|
|
$result = $xoopsDB->queryF($sql); |
|
|
|
|
548
|
|
|
if (!result) { |
549
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NOBROKEN); |
|
|
|
|
550
|
|
|
exit(); |
|
|
|
|
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid = %u', $xoopsDB->prefix('mylinks_links'), $lid); |
554
|
|
|
$result = $xoopsDB->queryF($sql); |
|
|
|
|
555
|
|
|
if (!result) { |
556
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
557
|
|
|
} else { |
558
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_LINKDELETED); |
|
|
|
|
559
|
|
|
} |
560
|
|
|
exit(); |
|
|
|
|
561
|
|
|
} |
562
|
|
|
|
563
|
|
View Code Duplication |
function ignoreBrokenLinks() |
|
|
|
|
564
|
|
|
{ |
565
|
|
|
global $xoopsDB; |
|
|
|
|
566
|
|
|
|
567
|
|
|
$bknrptid = mylinksUtility::mylinks_cleanVars($_POST, 'bknrptid', 0, 'int', array('min'=>0)); |
|
|
|
|
568
|
|
|
$sql = sprintf('DELETE FROM %s WHERE reportid = %u', $xoopsDB->prefix('mylinks_broken'), $bknrptid); |
569
|
|
|
$result = $xoopsDB->queryF($sql); |
|
|
|
|
570
|
|
|
if (!result) { |
571
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
572
|
|
|
} else { |
573
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_BROKENDELETED); |
|
|
|
|
574
|
|
|
} |
575
|
|
|
exit(); |
|
|
|
|
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
function listModReq() |
579
|
|
|
{ |
580
|
|
|
global $xoopsDB, $myts, $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
581
|
|
|
|
582
|
|
|
$result = $xoopsDB->query('SELECT requestid, lid, cid, title, url, logourl, description, modifysubmitter FROM ' . $xoopsDB->prefix('mylinks_mod') . ' ORDER BY requestid'); |
583
|
|
|
$totalModRequests = $xoopsDB->getRowsNum($result); |
584
|
|
|
xoops_cp_header(); |
585
|
|
|
$indexAdmin = new ModuleAdmin(); |
586
|
|
|
echo $indexAdmin->addNavigation('main.php?op=listModReq'); |
587
|
|
|
|
588
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
589
|
|
|
|
590
|
|
|
//echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>\n"; |
591
|
|
|
echo "<table class='outer' style='width: 100%; border-weight: 0px; margin: 1px;'>\n" |
592
|
|
|
." <tr class='even'><th>" . sprintf(_MD_MYLINKS_MODREQUESTS, $totalModRequests) . "</th></tr>\n" |
593
|
|
|
." <tr class='odd'>\n" |
594
|
|
|
." <td>\n"; |
595
|
|
|
if ( $totalModRequests > 0 ) { |
596
|
|
|
echo " <table style='width: 95%;'>\n" |
597
|
|
|
." <tr>\n" |
598
|
|
|
." <td>\n"; |
599
|
|
|
$lookup_lid = array(); |
600
|
|
|
while ( list($requestid, $lid, $cid, $title, $url, $logourl, $description, $submitterid)=$xoopsDB->fetchRow($result) ) { |
601
|
|
|
$catObj = $mylinksCatHandler->get($cid); |
602
|
|
|
$lookup_lid[$requestid] = $lid; |
603
|
|
|
$result2 = $xoopsDB->query('SELECT cid, title, url, logourl, submitter FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE lid='{$lid}'"); |
604
|
|
|
list($origcid, $origtitle, $origurl, $origlogourl, $ownerid)=$xoopsDB->fetchRow($result2); |
605
|
|
|
$origCatObj = $mylinksCatHandler->get($origcid); |
606
|
|
|
$result2 = $xoopsDB->query('SELECT description FROM ' . $xoopsDB->prefix('mylinks_text') . " WHERE lid='{$lid}'"); |
607
|
|
|
list($origdescription) = $xoopsDB->fetchRow($result2); |
608
|
|
|
$result7 = $xoopsDB->query('SELECT uname, email FROM ' . $xoopsDB->prefix('users') . " WHERE uid='{$submitterid}'"); |
609
|
|
|
$result8 = $xoopsDB->query('SELECT uname, email FROM ' . $xoopsDB->prefix('users') . " WHERE uid='{$ownerid}'"); |
610
|
|
|
$cidtitle = $catObj->getVar('title'); |
611
|
|
|
$cidtitle = $myts->htmlSpecialChars($cidtitle); |
612
|
|
|
$origcidtitle = $origCatObj->getVar('title'); |
613
|
|
|
$origcidtitle = $myts->htmlSpecialChars($origcidtitle); |
614
|
|
|
/* |
|
|
|
|
615
|
|
|
$cidtitle = $catObj->getPathFromID(); |
616
|
|
|
$origcidtitle = $origCatObj->getPathFromID(); |
617
|
|
|
*/ |
618
|
|
|
list($submitter, $submitteremail) = $xoopsDB->fetchRow($result7); |
619
|
|
|
list($owner, $owneremail) = $xoopsDB->fetchRow($result8); |
620
|
|
|
$title = $myts->htmlSpecialChars($title); |
621
|
|
|
$url = $myts->htmlSpecialChars($url); |
622
|
|
|
//$url = urldecode($url); |
|
|
|
|
623
|
|
|
|
624
|
|
|
// use original image file to prevent users from changing screen shots file |
625
|
|
|
$origlogourl = $myts->htmlSpecialChars($origlogourl); |
626
|
|
|
$logourl = $origlogourl; |
627
|
|
|
|
628
|
|
|
//$logourl = urldecode($logourl); |
|
|
|
|
629
|
|
|
$description = $myts->displayTarea($myts->stripSlashesGPC($description), 0); |
630
|
|
|
$origurl = $myts->htmlSpecialChars($origurl); |
631
|
|
|
//$origurl = urldecode($origurl); |
|
|
|
|
632
|
|
|
//$origlogourl = urldecode($origlogourl); |
|
|
|
|
633
|
|
|
$origdescription = $myts->displayTarea($myts->stripSlashesGPC($origdescription), 0); |
634
|
|
|
$owner = ( '' == $owner ) ? 'administration' : $owner; |
635
|
|
|
echo " <table style='border-width: 1px; border-color: black; padding: 5px; margin: auto; text-align: center; width: 800px;'>\n" |
636
|
|
|
." <tr><td>\n" |
637
|
|
|
." <table style='width: 100%; background-color: #DDDDDD'>\n" |
638
|
|
|
." <tr>\n" |
639
|
|
|
." <td style='vertical-align: top; width: 45%; font-weight: bold;'>" . _MD_MYLINKS_ORIGINAL . "</td>\n" |
640
|
|
|
." <td rowspan='14' style='vertical-align: top; text-align: left; font-size: small;'><br>" . _MD_MYLINKS_DESCRIPTIONC . "<br>{$origdescription}</td>\n" |
641
|
|
|
." </tr>\n" |
642
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SITETITLE . "{$myts->stripSlashesGPC($origtitle)}</td></tr>\n" |
643
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SITEURL . "{$origurl}</td></tr>\n" |
644
|
|
|
." <tr><td style='vertical-align= top; width: 45%; font-size: small;'>" . _MD_MYLINKS_CATEGORYC . "{$origcidtitle}</td></tr>\n" |
645
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SHOTIMAGE . ''; |
646
|
|
View Code Duplication |
if ( $xoopsModuleConfig['useshots'] && !empty($origlogourl) ) { |
|
|
|
|
647
|
|
|
echo "<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/images/shots/{$origlogourl}' style='width: " . $xoopsModuleConfig['shotwidth'] . ";'>"; |
648
|
|
|
} else { |
649
|
|
|
echo ' '; |
650
|
|
|
} |
651
|
|
|
echo "</td></tr>\n" |
652
|
|
|
." </table>\n" |
653
|
|
|
." </td></tr>\n" |
654
|
|
|
." <tr><td>\n" |
655
|
|
|
." <table style='width: 100%; background-color: #DDDDDD'>\n" |
656
|
|
|
." <tr>\n" |
657
|
|
|
." <td style='vertical-align: top; width: 45%; font-weight: bold;'>" . _MD_MYLINKS_PROPOSED . "</td>\n" |
658
|
|
|
." <td rowspan='14' style='vertical-align: top; text-align: left; font-size: small;'><br>" . _MD_MYLINKS_DESCRIPTIONC . "<br>{$description}</td>\n" |
659
|
|
|
." </tr>\n" |
660
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SITETITLE . "{$title}</td></tr>\n" |
661
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SITEURL . "{$url}</td></tr>\n" |
662
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_CATEGORYC . "{$cidtitle}</td></tr>\n" |
663
|
|
|
." <tr><td style='vertical-align: top; width: 45%; font-size: small;'>" . _MD_MYLINKS_SHOTIMAGE . ''; |
664
|
|
View Code Duplication |
if ( $xoopsModuleConfig['useshots'] == 1 && !empty($logourl) ) { |
|
|
|
|
665
|
|
|
echo "<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/images/shots/{$logourl}' style='width: " . $xoopsModuleConfig['shotwidth'] . ";' alt='{$title}'>"; |
666
|
|
|
} else { |
667
|
|
|
echo ' '; |
668
|
|
|
} |
669
|
|
|
echo "</td></tr>\n" |
670
|
|
|
." </table>\n" |
671
|
|
|
." </td></tr>\n" |
672
|
|
|
." </table>\n" |
673
|
|
|
." <table style='text-align: center; width: 800px; margin: auto;'>\n" |
674
|
|
|
." <tr>\n"; |
675
|
|
|
if ( '' == $submitteremail ) { |
676
|
|
|
echo " <td style='text-align: center; font-weight: bold;'>" . _MD_MYLINKS_SUBMITTER . "{$submitter}</td>\n"; |
677
|
|
|
} else { |
678
|
|
|
echo " <td style='text-align: center; font-size: small;'>" . _MD_MYLINKS_SUBMITTER . "<a href='mailto:{$submitteremail}'>{$submitter}</a></td>\n"; |
679
|
|
|
} |
680
|
|
|
if ( '' == $owneremail ) { |
681
|
|
|
echo " <td style='text-align: center; font-size: small;'>" . _MD_MYLINKS_OWNER . "{$owner}</td>\n"; |
682
|
|
|
} else { |
683
|
|
|
echo " <td style='text-align: center; font-size: small;'>" . _MD_MYLINKS_OWNER . "<a href='mailto:{$owneremail}'>{$owner}</a></td>\n"; |
684
|
|
|
} |
685
|
|
|
echo " <td style='text-align: center; font-size: small;'>\n" |
686
|
|
|
// ." <form style='display: inline; margin-right: 1.5em;' action='main.php?op=changeModReq&requestid={$requestid}' method='get'>\n" |
687
|
|
|
." <form style='display: inline; margin-right: 1.5em;' action='main.php' method='post'>\n" |
688
|
|
|
." <input type='hidden' name='op' value='changeModReq'>\n" |
689
|
|
|
." <input type='hidden' name='requestid' value='{$requestid}'>\n" |
690
|
|
|
." <input type='submit' value='" . _MD_MYLINKS_APPROVE . "'>\n" |
691
|
|
|
." </form>\n" |
692
|
|
|
// ." <form style='display: inline; margin-right: 1.5em;' action='main.php?op=modLink&lid={$lid}' method='get'>\n" |
693
|
|
|
." <form style='display: inline; margin-right: 1.5em;' action='main.php' method='get'>\n" |
694
|
|
|
." <input type='hidden' name='op' value='modLink'>\n" |
695
|
|
|
." <input type='hidden' name='lid' value='{$lid}'>\n" |
696
|
|
|
." <input type='submit' value='" . _EDIT . "'></form>\n" |
697
|
|
|
// ." <form style='display: inline;' action='main.php?op=ignoreModReq&requestid={$requestid}' method='post'><input type='submit' value='" . _MD_MYLINKS_IGNORE . "'></form>\n" |
698
|
|
|
." <form style='display: inline;' action='main.php' method='post'>\n" |
699
|
|
|
." <input type='hidden' name='op' value='ignoreModReq'>\n" |
700
|
|
|
." <input type='hidden' name='requestid' value='{$requestid}'>\n" |
701
|
|
|
." <input type='submit' value='" . _MD_MYLINKS_IGNORE . "'>\n" |
702
|
|
|
." </form>\n" |
703
|
|
|
." </td>\n" |
704
|
|
|
." </tr>\n" |
705
|
|
|
." </table><br><br>\n"; |
706
|
|
|
} |
707
|
|
|
echo ' </td></tr></table>'; |
708
|
|
|
} else { |
709
|
|
|
echo ' <em>' . _MD_MYLINKS_NOMODREQ . "</em>\n"; |
710
|
|
|
} |
711
|
|
|
echo " </td>\n" |
712
|
|
|
." </tr>\n" |
713
|
|
|
."</table>\n"; |
714
|
|
|
include 'admin_footer.php'; |
715
|
|
|
} |
716
|
|
|
|
717
|
|
|
function changeModReq() |
|
|
|
|
718
|
|
|
{ |
719
|
|
|
global $xoopsDB, $myts; |
|
|
|
|
720
|
|
|
|
721
|
|
|
$requestid = mylinksUtility::mylinks_cleanVars($_POST, 'requestid', 0, 'int', array('min'=>0)); |
|
|
|
|
722
|
|
|
$query = 'SELECT lid, cid, title, url, logourl, description FROM ' . $xoopsDB->prefix('mylinks_mod') . " WHERE requestid='{$requestid}'"; |
723
|
|
|
$result = $xoopsDB->query($query); |
724
|
|
|
while ( list($lid, $cid, $title, $url, $logourl, $description) = $xoopsDB->fetchRow($result) ) { |
725
|
|
|
|
726
|
|
|
$url = addslashes($url); |
727
|
|
|
$logourl = addslashes($logourl); |
728
|
|
|
$title = addslashes($title); |
729
|
|
|
$description = addslashes($description); |
730
|
|
|
|
731
|
|
|
$sql= sprintf("UPDATE %s SET cid = %u, title = '%s', url = '%s', logourl = '%s', status = 1, date = %u WHERE lid = %u", $xoopsDB->prefix('mylinks_links'), $cid, $title, $url, $logourl, time(), $lid); |
732
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
733
|
|
|
if (!result) { |
734
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
735
|
|
|
exit(); |
|
|
|
|
736
|
|
|
} else { |
737
|
|
|
$sql = sprintf("UPDATE %s SET description = '%s' WHERE lid = %u", $xoopsDB->prefix('mylinks_text'), $description, $lid); |
738
|
|
|
$result = $xoopsDB->query($sql); |
739
|
|
|
if (!$result) { |
740
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
741
|
|
|
exit(); |
|
|
|
|
742
|
|
|
} else { |
743
|
|
|
$sql = sprintf('DELETE FROM %s WHERE requestid = %u', $xoopsDB->prefix('mylinks_mod'), $requestid); |
744
|
|
|
$xoopsDB->query($sql); |
745
|
|
|
if (!result) { |
746
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
747
|
|
|
exit(); |
|
|
|
|
748
|
|
|
} |
749
|
|
|
} |
750
|
|
|
} |
751
|
|
|
} |
752
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_DBUPDATED); |
753
|
|
|
exit(); |
|
|
|
|
754
|
|
|
} |
755
|
|
|
|
756
|
|
View Code Duplication |
function ignoreModReq() |
|
|
|
|
757
|
|
|
{ |
758
|
|
|
global $xoopsDB; |
|
|
|
|
759
|
|
|
|
760
|
|
|
$requestid = mylinksUtility::mylinks_cleanVars($_POST, 'requestid', 0, 'int', array('min'=>0)); |
|
|
|
|
761
|
|
|
$sql = sprintf('DELETE FROM %s WHERE requestid = %u', $xoopsDB->prefix('mylinks_mod'), $requestid); |
762
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
763
|
|
|
if (!result) { |
764
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
765
|
|
|
} else { |
766
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_MODREQDELETED); |
|
|
|
|
767
|
|
|
} |
768
|
|
|
exit(); |
|
|
|
|
769
|
|
|
} |
770
|
|
|
|
771
|
|
|
function modLinkS() |
|
|
|
|
772
|
|
|
{ |
773
|
|
|
global $xoopsDB, $myts; |
|
|
|
|
774
|
|
|
|
775
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
776
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
777
|
|
|
$bknrptid = mylinksUtility::mylinks_cleanVars($_POST, 'bknrptid', 0, 'int', array('min'=>0)); |
|
|
|
|
778
|
|
|
$url = mylinksUtility::mylinks_cleanVars($_POST, 'url', '', 'string'); |
|
|
|
|
779
|
|
|
$logourl = mylinksUtility::mylinks_cleanVars($_POST, 'logourl', '', 'string'); |
|
|
|
|
780
|
|
|
$title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); |
|
|
|
|
781
|
|
|
$description = mylinksUtility::mylinks_cleanVars($_POST, 'description', '', 'string'); |
|
|
|
|
782
|
|
|
/* |
|
|
|
|
783
|
|
|
$url = $myts->addSlashes($url); |
784
|
|
|
$logourl = $myts->addSlashes($_POST['logourl']); |
785
|
|
|
$title = $myts->addSlashes($_POST['title']); |
786
|
|
|
$description = $myts->addSlashes($_POST['description']); |
787
|
|
|
*/ |
788
|
|
|
$xoopsDB->query('UPDATE ' . $xoopsDB->prefix('mylinks_links') . " SET cid='{$cid}', title='{$title}', url='{$url}', logourl='{$logourl}', status='2', date=" . time() . " WHERE lid='{$lid}'"); |
789
|
|
|
$result = $xoopsDB->query('UPDATE ' . $xoopsDB->prefix('mylinks_text') . " SET description='{$description}' where lid='{$lid}'"); |
|
|
|
|
790
|
|
|
if (!result) { |
791
|
|
|
redirect_header('main.php', 2, _MD_MYLINKS_DBNOTUPDATED); |
792
|
|
|
exit(); |
|
|
|
|
793
|
|
|
} |
794
|
|
|
if ($bknrptid) { |
795
|
|
|
// edit came after following link from a broken report, so delete broken report too |
796
|
|
|
$sql = sprintf('DELETE FROM %s WHERE reportid = %u', $xoopsDB->prefix('mylinks_broken'), $bknrptid); |
797
|
|
|
$result = $xoopsDB->query($sql); |
798
|
|
|
if (!$result) { |
799
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
800
|
|
|
exit(); |
|
|
|
|
801
|
|
|
} |
802
|
|
|
} |
803
|
|
|
redirect_header('index.php', 1, _MD_MYLINKS_DBUPDATED); |
804
|
|
|
exit(); |
|
|
|
|
805
|
|
|
} |
806
|
|
|
|
807
|
|
|
function delLink() |
|
|
|
|
808
|
|
|
{ |
809
|
|
|
global $xoopsDB, $xoopsModule; |
|
|
|
|
810
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
811
|
|
|
|
812
|
|
|
$dbTables = array( 'links', 'text', 'votedata', 'broken', 'mod' ); |
813
|
|
View Code Duplication |
foreach ($dbTables as $thisTable) { |
|
|
|
|
814
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid = %u', $xoopsDB->prefix("mylinks_{$thisTable}"), $lid); |
815
|
|
|
$result = $xoopsDB->query($sql); |
816
|
|
|
if (!$result) { |
817
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
818
|
|
|
exit(); |
|
|
|
|
819
|
|
|
} |
820
|
|
|
} |
821
|
|
|
// delete comments & notifications |
822
|
|
|
xoops_comment_delete($xoopsModule->getVar('mid'), $lid); |
823
|
|
|
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $lid); |
824
|
|
|
|
825
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_LINKDELETED); |
826
|
|
|
exit(); |
|
|
|
|
827
|
|
|
} |
828
|
|
|
|
829
|
|
|
function modCat() |
|
|
|
|
830
|
|
|
{ |
831
|
|
|
global $xoopsDB, $myts, $xoopsModule; |
|
|
|
|
832
|
|
|
|
833
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
834
|
|
|
xoops_cp_header(); |
835
|
|
|
|
836
|
|
|
echo '<h4>' . _MD_MYLINKS_WEBLINKSCONF . "</h4>\n" |
837
|
|
|
. "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" |
838
|
|
|
. ' <tr><th>' . _MD_MYLINKS_MODCAT . "<br></th></tr>\n" |
839
|
|
|
. " <tr class='odd'>\n" |
840
|
|
|
. " <td>\n"; |
841
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
842
|
|
|
$catObj = $mylinksCatHandler->get($cid); |
843
|
|
|
|
844
|
|
|
if (isset($catObj) && is_object($catObj)) { |
845
|
|
|
$criteria = new CriteriaCompo(); |
846
|
|
|
$criteria->add(new Criteria('cid', $cid, '!=')); |
847
|
|
|
$catListObjs = $mylinksCatHandler->getAll($criteria); |
848
|
|
|
$catListTree = new XoopsObjectTree($catListObjs, 'cid', 'pid'); |
849
|
|
|
|
850
|
|
|
$title = $myts->htmlSpecialChars($catObj->getVar('title')); |
851
|
|
|
$imgurl = $myts->htmlSpecialChars($catObj->getVar('imgurl'),'n'); |
852
|
|
|
$pid = $catObj->getVar('pid'); |
853
|
|
|
echo " <form action='main.php' method='post'>" . _MD_MYLINKS_TITLEC . "\n" |
854
|
|
|
." <input type='text' name='title' value='{$title}' size='51' maxlength='50'>\n" |
855
|
|
|
." <br><br>\n"; |
856
|
|
|
if ( 0 == $catObj->getVar('pid') ) { |
857
|
|
|
echo ' ' . _MD_MYLINKS_IMGURLMAIN . "<br>\n" |
858
|
|
|
. " <input type='text' name='imgurl' value='{$imgurl}' size='100' maxlength='150'>\n" |
859
|
|
|
. " <br><br>\n"; |
860
|
|
|
} |
861
|
|
|
echo ' ' . _MD_MYLINKS_PARENT . " \n" |
862
|
|
|
. ' ' . $catListTree->makeSelBox('pid', 'title', '- ', $pid, true) . "\n" |
863
|
|
|
. " <br>\n" |
864
|
|
|
. " <input type='hidden' name='cid' value='{$cid}'>\n" |
865
|
|
|
. " <input type='hidden' name='op' value='modCatS'><br>\n" |
866
|
|
|
. " <input type='submit' value='" . _MD_MYLINKS_SAVE . "'>\n" |
867
|
|
|
. " <input type='button' value='" . _DELETE . "' onclick=\"location='main.php?pid={$pid}&cid={$cid}&op=delCat'\"> \n" |
868
|
|
|
. " <input type='button' value='" . _CANCEL . "' onclick=\"javascript:history.go(-1)\">\n" |
869
|
|
|
. " </form>\n"; |
870
|
|
|
} else { |
871
|
|
|
echo ' <tr><td>' . _MD_MYLINKS_CIDERROR . "</td></tr>\n" |
872
|
|
|
. " <tr><td><input type='button' value='" . _BACK . "' onclick=\"javascript:history.go(-1)\"></td></tr>\n"; |
873
|
|
|
} |
874
|
|
|
echo " </td>\n" |
875
|
|
|
." </tr>\n" |
876
|
|
|
."</table>\n"; |
877
|
|
|
include 'admin_footer.php'; |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
function modCatS() |
|
|
|
|
881
|
|
|
{ |
882
|
|
|
global $xoopsDB, $myts, $xoopsModule; |
|
|
|
|
883
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
884
|
|
|
$imgurl = mylinksUtility::mylinks_cleanVars($_POST, 'imgurl', '', 'string'); |
|
|
|
|
885
|
|
|
$title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); |
|
|
|
|
886
|
|
|
// $title = $myts->addSlashes($title); |
|
|
|
|
887
|
|
|
|
888
|
|
|
if (empty($title)) { |
889
|
|
|
redirect_header('index.php', 3, _MD_MYLINKS_ERRORTITLE); |
890
|
|
|
} |
891
|
|
|
|
892
|
|
|
// $imgurl = $myts->addSlashes($imgurl); |
|
|
|
|
893
|
|
|
$updateInfo = array ( |
894
|
|
|
'pid' => intval($_POST['pid']), |
895
|
|
|
// 'title' => $myts->addSlashes($_POST['title']), |
|
|
|
|
896
|
|
|
'title' => $title, |
897
|
|
|
'imgurl' => $imgurl |
898
|
|
|
); |
899
|
|
|
|
900
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
901
|
|
|
$catObj = $mylinksCatHandler->get($cid); |
902
|
|
|
|
903
|
|
|
if (isset($catObj) && is_object($catObj)) { |
904
|
|
|
$catObj->setVars($updateInfo); |
905
|
|
|
$result = $mylinksCatHandler->insert($catObj); |
906
|
|
|
} else { |
907
|
|
|
$result = false; |
908
|
|
|
} |
909
|
|
|
|
910
|
|
|
if (!$result) { |
911
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_DBNOTUPDATED); |
|
|
|
|
912
|
|
|
exit(); |
|
|
|
|
913
|
|
|
} else { |
914
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_DBUPDATED); |
915
|
|
|
} |
916
|
|
|
} |
917
|
|
|
|
918
|
|
|
function delCat() |
|
|
|
|
919
|
|
|
{ |
920
|
|
|
global $xoopsDB, $myCatTree, $xoopsModule, $xoopsUser; |
|
|
|
|
921
|
|
|
|
922
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_REQUEST, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
923
|
|
|
$ok = mylinksUtility::mylinks_cleanVars($_POST, 'ok', 0, 'int', array('min'=>0, 'max'=>1)); |
|
|
|
|
924
|
|
|
|
925
|
|
|
if ( 1 == $ok ) { |
926
|
|
|
/** |
927
|
|
|
* nickname code: |
928
|
|
|
* |
929
|
|
|
* get all subcategories |
930
|
|
|
* get all links in these categories/subcategories |
931
|
|
|
* get all links in category & subcategories |
932
|
|
|
* delete all links in links, text, votedata, broken, & mod db tables that are in any of these categories |
933
|
|
|
* delete all comments and notifications for the links that have been deleted |
934
|
|
|
* delete category and all subcategories from category db table |
935
|
|
|
* delete all notifications for the categories that have been deleted |
936
|
|
|
*/ |
937
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
938
|
|
|
|
939
|
|
|
//get all subcategories under the specified category |
940
|
|
|
$catObjArr = $myCatTree->getAllChild($cid); |
941
|
|
|
$cidArray = array(); |
942
|
|
|
foreach ($catObjArr as $catObj) { |
943
|
|
|
$cidArray[] = $catObj->getVar('cid'); |
944
|
|
|
} |
945
|
|
|
|
946
|
|
|
array_push($cidArray, $cid); //add this category id to the array |
947
|
|
|
$catIDs = implode(',', $cidArray); |
948
|
|
|
$criteria = new CriteriaCompo(); |
949
|
|
|
$criteria->add(new Criteria('cid', '(' . intval($cid) . ',' . $catIDs . ')', 'IN')); |
950
|
|
|
|
951
|
|
|
// get list ids in any of these categories |
952
|
|
|
$sql = sprintf('SELECT lid FROM %s WHERE cid IN %s', $xoopsDB->prefix('mylinks_links'), "({$catIDs})"); |
953
|
|
|
$result = $xoopsDB->query($sql); |
954
|
|
|
if (!$result) { |
955
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
956
|
|
|
exit(); |
|
|
|
|
957
|
|
|
} |
958
|
|
|
$lidArray = $xoopsDB->fetchArray($result); |
959
|
|
|
|
960
|
|
|
// delete any links, link notifications and link comments from the database tables |
961
|
|
|
if ( $lidArray ) { |
962
|
|
|
$linkIDs = '(' . implode(',', $lidArray) . ')'; |
963
|
|
|
$dbTables = array( 'links', 'text', 'votedata', 'broken', 'mod' ); |
964
|
|
View Code Duplication |
foreach ($dbTables as $thisTable) { |
|
|
|
|
965
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid IN %s', $xoopsDB->prefix("mylinks_{$thisTable}"), $linkIDs); |
966
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
967
|
|
|
if (!result) { |
968
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
969
|
|
|
exit(); |
|
|
|
|
970
|
|
|
} |
971
|
|
|
} |
972
|
|
|
// remove any notifications and comments for these listings |
973
|
|
|
foreach ($lidArray as $this_lid) { |
974
|
|
|
xoops_comment_delete($xoopsModule->getVar('mid'), $this_lid); |
975
|
|
|
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $this_lid); |
976
|
|
|
} |
977
|
|
|
} |
978
|
|
|
// delete category and all subcategories from database |
979
|
|
|
if (!$mylinksCatHandler->deleteAll($criteria)) { |
980
|
|
|
redirect_header('main.php', 2, _MD_MYLINKS_NORECORDFOUND); |
981
|
|
|
exit(); |
|
|
|
|
982
|
|
|
} |
983
|
|
|
|
984
|
|
|
// delete the notification settings for each (sub)category |
985
|
|
|
foreach( $cidArray as $key=>$id) { |
986
|
|
|
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $id); |
987
|
|
|
} |
988
|
|
|
|
989
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_CATDELETED); |
990
|
|
|
exit(); |
|
|
|
|
991
|
|
|
} else { |
992
|
|
|
xoops_cp_header(); |
993
|
|
|
xoops_confirm(array('op' => 'delCat', 'cid' => $cid, 'ok' => 1), 'main.php', _MD_MYLINKS_WARNING); |
994
|
|
|
include 'admin_footer.php'; |
995
|
|
|
} |
996
|
|
|
} |
997
|
|
|
|
998
|
|
|
function delNewLink() |
|
|
|
|
999
|
|
|
{ |
1000
|
|
|
global $xoopsDB, $xoopsModule; |
|
|
|
|
1001
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
1002
|
|
|
|
1003
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid = %u', $xoopsDB->prefix('mylinks_links'), $lid); |
1004
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
1005
|
|
|
if (!result) { |
1006
|
|
|
redirect_header('main.php', 2, _MD_MYLINKS_NORECORDFOUND); |
1007
|
|
|
exit(); |
|
|
|
|
1008
|
|
|
} |
1009
|
|
|
$sql = sprintf('DELETE FROM %s WHERE lid = %u', $xoopsDB->prefix('mylinks_text'), $lid); |
1010
|
|
|
$result = $xoopsDB->query($sql); |
1011
|
|
|
if (!$result) { |
1012
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1013
|
|
|
exit(); |
|
|
|
|
1014
|
|
|
} |
1015
|
|
|
// delete comments |
1016
|
|
|
xoops_comment_delete($xoopsModule->getVar('mid'), $lid); |
1017
|
|
|
// delete notifications |
1018
|
|
|
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $lid); |
1019
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_LINKDELETED); |
1020
|
|
|
} |
1021
|
|
|
|
1022
|
|
|
function addCat() |
|
|
|
|
1023
|
|
|
{ |
1024
|
|
|
global $xoopsDB, $myts, $xoopsModule; |
|
|
|
|
1025
|
|
|
$pid = mylinksUtility::mylinks_cleanVars($_POST, 'pid', 0, 'int', array('min'=>0)); |
|
|
|
|
1026
|
|
|
$title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); |
|
|
|
|
1027
|
|
|
$imgurl = mylinksUtility::mylinks_cleanVars($_POST, 'imgurl', '', 'string'); |
|
|
|
|
1028
|
|
|
/* |
|
|
|
|
1029
|
|
|
$title = $myts->addSlashes($title); |
1030
|
|
|
$imgurl = $myts->addSlashes($imgurl); |
1031
|
|
|
*/ |
1032
|
|
|
if (empty($title)) { |
1033
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_ERRORTITLE); |
1034
|
|
|
exit(); |
|
|
|
|
1035
|
|
|
} |
1036
|
|
|
|
1037
|
|
|
$newCatVars = array( |
1038
|
|
|
'pid' => $pid, |
1039
|
|
|
'title' => $title, |
1040
|
|
|
'imgurl' => $imgurl |
1041
|
|
|
); |
1042
|
|
|
|
1043
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
1044
|
|
|
$newCatObj = $mylinksCatHandler->create(); |
1045
|
|
|
$newCatObj->setVars($newCatVars); |
1046
|
|
|
$newCatId = $mylinksCatHandler->insert($newCatObj); |
1047
|
|
|
if ($newCatId) { |
1048
|
|
|
//now update notification handler & trigger new cat added event |
1049
|
|
|
$tags = array(); |
1050
|
|
|
$tags['CATEGORY_NAME'] = $title; |
1051
|
|
|
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $newCatId; |
1052
|
|
|
$notification_handler =& xoops_getHandler('notification'); |
1053
|
|
|
$notification_handler->triggerEvent('global', 0, 'new_category', $tags); |
1054
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_NEWCATADDED); |
1055
|
|
|
|
1056
|
|
|
} else { |
1057
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_DBNOTUPDATED); |
1058
|
|
|
} |
1059
|
|
|
} |
1060
|
|
|
function importCats() |
|
|
|
|
1061
|
|
|
{ |
1062
|
|
|
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts; |
|
|
|
|
1063
|
|
|
|
1064
|
|
|
$ok = mylinksUtility::mylinks_cleanVars($_POST, 'ok', 0, 'int', array('min'=>0, 'max'=>1)); |
|
|
|
|
1065
|
|
|
if ( 1 == $ok ) { |
1066
|
|
|
|
1067
|
|
|
if ( file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/sql/mylinks_cat.dat') ) { |
1068
|
|
|
$importFile = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/sql/mylinks_cat.dat'; |
1069
|
|
|
} else { |
1070
|
|
|
$importFile = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/sql/mylinks_cat.dat'; |
1071
|
|
|
} |
1072
|
|
|
|
1073
|
|
|
if ( file_exists($importFile) ) { |
1074
|
|
|
/* the following will not work on some shared servers even though it's the most efficient |
1075
|
|
|
$sql = "LOAD DATA INFILE '{$importFile}' INTO TABLE " . $xoopsDB->prefix('mylinks_cat') . " FIELDS TERMINATED BY ',' IGNORE 1 LINES"; |
1076
|
|
|
$result = $xoopsDB->query($sql); |
1077
|
|
|
*/ |
1078
|
|
|
|
1079
|
|
|
if (($handle = fopen($importFile, 'r')) !== FALSE) { |
1080
|
|
|
// set 1000 to 0 in the following line if input line is truncated |
1081
|
|
|
while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) { |
1082
|
|
|
$sql = sprintf("INSERT INTO %s (cid, pid, title, imgurl) VALUES (%u, %u, '%s', '%s')", $xoopsDB->prefix('mylinks_cat'), intval($data[0]), intval($data[1]), $myts->addSlashes($data[2]) , $myts->addSlashes($data[3])); |
1083
|
|
|
$result = $xoopsDB->query($sql); |
1084
|
|
|
if (!$result) { |
1085
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1086
|
|
|
exit(); |
|
|
|
|
1087
|
|
|
} |
1088
|
|
|
} |
1089
|
|
|
fclose($handle); |
1090
|
|
|
redirect_header('index.php' , 2 , _MD_MYLINKS_CATSIMPORTED); |
1091
|
|
|
} else { |
1092
|
|
|
// problem importing categories |
1093
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); |
1094
|
|
|
$result = $mylinksCatHandler->getAll(); |
1095
|
|
|
if (count($result)) { |
1096
|
|
|
$result = $mylinksCatHandler->deleteAll(); // empty the dB table from partial import |
|
|
|
|
1097
|
|
|
} |
1098
|
|
|
redirect_header('index.php' , 2, _MD_MYLINKS_CATSNOTIMPORTED); |
1099
|
|
|
} |
1100
|
|
|
} else { //exit somewhat gracefully if import file not found |
1101
|
|
|
redirect_header('index.php', 2, sprintf(_MD_MYLINKS_IMPORTFILENOTFOUND, $importFile)); |
1102
|
|
|
} |
1103
|
|
|
exit(); |
|
|
|
|
1104
|
|
|
} else { |
1105
|
|
|
xoops_cp_header(); |
1106
|
|
|
xoops_confirm(array('op' => 'importCats', 'ok' => 1), 'main.php', _MD_MYLINKS_CATWARNING); |
1107
|
|
|
include 'admin_footer.php'; |
1108
|
|
|
} |
1109
|
|
|
} |
1110
|
|
|
|
1111
|
|
|
function addLink() |
|
|
|
|
1112
|
|
|
{ |
1113
|
|
|
global $xoopsDB, $myts, $xoopsUser, $xoopsModule; |
|
|
|
|
1114
|
|
|
|
1115
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
1116
|
|
|
$url = mylinksUtility::mylinks_cleanVars($_POST, 'url', '', 'string'); |
|
|
|
|
1117
|
|
|
$logourl = mylinksUtility::mylinks_cleanVars($_POST, 'logourl', '', 'string'); |
|
|
|
|
1118
|
|
|
$title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); |
|
|
|
|
1119
|
|
|
$description = mylinksUtility::mylinks_cleanVars($_POST, 'descarea', '', 'string'); |
|
|
|
|
1120
|
|
|
/* |
|
|
|
|
1121
|
|
|
$url = $myts->addSlashes($url); |
1122
|
|
|
$logourl = $myts->addSlashes($logourl); |
1123
|
|
|
$title = $myts->addSlashes($title); |
1124
|
|
|
$description = $myts->addSlashes($description); |
1125
|
|
|
*/ |
1126
|
|
|
$submitter = $xoopsUser->uid(); |
1127
|
|
|
$result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE url='{$url}'"); |
1128
|
|
|
list($numrows) = $xoopsDB->fetchRow($result); |
1129
|
|
|
$errormsg = array(); |
1130
|
|
|
$error = false; |
1131
|
|
|
if ( $numrows > 0 ) { |
1132
|
|
|
$errormsg[] = "<h4 style='color: #FF0000'>" . _MD_MYLINKS_ERROREXIST . '</h4>'; |
1133
|
|
|
$error = true; |
1134
|
|
|
} |
1135
|
|
|
if ($title == '') { // check if title exists |
1136
|
|
|
$errormsg[] = "<h4 style='color: #FF0000'>" . _MD_MYLINKS_ERRORTITLE . '</h4>'; |
1137
|
|
|
$error = true; |
1138
|
|
|
} |
1139
|
|
|
if ($url == '') { // check if url exists |
1140
|
|
|
$errormsg[] = "<h4 style='color: #FF0000'>" . _MD_MYLINKS_ERRORURL . '</h4>'; |
1141
|
|
|
$error = true; |
1142
|
|
|
} |
1143
|
|
|
if ($description == '') { // check if description exists |
1144
|
|
|
$errormsg[] = "<h4 style='color: #FF0000'>" . _MD_MYLINKS_ERRORDESC . '</h4>'; |
1145
|
|
|
$error = true; |
1146
|
|
|
} |
1147
|
|
|
if ( $error ) { |
1148
|
|
|
xoops_cp_header(); |
1149
|
|
|
$displayMsg = implode('<br>', $errormsg); |
1150
|
|
|
echo "<div style='text-align: center;'><fieldset>{$displayMsg}</fieldset></div>\n"; |
1151
|
|
|
xoops_cp_footer(); |
1152
|
|
|
exit(); |
|
|
|
|
1153
|
|
|
} |
1154
|
|
|
|
1155
|
|
|
$newid = $xoopsDB->genId($xoopsDB->prefix('mylinks_links') . '_lid_seq'); |
1156
|
|
|
$sql = sprintf("INSERT INTO %s (lid, cid, title, url, logourl, submitter, status, date, hits, rating, votes, comments) VALUES (%u, %u, '%s', '%s', '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix('mylinks_links'), $newid, $cid, $title, $url, $logourl, $submitter, 1, time(), 0, 0, 0, 0); |
1157
|
|
|
$result = $xoopsDB->query($sql); |
1158
|
|
|
if (!$result) { |
1159
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1160
|
|
|
exit(); |
|
|
|
|
1161
|
|
|
} |
1162
|
|
|
if ( 0 == $newid ) { |
1163
|
|
|
$newid = $xoopsDB->getInsertId(); |
1164
|
|
|
} |
1165
|
|
|
$sql = sprintf("INSERT INTO %s (lid, description) VALUES (%u, '%s')", $xoopsDB->prefix('mylinks_text'), $newid, $description); |
1166
|
|
|
$result = $xoopsDB->query($sql); |
1167
|
|
|
if (!$result) { |
1168
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1169
|
|
|
exit(); |
|
|
|
|
1170
|
|
|
} |
1171
|
|
|
$tags = array(); |
1172
|
|
|
$tags['LINK_NAME'] = $title; |
1173
|
|
|
$tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/singlelink.php?cid={$cid}&lid={$newid}"; |
1174
|
|
|
|
1175
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category' , $xoopsModule->getVar('dirname')); |
1176
|
|
|
$catObj = $mylinksCatHandler->get($cid); |
1177
|
|
|
$tags['CATEGORY_NAME'] = $catObj->getVar('title'); |
1178
|
|
|
unset($catObj, $mylinksCatHandler); |
1179
|
|
|
|
1180
|
|
|
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewcat.php?cid={$cid}"; |
1181
|
|
|
$notification_handler =& xoops_getHandler('notification'); |
1182
|
|
|
$notification_handler->triggerEvent('global', 0, 'new_link', $tags); |
1183
|
|
|
$notification_handler->triggerEvent('category', $cid, 'new_link', $tags); |
1184
|
|
|
redirect_header('main.php?op=linksConfigMenu', 2, _MD_MYLINKS_NEWLINKADDED); |
1185
|
|
|
} |
1186
|
|
|
|
1187
|
|
|
function approve() |
|
|
|
|
1188
|
|
|
{ |
1189
|
|
|
global $xoopsDB, $myts, $xoopsModule; |
|
|
|
|
1190
|
|
|
|
1191
|
|
|
$lid = mylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min'=>0)); |
|
|
|
|
1192
|
|
|
$cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min'=>0)); |
|
|
|
|
1193
|
|
|
$title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); |
|
|
|
|
1194
|
|
|
$url = mylinksUtility::mylinks_cleanVars($_POST, 'url', '', 'string'); |
|
|
|
|
1195
|
|
|
$logourl = mylinksUtility::mylinks_cleanVars($_POST, 'logourl', '', 'string'); |
|
|
|
|
1196
|
|
|
$description = mylinksUtility::mylinks_cleanVars($_POST, 'description', '', 'string'); |
|
|
|
|
1197
|
|
|
/* |
|
|
|
|
1198
|
|
|
$url = $myts->addSlashes($url); |
1199
|
|
|
$logourl = $myts->addSlashes($logourl); |
1200
|
|
|
$title = $myts->addSlashes($title); |
1201
|
|
|
$description = $myts->addSlashes($description); |
1202
|
|
|
*/ |
1203
|
|
|
$query = 'UPDATE ' . $xoopsDB->prefix('mylinks_links') . " set cid='{$cid}', title='{$title}', url='{$url}', logourl='{$logourl}', status='1', date=" . time() . " WHERE lid='{$lid}'"; |
1204
|
|
|
$result = $xoopsDB->query($query); |
1205
|
|
|
if ($result) { |
1206
|
|
|
$query = 'UPDATE ' . $xoopsDB->prefix('mylinks_text') . " SET description='{$description}' WHERE lid='{$lid}'"; |
1207
|
|
|
$result = $xoopsDB->query($query); |
1208
|
|
|
if (!$result) { |
1209
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1210
|
|
|
exit(); |
|
|
|
|
1211
|
|
|
} |
1212
|
|
|
} else { |
1213
|
|
|
mylinksUtility::show_message(_MD_MYLINKS_NORECORDFOUND); |
|
|
|
|
1214
|
|
|
exit(); |
|
|
|
|
1215
|
|
|
} |
1216
|
|
|
$tags = array(); |
1217
|
|
|
$tags['LINK_NAME'] = $title; |
1218
|
|
|
$tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/singlelink.php?cid={$cid}&lid={$lid}"; |
1219
|
|
|
$mylinksCatHandler =& xoops_getmodulehandler('category' , $xoopsModule->getVar('dirname')); |
1220
|
|
|
$catObj = $mylinksCatHandler->get($cid); |
1221
|
|
|
/* |
|
|
|
|
1222
|
|
|
$sql = "SELECT title FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE cid=" . $cid; |
1223
|
|
|
$result = $xoopsDB->query($sql); |
1224
|
|
|
$row = $xoopsDB->fetchArray($result); |
1225
|
|
|
$tags['CATEGORY_NAME'] = $row['title']; |
1226
|
|
|
*/ |
1227
|
|
|
if ($catObj) { |
1228
|
|
|
$tags['CATEGORY_NAME'] = $catObj->getVar('title'); |
1229
|
|
|
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewcat.php?cid={$cid}"; |
1230
|
|
|
$notification_handler =& xoops_getHandler('notification'); |
1231
|
|
|
$notification_handler->triggerEvent('global', 0, 'new_link', $tags); |
1232
|
|
|
$notification_handler->triggerEvent('category', $cid, 'new_link', $tags); |
1233
|
|
|
$notification_handler->triggerEvent('link', $lid, 'approve', $tags); |
1234
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_NEWLINKADDED); |
1235
|
|
|
} else { |
1236
|
|
|
redirect_header('index.php', 2, _MD_MYLINKS_DBNOTUPDATED); |
1237
|
|
|
} |
1238
|
|
|
} |
1239
|
|
|
|
1240
|
|
|
$op = mylinksUtility::mylinks_cleanVars($_REQUEST, 'op', 'main', 'string'); |
|
|
|
|
1241
|
|
|
|
1242
|
|
|
switch ($op) |
1243
|
|
|
{ |
1244
|
|
|
case 'delNewLink': |
1245
|
|
|
delNewLink(); |
1246
|
|
|
break; |
1247
|
|
|
case 'approve': |
1248
|
|
|
approve(); |
1249
|
|
|
break; |
1250
|
|
|
case 'addCat': |
1251
|
|
|
addCat(); |
1252
|
|
|
break; |
1253
|
|
|
case 'importCats': |
1254
|
|
|
importCats(); |
1255
|
|
|
break; |
1256
|
|
|
case 'addLink': |
1257
|
|
|
addLink(); |
1258
|
|
|
break; |
1259
|
|
|
case 'listBrokenLinks': |
1260
|
|
|
listBrokenLinks(); |
1261
|
|
|
break; |
1262
|
|
|
case 'delBrokenLinks': |
1263
|
|
|
delBrokenLinks(); |
1264
|
|
|
break; |
1265
|
|
|
case 'ignoreBrokenLinks': |
1266
|
|
|
ignoreBrokenLinks(); |
1267
|
|
|
break; |
1268
|
|
|
case 'listModReq': |
1269
|
|
|
listModReq(); |
1270
|
|
|
break; |
1271
|
|
|
case 'changeModReq': |
1272
|
|
|
changeModReq(); |
1273
|
|
|
break; |
1274
|
|
|
case 'ignoreModReq': |
1275
|
|
|
ignoreModReq(); |
1276
|
|
|
break; |
1277
|
|
|
case 'delCat': |
1278
|
|
|
delCat(); |
1279
|
|
|
break; |
1280
|
|
|
case 'modCat': |
1281
|
|
|
modCat(); |
1282
|
|
|
break; |
1283
|
|
|
case 'modCatS': |
1284
|
|
|
modCatS(); |
1285
|
|
|
break; |
1286
|
|
|
case 'modLink': |
1287
|
|
|
modLink(); |
1288
|
|
|
break; |
1289
|
|
|
case 'modLinkS': |
1290
|
|
|
modLinkS(); |
1291
|
|
|
break; |
1292
|
|
|
case 'delLink': |
1293
|
|
|
delLink(); |
1294
|
|
|
break; |
1295
|
|
|
case 'delVote': |
1296
|
|
|
delVote(); |
1297
|
|
|
break; |
1298
|
|
|
case 'linksConfigMenu': |
1299
|
|
|
default: |
1300
|
|
|
linksConfigMenu(); |
1301
|
|
|
break; |
1302
|
|
|
case 'listNewLinks': |
1303
|
|
|
listNewLinks(); |
1304
|
|
|
break; |
1305
|
|
|
case 'main': |
1306
|
|
|
break; |
1307
|
|
|
} |
1308
|
|
|
|
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.