Beispiel #1
0
$db->begin();
$data['numNodes'] = sotf_Node::countAll();
if ($data['numNodes'] == 0) {
    $data['numNodes'] = 1;
}
$data['numStations'] = sotf_Station::countAll();
$data['numProgs'] = sotf_Programme::countAll();
$data['numProgs'] = sotf_Programme::countAll();
$allStats = sotf_Statistics::networkStats();
$allStats['l_and_d'] = $allStats['listens'] + $allStats['downloads'];
$data['access'] = $allStats;
$fileStats = sotf_Programme::getFileStats();
$fileStats['size_mb'] = sprintf('%d', $fileStats['filesize'] / 1024 / 1024);
$fileStats['length_hour'] = sprintf('%d', $fileStats['play_length'] / 60 / 60);
$data['files'] = $fileStats;
$data['numUsers'] = sotf_User::countUsers();
$smarty->assign($data);
$smarty->assign('STATIONS', sotf_Station::listStationNames());
$searchLangs = $config['languages'];
array_unshift($searchLangs, "any_language");
for ($i = 0; $i < count($searchLangs); $i++) {
    $langNames[$i] = $page->getlocalized($searchLangs[$i]);
}
$smarty->assign('searchLangs', $searchLangs);
$smarty->assign('langNames', $langNames);
$now = getDate();
//$dayInThePast = mktime(0,0,0, $now['mon'], $now['mday']-10, $now['year']);
$dayInThePast = time() - 60 * 60 * 24 * 30;
// 30 days back
$fromDay = date('Y-m-d', $dayInThePast);
if ($page->loggedIn()) {
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: admin.php 554 2006-04-12 10:37:20Z buddhafly $
 * Authors: András Micsik 
 */
require "init.inc.php";
$smarty->assign('PAGETITLE', $page->getlocalized('AdminPage'));
$page->forceLogin();
//$page->errorURL = "admin.php";
checkPerm('node', 'change');
if (sotf_Utils::getParameter('del')) {
    $uid = sotf_Utils::getParameter('uid');
    $user = new sotf_User($uid);
    debug("Deleting user {$uid}", $user->username);
    $user->delete();
    $page->redirect('adminUsers.php');
    $page->logRequest();
    exit;
}
$pattern = sotf_Utils::getParameter('pattern');
$count = sotf_User::countUsers($pattern);
$limit = $page->splitList($count, $scriptUrl . "?pattern=" . urlencode($pattern));
$users = sotf_User::listUsers($limit["from"], $limit["maxresults"], $pattern);
foreach ($users as $user) {
    $user['groups'] = join(', ', sotf_Group::getGroupNames($user['id']));
    $ulist[] = $user;
}
$smarty->assign('USERS', $ulist);
$smarty->assign('PATTERN', $pattern);
$page->send();