CVE-2021-41262 (published 2021-12-16T19:15Z)

Galette is a membership management web application built for non profit organizations and released under GPLv3. Versions prior to 0.9.6 are subject to SQL injection attacks by users with "member" privilege. Users are advised to upgrade to version 0.9.6 as soon as possible. There are no known workarounds.

Severity: MEDIUM
CVSS v2 base score: 6.5 (AV:N/AC:L/Au:S/C:P/I:P/A:P)
CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/galette/galette
commit_details: repo_url: https://github.com/galette/galette
author: Johan Cwiklinski
author_date: 2021-11-09 18:55:23+01:00
msg: Use prepared statement rather than direct SQL
repository: repo_url: https://github.com/galette/galette
repo_name: galette/galette
description: Galette membership management web application towards non profit organizations main source code (mirror)
repo_language: PHP
owner: galette
file_changes: filename: Db.php
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2011-2014 The Galette Team
+ * Copyright © 2011-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2011-07-27
@@ -58,7 +58,7 @@ use Laminas\Db\Sql\SqlInterface;
  * @name      Db
  * @package   Galette
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://framework.zend.com/apidoc/2.2/namespaces/Zend.Db.html
  * @since     Available since 0.7dev - 2011-07-27
@@ -453,7 +453,7 @@ class Db
                 //can Galette SELECT records ?
                 try {
                     $select = $this->sql->select('galette_test');
-                    $select->where('test_id = 1');
+                    $select->where(['test_id' => 1]);
                     $res = $this->execute($select);
                     $pass = $res->count() === 1;
 
@@ -673,7 +673,7 @@ class Db
 
                 //build where
                 foreach ($pkeys as $k) {
-                    $where[] = $k . ' = "' . $row->$k . '"';
+                    $where[$k] = $row->$k;
                 }
 
                 //build data

programming_language: PHP
filename: Logo.php
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2009-2014 The Galette Team
+ * Copyright © 2009-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2009-09-13
@@ -46,7 +46,7 @@ use Analog\Analog;
  * @name      Logo
  * @package   Galette
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2009-09-13
@@ -100,7 +100,7 @@ class Logo extends Picture
                 'format'
             )
         );
-        $select->where(self::PK . ' = ' . $this->db_id);
+        $select->where([self::PK => $this->db_id]);
         return $select;
     }
 

programming_language: PHP
filename: MailingHistory.php
change_type: ModificationType.MODIFY
diff: @@ -356,7 +356,7 @@ class MailingHistory extends History
     {
         try {
             $select = $zdb->select(self::TABLE);
-            $select->where('mailing_id = ' . $id);
+            $select->where(['mailing_id' => $id]);
 
             $results = $zdb->execute($select);
             $result = $results->current();
@@ -450,7 +450,7 @@ class MailingHistory extends History
 
             $update = $this->zdb->update(self::TABLE);
             $update->set($values);
-            $update->where(self::PK . ' = ' . $this->mailing->history_id);
+            $update->where([self::PK => $this->mailing->history_id]);
             $this->zdb->execute($update);
             return true;
         } catch (Throwable $e) {

programming_language: PHP
filename: Password.php
change_type: ModificationType.MODIFY
diff: @@ -8,7 +8,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2003-2020 The Galette Team
+ * Copyright © 2003-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -31,7 +31,7 @@
  * @author    Frédéric Jacquot <unknown@unknow.com>
  * @author    Georges Khaznadar (password encryption, images) <unknown@unknow.com>
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2003-2014 The Galette Team
+ * @copyright 2003-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2009-02-28
@@ -52,7 +52,7 @@ use Galette\Entity\Adherent;
  * @author    Frédéric Jacquot <unknown@unknow.com>
  * @author    Georges Khaznadar (password encryption, images) <unknown@unknow.com>
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2020 The Galette Team
+ * @copyright 2009-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2011-06-16
@@ -95,7 +95,7 @@ class Password extends AbstractPassword
     {
         try {
             $delete = $this->zdb->delete(self::TABLE);
-            $delete->where(self::PK . ' = ' . $id_adh);
+            $delete->where([self::PK => $id_adh]);
 
             $del = $this->zdb->execute($delete);
             if ($del) {

programming_language: PHP
filename: Picture.php
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2006-2014 The Galette Team
+ * Copyright © 2006-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -29,7 +29,7 @@
  *
  * @author    Frédéric Jacquot <unknown@unknow.com>
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2006-2014 The Galette Team
+ * @copyright 2006-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  */
@@ -51,7 +51,7 @@ use Galette\IO\FileTrait;
  * @package   Galette
  * @author    Frédéric Jacquot <unknown@unknow.com>
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2006-2014 The Galette Team
+ * @copyright 2006-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  */
@@ -339,9 +339,7 @@ class Picture implements FileInterface
             }
 
             $delete = $zdb->delete($this->tbl_prefix . $class::TABLE);
-            $delete->where(
-                $class::PK . ' = ' . $this->db_id
-            );
+            $delete->where([$class::PK => $this->db_id]);
             $del = $zdb->execute($delete);
 
             if (!$del->count() > 0) {

programming_language: PHP
filename: DynamicField.php
change_type: ModificationType.MODIFY
diff: @@ -143,7 +143,7 @@ abstract class DynamicField
     {
         try {
             $select = $zdb->select(self::TABLE);
-            $select->where('field_id = ' . $id);
+            $select->where(['field_id' => $id]);
 
             $results = $zdb->execute($select);
             $result = $results->current();
@@ -216,7 +216,7 @@ abstract class DynamicField
     {
         try {
             $select = $this->zdb->select(self::TABLE);
-            $select->where(self::PK . ' = ' . $id);
+            $select->where([self::PK => $id]);
 
             $results = $this->zdb->execute($select);
             $result = $results->current();
@@ -716,9 +716,7 @@ abstract class DynamicField
 
             if (!$isnew) {
                 $update = $this->zdb->update(self::TABLE);
-                $update->set($values)->where(
-                    self::PK . ' = ' . $this->id
-                );
+                $update->set($values)->where([self::PK => $this->id]);
                 $this->zdb->execute($update);
             } else {
                 $values['field_type'] = $this->getType();

programming_language: PHP
filename: Adherent.php
change_type: ModificationType.MODIFY
diff: @@ -473,9 +473,7 @@ class Adherent
             $select = $this->zdb->select(self::TABLE);
             $select->columns(
                 array($id)
-            )->where(
-                'parent_id = ' . $this->_id
-            );
+            )->where(['parent_id' => $this->_id]);
 
             $results = $this->zdb->execute($select);
 
@@ -847,7 +845,7 @@ class Adherent
     {
         try {
             $select = $zdb->select(self::TABLE);
-            $select->where(self::PK . ' = ' . $id);
+            $select->where([self::PK => $id]);
 
             $results = $zdb->execute($select);
             $row = $results->current();
@@ -925,7 +923,7 @@ class Adherent
             $update = $zdb->update(self::TABLE);
             $update->set(
                 array('mdp_adh' => $cpass)
-            )->where(self::PK . ' = ' . $id_adh);
+            )->where([self::PK => $id_adh]);
             $zdb->execute($update);
             Analog::log(
                 'Password for `' . $id_adh . '` has been updated.',
@@ -1307,8 +1305,9 @@ class Adherent
                             array(self::PK)
                         )->where(array('email_adh' => $value));
                         if (!empty($this->_id)) {
-                            $select->where(
-                                self::PK . ' != ' . $this->_id
+                            $select->where->notEqualTo(
+                                self::PK,
+                                $this->_id
                             );
                         }
 
@@ -1345,8 +1344,9 @@ class Adherent
                                 array(self::PK)
                             )->where(array('login_adh' => $value));
                             if (!empty($this->_id)) {
-                                $select->where(
-                                    self::PK . ' != ' . $this->_id
+                                $select->where->notEqualTo(
+                                    self::PK,
+                                    $this->_id
                                 );
                             }
 
@@ -1404,7 +1404,7 @@ class Adherent
                     $this->$prop = (int)$value;
                     //check if status exists
                     $select = $this->zdb->select(Status::TABLE);
-                    $select->where(Status::PK . '= ' . $value);
+                    $select->where([Status::PK => $value]);
 
                     $results = $this->zdb->execute($select);
                     $result = $results->current();
@@ -1577,9 +1577,7 @@ class Adherent
 
                 $update = $this->zdb->update(self::TABLE);
                 $update->set($values);
-                $update->where(
-                    self::PK . '=' . $this->_id
-                );
+                $update->where([self::PK => $this->_id]);
 
                 $edit = $this->zdb->execute($update);
 
@@ -1629,7 +1627,7 @@ class Adherent
             $update = $this->zdb->update(self::TABLE);
             $update->set(
                 array('date_modif_adh' => $modif_date)
-            )->where(self::PK . '=' . $this->_id);
+            )->where([self::PK => $this->_id]);
 
             $edit = $this->zdb->execute($update);
             $this->_modification_date = $modif_date;

programming_language: PHP
filename: Contribution.php
change_type: ModificationType.MODIFY
diff: @@ -579,7 +579,7 @@ class Contribution
                 array('ct' => PREFIX_DB . ContributionsTypes::TABLE),
                 'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
                 array()
-            )->where(Adherent::PK . ' = ' . $this->_member)
+            )->where([Adherent::PK => $this->_member])
                 ->where(array('cotis_extension' => new Expression('true')))
                 ->where->nest->nest
                 ->greaterThanOrEqualTo('date_debut_cotis', $this->_begin_date)
@@ -590,7 +590,7 @@ class Contribution
                 ->lessThanOrEqualTo('date_fin_cotis', $this->_end_date);
 
             if ($this->id != '') {
-                $select->where(self::PK . ' != ' . $this->id);
+                $select->where->notEqualTo(self::PK, $this->id);
             }
 
             $results = $this->zdb->execute($select);
@@ -681,9 +681,7 @@ class Contribution
             } else {
                 //we're editing an existing contribution
                 $update = $this->zdb->update(self::TABLE);
-                $update->set($values)->where(
-                    self::PK . '=' . $this->_id
-                );
+                $update->set($values)->where([self::PK => $this->_id]);
                 $edit = $this->zdb->execute($update);
 
                 //edit == 0 does not mean there were an error, but that there
@@ -750,7 +748,7 @@ class Contribution
             $update->set(
                 array('date_echeance' => $date_fin_update)
             )->where(
-                Adherent::PK . '=' . $this->_member
+                [Adherent::PK => $this->_member]
             );
             $this->zdb->execute($update);
             return true;
@@ -782,7 +780,7 @@ class Contribution
             }
 
             $delete = $this->zdb->delete(self::TABLE);
-            $delete->where(self::PK . ' = ' . $this->_id);
+            $delete->where([self::PK => $this->_id]);
             $del = $this->zdb->execute($delete);
             if ($del->count() > 0) {
                 $this->updateDeadline();
@@ -884,7 +882,7 @@ class Contribution
                 'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
                 array()
             )->where(
-                Adherent::PK . ' = ' . $member_id
+                [Adherent::PK => $member_id]
             )->where(
                 array('cotis_extension' => new Expression('true'))
             );
@@ -927,7 +925,7 @@ class Contribution
                 $update->set(
                     array(Transaction::PK => null)
                 )->where(
-                    self::PK . ' = ' . $contrib_id
+                    [self::PK => $contrib_id]
                 );
                 $zdb->execute($update);
                 return true;
@@ -964,7 +962,7 @@ class Contribution
             $update = $zdb->update(self::TABLE);
             $update->set(
                 array(Transaction::PK => $trans_id)
-            )->where(self::PK . ' = ' . $contrib_id);
+            )->where([self::PK => $contrib_id]);
 
             $zdb->execute($update);
             return true;

programming_language: PHP
filename: Entitled.php
change_type: ModificationType.MODIFY
diff: @@ -126,7 +126,7 @@ abstract class Entitled
     {
         try {
             $select = $this->zdb->select($this->table);
-            $select->where($this->fpk . ' = ' . $id);
+            $select->where([$this->fpk => $id]);
 
             $results = $this->zdb->execute($select);
             if ($results->count() > 0) {
@@ -345,7 +345,7 @@ abstract class Entitled
 
         try {
             $select = $this->zdb->select($this->table);
-            $select->where($this->fpk . '=' . $id);
+            $select->where([$this->fpk => $id]);
 
             $results = $this->zdb->execute($select);
             $result = $results->current();
@@ -507,7 +507,7 @@ abstract class Entitled
 
             $update = $this->zdb->update($this->table);
             $update->set($values);
-            $update->where($this->fpk . ' = ' . $id);
+            $update->where([$this->fpk => $id]);
 
             $ret = $this->zdb->execute($update);
 
@@ -556,7 +556,7 @@ abstract class Entitled
         try {
             $this->zdb->connection->beginTransaction();
             $delete = $this->zdb->delete($this->table);
-            $delete->where($this->fpk . ' = ' . $id);
+            $delete->where([$this->fpk => $id]);
 
             $this->zdb->execute($delete);
             $this->deleteTranslation($ret->{$this->flabel});
@@ -590,7 +590,7 @@ abstract class Entitled
     {
         try {
             $select = $this->zdb->select($this->used);
-            $select->where($this->fpk . ' = ' . $id);
+            $select->where([$this->fpk => $id]);
 
             $results = $this->zdb->execute($select);
             $result = $results->current();

programming_language: PHP
filename: Group.php
change_type: ModificationType.MODIFY
diff: @@ -179,9 +179,9 @@ class Group
                     array('g' => $join),
                     'g.' . Adherent::PK . '=a.' . Adherent::PK,
                     array()
-                )->where(
-                    'g.' . self::PK . ' = ' . $this->id
-                )->order(
+                )->where([
+                    'g.' . self::PK => $this->id
+                ])->order(
                     'nom_adh ASC',
                     'prenom_adh ASC'
                 );
@@ -231,10 +231,10 @@ class Group
                     array('b' => PREFIX_DB . self::GROUPSMANAGERS_TABLE),
                     'a.' . self::PK . '=b.' . self::PK,
                     array()
-                )->where('b.' . Adherent::PK . ' = ' . $this->login->id);
+                )->where(['b.' . Adherent::PK => $this->login->id]);
             }
 
-            $select->where('parent_group = ' . $this->id)
+            $select->where(['parent_group' => $this->id])
                 ->order('group_name ASC');
 
             $results = $zdb->execute($select);
@@ -295,24 +295,18 @@ class Group
 
                 //delete members
                 $delete = $zdb->delete(self::GROUPSUSERS_TABLE);
-                $delete->where(
-                    self::PK . ' = ' . $this->id
-                );
+                $delete->where([self::PK => $this->id]);
                 $zdb->execute($delete);
 
                 //delete managers
                 $delete = $zdb->delete(self::GROUPSMANAGERS_TABLE);
-                $delete->where(
-                    self::PK . ' = ' . $this->id
-                );
+                $delete->where([self::PK => $this->id]);
                 $zdb->execute($delete);
             }
 
             //delete group itself
             $delete = $zdb->delete(self::TABLE);
-            $delete->where(
-                self::PK . ' = ' . $this->id
-            );
+            $delete->where([self::PK => $this->id]);
             $zdb->execute($delete);
 
             //commit all changes
@@ -371,7 +365,7 @@ class Group
             $update->set(
                 array('parent_group' => new Expression('NULL'))
             )->where(
-                self::PK . ' = ' . $this->id
+                [self::PK => $this->id]
             );
 
             $edit = $zdb->execute($update);
@@ -447,7 +441,7 @@ class Group
                 $update = $zdb->update(self::TABLE);
                 $update
                     ->set($values)
-                    ->where(self::PK . '=' . $this->id);
+                    ->where([self::PK => $this->id]);
 
                 $edit = $zdb->execute($update);
 
@@ -728,9 +722,7 @@ class Group
 
             //first, remove current groups members
             $delete = $zdb->delete(self::GROUPSUSERS_TABLE);
-            $delete->where(
-                self::PK . ' = ' . $this->id
-            );
+            $delete->where([self::PK => $this->id]);
             $zdb->execute($delete);
 
             Analog::log(
@@ -818,9 +810,7 @@ class Group
 
             //first, remove current groups managers
             $delete = $zdb->delete(self::GROUPSMANAGERS_TABLE);
-            $delete->where(
-                self::PK . ' = ' . $this->id
-            );
+            $delete->where([self::PK => $this->id]);
             $zdb->execute($delete);
 
             Analog::log(

programming_language: PHP
filename: ImportModel.php
change_type: ModificationType.MODIFY
diff: @@ -175,7 +175,7 @@ class ImportModel
                 //we're editing an existing model
                 $update = $zdb->update(self::TABLE);
                 $update->set($values);
-                $update->where(self::PK . '=' . $this->id);
+                $update->where([self::PK => $this->id]);
                 $zdb->execute($update);
                 return true;
             }

programming_language: PHP
filename: PaymentType.php
change_type: ModificationType.MODIFY
diff: @@ -100,7 +100,7 @@ class PaymentType
     {
         try {
             $select = $this->zdb->select(self::TABLE);
-            $select->limit(1)->where(self::PK . ' = ' . $id);
+            $select->limit(1)->where([self::PK => $id]);
 
             $results = $this->zdb->execute($select);
             $res = $results->current();
@@ -149,9 +149,7 @@ class PaymentType
                 }
 
                 $update = $this->zdb->update(self::TABLE);
-                $update->set($data)->where(
-                    self::PK . '=' . $this->id
-                );
+                $update->set($data)->where([self::PK => $this->id]);
                 $this->zdb->execute($update);
             } else {
                 $insert = $this->zdb->insert(self::TABLE);
@@ -191,9 +189,7 @@ class PaymentType
 
         try {
             $delete = $this->zdb->delete(self::TABLE);
-            $delete->where(
-                self::PK . ' = ' . $id
-            );
+            $delete->where([self::PK => $id]);
             $this->zdb->execute($delete);
             $this->deleteTranslation($this->name);
             Analog::log(

programming_language: PHP
filename: PdfModel.php
change_type: ModificationType.MODIFY
diff: @@ -136,7 +136,7 @@ abstract class PdfModel
         try {
             $select = $this->zdb->select(self::TABLE);
             $select->limit(1)
-                ->where(self::PK . ' = ' . $id);
+                ->where([self::PK => $id]);
 
             $results = $this->zdb->execute($select);
 
@@ -231,7 +231,7 @@ abstract class PdfModel
             if ($this->id !== null) {
                 $update = $this->zdb->update(self::TABLE);
                 $update->set($data)->where(
-                    self::PK . '=' . $this->id
+                    [self::PK => $this->id]
                 );
                 $this->zdb->execute($update);
             } else {

programming_language: PHP
filename: Reminder.php
change_type: ModificationType.MODIFY
diff: @@ -111,7 +111,7 @@ class Reminder
         try {
             $select = $zdb->select(self::TABLE);
             $select->limit(1)
-                ->where(self::PK . ' = ' . $id);
+                ->where([self::PK => $id]);
 
             $results = $zdb->execute($select);
             $this->loadFromRs($results->current());

programming_language: PHP
filename: SavedSearch.php
change_type: ModificationType.MODIFY
diff: @@ -102,11 +102,11 @@ class SavedSearch
     {
         try {
             $select = $this->zdb->select(self::TABLE);
-            $select->limit(1)->where(self::PK . ' = ' . $id);
+            $select->limit(1)->where([self::PK => $id]);
             if ($this->login->isSuperAdmin()) {
                 $select->where(Adherent::PK . ' IS NULL');
             } else {
-                $select->where(Adherent::PK . ' = ' . (int)$this->login->id);
+                $select->where([Adherent::PK => $this->login->id]);
             }
 
             $results = $this->zdb->execute($select);
@@ -223,9 +223,7 @@ class SavedSearch
         $id = (int)$this->id;
         try {
             $delete = $this->zdb->delete(self::TABLE);
-            $delete->where(
-                self::PK . ' = ' . $id
-            );
+            $delete->where([self::PK => $id]);
             $this->zdb->execute($delete);
             Analog::log(
                 'Saved search #' . $id . ' (' . $this->name

programming_language: PHP
filename: Social.php
change_type: ModificationType.MODIFY
diff: @@ -114,7 +114,7 @@ class Social
     {
         try {
             $select = $this->zdb->select(self::TABLE);
-            $select->limit(1)->where(self::PK . ' = ' . $id);
+            $select->limit(1)->where([self::PK => $id]);
 
             $results = $this->zdb->execute($select);
             $res = $results->current();
@@ -199,7 +199,7 @@ class Social
             if ($this->id !== null && $this->id > 0) {
                 $update = $this->zdb->update(self::TABLE);
                 $update->set(['url' => $this->url])->where(
-                    self::PK . '=' . $this->id
+                    [self::PK => $this->id]
                 );
                 $this->zdb->execute($update);
             } else {

programming_language: PHP
filename: Title.php
change_type: ModificationType.MODIFY
diff: @@ -91,7 +91,7 @@ class Title
         global $zdb;
         try {
             $select = $zdb->select(self::TABLE);
-            $select->limit(1)->where(self::PK . ' = ' . $id);
+            $select->limit(1)->where([self::PK => $id]);
 
             $results = $zdb->execute($select);
             $res = $results->current();
@@ -145,9 +145,7 @@ class Title
         try {
             if ($this->id !== null && $this->id > 0) {
                 $update = $zdb->update(self::TABLE);
-                $update->set($data)->where(
-                    self::PK . '=' . $this->id
-                );
+                $update->set($data)->where([self::PK => $this->id]);
                 $zdb->execute($update);
             } else {
                 $insert = $zdb->insert(self::TABLE);
@@ -187,9 +185,7 @@ class Title
 
         try {
             $delete = $zdb->delete(self::TABLE);
-            $delete->where(
-                self::PK . ' = ' . $id
-            );
+            $delete->where([self::PK => $id]);
             $zdb->execute($delete);
             Analog::log(
                 'Title #' . $id . ' (' . $this->short

programming_language: PHP
filename: Transaction.php
change_type: ModificationType.MODIFY
diff: @@ -154,7 +154,7 @@ class Transaction
     {
         try {
             $select = $this->zdb->select(self::TABLE, 't');
-            $select->where(self::PK . ' = ' . $id);
+            $select->where([self::PK => $id]);
             $select->join(
                 array('a' => PREFIX_DB . Adherent::TABLE),
                 't.' . Adherent::PK . '=a.' . Adherent::PK,
@@ -235,9 +235,7 @@ class Transaction
 
             //remove transaction itself
             $delete = $this->zdb->delete(self::TABLE);
-            $delete->where(
-                self::PK . ' = ' . $this->_id
-            );
+            $delete->where([self::PK => $this->_id]);
             $del = $this->zdb->execute($delete);
             if ($del->count() > 0) {
                 $this->dynamicsRemove(true);
@@ -457,9 +455,7 @@ class Transaction
             } else {
                 //we're editing an existing transaction
                 $update = $this->zdb->update(self::TABLE);
-                $update->set($values)->where(
-                    self::PK . '=' . $this->_id
-                );
+                $update->set($values)->where([self::PK => $this->_id]);
                 $edit = $this->zdb->execute($update);
                 //edit == 0 does not mean there were an error, but that there
                 //were nothing to change
@@ -514,7 +510,7 @@ class Transaction
                 array(
                     'sum' => new Expression('SUM(montant_cotis)')
                 )
-            )->where(self::PK . ' = ' . $this->_id);
+            )->where([self::PK => $this->_id]);
 
             $results = $this->zdb->execute($select);
             $result = $results->current();
@@ -547,7 +543,7 @@ class Transaction
                 array(
                     'sum' => new Expression('SUM(montant_cotis)')
                 )
-            )->where(self::PK . ' = ' . $this->_id);
+            )->where([self::PK => $this->_id]);
 
             $results = $this->zdb->execute($select);
             $result = $results->current();

programming_language: PHP
filename: Groups.php
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2011-2014 The Galette Team
+ * Copyright © 2011-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2011-10-25
@@ -52,7 +52,7 @@ use Galette\Core\Db;
  * @name      Groups
  * @package   Galette
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2011-10-25
@@ -136,7 +136,7 @@ class Groups
                     array('c' => PREFIX_DB . Group::GROUPSMANAGERS_TABLE),
                     'a.' . Group::PK . '=c.' . Group::PK,
                     array()
-                )->where('c.' . Adherent::PK . ' = ' . $this->login->id);
+                )->where(['c.' . Adherent::PK => $this->login->id]);
             }
 
             if ($full !== true) {
@@ -275,9 +275,7 @@ class Groups
 
             //first, remove current groups members
             $delete = $zdb->delete($table);
-            $delete->where(
-                Adherent::PK . ' = ' . $adh->id
-            );
+            $delete->where([Adherent::PK => $adh->id]);
             $zdb->execute($delete);
 
             $msg = null;

programming_language: PHP
filename: Members.php
change_type: ModificationType.MODIFY
diff: @@ -641,7 +641,7 @@ class Members
                         array('m' => PREFIX_DB . Group::GROUPSMANAGERS_TABLE),
                         'gr.' . Group::PK . '=m.' . Group::PK,
                         array()
-                    )->where('m.' . Adherent::PK . ' = ' . $login->id);
+                    )->where(['m.' . Adherent::PK => $login->id]);
                     break;
                 case self::SHOW_PUBLIC_LIST:
                     if ($photos) {
@@ -731,8 +731,8 @@ class Members
                             'val'       => 'field_val'
                         ]
                     );
-                    $subselect->where('df.field_form = \'adh\'');
-                    $subselect->where('df.field_id = ' . $df);
+                    $subselect->where(['df.field_form' => 'adh']);
+                    $subselect->where(['df.field_id' => $df]);
                     $select->join(
                         array('df' . $df => $subselect),
                         'a.id_adh = df' . $df . '.item_id',
@@ -1155,7 +1155,7 @@ class Members
                     array(),
                     $select::JOIN_LEFT
                 )->where(
-                    '(g.' . Group::PK . ' = ' . $this->filters->group_filter .
+                    '(g.' . Group::PK . ' = ' . $zdb->platform->quoteValue($this->filters->group_filter) .
                     ' OR gs.parent_group = NULL OR gs.parent_group = ' .
                     $this->filters->group_filter . ')'
                 );

programming_language: PHP