function freeradius_ClientArea($params)
{
    $username = $params["username"];
    $serviceid = $params["serviceid"];
    $collected = collect_usage($params);
    return array('templatefile' => 'clientarea', 'vars' => array('logins' => $collected['logins'], 'logintime' => secs_to_h($collected['logintime']), 'logintime_seconds' => $collected['logintime'], 'uploads' => byte_size($collected['uploads']), 'uploads_bytes' => $collected['uploads'], 'downloads' => byte_size($collected['downloads']), 'downloads_bytes' => $collected['downloads'], 'total' => byte_size($collected['total']), 'total_bytes' => $collected['total'], 'limit' => byte_size($collected['usage_limit']), 'limit_bytes' => $collected['usage_limit'], 'status' => $collected['status']));
}
Exemple #2
0
                        $i = 1;
                        if (!isset($pastBans[0]) || isset($pastBans[0]) && !is_array($pastBans[0])) {
                            $pastBans = array($pastBans);
                        }
                        foreach ($pastBans as $r) {
                            $r['reason'] = str_replace(array('"', '"'), array(''', '\''), $r['reason']);
                            $r['expired'] = $r['expired'] != 0 ? $r['expired'] + $mysqlSecs : $r['expired'];
                            $r['pastCreated'] = $r['pastCreated'] + $mysqlSecs;
                            $r['created'] = $r['created'] + $mysqlSecs;
                            echo '
					<tr>
						<td>' . $i . '</td>
						<td>' . $r['reason'] . '</td>
						<td>' . $r['pastActor_name'] . '</td>
						<td>' . date('H:i:s d/m/y', $r['pastCreated']) . '</td>
						<td>' . ($r['expired'] == 0 ? 'Never' : secs_to_h($r['expired'] - $r['pastCreated'])) . '</td>
						<td>' . $r['actor_name'] . '</td>
						<td>' . date('H:i:s d/m/y', $r['created']) . '</td>' . ($serverName ? '
						<td>' . $r['server'] . '</td>' : '') . ($admin ? '
						<td class="admin-options"><a href="#" class="btn btn-danger btn-xs delete" title="Remove" data-server="' . $_GET['server'] . '" data-record-id="' . $r['id'] . '"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td>' : '') . '
					</tr>';
                            ++$i;
                        }
                    }
                    ?>

				</tbody>
			</table>
		</div>
		<?php 
                }
function get_omni_invocation_elapsed_time($dir, $raw = true)
{
    $retVal = array();
    // get data from start file if it exists
    $retValStart = get_omni_invocation_file_raw_contents($dir, OMNI_INVOCATION_FILE::START_FILE, "start time file");
    if ($retValStart['code'] == 0) {
        $start_time = $retValStart['obj'];
    } else {
        return $retValStart;
    }
    // get data from stop file if it exists
    $retValStop = get_omni_invocation_file_raw_contents($dir, OMNI_INVOCATION_FILE::STOP_FILE, "stop time file");
    if ($retValStop['code'] == 0) {
        // process is finished, so find the difference between start and stop
        $stop_time = $retValStop['obj'];
        // return code of 0 tells client-side JS to stop polling - we want
        // this whether the finished process was a success or failure
        $retVal['code'] = 0;
        // check if omni-stderr is empty - if not, then process probably failed
        $retValError = get_omni_invocation_file_raw_contents($dir, OMNI_INVOCATION_FILE::ERROR_LOG_FILE, "error log");
        // Check if result has string 'rror from Aggregate', also meaning error
        $retValResult = get_omni_invocation_file_raw_contents($dir, OMNI_INVOCATION_FILE::CALL_RESULTS_FILE, "omni_results");
        if ($retValError['code'] == 0 || strpos($retValResult['obj'], 'rror from Aggregate')) {
            $retVal['msg'] = "<b style='color:red;'>Failed</b>";
        } else {
            $retVal['msg'] = "<b style='color:green;'>Finished</b>";
        }
    } else {
        // process isn't finished, so find the difference between start and now
        $stop_time = time();
        $retVal['code'] = 1;
        $retVal['msg'] = "<b style='color:#E17000;'>Running</b>";
    }
    $total_time = $stop_time - $start_time;
    if ($raw) {
        $retVal['obj'] = $total_time;
    } else {
        $retVal['obj'] = secs_to_h($total_time);
    }
    return $retVal;
}
					<tr>
						<td colspan="8">' . $language['viewplayer']['previous_mutes']['none'] . '</td>
					</tr>';
                        } else {
                            $i = 1;
                            foreach ($pastMutes as $r) {
                                $r['reason'] = str_replace(array('&quot;', '"'), array('&#039;', '\''), $r['reason']);
                                $r['expired'] = $r['expired'] != 0 ? $r['expired'] + $mysqlSecs : $r['expired'];
                                $r['created'] = $r['created'] + $mysqlSecs;
                                echo '
					<tr>
						<td>' . $i . '</td>
						<td>' . $r['reason'] . '</td>
						<td>' . $r['pastActor_name'] . '</td>
						<td>' . date('d/m/y', $r['created']) . '</td>
						<td>' . ($r['expired'] == 0 ? 'Permanent' : secs_to_h($r['expired'] - $r['pastCreated'])) . '</td>
						<td>' . $r['actor_name'] . '</td>
						<td>' . date('d/m/y', $r['pastCreated']) . '</td>' . ($serverName ? '
						<td>' . $r['server'] . '</td>' : '') . ($admin ? '
						<td class="admin-options"><a href="#" class="btn btn-danger delete btn-xs" title="' . $language['viewplayer']['previous_mutes']['admin-remove'] . '" data-server="' . $_GET['server'] . '" data-record-id="' . $r['id'] . '"><span class="glyphicon glyphicon-trash"></span></a></td>' : '') . '
					</tr>';
                                ++$i;
                            }
                        }
                        ?>

				</tbody>
			</table><?php 
                    }
                    if (isset($settings['player_warnings']) && $settings['player_warnings'] || !isset($settings['player_warnings'])) {
                        ?>