XoopsModules25x /
rssfit
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 | declare(strict_types=1); |
||||
| 4 | /* |
||||
| 5 | * You may not change or alter any portion of this comment or credits |
||||
| 6 | * of supporting developers from this source code or any supporting source code |
||||
| 7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
| 8 | * |
||||
| 9 | * This program is distributed in the hope that it will be useful, |
||||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 12 | */ |
||||
| 13 | |||||
| 14 | /** |
||||
| 15 | * @copyright XOOPS Project (https://xoops.org) |
||||
| 16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||
| 17 | * @package RSSFit - Extendable XML news feed generator |
||||
| 18 | * @author NS Tai (aka tuff) <http://www.brandycoke.com> |
||||
| 19 | * @author XOOPS Development Team |
||||
| 20 | */ |
||||
| 21 | |||||
| 22 | use XoopsModules\Rssfit; |
||||
| 23 | |||||
| 24 | require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
||||
| 25 | require_once \dirname(__DIR__, 3) . '/mainfile.php'; |
||||
| 26 | |||||
| 27 | function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool |
||||
| 28 | { |
||||
| 29 | global $xoopsDB; |
||||
| 30 | |||||
| 31 | $moduleDirName = \basename(\dirname(__DIR__)); |
||||
| 32 | |||||
| 33 | $helper = Rssfit\Helper::getInstance(); |
||||
| 34 | |||||
| 35 | // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); |
||||
| 36 | xoops_loadLanguage('install', $moduleDirName); |
||||
| 37 | $introSetting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; |
||||
| 38 | $sql[] = 'INSERT INTO `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' . $xoopsDB->quoteString( |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||||
| 39 | serialize($introSetting) |
||||
| 40 | ) . ')'; |
||||
| 41 | $sql[] = rssfInsertChannel($xoopsMod); |
||||
| 42 | $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(null, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; |
||||
| 43 | foreach ($sql as $s) { |
||||
| 44 | if (false === $xoopsDB->query($s)) { |
||||
| 45 | echo '<span style="color: #ff0000;"><b>' . $xoopsDB->error() . '<b></span><br>' . $s . '<br><br>'; |
||||
| 46 | |||||
| 47 | return false; |
||||
| 48 | } |
||||
| 49 | } |
||||
| 50 | |||||
| 51 | return true; |
||||
| 52 | } |
||||
| 53 | |||||
| 54 | /** |
||||
| 55 | * @param int $previousVersion version number of previously installed version |
||||
| 56 | * |
||||
| 57 | */ |
||||
| 58 | function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $previousVersion): bool |
||||
|
0 ignored issues
–
show
The parameter
$previousVersion is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 59 | { |
||||
| 60 | global $xoopsDB; |
||||
| 61 | $helper = Rssfit\Helper::getInstance(); |
||||
| 62 | // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); |
||||
| 63 | $moduleDirName = \basename(\dirname(__DIR__)); |
||||
| 64 | xoops_loadLanguage('install', $moduleDirName); |
||||
| 65 | |||||
| 66 | $rows = []; |
||||
| 67 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE 'misc_category' = 'channel'"; |
||||
| 68 | $result = $xoopsDB->query($sql); |
||||
| 69 | if ($result instanceof \mysqli_result) { |
||||
| 70 | [$rows] = $xoopsDB->fetchRow($result); |
||||
| 71 | } |
||||
| 72 | if (!$rows) { |
||||
| 73 | $sql = []; |
||||
| 74 | // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; |
||||
| 75 | // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; |
||||
| 76 | $introSetting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; |
||||
| 77 | $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($introSetting)) . " WHERE misc_category = 'intro'"; |
||||
| 78 | // $sql[] = 'ALTER TABLE `' |
||||
| 79 | // . $xoopsDB->prefix($helper->getDirname() . '_plugins') |
||||
| 80 | // . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; |
||||
| 81 | $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; |
||||
| 82 | $sql[] = rssfInsertChannel($xoopsMod); |
||||
| 83 | $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; |
||||
| 84 | foreach ($sql as $s) { |
||||
| 85 | if (false === $xoopsDB->query($s)) { |
||||
| 86 | echo '<span style="color: #ff0000;"><b>' . $xoopsDB->error() . '<b></span><br>' . $s . '<br><br>'; |
||||
| 87 | |||||
| 88 | return false; |
||||
| 89 | } |
||||
| 90 | } |
||||
| 91 | } |
||||
| 92 | |||||
| 93 | return true; |
||||
| 94 | } |
||||
| 95 | |||||
| 96 | //function rssfInstallLangFile($xoopsMod, $lang) |
||||
| 97 | //{ |
||||
| 98 | // $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; |
||||
| 99 | // if (is_file(sprintf($file, $lang))) { |
||||
| 100 | // include sprintf($file, $lang); |
||||
| 101 | // } else { |
||||
| 102 | // include sprintf($file, 'english'); |
||||
| 103 | // } |
||||
| 104 | //} |
||||
| 105 | |||||
| 106 | function rssfInsertChannel(\XoopsModule $xoopsMod): string |
||||
| 107 | { |
||||
| 108 | global $xoopsDB, $xoopsConfig; |
||||
| 109 | $helper = Rssfit\Helper::getInstance(); |
||||
| 110 | $url = $xoopsDB->quoteString(XOOPS_URL); |
||||
| 111 | $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); |
||||
| 112 | |||||
| 113 | $sql = "SELECT 'conf_value' FROM " . $xoopsDB->prefix('config') . " WHERE 'conf_name' = 'meta_copyright' AND 'conf_modid' = 1 AND 'conf_catid' = " . XOOPS_CONF_METAFOOTER; |
||||
| 114 | $result = $xoopsDB->query($sql); |
||||
| 115 | if ($result instanceof \mysqli_result) { |
||||
| 116 | [$copyright] = $xoopsDB->fetchRow($result); |
||||
| 117 | } |
||||
| 118 | |||||
| 119 | return 'INSERT INTO ' |
||||
| 120 | . $xoopsDB->prefix($helper->getDirname() . '_misc') |
||||
| 121 | . ' VALUES ' |
||||
| 122 | . "(0, 'channel', 'title', " |
||||
| 123 | . $sitename |
||||
| 124 | . ", '')" |
||||
| 125 | . ", (0, 'channel', 'link', " |
||||
| 126 | . $url |
||||
| 127 | . ", '')" |
||||
| 128 | . ", (0, 'channel', 'description', " |
||||
| 129 | . $xoopsDB->quoteString($xoopsConfig['slogan']) |
||||
| 130 | . ", ''), (0, 'channel', 'copyright', " |
||||
| 131 | . $xoopsDB->quoteString($copyright) |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
| 132 | . ", ''), (0, 'channel', 'managingEditor', " |
||||
| 133 | . $xoopsDB->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') |
||||
| 134 | . ", ''), (0, 'channel', 'webMaster', " |
||||
| 135 | . $xoopsDB->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') |
||||
| 136 | . ", '')" |
||||
| 137 | . ", (0, 'channel', 'category', '', '')" |
||||
| 138 | . ", (0, 'channel', 'generator', " |
||||
| 139 | . $xoopsDB->quoteString(XOOPS_VERSION . ' / RSSFit ' . $xoopsMod->getInfo('version')) |
||||
|
0 ignored issues
–
show
Are you sure
$xoopsMod->getInfo('version') of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 140 | . ", ''), (0, 'channel', 'docs', " |
||||
| 141 | . $xoopsDB->quoteString('https://blogs.law.harvard.edu/tech/rss') |
||||
| 142 | . ", '')" |
||||
| 143 | . ", (0, 'channelimg', 'url', " |
||||
| 144 | . $xoopsDB->quoteString(XOOPS_URL . '/images/logo.gif') |
||||
| 145 | . ", '')" |
||||
| 146 | . ", (0, 'channelimg', 'title', " |
||||
| 147 | . $sitename |
||||
| 148 | . ", '')" |
||||
| 149 | . ", (0, 'channelimg', 'link', " |
||||
| 150 | . $url |
||||
| 151 | . ", '')" |
||||
| 152 | . ';'; |
||||
| 153 | } |
||||
| 154 |