-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
184 lines (159 loc) · 5.72 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
<?php
require_once('inc/lang.inc.php');
require_once('inc/functions.inc.php');
// Get the editmode status
$editmode = (EDITMODE_ENABLE && isset($_GET['editmode'])) ? TRUE:FALSE;
// Request : DELETE FILES
if(isset($_POST['delete']))
{
foreach($_POST['Files'] as $file)
{
if(is_dir($file)) @rrmdir($file);
else @unlink($file);
}
}
// Request : MOVE FILES
if(isset($_POST['move']))
{
foreach($_POST['Files'] as $file)
{
if(is_dir($file)) @rename($file,$_POST['moveSelect']."/".basename($file));
else if(file_exists($file)) @rename($file,$_POST['moveSelect']."/".basename($file));
}
}
// Request : CREATE DIR
if(isset($_POST['mkdir']) && !empty($_POST['mkdir_name']))
{
mkdir($_POST['mkdirSelect']."/".$_POST['mkdir_name'],0777);
}
// Request : UPDATE
if(isset($_GET['do_update']))
{
// Force the MAJ with ?do_update&force_update
if(isset($_GET['force_update'])) $force = true;
else $force = false;
// Execute update
do_update($force);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="robots" content="noindex"/>
<title>CakeBox - <?php echo $lang[LOCAL_LANG]['index_title']; ?></title>
<meta charset="utf-8">
<script type="text/javascript" src="ressources/oXHR.js"></script>
<link rel="stylesheet" href="ressources/style.css" type="text/css" media="screen">
<link rel="stylesheet" href="ressources/reset.css" type="text/css" media="screen">
<link rel="stylesheet" href="ressources/tooltips.css" type="text/css" media="screen" />
<link href='http://fonts.googleapis.com/css?family=Changa+One|Droid+Sans' rel='stylesheet' type='text/css'>
<link rel="icon" type="image/ico" href="favicon.ico" />
</head>
<body>
<!-- HEADER -->
<header>
<div id="logo">
<a href="index.php">
<span class="first">Cake</span>
<span class="second">Box</span>
</a>
</div>
<div id="flattr">
<a href="http://flattr.com/thing/811178/Cakebox-votre-nouvelle-tele" target="_blank">
<?php echo $lang[LOCAL_LANG]['support_us']; ?> <span class="cakebox">Cakebox</span> <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /> <span class="coeur">♥</span>
</a>
</div>
</header>
<!-- / HEADER -->
<?php
// Verify if Cakebox is up to date
if(($update_info = check_update())) show_update($update_info);
// Show a message after an update
if(isset($_GET['update_done'])) show_update_done();
?>
<!-- CONTENT -->
<section id="content">
<?php
// Test chmod of main directories
check_dir();
?>
<h2><?php echo $lang[LOCAL_LANG]['index_main_title']; ?></h2>
<hr class="clear" />
<!-- EDITMODE MENU -->
<p>
<?php
// Check if user is in editmode or not (for javascript request)
$suffix = ($editmode) ? "-edit":""
?>
<select id="filterSelect" onchange="filesfilter(this);">
<option value="all<?php echo $suffix; ?>" default><?php echo $lang[LOCAL_LANG]['show_all_files']; ?></option>
<option value="videos<?php echo $suffix; ?>"><?php echo $lang[LOCAL_LANG]['show_video_files']; ?></option>
</select>
<?php
// Display a short sentence about the editmode (on/off)
if(EDITMODE_ENABLE && !$editmode)
echo '<a class="goeditmode" href="?editmode">'.$lang[LOCAL_LANG]['enter_edit_mode'].'</a>';
else if ($editmode)
echo '<a class="goeditmode" href="index.php">'.$lang[LOCAL_LANG]['leave_edit_mode'].'</a>';
?>
</p>
<?php
// Open form for editmode
if($editmode):
?>
<form name="editform" action="index.php?editmode" method="post">
<?php endif; ?>
<!-- Local files -->
<div id="local">
<?php
$listof_dir = array(); // Filled by recursive_directory_tree as a global var (for list of dir in editmode)
$tree_structure = recursive_directory_tree(LOCAL_DL_PATH);
print_tree_structure($tree_structure,"all",$editmode);
?>
</div>
<!-- / Local files -->
<?php
// Show the editbox
if($editmode):
?>
<div class="editbox">
<!-- Create dir form-->
<p>
<?php echo $lang[LOCAL_LANG]['create_new_dir']; ?>
<select name="mkdirSelect">
<option value="<?php echo LOCAL_DL_PATH; ?>">/</option>
<?php foreach($listof_dir as $dir) { echo '<option value="'.$dir.'">'.ustr_replace(LOCAL_DL_PATH,"",$dir).'</option>'; } ?>
</select>
<input type="text" value="<?php echo $lang[LOCAL_LANG]['name_new_dir'];?>" onblur="if(this.value=='') this.value='<?php echo $lang[LOCAL_LANG]['name_new_dir'];?>'" onclick="if(this.value=='<?php echo $lang[LOCAL_LANG]['name_new_dir'];?>') this.value='';" name="mkdir_name"/>
<input type="submit" value="<?php echo $lang[LOCAL_LANG]['create_new_dir_button']; ?>" name="mkdir"/>
</p>
<!-- / Create dir form-->
<!-- Move dir&file form-->
<p>
<?php echo $lang[LOCAL_LANG]['move_dir']; ?>
<select name="moveSelect">
<option value="<?php echo LOCAL_DL_PATH; ?>">/</option>
<?php foreach($listof_dir as $dir) { echo '<option value="'.$dir.'">'.ustr_replace(LOCAL_DL_PATH,"",$dir).'</option>'; } ?>
</select>
<input type="submit" value="<?php echo $lang[LOCAL_LANG]['move_dir_button']; ?>" name="move"/>
</p>
<!-- / Move dir&file form-->
<!-- Delete dir&file form-->
<p>
<?php echo $lang[LOCAL_LANG]['delete_content']; ?>
<input type="submit" value="<?php echo $lang[LOCAL_LANG]['delete_content_button']; ?>" name="delete"/>
</p>
<!-- / Delete dir&file form-->
</div>
</form>
<?php endif; ?>
</section>
<!-- / CONTENT -->
<!-- FOOTER -->
<footer>
<div class="padding">
</div>
</footer>
<!-- / FOOTER -->
</body>
</html>