forked from abdothedragon/Kleeja-2.0.0-alpha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
191 lines (157 loc) · 4.96 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
<?php
/**
*
* @package Kleeja
* @version $Id$
* @copyright (c) 2007 Kleeja.com
* @license ./docs/license.txt
*
*/
define ('IN_INDEX', true);
define ('IN_REAL_INDEX', true);
define ('IN_SUBMIT_UPLOADING' , (isset($_POST['submitr']) || isset($_POST['submittxt'])));
include ('includes/common.php');
($hook = kleeja_run_hook('begin_index_page')) ? eval($hook) : null; //run hook
//
//Is kleeja only for memebers ?!
//
if(empty($g_exts) && !$usrcp->name())
{
// Send a 503 HTTP response code to prevent search bots from indexing this message
header('HTTP/1.1 503 Service Temporarily Unavailable');
kleeja_info($lang['SITE_FOR_MEMBER_ONLY'], $lang['HOME']);
}
//
//Type of how will decoding name ..
//
switch($config['decode']):
case 1: $decode = 'time'; break;
case 2: $decode = 'md5'; break;
default:
//add you own decode
$decode = '';
($hook = kleeja_run_hook('decode_config_default')) ? eval($hook) : null; //run hook
break;
endswitch;
//
//start uploader class ..
//
$kljup->decode = $decode;
$kljup->linksite = $config['siteurl'];
$kljup->folder = $config['foldername'];
$kljup->filename = $config['prefixname'];
$kljup->action = $action = "index.php";
$kljup->filesnum = $config['filesnum'];
//--------------------- start user system part
$kljup->types = ($usrcp->name()) ? $u_exts : $g_exts;
$kljup->id_user = ($usrcp->name()) ? $usrcp->id() : '-1';
$kljup->user_is_adm = $usrcp->admin();
$kljup->safe_code = $config['safe_code'];
//--------------------- end user system part
$kljup->process();
//add from 1rc6
$FILES_NUM_LOOP = array();
foreach(range(1, $config['filesnum']) as $i)
{
$FILES_NUM_LOOP[] = array('i' => $i, 'show'=>($i == 1 || (!empty($config['filesnum_show']) && (int) $config['filesnum_show'] == 1) ? '' : 'display: none'));
}
//show errors and info
$info = array();
foreach($kljup->errs as $t=>$s)
{
$info[] = array('t'=>$s[1], 'i' => $s[0]);
}
//some words for template
$welcome_msg = $config['welcome_msg'];
$filecp_link = $usrcp->id() ? $config['siteurl'] . ($config['mod_writer'] ? 'filecp.html' : 'ucp.php?go=filecp') : false;
//
//For who online now..
//I dont like this feature and i prefer disable it
//
$show_online = $config['allow_online'] == 1 ? true : false;
if ($show_online)
{
$visitornum = $usersnum = 0;
$online_names = array();
$timeout = 100; //second
$timeout2 = time()-$timeout;
$search_engines = array(
'Google' => '<span style="color:orange;">GoogleBot</span>',
'Yahoo' => '<span style="color:red;">Yahoo!Slurp</span>',
//add more ..
);
//put another bot name
($hook = kleeja_run_hook('anotherbots_online_index_page')) ? eval($hook) : null; //run hook
$query = array(
'SELECT' => 'DISTINCT(n.ip), n.username, n.agent',
'FROM' => "{$dbprefix}online n",
'WHERE' => "n.time > '$timeout2'"
);
($hook = kleeja_run_hook('qr_select_online_index_page')) ? eval($hook) : null; //run hook
$result = $SQL->build($query);
while($row=$SQL->fetch_array($result))
{
($hook = kleeja_run_hook('while_qr_select_online_index_page')) ? eval($hook) : null; //run hook
//check if agent and add him to online list
if(!empty($row['agent']))
{
foreach($search_engines as $c=>$s)
{
if (strstr($row['agent'], $c) && empty($online_names[$c]))
{
$usersnum++;
$online_names[$c] = $s;
break;
}
}
}
//not guest , -1 is userid for guest
if($row['username'] != '-1')
{
$usersnum++;
$online_names[$row['username']] = $row['username'];
}
else
{
$visitornum++;
}
} #while
$SQL->freeresult($result);
//make names as array to print them in template
$shownames = array();
foreach ($online_names as $k)
{
$shownames[] = array('name' => $k, 'seperator' => sizeof($shownames) ? ',' : '');
}
//some variables must be destroyed here
unset($online_names, $timeout, $timeout2);
/**
* Wanna increase your onlines counter ..you can from next line
* but you must know this is illegal ...
*/
$allnumbers = $usersnum + $visitornum;
//check & update most ever users and vistors was online
if(empty($config['most_user_online_ever']) || trim($config['most_user_online_ever']) == '')
{
$most_online = $allnumbers;
$on_muoe = time();
}
else
{
list($most_online, $on_muoe) = @explode($config['most_user_online_ever']);
}
if((int) $most_online < $allnumbers || (empty($config['most_user_online_ever']) || trim($config['most_user_online_ever']) == ''))
{
update_config('most_user_online_ever', $allnumbers . ':' . time());
}
$on_muoe = date('d-m-Y h:i a', $on_muoe);
($hook = kleeja_run_hook('if_online_index_page')) ? eval($hook) : null; //run hook
}#allow_online
($hook = kleeja_run_hook('end_index_page')) ? eval($hook) : null; //run hook
//header
Saaheader();
//index
echo $tpl->display("index_body");
//footer
Saafooter();
//<-- EOF