MYSQL Syntax in story submit, step 2

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2007, 09:07 AM
Casual Pligger
 
Join Date: Feb 2007
Posts: 93
Hey, just installed 9.5.... however, i just tried submitting a story and i got this error after the first step

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND vote_ip='194.255.106.26'' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1, 10, '194.255.106.26')' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233

if i continue to submit the story it works fine, but id really like to get rid of the errors



then when i click on the story after it has been submitted, i get this error:

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in /home/.monika/celebrigator/new.celebrigator.com/story.php on line 131

fresh install of 9.5, using dreamhost setup

www.new.celebrigator.com
Reply With Quote
  #2 (permalink)  
Old 05-08-2007, 03:09 PM
Casual Pligger
 
Join Date: Feb 2007
Posts: 93
where would my ini file be
Reply With Quote
  #3 (permalink)  
Old 05-08-2007, 04:21 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
Check with your host, but I think theres a bug in the code. Hopefully there will be a fix soon.

Geoserv
Reply With Quote
  #4 (permalink)  
Old 05-08-2007, 09:05 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
There is a fix for that here.
Reply With Quote
  #5 (permalink)  
Old 05-09-2007, 03:30 AM
sdu sdu is offline
New Pligger
 
Join Date: May 2007
Posts: 1
the following error message is from "Latest comments":
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'comments_size_sidebar' at line 1
Reply With Quote
  #6 (permalink)  
Old 05-09-2007, 06:52 AM
Casual Pligger
 
Join Date: Feb 2007
Posts: 93
thanks for the fix ash, but I am still getting errors on submit step 2

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND vote_ip='194.255.106.26'' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 2, 10, '194.255.106.26')' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233



It also is weird, because stories are not being auto voted, and when i do go back and vote for them, it switches to voted, but the number still stays at 0, and if i try and click it again, I get the "you already voted for this story error!"

please advise, and thanks so much


UPDATE: After submitting a story (still with the above errors) if i go click on the story which HAS been submitted, it takes me to the story submit page! www.new.celebrigator.com

Last edited by mbs348; 05-09-2007 at 06:56 AM.
Reply With Quote
  #7 (permalink)  
Old 05-09-2007, 07:25 AM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
I registered and was able to vote on the one story you have. When I clicked on the story title, it did however take me to the submit process.

Can you post your submit.php file so we can take a peak?

Geoserv.
Reply With Quote
  #8 (permalink)  
Old 05-09-2007, 09:27 AM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
Quote:
Originally Posted by sdu View Post
the following error message is from "Latest comments":
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'comments_size_sidebar' at line 1

Go into your admin panel and into "Configure Pligg" and "Comments" and see if you have this "Number of comments (sidebar)" and see if it is set to 8.
Reply With Quote
  #9 (permalink)  
Old 05-09-2007, 12:16 PM
Casual Pligger
 
Join Date: Feb 2007
Posts: 93
Here is my submit.php file, I have not modified it at all, using build 1069

Code:
<?php

include_once('Smarty.class.php');
$main_smarty = new Smarty;

include('config.php');
include(mnminclude.'html1.php');
include(mnminclude.'ts.php');
include(mnminclude.'link.php');
include(mnminclude.'tags.php');
include(mnminclude.'smartyvariables.php');

// html tags allowed during submit
$main_smarty->assign('Story_Content_Tags_To_Allow', htmlspecialchars(Story_Content_Tags_To_Allow));

// breadcrumbs and page titles
$navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Breadcrumb_Submit');
$navwhere['link1'] = getmyurl('submit', '');
$main_smarty->assign('navbar_where', $navwhere);
$main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Breadcrumb_Submit'));
$main_smarty = do_sidebar($main_smarty);

// make sure user is logged in
force_authentication();

// module system hook
check_actions('submit_post_authentication');

// this is for direct links from weblogs
if(empty($_POST['phase']) && !empty($_GET['url'])) {
	$_POST['phase'] = 1;
	$_POST['url'] = $_GET['url'];
	$_POST['randkey'] = rand(10000,10000000);
	if(!empty($_GET['trackback'])) 
	$_POST['trackback'] = $_GET['trackback'];
}

// determine which step of the submit process we are on
if(isset($_POST["phase"])) {
	$phase = $_POST["phase"]; 
} 
else {
	$phase = 0;
}

// If show URL input box is disabled, go straight to step 2
if($phase == 0 && Submit_Show_URL_Input == false) {
	$phase = 1;
}
switch ($phase) {
	case 0:
		do_submit0();
		break;
	case 1:
		do_submit1();
		break;
	case 2:
		do_submit2();
		break;
	case 3:
		do_submit3();
		break;
}

exit;

// enter URL before submit process
function do_submit0() {
	global $main_smarty, $the_template;
	$main_smarty->assign('submit_rand', rand(10000,10000000));
	$main_smarty->assign('Submit_Show_URL_Input', Submit_Show_URL_Input);
	$main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL);
	
	define('pagename', 'submit'); 
  $main_smarty->assign('pagename', pagename);
	
	$main_smarty->assign('tpl_center', $the_template . '/submit_step_1');
	$main_smarty->display($the_template . '/pligg.tpl');
}

// submit step 1
function do_submit1() {
	global $main_smarty, $db, $dblang, $current_user, $the_template;

	$url = htmlspecialchars(strip_tags(trim($_POST['url'])));
	$url = html_entity_decode($url);
	
	$linkres=new Link;
	$linkres->randkey = strip_tags($_POST['randkey']);

	if(Submit_Show_URL_Input == false) {
		$url = "http://";	
		$linkres->randkey = rand(10000,10000000);
	}
	$Submit_Show_URL_Input = Submit_Show_URL_Input;
	if($url == "http://" || $url == ""){
		$Submit_Show_URL_Input = false;
	}
	
	$main_smarty->assign('randkey', $linkres->randkey);	
	$main_smarty->assign('submit_url', $url);
	$main_smarty->assign('Submit_Show_URL_Input', $Submit_Show_URL_Input);
	$main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL);

	$edit = false;
	$linkres->get($url);
	
	$trackback=$linkres->trackback;

	if($url == "http://" || $url == ""){
		if(Submit_Require_A_URL == false){
			$linkres->valid = true;}
		else{
			$linkres->valid = false;
		}
		$linkres->url_title = "";
	}
	
	if(!$linkres->valid) {
		$main_smarty->assign('submit_error', 'invalidurl');
		$main_smarty->assign('tpl_center', $the_template . '/submit_errors');
		
		$main_smarty->display($the_template . '/pligg.tpl');
		return;
	}
	
	if(Submit_Require_A_URL == true || ($url != "http://" && $url != "")){
		if($linkres->duplicates($url) > 0) {
			$main_smarty->assign('submit_search', getmyurl("search", htmlentities($url)));
			$main_smarty->assign('submit_error', 'dupeurl');
			$main_smarty->assign('tpl_center', $the_template . '/submit_errors');
			
			define('pagename', 'submit'); 
     	$main_smarty->assign('pagename', pagename);
			
			$main_smarty->display($the_template . '/pligg.tpl');
			return;
		}
	}

cont next message
Reply With Quote
  #10 (permalink)  
Old 05-09-2007, 12:18 PM
Casual Pligger
 
Join Date: Feb 2007
Posts: 93
Code:
	check_actions('submit_validating_url', array("url" => $url));
	
	totals_adjust_count('discard', 1);

	$linkres->status='discard';
	$linkres->author=$current_user->user_id;
	$linkres->store();

	$main_smarty->assign('StorySummary_ContentTruncate', StorySummary_ContentTruncate);
	$main_smarty->assign('SubmitSummary_Allow_Edit', SubmitSummary_Allow_Edit);
	$main_smarty->assign('enable_tags', Enable_Tags);
	$main_smarty->assign('submit_url_title', $linkres->url_title);
	$main_smarty->assign('submit_id', $linkres->id);
	$main_smarty->assign('submit_type', $linkres->type());
	if(isset($link_title)){$main_smarty->assign('submit_title', $link_title);}
	if(isset($link_content)){$main_smarty->assign('submit_content', $link_content);}
	$main_smarty->assign('submit_trackback', $trackback);
	$main_smarty->assign('submit_link_field1', $linkres->link_field1);
	$main_smarty->assign('submit_link_field2', $linkres->link_field2);
	$main_smarty->assign('submit_link_field3', $linkres->link_field3);
	$main_smarty->assign('submit_link_field4', $linkres->link_field4);
	$main_smarty->assign('submit_link_field5', $linkres->link_field5);
	$main_smarty->assign('submit_link_field6', $linkres->link_field6);
	$main_smarty->assign('submit_link_field7', $linkres->link_field7);
	$main_smarty->assign('submit_link_field8', $linkres->link_field8);
	$main_smarty->assign('submit_link_field9', $linkres->link_field9);
	$main_smarty->assign('submit_link_field10', $linkres->link_field10);
	$main_smarty->assign('submit_link_field11', $linkres->link_field11);
	$main_smarty->assign('submit_link_field12', $linkres->link_field12);
	$main_smarty->assign('submit_link_field13', $linkres->link_field13);
	$main_smarty->assign('submit_link_field14', $linkres->link_field14);
	$main_smarty->assign('submit_link_field15', $linkres->link_field15);

	$catsql = mysql_query("SELECT category_id, category_name FROM " . table_categories . " WHERE category_lang='$dblang' ORDER BY category_name ASC");
	$categories = array();
	while ($rows = mysql_fetch_array ($catsql, MYSQL_ASSOC)) array_push ($categories, $rows);
	$main_smarty->assign('categories', $categories);

	include_once(mnminclude.'dbtree.php');
	$array = tree_to_array(0, table_categories, FALSE);
	$main_smarty->assign('lastspacer', 0);
	$main_smarty->assign('cat_array', $array);


	$main_smarty->assign('Spell_Checker', Spell_Checker);

	$main_smarty->assign('tpl_extra_fields', $the_template . '/submit_extra_fields');
	$main_smarty->assign('tpl_center', $the_template . '/submit_step_2');
	
	define('pagename', 'submit'); 
  $main_smarty->assign('pagename', pagename);
	
	$main_smarty->display($the_template . '/pligg.tpl');
}

// submit step 2
function do_submit2() {
	global $db, $main_smarty, $dblang, $the_template;

	$main_smarty->assign('auto_vote', auto_vote);
	$main_smarty->assign('Submit_Show_URL_Input', Submit_Show_URL_Input);
	$main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL);





		$linkres=new Link;
		$linkres->id=$link_id = $_POST['id'];
		$linkres->read(FALSE);

		if($linkres->votes($current_user->user_id) == 0 && auto_vote == true) {
			$linkres->insert_vote($current_user->user_id, '10');
			$linkres->store_basic();
			$linkres->read(FALSE); 
		}


		$linkres->category=$_POST['category'];
		$linkres->title = strip_tags(trim($_POST['title']));
		$linkres->title_url = makeUrlFriendly($linkres->title);
		$linkres->tags = tags_normalize_string(strip_tags(trim($_POST['tags'])));
		$linkres->content = strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow);
		$linkres->content = str_replace("\n", "<br />", $linkres->content);
		$linkres->link_field1 = trim($_POST['link_field1']);
		$linkres->link_field2 = trim($_POST['link_field2']);
		$linkres->link_field3 = trim($_POST['link_field3']);
		$linkres->link_field4 = trim($_POST['link_field4']);
		$linkres->link_field5 = trim($_POST['link_field5']);
		$linkres->link_field6 = trim($_POST['link_field6']);
		$linkres->link_field7 = trim($_POST['link_field7']);
		$linkres->link_field8 = trim($_POST['link_field8']);
		$linkres->link_field9 = trim($_POST['link_field9']);
		$linkres->link_field10 = trim($_POST['link_field10']);
		$linkres->link_field11 = trim($_POST['link_field11']);
		$linkres->link_field12 = trim($_POST['link_field12']);
		$linkres->link_field13 = trim($_POST['link_field13']);
		$linkres->link_field14 = trim($_POST['link_field14']);
		$linkres->link_field15 = trim($_POST['link_field15']);
		


		if($_POST['summarytext'] == ""){
			$linkres->link_summary = utf8_substr(strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow), 0, StorySummary_ContentTruncate - 1);
			$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);		
		} else {
			$linkres->link_summary = strip_tags(trim($_POST['summarytext']), Story_Content_Tags_To_Allow);
			$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
			if(strlen($linkres->link_summary) > StorySummary_ContentTruncate){
				loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: ' . $_POST["username"].'|email: '.$_POST["email"], true);
				$linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
				$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
			}
		}


		if (link_errors($linkres)) {
			return;
		}

		$linkres->store();
		tags_insert_string($linkres->id, $dblang, $linkres->tags);
		$linkres->read(FALSE);
		$edit = true;
		$link_title = $linkres->title;
		$link_content = $linkres->content;
		$link_title = stripslashes(strip_tags(trim($_POST['title'])));
		$the_link = $linkres->print_summary('', true);
		$main_smarty->assign('the_link', $the_link);

		$main_smarty->assign('tags', $linkres->tags);
		if (!empty($linkres->tags)) {
			$tags_words = str_replace(",", ", ", $linkres->tags);
			$tags_url = urlencode($linkres->tags);
			$main_smarty->assign('tags_words', $tags_words);
			$main_smarty->assign('tags_url', $tags_url);
		}

		$main_smarty->assign('submit_url', $url);
		$main_smarty->assign('submit_url_title', $linkres->url_title);
		$main_smarty->assign('submit_id', $linkres->id);
		$main_smarty->assign('submit_type', $linkres->type());
		$main_smarty->assign('submit_title', $link_title);
		$main_smarty->assign('submit_content', $link_content);
		$main_smarty->assign('submit_trackback', $trackback);


	
	$main_smarty->assign('tpl_extra_fields', $the_template . '/submit_extra_fields');
	$main_smarty->assign('tpl_center', $the_template . '/submit_step_3');
	
	define('pagename', 'submit'); 
  $main_smarty->assign('pagename', pagename);
	
	$main_smarty->display($the_template . '/pligg.tpl');
	
}

// submit step 3
function do_submit3() {
	global $db;

	$linkres=new Link;

	$linkres->id=$link_id = strip_tags($_POST['id']);
	$linkres->read();

	totals_adjust_count($linkres->status, -1);
	totals_adjust_count('queued', 1);

	$linkres->status='queued';
	$linkres->store_basic();

	$linkres->check_should_publish();
	
	if(!empty($_POST['trackback'])) {
		require_once(mnminclude.'trackback.php');
		$trackres = new Trackback;
		$trackres->url=trim($_POST['trackback']);
		$trackres->link=$linkres->id;
		$trackres->title=$linkres->title;
		$trackres->author=$linkres->author;
		$trackres->content=$linkres->content;
		$res = $trackres->send();
	}

	header("Location: " . getmyurl('upcoming'));
	die;


}

// assign any errors found during submit
function link_errors($linkres)
{
	global $main_smarty, $the_template;
	$error = false;

	if($_POST['randkey'] !== $linkres->randkey) { // random key error
		$main_smarty->assign('submit_error', 'badkey');
		$main_smarty->display($the_template . '/submit_errors.tpl');
		$error = true;
	}
	if($linkres->status != 'discard') { // if link has already been submitted
		$main_smarty->assign('submit_error', 'hashistory');
		$main_smarty->assign('submit_error_history', $linkres->status);
		$main_smarty->display($the_template . '/submit_errors.tpl');
		$error = true;
	}
	if(strlen($linkres->title) < minTitleLength  || strlen($linkres->content) < minStoryLength ) { // if link title or descrition is too short
		$main_smarty->assign('submit_error', 'incomplete');
		$main_smarty->display($the_template . '/submit_errors.tpl');
		$error = true;
	}
	if(preg_match('/.*http:\//', $linkres->title)) { // if URL is found in link title
		$main_smarty->assign('submit_error', 'urlintitle');
		$main_smarty->display($the_template . '/submit_errors.tpl');
		$error = true;
	}
	if(!$linkres->category > 0) { // if no category is selected
		$main_smarty->assign('submit_error', 'nocategory');
		$main_smarty->display($the_template . '/submit_errors.tpl');
		$error = true;
	}
	return $error;
}
?>

also, autovote is still not working, and i get this error message!

Code:
Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND vote_ip='194.255.106.26'' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 4, 10, '194.255.106.26')' at line 1 in /home/.monika/celebrigator/new.celebrigator.com/libs/db.php on line 233

Does anyone else get this message if they try and submit a story(questionmark)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto submit story on submit step 3 for god only gnalkit Questions and Comments 2 10-13-2009 08:47 AM
Submit a new story MySQL error at step 3 spottraining Questions and Comments 6 09-01-2007 03:27 PM
submit story step 3 question VLJ Questions and Comments 0 05-14-2007 08:00 PM
how to get rid of step 1 of 'submit story'? mhk Questions and Comments 5 09-27-2006 02:17 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development