Completed
Push — master ( 786b6e...dc199a )
by Michael
01:38
created

header.php (1 issue)

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
//                XOOPS - PHP Content Management System                      //
4
//                    Copyright (c) 2000 XOOPS.org                           //
5
//                       <http://www.xoops.org/>                             //
6
//  ------------------------------------------------------------------------ //
7
// Based on:                                                                 //
8
// myPHPNUKE Web Portal System - http://myphpnuke.com/                       //
9
// PHP-NUKE Web Portal System - http://phpnuke.org/                          //
10
// Thatware - http://thatware.org/                                           //
11
// ------------------------------------------------------------------------- //
12
//  This program is free software; you can redistribute it and/or modify     //
13
//  it under the terms of the GNU General Public License as published by     //
14
//  the Free Software Foundation; either version 2 of the License, or        //
15
//  (at your option) any later version.                                      //
16
//                                                                           //
17
//  You may not change or alter any portion of this comment or credits       //
18
//  of supporting developers from this source code or any supporting         //
19
//  source code which is considered copyrighted (c) material of the          //
20
//  original comment or credit authors.                                      //
21
//                                                                           //
22
//  This program is distributed in the hope that it will be useful,          //
23
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
24
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
25
//  GNU General Public License for more details.                             //
26
//                                                                           //
27
//  You should have received a copy of the GNU General Public License        //
28
//  along with this program; if not, write to the Free Software              //
29
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
30
//  ------------------------------------------------------------------------ //
31
include dirname(dirname(__DIR__)) . '/mainfile.php';
32
33
//wanikoo
34
$mylinks_theme         = 'mylinksdefault';
35
$mylinks_allowed_theme = array(
36
    'mylinksdefault',
37
    'mylinksdefault-RW',
38
    'mylinksdefault-LW',
39
    'mylinksdefault-BW',
40
    'weblinkslike',
41
    'weblinkslike-RW',
42
    'weblinkslike-LW',
43
    'weblinkslike-BW'
44
);
45
46
if (!empty($_POST['mylinks_theme_select']) && in_array($_POST['mylinks_theme_select'], $mylinks_allowed_theme)) {
47
    $mylinks_theme                = $_POST['mylinks_theme_select'];
48
    $_SESSION['mylinksUserTheme'] = $_POST['mylinks_theme_select'];
49
} elseif (!empty($_SESSION['mylinksUserTheme']) && in_array($_SESSION['mylinksUserTheme'], $mylinks_allowed_theme)) {
50
    $mylinks_theme = $_SESSION['mylinksUserTheme'];
51
}
52
53
//wanikoo
54
if (in_array($mylinks_theme, $mylinks_allowed_theme)) {
55
    $valid_theme = true;
56
} else {
57
    $valid_theme = false;
58
}
59
60
$mylinks_wide_theme       = false;
61
$mylinks_right_wide_theme = false;
62
$mylinks_left_wide_theme  = false;
63
$mylinks_both_wide_theme  = false;
64
65
if (true == $valid_theme) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
66
    if (strpos($mylinks_theme, '-RW') || strpos($mylinks_theme, '-w')) {
67
        $mylinks_wide_theme       = true;
68
        $mylinks_right_wide_theme = true;
69
    } elseif (strpos($mylinks_theme, '-LW')) {
70
        $mylinks_wide_theme      = true;
71
        $mylinks_left_wide_theme = true;
72
    } elseif (strpos($mylinks_theme, '-BW')) {
73
        $mylinks_wide_theme      = true;
74
        $mylinks_both_wide_theme = true;
75
    }
76
}
77
//wanikoo
78
$modulename = basename(__DIR__);
79
80
define('XOOPSMYLINKURL', XOOPS_URL . "/modules/{$modulename}");
81
define('XOOPSMYLINKPATH', XOOPS_ROOT_PATH . "/modules/{$modulename}");
82
define('XOOPSMYLINKINCURL', XOOPSMYLINKURL . '/include');
83
define('XOOPSMYLINKINCPATH', XOOPSMYLINKPATH . '/include');
84
define('XOOPSMYLINKIMGURL', XOOPSMYLINKURL . '/images');
85
define('XOOPSMYLINKIMGPATH', XOOPSMYLINKPATH . '/images');
86
87
include_once XOOPSMYLINKPATH . '/include/functions.php';
88
89
//wanikoo
90
$mylinks_show_siteinfo  = $xoopsModuleConfig['showsiteinfo'] ? true : false;
91
$mylinks_show_extrafunc = $xoopsModuleConfig['showextrafunc'] ? true : false;
92
if (strpos($GLOBALS['xoopsRequestUri'], 'singlelink.php')) {
93
    $mylinks_show_extrafunc_big = true;
94
} else {
95
    $mylinks_show_extrafunc_big = false;
96
}
97
//ver3.11
98
$mylinks_shot_provider = $xoopsModuleConfig['shotprovider'];
99
100
//ver3.0
101
//$mylinks_show_externalsearch = false;
102
$mylinks_show_feed = $xoopsModuleConfig['showfeed'] ? true : false;
103
104
//ver2.0
105
$mylinks_show_logo    = $xoopsModuleConfig['showlogo'] ? true : false;
106
$mylinks_show_letters = $xoopsModuleConfig['showletters'] ? true : false;
107
$mylinks_show_toolbar = $xoopsModuleConfig['showtoolbar'] ? true : false;
108
$mylinks_show_search  = $xoopsModuleConfig['showxoopssearch'] ? true : false;
109
110
/* v3.11 changed theme changer to not display by default
111
 * since there are no themes included with module and adds
112
 * complexity for new users/admins
113
 */
114
$mylinks_show_themechanger = false;
115
116
$mylinks_adcodes               = array();
117
$mylinks_adcodes['all']        = '';
118
$mylinks_adcodes['index']      = '';
119
$mylinks_adcodes['singlelink'] = '';
120
$mylinks_adcodes['viewcat']    = '';
121
$mylinks_adcodes['topten']     = '';
122
$mylinks_adcodes['recent']     = '';
123
$mylinks_adcodes['ratelink']   = '';
124
$mylinks_adcodes['modlink']    = '';
125
$mylinks_adcodes['brokenlink'] = '';
126
$mylinks_adcodes['submit']     = '';
127
128
//wanikoo
129
// disallow=0, allow =1, memberonly =2
130
$mylinks_can_print    = $xoopsModuleConfig['canprint'];
131
$mylinks_can_pdf      = $xoopsModuleConfig['canpdf'];
132
$mylinks_can_bookmark = $xoopsModuleConfig['canbookmark'];
133
134
//if qrcode module exists
135
if (file_exists(XOOPS_ROOT_PATH . '/modules/qrcode/qrcode_image.php')) {
136
    // disallow=0, allow =1, memberonly =2
137
    $mylinks_can_qrcode = $xoopsModuleConfig['canqrcode'];
138
} else {
139
    //no qrcode module
140
    $mylinks_can_qrcode = 0;
141
}
142
143
//logo
144
if ($mylinks_show_logo && !is_dir(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}/icons/logo.gif")
145
    && file_exists(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}/icons/logo.gif")
146
) {
147
    $logoimage = "<a href='" . XOOPSMYLINKURL . "/index.php'><img src='" . XOOPSMYLINKIMGURL . "/{$mylinks_theme}/icons/logo.gif' style='border-width: 0px;' alt=''></a>";
148
} elseif ($mylinks_show_logo && !is_dir(XOOPSMYLINKIMGPATH . '/icons/logo.gif')
149
          && file_exists(XOOPSMYLINKIMGPATH . '/icons/logo.gif')
150
) {
151
    $logoimage = "<a href='" . XOOPSMYLINKURL . "/index.php'><img src='" . XOOPSMYLINKIMGURL . "/icons/logo.gif' style='border-width: 0px' alt=''></a>";
152
} else {
153
    $logoimage = '';
154
}
155