Code Duplication    Length = 10-12 lines in 2 locations

htdocs/lib/clicompatbase.inc.php 1 location

@@ 97-108 (lines=12) @@
94
95
// read a file and return it as a string
96
// WARNING: no huge files!
97
function read_file($file = '')
98
{
99
    $content = false;
100
    $fh = fopen($file, 'r');
101
    if ($fh) {
102
        $content = fread($fh, filesize($file));
103
    }
104
105
    fclose($fh);
106
107
    return $content;
108
}
109
110
function escape_javascript($text)
111
{

htdocs/lib2/ss_zip.class.php 1 location

@@ 194-203 (lines=10) @@
191
     *
192
     * @see ss_zip::add_data()
193
     */
194
    public function add_file($filename, $storedasname = ''): void
195
    {
196
        $fh = fopen($filename, 'r');
197
        $data = fread($fh, filesize($filename));
198
        if (!trim($storedasname)) {
199
            $storedasname = $filename;
200
        }
201
202
        $this->add_data($storedasname, $data);
203
    }
204
205
    /** compile the archive.
206
     * This function produces ZIP archive and returns it.