-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssi.php
More file actions
116 lines (92 loc) · 3.99 KB
/
ssi.php
File metadata and controls
116 lines (92 loc) · 3.99 KB
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
<?php
//===========================================================================\\
// Aardvark Topsites PHP 5.2 \\
// Copyright (c) 2000-2009 Jeremy Scheff. All rights reserved. \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/ http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// This program is free software; you can redistribute it and/or modify it \\
// under the terms of the GNU General Public License as published by the \\
// Free Software Foundation; either version 2 of the License, or (at your \\
// option) any later version. \\
// \\
// This program is distributed in the hope that it will be useful, but \\
// WITHOUT ANY WARRANTY; without even the implied warranty of \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General \\
// Public License for more details. \\
//===========================================================================\\
// Help prevent register_globals injection
define('ATSPHP', 1);
$CONF = array();
$FORM = array();
$TMPL = array();
// Change the path to your full path if necessary
$CONF['path'] = '.';
// Connect to the database
require_once("{$CONF['path']}/settings_sql.php");
require_once("{$CONF['path']}/sources/sql/{$CONF['sql']}.php");
$DB = "sql_{$CONF['sql']}";
$DB = new $DB;
$DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database']);
// Settings
$settings = $DB->fetch("SELECT * FROM {$CONF['sql_prefix']}_settings", __FILE__, __LINE__);
$CONF = array_merge($CONF, $settings);
$CONF['skins_path'] = "{$CONF['path']}/skins";
$CONF['skins_url'] = "{$CONF['list_url']}/skins";
$TMPL['skins_url'] = $CONF['skins_url'];
$TMPL['list_name'] = $CONF['list_name'];
$TMPL['list_url'] = $CONF['list_url'];
// Combine the GET and POST input
$FORM = array_merge($_GET, $_POST);
// The language file
require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");
// The skin
$TMPL['skin_name'] = $CONF['default_skin'];
require_once("{$CONF['path']}/sources/misc/skin.php");
if (isset($FORM['a']) && $FORM['a'] == 'new') {
if (isset($FORM['num'])) {
$TMPL['num'] = intval($FORM['num']);
}
if (!isset($TMPL['num']) || !$TMPL['num']) {
$TMPL['num'] = 5;
}
$TMPL['sites'] = '';
$result = $DB->select_limit("SELECT *
FROM {$CONF['sql_prefix']}_sites
WHERE active = 1
ORDER BY join_date DESC
", $TMPL['num'], 0, __FILE__, __LINE__);
while ($row = $DB->fetch_array($result)) {
$TMPL = array_merge($TMPL, $row);
$skin = new skin('ssi_new_row');
$TMPL['sites'] .= $skin->make();
}
$LNG['ssi_new'] = sprintf($LNG['ssi_new'], $TMPL['num']);
$skin = new skin('ssi_new');
}
else {
if (isset($FORM['num'])) {
$TMPL['num'] = intval($FORM['num']);
}
if (!isset($TMPL['num']) || !$TMPL['num']) {
$TMPL['num'] = 5;
}
$TMPL['sites'] = '';
require_once("{$CONF['path']}/sources/misc/classes.php");
$order_by = base::rank_by()." DESC";
$result = $DB->select_limit("SELECT *
FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
WHERE sites.username = stats.username AND active = 1
ORDER BY {$order_by}
", $TMPL['num'], 0, __FILE__, __LINE__);
while ($row = $DB->fetch_array($result)) {
$TMPL = array_merge($TMPL, $row);
$skin = new skin('ssi_top_row');
$TMPL['sites'] .= $skin->make();
}
$LNG['ssi_top'] = sprintf($LNG['ssi_top'], $TMPL['num']);
$skin = new skin('ssi_top');
}
echo $skin->make();
$DB->close();
?>