Passed
Push — master ( 222087...05cb95 )
by Michael
03:24 queued 10s
created

replies.php (1 issue)

Labels
Severity
1
<?php
2
/*
3
-------------------------------------------------------------------------
4
                     ADSLIGHT 2 : Module for Xoops
5
6
        Redesigned and ameliorate By Luc Bizet user at www.frxoops.org
7
        Started with the Classifieds module and made MANY changes
8
        Website : http://www.luc-bizet.fr
9
        Contact : [email protected]
10
-------------------------------------------------------------------------
11
             Original credits below Version History
12
##########################################################################
13
#                    Classified Module for Xoops                         #
14
#  By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com         #
15
#      Started with the MyAds module and made MANY changes               #
16
##########################################################################
17
 Original Author: Pascal Le Boustouller
18
 Author Website : [email protected]
19
 Licence Type   : GPL
20
-------------------------------------------------------------------------
21
*/
22
23
use Xmf\Request;
24
25
require_once __DIR__ . '/header.php';
26
//require_once XOOPS_ROOT_PATH . '/modules/adslight/class/Utility.php';
27
28
$myts      = \MyTextSanitizer::getInstance(); // MyTextSanitizer object
29
$module_id = $xoopsModule->getVar('mid');
30
$groups    = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
31
/** @var \XoopsGroupPermHandler $grouppermHandler */
32
$grouppermHandler = xoops_getHandler('groupperm');
33
$perm_itemid      = Request::getInt('item_id', 0, 'POST');
34
35
//If no access
36
if (!$grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) {
37
    redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM);
38
}
39
//require_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
40
$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
0 ignored issues
show
The type Adslight\ClassifiedsTree was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
41
42
$lid                                     = Request::getInt('lid', 0, 'GET');
43
$GLOBALS['xoopsOption']['template_main'] = 'adslight_replies.tpl';
44
require_once XOOPS_ROOT_PATH . '/header.php';
45
46
$GLOBALS['xoopsTpl']->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>');
47
$show = 1;
48
$min  = Request::getInt('min', 0, 'GET');
49
if (!isset($max)) {
50
    $max = $min + $show;
51
}
52
$orderby = 'date Desc';
53
54
$GLOBALS['xoopsTpl']->assign('lid', $lid);
55
$countresult = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid=' . $xoopsDB->escape($lid));
56
list($trow) = $xoopsDB->fetchRow($countresult);
57
$trows   = $trow;
58
$pagenav = '';
59
60
if ($trows < '1') {
61
    $GLOBALS['xoopsTpl']->assign('has_replies', false);
62
    $GLOBALS['xoopsTpl']->assign('no_more_replies', _ADSLIGHT_NO_REPLIES);
63
}
64
65
if ($trows > '0') {
66
    $GLOBALS['xoopsTpl']->assign('has_replies', true);
67
    $GLOBALS['xoopsTpl']->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD);
68
    $GLOBALS['xoopsTpl']->assign('last_head_title', _ADSLIGHT_TITLE);
69
    $GLOBALS['xoopsTpl']->assign('last_head_price', _ADSLIGHT_PRICE);
70
    $GLOBALS['xoopsTpl']->assign('last_head_date', _ADSLIGHT_DATE);
71
    $GLOBALS['xoopsTpl']->assign('last_head_local', _ADSLIGHT_LOCAL2);
72
    $GLOBALS['xoopsTpl']->assign('last_head_views', _ADSLIGHT_VIEW);
73
    $GLOBALS['xoopsTpl']->assign('last_head_photo', _ADSLIGHT_PHOTO);
74
    $GLOBALS['xoopsTpl']->assign('min', $min);
75
76
    $sql    = 'SELECT r_lid, lid, title, date, submitter, message, tele, email, r_usid FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid=' . $xoopsDB->escape($lid) . " ORDER BY $orderby";
77
    $result = $xoopsDB->query($sql, $show, $min);
78
79
    if ($trows > '1') {
80
        $GLOBALS['xoopsTpl']->assign('has_replies', true);
81
        $GLOBALS['xoopsTpl']->assign('show_nav', true);
82
        $GLOBALS['xoopsTpl']->assign('lang_sortby', _ADSLIGHT_SORTBY);
83
        $GLOBALS['xoopsTpl']->assign('lang_title', _ADSLIGHT_TITLE);
84
        $GLOBALS['xoopsTpl']->assign('lang_titleatoz', _ADSLIGHT_TITLEATOZ);
85
        $GLOBALS['xoopsTpl']->assign('lang_titleztoa', _ADSLIGHT_TITLEZTOA);
86
        $GLOBALS['xoopsTpl']->assign('lang_date', _ADSLIGHT_DATE);
87
        $GLOBALS['xoopsTpl']->assign('lang_dateold', _ADSLIGHT_DATEOLD);
88
        $GLOBALS['xoopsTpl']->assign('lang_datenew', _ADSLIGHT_DATENEW);
89
        $GLOBALS['xoopsTpl']->assign('lang_popularity', _ADSLIGHT_POPULARITY);
90
        $GLOBALS['xoopsTpl']->assign('lang_popularityleast', _ADSLIGHT_POPULARITYLTOM);
91
        $GLOBALS['xoopsTpl']->assign('lang_popularitymost', _ADSLIGHT_POPULARITYMTOL);
92
        $GLOBALS['xoopsTpl']->assign('lang_cursortedby', _ADSLIGHT_CURSORTEDBY . '' . $orderby);
93
    }
94
95
    while (false !== (list($r_lid, $lid, $title, $date, $submitter, $message, $tele, $email, $r_usid) = $xoopsDB->fetchRow($result))) {
96
        $useroffset = '';
97
        if ($GLOBALS['xoopsUser']) {
98
            $timezone = $GLOBALS['xoopsUser']->timezone();
99
            if (isset($timezone)) {
100
                $useroffset = $GLOBALS['xoopsUser']->timezone();
101
            } else {
102
                $useroffset = $xoopsConfig['default_TZ'];
103
            }
104
        }
105
        $r_usid = $r_usid;
106
        $GLOBALS['xoopsTpl']->assign('submitter', " <a href='" . XOOPS_URL . "/userinfo.php?uid=$r_usid'>$submitter</a>");
107
        $date = ($useroffset * 3600) + $date;
108
        $date = formatTimestamp($date, 's');
109
        $GLOBALS['xoopsTpl']->assign('title', "<a href='viewads.php?lid=$lid'>$title</a>");
110
        $GLOBALS['xoopsTpl']->assign('title_head', _ADSLIGHT_REPLY_TITLE);
111
        $GLOBALS['xoopsTpl']->assign('date_head', _ADSLIGHT_REPLIED_ON);
112
        $GLOBALS['xoopsTpl']->assign('submitter_head', _ADSLIGHT_REPLIED_BY);
113
        $GLOBALS['xoopsTpl']->assign('message_head', _ADSLIGHT_REPLY_MESSAGE);
114
        $GLOBALS['xoopsTpl']->assign('email_head', _ADSLIGHT_EMAIL);
115
        $GLOBALS['xoopsTpl']->assign('tele_head', _ADSLIGHT_TEL);
116
        $GLOBALS['xoopsTpl']->assign('email', "<a href ='mailto:$email'>$email</a>");
117
        $GLOBALS['xoopsTpl']->assign('delete_reply', "<a href='modify.php?op=DelReply&amp;r_lid=$r_lid'>" . _ADSLIGHT_DELETE_REPLY . '</a>');
118
        $GLOBALS['xoopsTpl']->append('items', [
119
            'id'      => $lid,
120
            'title'   => $myts->htmlSpecialChars($title),
121
            'date'    => $date,
122
            'message' => $myts->displayTarea($message),
123
            'tele'    => $myts->htmlSpecialChars($tele),
124
        ]);
125
    }
126
    $lid = Request::getInt('lid', 0, 'GET');
127
    //Calculates how many pages exist.  Which page one should be on, etc...
128
    $linkpages = ceil($trows / $show);
129
    //Page Numbering
130
    if (1 != $linkpages && 0 != $linkpages) {
131
        $prev = $min - $show;
132
        if ($prev >= 0) {
133
            $pagenav .= "<a href='replies.php?lid=$lid&min=$prev&show=$show'><strong><u>&laquo;</u></strong></a> ";
134
        }
135
        $counter     = 1;
136
        $currentpage = ($max / $show);
137
        while ($counter <= $linkpages) {
138
            $mintemp = ($show * $counter) - $show;
139
            if ($counter == $currentpage) {
140
                $pagenav .= "<strong>($counter)</strong> ";
141
            } else {
142
                $pagenav .= "<a href='replies.php?lid=$lid&min=$mintemp&show=$show'>$counter</a> ";
143
            }
144
            ++$counter;
145
        }
146
        if ($trows > $max) {
147
            $pagenav .= "<a href='replies.php?lid=$lid&min=$max&show=$show'>";
148
            $pagenav .= '<strong><u>&raquo;</u></strong></a>';
149
        }
150
        $GLOBALS['xoopsTpl']->assign('nav_page', '<strong>' . _ADSLIGHT_REPLY . "</strong>&nbsp;&nbsp; $pagenav");
151
    }
152
}
153
154
require_once XOOPS_ROOT_PATH . '/footer.php';
155