Passed
Push — master ( 48d769...5ccf6e )
by Michael
07:14
created

delete.php (2 issues)

Labels
1
<?php
2
// -------------------------------------------------------------------------
3
4
use XoopsModules\Pedigree;
5
6
7
//require_once  dirname(dirname(__DIR__)) . '/mainfile.php';
8
require_once __DIR__ . '/header.php';
9
$moduleDirName = basename(__DIR__);
10
xoops_loadLanguage('main', $moduleDirName);
11
// Include any common code for this module.
12
require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php';
13
14
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_delete.tpl';
15
16
include XOOPS_ROOT_PATH . '/header.php';
17
18
//get module configuration
19
/** @var XoopsModuleHandler $moduleHandler */
20
$moduleHandler = xoops_getHandler('module');
21
$module        = $moduleHandler->getByDirname($moduleDirName);
22
$configHandler = xoops_getHandler('config');
23
$moduleConfig  = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
0 ignored issues
show
The method getConfigsByCat() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
$moduleConfig  = $configHandler->/** @scrutinizer ignore-call */ getConfigsByCat(0, $module->getVar('mid'));
Loading history...
24
25
//check for access
26
$xoopsModule = XoopsModule::getByDirname($moduleDirName);
27
if (empty($GLOBALS['xoopsUser']) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
28
    redirect_header('javascript:history.go(-1)', 3, _NOPERM . '<br>' . _MA_PEDIGREE_REGIST);
29
}
30
31
global $xoopsTpl;
32
global $xoopsDB;
33
global $xoopsModuleConfig;
34
35
$id = $_GET['id'];
36
//query (find values for this dog (and format them))
37
$queryString = 'SELECT naam, user, roft FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_tree') . ' WHERE id=' . $id;
38
$result      = $GLOBALS['xoopsDB']->query($queryString);
39
40
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
41
    //ID
42
    $id = $row['id'];
43
    //name
44
    $naam     = htmlentities(stripslashes($row['naam']), ENT_QUOTES);
45
    $namelink = '<a href="dog.php?id=' . $row['id'] . '">' . stripslashes($row['naam']) . '</a>';
46
    //user who entered the info
47
    $dbuser = $row['user'];
48
    $roft   = $row['roft'];
49
}
50
51
//create form
52
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
53
$form = new \XoopsThemeForm($naam, 'deletedata', 'deletepage.php', 'post', true);
54
//hidden value current record owner
55
$form->addElement(new \XoopsFormHidden('dbuser', $dbuser));
56
//hidden value dog ID
57
$form->addElement(new \XoopsFormHidden('dogid', $_GET['id']));
58
$form->addElement(new \XoopsFormHidden('curname', $naam));
59
$form->addElement(new \XoopsFormHiddenToken($name = 'XOOPS_TOKEN_REQUEST', $timeout = 360));
60
$form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_DELE_SURE, _MA_PEDIGREE_DEL_MSG . $moduleConfig['animalType'] . ' : <b>' . $naam . '</b>?'));
61
$pups = pups($_GET['id'], $roft);
0 ignored issues
show
Are you sure the assignment to $pups is correct as pups($_GET['id'], $roft) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
62
$form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_DELE_WARN, _MA_PEDIGREE_ALL . $moduleConfig['children'] . _MA_PEDIGREE_ALL_ORPH . $pups));
63
$form->addElement(new \XoopsFormButton('', 'button_id', _DELETE, 'submit'));
64
//add data (form) to smarty template
65
$xoopsTpl->assign('form', $form->render());
66
67
//footer
68
include XOOPS_ROOT_PATH . '/footer.php';
69