Code Duplication    Length = 15-16 lines in 2 locations

admin/index.php 1 location

@@ 48-63 (lines=16) @@
45
$adminObject->addInfoBox(_AM_USERLOG_STATS_ABSTRACT);
46
$periods = array_flip($statsObj->period);
47
$types   = $statsObj->type;
48
foreach ($stats as $type => $arr) {
49
    if (strlen($type) > 10) {
50
        continue;
51
    }
52
    foreach ($arr as $period => $arr2) {
53
        // use sprintf in moduleadmin: sprintf($text, "<span style='color : " . $color . "; font-weight : bold;'>" . $value . "</span>")
54
        $adminObject->addInfoBoxLine(
55
            sprintf(
56
            sprintf(_AM_USERLOG_STATS_TYPE_PERIOD, '%1$s', $types[$type], constant('_AM_USERLOG_' . strtoupper($periods[$period]))) . ' ' . _AM_USERLOG_STATS_TIME_UPDATE . ' ' . $arr2['time_update'],
57
            $arr2['value']
58
            ),
59
            '',
60
            $arr2['value'] ? 'GREEN' : 'RED'
61
        );
62
    }
63
}
64
// if there is no file in working check the parent folder chmod
65
if ((isset($stats['fileall'][0]) && 0 == $stats['fileall'][0]['value']) || (0 == $stats['file' . $userlog->getWorkingFile()][0]['value'])) {
66
    $adminObject->addConfigBoxLine([$userlog->getConfig('logfilepath'), 755], 'chmod');

admin/stats.php 1 location

@@ 55-69 (lines=15) @@
52
$adminObject->addInfoBox(_AM_USERLOG_STATS_ABSTRACT);
53
$periods = array_flip($statsObj->period);
54
$types   = $statsObj->type;
55
foreach ($stats as $type => $arr) {
56
    if (strlen($type) > 10) {
57
        continue;
58
    }
59
    foreach ($arr as $period => $arr2) {
60
        // use sprintf in moduleadmin: sprintf($text, "<span style='color : " . $color . "; font-weight : bold;'>" . $value . "</span>")
61
        $adminObject->addInfoBoxLine(sprintf(
62
            _AM_USERLOG_STATS_TYPE_PERIOD,
63
            '%1$s',
64
            $types[$type],
65
            constant('_AM_USERLOG_' . strtoupper($periods[$period])) . ' ' . _AM_USERLOG_STATS_TIME_UPDATE . ' ' . $arr2['time_update'],
66
            $arr2['value']
67
        ), '', $arr2['value'] ? 'GREEN' : 'RED');
68
    }
69
}
70
$criteria = new CriteriaCompo();
71
$criteria->setGroupBy('module');
72
$moduleViews = $userlog->getHandler('log')->getCounts($criteria);