1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* Module: SmartPartner |
6
|
|
|
* Author: The SmartFactory <www.smartfactory.ca> |
7
|
|
|
* Licence: GNU |
8
|
|
|
* @param $options |
9
|
|
|
* @return array |
10
|
|
|
*/ |
11
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
|
|
|
12
|
|
|
|
13
|
|
|
function b_recent_partners_show($options) |
14
|
|
|
{ |
15
|
|
|
include_once(XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'); |
16
|
|
|
|
17
|
|
|
// Creating the partner handler object |
18
|
|
|
$smartPartnerPartnerHandler = smartpartner_gethandler('partner'); |
19
|
|
|
$smartPartnerCategoryHandler = smartpartner_gethandler('category'); |
|
|
|
|
20
|
|
|
|
21
|
|
|
// Randomize |
22
|
|
|
$partnersObj = $smartPartnerPartnerHandler->getPartners($options[2], 0, _SPARTNER_STATUS_ACTIVE, 'datesub', 'DESC'); |
23
|
|
|
|
24
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php'; |
25
|
|
|
$smartPermissionsHandler = new SmartobjectPermissionHandler($smartPartnerPartnerHandler); |
26
|
|
|
$grantedItems = $smartPermissionsHandler->getGrantedItems('full_view'); |
27
|
|
|
|
28
|
|
|
if ($partnersObj) { |
29
|
|
|
$block = array(); |
30
|
|
|
foreach ($partnersObj as $partnerObj) { |
31
|
|
|
if (in_array($partnerObj->id(), $grantedItems)) { |
32
|
|
|
$block['partners'][] = $partnerObj->toArray(); |
33
|
|
|
} |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
if (!empty($block['partners'])) { |
37
|
|
|
if ($options[0] == 1) { |
38
|
|
|
$block['insertBr'] = true; |
39
|
|
|
} |
40
|
|
|
if ($options[1] == 1) { |
41
|
|
|
$block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
//$block['see_all'] = $options[6]; |
|
|
|
|
45
|
|
|
$block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL; |
46
|
|
|
$block['smartpartner_url'] = SMARTPARTNER_URL; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
return $block; |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param $options |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
View Code Duplication |
function b_recent_partners_edit($options) |
|
|
|
|
57
|
|
|
{ |
58
|
|
|
$form = "<table border='0'>"; |
59
|
|
|
$form .= '<tr><td>' . _MB_SPARTNER_PARTNERS_PSPACE . '</td><td>'; |
60
|
|
|
$chk = ''; |
61
|
|
|
if ($options[0] == 0) { |
62
|
|
|
$chk = " checked='checked'"; |
63
|
|
|
} |
64
|
|
|
$form .= "<input type='radio' name='options[0]' value='0'" . $chk . ' />' . _NO . ''; |
65
|
|
|
$chk = ''; |
66
|
|
|
if ($options[0] == 1) { |
67
|
|
|
$chk = " checked='checked'"; |
68
|
|
|
} |
69
|
|
|
$form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' />' . _YES . '</td></tr>'; |
70
|
|
|
$form .= '<tr><td>' . _MB_SPARTNER_FADE . '</td><td>'; |
71
|
|
|
$chk = ''; |
72
|
|
|
if ($options[1] == 0) { |
73
|
|
|
$chk = " checked='checked'"; |
74
|
|
|
} |
75
|
|
|
$form .= "<input type='radio' name='options[1]' value='0'" . $chk . ' />' . _NO . ''; |
76
|
|
|
$chk = ''; |
77
|
|
|
if ($options[1] == 1) { |
78
|
|
|
$chk = " checked='checked'"; |
79
|
|
|
} |
80
|
|
|
$form .= "<input type='radio' name='options[1]' value='1'" . $chk . ' />' . _YES . '</td></tr>'; |
81
|
|
|
$form .= '<tr><td>' . _MB_SPARTNER_BLIMIT . '</td><td>'; |
82
|
|
|
$form .= "<input type='text' name='options[2]' size='16' value='" . $options[2] . "' /></td></tr>"; |
83
|
|
|
/*$form .= "<tr><td>"._MB_SPARTNER_BSHOW."</td><td>"; |
|
|
|
|
84
|
|
|
$form .= "<select size='1' name='options[3]'>"; |
85
|
|
|
$sel = ""; |
86
|
|
|
if ($options[3] == 1) { |
87
|
|
|
$sel = " selected='selected'"; |
88
|
|
|
} |
89
|
|
|
$form .= "<option value='1' ".$sel.">"._MB_SPARTNER_IMAGES."</option>"; |
90
|
|
|
$sel = ""; |
91
|
|
|
if ($options[3] == 2) { |
92
|
|
|
$sel = " selected='selected'"; |
93
|
|
|
} |
94
|
|
|
$form .= "<option value='2' ".$sel.">"._MB_SPARTNER_TEXT."</option>"; |
95
|
|
|
$sel = ""; |
96
|
|
|
if ($options[3] == 3) { |
97
|
|
|
$sel = " selected='selected'"; |
98
|
|
|
} |
99
|
|
|
$form .= "<option value='3' ".$sel.">"._MB_SPARTNER_BOTH."</option>"; |
100
|
|
|
$form .= "</select></td></tr>"; |
101
|
|
|
$form .= "<tr><td>"._MB_SPARTNER_BORDER."</td><td>"; |
102
|
|
|
$form .= "<select size='1' name='options[5]'>"; |
103
|
|
|
$sel = ""; |
104
|
|
|
if ($options[4] == "id") { |
105
|
|
|
$sel = " selected='selected'"; |
106
|
|
|
} |
107
|
|
|
$form .= "<option value='id' ".$sel.">"._MB_SPARTNER_ID."</option>"; |
108
|
|
|
$sel = ""; |
109
|
|
|
if ($options[4] == "hits") { |
110
|
|
|
$sel = " selected='selected'"; |
111
|
|
|
} |
112
|
|
|
$form .= "<option value='hits' ".$sel.">"._MB_SPARTNER_HITS."</option>"; |
113
|
|
|
$sel = ""; |
114
|
|
|
if ($options[4] == "title") { |
115
|
|
|
$sel = " selected='selected'"; |
116
|
|
|
} |
117
|
|
|
$form .= "<option value='title' ".$sel.">"._MB_SPARTNER_TITLE."</option>"; |
118
|
|
|
if ($options[4] == "weight") { |
119
|
|
|
$sel = " selected='selected'"; |
120
|
|
|
} |
121
|
|
|
$form .= "<option value='weight' ".$sel.">"._MB_SPARTNER_WEIGHT."</option>"; |
122
|
|
|
$form .= "</select> "; |
123
|
|
|
$form .= "<select size='1' name='options[6]'>"; |
124
|
|
|
$sel = ""; |
125
|
|
|
if ($options[5] == "ASC") { |
126
|
|
|
$sel = " selected='selected'"; |
127
|
|
|
} |
128
|
|
|
$form .= "<option value='ASC' ".$sel.">"._MB_SPARTNER_ASC."</option>"; |
129
|
|
|
$sel = ""; |
130
|
|
|
if ($options[5] == "DESC") { |
131
|
|
|
$sel = " selected='selected'"; |
132
|
|
|
} |
133
|
|
|
$form .= "<option value='DESC' ".$sel.">"._MB_SPARTNER_DESC."</option>"; |
134
|
|
|
$form .= "</select></td></tr>"; |
135
|
|
|
|
136
|
|
|
$form .= "<tr><td>"._MB_SPARTNER_SEE_ALL."</td><td>"; |
137
|
|
|
$chk = ""; |
138
|
|
|
if ($options[6] == 0) { |
139
|
|
|
$chk = " checked='checked'"; |
140
|
|
|
} |
141
|
|
|
$form .= "<input type='radio' name='options[7]' value='0'".$chk." />"._NO.""; |
142
|
|
|
$chk = ""; |
143
|
|
|
if ($options[6] == 1) { |
144
|
|
|
$chk = " checked='checked'"; |
145
|
|
|
} |
146
|
|
|
$form .= "<input type='radio' name='options[7]' value='1'".$chk." />"._YES."</td></tr>";*/ |
147
|
|
|
|
148
|
|
|
$form .= '</table>'; |
149
|
|
|
|
150
|
|
|
return $form; |
151
|
|
|
} |
152
|
|
|
|
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.