forked from science-ation/science-ation
Trim the summary before splitting to count words (gets rid of leading and trailing whitespace causing extra 'words')
This commit is contained in:
parent
7583dc7dc6
commit
e47f65729d
@ -288,7 +288,7 @@ function saveProjectData($data,$registrations_id=null){
|
||||
$qstr="SELECT * FROM projects WHERE id='" . $data['project_id'] . "' AND registrations_id='" . $rid . "' AND conferences_id='" . $conference['id'] . "'";
|
||||
$q = mysql_query($qstr);
|
||||
if(mysql_num_rows($q) == 1) {
|
||||
$summarywords = preg_split("/[\s,]+/", $data['summary']);
|
||||
$summarywords = preg_split("/[\s,]+/", trim($data['summary']));
|
||||
$summarywordcount = count($summarywords);
|
||||
if($summarywordcount > $config['participant_project_summary_wordmax'] || $summarywordcount<$config['participant_project_summary_wordmin'])
|
||||
$summarycountok=0;
|
||||
@ -576,6 +576,7 @@ function getProject($userId,$registrations_id=null){
|
||||
'projects.id AS project_id',
|
||||
'registrations.num AS registration_number',
|
||||
'projects.projectdivisions_id',
|
||||
'projects.projectcategories_id',
|
||||
'projects.title',
|
||||
'projects.language',
|
||||
'projects.req_electricity',
|
||||
|
@ -241,7 +241,7 @@ function countwords()
|
||||
|
||||
echo "<tr><td>".i18n("Summary").": </td><td><textarea onchange='countwords()' onkeypress='countwords()' cols=\"60\" rows=\"12\" id=\"summary\" name=\"summary\">".htmlspecialchars($projectinfo->summary)."</textarea>".REQUIREDFIELD."<br />";
|
||||
|
||||
$summarywords=preg_split("/[\s,]+/",$projectinfo->summary);
|
||||
$summarywords=preg_split("/[\s,]+/",trim($projectinfo->summary));
|
||||
$summarywordcount=count($summarywords);
|
||||
if($summarywordcount>$config['participant_project_summary_wordmax'])
|
||||
echo "<div id=\"wordcountmessage\" class=\"incomplete\">";
|
||||
|
Loading…
Reference in New Issue
Block a user