XoopsModules25x /
xhelp
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 declare(strict_types=1); |
||||||
| 2 | |||||||
| 3 | /* |
||||||
| 4 | * You may not change or alter any portion of this comment or credits |
||||||
| 5 | * of supporting developers from this source code or any supporting source code |
||||||
| 6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
| 7 | * |
||||||
| 8 | * This program is distributed in the hope that it will be useful, |
||||||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
| 11 | */ |
||||||
| 12 | |||||||
| 13 | /** |
||||||
| 14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||||
| 15 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||||
| 16 | * @author Brian Wahoff <[email protected]> |
||||||
| 17 | * @author Eric Juden <[email protected]> |
||||||
| 18 | * @author XOOPS Development Team |
||||||
| 19 | */ |
||||||
| 20 | |||||||
| 21 | namespace XoopsModules\Xhelp\Faq; |
||||||
| 22 | |||||||
| 23 | use XoopsModules\Xhelp; |
||||||
| 24 | use XoopsModules\Xoopsfaq\Helper as AdapterHelper; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 25 | |||||||
| 26 | if (!\defined('XHELP_CLASS_PATH')) { |
||||||
| 27 | exit(); |
||||||
| 28 | } |
||||||
| 29 | |||||||
| 30 | \define('XHELP_XFAQ_PATH', XOOPS_ROOT_PATH . '/modules/xoopsfaq'); |
||||||
| 31 | \define('XHELP_XFAQ_URL', XOOPS_URL . '/modules/xoopsfaq'); |
||||||
| 32 | |||||||
| 33 | /** |
||||||
| 34 | * class Xoopsfaq |
||||||
| 35 | */ |
||||||
| 36 | class Xoopsfaq extends Xhelp\FaqAdapterAbstract |
||||||
| 37 | { |
||||||
| 38 | /** |
||||||
| 39 | * Does application support categories? |
||||||
| 40 | * Possible Values: |
||||||
| 41 | * XHELP_FAQ_CATEGORY_SING - entries can be in 1 category |
||||||
| 42 | * XHELP_FAQ_CATEGORY_MULTI - entries can be in more than 1 category |
||||||
| 43 | * XHELP_FAQ_CATEGORY_NONE - No category support |
||||||
| 44 | */ |
||||||
| 45 | public $categoryType = \XHELP_FAQ_CATEGORY_SING; |
||||||
| 46 | /** |
||||||
| 47 | * Adapter Details |
||||||
| 48 | * Required Values: |
||||||
| 49 | * name - name of adapter |
||||||
| 50 | * author - who wrote the plugin |
||||||
| 51 | * author_email - contact email |
||||||
| 52 | * version - version of this plugin |
||||||
| 53 | * tested_versions - supported application versions |
||||||
| 54 | * url - support url for plugin |
||||||
| 55 | * module_dir - module directory name (not needed if class overloads the isActive() function from Xhelp\FaqAdapterAbstract) |
||||||
| 56 | */ |
||||||
| 57 | public $meta = [ |
||||||
| 58 | 'name' => 'xoopsfaq', |
||||||
| 59 | 'author' => 'Eric Juden', |
||||||
| 60 | 'author_email' => '[email protected]', |
||||||
| 61 | 'description' => 'Create xoopsfaq entries from xHelp helpdesk tickets', |
||||||
| 62 | 'version' => '1.0', |
||||||
| 63 | 'tested_versions' => '1.1', |
||||||
| 64 | 'url' => 'https://xoops.org', |
||||||
| 65 | 'module_dir' => 'xoopsfaq', |
||||||
| 66 | ]; |
||||||
| 67 | |||||||
| 68 | /** |
||||||
| 69 | * Xhelp\Xoopsfaq constructor. |
||||||
| 70 | */ |
||||||
| 71 | public function __construct() |
||||||
| 72 | { |
||||||
| 73 | if (\class_exists(AdapterHelper::class)) { |
||||||
| 74 | $this->helper = AdapterHelper::getInstance(); |
||||||
| 75 | $this->dirname = $this->helper->dirname(); |
||||||
| 76 | } |
||||||
| 77 | |||||||
| 78 | $this->init(); |
||||||
| 79 | } |
||||||
| 80 | |||||||
| 81 | /** |
||||||
| 82 | * @return array |
||||||
| 83 | */ |
||||||
| 84 | public function &getCategories(): array |
||||||
| 85 | { |
||||||
| 86 | global $xoopsDB; |
||||||
| 87 | |||||||
| 88 | $ret = []; |
||||||
| 89 | |||||||
| 90 | if (null === $this->helper) { |
||||||
| 91 | return $ret; |
||||||
| 92 | } |
||||||
| 93 | $helper = Xhelp\Helper::getInstance(); |
||||||
| 94 | // Create an instance of the Xhelp\FaqCategoryHandler |
||||||
| 95 | $faqCategoryHandler = $helper->getHandler('FaqCategory'); |
||||||
| 96 | |||||||
| 97 | $sql = \sprintf('SELECT category_id, category_title FROM `%s` ORDER BY category_order', $xoopsDB->prefix('xoopsfaq_categories')); |
||||||
| 98 | $result = $xoopsDB->query($sql); |
||||||
| 99 | |||||||
| 100 | if (!$result) { |
||||||
| 101 | return $ret; |
||||||
| 102 | } |
||||||
| 103 | |||||||
| 104 | //Convert the module specific category to the |
||||||
| 105 | //Xhelp\FaqCategory object for standarization |
||||||
| 106 | while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
||||||
| 107 | $faqcat = $faqCategoryHandler->create(); |
||||||
| 108 | $faqcat->setVar('id', $myrow['category_id']); |
||||||
| 109 | $faqcat->setVar('name', $myrow['category_title']); |
||||||
| 110 | $faqcat->setVar('parent', 0); |
||||||
| 111 | $ret[] = $faqcat; |
||||||
| 112 | } |
||||||
| 113 | |||||||
| 114 | return $ret; |
||||||
| 115 | } |
||||||
| 116 | |||||||
| 117 | /** |
||||||
| 118 | * @param Xhelp\Faq|null $faq The faq to add |
||||||
| 119 | * @return bool true (success)/false (failure) |
||||||
| 120 | */ |
||||||
| 121 | public function storeFaq(Xhelp\Faq $faq = null): bool |
||||||
| 122 | { |
||||||
| 123 | global $xoopsDB, $xoopsUser; |
||||||
| 124 | |||||||
| 125 | // Set values before storing to db |
||||||
| 126 | // $newid = 0; |
||||||
| 127 | $categories = $faq->getVar('categories'); |
||||||
|
0 ignored issues
–
show
The method
getVar() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 128 | $category_id = $categories[0]; |
||||||
| 129 | $title = $faq->getVar('problem'); |
||||||
| 130 | $contents = $faq->getVar('solution'); |
||||||
| 131 | $contents_order = 0; |
||||||
| 132 | $contents_visible = 1; |
||||||
| 133 | $contents_nohtml = 0; |
||||||
| 134 | $contents_nosmiley = 0; |
||||||
| 135 | $contents_noxcode = 0; |
||||||
| 136 | |||||||
| 137 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('xoopsfaq_contents') . ' (category_id, contents_title, contents_contents, contents_time, contents_order, contents_visible, contents_nohtml, contents_nosmiley, contents_noxcode) VALUES (' |
||||||
| 138 | // . $newid |
||||||
| 139 | // . ', ' |
||||||
| 140 | . $category_id . ", '" . $title . "', '" . $contents . "', " . \time() . ', ' . $contents_order . ', ' . $contents_visible . ', ' . $contents_nohtml . ', ' . $contents_nosmiley . ', ' . $contents_noxcode . ')'; |
||||||
| 141 | $ret = $xoopsDB->query($sql); |
||||||
| 142 | |||||||
| 143 | $newid = $xoopsDB->getInsertId(); // Get new faq id from db |
||||||
| 144 | if ($ret) { |
||||||
| 145 | $faq->setVar('id', $newid); |
||||||
| 146 | } |
||||||
| 147 | |||||||
| 148 | return $ret; |
||||||
| 149 | } |
||||||
| 150 | |||||||
| 151 | /** |
||||||
| 152 | * @param \XoopsModules\Xhelp\Faq $faq |
||||||
| 153 | * @return string |
||||||
| 154 | */ |
||||||
| 155 | public function makeFaqUrl(\XoopsModules\Xhelp\Faq $faq): string |
||||||
| 156 | { |
||||||
| 157 | return \XHELP_XFAQ_URL . '/index.php?cat_id=' . $faq->getVar('categories') . '#q' . $faq->getVar('id'); |
||||||
| 158 | } |
||||||
| 159 | } |
||||||
| 160 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths