Completed
Push — master ( deac0a...054aa6 )
by Michael
01:55
created

tips_writing_ad.php (1 issue)

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
-------------------------------------------------------------------------
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/include/gtickets.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
27
28
$myts      = MyTextSanitizer::getInstance();
29
$module_id = $xoopsModule->getVar('mid');
30
31
$groups = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
32
/** @var XoopsGroupPermHandler $gpermHandler */
33
$gpermHandler = xoops_getHandler('groupperm');
34
$perm_itemid  = Request::getInt('item_id', 0, 'POST');
35
//If no access
36 View Code Duplication
if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) {
37
    redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
38
}
39
$prem_perm = $gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id) ? '1' : '0';
40
41
#  function tips_writing
42
#####################################################
43
function tips_writing()
44
{
45
    global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $mytree, $meta, $mid, $moduleDirName, $main_lang, $prem_perm;
46
47
    $GLOBALS['xoopsOption']['template_main'] = 'adslight_tips_writing_ad.tpl';
48
    include XOOPS_ROOT_PATH . '/header.php';
49
50
    $xoopsTpl->assign('xmid', $xoopsModule->getVar('mid'));
51
    $xoopsTpl->assign('permit', $prem_perm);
52
    $xoopsTpl->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']);
53
    $xoopsTpl->assign('add_from_title', _ADSLIGHT_ADDFROM);
54
    $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']);
55
    $xoopsTpl->assign('only_pix', _ADSLIGHT_ONLYPIX);
56
    $xoopsTpl->assign('adslight_logolink', _ADSLIGHT_LOGOLINK);
57
    $xoopsTpl->assign('bullinfotext', _ADSLIGHT_TIPSWRITE);
58
    $xoopsTpl->assign('adslight_writetexte', $GLOBALS['xoopsModuleConfig']['adslight_tips_writetxt']);
59
    $xoopsTpl->assign('adslight_writetitle', $GLOBALS['xoopsModuleConfig']['adslight_tips_writetitle']);
60
    $xoopsTpl->assign('ads_use_tipswrite', $GLOBALS['xoopsModuleConfig']['adslight_use_tipswrite']);
61
62
    $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >');
63
    $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow');
64
65
    // adslight 2
66
    $xoopsTpl->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']);
67
    $xoopsTpl->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']);
68
69 View Code Duplication
    if ($GLOBALS['xoopsUser']) {
70
        $member_usid = $GLOBALS['xoopsUser']->getVar('uid');
71
        if ($usid = $member_usid) {
72
            $xoopsTpl->assign('istheirs', true);
73
74
            list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid=$member_usid"));
75
76
            $xoopsTpl->assign('show_user', $show_user);
77
            $xoopsTpl->assign('show_user_link', "members.php?usid=$member_usid");
78
        }
79
    }
80
}
81
82
######################################################
83
84
$pa = Request::getInt('pa', null, 'GET');
85
86
switch ($pa) {
87
    default:
88
        $GLOBALS['xoopsOption']['template_main'] = 'adslight_tips_writing_ad.tpl';
89
        tips_writing();
90
        break;
91
}
92
include XOOPS_ROOT_PATH . '/footer.php';
93