/
index.php
executable file
·171 lines (139 loc) · 4.47 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
<?php
/**
*
* @package Kleeja
* @version $Id: index.php 2121 2013-01-04 23:53:36Z saanina $
* @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($d_groups[2]['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 ..
//
$decode = 'none';
switch(intval($config['decode'])):
case 1: $decode = 'time'; break;
case 2: $decode = 'md5'; break;
default:
//add you own decode
($hook = kleeja_run_hook('decode_config_default')) ? eval($hook) : null; //run hook
break;
endswitch;
//
//start uploader class ..
//
$kljup->decode = $decode;
$kljup->folder = $config['foldername'];
$kljup->prefix = $config['prefixname'];
$kljup->action = $action = "index.php";
$kljup->filesnum = $config['filesnum'];
//--------------------- start user system part
$kljup->types = $d_groups[$userinfo['group_id']]['exts'];
$kljup->id_user = ($usrcp->name()) ? $usrcp->id() : '-1';
$kljup->user_is_adm = user_can('enter_acp');
$kljup->safe_code = $config['safe_code'];
//--------------------- end user system part
$kljup->process();
//add from 1rc6
$FILES_NUM_LOOP = array();
if($config['filesnum'] > 0)
{
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'));
}
}
else
{
$text = $lang['PLACE_NO_YOU'];
}
//show errors and info
$info = array();
foreach($kljup->messages 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;
$terms_msg = sprintf($lang['AGREE_RULES'], '<a href="' . ($config['mod_writer'] ? 'rules.html' : 'go.php?go=rules') . '">' , '</a>');
$link_avater = sprintf($lang['EDIT_U_AVATER_LINK'], '<a href="http://www.gravatar.com/">' , '</a>');
//
//For who online now..
//I dont like this feature and I prefer to disable it
//
$show_online = $config['allow_online'] == 1 ? true : false;
if ($show_online)
{
$usersnum = 0;
$online_names = array();
$timeout = 30; //30 second
$timeout2 = time()-$timeout;
//put another bot name
($hook = kleeja_run_hook('anotherbots_online_index_page')) ? eval($hook) : null; //run hook
$query = array(
'SELECT' => 'u.name',
'FROM' => "{$dbprefix}users u",
'WHERE' => "u.last_visit > $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
$usersnum++;
$online_names[$row['name']] = $row['name'];
}#while
$SQL->freeresult($result);
//make names as array to print them in template
$shownames = array();
$shownames_sizeof = sizeof($shownames);
foreach ($online_names as $k)
{
$shownames[] = array('name' => $k, 'seperator' => $shownames_sizeof ? ',' : '');
}
//some variables must be destroyed here
unset($online_names, $timeout, $timeout2);
//check & update most ever users and vistors was online
if(empty($config['most_user_online_ever']) || trim($config['most_user_online_ever']) == '')
{
$most_online = $usersnum;
$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', $usersnum . ':' . time());
}
$on_muoe = date('d-m-Y h:i a', $on_muoe);
if(!$usersnum)
{
$show_online = false;
}
($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(($config['filesnum'] > 0 ? "index_body" : "info"));
//footer
Saafooter();
//<-- EOF