Completed
Push — master ( 53db9c...d00923 )
by Michael
03:42 queued 01:42
created

whoswho.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright      {@link https://xoops.org/ XOOPS Project}
14
 * @license        {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package
16
 * @since
17
 * @author         XOOPS Development Team
18
 */
19
20
/*
21
 * Created on 28 oct. 2006
22
 *
23
 * This page will display a list of the authors of the site
24
 *
25
 * @package News
26
 * @author Herve Thouzard
27
 * @copyright (c) Herve Thouzard (http://www.herve-thouzard.com)
28
 */
29
include __DIR__ . '/../../mainfile.php';
30
require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
31
require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
32
require_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
33
require_once XOOPS_ROOT_PATH . '/modules/news/class/utility.php';
34
35
if (!NewsUtility::getModuleOption('newsbythisauthor')) {
36
    redirect_header('index.php', 2, _ERRORS);
37
}
38
39
$GLOBALS['xoopsOption']['template_main'] = 'news_whos_who.tpl';
40
require_once XOOPS_ROOT_PATH . '/header.php';
41
42
$option  = NewsUtility::getModuleOption('displayname');
43
$article = new NewsStory();
44
$uid_ids = [];
45
$uid_ids = $article->getWhosWho(NewsUtility::getModuleOption('restrictindex'));
46
if (count($uid_ids) > 0) {
47
    $lst_uid       = implode(',', $uid_ids);
48
    $memberHandler = xoops_getHandler('member');
49
    $critere       = new Criteria('uid', '(' . $lst_uid . ')', 'IN');
50
    $tbl_users     = $memberHandler->getUsers($critere);
51
    foreach ($tbl_users as $one_user) {
52
        $uname = '';
53
        switch ($option) {
54
            case 1: // Username
55
                $uname = $one_user->getVar('uname');
56
                break;
57
58 View Code Duplication
            case 2: // Display full name (if it is not empty)
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
                if ('' !== xoops_trim($one_user->getVar('name'))) {
60
                    $uname = $one_user->getVar('name');
61
                } else {
62
                    $uname = $one_user->getVar('uname');
63
                }
64
                break;
65
        }
66
        $xoopsTpl->append('whoswho', [
67
            'uid'            => $one_user->getVar('uid'),
68
            'name'           => $uname,
69
            'user_avatarurl' => XOOPS_URL . '/uploads/' . $one_user->getVar('user_avatar')
70
        ]);
71
    }
72
}
73
74
$xoopsTpl->assign('advertisement', NewsUtility::getModuleOption('advertisement'));
75
76
/**
77
 * Manage all the meta datas
78
 */
79
NewsUtility::createMetaDatas($article);
80
81
$xoopsTpl->assign('xoops_pagetitle', _AM_NEWS_WHOS_WHO);
82
$myts             = MyTextSanitizer::getInstance();
83
$meta_description = _AM_NEWS_WHOS_WHO . ' - ' . $xoopsModule->name('s');
84 View Code Duplication
if (isset($xoTheme) && is_object($xoTheme)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
    $xoTheme->addMeta('meta', 'description', $meta_description);
86
} else { // Compatibility for old Xoops versions
87
    $xoopsTpl->assign('xoops_meta_description', $meta_description);
88
}
89
90
require_once XOOPS_ROOT_PATH . '/footer.php';
91