From 048ea8062a9b9481a4f7c87e81b9ff2194d7b728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 2 Jan 2014 16:32:11 +0100 Subject: [PATCH] Modified GET param of poll id to accept standard ID --- COPYRIGHT | 3 +++ htdocs/opensurvey/adminstuds.php | 34 +++++++++--------------- htdocs/opensurvey/adminstuds_preview.php | 17 ++++++------ htdocs/opensurvey/list.php | 2 +- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index db0cb532478..799e49cd60b 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -50,6 +50,9 @@ http://www.fsf.org/licensing/licenses/index_html Copyright --------- +Copyright (C) 2014 +- Marcos García + Copyright (C) 2013 - Christophe Battarel - Laurent Destailleur diff --git a/htdocs/opensurvey/adminstuds.php b/htdocs/opensurvey/adminstuds.php index 099d3090f7e..c6fc44e0025 100644 --- a/htdocs/opensurvey/adminstuds.php +++ b/htdocs/opensurvey/adminstuds.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,18 +36,10 @@ if (!$user->admin) accessforbidden(); // Initialisation des variables $action=GETPOST('action'); $numsondage = $numsondageadmin = ''; -if (GETPOST('sondage')) -{ - if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL - { - $numsondageadmin=GETPOST("sondage",'alpha'); - $numsondage=substr($numsondageadmin, 0, 16); - } - else - { - $numsondageadmin=''; - $numsondage=GETPOST("sondage",'alpha'); - } + +if (GETPOST('id')) { + $numsondageadmin = GETPOST('id', 'alpha'); + $numsondage = substr($numsondageadmin, 0, 16); } $object=new Opensurveysondage($db); @@ -128,7 +121,7 @@ if (GETPOST('ajoutcomment')) $comment_user = GETPOST('commentuser'); $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; - $sql.= " VALUES ('".$db->escape($numsondage)."','".$db->escape($comment)."','".$db->escape($comment_user)."')"; + $sql.= " VALUES ('".$db->escape($object->id_sondage)."','".$db->escape($comment)."','".$db->escape($comment_user)."')"; $resql = $db->query($sql); dol_syslog("sql=".$sql); if (! $resql) @@ -153,7 +146,7 @@ if ($idcomment) $form=new Form($db); -$result=$object->fetch(0,$numsondage); +$result=$object->fetch(0, $numsondageadmin); if ($result <= 0) { dol_print_error($db,$object->error); @@ -177,7 +170,7 @@ $toutsujet=str_replace("@","
",$toutsujet); $toutsujet=str_replace("°","'",$toutsujet); -print '
'."\n"; +print ''."\n"; print ''; $head = array(); @@ -271,7 +264,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current -$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage; +$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$object->id_sondage; $urllink=''.$url.''; print $urllink; @@ -289,15 +282,15 @@ dol_fiche_end(); */ print '
'; -if ($action != 'edit') print ''.$langs->trans("Modify") . ''; +if ($action != 'edit') print ''.$langs->trans("Modify") . ''; -if ($action != 'edit') print ''.$langs->trans('Delete').''; +if ($action != 'edit') print ''.$langs->trans('Delete').''; print '
'; if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?&sondage='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?&id='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1); } @@ -312,7 +305,6 @@ print_fiche_titre($langs->trans("CommentsOfVoters"),'',''); // Comment list $sql = 'SELECT id_comment, usercomment, comment'; $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; -$sql.= " WHERE id_sondage='".$db->escape($numsondage)."'"; $sql.= " ORDER BY id_comment"; $resql = $db->query($sql); $num_rows=$db->num_rows($resql); @@ -322,7 +314,7 @@ if ($num_rows > 0) while ( $i < $num_rows) { $obj=$db->fetch_object($resql); - print ' '.img_picto('', 'delete.png').' '; + print ' '.img_picto('', 'delete.png').' '; print $obj->usercomment.' : '.dol_nl2br($obj->comment)."
"; $i++; } diff --git a/htdocs/opensurvey/adminstuds_preview.php b/htdocs/opensurvey/adminstuds_preview.php index 4445ed8c538..f0b29720bbb 100644 --- a/htdocs/opensurvey/adminstuds_preview.php +++ b/htdocs/opensurvey/adminstuds_preview.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ if (!$user->admin) accessforbidden(); // Init vars $action=GETPOST('action'); -$numsondageadmin=GETPOST("sondage"); +$numsondageadmin=GETPOST("id"); $numsondage=substr($numsondageadmin, 0, 16); $object=new Opensurveysondage($db); @@ -471,7 +472,7 @@ if (GETPOST('ajoutsujet')) { //on recupere les données et les sujets du sondage print ''."\n"; - print ''; + print ''; print ''; print '
'."\n"; @@ -586,7 +587,7 @@ print '
'."\n"; $nbcolonnes=substr_count($object->sujet,',')+1; print ''."\n"; -print ''; +print ''; print '
'."\n"; print '
'."\n"; @@ -643,7 +644,7 @@ if ($object->format=="D"||$object->format=="D+") } } - print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; + print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -669,7 +670,7 @@ if ($object->format=="D"||$object->format=="D+") } } - print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; + print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -693,7 +694,7 @@ if ($object->format=="D"||$object->format=="D+") } } - print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; + print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; print ''."\n"; //affichage des horaires @@ -711,7 +712,7 @@ if ($object->format=="D"||$object->format=="D+") } } - print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; + print 'id_sondage_admin.'">'.$langs->trans("Add").''."\n"; print ''."\n"; } } @@ -728,7 +729,7 @@ else print ''.$tmp[0].''."\n"; } - print ''.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).''."\n"; + print ''.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).''."\n"; print ''."\n"; } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 908a01db8fd..0248e2402c9 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -113,7 +113,7 @@ while ($i < min($num,$limit)) $var=!$var; print ''; print ''; - print ''.img_picto('','object_opensurvey').' '.$obj->id_sondage.''; + print ''.img_picto('','object_opensurvey').' '.$obj->id_sondage.''; print ''; $type=($obj->format=='A' || $obj->format=='A+')?'classic':'date'; print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);