Passed
Push — master ( 41940e...005d4f )
by Michael
36s queued 18s
created

deletebreeder.php (1 issue)

Labels
Severity
1
<?php
2
// -------------------------------------------------------------------------
3
4
use Xmf\Request;
5
use XoopsModules\Pedigree;
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 = Request::getInt('id', 0, 'GET');
36
//query (find values for this dog (and format them))
37
$queryString = 'SELECT lastname, firstname, user FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' 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['lastname']) . ', ' . stripslashes($row['firstname']), ENT_QUOTES);
45
    $namelink = '<a href="owner.php?ownid=' . $row['id'] . '">' . stripslashes($row['lastname']) . ', ' . stripslashes($row['firstname']) . '</a>';
46
    //user who entered the info
47
    $dbuser = $row['user'];
48
}
49
50
//create form
51
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
52
$form = new \XoopsThemeForm($naam, 'deletedata', 'deletebreederpage.php', 'post', true);
53
//hidden value current record owner
54
$form->addElement(new \XoopsFormHidden('dbuser', $dbuser));
55
//hidden value dog ID
56
$form->addElement(new \XoopsFormHidden('dogid', $_GET['id']));
57
$form->addElement(new \XoopsFormHidden('curname', $naam));
58
$form->addElement(new \XoopsFormHiddenToken($name = 'XOOPS_TOKEN_REQUEST', $timeout = 360));
59
$form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_DELE_SURE, _MA_PEDIGREE_DELE_CONF_OWN . '<b>' . $naam . '</b>?'));
60
$breeder = Pedigree\Utility::breederof($_GET['id'], 1);
61
if ('' != $breeder) {
62
    $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_DELE_WARN, strtr(_MA_PEDIGREE_DELE_WARN_BREEDER, ['[animalTypes]' => $moduleConfig['animalTypes']]) . '<br><br>' . $breeder));
63
}
64
$owner = Pedigree\Utility::breederof($_GET['id'], 0);
65
if ('' != $owner) {
66
    $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_DELE_WARN, strtr(_MA_PEDIGREE_DELE_WARN_OWNER, ['[animalTypes]' => $moduleConfig['animalTypes']]) . '<br><br>' . $owner));
67
}
68
$form->addElement(new \XoopsFormButton('', 'button_id', _DELETE, 'submit'));
69
//add data (form) to smarty template
70
$xoopsTpl->assign('form', $form->render());
71
72
//footer
73
include XOOPS_ROOT_PATH . '/footer.php';
74