These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 | include_once __DIR__ . '/header.php'; |
||
24 | require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
25 | |||
26 | $myts = MyTextSanitizer::getInstance(); |
||
27 | $module_id = $xoopsModule->getVar('mid'); |
||
28 | |||
29 | if (is_object($xoopsUser)) { |
||
30 | $groups = $xoopsUser->getGroups(); |
||
31 | } else { |
||
32 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
33 | } |
||
34 | $gperm_handler = xoops_getHandler('groupperm'); |
||
35 | if (isset($_POST['item_id'])) { |
||
36 | $perm_itemid = (int)$_POST['item_id']; |
||
37 | } else { |
||
38 | $perm_itemid = 0; |
||
39 | } |
||
40 | //If no access |
||
41 | View Code Duplication | if (!$gperm_handler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
1 ignored issue
–
show
|
|||
42 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
43 | } |
||
44 | if (!$gperm_handler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||
45 | $prem_perm = '0'; |
||
46 | } else { |
||
47 | $prem_perm = '1'; |
||
48 | } |
||
49 | |||
50 | # function adslightMaps |
||
51 | ##################################################### |
||
52 | function adslightMaps() |
||
53 | { |
||
54 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsTpl, $myts, $mytree, $meta, $mid, $moduleDirName, $main_lang, $prem_perm; |
||
55 | |||
56 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_maps.tpl'; |
||
57 | |||
58 | include XOOPS_ROOT_PATH . '/header.php'; |
||
59 | |||
60 | $xoopsTpl->assign('xmid', $xoopsModule->getVar('mid')); |
||
61 | $xoopsTpl->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
62 | $xoopsTpl->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
63 | $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
64 | $xoopsTpl->assign('search_listings', _ADSLIGHT_SEARCH_LISTINGS); |
||
65 | $xoopsTpl->assign('all_words', _ADSLIGHT_ALL_WORDS); |
||
66 | $xoopsTpl->assign('any_words', _ADSLIGHT_ANY_WORDS); |
||
67 | $xoopsTpl->assign('exact_match', _ADSLIGHT_EXACT_MATCH); |
||
68 | $xoopsTpl->assign('only_pix', _ADSLIGHT_ONLYPIX); |
||
69 | $xoopsTpl->assign('search', _ADSLIGHT_SEARCH); |
||
70 | $xoopsTpl->assign('permit', $prem_perm); |
||
71 | $xoopsTpl->assign('imgscss', XOOPS_URL . '/modules/adslight/assets/css/adslight.css'); |
||
72 | $xoopsTpl->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
73 | |||
74 | $xoTheme->addMeta('meta', 'robots', 'noindex, nofollow'); |
||
75 | |||
76 | $header_cssadslight = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" />'; |
||
77 | |||
78 | $xoopsTpl->assign('xoops_module_header', $header_cssadslight); |
||
79 | |||
80 | $maps_name = $xoopsModuleConfig['adslight_maps_set']; |
||
81 | $maps_width = $xoopsModuleConfig['adslight_maps_width']; |
||
82 | $maps_height = $xoopsModuleConfig['adslight_maps_height']; |
||
83 | |||
84 | $xoopsTpl->assign('maps_name', $maps_name); |
||
85 | $xoopsTpl->assign('maps_width', $maps_width); |
||
86 | $xoopsTpl->assign('maps_height', $maps_height); |
||
87 | |||
88 | $xoopsTpl->assign('adlight_maps_title', _ADSLIGHT_MAPS_TITLE); |
||
89 | $xoopsTpl->assign('bullinfotext', _ADSLIGHT_MAPS_TEXT); |
||
90 | |||
91 | // adslight 2 |
||
92 | $xoopsTpl->assign('adslight_active_menu', $xoopsModuleConfig['adslight_active_menu']); |
||
93 | $xoopsTpl->assign('adslight_active_rss', $xoopsModuleConfig['adslight_active_rss']); |
||
94 | |||
95 | View Code Duplication | if ($xoopsUser) { |
|
96 | $member_usid = $xoopsUser->getVar('uid'); |
||
97 | if ($usid = $member_usid) { |
||
98 | $xoopsTpl->assign('istheirs', true); |
||
99 | |||
100 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid=$member_usid")); |
||
101 | |||
102 | $xoopsTpl->assign('show_user', $show_user); |
||
103 | $xoopsTpl->assign('show_user_link', "members.php?usid=$member_usid"); |
||
104 | } |
||
105 | } |
||
106 | } |
||
107 | |||
108 | ###################################################### |
||
109 | |||
110 | $pa = !isset($_GET['pa']) ? null : $_GET['pa']; |
||
111 | |||
112 | switch ($pa) { |
||
113 | default: |
||
114 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_maps.tpl'; |
||
115 | adslightMaps(); |
||
116 | break; |
||
117 | } |
||
118 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
119 |
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.