Issues (1149)

listing.php (10 issues)

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      efqdirectory
16
 * @since
17
 * @author       Martijn Hertog (aka wtravel)
18
 * @author       XOOPS Development Team,
19
 */
20
21
include __DIR__ . '/header.php';
22
$myts = MyTextSanitizer::getInstance();// MyTextSanitizer object
0 ignored issues
show
The type MyTextSanitizer 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...
23
require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
24
require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php';
25
require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php';
26
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
27
require_once __DIR__ . '/class/class.listing.php';
28
require_once __DIR__ . '/class/class.datafieldmanager.php';
29
require_once __DIR__ . '/class/class.couponhandler.php';
30
31
$mytree           = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid');
0 ignored issues
show
The type XoopsTree 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...
32
$datafieldmanager = new efqDataFieldManager();
33
$eh               = new ErrorHandler;
0 ignored issues
show
The type ErrorHandler 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...
34
35
$GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_listing.tpl';
36
include XOOPS_ROOT_PATH . '/header.php';
37
38 View Code Duplication
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
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...
39
    $isadmin = true;
40
} else {
41
    $isadmin = false;
42
}
43
44
if (isset($_GET['catid'])) {
45
    $get_catid = (int)$_GET['catid'];
46
} else {
47
    $get_catid = 0;
48
}
49 View Code Duplication
if (!empty($_GET['item'])) {
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...
50
    $get_itemid = (int)$_GET['item'];
51
} else {
52
    redirect_header('index.php', 2, _MD_NOVALIDITEM);
0 ignored issues
show
The function redirect_header was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
    /** @scrutinizer ignore-call */ redirect_header('index.php', 2, _MD_NOVALIDITEM);
Loading history...
53
    exit();
54
}
55
56
$moddir         = $xoopsModule->getVar('dirname');
57
$dirid          = getDirIdFromItem($get_itemid);
58
$islistingowner = false;
59
60
$xoopsTpl->assign('xoops_module_header', $xoops_module_header);
61 View Code Duplication
if ($isadmin) {
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...
62
    $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&amp;item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon2.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>';
0 ignored issues
show
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
63
} else {
64
    $adminlink = '';
65
}
66
$xoopsTpl->assign('adminlink', $adminlink);
67
68
$coupon         = new efqCouponHandler();
69
$listing        = new efqListing();
70
$listinghandler = new efqListingHandler();
71
72
$listing->setVars($listinghandler->getListing($get_itemid));
73
74
$pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a>&nbsp;:&nbsp;';
75
$pathstring .= $mytree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . '');
76
77
$editlink = '<a href="edit.php?item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-edit.gif" alt="' . _MD_EDIT_LISTING . '" title="' . _MD_EDIT_LISTING . '"></a>';
78
79
if (isset($xoopsUser) && $xoopsUser != null) {
80
    if ($xoopsUser->getVar('uid') == $listing->getVar('uid')) {
81
        $islistingowner = true;
82
        $xoopsTpl->assign('listingowner', '1');
83
        if ($listing->getVar('status') == '2' and $xoopsModuleConfig['autoapprove'] == 1) {
84
            $editrights = '1';
85
        } else {
86
            $editrights = '0';
87
        }
88
    } else {
89
        $editrights = '0';
90
    }
91
}
92
if (!$islistingowner and !$isadmin) {
93
    $listinghandler->incrementHits($get_itemid);
94
}
95
96
$type     = getTypeFromId($listing->getVar('typeid'));
97
$template = getTemplateFromCatid($get_catid);
98
if ($listing->getVar('logourl') !== '') {
99
    $logourl = '<img src="' . XOOPS_URL . '/modules/' . $moddir . '/uploads/' . $listing->getVar('logourl') . '">';
100
} else {
101
    $logourl = '';
102
}
103
104
$myts   = MyTextSanitizer::getInstance();
105
$html   = 1;
106
$smiley = 1;
107
$xcodes = 1;
108
109
$description = $myts->displayTarea($listing->getVar('description'), $html, $smiley, $xcodes);
110
111
$xoopsTpl->assign('category_path', $pathstring);
112
$xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
113
$xoopsTpl->assign('edit_link', $editlink);
114
$xoopsTpl->assign('type', $type);
115
$xoopsTpl->assign('creates', $listing->getVar('created'));
116
$xoopsTpl->assign('editrights', $listing->_editrights);
117
$xoopsTpl->assign('item_id', $listing->getVar('itemid'));
118
$xoopsTpl->assign('item_title', $listing->getVar('title'));
119
$xoopsTpl->assign('item_description', $description);
120
$xoopsTpl->assign('item_logo', $logourl);
121
$xoopsTpl->assign('lang_item_title', _MD_LANG_ITEMTITLE);
122
$xoopsTpl->assign('lang_item_description', _MD_LANG_ITEMDESCRIPTION);
123
$xoopsTpl->assign('lang_edit_item', _MD_LANG_EDIT_ITEM);
124
$xoopsTpl->assign('template', $template);
125
126
$listing->setDataTypes($listinghandler->getDataTypes($get_itemid));
127
128
if (count($listing->_datatypes) > 0) {
129
    xoops_debug('o, o');
0 ignored issues
show
The function xoops_debug was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

129
    /** @scrutinizer ignore-call */ xoops_debug('o, o');
Loading history...
130
    $xoopsTpl->assign('datatypes', true);
131
    foreach ($listing->_datatypes as $datatype) {
132
        $xoopsTpl->append('section' . $datatype['section'] . '', array('icon' => $datatype['icon'], 'label' => $datatype['title'], 'value' => $datatype['value'], 'fieldtype' => $datatype['fieldtype']));
133
    }
134
}
135
136
if ($xoopsModuleConfig['allowcoupons'] == '0') {
137
    $xoopsTpl->assign('couponsallowed', '0');
138
} else {
139
    $xoopsTpl->assign('couponsallowed', '1');
140
    $xoopsTpl->assign('lang_addcoupon', _MD_ADDCOUPON);
141
    $xoopsTpl->assign('coupons', $coupon->getCountByLink($get_itemid));
142
}
143
if ($xoopsModuleConfig['allowsubscr'] == '0') {
144
    $xoopsTpl->assign('subscrallowed', '0');
145
} else {
146
    $xoopsTpl->assign('subscrallowed', '1');
147
    $xoopsTpl->assign('lang_viewsubscription', _MD_VIEWSUBSCRIPTIONS);
148
}
149
150
include XOOPS_ROOT_PATH . '/footer.php';
151