Code Duplication    Length = 18-20 lines in 4 locations

class/PublicWallUpdates.php 2 locations

@@ 298-315 (lines=18) @@
295
     * @param int $ownerID
296
     * @return array|bool
297
     */
298
    public function updatesPermalink($updid, $uid, $ownerID)
299
    {
300
        global $xoopsUser, $xoopsDB, $moduleConfig;
301
        $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 . "'";
302
        $query  .= " AND M.msg_id = '" . $updid . "'";
303
        $query  .= ' order by M.created DESC LIMIT 1';
304
        $result = $xoopsDB->queryF($query);
305
        $count  = $xoopsDB->getRowsNum($result);
306
        if ($count < 1) {
307
            return false;
308
        }
309
        while (false !== ($row = $xoopsDB->fetchArray($result))) {
310
            $data[] = $row;
311
        }
312
        if (!empty($data)) {
313
            return $data;
314
        }
315
    }
316
317
    /**
318
     * @Get share link
@@ 323-340 (lines=18) @@
320
     * @param int $ownerID
321
     * @return array|bool
322
     */
323
    public function updatesSharelink($updid, $ownerID)
324
    {
325
        global $xoopsUser, $xoopsDB, $moduleConfig;
326
        $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";
327
        $query  .= " AND M.msg_id = '" . $updid . "'";
328
        $query  .= ' order by created DESC LIMIT 1';
329
        $result = $xoopsDB->queryF($query);
330
        $count  = $xoopsDB->getRowsNum($result);
331
        if ($count < 1) {
332
            return false;
333
        }
334
        while (false !== ($row = $xoopsDB->fetchArray($result))) {
335
            $data[] = $row;
336
        }
337
        if (!empty($data)) {
338
            return $data;
339
        }
340
    }
341
342
    /**
343
     * @Get sharing link

class/WallUpdates.php 2 locations

@@ 363-380 (lines=18) @@
360
     * @param int $ownerID
361
     * @return array|bool
362
     */
363
    public function updatesPermalink($updid, $uid, $ownerID)
364
    {
365
        global $xoopsUser, $xoopsDB, $moduleConfig;
366
        $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 . "'";
367
        $query  .= " AND M.msg_id = '" . $updid . "'";
368
        $query  .= ' order by M.created DESC LIMIT 1';
369
        $result = $xoopsDB->queryF($query);
370
        $count  = $xoopsDB->getRowsNum($result);
371
        if ($count < 1) {
372
            return false;
373
        }
374
        while (false !== ($row = $xoopsDB->fetchArray($result))) {
375
            $data[] = $row;
376
        }
377
        if (!empty($data)) {
378
            return $data;
379
        }
380
    }
381
382
    /**
383
     * @Get share link
@@ 388-407 (lines=20) @@
385
     * @param int $ownerID
386
     * @return array|bool
387
     */
388
    public function updatesSharelink($updid, $ownerID)
389
    {
390
        global $xoopsUser, $xoopsDB, $moduleConfig, $xoopsLogger;
391
        $xoopsLogger->activated = false;
392
        //error_reporting(E_ALL);
393
        $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";
394
        $query  .= " AND M.msg_id = '" . $updid . "'";
395
        $query  .= ' order by created DESC LIMIT 1';
396
        $result = $xoopsDB->queryF($query);
397
        $count  = $xoopsDB->getRowsNum($result);
398
        if ($count < 1) {
399
            return false;
400
        }
401
        while (false !== ($row = $xoopsDB->fetchArray($result))) {
402
            $data[] = $row;
403
        }
404
        if (!empty($data)) {
405
            return $data;
406
        }
407
    }
408
409
    /**
410
     * @Get sharing link