Skip to content

Commit

Permalink
Removed unused constants & functions and added new comment insert err…
Browse files Browse the repository at this point in the history
…or message
  • Loading branch information
marcosgdf committed Jan 5, 2014
1 parent b68f5b6 commit ef44db8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 35 deletions.
1 change: 1 addition & 0 deletions htdocs/langs/en_US/opensurvey.lang
Expand Up @@ -65,4 +65,5 @@ BackToCurrentMonth=Back to current month
ErrorOpenSurveyFillFirstSection=You haven't filled the first section of the poll creation
ErrorOpenSurveyOneChoice=Enter at least one choice
ErrorOpenSurveyDateFormat=Date must be have the format DD/MM/YYYY
ErrorInsertingComment=There was an error while inserting your comment
MoreChoices=Enter more choices for the voters
2 changes: 1 addition & 1 deletion htdocs/opensurvey/card.php
Expand Up @@ -130,7 +130,7 @@

if (! $resql)
{
$err |= COMMENT_INSERT_FAILED;
setEventMessage($langs->trans('ErrorInsertingComment'), 'errors');
}
}
}
Expand Down
32 changes: 0 additions & 32 deletions htdocs/opensurvey/fonctions.php
Expand Up @@ -144,24 +144,6 @@ function get_server_name()
return $url;
}


/**
* is_error
*
* @param unknown_type $cerr error number
* @return boolean Error key found or not
*/
function is_error($cerr)
{
global $err;
if ( $err == 0 ) {
return false;
}

return (($err & $cerr) != 0 );
}


/**
* Fonction vérifiant l'existance et la valeur non vide d'une clé d'un tableau
*
Expand Down Expand Up @@ -264,18 +246,4 @@ function ajouter_sondage()
exit();
}



define('COMMENT_EMPTY', 0x0000000001);
define('COMMENT_USER_EMPTY', 0x0000000010);
define('COMMENT_INSERT_FAILED', 0x0000000100);
define('NAME_EMPTY', 0x0000001000);
define('NAME_TAKEN', 0x0000010000);
define('NO_POLL', 0x0000100000);
define('NO_POLL_ID', 0x0001000000);
define('INVALID_EMAIL', 0x0010000000);
define('TITLE_EMPTY', 0x0100000000);
define('INVALID_DATE', 0x1000000000);
$err = 0;

?>
2 changes: 1 addition & 1 deletion htdocs/opensurvey/public/studs.php
Expand Up @@ -546,7 +546,7 @@
if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst')))
{
print '<input type="checkbox" name="choix'.$i.'" value="1"';
if (isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1' && is_error(NAME_EMPTY) )
if (isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1')
{
print ' checked="checked"';
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/opensurvey/results.php
Expand Up @@ -899,7 +899,7 @@
if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst')))
{
print '<input type="checkbox" name="choix'.$i.'" value="1"';
if ( isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1' && is_error(NAME_EMPTY) )
if ( isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1' )
{
print ' checked="checked"';
}
Expand Down

0 comments on commit ef44db8

Please sign in to comment.