XoopsModules25x /
xoopshp
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | if (!defined('XOOPS_ROOT_PATH')) { |
||
| 4 | exit; |
||
| 5 | } |
||
| 6 | |||
| 7 | // referer check |
||
| 8 | $ref = xoops_getenv('HTTP_REFERER'); |
||
| 9 | if ($ref === '' || strpos($ref, XOOPS_URL . '/modules/system/admin.php') === 0) { |
||
| 10 | /* XoopsHP specific part */ |
||
| 11 | |||
| 12 | global $xoopsDB, $xoopsUser, $xoopsModule; |
||
| 13 | include XOOPS_ROOT_PATH . '/modules/' . $modversion['dirname'] . '/module_prefix.php'; |
||
| 14 | |||
| 15 | // Perms check |
||
| 16 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
||
| 17 | exit('Access Denied'); |
||
| 18 | } |
||
| 19 | |||
| 20 | // DB Maintenance |
||
| 21 | |||
| 22 | if ($xoopsDB->query('SELECT display FROM ' . $xoopsDB->prefix($module_prefix . '_quiz')) === false) { |
||
| 23 | |||
| 24 | // quiz database |
||
| 25 | $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix($module_prefix . '_quiz') . " ADD display TINYINT NOT NULL DEFAULT '1'"); |
||
| 26 | if ($result) { |
||
| 27 | // echo '<br>' . _AM_MSG_UPDATE_FAILED." (".$xoopsDB->prefix($module_prefix."_quiz").".display) <br>"; |
||
| 28 | $errors++; |
||
| 29 | } else { |
||
|
0 ignored issues
–
show
|
|||
| 30 | // echo _AM_MSG_UPDATE_SUCCEEDED." (".$xoopsDB->prefix($module_prefix."_quiz").".display) <br>"; |
||
| 31 | } |
||
| 32 | |||
| 33 | $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix($module_prefix . '_quiz') . " ADD expire DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"); |
||
| 34 | if ($result) { |
||
| 35 | // echo '<br>' . _AM_MSG_UPDATE_FAILED." (".$xoopsDB->prefix($module_prefix."_quiz").".expire) <br>"; |
||
| 36 | $errors++; |
||
| 37 | } else { |
||
|
0 ignored issues
–
show
This
else statement is empty and can be removed.
This check looks for the These if (rand(1, 6) > 3) {
print "Check failed";
} else {
//print "Check succeeded";
}
could be turned into if (rand(1, 6) > 3) {
print "Check failed";
}
This is much more concise to read. Loading history...
|
|||
| 38 | // echo _AM_MSG_UPDATE_SUCCEEDED." (".$xoopsDB->prefix($module_prefix."_quiz").".expire) <br>"; |
||
| 39 | } |
||
| 40 | |||
| 41 | // sections database |
||
| 42 | $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix($module_prefix . '_sections') . " ADD display TINYINT NOT NULL DEFAULT '1'"); |
||
| 43 | if ($result) { |
||
| 44 | echo '<br>' . _AM_MSG_UPDATE_FAILED . ' (' . $xoopsDB->prefix($module_prefix . '_sections') . '.display) <br>'; |
||
| 45 | $errors++; |
||
| 46 | } else { |
||
|
0 ignored issues
–
show
This
else statement is empty and can be removed.
This check looks for the These if (rand(1, 6) > 3) {
print "Check failed";
} else {
//print "Check succeeded";
}
could be turned into if (rand(1, 6) > 3) {
print "Check failed";
}
This is much more concise to read. Loading history...
|
|||
| 47 | // echo _AM_MSG_UPDATE_SUCCEEDED." (".$xoopsDB->prefix($module_prefix."_sections").".display) <br>"; |
||
| 48 | } |
||
| 49 | |||
| 50 | $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix($module_prefix . '_sections') . " ADD expire DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"); |
||
| 51 | if ($result) { |
||
| 52 | // echo '<br>' . _AM_MSG_UPDATE_FAILED." (".$xoopsDB->prefix($module_prefix."_sections").".expire) <br>"; |
||
| 53 | $errors++; |
||
| 54 | } else { |
||
|
0 ignored issues
–
show
This
else statement is empty and can be removed.
This check looks for the These if (rand(1, 6) > 3) {
print "Check failed";
} else {
//print "Check succeeded";
}
could be turned into if (rand(1, 6) > 3) {
print "Check failed";
}
This is much more concise to read. Loading history...
|
|||
| 55 | // echo _AM_MSG_UPDATE_SUCCEEDED." (".$xoopsDB->prefix($module_prefix."_sections").".expire) <br>"; |
||
| 56 | } |
||
| 57 | |||
| 58 | // echo "Database update ended with ".$errors."error(s)"; |
||
| 59 | } |
||
| 60 | |||
| 61 | /* Misc */ |
||
| 62 | |||
| 63 | // Add other stuff below |
||
| 64 | } |
||
| 65 |
This check looks for the
elsebranches ofifstatements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
elsebranches can be removed.could be turned into
This is much more concise to read.