From 42ddf7e27be41eddff756a67cfb4c686a14f7678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 20:45:03 +0100 Subject: [PATCH 1/9] doxygen --- htdocs/core/class/openid.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index 0d382a78589..b2a265c47d5 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -101,7 +101,7 @@ class SimpleOpenID /** * SetRequiredFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetRequiredFields($a) @@ -118,7 +118,7 @@ class SimpleOpenID /** * SetOptionalFields * - * @param string $a Server + * @param string|array $a Server * @return void */ public function SetOptionalFields($a) From c4b13b154e314cbd1583cf651781fa54854bee78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:00:23 +0100 Subject: [PATCH 2/9] doxygen --- htdocs/user/clicktodial.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 339cb794c12..a97d011a2e2 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; // Load translation files required by page $langs->loadLangs(array('users', 'admin')); -$action = GETPOST('action', 'aZ09'); -$id = GETPOST('id', 'int'); +$action = (string) GETPOST('action', 'aZ09'); +$id = (int) GETPOST('id', 'int'); // Security check $socid = 0; @@ -54,14 +54,13 @@ if (empty($reshook)) { $edituser = new User($db); $edituser->fetch($id); - $edituser->clicktodial_url = GETPOST("url"); - $edituser->clicktodial_login = GETPOST("login"); - $edituser->clicktodial_password = GETPOST("password"); - $edituser->clicktodial_poste = GETPOST("poste"); + $edituser->clicktodial_url = (string) GETPOST("url", "alpha"); + $edituser->clicktodial_login = (string) GETPOST("login", "alpha"); + $edituser->clicktodial_password = (string) GETPOST("password", "alpha"); + $edituser->clicktodial_poste = (string) GETPOST("poste", "alpha"); $result = $edituser->update_clicktodial(); - if ($result < 0) - { + if ($result < 0) { setEventMessages($edituser->error, $edituser->errors, 'errors'); } } From 0448a76df560faf65a3c7e3b3bca0fa82388ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:13:00 +0100 Subject: [PATCH 3/9] doxygen --- .../class/opensurveysondage.class.php | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index f8f6cb0f885..4b8ac089591 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2020 Frédéric France * * 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 @@ -60,7 +61,14 @@ class Opensurveysondage extends CommonObject */ public $description; + /** + * @var string email admin + */ public $mail_admin; + + /** + * @var admin name + */ public $nom_admin; /** @@ -75,10 +83,21 @@ class Opensurveysondage extends CommonObject public $title; public $date_fin = ''; + + /** + * @var int status + */ public $status = 1; public $format; + + /** + * @var int mailsonde + */ public $mailsonde; + /** + * @var string subject + */ public $sujet; /** @@ -133,8 +152,7 @@ class Opensurveysondage extends CommonObject $this->cleanParameters(); // Check parameters - if (!$this->date_fin > 0) - { + if (!$this->date_fin > 0) { $this->error = 'BadValueForEndDate'; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; @@ -156,10 +174,10 @@ class Opensurveysondage extends CommonObject $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($this->id_sondage)."',"; $sql .= " ".(empty($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; - $sql .= " ".$user->id.","; + $sql .= " ".(int) $user->id.","; $sql .= " '".$this->db->escape($this->title)."',"; $sql .= " '".$this->db->idate($this->date_fin)."',"; - $sql .= " ".$this->status.","; + $sql .= " ".(int) $this->status.","; $sql .= " '".$this->db->escape($this->format)."',"; $sql .= " ".$this->db->escape($this->mailsonde).","; $sql .= " ".$this->db->escape($this->allow_comments).","; @@ -173,17 +191,13 @@ class Opensurveysondage extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) - { - if (!$notrigger) - { - global $langs, $conf; + if (!$error && !$notrigger) + global $langs, $conf; - // Call trigger - $result = $this->call_trigger('OPENSURVEY_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } + // Call trigger + $result = $this->call_trigger('OPENSURVEY_CREATE', $user); + if ($result < 0) $error++; + // End call triggers } // Commit or rollback @@ -310,10 +324,12 @@ class Opensurveysondage extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); + } - if (!$error && !$notrigger) - { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('OPENSURVEY_MODIFY', $user); if ($result < 0) $error++; @@ -356,15 +372,11 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('OPENSURVEY_DELETE', $user); - if ($result < 0) $error++; - // End call triggers - } + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('OPENSURVEY_DELETE', $user); + if ($result < 0) $error++; + // End call triggers } if (!$error) @@ -441,7 +453,9 @@ class Opensurveysondage extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } $linkstart = ''; @@ -591,7 +605,7 @@ class Opensurveysondage extends CommonObject $this->mail_admin = trim($this->mail_admin); $this->nom_admin = trim($this->nom_admin); $this->title = trim($this->title); - $this->status = trim($this->status); + $this->status = (int) $this->status; $this->format = trim($this->format); $this->mailsonde = ($this->mailsonde ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0); From fd14ce4ea47df324c0f4ab2314b91085c03761ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:16:58 +0100 Subject: [PATCH 4/9] Update opensurveysondage.class.php --- htdocs/opensurvey/class/opensurveysondage.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 4b8ac089591..27179a20ac3 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -50,7 +50,6 @@ class Opensurveysondage extends CommonObject */ public $picto = 'poll'; - /** * @var string ID survey */ @@ -88,6 +87,10 @@ class Opensurveysondage extends CommonObject * @var int status */ public $status = 1; + + /** + * @var string format of survey + */ public $format; /** @@ -201,10 +204,8 @@ class Opensurveysondage extends CommonObject } // Commit or rollback - if ($error) - { - foreach ($this->errors as $errmsg) - { + if ($error) { + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } From 894f1e8215857bcb5dedab0118dad6707538b278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:20:17 +0100 Subject: [PATCH 5/9] Update card.php --- htdocs/opensurvey/card.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 96bcd2af739..92d0f7a3eb5 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -41,14 +41,13 @@ $cancel = GETPOST('cancel', 'alpha'); $numsondage = ''; if (GETPOST('id')) { - $numsondage = GETPOST('id', 'alpha'); + $numsondage = (string) GETPOST('id', 'alpha'); } $object = new Opensurveysondage($db); $result = $object->fetch(0, $numsondage); -if ($result <= 0) -{ +if ($result <= 0) { dol_print_error($db, $object->error); exit; } @@ -112,17 +111,16 @@ if (empty($reshook)) if (!$error) { - $object->title = GETPOST('nouveautitre', 'nohtml'); - $object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); - $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); + $object->title = (string) GETPOST('nouveautitre', 'nohtml'); + $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml'); + $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; $res = $object->update($user); - if ($res < 0) - { + if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } From 10bdb1f787f39a1d061155e9dfb3284c29fa3304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:21:48 +0100 Subject: [PATCH 6/9] Update opensurveysondage.class.php --- htdocs/opensurvey/class/opensurveysondage.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 27179a20ac3..595270b78ad 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -194,7 +194,7 @@ class Opensurveysondage extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && !$notrigger) + if (!$error && !$notrigger) { global $langs, $conf; // Call trigger From dd2ab6f36006028f498f3a5033fd2930cbf24e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:56:17 +0100 Subject: [PATCH 7/9] Update card.php --- htdocs/adherents/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bd3ad481cd8..fe6f27ef8b6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2020 Philippe Grand * Copyright (C) 2015-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -1564,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); } else { if ($object->user_id) { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); + $linkeduser = new User($db); + $linkeduser->fetch($object->user_id); + print $linkeduser->getNomUrl(-1); } else { print $langs->trans("NoDolibarrAccess"); } From 5c159c6344cdcc2e3c97dbdb5ad197dc9fd966c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 21:57:46 +0100 Subject: [PATCH 8/9] Update card.php --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 6a928e0bfee..cd6eb0991d9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 David Beniamine * * This program is free software; you can redistribute it and/or modify @@ -1781,7 +1781,7 @@ if ($action == 'create' || $action == 'adduserldap') $adh = new Adherent($db); $adh->fetch($object->fk_member); $adh->ref = $adh->getFullname($langs); // Force to show login instead of id - print $adh->getNomUrl(1); + print $adh->getNomUrl(-1); } else { print $langs->trans("UserNotLinkedToMember"); } From 34beb995f23b1103c34f789e67b35e592ec408c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Nov 2020 00:51:01 +0100 Subject: [PATCH 9/9] Update card.php --- htdocs/opensurvey/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 92d0f7a3eb5..393914f95ba 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -111,13 +111,13 @@ if (empty($reshook)) if (!$error) { - $object->title = (string) GETPOST('nouveautitre', 'nohtml'); + $object->title = (string) GETPOST('nouveautitre', 'alphanohtml'); $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml'); $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; - $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; - $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; - $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; + $object->allow_comments = GETPOST('cancomment', 'aZ09') == 'on' ? 1 : 0; + $object->allow_spy = GETPOST('canseeothersvote', 'aZ09') == 'on' ? 1 : 0; + $object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? true : false; $res = $object->update($user); if ($res < 0) {