Completed
Push — master ( 1578b3...d900db )
by Michael
05:55 queued 02:54
created

footer.php (5 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
// $Id: footer.php 11819 2013-07-09 18:21:40Z zyspec $
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                    Copyright (c) 2000 XOOPS.org                           //
6
//                       <http://www.xoops.org/>                             //
7
//  ------------------------------------------------------------------------ //
8
//  This program is free software; you can redistribute it and/or modify     //
9
//  it under the terms of the GNU General Public License as published by     //
10
//  the Free Software Foundation; either version 2 of the License, or        //
11
//  (at your option) any later version.                                      //
12
//                                                                           //
13
//  You may not change or alter any portion of this comment or credits       //
14
//  of supporting developers from this source code or any supporting         //
15
//  source code which is considered copyrighted (c) material of the          //
16
//  original comment or credit authors.                                      //
17
//                                                                           //
18
//  This program is distributed in the hope that it will be useful,          //
19
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
//  GNU General Public License for more details.                             //
22
//                                                                           //
23
//  You should have received a copy of the GNU General Public License        //
24
//  along with this program; if not, write to the Free Software              //
25
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
//  ------------------------------------------------------------------------ //
27
28
defined('XOOPS_ROOT_PATH') or die('Restricted access');
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as or instead of || is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
29
30
if (is_object($xoopsTpl) && ($mylinks_right_wide_theme === true)) {
31
    $xoopsTpl->assign('xoops_showrblock', 0);
32
} elseif (is_object($xoopsTpl) && ($mylinks_left_wide_theme === true)) {
33
    $xoopsTpl->assign('xoops_showlblock', 0);
34
} elseif (is_object($xoopsTpl) && ($mylinks_both_wide_theme === true)) {
35
    $xoopsTpl->assign('xoops_showrblock', 0);
36
    $xoopsTpl->assign('xoops_showlblock', 0);
37
}
38
39
//wanikoo
40
$xoopsTpl->assign('mylinksshowsiteinfo', $mylinks_show_siteinfo);
41
$xoopsTpl->assign('mylinksshowextrafunc', $mylinks_show_extrafunc);
42
$xoopsTpl->assign('mylinksshowextrafuncbig', $mylinks_show_extrafunc_big);
43
$xoopsTpl->assign('mylinksshowsearch', $mylinks_show_search);
44
$xoopsTpl->assign('mylinksshowlogo', $mylinks_show_logo);
45
$xoopsTpl->assign('mylinkslogoimage', $logoimage);
46
$xoopsTpl->assign('mylinksadcodes', $mylinks_adcodes);
47
$xoopsTpl->assign('mylinksshowfeed', $mylinks_show_feed);
48
$xoopsTpl->assign('mylinksshowthemechanger', $mylinks_show_themechanger);
49
50
//wanikoo
51
$can_print    = _MD_MYLINKS_DISALLOW;
52
$can_pdf      = _MD_MYLINKS_DISALLOW;
53
$can_qrcode   = _MD_MYLINKS_DISALLOW;
54
$can_bookmark = _MD_MYLINKS_DISALLOW;
55
56
//print func
57 View Code Duplication
switch ($mylinks_can_print)
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
{
59
    case _MD_MYLINKS_MEMBERONLY:
60
        $can_print = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
61
        break;
62
    case _MD_MYLINKS_ALLOW:
63
        $can_print = _MD_MYLINKS_ALLOW;
64
        break;
65
    case _MD_MYLINKS_DISALLOW:
66
    default:
67
        $can_print = _MD_MYLINKS_DISALLOW;
68
        break;
69
}
70
71
if ( _MD_MYLINKS_DISALLOW == $can_print ) {
72
    $xoopsTpl->assign('mylinksextrafuncprint', false);
73
} else {
74
    $xoopsTpl->assign('mylinksextrafuncprint', true);
75
}
76
77
//pdf function
78 View Code Duplication
switch ($mylinks_can_pdf) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
    case _MD_MYLINKS_MEMBERONLY:
80
        $can_pdf = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
81
        break;
82
    case _MD_MYLINKS_ALLOW:
83
        $can_pdf = _MD_MYLINKS_ALLOW;
84
        break;
85
    case _MD_MYLINKS_DISALLOW:
86
    default:
87
        $can_pdf = _MD_MYLINKS_DISALLOW;
88
        break;
89
}
90
if ( _MD_MYLINKS_DISALLOW == $can_pdf ) {
91
    $xoopsTpl->assign('mylinksextrafuncpdf', false);
92
} else {
93
    $xoopsTpl->assign('mylinksextrafuncpdf', true);
94
}
95
96
//qrcode func
97 View Code Duplication
switch ($mylinks_can_qrcode) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
98
    case _MD_MYLINKS_MEMBERONLY:
99
        $can_qrcode = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
100
        break;
101
    case _MD_MYLINKS_ALLOW:
102
        $can_qrcode = _MD_MYLINKS_ALLOW;
103
        break;
104
    case _MD_MYLINKS_DISALLOW:
105
    default:
106
        $can_qrcode = _MD_MYLINKS_DISALLOW;
107
        break;
108
}
109
if ( _MD_MYLINKS_DISALLOW == $can_qrcode ) {
110
    $xoopsTpl->assign('mylinksextrafuncqrcode', false);
111
} else {
112
    $xoopsTpl->assign('mylinksextrafuncqrcode', true);
113
}
114
115
//ver3.0 bookmark
116
//bookmark func
117 View Code Duplication
switch ($mylinks_can_bookmark) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
118
    case _MD_MYLINKS_MEMBERONLY:
119
        $can_bookmark = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
120
        break;
121
    case _MD_MYLINKS_ALLOW:
122
        $can_bookmark = _MD_MYLINKS_ALLOW;
123
        break;
124
    case _MD_MYLINKS_DISALLOW:
125
    default:
126
        $can_bookmark = _MD_MYLINKS_DISALLOW;
127
        break;
128
}
129
if ( _MD_MYLINKS_DISALLOW == $can_bookmark ) {
130
    $xoopsTpl->assign('mylinksextrafuncbookmark', false);
131
} else {
132
    $xoopsTpl->assign('mylinksextrafuncbookmark', true);
133
}
134
//ver 3.11
135
$xoopsTpl->assign('mylinks_shotprovider', $mylinks_shot_provider);
136
137
//ver3.0
138
$xoopsTpl->assign('lang_fullview', _MD_MYLINKS_FULLVIEW);
139
$xoopsTpl->assign('lang_print', _MD_MYLINKS_MAKE_PRINT);
140
$xoopsTpl->assign('lang_pdf', _MD_MYLINKS_MAKE_PDF);
141
$xoopsTpl->assign('lang_qrcode', _MD_MYLINKS_MAKE_QRCODE);
142
$xoopsTpl->assign('lang_bookmark', _MD_MYLINKS_BOOKMARK);
143
$xoopsTpl->assign('lang_feedsubscript', _MD_MYLINKS_FEEDSUBSCRIPT);
144
$xoopsTpl->assign('lang_feedsubscript_desc', _MD_MYLINKS_FEEDSUBSCRIPT_DESC);
145
$xoopsTpl->assign('lang_minimizeblock', _MD_MYLINKS_MINIMIZEBLOCK);
146
$xoopsTpl->assign('lang_restoreblock', _MD_MYLINKS_RESTOREBLOCK);
147
$xoopsTpl->assign('lang_gototop', _MD_MYLINKS_GOTOTOP);
148
$xoopsTpl->assign('lang_gotobottom', _MD_MYLINKS_GOTOBOTTOM);
149
$xoopsTpl->assign('lang_rssfeed', _MD_MYLINKS_RSSFEED);
150
$xoopsTpl->assign('lang_atomfeed', _MD_MYLINKS_ATOMFEED);
151
$xoopsTpl->assign('lang_pdafeed', _MD_MYLINKS_PDAFEED);
152
$xoopsTpl->assign('lang_rssfeed_cat', _MD_MYLINKS_RSSFEED_CAT);
153
$xoopsTpl->assign('lang_atomfeed_cat', _MD_MYLINKS_ATOMFEED_CAT);
154
$xoopsTpl->assign('lang_pdafeed_cat', _MD_MYLINKS_PDAFEED_CAT);
155
156
//ver2.5
157
$xoopsTpl->assign('mylinks_weburl', XOOPSMYLINKURL);
158
if (file_exists(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}")) {
159
    $xoopsTpl->assign('mylinks_imgurl', XOOPSMYLINKIMGURL."/{$mylinks_theme}");
160
} else {
161
    $xoopsTpl->assign('mylinks_imgurl', XOOPSMYLINKIMGURL);
162
}
163
164
include_once XOOPS_ROOT_PATH . '/footer.php';
165