vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Attachment Editor (https://vborg.vbsupport.ru/showthread.php?t=34625)

Admin 01-29-2002 10:00 PM

This one gives users a way to edit their attached text (.txt) files inside the forum system, without the hassle of downloading-editing-updating the file every time. :)
(needless to say only mods and the poster can see the link / access the editor)

I thought of it while updating a hack of mine, because I had to do it numerous times and it really got on my nerves. :o

If you want to see a demo, either attach a small file here and see how it works, or just look below in the next post for a screen shot. :)
(the image is also in the zip file)

Anyhow, here are the instructions to install the hack.
First download the attached zip archive so you can have the files you need in front of you.
A text version of this post is available in the zip as well.
  • In functions.php, add this:
    Code:

    [high]        $editattach='';[/high]
    right before this:
    Code:

            if ($post[attachmentid]!=0 and $post[attachmentvisible]) {
  • And add this:
    Code:

    [high]                        if (($bbuserinfo['usergroupid']==5 or $bbuserinfo['usergroupid']==6 or $bbuserinfo['usergroupid']==7 or $bbuserinfo['userid']==$post['userid']) and $post['attachmentextension']=='txt') {
                                    $editattach=' (<a href="misc.php?s=&action=editattach&postid='.$post['postid'].'">edit</a>)';
                            }[/high]

    right before this:
    Code:

                            eval("\$post[attachment] = \"".gettemplate("postbit_attachment")."\";");
                    }
            } else {
                    $post[attachment]="";
            }

  • Save functions.php and upload.
  • In misc.php, add the contents of add-to-misc.txt (in attached zip file) right before ?> (end of file).
  • Save misc.php and upload.
  • In the postbit_attachment template add this:
    Code:

    [high]$editattach[/high]
    right after this:
    Code:

    $post[filename]</a>
  • Create a new template editattach with the contents of editattach.txt (in attached zip file).
  • Add a new template error_attacheditorinvalidext:
    Code:

    [high]You are trying to edit a file with an invalid extension. We currently only support editing text files.[/high]
  • Add a new template error_attacheditortoobig:
    Code:

    [high]The data you are trying to save is too big! The maximum allowed size is $maxattachsize bytes.[/high]
  • Add a new template redirect_attachupdated:
    Code:

    [high]The attachment has been updated! You will now be taken back to your post.[/high]

Have fun! :china:

Admin 01-30-2002 11:41 AM

A screen shot...

larryz 01-30-2002 11:54 AM

Excellent idea FireFly, I'm going to check this one out ASAP.

Lesane 01-30-2002 11:56 AM

Great hack, Thanks.

SaintDog 01-30-2002 09:19 PM

Nice hack, although I am using 2.2.1 because I do not feel like re-applying 20 hacks to the board when almost every file has been edited in some way or another.

From the looks of it though, it would be a great tool, not only for those here, but many others as well.

Great job!

Dade 01-31-2002 12:20 AM

Lesane always is the first or second person that replies to a new hack post, and always replies "Great hack, thanks" :D

But in all seriousness chen, great hack, thanks! :D:D

Lesane 01-31-2002 09:25 AM

Quote:

Originally posted by Dade
Lesane always is the first or second person that replies to a new hack post, and always replies "Great hack, thanks" :D

But in all seriousness chen, great hack, thanks! :D:D

haha :D, tru tru but only when its a great hack though ;)

MikeWarner 01-31-2002 09:49 AM

Just testing to see it work.....

MikeWarner 01-31-2002 09:50 AM

wow - very nice. I like that! Don't think I'll need it on my site though as only admin can attach files, and they are always .gif files.

Nice work though.

Danny 02-03-2002 11:25 PM

testing also


All times are GMT. The time now is 01:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01050 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete