1
|
|
|
<?php |
2
|
|
|
// ------------------------------------------------------------------------- |
3
|
|
|
|
4
|
|
|
require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
5
|
|
|
|
6
|
|
|
$moduleDirName = basename(__DIR__); |
7
|
|
|
xoops_loadLanguage('main', $moduleDirName); |
8
|
|
|
xoops_load('XoopsRequest'); |
9
|
|
|
// Include any common code for this module. |
10
|
|
|
require_once XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/include/common.php"; |
11
|
|
|
|
12
|
|
|
//check for access |
13
|
|
View Code Duplication |
if (!$xoopsUser instanceof XoopsUser) { |
|
|
|
|
14
|
|
|
redirect_header('index.php', 3, _NOPERM . '<br />' . _MA_PEDIGREE_REGIST); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
$xoopsOption['template_main'] = 'pedigree_adddog.tpl'; |
18
|
|
|
include XOOPS_ROOT_PATH . '/header.php'; |
19
|
|
|
|
20
|
|
|
//@todo - move language string to language file |
21
|
|
|
$xoopsTpl->assign('page_title', 'Pedigree database - Add owner/breeder'); |
22
|
|
|
|
23
|
|
|
global $xoopsTpl, $xoopsUser, $xoopsDB; |
|
|
|
|
24
|
|
|
|
25
|
|
|
$f = XoopsRequest::getCmd('f', '', 'POST'); |
26
|
|
|
if ('check' === $f) { |
27
|
|
|
//check security token here |
28
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
29
|
|
|
redirect_header($_SERVER['PHP_SELF'], 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$achternaam = XoopsRequest::getString('achternaam', '', 'POST'); |
33
|
|
|
$voornaam = XoopsRequest::getString('voornaam', '', 'POST'); |
34
|
|
|
$email = XoopsRequest::getEmail('email', '', 'POST'); |
35
|
|
|
$website = XoopsRequest::getUrl('website', '', 'POST'); |
36
|
|
|
$user = XoopsRequest::getString('user', '', 'POST'); |
37
|
|
|
|
38
|
|
|
//insert into owner |
39
|
|
|
//$query = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . " VALUES ('','" . $voornaam . "','" . $achternaam . "','','','','','','" . $email . "','" . $website . "','" . $user . "')"; |
|
|
|
|
40
|
|
|
$query = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . " VALUES ('','" . $GLOBALS['xoopsDB']->escape($voornaam) . "','" . $GLOBALS['xoopsDB']->escape($achternaam) . "','','','','','','" . $GLOBALS['xoopsDB']->escape($email) . "','" . $GLOBALS['xoopsDB']->escape($website) . "','" . $GLOBALS['xoopsDB']->escape($user) . "')"; |
41
|
|
|
|
42
|
|
|
$GLOBALS['xoopsDB']->query($query); |
43
|
|
|
//@todo - move language string to language file |
44
|
|
|
redirect_header('index.php', 1, 'The data has been stored.'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
//check for access |
48
|
|
|
$xoopsModule = XoopsModule::getByDirname('pedigree'); |
49
|
|
|
|
50
|
|
|
//create form |
51
|
|
|
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
52
|
|
|
$form = new XoopsThemeForm(_MA_PEDIGREE_ADD_OWNER, 'breedername', 'add_breeder.php?f=check', 'POST'); |
53
|
|
|
$form->addElement(new XoopsFormHiddenToken($name = 'XOOPS_TOKEN_REQUEST', $timeout = 360)); |
54
|
|
|
$form->addElement(new XoopsFormHidden('user', $xoopsUser->getVar('uid'))); |
55
|
|
|
//lastname |
56
|
|
|
$form->addElement(new XoopsFormText('<b>' . _MA_PEDIGREE_FLD_OWN_LNAME . '</b>', 'achternaam', $size = 50, $maxsize = 255, $value = '')); |
57
|
|
|
|
58
|
|
|
//firstname |
59
|
|
|
$form->addElement(new XoopsFormText('<b>' . _MA_PEDIGREE_FLD_OWN_FNAME . '</b>', 'voornaam', $size = 50, $maxsize = 255, $value = '')); |
60
|
|
|
|
61
|
|
|
//email |
62
|
|
|
$form->addElement(new XoopsFormText('<b>' . _MA_PEDIGREE_FLD_OWN_EMAIL . '</b>', 'email', $size = 50, $maxsize = 255, $value = '')); |
63
|
|
|
|
64
|
|
|
//website |
65
|
|
|
$form->addElement(new XoopsFormText('<b>' . _MA_PEDIGREE_FLD_OWN_WEB . '</b>', 'website', $size = 50, $maxsize = 255, $value = '')); |
66
|
|
|
$form->addElement(new XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, _MA_PEDIGREE_FLD_OWN_WEB_EX)); |
67
|
|
|
|
68
|
|
|
//submit button |
69
|
|
|
$form->addElement(new XoopsFormButton('', 'button_id', _MA_PEDIGREE_ADD_OWNER, 'submit')); |
70
|
|
|
|
71
|
|
|
//add data (form) to smarty template |
72
|
|
|
$xoopsTpl->assign('form', $form->render()); |
73
|
|
|
|
74
|
|
|
//footer |
75
|
|
|
include XOOPS_ROOT_PATH . '/footer.php'; |
76
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.