Code Duplication    Length = 5-6 lines in 5 locations

src/Intraface/modules/contact/Contact.php 1 location

@@ 333-337 (lines=5) @@
330
            WHERE contact.id=".$this->id."
331
                AND intranet_id =".$this->kernel->intranet->get('id'));
332
333
        if (!$db->nextRecord()) {
334
            $this->id = 0;
335
            $this->value['id'] = 0;
336
            return false;
337
        }
338
339
        $this->value['id'] = $db->f('id');
340

src/Intraface/modules/filemanager/InstanceHandler.php 1 location

@@ 167-171 (lines=5) @@
164
165
        $db = new DB_sql;
166
        $db->query("SELECT * FROM file_handler_instance WHERE intranet_id = ".$this->file_handler->kernel->intranet->get('id')." AND active = 1 AND id = ".$this->id);
167
        if (!$db->nextRecord()) {
168
            $this->id = 0;
169
            $this->value['id'] = 0;
170
            return false;
171
        }
172
        $type = $this->checkType((int)$db->f('type_key'), 'type_key');
173
        if ($type === false) {
174
            $this->id = 0;

src/Intraface/modules/invoice/Reminder.php 1 location

@@ 54-58 (lines=5) @@
51
                DATE_FORMAT(date_executed, '%d-%m-%Y') AS dk_date_executed,
52
                DATE_FORMAT(date_cancelled, '%d-%m-%Y') AS dk_date_cancelled
53
            FROM invoice_reminder WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get("id")."");
54
        if (!$this->db->nextRecord()) {
55
            $this->id = 0;
56
            $this->value['id'] = 0;
57
            return false;
58
        }
59
60
        $this->value["id"] = $this->db->f("id");
61
        $this->value["invoice_id"] = $this->db->f("invoice_id");

src/Intraface/modules/newsletter/NewsletterSubscriber.php 1 location

@@ 139-144 (lines=6) @@
136
    {
137
        $db = new DB_Sql;
138
        $db->query("SELECT * FROM newsletter_subscriber WHERE id = " . $this->id." and active = 1");
139
        if (!$db->nextRecord()) {
140
            $this->id = 0;
141
            $this->value['id'] = 0;
142
            return false;
143
        }
144
145
        $this->value['id'] = $db->f('id');
146
        $this->value['contact_id'] = $db->f('contact_id');
147
        $this->value['code'] = $db->f('code');

src/Intraface/modules/filemanager/FileHandler.php 1 location

@@ 227-232 (lines=6) @@
224
    {
225
        $db = new DB_Sql;
226
        $db->query("SELECT id, date_created, width, height, date_changed, description, file_name, server_file_name, file_size, access_key, accessibility_key, file_type_key, DATE_FORMAT(date_created, '%d-%m-%Y') AS dk_date_created, DATE_FORMAT(date_changed, '%d-%m-%Y') AS dk_date_changed FROM file_handler WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
227
        if (!$db->nextRecord()) {
228
            $this->id = 0;
229
            $this->value['id'] = 0;
230
            return 0;
231
        }
232
233
        $this->value['id'] = $db->f('id');
234
        $this->value['date_created'] = $db->f('date_created');
235
        $this->value['dk_date_created'] = $db->f('dk_date_created');