PDA

View Full Version : NO images in Post New thread


ga.net
04-07-2003, 11:51 AM
Is there a hack for this??

Sebastian
04-07-2003, 12:14 PM
there is an option in the admin cp to not allow people to upload attachments, you must go under forum permissions and use custom settings for which ever forum you want to restrict it.

ga.net
04-07-2003, 10:27 PM
What I mean is unable to use the IMG tag in Post New Thread. Are you referring to this too?

Sebastian
04-08-2003, 06:25 AM
its not possible to do this i dont think, i thought you mean uploading images.

Boofo
04-08-2003, 08:42 AM
This is quick and dirty and not tested, but I think it should work.

In functions.php

Find:

if ($enablecensor==1 and $censorwords!="") {

ABOVE it add:

if($newthread) {
$text = preg_replace("/IMG/i", "", $text);
$text = preg_replace("/img/i", "", $text);
}

Also add $newthread to the global line right above this.

ga.net
04-08-2003, 09:53 AM
Thanks! But what do you mean by quick and dirty???

If it would cause problems, is there a way to just disable the IMG Tag?? :)

Boofo
04-08-2003, 09:57 AM
It won't cause problems. Either it will work or it won't. If it doesn't work, just take the code you add out. Quick and dirty means fast and untested, is all. ;) I use code similar to this to disable a vbcode tag I use so no one else can use it.

Sebastian
04-09-2003, 12:28 AM
there is really no way to just disable it when making a new thread .. all you can do it pre replace it with nothing, as boofo pointed out.

ga.net
04-10-2003, 12:49 PM
Ok thanks! Ill try it out. So this hack will be able to prevent posting of images in first post??

ga.net
04-13-2003, 09:01 AM
bump

Boofo
04-13-2003, 06:31 PM
Have you tried the above code yet?

ga.net
04-14-2003, 02:26 PM
Not yet! sorry :)

ga.net
04-17-2003, 06:43 AM
I got this error

Parse error: parse error in /www/greenarcher.net/html/forums/admin/functions.php on line 128

Fatal error: Call to undefined function: getuserinfo() in /www/greenarcher.net/html/forums/admin/sessions.php on line 112

Erwin
04-17-2003, 06:55 AM
Not perfect, but will work.

Open newthread.php, find:


// check max images
if ($maximages!=0) {
$parsedmessage=bbcodeparse($message,$forumid,$allo wsmilie);
if (countchar($parsedmessage,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}


Below, add:


if(strstr($message,'[img]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}
if(strstr($message,'[IMG]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}


Then, ADD a template called "error_noimagesnewreply" with this content:


You cannot use the [img] code with a new thread!


That would work.

ga.net
04-17-2003, 07:07 AM
Shouldnt it be newthread instead of newreply???

Erwin
04-17-2003, 07:12 AM
Oops... yes, it's the same instructions, same code. :)

Boofo
04-17-2003, 07:15 AM
Today at 02:12 AM Erwin said this in Post #16 (https://vborg.vbsupport.ru/showthread.php?postid=383259#post383259)
Oops... yes, it's the same instructions, same code. :)

I'm just curious...why didn't this work?

if($newthread) {
$text = preg_replace("/IMG/i", "", $text);
$text = preg_replace("/img/i", "", $text);
}

ga.net
04-17-2003, 07:42 AM
Im getting a parse error

Erwin
04-17-2003, 07:45 AM
The instructions I gave you are so basic they are error-free.

Redo the hack again from scratch.

Post the parse error, and the 10 lines before and after of the code that the parse error specifies.

If you still get errors, then there something wrong with the way you are doing it - make sure you use Notepad, not Wordpad, and you're not mucking up the formatting.

@ Boofo - not sure what's wrong with your code, looks fine to me.

ga.net
04-17-2003, 07:52 AM
Here's the error:

Parse error: parse error in /www/greenarcher.net/html/forums/newthread.php on line 198

Here is part of the code

// check max images
if ($maximages!=0) {
$parsedmessage=bbcodeparse($message,$foruminfo[forumid],$allowsmilie);
if (countchar($parsedmessage,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}
if($message,'[img]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}
if($message,'[IMG]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}

Erwin
04-17-2003, 08:07 AM
You are using the WRONG code.

Take a close look at what I posted, then at what you posted.

You are missing this bit in crucial places

strstr

Like I said, redo the hack again. Follow the instructions. Delete the above chunk of code, copy and paste EXACTLY what I posted.

ga.net
04-17-2003, 08:11 AM
Ok! but weird cause I just copy and pasted what you posted.

ga.net
04-17-2003, 08:17 AM
I dont see any difference! Mind if you post the code without quoting it? I copy and pasted what you posted and I dont see any differece. :)

Erwin
04-17-2003, 08:21 AM
What you posted:

if($message,'[img]')) {

What I posted:

if(strstr($message,'[img]')) {

Can you see the difference now?

Erwin
04-17-2003, 08:22 AM
Here's the code without putting it in a code box.

if(strstr($message,'[img]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}
if(strstr($message,'[IMG]')) {
eval("standarderror(\"".gettemplate("error_noimagesnewreply")."\");");
exit;
}

Strange that you can't copy it properly... Let us know if it's a bug.

ga.net
04-17-2003, 08:30 AM
Please check what you posted in page 1. This is what I copied:

http://www.greenarcher.net/err.gif

Where's the "strstr" ????

Anyway thanks! Im gonna try it out

ga.net
04-17-2003, 08:43 AM
Thanks! it works, the problem is when I edit the post and put the IMG tags, the images appears.