Code Duplication    Length = 13-15 lines in 3 locations

src/Intraface/shared/email/Email.php 1 location

@@ 382-396 (lines=15) @@
379
    /**
380
     * @return array with attachments
381
     */
382
    function getAttachments()
383
    {
384
        $db = new DB_Sql;
385
        $db->query("SELECT file_id, filename FROM email_attachment
386
            WHERE intranet_id = " .$this->kernel->intranet->get('id') . " AND email_id = " . $this->id);
387
        $file = array();
388
        $i = 0;
389
        while ($db->nextRecord()) {
390
            $file[$i]['id'] = $db->f('file_id');
391
            $file[$i]['filename'] = $db->f('filename');
392
            $i++;
393
        }
394
        return $file;
395
    }
396
397
    /**
398
     * @deprecated
399
     *

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

@@ 933-945 (lines=13) @@
930
     *
931
     * @return array
932
     */
933
    function needNewsletterOptin()
934
    {
935
        $db = new DB_Sql;
936
        $db->query("SELECT list_id, code FROM newsletter_subscriber WHERE optin = 0 AND contact_id = " . $this->id . " AND intranet_id =" . $this->kernel->intranet->get('id'));
937
        $lists = array();
938
        $i = 0;
939
        while ($db->nextRecord()) {
940
            $lists[$i]['list_id'] = $db->f('list_id');
941
            $lists[$i]['code'] = $db->f('code');
942
            $i++;
943
        }
944
        return $lists;
945
    }
946
947
    /**
948
     * Kontakten kan slettes, hvis man kun er indskrevet i nyhedsbrevet.

src/Intraface/modules/cms/Site.php 1 location

@@ 122-134 (lines=13) @@
119
        return 1;
120
    }
121
122
    function getList()
123
    {
124
        $db = new DB_Sql;
125
        $db->query("SELECT id, name FROM cms_site WHERE intranet_id = " . $this->kernel->intranet->get('id'). " AND active = 1");
126
        $i = 0;
127
        $sites = array();
128
        while ($db->nextRecord()) {
129
            $sites[$i]['id'] = $db->f('id');
130
            $sites[$i]['name'] = $db->f('name');
131
            $i++;
132
        }
133
        return $sites;
134
    }
135
}
136