forked from XoopsModules25x/adslight
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtips_writing_ad.php
97 lines (82 loc) · 4.42 KB
/
tips_writing_ad.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php declare(strict_types=1);
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* @copyright XOOPS Project (https://xoops.org)
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author XOOPS Development Team
* @author Pascal Le Boustouller: original author (pascal.e-xoops@perso-search.com)
* @author Luc Bizet (www.frxoops.org)
* @author jlm69 (www.jlmzone.com)
* @author mamba (www.xoops.org)
*/
use Xmf\Request;
use XoopsModules\Adslight\{
Helper
};
require_once __DIR__ . '/header.php';
//require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
$myts = \MyTextSanitizer::getInstance();
$moduleId = $xoopsModule->getVar('mid');
$groups = $GLOBALS['xoopsUser'] instanceof \XoopsUser ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
/** @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
$perm_itemid = Request::getInt('item_id', 0, 'POST');
//If no access
if (!$grouppermHandler->checkRight('adslight_view', $perm_itemid, $groups, $moduleId)) {
redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
}
$prem_perm = $grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $moduleId) ? '1' : '0';
# function tips_writing
#####################################################
function tips_writing(): void
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $mytree, $meta, $mid, $prem_perm;
$helper = Helper::getInstance();
$GLOBALS['xoopsOption']['template_main'] = 'adslight_tips_writing_ad.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
$GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid'));
$GLOBALS['xoopsTpl']->assign('permit', $prem_perm);
$GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']);
$GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM);
$GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']);
$GLOBALS['xoopsTpl']->assign('only_pix', _ADSLIGHT_ONLYPIX);
$GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK);
$GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_TIPSWRITE);
$GLOBALS['xoopsTpl']->assign('adslight_writetexte', $helper->getConfig('adslight_tips_writetxt'));
$GLOBALS['xoopsTpl']->assign('adslight_writetitle', $helper->getConfig('adslight_tips_writetitle'));
$GLOBALS['xoopsTpl']->assign('ads_use_tipswrite', $helper->getConfig('adslight_use_tipswrite'));
$GLOBALS['xoopsTpl']->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >');
$GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow');
// adslight 2
$GLOBALS['xoopsTpl']->assign('adslight_active_menu', $helper->getConfig('adslight_active_menu'));
$GLOBALS['xoopsTpl']->assign('adslight_active_rss', $helper->getConfig('adslight_active_rss'));
if ($GLOBALS['xoopsUser']) {
$member_usid = $GLOBALS['xoopsUser']->getVar('uid');
$usid = $member_usid;
if ($usid) {
$GLOBALS['xoopsTpl']->assign('istheirs', true);
$sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid={$member_usid}";
$result = $xoopsDB->query($sql);
if (!$xoopsDB->isResultSet($result)) {
\trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR);
}
[$show_user] = $xoopsDB->fetchRow($result);
$GLOBALS['xoopsTpl']->assign('show_user', $show_user);
$GLOBALS['xoopsTpl']->assign('show_user_link', "members.php?usid={$member_usid}");
}
}
}
######################################################
$pa = Request::getInt('pa', null, 'GET');
$GLOBALS['xoopsOption']['template_main'] = 'adslight_tips_writing_ad.tpl';
tips_writing();
//break;
require_once XOOPS_ROOT_PATH . '/footer.php';