Example #1
0
            require Pingouin_ROOT . 'lib/template/footer.php';
            exit;
        }
    }
}
if (!$password_challenged && !$do_download && !$do_preview) {
    require Pingouin_ROOT . 'lib/template/header.php';
    echo '<div>' . '<form action = "';
    echo $cfg['web_root'] . '/f.php';
    echo '" ' . 'method = "post" id = "submit_post">';
    ?>
             <input type = "hidden" name = "Pingouin" value = "<?php 
    echo Pingouin_VERSION;
    ?>
"/><?php 
    echo '<fieldset><legend>' . htmlspecialchars($link['file_name']) . '</legend><table>' . '<tr><td>' . t('You are about to download') . ' "' . htmlspecialchars($link['file_name']) . '" (' . Pingouin_human_size($link['file_size']) . ')' . '</td></tr>' . '<tr><td>' . t('By using our services, you accept our') . ' <a href="' . $cfg['web_root'] . '/tos.php' . '">' . t('Term Of Service') . '</a>' . '</td></tr>';
    if ($link['onetime'] == 'O') {
        echo '<tr><td id="self_destruct">' . t('Warning, this file will self-destruct after being read') . '</td></tr>';
    }
    ?>
        <tr><td><input type="submit" id = "submit_download"  value="<?php 
    echo t('Download');
    ?>
"
        onclick="document.getElementById('submit_post').action='
<?php 
    echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&amp;d=1';
    if (!empty($crypt_key)) {
        echo '&amp;k=' . urlencode($crypt_key);
    }
    ?>
Example #2
0
/**
 * List files in admin interface.
 */
function Pingouin_admin_list($name, $file_hash, $link_hash)
{
    echo '<fieldset><legend>';
    if (!empty($name)) {
        echo t('Filename') . ": {$name} ";
    }
    if (!empty($file_hash)) {
        echo t('file') . ": {$file_hash} ";
    }
    if (!empty($link_hash)) {
        echo t('link') . ": {$link_hash} ";
    }
    if (empty($name) && empty($file_hash) && empty($link_hash)) {
        echo t('List all files');
    }
    echo '</legend>';
    echo '<table>';
    echo '<tr>';
    echo '<td>' . t('Filename') . '</td>';
    echo '<td>' . t('Type') . '</td>';
    echo '<td>' . t('Size') . '</td>';
    echo '<td>' . t('Expire') . '</td>';
    echo '<td>' . t('Onetime') . '</td>';
    echo '<td>' . t('Upload date') . '</td>';
    echo '<td>' . t('Origin') . '</td>';
    echo '<td>' . t('Action') . '</td>';
    echo '</tr>';
    /* Get all links files. */
    $stack = array(VAR_LINKS);
    while (($d = array_shift($stack)) && $d != NULL) {
        $dir = scandir($d);
        foreach ($dir as $node) {
            if (strcmp($node, '.') == 0 || strcmp($node, '..') == 0 || preg_match('/\\.tmp/i', "{$node}")) {
                continue;
            }
            if (is_dir($d . $node)) {
                /* Push new found directory. */
                $stack[] = $d . $node . '/';
            } elseif (is_file($d . $node)) {
                /* Read link informations. */
                $l = Pingouin_get_link($node);
                if (!count($l)) {
                    continue;
                }
                /* Filter. */
                if (!empty($name) && !preg_match("/{$name}/i", htmlspecialchars($l['file_name']))) {
                    continue;
                }
                if (!empty($file_hash) && $file_hash != $l['md5']) {
                    continue;
                }
                if (!empty($link_hash) && $link_hash != $node) {
                    continue;
                }
                /* Print link informations. */
                echo '<tr>';
                echo '<td>' . '<form action = "admin.php" method = "post">' . '<input type = "hidden" name = "action" value = "download"/>' . '<input type = "hidden" name = "link" value = "' . $node . '"/>' . '<input type = "submit" value = "' . htmlspecialchars($l['file_name']) . '" />' . '</form>';
                echo '</td>';
                echo '<td>' . $l['mime_type'] . '</td>';
                echo '<td>' . Pingouin_human_size($l['file_size']) . '</td>';
                echo '<td>' . ($l['time'] == -1 ? '' : strftime('%c', $l['time'])) . '</td>';
                echo '<td>';
                if ($l['onetime'] == 'O') {
                    echo 'Y';
                } else {
                    echo 'N';
                }
                echo '</td>';
                echo '<td>' . strftime('%c', $l['upload_date']) . '</td>';
                echo '<td>' . $l['ip'] . '</td>';
                echo '<td>' . '<form action = "admin.php" method = "post">' . '<input type = "hidden" name = "action" value = "delete_link"/>' . '<input type = "hidden" name = "link" value = "' . $node . '"/>' . '<input type = "submit" value = "' . t('Del link') . '" />' . '</form>' . '<form action = "admin.php" method = "post">' . '<input type = "hidden" name = "action" value = "delete_file"/>' . '<input type = "hidden" name = "md5" value = "' . $l['md5'] . '"/>' . '<input type = "submit" value = "' . t('Del file and links') . '" />' . '</form>' . '</td>';
                echo '</tr>';
            }
        }
    }
    echo '</table></fieldset>';
}