1. Redistributions of source code must retain the above copyright notice, this
       list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    The views and conclusions contained in the software and documentation are those
    of the authors and should not be interpreted as representing official policies,
    either expressed or implied, of the FreeBSD Project.
*/
require_once "config.inc";
$extension_dir = "/usr/local/www";
require_once "{$extension_dir}/downloady.php";
if (is_link("/usr/local/share/locale-dly")) {
    mwexec("unlink /usr/local/share/locale-dly", true);
}
// remove link to languages
$d = new downloady($dest, $ratelimit);
$d->StopAll();
    of the authors and should not be interpreted as representing official policies,
    either expressed or implied, of the FreeBSD Project.
*/
$extension_dir = "/usr/local/www";
if (!is_dir($extension_dir)) {
    mwexec("mkdir -p {$extension_dir}", true);
}
$arch = $g['arch'];
if ($arch == "i386") {
    $arch = "x86";
} elseif ($arch == "amd64") {
    $arch = "x64";
}
mwexec("cp -R {$config['downloady']['rootfolder']}ext/* {$extension_dir}/", true);
// copy extension
mwexec("cp -R {$config['downloady']['rootfolder']}{$arch}/local/* /usr/local/", true);
// copy wget binaries
if (!is_link("/usr/local/share/locale-dly")) {
    mwexec("ln -s {$config['downloady']['rootfolder']}locale-dly /usr/local/share/", true);
}
// create link to languages
if (isset($config['downloady']['enable'])) {
    if (isset($config['downloady']['resume']) || isset($config['downloady']['enable_schedule'])) {
        require_once "{$extension_dir}/downloady.php";
        if (isset($config['downloady']['full_bandwidth'])) {
            $ratelimit = 0;
        }
        $d = new downloady($dest, $ratelimit);
        $d->StartAll();
    }
}
示例#3
0
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    The views and conclusions contained in the software and documentation are those
    of the authors and should not be interpreted as representing official policies,
    either expressed or implied, of the FreeBSD Project.
*/
require_once "downloady.php";
$namechop = 80;
$refresh = 5;
$d = new downloady($dest, $ratelimit);
$sid = isset($_REQUEST['sid']) ? $_REQUEST['sid'] : NULL;
$cmd = strtolower(isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL);
function HumanReadableSize($size)
{
    $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
    if ($size > 0) {
        return round($size / pow(1024, $i = floor(log($size, 1024))), 2) . $filesizename[$i];
    } else {
        return $size;
    }
}
function ShortenName($name, $maxlength)
{
    // needs improvements
    if (strlen($name) <= $maxlength) {
示例#4
0
    $d->RemoveDelete();
}
if (isset($_POST['download']) && $_POST['download']) {
    $url = isset($_REQUEST['url']) ? $_REQUEST['url'] : NULL;
    $rs = isset($_REQUEST['rapidshare']) ? true : false;
    $pause = isset($_REQUEST['pause']) ? true : false;
    if ($url) {
        $urls = explode("\n", $url);
        for ($i = 0; $i < count($urls); $i++) {
            $url_parts = parse_url($urls[$i]);
            switch ($url_parts['scheme']) {
                // Make sure the URL is valid
                case "http":
                case "https":
                case "ftp":
                    $d = new downloady($dest, $ratelimit);
                    $d->AddURL($urls[$i], $rs, $pause);
                    list($file, $rest) = explode("?r=", basename($urls[$i]), 2);
                    // get rid of redirection data
                    $clean_url = $file;
                    $savemsg .= gettext('File') . ": " . $clean_url . " " . gettext('added.') . "<br />";
                    break;
                default:
                    if (trim($urls[$i]) == "") {
                        break;
                    }
                    $savemsg .= gettext('URL') . ": " . $urls[$i] . " " . gettext("is not allowed for download. Only URLs containing the schemes 'http', 'https' and 'ftp' are permitted for download.") . "<br />";
            }
        }
    }
}