From c9db0c3a945a5b0cafd5a20725cfe53ffc4cdefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Jan 2014 19:51:44 +0100 Subject: [PATCH] =?UTF-8?q?Removed=20=E2=80=9Cstupid=E2=80=9D=20feature=20?= =?UTF-8?q?to=20allow=20voters=20edit=20other=20users=E2=80=99=20vote?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 1 + .../install/mysql/tables/llx_opensurvey_sondage.sql | 1 - htdocs/opensurvey/adminstuds.php | 10 ---------- htdocs/opensurvey/class/opensurveysondage.class.php | 8 -------- htdocs/opensurvey/fonctions.php | 4 ---- htdocs/opensurvey/public/choix_autre.php | 1 - htdocs/opensurvey/public/choix_date.php | 1 - htdocs/opensurvey/public/create_survey.php | 11 ++--------- htdocs/opensurvey/public/studs.php | 2 +- 9 files changed, 4 insertions(+), 35 deletions(-) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 41209d68cd2..ffd906c0299 100755 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -22,4 +22,5 @@ ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_comments` TINYINT( 1 ) U ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `survey_link_visible` ; ALTER TABLE `llx_opensurvey_sondage` DROP INDEX `idx_id_sondage_admin` ; ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `id_sondage_admin` ; +ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `canedit` ; ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_spy` TINYINT( 1 ) UNSIGNED NOT NULL AFTER `allow_comments` ; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql index 111519ce901..b697b0bc4ff 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql @@ -24,7 +24,6 @@ CREATE TABLE llx_opensurvey_sondage ( date_fin DATETIME, format VARCHAR(2), mailsonde varchar(2) DEFAULT '0', - canedit integer DEFAULT 0, allow_comments TINYINT(1) unsigned NOT NULL DEFAULT 1, allow_spy TINYINT(1) unsigned NOT NULL DEFAULT 1, origin VARCHAR(64), diff --git a/htdocs/opensurvey/adminstuds.php b/htdocs/opensurvey/adminstuds.php index 32465058912..bb31acf0d99 100644 --- a/htdocs/opensurvey/adminstuds.php +++ b/htdocs/opensurvey/adminstuds.php @@ -86,7 +86,6 @@ if ($action == 'update') $object->commentaires = GETPOST('nouveauxcommentaires'); $object->mail_admin = GETPOST('nouvelleadresse'); $object->date_fin = $expiredate; - $object->canedit = GETPOST('canedit')=='on'?1:0; $object->allow_comments = GETPOST('cancomment') == 'on' ? true : false; $object->allow_spy = GETPOST('canseeothersvote') == 'on' ? true : false; $object->mailsonde = GETPOST('mailsonde') == 'on' ? true : false; @@ -232,15 +231,6 @@ if ($action == 'edit') else print yn($object->mailsonde); print ''; -// Can edit other votes -print ''.$langs->trans('CanEditVotes').''; -if ($action == 'edit') -{ - print 'canedit?' checked="true"':'').'">'; -} -else print yn($object->canedit); -print ''; - // Users can comment print ''.$langs->trans('CanComment').''; if ($action == 'edit') diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 7a7f9e8530a..b7f83470cec 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -50,7 +50,6 @@ class Opensurveysondage extends CommonObject var $date_fin=''; var $format; var $mailsonde; - var $canedit; public $origin; public $sujet; @@ -107,7 +106,6 @@ class Opensurveysondage extends CommonObject $sql.= "date_fin,"; $sql.= "format,"; $sql.= "mailsonde,"; - $sql.= "canedit,"; $sql.= "allow_comments,"; $sql.= "allow_spy,"; $sql.= "origin,"; @@ -122,7 +120,6 @@ class Opensurveysondage extends CommonObject $sql.= " '".$this->db->idate($this->date_fin)."',"; $sql.= " '".$this->db->escape($this->format)."',"; $sql.= " ".$this->db->escape($this->mailsonde).","; - $sql.= " ".$this->db->escape($this->canedit).","; $sql.= " ".$this->db->escape($this->allow_comments).","; $sql.= " ".$this->db->escape($this->allow_spy).","; $sql.= " '".$this->db->escape($this->origin)."',"; @@ -189,7 +186,6 @@ class Opensurveysondage extends CommonObject $sql.= " t.date_fin,"; $sql.= " t.format,"; $sql.= " t.mailsonde,"; - $sql.= " t.canedit,"; $sql.= " t.allow_comments,"; $sql.= " t.allow_spy,"; $sql.= " t.sujet,"; @@ -213,7 +209,6 @@ class Opensurveysondage extends CommonObject $this->date_fin = $this->db->jdate($obj->date_fin); $this->format = $obj->format; $this->mailsonde = $obj->mailsonde; - $this->canedit = $obj->canedit; $this->allow_comments = $obj->allow_comments; $this->allow_spy = $obj->allow_spy; $this->sujet = $obj->sujet; @@ -271,7 +266,6 @@ class Opensurveysondage extends CommonObject $sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; $sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").","; $sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").","; - $sql.= " canedit=".$this->db->escape($this->canedit).","; $sql.= " allow_comments=".$this->db->escape($this->allow_comments).","; $sql.= " allow_spy=".$this->db->escape($this->allow_spy); @@ -435,7 +429,6 @@ class Opensurveysondage extends CommonObject $this->date_fin=''; $this->format=''; $this->mailsonde=''; - $this->canedit=0; } /** @@ -497,7 +490,6 @@ class Opensurveysondage extends CommonObject $this->titre = trim($this->titre); $this->format = trim($this->format); $this->mailsonde = ($this->mailsonde ? 1 : 0); - $this->canedit = ($this->canedit ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0); $this->allow_spy = ($this->allow_spy ? 1 : 0); $this->origin = trim($this->origin); diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index d3f1069babb..9e7bcf5f511 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -255,7 +255,6 @@ function ajouter_sondage($origin) if (is_numeric($date_fin) === false) { $date_fin = time()+15552000; } - $canedit=empty($_SESSION['caneditsondage']) ? 0 : 1; $allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1; $allow_spy = empty($_SESSION['allow_spy']) ? 0 : 1; @@ -269,7 +268,6 @@ function ajouter_sondage($origin) $opensurveysondage->date_fin = $date_fin; $opensurveysondage->format = $_SESSION['formatsondage']; $opensurveysondage->mailsonde = $_SESSION['mailsonde']; - $opensurveysondage->canedit = $canedit; $opensurveysondage->allow_comments = $allow_comments; $opensurveysondage->allow_spy = $allow_spy; $opensurveysondage->origin = $origin; @@ -294,12 +292,10 @@ function ajouter_sondage($origin) unset($_SESSION["nom"]); unset($_SESSION["adresse"]); unset($_SESSION["commentaires"]); - unset($_SESSION["canedit"]); unset($_SESSION["mailsonde"]); unset($_SESSION['allow_comments']); unset($_SESSION['allow_spy']); unset($_SESSION['toutchoix']); - unset($_SESSION['caneditsondage']); unset($_SESSION['totalchoixjour']); unset($_SESSION['champdatefin']); diff --git a/htdocs/opensurvey/public/choix_autre.php b/htdocs/opensurvey/public/choix_autre.php index 5d10ad9792f..ccb50a899f0 100644 --- a/htdocs/opensurvey/public/choix_autre.php +++ b/htdocs/opensurvey/public/choix_autre.php @@ -102,7 +102,6 @@ if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"])) { //format du sondage AUTRE $_SESSION["formatsondage"]="A"; - $_SESSION["caneditsondage"]=$_SESSION["canedit"]; // Add into database ajouter_sondage($origin); diff --git a/htdocs/opensurvey/public/choix_date.php b/htdocs/opensurvey/public/choix_date.php index d90fbb680d9..4e51a91450b 100644 --- a/htdocs/opensurvey/public/choix_date.php +++ b/htdocs/opensurvey/public/choix_date.php @@ -207,7 +207,6 @@ $premierjourmois = date("N", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["an //le format du sondage est DATE $_SESSION["formatsondage"] = "D"; -$_SESSION["formatcanedit"] = $_SESSION["canedit"]; //traduction de la valeur du mois if (is_integer($_SESSION["mois"]) && $_SESSION["mois"] > 0 && $_SESSION["mois"] < 13) diff --git a/htdocs/opensurvey/public/create_survey.php b/htdocs/opensurvey/public/create_survey.php index fee80200fb0..f0f99fe7659 100644 --- a/htdocs/opensurvey/public/create_survey.php +++ b/htdocs/opensurvey/public/create_survey.php @@ -36,14 +36,14 @@ $origin=GETPOST('origin','alpha'); // On teste toutes les variables pour supprimer l'ensemble des warnings PHP // On transforme en entites html les données afin éviter les failles XSS -$post_var = array('titre', 'nom', 'adresse', 'commentaires', 'canedit', 'mailsonde', 'creation_sondage_date', 'creation_sondage_date_x', 'creation_sondage_autre', 'creation_sondage_autre_x'); +$post_var = array('titre', 'nom', 'adresse', 'commentaires', 'mailsonde', 'creation_sondage_date', 'creation_sondage_date_x', 'creation_sondage_autre', 'creation_sondage_autre_x'); foreach ($post_var as $var) { $$var = GETPOST($var); } // On initialise egalement la session car sinon bonjour les warning :-) -$session_var = array('titre', 'nom', 'adresse', 'commentaires', 'mailsonde', 'canedit'); +$session_var = array('titre', 'nom', 'adresse', 'commentaires', 'mailsonde'); foreach ($session_var as $var) { if (isset($_SESSION[$var])) $_SESSION[$var] = null; @@ -65,9 +65,6 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre") || GET $_SESSION["adresse"] = $adresse; $_SESSION["commentaires"] = $commentaires; - unset($_SESSION["canedit"]); - $_SESSION["canedit"] = $canedit; - unset($_SESSION["mailsonde"]); if ($mailsonde !== null) { $_SESSION["mailsonde"] = true; @@ -175,10 +172,6 @@ print ''."\n"; print '
'."\n"; // Check or not -$cocheplus=''; -if ($_SESSION["canedit"]) $cocheplus="checked"; - -print ' '. $langs->trans("VotersCanModify") .'
'."\n"; if ($_SESSION["mailsonde"]) $cochemail="checked"; diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index a0cce7067ad..812555e83e5 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -389,7 +389,7 @@ if ($object->allow_spy) { print ''."\n"; // ligne d'un usager pré-authentifié - $mod_ok = ($object->canedit || (! empty($nombase) && in_array($nombase, $listofvoters))); + $mod_ok = (! empty($nombase) && in_array($nombase, $listofvoters)); // Name $nombase=str_replace("°","'",$obj->nom);