<?
/*
* Libretto - Web download manager.
* Copyright (C) 2007 Jordi Pujol (jordi_pujolATtelefonicaDOTnet).
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
include "includes/globals.php";
include_once "includes/downloady.php";
function echo_dir($dir) {
echo $dir;
if ( is_dir($dir) ) {
$stat = stat($dir);
echo ' <B>'.t('uid').' '.$stat['uid'];
$pwuid = posix_getpwuid($stat['uid']);
if ( isset($pwuid['name']) )
echo ':'.$pwuid['name'];
echo ', '.t('gid').' '.$stat['gid'];
$grgid = posix_getgrgid($stat['gid']);
if ( isset($grgid['name']) )
echo ':'.$grgid['name'];
echo ', '.t('mode').' '.decoct($stat['mode']&0000777).'</B>';
} else
echo ' <B>'.t('notfound').'</B>';
}
?>
<h1><? echo t('configuration'); ?>
</h1>
<? displayUserName(); ?>
<table width="100%" border="1em">
<tr>
<td width="15%"><h3><? echo t('language'); ?></h3></td>
<td><? echo $lang; ?>
</td>
</tr>
<tr>
<td width="15%"></h3></td>
<td><? print_r($lang_codes); ?>
</td>
</tr>
<tr>
<td width="15%"></h3></td>
<td><? print_r($locales); ?>
</td>
</tr>
<tr>
<td width="15%"><h3><? echo t('refreshinterval'); ?></h3></td>
<td><? echo $refreshinterval; ?>
</td>
</tr>
<tr>
<td width="15%"><h3><? echo t('files'); ?></h3></td>
<td></td>
</tr>
<tr>
<td width="15%"><? echo t('destdir'); ?></td>
<td><? echo_dir($destdir); ?></td>
</tr>
<tr>
<td width="15%"><? echo t('tmpdir'); ?></td>
<td><? echo_dir($tmpdir); ?></td>
</tr>
<tr>
<td width="15%"><? echo t('storagedir'); ?></td>
<td><? echo_dir($storagedir); ?></td>
</tr>
<tr>
<td width="15%"><? echo t('logfile'); ?></td>
<td><? echo $logfile; ?>
</td>
</tr>
<tr>
<td width="15%"><h3><? echo t('utilities'); ?></h3></td>
<td></td>
</tr>
<? foreach ( $downloaders AS $downloadername => $downloadervalue ) { ?>
<tr>
<td width="15%"><B><? echo t($downloadername); ?></B></td>
<td></td>
</tr>
<tr>
<td width="15%"><? echo t('binary'); ?></td>
<td><? echo $downloaders[$downloadername]['binary']; ?></td>
</tr>
<tr>
<td width="15%"><? echo t('fullpath'); ?></td>
<td><? if ($downloaders[$downloadername]['fullpath'])
echo $downloaders[$downloadername]['fullpath'];
else
echo t('notfound');
?></td>
</tr>
<?
foreach ( $downloaders[$downloadername]['protocols'] AS $protocolname => $protocolvalue ) { ?>
<tr>
<td width="15%"><? echo t($protocolname).' '.t('from'); ?></td>
<td>
<? foreach ( $downloaders[$downloadername]['protocols'][$protocolname] AS $fromname )
echo t($fromname).', ';
?>
</td>
</tr>
<?
}
}
?>
<tr>
<td width="15%"><h4><? echo t('users'); ?></h4></td>
<td><? print_r($users); ?></td>
</tr>
<tr>
<td width="15%"><? echo t('user'); ?></td>
<td><? echo $user; ?></td>
</tr>
<tr>
<td width="15%"><h4><? echo t('jobs'); ?></h4></td>
<td><? $d= new downloady();
$list = $d->GetJobList();
print_r($list);
?></td>
</tr>
<tr>
<td width="15%"><h4><? echo t('jobs'); ?></h4></td>
<td><? $d= new downloady();
$list = $d->GetJobList();
foreach ( $list as $sid ) {
print($d->GetStats('pid',$sid).' ');
echo ( ($d->GetStats('is_running',$sid) > 0) ? t('active') : t('inactive') );
print(', <br>');
} ?></td>
</tr>
<tr>
<td width="15%"><h4><? echo t('jobs'); ?></h4></td>
<td><? $d= new downloady();
$list = $d->GetJobList();
foreach ( $list as $sid )
print_r($d->GetDetails($sid));
?></td>
</tr>
</table>