Passed
Push — master ( 4761c2...696f77 )
by
unknown
05:50 queued 19s
created

blocks/friends_block.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
/*
5
 You may not change or alter any portion of this comment or credits
6
 of supporting developers from this source code or any supporting source code
7
 which is considered copyrighted (c) material of the original comment or credit authors.
8
9
 This program is distributed in the hope that it will be useful,
10
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
*/
13
14
/**
15
 * @category        Module
16
 * @package         suico
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
20
 */
21
22
use XoopsModules\Suico;
23
24
if (!defined('XOOPS_ROOT_PATH')) {
25
    exit();
26
}
27
//include_once(XOOPS_ROOT_PATH."/class/criteria.php");
28
//require_once XOOPS_ROOT_PATH . '/modules/suico/class/Friendship.php';
29
/**
30
 * @param $options
31
 * @return array
32
 */
33
function b_suico_friends_show($options)
34
{
35
    global $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsUser;
36
    $myts  = MyTextSanitizer::getInstance();
0 ignored issues
show
The assignment to $myts is dead and can be removed.
Loading history...
37
    $block = [];
38
    if ($xoopsUser) {
39
        /**
40
         * Filter for fetch votes ishot and isnothot
41
         */
42
        $criteria2 = new Criteria(
43
            'friend1_uid', $xoopsUser->getVar(
44
            'uid'
45
        )
46
        );
47
        /**
48
         * Creating factories of pictures and votes
49
         */
50
        //$albumFactory      = new ImagesHandler($xoopsDB);
51
        $friendsFactory           = new Suico\FriendshipHandler($xoopsDB);
52
        $block['friends']         = $friendsFactory->getFriends($options[0], $criteria2);
53
        $block['lang_allfriends'] = _MB_SUICO_ALLFRIENDS;
54
        $block['lang_nofriends']  = _MB_SUICO_NOFRIENDSYET;
55
        $block['enablepm']        = $options[1] ?? '';
56
        return $block;
57
    }
58
}
59
60
/**
61
 * @param $options
62
 * @return string
63
 */
64
function b_suico_friends_edit($options)
65
{
66
    $form .= _MB_SUICO_TOTALFRIENDSTOSHOW . '&nbsp;';
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $form seems to be never defined.
Loading history...
67
    $form .= "<input type='text' name='options[0]' value='" . $options[0] . "'><br>";
68
    $form .= _MB_SUICO_ENABLEPM . '&nbsp;';
69
    if (1 === $options[1]) {
70
        $chk = ' checked';
71
    }
72
    $form .= "<input type='radio' name='options[1]' value='1'" . $chk . '>&nbsp;' . _YES . '';
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $chk does not seem to be defined for all execution paths leading up to this point.
Loading history...
73
    $chk  = '';
74
    if (0 === $options[1]) {
75
        $chk = ' checked';
76
    }
77
    $form .= "&nbsp;<input type='radio' name='options[1]' value='0'" . $chk . '>' . _NO . '<br>';
78
    return $form;
79
}
80