Differences From Artifact [e8c8379b02]:

To Artifact [b8b70c10db]:


109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

    public function save()
    {
        if (empty($this->modified))
            return true;

        $values = [];

        $db = DB::getInstance();
        $db->begin();

        if (isset($this->modified['image_fond']))
        {
            if ($current = $db->firstColumn('SELECT valeur FROM config WHERE cle = \'image_fond\';'))
            {
                $f = new Fichiers($current);
                $f->remove();
            }

            if (strlen($this->config['image_fond']) > 0)
            {
                $f = Fichiers::storeFromBase64('Image_fond_admin.png', $this->config['image_fond']);
                $this->config['image_fond'] = $f->id;
                unset($f);
            }
        }



        foreach ($this->modified as $key=>$modified)
        {
            $value = $this->config[$key];

            if (is_array($value))
            {
                $value = implode(',', $value);
            }
            elseif (is_object($value))
            {
                $value = (string) $value;
            }

            $db->query('INSERT OR REPLACE INTO config (cle, valeur) VALUES (?, ?);',
                [$key, $value]);
        }

        if (!empty($this->modified['champ_identifiant']))
        {
            // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique
            $db->exec('UPDATE membres SET '.$this->get('champ_identifiant').' = NULL 







<

<
















>
>














|







109
110
111
112
113
114
115

116

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

    public function save()
    {
        if (empty($this->modified))
            return true;

        $values = [];

        $db = DB::getInstance();


        if (isset($this->modified['image_fond']))
        {
            if ($current = $db->firstColumn('SELECT valeur FROM config WHERE cle = \'image_fond\';'))
            {
                $f = new Fichiers($current);
                $f->remove();
            }

            if (strlen($this->config['image_fond']) > 0)
            {
                $f = Fichiers::storeFromBase64('Image_fond_admin.png', $this->config['image_fond']);
                $this->config['image_fond'] = $f->id;
                unset($f);
            }
        }

        $db->begin();

        foreach ($this->modified as $key=>$modified)
        {
            $value = $this->config[$key];

            if (is_array($value))
            {
                $value = implode(',', $value);
            }
            elseif (is_object($value))
            {
                $value = (string) $value;
            }

            $db->preparedQuery('INSERT OR REPLACE INTO config (cle, valeur) VALUES (?, ?);',
                [$key, $value]);
        }

        if (!empty($this->modified['champ_identifiant']))
        {
            // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique
            $db->exec('UPDATE membres SET '.$this->get('champ_identifiant').' = NULL