Recent Topics

1 Sep 19, 2006 23:48    

I'm hoping you can help me figure this out :)

I upgraded to 1.8 and now when unregistered users try to post a comment, the page times out. The comment shows up if they wait the whole time.

I have uploaded a fresh version of the feedback.php file and the comment_post.php file. Anything else I can try?

You can see it for yourself here:
http://www.hippiemommy.com

2 Sep 20, 2006 01:34

YEP ... I get a "no response from server" (or something like that) , through the comment registers.

Hmmm. To me, there is something wonky about your setup.

The category listing you have at the top of the page: aside from the (ALL) - which leads to index.php, the rest all lead to index.php/stub ??

index.php/stub just is a re-hash of your index.php page?

Seems that each of those should be MAIN CATEGORIES (and all the stuff inside should be sub-categories) ... that's how I'd organize it anyway. THEN, when you clicked ("homekeeping" - for example) ... ALL of the "homekeeping" sub-categories would be listed as posts, in chronological order (rather than now, when you click "homekeeping", you're just back at the first page).

Not sure what your comment problem is, but seems that it may be related to the basic setup (like after the comment, the visitor is rerouted to some odd spot that never resolves).

Notice that you also have a number of W3C validation errors too, with your skin, which can only hurt your situation.

I'd recommend (a) resolving the validation errors and (b) revisiting your basic set-up (so the links that now go to "stub", go to a unique location, instead).

Not a direct solution, but I'd bet the comment thing is a syptom of a larger navigational issue.

Hope this helps.

3 Sep 20, 2006 01:44

Hmmm ... seems the comment_post.php file is in the correct spot ... it accepts the comment (or rejects it) - quickly enough ... logs it to the DB ... it must be the header redirect that gets jammed up.

I'm still thinking the whole stub thing is part of the problem.

I see now that blog#7 = "HomeKeeping"; #8="Exercise"; etc. (So they're different blogs with categories).

OKAY ... then why are the bloglist links all going to /stub?

Again ... that seems to be the issue. (I'd have to have a play in your backoffice to see how each blog is set up, but my guess is that it's that).

Good luck. If you want some personalized help, just PM me or contact me through our site.

4 Sep 20, 2006 01:48

OK, I'll play with that. That part broke when I upgraded...

Would it make sense for that part not to work when it works fine if you're registered?

5 Sep 20, 2006 02:02

I fixed that problem. Oddly enough, I just had to click off of the explicit reference from index and then back on and then the link was right.

The other problem remains though.

6 Sep 20, 2006 02:05

Oh wait, although it looks right on the backend, its not right on the links <banging head>

7 Sep 20, 2006 03:09

I made all of the blogs into one blog, with categories like you mentioned. Same problem though :/

I also checked it using other skins, and they all have the same problem.

8 Sep 20, 2006 05:52

You're running v1.8 beta, right?

Check your two blogs (all and linkblog) to see make sure that the "new feedback status" is set to "published"

[Blog Settings -> Pick a blog -> Advanced -> Feedback Options (2nd item) ]

If they are (as I suspect), then I want to try something.

(1) Turn on debugging (edit the /conf/_advanced.php file and change line 33 from $debug = 0; to $debug = 1; )

(2) Edit your /htsrv/comment_post.php file and go to the bottom. There, you should find a line that reads "if( $debug ) ... in that area, I want you to add the following line:

  
echo $redirect_to; 

Add it right below THIS line:

// $redirect_to .= '#'.$Comment->get_anchor();

After you upload the new /conf/_advanced.php and /htsrv/comment_post.php files ... then make sure you log out of your blog ... try to make a comment and it should spit back a BUNCH of debug stuff, but I'm interested in the ECHO link at the very top.

I tested this on my site and got the following (for a comment I made as a visitor):

http://randsco.com/index.php/2006/09/11/sunflower_project_sep_11th_update?blog=7&title=sunflower_project_sep_11th_update&page=1&more=1&c=1&tb=1&pb=1&disp=single#c590

It's a mouthful, but most importantly, it's a valid link. I want to see the one yours spits out, as it's THAT LOCATION it's trying to go to AFTER a visitor make s a comment (and what's tossing your server for a loop).

This should tell us something.

After you've gotten the link and pasted it here ... please go back and turn of debug (just change the 1 back to a 0 in _advanced.php) ...

9 Sep 20, 2006 19:58

The default was set to published.

I don't seem to have that line at the bottom of my comment_post.php. Do I maybe have the wrong version somehow? This is what I have

<?php
/**
 * This file posts a comment!
 *
 * This file is part of the evoCore framework - {@link http://evocore.net/}
 * See also {@link http://sourceforge.net/projects/evocms/}.
 *
 * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * {@internal License choice
 * - If you have received this file as part of a package, please find the license.txt file in
 *   the same folder or the closest folder above for complete license terms.
 * - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)
 *   then you must choose one of the following licenses before using the file:
 *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
 *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
 * }}
 *
 * {@internal Open Source relicensing agreement:
 * }}
 *
 * @package htsrv
 */


/**
 * Initialize everything:
 */
require_once dirname(__FILE__).'/../conf/_config.php';

require_once $inc_path.'_main.inc.php';

// statuses allowed for acting on:
$show_statuses = array( 'published', 'protected', 'private' );

// Only for 0.9.0.11, for users who will not update their conf! :/
if( !isset($minimum_comment_interval) ) $minimum_comment_interval = 30;

// Getting GET or POST parameters:
param( 'comment_post_ID', 'integer', true ); // required

$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID );

if( ! $commented_Item->can_comment( NULL ) )
{
	$Messages->add( T_('You cannot leave comments on this post!'), 'error' );
}


// Note: we use funky field names to defeat the most basic guestbook spam bots and/or their most basic authors
$comment = param( 'p', 'html' );
param( 'comment_autobr', 'integer', ($comments_use_autobr == 'always') ? 1 : 0 );

if( ! is_logged_in() )
{	// User is not logged in (registered users), we need some id info from him:
	// Note: we use funky field names to defeat the most basic guestbook spam bots and/or their most basic authors
	$author = param( 'u', 'string' );
	$email = param( 'i', 'string' );
	$url = param( 'o', 'string' );
	param( 'comment_cookies', 'integer', 0 );
	param( 'comment_allow_msgform', 'integer', 0 ); // checkbox

	if ($require_name_email)
	{ // We want Name and EMail with comments
		if( empty($author) )
		{
			$Messages->add( T_('Please fill in your name.'), 'error' );
		}
		if( empty($email) )
		{
			$Messages->add( T_('Please fill in your email.'), 'error' );
		}
	}

	if( !empty($author) && antispam_check( $author ) )
	{
		$Messages->add( T_('Supplied name is invalid.'), 'error' );
	}

	if( !empty($email)
		&& ( !is_email($email)|| antispam_check( $email ) ) )
	{
		$Messages->add( T_('Supplied email address is invalid.'), 'error' );
	}

	// add 'http://' if no protocol defined for URL
	$url = ((!stristr($url, '://')) && ($url != '')) ? 'http://' . $url : $url;
	if( strlen($url) < 7 ){
		$url = '';
	}
	if( $error = validate_url( $url, $comments_allowed_uri_scheme ) )
	{
		$Messages->add( T_('Supplied URL is invalid: ').$error, 'error' );
	}
}

$now = date( 'Y-m-d H:i:s', $localtimenow );

// CHECK and FORMAT content
$original_comment = $comment;
//echo 'allowed tags:',htmlspecialchars($comment_allowed_tags);
$comment = strip_tags($comment, $comment_allowed_tags);
// TODO: AutoBR should really be a "comment renderer" (like with Items)
$comment = format_to_post($original_comment, $comment_autobr, 1);

if( empty($comment) )
{ // comment should not be empty!
	$Messages->add( T_('Please do not send empty comments.'), 'error' );
}
elseif( antispam_check( strip_tags($comment) ) )
{
	$Messages->add( T_('Supplied comment is invalid.'), 'error' );
}

// Flood protection was here and SHOULD NOT have moved down!

/**
 * Create comment object. Gets validated, before recording it into DB:
 */
$Comment = & new Comment();
$Comment->set( 'type', 'comment' );
$Comment->set_Item( $commented_Item );
if( is_logged_in() )
{ // User is logged in, we'll use his ID
	$Comment->set_author_User( $current_User );
}
else
{	// User is not logged in:
	$Comment->set( 'author', $author );
	$Comment->set( 'author_email', $email );
	$Comment->set( 'author_url', $url );
	$Comment->set( 'allow_msgform', $comment_allow_msgform );
}
$Comment->set( 'author_IP', $Hit->IP );
$Comment->set( 'date', $now );
$Comment->set( 'content', $comment );

$commented_Item->get_Blog(); // Make sure Blog is loaded

// Assign default status for new comments:
$Comment->set( 'status', $commented_Item->Blog->get_setting('new_feedback_status') );


// Check if we want to PREVIEW:
$action = $Request->param_arrayindex( 'submit_comment_post_'.$commented_Item->ID, 'save' );

if( $action != 'preview' )
{
	/*
	 * Flood-protection
	 * TODO: Put time check into query?
	 * TODO: move that as far !!UP!! as possible! We want to waste minimum resources on Floods
	 * TODO: have several thresholds. For example:
	 * 1 comment max every 30 sec + 5 comments max every 10 minutes + 15 comments max every 24 hours
	 * TODO: factorize with trackback
	 */
	$query = 'SELECT MAX(comment_date)
							FROM T_comments
						 WHERE comment_author_IP = '.$DB->quote($Hit->IP).'
								OR comment_author_email = '.$DB->quote($Comment->get_author_email());
	$ok = 1;
	if( $then = $DB->get_var( $query ) )
	{
		$time_lastcomment = mysql2date("U",$then);
		$time_newcomment = mysql2date("U",$now);
		if( ($time_newcomment - $time_lastcomment) < $minimum_comment_interval )
			$ok = 0;
	}
	if( !$ok )
	{
		$Messages->add( sprintf( T_('You can only post a new comment every %d seconds.'), $minimum_comment_interval ), 'error' );
	}
	/* end flood-protection */
}


// Trigger event: a Plugin could add a $category="error" message here..
$Plugins->trigger_event('BeforeCommentFormInsert', array(
	'Comment' => & $Comment,
	'original_comment' => & $original_comment,
	'is_preview' => ($action == 'preview') ) );


/*
 * Error messages:
 */
if( $Messages->count('error') )
{
	$Messages->display( T_('Cannot post comment, please correct these errors:'),
	'[<a href="javascript:history.go(-1)">'. T_('Back to comment editing') . '</a>]' );

	debug_info();  // output debug info, useful to see what a plugin might have done
	exit(); // TODO: nicer displaying here (but do NOT die or debug_die because this is not a BUG/user hack, it's a plain user input error - any bozo can produce it)
}

if( $action == 'preview' )
{ // set the Comment into user's session and redirect. _feeback.php of the skin should display it.
	$Comment->set( 'original_content', $original_comment ); // used in the textarea input field again
	$Session->set( 'core.preview_Comment', $Comment );
	$Session->dbsave();

	$Request->param( 'redirect_to', 'string', '' );
	$redirect_to .= '#comment_preview';

	header_nocache();
	header_redirect();
	exit();
}
else
{ // delete any preview comment from session data:
	$Session->delete( 'core.preview_Comment' );
}


// RECORD comment:

$Comment->dbinsert();


/*
 * ---------------
 * Handle cookies:
 * ---------------
 */
if( !is_logged_in() )
{
	if( $comment_cookies )
	{	// Set cookies:
		if ($email == '')
			$email = ' '; // this to make sure a cookie is set for 'no email'
		if ($url == '')
			$url = ' '; // this to make sure a cookie is set for 'no url'

		// fplanque: made cookies available for whole site
		setcookie( $cookie_name, $author, $cookie_expires, $cookie_path, $cookie_domain);
		setcookie( $cookie_email, $email, $cookie_expires, $cookie_path, $cookie_domain);
		setcookie( $cookie_url, $url, $cookie_expires, $cookie_path, $cookie_domain);
	}
	else
	{	// Erase cookies:
		if( !empty($_COOKIE[$cookie_name]) )
		{
			// echo "del1<br />";
			setcookie('comment_author', '', $cookie_expired, '/');
			setcookie('comment_author', '', $cookie_expired, $cookie_path, $cookie_domain);
			setcookie( $cookie_name, '', $cookie_expired, $cookie_path, $cookie_domain);
		}
		if( !empty($_COOKIE['comment_author_email']) )
		{
			// echo "del2<br />";
			setcookie('comment_author_email', '', $cookie_expired, '/');
			setcookie('comment_author_email', '', $cookie_expired, $cookie_path, $cookie_domain);
			setcookie( $cookie_email, '', $cookie_expired, $cookie_path, $cookie_domain);
		}
		if( !empty($_COOKIE['comment_author_url']) )
		{
			// echo "del3<br />";
			setcookie('comment_author_url', '', $cookie_expired, '/');
			setcookie('comment_author_url', '', $cookie_expired, $cookie_path, $cookie_domain);
			setcookie( $cookie_url, '', $cookie_expired, $cookie_path, $cookie_domain);
		}
	}
}

// Note: we don't give any clue that we have automatically deleted a comment. Il would only give spammers the perfect tool to find out how to pass the filter.

if( $Comment->ID )
{ // comment has not been deleted
	// Trigger event: a Plugin should cleanup any temporary data here..
	$Plugins->trigger_event( 'AfterCommentFormInsert', array( 'Comment' => & $Comment, 'original_comment' => $original_comment ) );

	/*
	 * --------------------------
	 * New comment notifications:
	 * --------------------------
	 */
	$Comment->send_email_notifications();


	// Add a message, according to the comment's status:
	if( $Comment->status == 'published' )
	{
		$Messages->add( T_('Your comment has been submitted.'), 'success' );

		// Append anchor to the redirect_to param, so the user sees his comment:
		$Request->param( 'redirect_to', 'string', '' );
		$redirect_to .= '#'.$Comment->get_anchor();
	}
	else
	{
		$Messages->add( T_('Your comment has been submitted. It will appear once it has been approved.'), 'success' );
	}
}
// Set Messages into user's session, so they get restored on the next page (after redirect):
$Session->set( 'Messages', $Messages );


header_nocache();
header_redirect();


/*
 nolog */
?>

10 Sep 20, 2006 20:00

I haven't changed anything, but it is now working.... <shrug> I'll post if it happens again.

11 Sep 20, 2006 20:05

LOL ... It was all ME! B)

I went to your host and got everything sorted!! :D

You should be good-to-go now. Let me know if it happens again.

Cheers,


Form is loading...