Code Duplication    Length = 14-27 lines in 2 locations

htdocs/lib2/logic/cachelog.class.php 1 location

@@ 311-337 (lines=27) @@
308
        );
309
    }
310
311
    public function allowView()
312
    {
313
        global $login;
314
315
        $login->verify();
316
        $allow = sql_value(
317
            "SELECT `cache_status`.`allow_user_view`
318
             FROM `caches`
319
             INNER JOIN `cache_status`
320
                 ON `caches`.`status`=`cache_status`.`id`
321
             WHERE `caches`.`cache_id`='&1'",
322
            0,
323
            $this->getCacheId()
324
        );
325
        if ($allow == 1) {
326
            return true;
327
        } elseif ($login->userid == sql_value(
328
            "SELECT `user_id` FROM `caches` WHERE `cache_id`='&1'",
329
            0,
330
            $this->getCacheId()
331
        )) {
332
            return true;
333
        }
334
335
        return false;
336
    }
337
338
    public function allowEdit()
339
    {
340
        global $login;

htdocs/lib2/logic/picture.class.php 1 location

@@ 666-679 (lines=14) @@
663
        return substr($dp, 1);
664
    }
665
666
    public function allowEdit()
667
    {
668
        global $login;
669
670
        $login->verify();
671
672
        if (sql_value(
673
            "SELECT COUNT(*)
674
            FROM `caches`
675
            INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
676
            WHERE (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')
677
            AND `caches`.`cache_id`='&2'",
678
            0,
679
            $login->userid,
680
            $this->getCacheId()
681
        ) == 0) {
682
            return false;