XoopsModules25x /
xfguestbook
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | // $Id: include/cp_functions.php,v 1.3 2006/01/01 C.Felix AKA the Cat |
||
| 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 | function xfguestbook_admin_menu($currentoption = 0, $breadcrumb = '') |
||
|
0 ignored issues
–
show
|
|||
| 31 | { |
||
| 32 | |||
| 33 | /* Nice buttons styles */ |
||
| 34 | echo " |
||
| 35 | <style type='text/css'> |
||
| 36 | #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; } |
||
| 37 | #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 black; border-right: 1px solid black; margin-bottom: 12px; } |
||
| 38 | #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; } |
||
| 39 | #buttonbar li { display:inline; margin:0; padding:0; } |
||
| 40 | #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; } |
||
| 41 | #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; } |
||
| 42 | /* Commented Backslash Hack hides rule from IE5-Mac \*/ |
||
| 43 | #buttonbar a span {float:none;} |
||
| 44 | /* End IE5-Mac hack */ |
||
| 45 | #buttonbar a:hover span { color:#333; } |
||
| 46 | #buttonbar #current a { background-position:0 -150px; border-width:0; } |
||
| 47 | #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; } |
||
| 48 | #buttonbar a:hover { background-position:0 -150px; } |
||
| 49 | #buttonbar a:hover span { background-position:100% -150px; } |
||
| 50 | </style> |
||
| 51 | "; |
||
| 52 | |||
| 53 | global $xoopsModule, $xoopsConfig; |
||
| 54 | $myts = MyTextSanitizer::getInstance(); |
||
| 55 | |||
| 56 | $tblColors = array(); |
||
| 57 | $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = $tblColors[8] = ''; |
||
| 58 | $tblColors[$currentoption] = 'current'; |
||
| 59 | // if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 60 | // include_once XOOPS_ROOT_PATH . '/modules/xfguestbook/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
||
| 61 | // } else { |
||
| 62 | // include_once XOOPS_ROOT_PATH . '/modules/xfguestbook/english/modinfo.php'; |
||
| 63 | // } |
||
| 64 | xoops_loadLanguage('modinfo', $xoopsModule->getVar('dirname')); |
||
| 65 | |||
| 66 | echo "<div id='buttontop'>"; |
||
| 67 | echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>"; |
||
| 68 | //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>"; |
||
| 69 | echo "<td style='font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;'> |
||
| 70 | <a class='nobutton' href='" . XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid') . "'>" . _AM_XFGB_GENERALSET . "</a> |
||
| 71 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/index.php'>" . _AM_XFGB_GOINDEX . "</a> |
||
| 72 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/flags_install.php'>" . _AM_XFGB_INSTALL_IMG . "</a> |
||
| 73 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/upgrade.php'>" . _AM_XFGB_UPGRADE . "</a> |
||
| 74 | | <a href='" . XOOPS_URL . "/modules/xfguestbook/admin/img_manager.php'>" . _AM_XFGB_MSGIMG . '</a> |
||
| 75 | </td>'; |
||
| 76 | echo "<td style='font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;'><b>" . $myts->displayTarea($xoopsModule->name()) . ' </b> </td>'; |
||
| 77 | echo '</tr></table>'; |
||
| 78 | echo '</div>'; |
||
| 79 | |||
| 80 | echo "<div id='buttonbar'>"; |
||
| 81 | echo '<ul>'; |
||
| 82 | echo "<li id='" . $tblColors[0] . "'><a href=\"" . XOOPS_URL . "/modules/xfguestbook/admin/index.php\"><span>" . _AM_XFGB_MSGMANAGE . '</span></a></li>'; |
||
| 83 | echo "<li id='" . $tblColors[1] . "'><a href=\"" . XOOPS_URL . "/modules/xfguestbook/admin/config.php\"><span>" . _AM_XFGB_FORMOPT . '</span></a></li>'; |
||
| 84 | echo "<li id='" . $tblColors[2] . "'><a href=\"" . XOOPS_URL . "/modules/xfguestbook/admin/country_manager.php\"><span>" . _AM_XFGB_COUNTRYMANAGE . '</span></a></li>'; |
||
| 85 | echo "<li id='" . $tblColors[3] . "'><a href=\"" . XOOPS_URL . "/modules/xfguestbook/admin/ip_manager.php\"><span>" . _AM_XFGB_BADIPSMANAGE . '</span></a></li>'; |
||
| 86 | echo '</ul></div> '; |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @param $sql_file_path |
||
| 91 | * @return bool |
||
| 92 | */ |
||
| 93 | function executeSQL($sql_file_path) |
||
| 94 | { |
||
| 95 | global $xoopsModule; |
||
| 96 | $error = false; |
||
| 97 | // $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'); |
||
| 98 | // $sql_file_path = XOOPS_ROOT_PATH."/modules/".$xoopsModule->dirname()."/sql/".$sqlfile; |
||
| 99 | if (!file_exists($sql_file_path)) { |
||
| 100 | echo "SQL file not found at <b>$sql_file_path</b><br>"; |
||
| 101 | // $msg = "SQL file not found at <b>$sql_file_path</b><br>"; |
||
| 102 | $error = true; |
||
| 103 | } else { |
||
| 104 | echo "SQL file found at <b>$sql_file_path</b>.<br /> Creating tables...<br>"; |
||
| 105 | // $msg = "SQL file found at <b>$sql_file_path</b>.<br /> Creating tables...<br>"; |
||
| 106 | include_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; |
||
| 107 | $sql_query = fread(fopen($sql_file_path, 'r'), filesize($sql_file_path)); |
||
| 108 | $sql_query = trim($sql_query); |
||
| 109 | SqlUtility::splitMySqlFile($pieces, $sql_query); |
||
| 110 | $created_tables = array(); |
||
| 111 | foreach ($pieces as $piece) { |
||
| 112 | // [0] contains the prefixed query |
||
| 113 | // [4] contains unprefixed table name |
||
| 114 | $prefixed_query = SqlUtility::prefixQuery($piece, $GLOBALS['xoopsDB']->prefix()); |
||
| 115 | if (!$prefixed_query) { |
||
| 116 | // $msg = "<b>$piece</b> is not a valid SQL!<br>"; |
||
| 117 | echo "<b>$piece</b> is not a valid SQL!<br>"; |
||
| 118 | $error = true; |
||
| 119 | break; |
||
| 120 | } |
||
| 121 | // check if the table name is reserved |
||
| 122 | //if (!in_array($prefixed_query[4], $reservedTables)) { |
||
| 123 | // not reserved, so try to create one |
||
| 124 | if (!$GLOBALS['xoopsDB']->query($prefixed_query[0])) { |
||
| 125 | //$this->setErrors($GLOBALS['xoopsDB']->error()); |
||
| 126 | echo 'erreur<br>'; |
||
| 127 | $error = true; |
||
| 128 | break; |
||
| 129 | } else { |
||
| 130 | if (!in_array($prefixed_query[4], $created_tables)) { |
||
| 131 | // $msg = ' Table <b>'.$GLOBALS['xoopsDB']->prefix($prefixed_query[4]).'</b> created.<br>'; |
||
| 132 | echo ' Table <b>' . $GLOBALS['xoopsDB']->prefix($prefixed_query[4]) . '</b> created.<br>'; |
||
| 133 | $created_tables[] = $prefixed_query[4]; |
||
| 134 | } else { |
||
| 135 | echo ' Data inserted to table <b>' . $GLOBALS['xoopsDB']->prefix($prefixed_query[4]) . '</b>.<br>'; |
||
| 136 | // $msg = ' Data inserted to table <b>'.$GLOBALS['xoopsDB']->prefix($prefixed_query[4]).'</b>.<br>'; |
||
| 137 | } |
||
| 138 | } |
||
| 139 | // } else { |
||
| 140 | // the table name is reserved, so halt the installation |
||
| 141 | // $this->setErrors('<b>'.$prefixed_query[4]."</b> is a reserved table!"); |
||
| 142 | // $error = true; |
||
| 143 | // break; |
||
| 144 | // } |
||
| 145 | } |
||
| 146 | // if there was an error, delete the tables created so far, so the next installation will not fail |
||
| 147 | if ($error === true) { |
||
| 148 | foreach ($created_tables as $ct) { |
||
| 149 | //echo $ct; |
||
| 150 | $GLOBALS['xoopsDB']->query('DROP TABLE ' . $GLOBALS['xoopsDB']->prefix($ct)); |
||
| 151 | } |
||
| 152 | } |
||
| 153 | } |
||
| 154 | |||
| 155 | //} |
||
| 156 | return $error; |
||
| 157 | } |
||
| 158 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.