[php]代码库
<?php
// Sorting direction image.
$direction = $sort_order == 'asc' ? '<img src="templates/default/images/arrowup.gif" alt="" />' : '<img src="templates/default/images/arrowdown.gif" alt="" />';
// Sorting indicator
$sort_name = $sort_by == 'name' ? ' ' . $direction : '';
$sort_date = $sort_by == 'date' ? ' ' . $direction : '';
$sort_size = $sort_by == 'size' ? ' ' . $direction : '';
$sort_ext = $sort_by == 'ext' ? ' ' . $direction : '';
// Required to display file icons for different file types
include_once ( 'tpl_icons.php' );
// Generate javascript array of files
reset ( $user_files );
$temp = array ( );
while ( list ( $i, $file ) = each ( $user_files ) )
{
$file['icon'] = tpl_myfiles_get_icon ( $file['ext'] );
$temp [] = sprintf ( "['%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%s,%s,'%s','%s']",
$file['icon'],
$file['file_url'],
addslashes ( htmlentities_str ( str_slice ( $file['name'], 35 ) ) ),
$file['size'],
$file['date'],
$file['is_resizeable'],
$file['resize_url'],
$file['rename_url'],
$file['form_name'],
$file['ext'],
$file['size_raw'],
$file['date_raw'],
addslashes ( $file['full_name'] ),
$file['download_url']
);
}
$javascript_array = '[' . implode ( $temp, ",\n" ) . ']';
// end php
?>
<script type="text/javascript">
<!--
var files = <?=$javascript_array?>;
var current_folder = '<?=$current_folder_path?>';
var sort_links = { '类型' : '<?=$sort_links['ext']?>', '日期' : '<?=$sort_links['date']?>', '名称' : '<?=$sort_links['name']?>', 'size' : '<?=$sort_links['size']?>' }
var current_sort = { '类型' : '<?=$sort_ext?>', '日期' : '<?=$sort_date?>', '名称' : '<?=$sort_name?>', '大小' : '<?=$sort_size?>' }
-->
</script>
<script type="text/javascript" src="templates/default/myfiles.js"></script>
<!-- LEFT SIDE -->
<div style="float: left; width: 23%; overflow: hidden; color: #a0a0a0;">
<!-- Folders -->
<img src="templates/default/images/folder2.gif" alt="" class="img1" /> <a href="folders.php" class="special" style="font-weight:bold;">文件夹</a>
(<a href="folders.php?action=create" class="special">新建</a>)
<ul style="line-height: 1.6em; margin-top: 3px;">
<li><a href="myfiles.php" class="special">主文件夹 (<?=$main_folder_file_count?>)</a></li>
<?php /* Loop through folders and list them */ reset ( $user_folders ); while ( list ( $i, $folder ) = each ( $user_folders ) ) : $folder['spaces'] = str_repeat ( ' ', $folder['level'] ); ?>
<li><?=$folder['spaces']?><a href="<?=$folder['folder_url']?>" class="special"><?=str_slice($folder['name'],20)?> (<?=$folder['files']?>)</a></li>
<?php /* End folders loop */ endwhile; ?>
</ul>
<!-- Tools -->
<div style="margin-top:15px;display:none;">
<img src="templates/default/images/gallery.gif" alt="" class="img1" /> <a href="folders.php" class="special" style="font-weight:bold;">图表种类</a>
</div>
<!-- statistics -->
<div style="margin-top:10px;">
<img src="templates/default/images/stats.gif" alt="" class="img1" /> <strong class="s1">状态统计</strong>
<div style="font-size:0.8em; margin-top: 2px;color:#666666;">
空间: <?=$total_file_size?> / <?=$max_file_storage=='0.0B'?'无限制':$max_file_storage?>
<div style="margin-bottom:3px;width: 130px; overflow: hidden; border: 1px solid #808080;padding:1px;">
<div style="width: <?=$space_usage_percentage>100?100:($space_usage_percentage+1)?>%; background-color: <?=$space_usage_percentage>=100?'#BF3030':'#E0E0E0'?>; height: 7px; float: left;"><!-- --></div>
</div>
<?php /* if max bandwidth is not Unlimited */ if ( $max_bandwidth != '0B' ) : ?>
流量: <?=$bandwidth_used?> / <?=intval($max_bandwidth)==0?'无限制':$max_bandwidth?>
<div style="width: 130px; overflow: hidden; border: 1px solid #808080;padding:1px;">
<div style="width: <?=$bandwidth_usage_percentage>100?100:($bandwidth_usage_percentage+1)?>%; background-color: <?=$bandwidth_usage_percentage>=100?'#BF3030':'#E0E0E0'?>; height: 7px; float: left;"><!-- --></div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- RIGHT SIDE -->
<div style="float:right; width:75%;">
<form method="post" action="myfiles.php" id="myfiles_form">
<input type="hidden" name="folder" value="<?=$current_folder_path?>" />
<input type="hidden" name="action" value="" id="myfiles_form_action" />
<div>
<a href="<?=$current_folder_upload_url?>" class="special" style="font-weight:bold;"><?=$current_folder==''? '主文件夹' : $current_folder?></a>
<p class="p2"><?=$current_folder_description==''?'没有描述':htmlentities_str($current_folder_description);?></p>
</div>
<?php /* If there are files in the current folder, show this menu*/ if ( count ( $user_files ) ) : ?>
<div id="move_files_select" style="margin:8px 0px 5px 0px; background-color:#F5F5F5;padding:8px 8px 4px 8px;">
<select name="move_to">
<option value="">主文件夹</option>
<?php /* Loop through list of folders */ reset ( $user_folders ); while ( list ( $i, $folder ) = each ( $user_folders ) ) : $folder['spaces'] = str_repeat ( ' ', $folder['level'] ); ?>
<option value="<?=$folder['path']?>">
<?=$folder['spaces']?><?=str_slice($folder['name'],40)?>
</option>
<?php /* End folders loop */ endwhile; ?>
</select>
<input type="button" name="action[move]" value="移动" onclick="myFilesAction('move');" class="blue_button" />
<input type="button" name="action[delete]" value="删除" onclick="myFilesAction('delete');" class="blue_button" />
<input type="button" name="action[img_tags]" value="[IMG]标签" onclick="myFilesAction('img_tags');" class="blue_button" />
<div style="margin-top: 8px; color: #888888;" onmousedown="return false;">
<strong class="s2">选择:</strong>
<span class="link" id="select_0" onmousedown="checkFiles(0);">全部</span>,
<span class="link" id="select_1" onmousedown="checkFiles(1);">无</span>,
<span class="link" id="select_2" onmousedown="checkFiles(2);">图像</span>,
<span class="link" id="select_3" onmousedown="checkFiles(3);">非图像</span>,
<span class="link" id="select_4" onmousedown="checkFiles(4);">反选</span>
</div>
</div>
<div id="error_message_box" style="text-align:center; margin-bottom: 5px;display:none;">
你没有选择任何文件。
</div>
<!-- generate files table here -->
<div id="my_files_container"></div>
<p style="padding:5px;border-top:1px solid #f0f0f0;font-size:0.9em;color:#505050;">
总共有 <?=$current_folder_file_count?> 个文件在此文件夹, 共占用空间 <?=$current_folder_size?> 。
</p>
<?php /* There are no files */ else:?>
<p style="-moz-border-radius:5px;padding:10px;margin:10px 0px 10px 0px;text-align:center;background-color:#FAFFE6;color:#2F331F;">
这个文件夹是空的, <a href="<?=$current_folder_upload_url?>" class="special">点击这里</a> 上传文件到这个文件夹。
</p>
<?php /* Endif for file list */ endif; ?>
<!-- end files list -->
</form>
</div>
<div class="spacer"><!-- --></div>
[源代码打包下载]