Completed
Push — master ( 0424ea...923121 )
by Michael
03:57
created

blocks/maps.php (2 issues)

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
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
24
25
// <{$xoops_url}>/modules/adslight/maps/<{$block.mapsname}>/assets/images/map.png
26
27
/**
28
 * @param $options
29
 *
30
 * @return array
31
 */
32
function adslight_maps_show($options)
33
{
34
    global $xoopsDB, $xoopsModuleConfig, $xoopsConfig, $blockdirname, $xoopsTpl, $block_lang;
35
36
    $maps_name = $xoopsConfig['language'];
37
38
    $block = array();
39
    $myts  = MyTextSanitizer::getInstance();
0 ignored issues
show
$myts is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
40
41
    $blockdirname = basename(dirname(__DIR__));
42
    $block_lang   = '_MB_' . strtoupper($blockdirname);
43
44
    $block['title'] = '' . constant($block_lang . '_TITLE') . '';
45
46
    $block['imgmapsurl'] = '<a title="Recherche dans votre r&eacute;gion" href="' .
47
                           XOOPS_URL .
48
                           '/modules/adslight/maps.php"><img src="' .
49
                           XOOPS_URL .
50
                           '/modules/adslight/maps/' .
51
                           $xoopsConfig['language'] .
52
                           '/assets/images/map.png" alt="Recherche dans votre r&eacute;gion" border="0"></a><br>';
53
54
    $block['link'] = "<a href=\"" . XOOPS_URL . "/modules/$blockdirname/\"><b>" . constant($block_lang . '_ALL_LISTINGS') . '</b></a><br>';
55
    $block['add']  = "<a href=\"" . XOOPS_URL . "/modules/$blockdirname/\"><b>" . constant($block_lang . '_ADDNOW') . '</b></a><br>';
56
57
    return $block;
58
}
59
60
/**
61
 * @param $options
62
 *
63
 * @return string
64
 */
65 View Code Duplication
function adslight_maps_edit($options)
66
{
67
    global $xoopsDB;
68
    $blockdirname = basename(dirname(__DIR__));
69
    $block_lang   = '_MB_' . strtoupper($blockdirname);
70
71
    $form = constant($block_lang . '_ORDER') . "&nbsp;<select name='options[]'>";
72
    $form .= "<option value='date'";
73
    if ($options[0] === 'date') {
74
        $form .= " selected='selected'";
75
    }
76
    $form .= '>' . constant($block_lang . '_DATE') . "</option>\n";
77
78
    $form .= "<option value='hits'";
79
    if ($options[0] === 'hits') {
80
        $form .= " selected='selected'";
81
    }
82
    $form .= '>' . constant($block_lang . '_HITS') . '</option>';
83
    $form .= "</select>\n";
84
85
    $form .= '&nbsp;' . constant($block_lang . '_DISP') . "&nbsp;<input type='text' name='options[]' value='" . $options[1] . "'/>&nbsp;" . constant($block_lang . '_LISTINGS');
86
    $form .= '&nbsp;<br><br>' . constant($block_lang . '_CHARS') . "&nbsp;<input type='text' name='options[]' value='" . $options[2] . "'/>&nbsp;" . constant($block_lang . '_LENGTH') . '<br><br>';
87
88
    return $form;
89
}
90