-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
executable file
·150 lines (140 loc) · 4.17 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
<?php
/**
# Project: PHPDISK File Storage Solution
# This is NOT a freeware, use is subject to license terms.
#
# Site: http://www.google.com
#
# $Id: index.php 121 2014-03-04 12:38:05Z along $
#
# Copyright (C) 2008-2014 PHPDisk Team. All Rights Reserved.
#
*/
include "includes/commons.inc.php";
$in_front = true;
if($action=='set_default_tpl'){
pd_setcookie('ptpl','default');
settings_cache(array('open_switch_tpls'=>1));
$db->query_unbuffered("update {$tpf}templates set actived=0 where tpl_type='user';");
$db->query_unbuffered("update {$tpf}templates set actived=1 where tpl_name='default'");
header('Location: '.$settings[phpdisk_url]);
exit;
}
$title = $settings[site_title];
$seo = get_seo('index',0);
if(isset($seo[title])){
eval("\$title = \"$seo[title]\";");
}
if(isset($seo[keywords])) {
eval("\$keywords = \"$seo[keywords]\";");
}
if(isset($seo[description])) {
eval("\$description = \"$seo[description]\";");
}
include PHPDISK_ROOT."./includes/header.inc.php";
if(!$auth[is_fms]){
$show_multi = false;
if(in_array($curr_script,array('index'))){
$ts = (int)gpc('ts','G',0);
if($action=='multi'){
$show_multi = true;
}
}
$upload_remote = false;
if($settings['open_multi_server']){
$rs = $db->fetch_one_array("select server_host,server_store_path,server_key from {$tpf}servers where server_id>1 order by is_default desc limit 1");
if($rs){
$upload_remote = true;
$upload_url = $rs['server_host'].'mydisk.php?item=upload&code='.pd_encode($rs['server_key']);
if(in_array($curr_script,array('index'))){
$upload_url2 = '&url='.base64_encode($settings[phpdisk_url].$script.'?action=multi&ts='.$timestamp);
}
}
unset($rs);
}
}
if($settings[open_switch_tpls]){
$tpl = gpc('tpl','G','');
$ref = gpc('ref','G','');
$ref = $ref ? base64_decode($ref) : './';
if($tpl){
$num = @$db->result_first("select count(*) from {$tpf}templates where tpl_name='$tpl'");
if($num){
pd_setcookie('ptpl',$tpl);
header('Location: '.$ref);
exit;
}
}
}
if($settings[open_switch_langs]){
$lang = gpc('lang','G','');
$ref = gpc('ref','G','');
$ref = $ref ? base64_decode($ref) : './';
if($lang){
$num = @$db->result_first("select count(*) from {$tpf}langs where lang_name='$lang'");
if($num){
pd_setcookie('lang',$lang);
header('Location: '.$ref);
exit;
}
}
}
$upload_remote = false;
if(display_plugin('multi_server','open_multi_server_plugin',$settings['open_multi_server'],0)){
$rs = $db->fetch_one_array("select server_host,server_store_path,server_key from {$tpf}servers where server_id>1 order by is_default desc limit 1");
if($rs){
$upload_remote = true;
$remote_url = $rs['server_host'].'?code='.pd_encode($rs['server_key']);
}
unset($rs);
}
$C[last_file] = get_last_file(15);
$C[hot_file] = get_hot_file(15);
if($auth[is_fms]){
$C[links_arr] = get_friend_link();
$C[last_users] = get_last_user_list(5);
$C[last_one] = index_last();
$C[ann_list] = get_announces();
$C[index_tags] = get_last_tag();
$C[commend_file] = get_commend_file(15);
}
require_once template_echo('phpdisk',$user_tpl_dir);
$f = PHPDISK_ROOT."./system/global/stats.inc.php";
if(!file_exists($f) || $timestamp-@filemtime($f)>3600){
stats_cache();
}
sitemap::build();
include PHPDISK_ROOT."./includes/footer.inc.php";
function get_last_user_list($num=10){
global $db,$tpf;
$q = $db->query("select username,reg_time from {$tpf}users order by userid desc limit $num");
$last_users = array();
while ($rs = $db->fetch_array($q)) {
$rs[a_space] = urr("space","username=".rawurlencode($rs[username]));
$rs[reg_time] = date('Y-m-d',$rs[reg_time]);
$last_users[] = $rs;
}
$db->free($q);
unset($rs);
return $last_users;
}
function get_friend_link(){
global $db,$tpf;
$q = $db->query("select * from {$tpf}links where is_hidden=0 order by logo desc,show_order asc,linkid desc");
$arr = array();
while($rs = $db->fetch_array($q)){
$rs['has_logo'] = $rs['logo'] ? 1 : 0;
$arr[] = $rs;
}
$db->free($q);
unset($rs);
return $arr;
}
function index_last(){
global $db,$tpf;
$username = @$db->result_first("select username from {$tpf}users order by userid desc limit 1");
$arr['username'] = $username;
$arr['a_last_user'] = urr("space","username=".rawurlencode($username));
return $arr;
}
?>