<?
/*
* 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";
?>
<h1><? print t('adddownload'); ?></h1>
<? displayUserName(); ?>
<form method="POST" enctype="multipart/form-data">
<table width="100%" border="0">
<tr><td><label>
<? echo t('url').'/'.t('fileserver'); ?>
</label>
</td><td>
<input type="text" size="80" name="url" id="url_id" value="<? echo $URL; ?>"
title="<? echo t('url').'/'.t('fileserver'); ?>">
<?php
if (isset($displayfolder) && $displayfolder && is_dir($displayfolder)) {
if ($displayfolder{strlen($displayfolder)-1}=='/')
$displayfolder = substr($displayfolder,0,-1);
if (is_dir($displayfolder)) {
$gwd = getcwd();
chdir($displayfolder);
$list = glob('*.*');
if (count($list)>0) {
echo '<br /><select onchange="if (this.value != \'\') {document.getElementById(\'url_id\').value=\''
.addslashes($displayfolder).'/\'+this.value;}">';
echo '<option value=""></option>';
foreach ($list as $name) {
echo '<option value="'.$name.'">'.$name.'</option>';
}
echo '</select>';
}
chdir($gwd);
}
}
?>
</td></tr>
<tr>
<td><? echo t('url').' '.t('user'); ?></td>
<td>
<input type="text" size="10" name="httpuser" value="<? echo $httpuser; ?>"
title="<? echo t('httpuser'); ?>">
</td>
</tr>
<tr>
<td><? echo t('url').' '.t('password'); ?></td>
<td>
<input type="password" size="10" name="httppasswd" value="<? echo $httppasswd; ?>"
title="<? echo t('httppasswd'); ?>">
</td>
</tr>
<tr><td><? echo t('mask'); ?>
</td>
<td>
<input type="text" size="10" name="mask" value="<? echo $mask; ?>"
title="<? echo t('mask'); ?>">
</td>
</tr>
<tr>
<td><label><? echo t('filelocal'); ?></label>
</td>
<td>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000"/>
<input type="file" name="filelocal" size="60" title="<? echo t('filelocal'); ?>"/>
</td>
</tr>
<tr><td><label><? echo t('filealtlocal'); ?></label>
</td>
<td>
<input type="file" name="filealtLocal" size="60" title="<? echo t('filealtlocal'); ?>"/>
</td>
</tr>
<? if ( @$downloaders['jigdo']['fullpath'] ) { ?>
<tr>
<td><label><? echo t('scanpath').': '; ?></label></td>
<td><input type="text" name="scanpath" size="60" value="<? echo $scanpath; ?>"
title="<? echo t('scanpath'); ?>"/></td>
</tr>
<? } ?>
<tr>
<td><? echo t('destdir').': '; ?></td>
<td><? echo $storagedir; ?></td>
</tr>
<tr>
<td><label><? echo t('subdircheck').': '; ?></label></td>
<td><input type="checkbox" name="subdircheck"
<? echo ' title="'.t('subdircheck').'"';
if ( $subdircheck ) echo ' "checked"';
?>/>
</td>
</tr>
<tr>
<td><label><? echo t('subdirname').': '; ?></label></td>
<td><input type="text" name="subdirname" value="<? echo $subdirname; ?>"
title="<? echo t('subdirname'); ?>"/></td>
</tr>
<tr>
<td><label><? echo t('downloader').': '; ?></label></td>
<td><select name="downloader" title="<? echo t('downloader'); ?>">
<option value="auto"
<? if ($downloader == "auto")
echo ' selected="selected"'; ?>
>
<? echo t('auto'); ?>
</option>
<? foreach ( $downloaders AS $downloadername => $value )
if ( $downloaders[$downloadername]['fullpath'] ) {
echo '<option value="'.$downloadername.'"';
if ( $downloader == $downloadername )
echo ' selected="selected"';
echo '>';
echo t($downloadername);
echo '</option>'."\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><label><? echo t('urltype').': '; ?></label></td>
<td><select name="URLType" title="<? echo t('urltype'); ?>">
<option value="auto"
<? if ($URLType == "auto")
echo ' selected="selected"'; ?>
>
<? echo t('auto'); ?>
</option>
<? $froms = array();
foreach ( $downloaders AS $downloadername => $downloadervalue )
if ( $downloaders[$downloadername]['fullpath'] )
if ( isset($downloaders[$downloadername]['protocols']) )
foreach ( $downloaders[$downloadername]['protocols'] AS $protocolname => $protocolvalue )
foreach ( $downloaders[$downloadername]['protocols'][$protocolname] AS $from )
if( !in_array($from,$froms) )
$froms[]=$from;
$r = array_multisort($froms, SORT_ASC);
foreach ( $froms AS $from ) {
echo '<option value="'.$from.'"';
if ( $URLType == $from )
echo ' selected="selected"';
echo '>';
echo t($from);
echo '</option>'."\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="edit-file"><? echo t('downloadtype').': '; ?></label></td>
<td><select name="downloadtype" title="<? echo t('downloadtype'); ?>">
<option value="auto"
<? if ($downloadtype == "auto")
echo ' selected="selected"'; ?>
>
<? echo t('auto'); ?>
</option>
<? $protocols = array();
foreach ( $downloaders AS $downloadername => $downloadervalue )
if ( $downloaders[$downloadername]['fullpath'] )
if ( isset($downloaders[$downloadername]['protocols']) )
foreach ( $downloaders[$downloadername]['protocols'] AS $protocolname => $protocolvalue )
if( !in_array($protocolname,$protocols) )
$protocols[]=$protocolname;
$r = array_multisort($protocols, SORT_ASC);
foreach ( $protocols AS $protocolname ) {
echo '<option value="'.$protocolname.'"';
if ( $URLType == $protocolname )
echo ' selected="selected"';
echo '>';
echo t($protocolname);
echo '</option>'."\n";
}
?>
</select>
</td>
</tr>
</table>
<div align="center"><p>
<input type="submit" name="downloadstart" value="<? echo t('downloadstart'); ?>"
title="<? echo t('downloadstart'); ?>">
</p></div>
<input type="hidden" name="_submit_adddownload" value="1"/>
</form>