Code Duplication    Length = 8-8 lines in 4 locations

src/Intraface/modules/filemanager/InstanceHandler.php 2 locations

@@ 197-204 (lines=8) @@
194
        $this->value['file_uri_parameters'] = '?/'.$this->file_handler->kernel->intranet->get('public_key').'/'.$this->file_handler->get('access_key').'/'.$this->get('type').'/'.urlencode($this->file_handler->get('file_name'));
195
        $this->value['file_uri'] = FILE_VIEWER.$this->value['file_uri_parameters'];
196
197
        if ($db->f('width') == 0) {
198
            $imagesize = getimagesize($this->get('file_path'));
199
            $this->value['width'] = $imagesize[0]; // imagesx($this->get('file_uri'));
200
            $db2 = new DB_sql;
201
            $db2->query("UPDATE file_handler_instance SET width = ".$this->value['width']." WHERE intranet_id = ".$this->file_handler->kernel->intranet->get('id')." AND id = ".$this->id);
202
        } else {
203
            $this->value['width'] = $db->f('width');
204
        }
205
206
        if ($db->f('height') == 0) {
207
            $imagesize = getimagesize($this->get('file_path'));
@@ 206-213 (lines=8) @@
203
            $this->value['width'] = $db->f('width');
204
        }
205
206
        if ($db->f('height') == 0) {
207
            $imagesize = getimagesize($this->get('file_path'));
208
            $this->value['height'] = $imagesize[1]; //imagesy($this->get('file_uri'));
209
            $db2 = new DB_sql;
210
            $db2->query("UPDATE file_handler_instance SET height = ".$this->value['height']." WHERE intranet_id = ".$this->file_handler->kernel->intranet->get('id')." AND id = ".$this->id);
211
        } else {
212
            $this->value['height'] = $db->f('height');
213
        }
214
215
        return true;
216
    }

src/Intraface/modules/filemanager/FileHandler.php 2 locations

@@ 286-293 (lines=8) @@
283
        }
284
285
        if ($this->value['is_image'] == 1) {
286
            if ($db->f('width') == null) {
287
                $imagesize = getimagesize($this->get('file_path'));
288
                $this->value['width'] = $imagesize[0]; // imagesx($this->get('file_uri'));
289
                $db2 = new DB_sql;
290
                $db2->query("UPDATE file_handler SET width = ".(int)$this->value['width']." WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id);
291
            } else {
292
                $this->value['width'] = $db->f('width');
293
            }
294
295
            if ($db->f('height') == null) {
296
                $imagesize = getimagesize($this->get('file_path'));
@@ 295-302 (lines=8) @@
292
                $this->value['width'] = $db->f('width');
293
            }
294
295
            if ($db->f('height') == null) {
296
                $imagesize = getimagesize($this->get('file_path'));
297
                $this->value['height'] = $imagesize[1]; //imagesy($this->get('file_uri'));
298
                $db2 = new DB_sql;
299
                $db2->query("UPDATE file_handler SET height = ".(int)$this->value['height']." WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id);
300
            } else {
301
                $this->value['height'] = $db->f('height');
302
            }
303
        } else {
304
            $this->value['width'] = '';
305
            $this->value['height'] = '';