XoopsModules25x /
xfguestbook
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 | // XF Guestbook // |
||||
| 5 | // ------------------------------------------------------------------------- // |
||||
| 6 | // This program is free software; you can redistribute it and/or modify // |
||||
| 7 | // it under the terms of the GNU General Public License as published by // |
||||
| 8 | // the Free Software Foundation; either version 2 of the License, or // |
||||
| 9 | // (at your option) any later version. // |
||||
| 10 | // // |
||||
| 11 | // You may not change or alter any portion of this comment or credits // |
||||
| 12 | // of supporting developers from this source code or any supporting // |
||||
| 13 | // source code which is considered copyrighted (c) material of the // |
||||
| 14 | // original comment or credit authors. // |
||||
| 15 | // // |
||||
| 16 | // This program is distributed in the hope that it will be useful, // |
||||
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||||
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||||
| 19 | // GNU General Public License for more details. // |
||||
| 20 | // // |
||||
| 21 | // You should have received a copy of the GNU General Public License // |
||||
| 22 | // along with this program; if not, write to the Free Software // |
||||
| 23 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||||
| 24 | // ------------------------------------------------------------------------ // |
||||
| 25 | |||||
| 26 | /** |
||||
| 27 | * @param int $currentoption |
||||
| 28 | * @param string $breadcrumb |
||||
| 29 | */ |
||||
| 30 | |||||
| 31 | use XoopsModules\Xfguestbook; |
||||
| 32 | use XoopsModules\Xfguestbook\Helper; |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * @param int $currentoption |
||||
| 36 | * @param string $breadcrumb |
||||
| 37 | */ |
||||
| 38 | function xfguestbook_admin_menu($currentoption = 0, $breadcrumb = '') |
||||
|
0 ignored issues
–
show
|
|||||
| 39 | { |
||||
| 40 | /* Nice buttons styles */ |
||||
| 41 | echo " |
||||
| 42 | <style type='text/css'> |
||||
| 43 | #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; margin: 0; } |
||||
| 44 | #buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/xfguestbook/assets/images/bg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid #000000; border-right: 1px solid #000000; margin-bottom: 12px; } |
||||
| 45 | #buttonbar ul { margin: 15px 0 0;padding:10px 10px 0; list-style:none; } |
||||
| 46 | #buttonbar li { display:inline; margin:0; padding:0; } |
||||
| 47 | #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/xfguestbook/assets/images/left_both.gif') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; } |
||||
| 48 | #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/xfguestbook/assets/images/right_both.gif') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; } |
||||
| 49 | /* Commented Backslash Hack hides rule from IE5-Mac \*/ |
||||
| 50 | #buttonbar a span {float:none;} |
||||
| 51 | /* End IE5-Mac hack */ |
||||
| 52 | #buttonbar a:hover span { color:#333; } |
||||
| 53 | #buttonbar #current a { background-position:0 -150px; border-width:0; } |
||||
| 54 | #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; } |
||||
| 55 | #buttonbar a:hover { background-position:0 -150px; } |
||||
| 56 | #buttonbar a:hover span { background-position:100% -150px; } |
||||
| 57 | </style> |
||||
| 58 | "; |
||||
| 59 | |||||
| 60 | global $xoopsModule, $xoopsConfig; |
||||
| 61 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 62 | |||||
| 63 | $tblColors = []; |
||||
| 64 | $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = $tblColors[8] = ''; |
||||
| 65 | $tblColors[$currentoption] = 'current'; |
||||
| 66 | |||||
| 67 | /** @var Helper $helper */ |
||||
| 68 | $helper = Helper::getInstance(); |
||||
| 69 | $helper->loadLanguage('modinfo'); |
||||
| 70 | |||||
| 71 | echo "<div id='buttontop'>"; |
||||
| 72 | echo '<table style="width: 100%; padding: 0; " cellspacing="0"><tr>'; |
||||
| 73 | //echo "<td style=\"width: 45%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"../../system/admin.php?fct=preferences&op=showmod&mod=" . $xoopsModule->getVar('mid') . "\">" . _AM_SF_OPTS . "</a> | <a href=\"import.php\">" . _AM_SF_IMPORT . "</a> | <a href=\"../index.php\">" . _AM_SF_GOMOD . "</a> | <a href=\"../help/index.html\" target=\"_blank\">" . _AM_SF_HELP . "</a> | <a href=\"about.php\">" . _AM_SF_ABOUT . "</a></td>"; |
||||
| 74 | echo "<td style='font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;'> |
||||
| 75 | <a class='nobutton' href='" . XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid') . '\'>' . AM_XFGUESTBOOK_GENERALSET . "</a> |
||||
| 76 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/index.php'>" . AM_XFGUESTBOOK_GOINDEX . "</a> |
||||
| 77 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/flags_install.php'>" . AM_XFGUESTBOOK_INSTALL_IMG . "</a> |
||||
| 78 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/upgrade.php'>" . AM_XFGUESTBOOK_UPGRADE . "</a> |
||||
| 79 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/img_manager.php'>" . AM_XFGUESTBOOK_MSGIMG . '</a> |
||||
| 80 | </td>'; |
||||
| 81 | echo "<td style='font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;'><b>" . $myts->displayTarea($xoopsModule->name()) . ' </b> </td>'; |
||||
| 82 | echo '</tr></table>'; |
||||
| 83 | echo '</div>'; |
||||
| 84 | |||||
| 85 | echo "<div id='buttonbar'>"; |
||||
| 86 | echo '<ul>'; |
||||
| 87 | echo "<li id='" . $tblColors[0] . '\'><a href="' . XOOPS_URL . '/modules/xfguestbook/admin/index.php"><span>' . AM_XFGUESTBOOK_MSGMANAGE . '</span></a></li>'; |
||||
| 88 | echo "<li id='" . $tblColors[1] . '\'><a href="' . XOOPS_URL . '/modules/xfguestbook/admin/config.php"><span>' . AM_XFGUESTBOOK_FORMOPT . '</span></a></li>'; |
||||
| 89 | echo "<li id='" . $tblColors[2] . '\'><a href="' . XOOPS_URL . '/modules/xfguestbook/admin/country_manager.php"><span>' . AM_XFGUESTBOOK_COUNTRYMANAGE . '</span></a></li>'; |
||||
| 90 | echo "<li id='" . $tblColors[3] . '\'><a href="' . XOOPS_URL . '/modules/xfguestbook/admin/ip_manager.php"><span>' . AM_XFGUESTBOOK_BADIPSMANAGE . '</span></a></li>'; |
||||
| 91 | echo '</ul></div> '; |
||||
| 92 | } |
||||
| 93 | |||||
| 94 | /** |
||||
| 95 | * @param $sql_file_path |
||||
| 96 | * @return bool |
||||
| 97 | */ |
||||
| 98 | function executeSQL($sql_file_path) |
||||
| 99 | { |
||||
| 100 | global $xoopsModule; |
||||
| 101 | $error = false; |
||||
| 102 | // $reservedTables = array('avatar', 'avatar_users_link', 'block_module_link', 'xoopscomments', 'config', 'configcategory', 'configoption', 'image', 'imagebody', 'imagecategory', 'imgset', 'imgset_tplset_link', 'imgsetimg', 'groups','groups_users_link','group_permission', 'online', 'bannerclient', 'banner', 'bannerfinish', 'ranks', 'session', 'smiles', 'users', 'newblocks', 'modules', 'tplfile', 'tplset', 'tplsource', 'xoopsnotifications', 'banner', 'bannerclient', 'bannerfinish'); |
||||
| 103 | // $sql_file_path = XOOPS_ROOT_PATH."/modules/".$xoopsModule->dirname()."/sql/".$sqlfile; |
||||
| 104 | if (!is_file($sql_file_path)) { |
||||
| 105 | echo "SQL file not found at <b>$sql_file_path</b><br>"; |
||||
| 106 | // $msg = "SQL file not found at <b>$sql_file_path</b><br>"; |
||||
| 107 | $error = true; |
||||
| 108 | } else { |
||||
| 109 | echo "SQL file found at <b>$sql_file_path</b>.<br > Creating tables...<br>"; |
||||
| 110 | // $msg = "SQL file found at <b>$sql_file_path</b>.<br > Creating tables...<br>"; |
||||
| 111 | require_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; |
||||
| 112 | $sql_query = fread(fopen($sql_file_path, 'rb'), filesize($sql_file_path)); |
||||
|
0 ignored issues
–
show
It seems like
fopen($sql_file_path, 'rb') can also be of type false; however, parameter $handle of fread() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 113 | $sql_query = trim($sql_query); |
||||
| 114 | SqlUtility::splitMySqlFile($pieces, $sql_query); |
||||
| 115 | $created_tables = []; |
||||
| 116 | foreach ($pieces as $piece) { |
||||
| 117 | // [0] contains the prefixed query |
||||
| 118 | // [4] contains unprefixed table name |
||||
| 119 | $prefixed_query = SqlUtility::prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); |
||||
| 120 | if (!$prefixed_query) { |
||||
| 121 | // $msg = "<b>$piece</b> is not a valid SQL!<br>"; |
||||
| 122 | echo "<b>$piece</b> is not a valid SQL!<br>"; |
||||
| 123 | $error = true; |
||||
| 124 | break; |
||||
| 125 | } |
||||
| 126 | // check if the table name is reserved |
||||
| 127 | //if (!in_array($prefixed_query[4], $reservedTables)) { |
||||
| 128 | // not reserved, so try to create one |
||||
| 129 | if (!$GLOBALS['xoopsDB']->query($prefixed_query[0])) { |
||||
| 130 | //$this->setErrors($GLOBALS['xoopsDB']->error()); |
||||
| 131 | echo 'erreur<br>'; |
||||
| 132 | $error = true; |
||||
| 133 | break; |
||||
| 134 | } |
||||
| 135 | if (!in_array($prefixed_query[4], $created_tables)) { |
||||
| 136 | // $msg = ' Table <b>'.$GLOBALS['xoopsDB']->prefix($prefixed_query[4]).'</b> created.<br>'; |
||||
| 137 | echo ' Table <b>' . $GLOBALS['xoopsDB']->prefix($prefixed_query[4]) . '</b> created.<br>'; |
||||
| 138 | $created_tables[] = $prefixed_query[4]; |
||||
| 139 | } else { |
||||
| 140 | echo ' Data inserted to table <b>' . $GLOBALS['xoopsDB']->prefix($prefixed_query[4]) . '</b>.<br>'; |
||||
| 141 | // $msg = ' Data inserted to table <b>'.$GLOBALS['xoopsDB']->prefix($prefixed_query[4]).'</b>.<br>'; |
||||
| 142 | } |
||||
| 143 | |||||
| 144 | // } else { |
||||
| 145 | // the table name is reserved, so halt the installation |
||||
| 146 | // $this->setErrors('<b>'.$prefixed_query[4]."</b> is a reserved table!"); |
||||
| 147 | // $error = true; |
||||
| 148 | // break; |
||||
| 149 | // } |
||||
| 150 | } |
||||
| 151 | // if there was an error, delete the tables created so far, so the next installation will not fail |
||||
| 152 | if (true === $error) { |
||||
| 153 | foreach ($created_tables as $ct) { |
||||
| 154 | //echo $ct; |
||||
| 155 | $GLOBALS['xoopsDB']->query('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix($ct)); |
||||
| 156 | } |
||||
| 157 | } |
||||
| 158 | } |
||||
| 159 | |||||
| 160 | //} |
||||
| 161 | return $error; |
||||
| 162 | } |
||||
| 163 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.