Issues (1149)

printcoupon.php (5 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__ . '/../../mainfile.php';
22
include XOOPS_ROOT_PATH . '/header.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...
23
$moduleDirName = basename(__DIR__);
24
$coupid    = isset($_GET['coupid']) ? (int)$_GET['coupid'] : 0;
25
if (!($coupid > 0)) {
26
    redirect_header('index.php');
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

26
    /** @scrutinizer ignore-call */ redirect_header('index.php');
Loading history...
27
}
28
29
/**
30
 * @param $coupid
31
 */
32
function PrintPage($coupid)
33
{
34
    global $xoopsModule, $xoopsTpl, $xoopsModuleConfig, $moduleDirName;
35
    $couponHandler = xoops_getModuleHandler('coupon', $moduleDirName);
0 ignored issues
show
The function xoops_getModuleHandler 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

35
    $couponHandler = /** @scrutinizer ignore-call */ xoops_getModuleHandler('coupon', $moduleDirName);
Loading history...
36
    $couponHandler->increment($coupid);
37
    $coupon     = $couponHandler->getLinkedCoupon($coupid);
38
    $coupon_arr = $couponHandler->prepare2show($coupon);
39
    //$xoopsTpl->assign('coupon_footer', $xoopsModuleConfig['coupon_footer']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
85% 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...
40
    $xoopsTpl->assign('coupon', $coupon_arr['items']['coupons'][0]);
41
    $xoopsTpl->template_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname();
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...
42
    $xoopsTpl->display('db:efqdiralpha1_print_savings.tpl');
43
}
44
45
//Smarty directory autodetect
46
$smartydir = $moduleDirName;
47
$xoopsTpl->assign('smartydir', $smartydir);
48
PrintPage($coupid);
49