-
Notifications
You must be signed in to change notification settings - Fork 32
/
share_file.php
196 lines (181 loc) · 8.52 KB
/
share_file.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
192
193
194
195
196
<?php
// setup includes
require_once('includes/master.inc.php');
// load file
$file = null;
if (isset($_REQUEST['u']))
{
// figure out the delete hash
$loggedInHash = '';
foreach($_REQUEST AS $k=>$item)
{
if(strlen($k) == 32)
{
$loggedInHash = $k;
}
}
// only keep the initial part if there's a forward slash
$shortUrl = current(explode("/", str_replace("~i", "", $_REQUEST['u'])));
$file = file::loadByShortUrl($shortUrl);
// check whether we can display the delete/password options
$showAll = false;
if($file->deleteHash == $loggedInHash)
{
$showAll = true;
}
// double check the owner for logged in user
if(($showAll == false) && ($file))
{
if($file->userId == $Auth->id)
{
$showAll = true;
}
}
}
/* load file details */
if(!$file)
{
/* if no file found, redirect to home page */
redirect(WEB_ROOT . "/index." . SITE_CONFIG_PAGE_EXTENSION);
}
// setup page
define("PAGE_NAME", $file->originalFilename.' '.t("file_information_page_name", ""));
define("PAGE_DESCRIPTION", t("file_information_description", "Information about").' '.$file->originalFilename);
define("PAGE_KEYWORDS", strtolower($file->originalFilename).t("file_information_meta_keywords", ", share, information, file, upload, download, site"));
require_once('_header.php');
?>
<div class="contentPageWrapper">
<div class="pageSectionMainFull ui-corner-all">
<div class="pageSectionMainInternal">
<?php if($file->getLargeIconPath()): ?>
<div style="float: right;">
<img src="<?php echo $file->getLargeIconPath(); ?>" width="160" alt="<?php echo $file->extension; ?>"/>
</div>
<?php endif; ?>
<div id="pageHeader">
<h2><?php echo PAGE_NAME; ?></h2>
</div>
<div>
<table class="accountStateTable" style="width: 740px;">
<tbody>
<tr>
<td class="first">
<?php echo UCWords(t('filename', 'filename')); ?>:
</td>
<td>
<?php echo $file->originalFilename; ?> <a href="<?php echo $file->getFullShortUrl(); ?>" target="_blank">(<?php echo t('download', 'download'); ?>)</a>
</td>
</tr>
<tr>
<td class="first">
<?php echo UCWords(t('filesize', 'filesize')); ?>:
</td>
<td>
<?php echo formatSize($file->fileSize); ?>
</td>
</tr>
</tbody>
</table>
<table class="accountStateTable" style="width: 740px; margin-top: 16px;">
<tbody>
<tr>
<td class="first">
<?php echo UCWords(t('url', 'url')); ?>:
</td>
<td>
<a href="<?php echo $file->getFullShortUrl(); ?>" target="_blank"><?php echo $file->getFullShortUrl(); ?></a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="clear"><!-- --></div>
<div id="pageHeader" style="padding-top: 12px;">
<h2><?php echo t("download_urls", "download urls"); ?></h2>
</div>
<div>
<table class="accountStateTable">
<tbody>
<tr>
<td class="first">
<?php echo t('html_code', 'HTML Code'); ?>:
</td>
<td class="htmlCode">
<a href="<?php echo $file->getFullShortUrl(); ?>" target="_blank" title="<?php echo t('download_from', 'Download from'); ?> <?php echo SITE_CONFIG_SITE_NAME; ?>">Download <?php echo $file->originalFilename; ?> from <?php echo SITE_CONFIG_SITE_NAME; ?></a>
</td>
</tr>
<tr>
<td class="first">
<?php echo UCWords(t('forum_code', 'forum code')); ?>
</td>
<td class="htmlCode">
[url]<?php echo $file->getFullShortUrl(); ?>[/url]
</td>
</tr>
</tbody>
</table>
</div>
<div class="clear"><!-- --></div>
<div id="pageHeader" style="padding-top: 12px;">
<h2><?php echo t("share", "share"); ?></h2>
</div>
<div>
<table class="accountStateTable">
<tbody>
<tr>
<td class="first">
<?php echo UCWords(t('share_file', 'share file')); ?>:
</td>
<td>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_preferred_1" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
<a class="addthis_button_preferred_2" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
<a class="addthis_button_preferred_3" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
<a class="addthis_button_preferred_4" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
<a class="addthis_button_compact" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
<a class="addthis_counter addthis_bubble_style" addthis:url="<?php echo $file->getFullShortUrl(); ?>" addthis:title="<?php echo str_replace("\"", "", $file->originalFilename); ?>"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f10918d56581527"></script>
<!-- AddThis Button END -->
</td>
</tr>
</tbody>
</table>
</div>
<div class="clear"><!-- --></div>
<div id="pageHeader" style="padding-top: 12px;">
<h2><?php echo t("other_options", "other options"); ?></h2>
</div>
<div>
<table class="accountStateTable">
<tbody>
<tr>
<td class="first">
<?php echo UCWords(t('statistics', 'statistics')); ?>:
</td>
<td>
<a href="<?php echo $file->getStatisticsUrl(); ?>" target="_blank"><?php echo $file->getStatisticsUrl(); ?></a>
</td>
</tr>
<?php if($showAll == true): ?>
<tr>
<td class="first">
<?php echo UCWords(t('delete_file', 'delete file')); ?>:
</td>
<td>
<a href="<?php echo $file->getDeleteUrl(); ?>" target="_blank"><?php echo $file->getDeleteUrl(); ?></a>
</td>
</tr>
<?php endif ?>
</tbody>
</table>
</div>
<div class="clear"><!-- --></div>
</div>
</div>
</div>
<div class="clear"></div>
<?php
require_once('_footer.php');
?>