4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 31, 2014, 04:58:35 AM

Login with username, password and session length
Search:     Advanced search
4images is now on facebook. Click here and become a fan!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Issues / Ausgaben
| |-+  Feedback & Suggestions (Moderator: Acidgod)
| | |-+  [FIX] - details.php file (for comments post)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: [FIX] - details.php file (for comments post)  (Read 10109 times)
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« on: November 03, 2007, 09:16:01 PM »

This check for valid post comment chars after submit.

In details.php file,

find:

Quote  [Expand]
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
    $msg = $lang['comments_deactivated'];  
  }  
  else {
    $user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

replace:

1
2
3
4
5
6
7
8
9
10
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
    $msg = $lang['comments_deactivated'];
  
  } elseif (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['comment_headline']) || !check_post_comment_valid_chars($HTTP_POST_VARS['comment_text'])) {
      redirect("details.php?image_id=" . $id);  
  }  
  else {
    $user_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_text']));

In member.php file,

find:

Quote  [Expand]
if ($action == "uploadimage") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }

add after:

1
2
3
if (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['image_name']) || !check_post_comment_valid_chars($HTTP_POST_VARS['image_description'])) {
      redirect("categories.php?cat_id=" . $cat_id);
  }

In includes/functions.php file,

add before ?> :

1
2
3
4
5
if (!function_exists('check_post_comment_valid_chars')) {
   function check_post_comment_valid_chars($text) {
      return preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $text);
   }
}

If fail, is redirect to details page (with same image ID and for member - with same category id).
« Last Edit: August 27, 2011, 02:26:10 PM by thunderstrike » Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
Mr_LovaLove
Full Member
***
Offline Offline

Posts: 233

Thank You
-Given: 1
-Receive: 0

Unkown


View Profile
« Reply #1 on: January 05, 2008, 03:49:50 PM »

last step

is add after ??? or before O_o

and thanks
Logged

English Please :@
nobby
4images Guru
*******
Offline Offline

Posts: 2612

Thank You
-Given: 5
-Receive: 40


View Profile
« Reply #2 on: January 05, 2008, 03:59:23 PM »

Before ?>
Logged
Mr_LovaLove
Full Member
***
Offline Offline

Posts: 233

Thank You
-Given: 1
-Receive: 0

Unkown


View Profile
« Reply #3 on: January 05, 2008, 04:06:23 PM »

thanks i know Razz

but it must be changed Smile

and thanks for ur post and ur nice replay Smile
Logged

English Please :@
nobby
4images Guru
*******
Offline Offline

Posts: 2612

Thank You
-Given: 5
-Receive: 40


View Profile
« Reply #4 on: January 05, 2008, 04:17:21 PM »

thunderstrike, You have here a mistake. 
Quote  [Expand]
In includes/functions.php file,
 add after ?> :

Before ?> is Correct

nobby
Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #5 on: January 05, 2008, 05:00:55 PM »

This is right. Post edit. Wink
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
Mr_LovaLove
Full Member
***
Offline Offline

Posts: 233

Thank You
-Given: 1
-Receive: 0

Unkown


View Profile
« Reply #6 on: January 05, 2008, 05:15:56 PM »

seems it works now !!!?!?

dont know what happen lol

thunder the if statement is wrong ( i mean IF )
1
2
3
4
5
ïf(!function_exists('check_post_comment_valid_chars')) {
   function check_post_comment_valid_chars($text) {
      return preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $text);
   }
}

ïf  (!function_exists('check_post_comment_valid_chars')) {
Logged

English Please :@
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #7 on: January 05, 2008, 05:16:48 PM »

@MrLovalove:?

I ... no get your post ... what is problem ? ...
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
Mr_LovaLove
Full Member
***
Offline Offline

Posts: 233

Thank You
-Given: 1
-Receive: 0

Unkown


View Profile
« Reply #8 on: January 05, 2008, 05:18:20 PM »

not big deal !!

its cleared on my last post

Smile
Logged

English Please :@
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #9 on: January 05, 2008, 05:20:02 PM »

 Shocked ... this is right ... so small  Mr. Green

Post fix. Wink
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.395 seconds with 19 queries.
Post your comments here