Results 1 to 3 of 3

Thread: Simple attachment info 0.0.1 a1

  1. #1
    mega's Avatar
    mega is offline Newbie Net Builder
    Join Date
    May 2009
    Location
    Hell , Wanna Come ??
    Posts
    62
    Thanks
    0
    Thanked 10 Times in 4 Posts

    Red face

    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 = &#39;SELECT SUM(filesize) AS attachments_size
            FROM &#39; . ATTACHMENTS_TABLE .
            &#39; WHERE poster_id = &#39; . $user->data[&#39;user_id&#39;];
        $result = $db->sql_query_limit($sql, 1);
        $row = $db->sql_fetchrow($result);
        $attachments_size = (int)$row[&#39;attachments_size&#39;];
        $filesize = (int)$config[&#39;max_filesize&#39;];
        $db->sql_freeresult($result);
    
        $fileunit = array(&#39;B&#39;, &#39;KB&#39;, &#39;MB&#39;);
        
        $template->assign_vars(array(
            //&#39;ATTACHMENT_SIZE&#39; => &#39;Attachment(s) used spaces: &#39; . (int)($attachments_size / 1024) . &#39; kb&#39; , allowed 
            &#39;L_ATTACHMENT_SIZE&#39; => &#39;Spaces used : &#39; . $attachments_size . &#39;&#39; ,
            &#39;L_FILESIZE&#39; => &#39;Max. per file: &#39; . $filesize . &#39;&#39;,
            &#39;ATTACHMENT_SIZE&#39; => $attachments_size,
            &#39;FILESIZE&#39; => $filesize,
            &#39;FILEUNIT&#39; => &#39;<option>B</option><option>KB</option><option>MB</option>&#39;,
            ));
    }
    ?>

    OPEN posting.php
    FIND
    Code:
    
    if ($auth->acl_get(&#39;f_attach&#39;, $forum_id) && $auth->acl_get(&#39;u_attach&#39;) && $config[&#39;allow_attachments&#39;] && $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
    Code:
    
    
    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 + &#39;h&#39;).value;
    
            var new_value = 0;
    Never argue with an idiot; First he takes you down to his level and then he beats you with experience.

  2. #2
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks 4 share
    i will tryit now and reply

  3. #3
    Eyes's Avatar
    Eyes is offline Newbie Net Builder
    Join Date
    May 2009
    Location
    In a Party
    Posts
    83
    Thanks
    0
    Thanked 1 Time in 1 Post
    very good, nice one...

Similar Threads

  1. Replies: 0
    Last Post: 28 April, 2011, 10:29 AM
  2. Need simple help
    By SonnyCooL in forum General Chat
    Replies: 5
    Last Post: 11 April, 2010, 15:03 PM
  3. [Free] Simple PHP Gallery
    By crivion in forum Scripts
    Replies: 0
    Last Post: 21 February, 2010, 11:33 AM
  4. Beauty or Simple
    By Electron in forum Web Design
    Replies: 12
    Last Post: 17 August, 2009, 19:29 PM
  5. is seo simple?
    By epidemic in forum Building
    Replies: 17
    Last Post: 21 July, 2009, 03:26 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •