|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Module: WF-Links |
|
4
|
|
|
* Version: v1.0.3 |
|
5
|
|
|
* Release Date: 21 June 2005 |
|
6
|
|
|
* Developer: John N |
|
7
|
|
|
* Team: WF-Projects |
|
8
|
|
|
* Licence: GNU |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
use XoopsModules\Wflinks; |
|
12
|
|
|
|
|
13
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
14
|
|
|
|
|
15
|
|
|
/** @var Wflinks\Helper $helper */ |
|
16
|
|
|
$helper = Wflinks\Helper::getInstance(); |
|
17
|
|
|
|
|
18
|
|
|
$op = \Xmf\Request::getString('op', ''); |
|
19
|
|
|
$cid = \Xmf\Request::getInt('cid', 0); |
|
20
|
|
|
|
|
21
|
|
|
switch (mb_strtolower($op)) { |
|
22
|
|
|
case 'save': |
|
23
|
|
|
$indexheading = $myts->addSlashes(xoops_trim($_REQUEST['indexheading'])); |
|
24
|
|
|
$indexheader = $myts->addSlashes(xoops_trim($_REQUEST['indexheader'])); |
|
25
|
|
|
$indexfooter = $myts->addSlashes(xoops_trim($_REQUEST['indexfooter'])); |
|
26
|
|
|
$indeximage = $myts->addSlashes($_REQUEST['indeximage']); |
|
27
|
|
|
$nohtml = isset($_REQUEST['nohtml']) ? 1 : 0; |
|
28
|
|
|
$nosmiley = isset($_REQUEST['nosmiley']) ? 1 : 0; |
|
29
|
|
|
$noxcodes = isset($_REQUEST['noxcodes']) ? 1 : 0; |
|
30
|
|
|
$noimages = isset($_REQUEST['noimages']) ? 1 : 0; |
|
31
|
|
|
$nobreak = isset($_REQUEST['nobreak']) ? 1 : 0; |
|
32
|
|
|
$indexheaderalign = $myts->addSlashes($_REQUEST['indexheaderalign']); |
|
33
|
|
|
$indexfooteralign = $myts->addSlashes($_REQUEST['indexfooteralign']); |
|
34
|
|
|
$lastlinksyn = $_REQUEST['lastlinksyn']; |
|
35
|
|
|
$lastlinkstotal = $myts->addSlashes($_REQUEST['lastlinkstotal']); |
|
36
|
|
|
$sql = 'UPDATE ' |
|
37
|
|
|
. $xoopsDB->prefix('wflinks_indexpage') |
|
38
|
|
|
. " set indexheading='$indexheading', indexheader='$indexheader', indexfooter='$indexfooter', indeximage='$indeximage', indexheaderalign='$indexheaderalign ', indexfooteralign='$indexfooteralign', nohtml='$nohtml', nosmiley='$nosmiley', noxcodes='$noxcodes', noimages='$noimages', nobreak='$nobreak', lastlinksyn='$lastlinksyn', lastlinkstotal='$lastlinkstotal'"; |
|
39
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
|
40
|
|
|
/** @var \XoopsLogger $logger */ |
|
41
|
|
|
$logger = \XoopsLogger::getInstance(); |
|
42
|
|
|
$logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
|
43
|
|
|
|
|
44
|
|
|
return false; |
|
45
|
|
|
} |
|
46
|
|
|
redirect_header('index.php', 1, _AM_WFL_IPAGE_UPDATED); |
|
47
|
|
|
break; |
|
48
|
|
|
default: |
|
49
|
|
|
$sql = 'SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign, lastlinksyn, lastlinkstotal FROM ' . $xoopsDB->prefix('wflinks_indexpage'); |
|
50
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
|
51
|
|
|
/** @var \XoopsLogger $logger */ |
|
52
|
|
|
$logger = \XoopsLogger::getInstance(); |
|
53
|
|
|
$logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
|
54
|
|
|
|
|
55
|
|
|
return false; |
|
56
|
|
|
} |
|
57
|
|
|
list($indeximage, $indexheading, $indexheader, $indexfooter, $nohtml, $nosmiley, $noxcodes, $noimages, $nobreak, $indexheaderalign, $indexfooteralign, $lastlinksyn, $lastlinkstotal) = $xoopsDB->fetchRow($result); |
|
58
|
|
|
|
|
59
|
|
|
xoops_cp_header(); |
|
60
|
|
|
|
|
61
|
|
|
echo " |
|
62
|
|
|
<fieldset><legend style='font-weight: bold; color: #0A3760;'>" . _AM_WFL_IPAGE_INFORMATION . "</legend>\n |
|
63
|
|
|
<div style='padding: 8px;'>" . _AM_WFL_MINDEX_PAGEINFOTXT . "</div>\n |
|
64
|
|
|
</fieldset><br>\n |
|
65
|
|
|
"; |
|
66
|
|
|
|
|
67
|
|
|
$sform = new \XoopsThemeForm(_AM_WFL_IPAGE_MODIFY, 'op', xoops_getenv('SCRIPT_NAME'), 'post', true); |
|
68
|
|
|
$sform->addElement(new \XoopsFormText(_AM_WFL_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false); |
|
69
|
|
|
$graph_array = Wflinks\Lists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $helper->getConfig('mainimagedir'), $type = 'images'); |
|
70
|
|
|
$indeximage_select = new \XoopsFormSelect('', 'indeximage', $indeximage); |
|
71
|
|
|
$indeximage_select->addOptionArray($graph_array); |
|
72
|
|
|
$indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $helper->getConfig('mainimagedir') . '", "", "' . XOOPS_URL . "\")'"); |
|
73
|
|
|
$indeximage_tray = new \XoopsFormElementTray(_AM_WFL_IPAGE_CIMAGE, ' '); |
|
74
|
|
|
$indeximage_tray->addElement($indeximage_select); |
|
75
|
|
|
if (!empty($indeximage)) { |
|
76
|
|
|
$indeximage_tray->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $helper->getConfig('mainimagedir') . '/' . $indeximage . "' name='image' id='image' alt=''>")); |
|
77
|
|
|
} else { |
|
78
|
|
|
$indeximage_tray->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt=''>")); |
|
79
|
|
|
} |
|
80
|
|
|
$sform->addElement($indeximage_tray); |
|
81
|
|
|
|
|
82
|
|
|
$editor = Wflinks\Utility::getWysiwygForm(_AM_WFL_IPAGE_CHEADING, 'indexheader', $indexheader, 15, 60, ''); |
|
|
|
|
|
|
83
|
|
|
$sform->addElement($editor, false); |
|
84
|
|
|
|
|
85
|
|
|
$headeralign_select = new \XoopsFormSelect(_AM_WFL_IPAGE_CHEADINGA, 'indexheaderalign', $indexheaderalign); |
|
86
|
|
|
$headeralign_select->addOptionArray( |
|
87
|
|
|
[ |
|
88
|
|
|
'left' => _AM_WFL_IPAGE_CLEFT, |
|
89
|
|
|
'right' => _AM_WFL_IPAGE_CRIGHT, |
|
90
|
|
|
'center' => _AM_WFL_IPAGE_CCENTER, |
|
91
|
|
|
] |
|
92
|
|
|
); |
|
93
|
|
|
$sform->addElement($headeralign_select); |
|
94
|
|
|
$sform->addElement(new \XoopsFormTextArea(_AM_WFL_IPAGE_CFOOTER, 'indexfooter', $indexfooter, 10, 60)); |
|
95
|
|
|
$footeralign_select = new \XoopsFormSelect(_AM_WFL_IPAGE_CFOOTERA, 'indexfooteralign', $indexfooteralign); |
|
96
|
|
|
$footeralign_select->addOptionArray( |
|
97
|
|
|
[ |
|
98
|
|
|
'left' => _AM_WFL_IPAGE_CLEFT, |
|
99
|
|
|
'right' => _AM_WFL_IPAGE_CRIGHT, |
|
100
|
|
|
'center' => _AM_WFL_IPAGE_CCENTER, |
|
101
|
|
|
] |
|
102
|
|
|
); |
|
103
|
|
|
$sform->addElement($footeralign_select); |
|
104
|
|
|
|
|
105
|
|
|
$options_tray = new \XoopsFormElementTray(_AM_WFL_TEXTOPTIONS, '<br>'); |
|
106
|
|
|
//html option |
|
107
|
|
|
$html_checkbox = new \XoopsFormCheckBox('', 'nohtml', $nohtml); |
|
108
|
|
|
$html_checkbox->addOption(1, _AM_WFL_DISABLEHTML); |
|
109
|
|
|
$options_tray->addElement($html_checkbox); |
|
110
|
|
|
//smiley option |
|
111
|
|
|
$smiley_checkbox = new \XoopsFormCheckBox('', 'nosmiley', $nosmiley); |
|
112
|
|
|
$smiley_checkbox->addOption(1, _AM_WFL_DISABLESMILEY); |
|
113
|
|
|
$options_tray->addElement($smiley_checkbox); |
|
114
|
|
|
//xcodes option |
|
115
|
|
|
$xcodes_checkbox = new \XoopsFormCheckBox('', 'noxcodes', $noxcodes); |
|
116
|
|
|
$xcodes_checkbox->addOption(1, _AM_WFL_DISABLEXCODE); |
|
117
|
|
|
$options_tray->addElement($xcodes_checkbox); |
|
118
|
|
|
//noimages option |
|
119
|
|
|
$noimages_checkbox = new \XoopsFormCheckBox('', 'noimages', $noimages); |
|
120
|
|
|
$noimages_checkbox->addOption(1, _AM_WFL_DISABLEIMAGES); |
|
121
|
|
|
$options_tray->addElement($noimages_checkbox); |
|
122
|
|
|
//breaks option |
|
123
|
|
|
$breaks_checkbox = new \XoopsFormCheckBox('', 'nobreak', $nobreak); |
|
124
|
|
|
$breaks_checkbox->addOption(1, _AM_WFL_DISABLEBREAK); |
|
125
|
|
|
$options_tray->addElement($breaks_checkbox); |
|
126
|
|
|
$sform->addElement($options_tray); |
|
127
|
|
|
|
|
128
|
|
|
$sform->addElement(new \XoopsFormRadioYN(_AM_WFL_IPAGE_SHOWLATEST, 'lastlinksyn', $lastlinksyn, ' ' . _YES . '', ' ' . _NO . '')); |
|
129
|
|
|
|
|
130
|
|
|
$lastlinkstotalform = new \XoopsFormText(_AM_WFL_IPAGE_LATESTTOTAL, 'lastlinkstotal', 2, 2, $lastlinkstotal); |
|
131
|
|
|
$lastlinkstotalform->setDescription('<small>' . _AM_WFL_IPAGE_LATESTTOTAL_DSC . '</small>'); |
|
132
|
|
|
$sform->addElement($lastlinkstotalform, false); |
|
133
|
|
|
|
|
134
|
|
|
$buttonTray = new \XoopsFormElementTray('', ''); |
|
135
|
|
|
$hidden = new \XoopsFormHidden('op', 'save'); |
|
136
|
|
|
$buttonTray->addElement($hidden); |
|
137
|
|
|
$buttonTray->addElement(new \XoopsFormButton('', 'post', _AM_WFL_BSAVE, 'submit')); |
|
138
|
|
|
$sform->addElement($buttonTray); |
|
139
|
|
|
$sform->display(); |
|
140
|
|
|
break; |
|
141
|
|
|
} |
|
142
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
143
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.