Code Duplication    Length = 19-21 lines in 4 locations

class/PublicWallUpdates.php 2 locations

@@ 294-312 (lines=19) @@
291
     * @param int $ownerID
292
     * @return array|bool
293
     */
294
    public function UpdatesPermalink($updid, $uid, $ownerID)
295
    {
296
        global $xoopsUser, $xoopsDB, $moduleConfig;
297
        $query  = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U  WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "'";
298
        $query  .= " AND M.msg_id = '" . $updid . "'";
299
        $query  .= ' order by M.created DESC LIMIT 1';
300
        $result = $xoopsDB->queryF($query);
301
        $count  = $xoopsDB->getRowsNum($result);
302
        if ($count < 1) {
303
            return false;
304
        } else {
305
            while ($row = $xoopsDB->fetchArray($result)) {
306
                $data[] = $row;
307
            }
308
            if (!empty($data)) {
309
                return $data;
310
            }
311
        }
312
    }
313
314
    /**
315
     * @Get share link
@@ 320-338 (lines=19) @@
317
     * @param int $ownerID
318
     * @return array|bool
319
     */
320
    public function UpdatesSharelink($updid, $ownerID)
321
    {
322
        global $xoopsUser, $xoopsDB, $moduleConfig;
323
        $query  = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "' AND M.priv = 0";
324
        $query  .= " AND M.msg_id = '" . $updid . "'";
325
        $query  .= ' order by created DESC LIMIT 1';
326
        $result = $xoopsDB->queryF($query);
327
        $count  = $xoopsDB->getRowsNum($result);
328
        if ($count < 1) {
329
            return false;
330
        } else {
331
            while ($row = $xoopsDB->fetchArray($result)) {
332
                $data[] = $row;
333
            }
334
            if (!empty($data)) {
335
                return $data;
336
            }
337
        }
338
    }
339
340
    /**
341
     * @Get sharing link

class/WallUpdates.php 2 locations

@@ 356-374 (lines=19) @@
353
     * @param int $ownerID
354
     * @return array|bool
355
     */
356
    public function UpdatesPermalink($updid, $uid, $ownerID)
357
    {
358
        global $xoopsUser, $xoopsDB, $moduleConfig;
359
        $query  = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U  WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "'";
360
        $query  .= " AND M.msg_id = '" . $updid . "'";
361
        $query  .= ' order by M.created DESC LIMIT 1';
362
        $result = $xoopsDB->queryF($query);
363
        $count  = $xoopsDB->getRowsNum($result);
364
        if ($count < 1) {
365
            return false;
366
        } else {
367
            while ($row = $xoopsDB->fetchArray($result)) {
368
                $data[] = $row;
369
            }
370
            if (!empty($data)) {
371
                return $data;
372
            }
373
        }
374
    }
375
376
    /**
377
     * @Get share link
@@ 382-402 (lines=21) @@
379
     * @param int $ownerID
380
     * @return array|bool
381
     */
382
    public function UpdatesSharelink($updid, $ownerID)
383
    {
384
        global $xoopsUser, $xoopsDB, $moduleConfig, $xoopsLogger;
385
        $xoopsLogger->activated = false;
386
        //error_reporting(E_ALL);
387
        $query  = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "' AND M.priv = 0";
388
        $query  .= " AND M.msg_id = '" . $updid . "'";
389
        $query  .= ' order by created DESC LIMIT 1';
390
        $result = $xoopsDB->queryF($query);
391
        $count  = $xoopsDB->getRowsNum($result);
392
        if ($count < 1) {
393
            return false;
394
        } else {
395
            while ($row = $xoopsDB->fetchArray($result)) {
396
                $data[] = $row;
397
            }
398
            if (!empty($data)) {
399
                return $data;
400
            }
401
        }
402
    }
403
404
    /**
405
     * @Get sharing link