Completed
Push — master ( 66731e...5478d6 )
by Michael
02:20
created

functions.php ➔ marquee_adminmenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 49
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 49
rs 9.2258
c 0
b 0
f 0
1
<?php
2
/**
3
 * ****************************************************************************
4
 * marquee - MODULE FOR XOOPS
5
 * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com)
6
 *
7
 * You may not change or alter any portion of this comment or credits
8
 * of supporting developers from this source code or any supporting source code
9
 * which is considered copyrighted (c) material of the original comment or credit authors.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 *
14
 * @copyright         Hervé Thouzard (http://www.herve-thouzard.com)
15
 * @license           http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package           marquee
17
 * @author            Hervé Thouzard (http://www.herve-thouzard.com)
18
 *
19
 * Version : $Id:
20
 * ****************************************************************************
21
 *
22
 * @param int    $currentoption
23
 * @param string $breadcrumb
24
 */
25
26
// 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...
27
28
function marquee_adminmenu($currentoption = 0, $breadcrumb = '')
0 ignored issues
show
Unused Code introduced by
The parameter $currentoption is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $breadcrumb is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
{
30
    ///*    include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
31
    //
32
    //  /* Nice buttons styles */
33
    //  echo "
34
    //      <style type='text/css'>
35
    //      #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; }
36
    //      #buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/marquee/assets/images/bg.png') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px; }
37
    //      #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }
38
    //      #buttonbar li { display:inline; margin:0; padding:0; }
39
    //      #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/marquee/assets/images/left_both.png') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }
40
    //      #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/marquee/assets/images/right_both.png') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }
41
    //      /* Commented Backslash Hack hides rule from IE5-Mac \*/
42
    //      #buttonbar a span {float:none;}
43
    //      /* End IE5-Mac hack */
44
    //      #buttonbar a:hover span { color:#333; }
45
    //      #buttonbar #current a { background-position:0 -150px; border-width:0; }
46
    //      #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }
47
    //      #buttonbar a:hover { background-position:0% -150px; }
48
    //      #buttonbar a:hover span { background-position:100% -150px; }
49
    //      </style>
50
    //    ";
51
    //  global $xoopsModule, $xoopsConfig;
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% 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...
52
    //
53
    //  $tblColors = array('','','','','');
0 ignored issues
show
Unused Code Comprehensibility introduced by
78% 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...
54
    //  if ($currentoption >= 0) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% 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...
55
    //      $tblColors[$currentoption] = 'current';
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
56
    //  }
57
    //
58
    //  if (file_exists(XOOPS_ROOT_PATH . '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php')) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% 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...
59
    //      include_once XOOPS_ROOT_PATH. '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
60
    //  } else {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
61
    //      include_once XOOPS_ROOT_PATH . '/modules/marquee/language/english/modinfo.php';
62
    //  }
63
    //
64
    //  echo "<div id='buttontop'>";
65
    //  echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>";
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% 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...
66
    //  echo "<td style=\"width: 60%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"../../system/admin.php?fct=preferences&amp;op=showmod&amp;mod=".$xoopsModule->getVar('mid')."\">" . _AM_MARQUEE_GENERALSET . "</a></td>";
67
    //  echo "<td style=\"width: 40%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;\"><b>" . $xoopsModule->name() . "  " . _AM_MARQUEE_MODULEADMIN . "</b> " . $breadcrumb . "</td>";
68
    //  echo "</tr></table>";
69
    //  echo "</div>";
70
    //
71
    //  echo "<div id='buttonbar'>";
72
    //  echo "<ul>";
73
    //  echo "<li id='" . $tblColors[0] . "'><a href=\"index.php\"\"><span>"._MI_MARQUEE_MENU_01 ."</span></a></li>\n";
74
    //  echo "</ul></div>";
75
    //  echo "<br /><br /><pre>&nbsp;</pre><pre>&nbsp;</pre><br />";*/
76
}
77
78
/**
79
 * Returns the files in a folder according to a pattern
80
 *
81
 * Some hosts have disabled the Php glob() function, that's why this function exists
82
 *
83
 * @package          Marquee
84
 * @author           Hervé Thouzard (http://www.herve-thouzard.com)
85
 * @copyright    (c) Hervé Thouzard
86
 *
87
 * @param string $folder  Folder where you want to grab files from (terminated with a slash)
88
 * @param string $pattern Pattern used to filter files
89
 *
90
 * @return array Files that match the pattern in the selected folder
0 ignored issues
show
Documentation introduced by
Should the return type not be array|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
91
 */
92
function myglob($folder = '', $pattern = 'php')
93
{
94
    $result = array();
95
    try {
96
        if (!($dir = @opendir($folder))) {
97
            throw new \RuntimeException('Error, impossible to open the folder ' . $folder);
98
        }
99
        while (($file = readdir($dir)) !== false) {
100
            if (!is_dir($file)) {
101
                $ext       = basename($file);
102
                $ext       = explode('.', $ext);
103
                $extension = strtolower($ext[count($ext) - 1]);
104
                if ($extension === $pattern) {
105
                    $result[] = $file;
106
                }
107
            }
108
        }
109
        closedir($dir);
110
        return $result;
111
    } catch (Exception $e) {
112
        echo 'Caught exception: ', $e->getMessage(), "\n", '<br/>';
113
    }
114
}
115