| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/central/modules/widgets/ |
Upload File : |
<?php
namespace WHMCS\Module\Widget;
use Carbon\Carbon;
use WHMCS\Log\Activity as ActivityLog;
use WHMCS\Module\AbstractWidget;
/**
* Activity Widget.
*
* @copyright Copyright (c) WHMCS Limited 2005-2016
* @license http://www.whmcs.com/license/ WHMCS Eula
*/
class Activity extends AbstractWidget
{
protected $title = 'Activity';
protected $description = 'Recent system activity.';
protected $weight = 100;
protected $cache = true;
protected $requiredPermission = 'View Activity Log';
public function getData()
{
return localAPI('GetActivityLog', array('limitstart' => 0, 'limitnum' => 10));
}
public function generateOutput($data)
{
$log = new ActivityLog();
$output = '';
foreach ($data['activity']['entry'] as $entry) {
$date = Carbon::createFromFormat('Y-m-d H:i:s', $entry['date']);
$description = $entry['description'];
if ($entry['userid']) {
$userLabel = ' - User ID: ' . $entry['userid'];
if (!strpos($description, $userLabel)) {
$description .= $userLabel;
}
}
$output .= '
<div class="feed-element">
<div>
<small class="pull-right text-navy">' . $date->diffForHumans() . '</small>
<strong>' . $entry['username'] . '</strong>
<div>' . $log->autoLink($description) . '</div>
<small class="text-muted">' . $entry['ipaddress'] . '</small>
</div>
</div>';
}
return <<<EOF
<div class="widget-content-padded">
{$output}
</div>
EOF;
}
}