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

@@ 557-570 (lines=14) @@
554
        return substr($dp, 1);
555
    }
556
557
    public function allowEdit()
558
    {
559
        global $login;
560
561
        $login->verify();
562
563
        if (sql_value(
564
                "SELECT COUNT(*)
565
                FROM `caches`
566
                INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
567
                WHERE (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')
568
                AND `caches`.`cache_id`='&2'", 0, $login->userid, $this->getCacheId()
569
            ) == 0
570
        ) {
571
            return false;
572
        } elseif ($this->getUserId() == $login->userid) {
573
            return true;