Completed
Pull Request — master (#4)
by Michael
03:07
created

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
 * Module: SmartPartner
5
 * Author: Sudhaker Raj <http://xoops.biz>
6
 * Licence: GNU
7
 */
8
9
if (empty($seoOp)) {
10
    // SEO mode is path-info
11
    /*
12
     Sample URL for path-info
13
     http://localhost/modules/smartpartner/seo.php/item.2/can-i-turn-the-ads-off.html
14
     */
15
    $data = explode('/', $HTTP_SERVER_VARS['PATH_INFO']);
16
17
    $seoParts = explode('.', $data[1]);
18
    $seoOp    = $seoParts[0];
19
    $seoArg   = $seoParts[1];
20
    // for multi-argument modules, where itemid and catid both are required.
21
    // $seoArg = substr($data[1], strlen($seoOp) + 1);
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% 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...
22
}
23
24
$seoMap = array(
25
    'category' => 'category.php',
26
    'item'     => 'partner.php',
27
    'print'    => 'print.php'
28
);
29
30
if (!empty($seoOp) && !empty($seoMap[$seoOp])) {
31
    // module specific dispatching logic, other module must implement as
32
    // per their requirements.
33
    $newUrl = '/modules/smartpartner/' . $seoMap[$seoOp] . '.php';
34
35
    $_ENV['PHP_SELF']       = $newUrl;
36
    $_SERVER['SCRIPT_NAME'] = $newUrl;
37
    $_SERVER['PHP_SELF']    = $newUrl;
38
    switch ($seoOp) {
39
        case 'category':
40
            $_SERVER['REQUEST_URI'] = $newUrl . '?categoryid=' . $seoArg;
41
            $_GET['categoryid']     = $seoArg;
42
            break;
43
        case 'item':
44
        case 'print':
45
        default:
46
            $_SERVER['REQUEST_URI'] = $newUrl . '?itemid=' . $seoArg;
47
            $_GET['itemid']         = $seoArg;
48
    }
49
50
    include("${seoOp}.php");
51
}
52
53
exit;
54