This is a simple attachment info still in developement.
Any suggestion and comments are welcome !
But haven't writing the MODX file.
It now just add the total size uploaded and per attachment max. filesize.
OPEN function_posting.php
<a href="http://ipost2host.com/viewtopic.php?f=13&t=1947#" target="_blank">
</a>
Code:
<?php
function attachments_get_total($mode = 0, &$user = null)
{
global $db, $template, $user, $config;
$attachments_size = 0;
$sql = 'SELECT SUM(filesize) AS attachments_size
FROM ' . ATTACHMENTS_TABLE .
' WHERE poster_id = ' . $user->data['user_id'];
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$attachments_size = (int)$row['attachments_size'];
$filesize = (int)$config['max_filesize'];
$db->sql_freeresult($result);
$fileunit = array('B', 'KB', 'MB');
$template->assign_vars(array(
//'ATTACHMENT_SIZE' => 'Attachment(s) used spaces: ' . (int)($attachments_size / 1024) . ' kb' , allowed
'L_ATTACHMENT_SIZE' => 'Spaces used : ' . $attachments_size . '' ,
'L_FILESIZE' => 'Max. per file: ' . $filesize . '',
'ATTACHMENT_SIZE' => $attachments_size,
'FILESIZE' => $filesize,
'FILEUNIT' => '<option>B</option><option>KB</option><option>MB</option>',
));
}
?>
OPEN posting.php
FIND
Code:
if ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype)
AFTER ADD
Code:
attachments_get_total();
OPEN posting_attach_body.html
FIND
<a href="http://ipost2host.com/viewtopic.php?f=13&t=1947#" target="_blank">
</a>
Code:
{L_ADD_ATTACHMENT_EXPLAIN}</p>
AFTER ADD
attachment_info.html
<a href="http://ipost2host.com/viewtopic.php?f=13&t=1947#" target="_blank">
</a>
Code:
<script type="text/javascript" defer="defer">
// <!CDATA[
function change_unit(idx, elem)
{
var kb_unit = 1024;
var mb_unit = 1048576;
var t = document.getElementById(elem);
var default_value = document.getElementById(elem + 'h').value;
var new_value = 0;
Bookmarks