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.
1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * Module: SmartFAQ |
||||
5 | * Author: The SmartFactory <www.smartfactory.ca> |
||||
6 | * Licence: GNU |
||||
7 | */ |
||||
8 | |||||
9 | use XoopsModules\Smartfaq; |
||||
10 | |||||
11 | global $_POST, $xoopsDB; |
||||
12 | |||||
13 | require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
||||
14 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
15 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
16 | //require_once __DIR__ . '/functions.php'; |
||||
17 | |||||
18 | /** @var Smartfaq\Helper $helper */ |
||||
19 | $helper = Smartfaq\Helper::getInstance(); |
||||
20 | |||||
21 | $mytree = new Smartfaq\Tree($xoopsDB->prefix('smartfaq_categories'), 'categoryid', 'parentid'); |
||||
22 | $form = new \XoopsThemeForm(_MD_SF_SUB_SMNAME, 'form', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||||
23 | |||||
24 | // Category |
||||
25 | ob_start(); |
||||
26 | $form->addElement(new \XoopsFormHidden('categoryid', '')); |
||||
27 | $mytree->makeMySelBox('name', 'weight', $categoryObj->categoryid()); |
||||
28 | $category_label = new \XoopsFormLabel(_MD_SF_CATEGORY_FAQ, ob_get_contents()); |
||||
29 | $category_label->setDescription(_MD_SF_CATEGORY_FAQ_DSC); |
||||
30 | $form->addElement($category_label); |
||||
31 | ob_end_clean(); |
||||
32 | |||||
33 | // FAQ QUESTION |
||||
34 | $form->addElement(new \XoopsFormTextArea(_MD_SF_QUESTION, 'question', $faqObj->question(), 7, 60), true); |
||||
35 | |||||
36 | // ANSWER |
||||
37 | //$answer_text = new \XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', $answerObj->answer(), 15, 60); |
||||
38 | //$answer_text->setDescription(_MD_SF_ANSWER_FAQ_DSC); |
||||
39 | //$form->addElement($answer_text, true); |
||||
40 | |||||
41 | $userIsAdmin = Smartfaq\Utility::userIsAdmin(); |
||||
42 | if ($userIsAdmin) { |
||||
43 | $tempEditor = $helper->getConfig('form_editorOptions'); |
||||
44 | } else { |
||||
45 | $tempEditor = $helper->getConfig('form_editorOptionsUser'); |
||||
46 | } |
||||
47 | |||||
48 | $editorTray = new \XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br>'); |
||||
49 | if (class_exists('XoopsFormEditor')) { |
||||
50 | $options['name'] = 'answer'; |
||||
51 | $options['value'] = $answerObj->answer(); |
||||
52 | $options['rows'] = 5; |
||||
53 | $options['cols'] = '100%'; |
||||
54 | $options['width'] = '100%'; |
||||
55 | $options['height'] = '200px'; |
||||
56 | $answerEditor = new \XoopsFormEditor('', $tempEditor, $options, $nohtml = false, $onfailure = 'textarea'); |
||||
57 | $editorTray->addElement($answerEditor); |
||||
58 | } else { |
||||
59 | $answerEditor = new \XoopsFormDhtmlTextArea('', 'answer', $faqObj->question(), '100%', '100%'); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() '100%' of type string is incompatible with the type integer expected by parameter $cols of XoopsFormDhtmlTextArea::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
60 | $answerEditor->setDescription(_MD_SF_ANSWER_FAQ_DSC); |
||||
61 | $editorTray->addElement($answerEditor); |
||||
62 | } |
||||
63 | |||||
64 | $form->addElement($editorTray); |
||||
65 | |||||
66 | // HOW DO I |
||||
67 | $howdoi_text = new \XoopsFormText(_MD_SF_HOWDOI_FAQ, 'howdoi', 50, 255, $faqObj->howdoi()); |
||||
68 | $howdoi_text->setDescription(_MD_SF_HOWDOI_FAQ_DSC); |
||||
69 | $form->addElement($howdoi_text, false); |
||||
70 | |||||
71 | // DIDUNO |
||||
72 | $diduno_text = new \XoopsFormTextArea(_MD_SF_DIDUNO_FAQ, 'diduno', $faqObj->diduno(), 3, 60); |
||||
73 | $diduno_text->setDescription(_MD_SF_DIDUNO_FAQ_DSC); |
||||
74 | $form->addElement($diduno_text); |
||||
75 | |||||
76 | //************************************************** |
||||
77 | |||||
78 | //if ($topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
||||
79 | $upload_tray = new \XoopsFormElementTray(_MD_SF_ATTACHMENT); |
||||
80 | // $upload_tray->addElement(new \XoopsFormFile('', 'userfile', ($forum_obj->getVar('attach_maxkb') * 1024))); |
||||
81 | $upload_tray->addElement(new \XoopsFormFile('', 'userfile', $helper->getConfig('max_image_size') * 1024)); |
||||
82 | $upload_tray->addElement(new \XoopsFormButton('', 'contents_upload', _MD_SF_UPLOAD, 'submit')); |
||||
83 | $upload_tray->addElement(new \XoopsFormLabel('<br><br>' . _MD_SF_MAX_FILESIZE . ':', $helper->getConfig('max_image_size') . 'Kb; ')); |
||||
84 | $extensions = trim(str_replace('|', ' ', $helper->getConfig('attach_ext'))); |
||||
85 | $extensions = (empty($extensions) || '*' === $extensions) ? _ALL : $extensions; |
||||
86 | $upload_tray->addElement(new \XoopsFormLabel(_MD_SF_ALLOWED_EXTENSIONS . ':', $extensions)); |
||||
87 | $upload_tray->addElement(new \XoopsFormLabel('<br>' . sprintf(_MD_SF_MAXPIC, $helper->getConfig('max_img_height'), $helper->getConfig('max_img_width')))); |
||||
88 | $form->addElement($upload_tray); |
||||
89 | //} |
||||
90 | |||||
91 | if (!empty($attachments) && is_array($attachments) && count($attachments)) { |
||||
92 | $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_SF_ATTACHED_FILES, 'delete_attach[]'); |
||||
93 | foreach ($attachments as $key => $attachment) { |
||||
94 | $attach = ' ' . _DELETE . ' <a href=' . XOOPS_URL . '/' . $helper->getConfig('dir_attachments') . '/' . $attachment['name_saved'] . ' rel="external">' . $attachment['name_display'] . '</a><br>'; |
||||
95 | $delete_attach_checkbox->addOption($key, $attach); |
||||
96 | } |
||||
97 | $form->addElement($delete_attach_checkbox); |
||||
98 | unset($delete_attach_checkbox); |
||||
99 | } |
||||
100 | |||||
101 | if (!empty($attachments_tmp) && is_array($attachments_tmp) && count($attachments_tmp)) { |
||||
102 | $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_REMOVE, 'delete_tmp[]'); |
||||
103 | $url_prefix = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, XOOPS_CACHE_PATH); |
||||
104 | foreach ($attachments_tmp as $key => $attachment) { |
||||
105 | $attach = ' <a href="' . $url_prefix . '/' . $attachment[0] . '" rel="external">' . $attachment[1] . '</a><br>'; |
||||
106 | $delete_attach_checkbox->addOption($key, $attach); |
||||
107 | } |
||||
108 | $form->addElement($delete_attach_checkbox); |
||||
109 | unset($delete_attach_checkbox); |
||||
110 | $attachments_tmp = base64_encode(serialize($attachments_tmp)); |
||||
111 | $form->addElement(new \XoopsFormHidden('attachments_tmp', $attachments_tmp)); |
||||
112 | } |
||||
113 | |||||
114 | //************************************************ |
||||
115 | |||||
116 | // CONTEXT MODULE LINK |
||||
117 | // Retrieve the list of module currently installed. The key value is the dirname |
||||
118 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
119 | /* |
||||
120 | $moduleHandler = xoops_getHandler('module'); |
||||
121 | $modules_array = $moduleHandler->getList(null, true); |
||||
122 | $modulelink_select_array = ['url' => _MD_SF_SPECIFIC_URL_SELECT]; |
||||
123 | $modulelink_select_array = array_merge($modules_array, $modulelink_select_array); |
||||
124 | $modulelink_select_array = array_merge(['None' => _MD_SF_NONE, 'All' => _MD_SF_ALL], $modulelink_select_array); |
||||
125 | |||||
126 | $modulelink_select = new \XoopsFormSelect('', 'modulelink', ''); |
||||
127 | $modulelink_select->addOptionArray($modulelink_select_array); |
||||
128 | $modulelink_tray = new \XoopsFormElementTray(_MD_SF_CONTEXTMODULELINK_FAQ, ' '); |
||||
129 | $modulelink_tray->addElement($modulelink_select); |
||||
130 | $form->addElement($modulelink_tray); |
||||
131 | */ |
||||
132 | |||||
133 | // CONTEXTPAGE |
||||
134 | //$form->addElement(new \XoopsFormText(_MD_SF_SPECIFIC_URL, 'contextpage', 50, 60, ''), false); |
||||
135 | |||||
136 | // EXACT URL? |
||||
137 | /*$excaturl_radio = new \XoopsFormRadioYN(_MD_SF_EXACTURL, 'exacturl', 0, ' ' . _MD_SF_YES . '', ' ' . _MD_SF_NO . ''); |
||||
138 | $form->addElement($excaturl_radio); |
||||
139 | */ |
||||
140 | // NOTIFY ON PUBLISH |
||||
141 | if (is_object($xoopsUser)) { |
||||
142 | $notify_checkbox = new \XoopsFormCheckBox('', 'notifypub', $notifypub); |
||||
143 | $notify_checkbox->addOption(1, _MD_SF_NOTIFY); |
||||
144 | $form->addElement($notify_checkbox); |
||||
145 | } |
||||
146 | |||||
147 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||
148 | |||||
149 | $butt_create = new \XoopsFormButton('', 'post', _MD_SF_CREATE, 'submit'); |
||||
150 | $buttonTray->addElement($butt_create); |
||||
151 | |||||
152 | $butt_preview = new \XoopsFormButton('', 'preview', _MD_SF_PREVIEW, 'submit'); |
||||
153 | $buttonTray->addElement($butt_preview); |
||||
154 | |||||
155 | $form->addElement($buttonTray); |
||||
156 | $form->assign($xoopsTpl); |
||||
157 | |||||
158 | unset($hidden, $hidden2); |
||||
159 |