|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits of |
|
4
|
|
|
supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit |
|
6
|
|
|
authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, but |
|
9
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Module: Pedigree |
|
15
|
|
|
* |
|
16
|
|
|
* @package XoopsModules\Pedigree |
|
17
|
|
|
* @author XOOPS Module Development Team |
|
18
|
|
|
* @copyright Copyright (c) 2001-2019 {@link https://xoops.org XOOPS Project} |
|
19
|
|
|
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
use Xmf\Request; |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
//require_once \dirname(__DIR__, 2) . '/mainfile.php'; |
|
25
|
|
|
require_once __DIR__ . '/header.php'; |
|
26
|
|
|
|
|
27
|
|
|
$moduleDirName = basename(__DIR__); |
|
28
|
|
|
xoops_loadLanguage('main', $moduleDirName); |
|
29
|
|
|
|
|
30
|
|
|
// Include any common code for this module. |
|
31
|
|
|
/* |
|
32
|
|
|
// Get all HTTP post or get parameters into global variables that are prefixed with "param_" |
|
33
|
|
|
//import_request_variables("gp", "param_"); |
|
34
|
|
|
extract($_GET, EXTR_PREFIX_ALL, "param"); |
|
35
|
|
|
extract($_POST, EXTR_PREFIX_ALL, "param"); |
|
36
|
|
|
*/ |
|
37
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_members.tpl'; |
|
38
|
|
|
|
|
39
|
|
|
require $GLOBALS['xoops']->path('/header.php'); |
|
40
|
|
|
|
|
41
|
|
|
$sql = 'SELECT COUNT(d.user) AS X, d.user AS d_user, u.uname AS u_uname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' d LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('users') . ' u ON d.user = u.uid GROUP BY user ORDER BY X DESC LIMIT 50'; |
|
42
|
|
|
$result = $GLOBALS['xoopsDB']->query($sql); |
|
43
|
|
|
$numpos = 1; |
|
44
|
|
|
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
45
|
|
|
$content = ''; |
|
46
|
|
|
$star = $row['X']; |
|
47
|
|
|
if ($star > 10000) { |
|
48
|
|
|
$sterretje = floor($star / 10000); |
|
49
|
|
|
for ($c = 0; $c < $sterretje; ++$c) { |
|
50
|
|
|
$content .= "<img src=\"" . PEDIGREE_IMAGE_URL . "/star.png\" border=\"0\">"; |
|
|
|
|
|
|
51
|
|
|
$star -= 10000; |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
if ($star > 1000) { |
|
55
|
|
|
$sterretje = floor($star / 1000); |
|
56
|
|
|
for ($c = 0; $c < $sterretje; ++$c) { |
|
57
|
|
|
$content .= "<img src=\"" . PEDIGREE_IMAGE_URL . "/star3.gif\" border=\"0\">"; |
|
58
|
|
|
$star -= 1000; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
if ($star > 100) { |
|
62
|
|
|
$sterretje = floor($star / 100); |
|
63
|
|
|
for ($c = 0; $c < $sterretje; ++$c) { |
|
64
|
|
|
$content .= "<img src=\"" . PEDIGREE_IMAGE_URL . "/star2.gif\" border=\"0\">"; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
$members[] = [ |
|
69
|
|
|
'position' => $numpos, |
|
70
|
|
|
'user' => '<a href="../../userinfo.php?uid=' . $row['d_user'] . '">' . $row['u_uname'] . '</a>', |
|
71
|
|
|
'stars' => $content, |
|
72
|
|
|
'nument' => '<a href="result.php?f=user&l=0&w=' . $row['d_user'] . '&o=pname">' . $row['X'] . '</a>', |
|
73
|
|
|
]; |
|
74
|
|
|
++$numpos; |
|
75
|
|
|
} |
|
76
|
|
|
$GLOBALS['xoopsTpl']->assign('members', $members); |
|
77
|
|
|
$GLOBALS['xoopsTpl']->assign('title', _MA_PEDIGREE_M50_TIT); |
|
78
|
|
|
$GLOBALS['xoopsTpl']->assign('position', _MA_PEDIGREE_M50_POS); |
|
79
|
|
|
$GLOBALS['xoopsTpl']->assign('numdogs', _MA_PEDIGREE_M50_NUMD); |
|
80
|
|
|
//comments and footer |
|
81
|
|
|
require $GLOBALS['xoops']->path('footer.php'); |
|
82
|
|
|
|
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: