/
index.php
255 lines (237 loc) · 12.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: index.php
| Author: PHP-Fusion Addons Team
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| addonify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
require_once INFUSIONS."addondb/infusion_db.php";
require_once INFUSIONS."addondb/inc/inc.functions.php";
include INFUSIONS."addondb/locale/".LOCALESET."addons.php";
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
$db_opts = "addon_status='0'";
$get_vars = "";
$get_prefix = "";
$db_count = "";
$addon_type_list = "";
$addon_cat_id = "";
$type = "";
$version = "";
$addon_orderby_list = "";
$addon_orderby_dir_list = "";
$orderby = "";
$sort = "";
$check_order_val = array("addon_name", "addon_author_name", "addon_date");
$check_order_dir = array("ASC", "DESC");
if(isset($_GET['addon_cat_id']) && isnum($_GET['addon_cat_id'])) {
$get_vars .= (empty($get_vars) ? "?" : "&")."addon_cat_id=".$_GET['addon_cat_id'];
if ($_GET['addon_cat_id'] != 0) {
$addon_cat_id = $_GET['addon_cat_id'];
$db_opts .= " AND tc.addon_cat_id='".$_GET['addon_cat_id']."'";
$db_count .= " AND tc.addon_cat_id='".$_GET['addon_cat_id']."'";
}
}
if(isset($_GET['type']) && isnum($_GET['type'])) {
$get_vars .= (empty($get_vars) ? "?" : "&")."type=".$_GET['type'];
if ($_GET['type'] != 0) {
$type = $_GET['type'];
$db_opts .= " AND tm.addon_type='".$_GET['type']."'";
$db_count .= " AND tm.addon_type='".$_GET['type']."'";
} else {
$type = 0;
}
} else {
$type = 0;
}
if(isset($_GET['version']) && isnum($_GET['version'])) {
$get_vars .= (empty($get_vars) ? "?" : "&")."version=".$_GET['version'];
if ($_GET['version'] != 0) {
$version = $_GET['version'];
$db_opts .= " AND tv.version_id='".$_GET['version']."'";
$db_count .= " AND tv.version_id='".$_GET['version']."'";
}
} else {
$version = 0;
}
if(isset($_GET['orderby']) && in_array($_GET['orderby'], $check_order_val)) {
$orderby = stripinput($_GET['orderby']);
$get_vars .= (empty($get_vars) ? "?" : "&")."orderby=".$orderby;
} else {
$orderby = "addon_name";
}
if(isset($_GET['sort']) && in_array($_GET['sort'], $check_order_dir)) {
$sort = stripinput($_GET['sort']);
$get_vars .= (empty($get_vars) ? "?" : "&")."sort=".$sort;
} else {
$sort = "ASC";
}
if ($settings_global['set_addondb_onf'] == '1' && iADMIN) { echo "<div class ='admin-message'><center><b>".$locale['addondb605']."</b></div>\n"; }
if ($settings_global['set_addondb_sub'] == '1' && iADMIN) { echo "<div class ='admin-message'><center><b>".$locale['addondb608']."</b></div>\n"; }
if ($settings_global['set_addondb_sub'] == '1' && iMEMBER) { echo "<div class ='admin-message'><center><b>".$locale['addondb609']." ".$locale['addondb607']."</b></div>\n"; }
$versel = $locale['addondb429'];
$ver_list = "<li class='0'>".$locale['addondb429']."</li>".buildversionlilist($version);
$addon_type_list = "<li class='0'>".$locale['addondb429']."</li>";
$add = $locale['addondb429'];
foreach ($addon_types as $k=>$addon_typ) {
$addon_type_list .= "<li class='".$k."'>".$addon_typ."</li>\n";
$type == $k ? $add = $addon_typ : "";
}
$aob = $locale['func016'];
foreach ($addon_orderby as $k=>$addon_orderby) {
$addon_orderby_list .= "<li class='".$k."'>".$addon_orderby."</li>\n";
$orderby == $k ? $aob = $addon_orderby : "";
}
$aobl = $locale['func023'];
foreach ($addon_orderby_dir as $k=>$addon_orderby_dir) {
$addon_orderby_dir_list .= "<li class='".$k."'>".$addon_orderby_dir."</li>\n";
$sort == $k ? $aobl = $addon_orderby_dir : "";
}
$rows = dbresult(dbquery("SELECT COUNT(*) FROM ".DB_ADDON_CATS." tc LEFT JOIN ".DB_ADDONS." tm USING(addon_cat_id) LEFT JOIN ".DB_ADDON_VERSIONS." tv USING(version_id) WHERE ".groupaccess('tc.addon_cat_access')." AND ".$db_opts." AND addon_status='0'"),0);
$result = dbquery("
SELECT tc.*,tm.*,tv.*
FROM ".DB_ADDON_CATS." tc
LEFT JOIN ".DB_ADDONS." tm USING(addon_cat_id)
LEFT JOIN ".DB_ADDON_VERSIONS." tv USING(version_id)
WHERE ".$db_opts." AND ".groupaccess('tc.addon_cat_access')."
GROUP BY addon_id, tc.addon_cat_id
ORDER BY addon_cat_name, ".$orderby." ".$sort."
LIMIT ".$_GET['rowstart'].",".$settings_global['addons_per_page']
);
add_to_title($locale['addondb435'].$locale['addondb400']);
include ADDON_INC."view_nav.php";
opentable($locale['addondb400']); ?>
<form name="filterform" method="get" action="<?php echo FUSION_SELF; ?>">
<div class="dropselect threecol">
<?php echo $locale['addondb432']; ?>
<p class="field"><?php echo $add; ?></p>
<input type="hidden" name="type" value="<?php echo $type; ?>" class="field-h" />
<ul class="list">
<?php echo $addon_type_list; ?>
</ul>
</div>
<div class="dropselect threecol">
<?php echo $locale['addondb433']; ?>
<p class="field"><?php echo $versel; ?></p>
<input type="hidden" name="version" value="<?php echo $version; ?>" class="field-h" />
<ul class="list">
<?php echo $ver_list; ?>
</ul>
</div>
<div class="dropselect threecol">
<?php echo $locale['addondb434']; ?>
<p class="field"><?php echo $aob; ?></p>
<input type="hidden" name="orderby" value="<?php echo $orderby; ?>" class="field-h" />
<ul class="list">
<?php echo $addon_orderby_list; ?>
</ul>
</div>
<div class="dropselect threecol">
Sort
<p class="field"><?php echo $aobl; ?></p>
<input type="hidden" name="sort" value="<?php echo $sort; ?>" class="field-h" />
<ul class="list">
<?php echo $addon_orderby_dir_list; ?>
</ul>
</div>
<div class="dropselect onecol"><br />
<button type="submit" class="button"><span><?php echo $locale['addondb436']; ?></span></button>
</div>
</form>
<table cellpadding="0" cellspacing="0" width="100%" class="tbl-border">
<?php $addon_cat_old = -1; ?>
<?php while($data = dbarray($result)) : ?>
<?php if($data['addon_cat_id'] <> $addon_cat_old) : ?>
<tr>
<td class="forum-caption"><?php echo stripslashes($data['addon_cat_name'])." [".get_addon_type($data['addon_cat_type']); ?>]</td>
<td class="forum-caption" width="1%" style="white-space:nowrap"><?php echo $locale['addondb405']; ?></td>
<td class="forum-caption" width="1%" style="white-space:nowrap"><?php echo $locale['addondb402']; ?></td>
<td class="forum-caption" width="1%" style="white-space:nowrap"><?php echo $locale['addondb403']; ?></td>
<td class="forum-caption" width="1%" style="white-space:nowrap"><?php echo $locale['addondb404']; ?></td>
</tr>
<?php endif; ?>
<?php $ver = "v".$data['version_h'].".".$data['version_l'].($data['version_s'] != "" ? " ".$data['version_s'] : ""); ?>
<?php $addon_author = ($data['addon_author_name'] == "" ? $locale['addondb409'] : $data['addon_author_name']); ?>
<?php $data['addon_date'] + 604800 > time() + ($settings['timeoffset'] * 3600) ? $time = nicetime(showdate("%Y-%m-%d %H:%M:%S",$data['addon_date'])) : $time = showdate("%d. %B",$data['addon_date']); ?>
<?php if ($data['addon_date'] + $settings_global['set_new_time'] > time() + ($settings['timeoffset'] * 3600)) { $new = "<img src='".ADDON_IMG."new.png' border='0' alt='' />";} else {$new = "";} ?>
<tr>
<td class="tbl1" style="white-space:nowrap"><a href="view.php?addon_id=<?php echo $data['addon_id']; ?>"><?php echo $new.trimlink($data['addon_name'], 30); ?></a></td>
<td class="tbl2" width="1%" style="white-space:nowrap"><?php echo $time; ?></td>
<td class="tbl2" width="1%" style="white-space:nowrap"><span title="<?php echo $addon_author; ?>"><?php echo trimlink($addon_author, 20); ?></span></td>
<td class="tbl2" width="1%" style="white-space:nowrap"><?php echo $data['addon_version']; ?></td>
<td class="tbl1" width="1%" style="white-space:nowrap"><?php echo $ver; ?></td>
</tr>
<?php $addon_cat_old = $data['addon_cat_id']; ?>
<?php endwhile; ?>
<?php if(!$rows) : ?>
<tr>
<td class="tbl1"><?php echo (isset($addon_cat_id) || isset($version) || isset($type) ? $locale['addondb424'] : $locale['addondb422']); ?></td>
</tr>
<?php endif; ?>
</table>
<?php if ($rows > $settings_global['addons_per_page']) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($_GET['rowstart'], $settings_global['addons_per_page'], $rows, 3, ($get_vars ? FUSION_SELF."".$get_vars."&" : ""))."\n</div>\n";
closetable();
opentable($locale['addondb500']);
$total_addon = dbcount("(addon_id)", DB_ADDONS, "addon_status = '0'");
$total_infus = dbcount("(addon_id)", DB_ADDONS, "addon_status = '0' && addon_type = '1'");
$total_panel = dbcount("(addon_id)", DB_ADDONS, "addon_status = '0' && addon_type = '3'");
$total_theme = dbcount("(addon_id)", DB_ADDONS, "addon_status = '0' && addon_type = '2'");
$total_other = dbcount("(addon_id)", DB_ADDONS, "addon_status = '0' && addon_type = '4'");
$total_trans = dbcount("(trans_id)", DB_ADDON_TRANS, "trans_active = '0'");
$total = dbarray(dbquery("SELECT SUM(addon_download_count) download_count, COUNT(addon_id) FROM ".DB_ADDONS." WHERE addon_status = '0'"));
$total_count = $total['download_count'];
echo "<table class='tbl-border' align='center' width='100%'><tr>\n
<th class='forum-caption' width='20%'><b>".$locale['addondb501']."</b></th>
<th class='forum-caption' width='20%'>".$locale['addondb502']."</th>
<th class='forum-caption' width='20%'>".$locale['addondb503']."</th>
<th class='forum-caption' width='20%'>".$locale['addondb504']."</th>
<th class='forum-caption' width='20%'>".$locale['addondb505']."</th>\n";
echo "<tr></tr>\n
<td class='tbl2' align='center'>".$total_addon."</td>
<td class='tbl2' align='center'>".$total_infus."</td>
<td class='tbl2' align='center'>".$total_panel."</td>
<td class='tbl2' align='center'>".$total_theme."</td>
<td class='tbl2' align='center'>".$total_other."</td>\n
</tr>\n<table>\n";
echo "<table class='tbl-border' align='center' width='100%'><tr>\n";
if (iMEMBER) {
echo "<td class='tbl2' align='center'><a href='".ADDON."dashboard.php' title=''>".$locale['addondb509']."</a></td>\n"; }
echo "<td class='tbl2'>".sprintf($locale['addondb508'], $total_trans)."</td>\n";
echo "<td class='tbl2' align='right'>".sprintf($locale['addondb506'], $total_addon).sprintf($locale['addondb507'], $total_count)."</td>
</tr>\n</table>\n";
closetable();
echo "<br />\n";
if (iADMIN && checkrights("ADNX")) {
opentable($locale['addondb600']);
$addonsq = dbquery("SELECT * FROM ".DB_SUBMISSIONS." WHERE submit_type='m' ORDER BY submit_id DESC");
$errosq = dbquery("SELECT * FROM ".DB_ADDON_ERRORS." WHERE error_active ='1'");
$transq = dbquery("SELECT * FROM ".DB_ADDON_TRANS." WHERE trans_active='1'");
$addons = dbrows($addonsq);
$errors = dbrows($errosq);
$trans = dbrows($transq);
echo "<table class='tbl-border' align='center' width='100%'><tr>\n
<th class='forum-caption' width='25%'>".$locale['addondb601']."</th>
<th class='forum-caption' width='25%'>".$locale['addondb602']."</th>
<th class='forum-caption' width='25%'>".$locale['addondb603']."</th>
<th class='forum-caption' width='25%'>".$locale['addondb604']."</th>
<tr></tr>\n
<td class='tbl2' align='center'><a href='".ADDON_ADMIN."submissions.php".$aidlink."'>".$addons."</a></td>
<td class='tbl2' align='center'><a href='".ADDON_ADMIN."submissions.php".$aidlink."'>".$trans."</a></td>
<td class='tbl2' align='center'><a href='".ADDON_ADMIN."error.php".$aidlink."'>".$errors."</a></td>
<td class='tbl2' align='center'><a href='".ADDON_ADMIN."index.php".$aidlink."'>".$locale['addondb604']."</a></td>
</tr>\n</table>\n";
closetable();
}
require_once THEMES."templates/footer.php";
?>