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 | |||
10 | //xoops_loadLanguage('main', basename(dirname(__DIR__))); |
||
11 | $moduleDirName = basename(__DIR__); |
||
12 | xoops_loadLanguage('main', $moduleDirName); |
||
13 | |||
14 | require_once __DIR__ . '/header.php'; |
||
15 | |||
16 | // Include any common code for this module. |
||
17 | require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
||
18 | |||
19 | // Get all HTTP post or get parameters into global variables that are prefixed with "param_" |
||
20 | //import_request_variables("gp", "param_"); |
||
21 | extract($_GET, EXTR_PREFIX_ALL, 'param'); |
||
22 | extract($_POST, EXTR_PREFIX_ALL, 'param'); |
||
23 | |||
24 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_owner.tpl'; |
||
25 | |||
26 | include $GLOBALS['xoops']->path('/header.php'); |
||
27 | |||
28 | $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||
29 | $GLOBALS['xoTheme']->addScript('browse.php?modules/' . $moduleDirName . '/assets/js/jquery.magnific-popup.min.js'); |
||
30 | $GLOBALS['xoTheme']->addStylesheet('browse.php?modules/' . $moduleDirName . '/assets/css/style.css'); |
||
31 | |||
32 | $GLOBALS['xoTheme']->addStylesheet(PEDIGREE_URL . '/assets/css/magnific-popup.css'); |
||
33 | |||
34 | if (isset($GLOBALS['xoTheme'])) { |
||
35 | $GLOBALS['xoTheme']->addScript('include/color-picker.js'); |
||
36 | } else { |
||
37 | echo '<script type="text/javascript" src="' . XOOPS_URL . '/include/color-picker.js"></script>'; |
||
38 | } |
||
39 | |||
40 | //@todo move language string to language file |
||
41 | $xoopsTpl->assign('page_title', 'Pedigree database - View Owner/Breeder details'); |
||
42 | |||
43 | //get module configuration |
||
44 | /** @var XoopsModuleHandler $moduleHandler */ |
||
45 | $moduleHandler = xoops_getHandler('module'); |
||
46 | $module = $moduleHandler->getByDirname($moduleDirName); |
||
47 | $configHandler = xoops_getHandler('config'); |
||
48 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||
49 | |||
50 | global $xoopsTpl, $xoopsModuleConfig, $xoopsModule; |
||
51 | |||
52 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||
53 | |||
54 | xoops_load('XoopsUserUtility'); |
||
55 | |||
56 | $ownid = Request::getInt('ownid', 0, 'GET'); |
||
57 | |||
58 | //query |
||
59 | $queryString = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE id=' . $ownid; |
||
60 | $result = $GLOBALS['xoopsDB']->query($queryString); |
||
61 | |||
62 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
63 | //id |
||
64 | $id = $row['id']; |
||
65 | |||
66 | //name |
||
67 | $naam = stripslashes($row['firstname']) . ' ' . stripslashes($row['lastname']); |
||
68 | |||
69 | //lastname |
||
70 | $naaml = stripslashes($row['lastname']); |
||
71 | |||
72 | //firstname |
||
73 | $naamf = stripslashes($row['firstname']); |
||
74 | |||
75 | |||
76 | $email = $row['emailadres']; |
||
77 | |||
78 | //homepage - changed to be regular expression check for http or https (case insensitive) |
||
79 | $homepage = $row['website']; |
||
80 | if (!empty($homepage) && !preg_match('/^(https?:\/\/)/i', $homepage)) { |
||
81 | $homepage = "http://{$homepage}"; |
||
82 | } |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
83 | /* |
||
84 | $check = substr($homepage, 0, 7); |
||
85 | if ('http://' !== $check) { |
||
86 | $homepage = 'http://' . $homepage; |
||
87 | } |
||
88 | |||
89 | //Owner of |
||
90 | $owner = Pedigree\Utility::breederof($row['id'], 0); |
||
91 | |||
92 | //Breeder of |
||
93 | $breeder = Pedigree\Utility::breederof($row['id'], 1); |
||
94 | |||
95 | //entered into the database by |
||
96 | $dbuser = \XoopsUserUtility::getUnameFromId($row['user']); |
||
97 | |||
98 | //check for edit rights |
||
99 | $access = 0; |
||
100 | $xoopsModule = XoopsModule::getByDirname($moduleDirName); |
||
101 | if (!empty($GLOBALS['xoopsUser'])) { |
||
102 | if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
||
103 | $access = 1; |
||
104 | } |
||
105 | if ($row['user'] == $GLOBALS['xoopsUser']->getVar('uid')) { |
||
106 | $access = 1; |
||
107 | } |
||
108 | } |
||
109 | |||
110 | //lastname |
||
111 | $items[] = [ |
||
112 | 'header' => _MA_PEDIGREE_OWN_LNAME, |
||
113 | 'data' => '<a href="owner.php?ownid=' . $row['id'] . '">' . $naaml . '</a>', |
||
114 | 'edit' => '<a href="updateowner.php?id=' . $row['id'] . "&fld=nl\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>" |
||
115 | ]; |
||
116 | |||
117 | //firstname |
||
118 | $items[] = [ |
||
119 | 'header' => _MA_PEDIGREE_OWN_FNAME, |
||
120 | 'data' => '<a href="owner.php?ownid=' . $row['id'] . '">' . $naamf . '</a>', |
||
121 | 'edit' => '<a href="updateowner.php?id=' . $row['id'] . "&fld=nf\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>" |
||
122 | ]; |
||
123 | |||
124 | |||
125 | $items[] = [ |
||
126 | 'header' => _MA_PEDIGREE_FLD_OWN_EMAIL, |
||
127 | 'data' => '<a href="mailto:' . $email . '">' . $email . '</a>', |
||
128 | 'edit' => '<a href="updateowner.php?id=' . $row['id'] . "&fld=em\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>" |
||
129 | ]; |
||
130 | //homepage |
||
131 | $items[] = [ |
||
132 | 'header' => _MA_PEDIGREE_FLD_OWN_WEB, |
||
133 | 'data' => '<a href="' . $homepage . '" target="_blank">' . $homepage . '</a>', |
||
134 | 'edit' => '<a href="updateowner.php?id=' . $row['id'] . "&fld=we\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>" |
||
135 | ]; |
||
136 | //owner of |
||
137 | $items[] = [ |
||
138 | 'header' => _MA_PEDIGREE_OWN_OWN, |
||
139 | 'data' => $owner, |
||
140 | 'edit' => '' |
||
141 | ]; |
||
142 | //breeder of |
||
143 | $items[] = [ |
||
144 | 'header' => _MA_PEDIGREE_OWN_BRE, |
||
145 | 'data' => $breeder, |
||
146 | 'edit' => '' |
||
147 | ]; |
||
148 | |||
149 | //database user |
||
150 | $items[] = [ |
||
151 | 'header' => _MA_PEDIGREE_FLD_DBUS, |
||
152 | 'data' => $dbuser, |
||
153 | 'edit' => '' |
||
154 | ]; |
||
155 | } |
||
156 | |||
157 | //add data to smarty template |
||
158 | $xoopsTpl->assign('access', $access); |
||
159 | $xoopsTpl->assign('dogs', $items); |
||
160 | $xoopsTpl->assign('name', $naam); |
||
161 | $xoopsTpl->assign('id', $id); |
||
162 | //$xoopsTpl->assign("delete", _DELETE); |
||
163 | $xoopsTpl->assign('delete', "<img src=' " . $pathIcon16 . "/delete.png' border='0' alt=_DELETE title=_DELETE>"); |
||
164 | |||
165 | //comments and footer |
||
166 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
167 |