当前位置: 首页>>代码示例>>PHP>>正文


PHP bytesToKbOrMbOrGb函数代码示例

本文整理汇总了PHP中bytesToKbOrMbOrGb函数的典型用法代码示例。如果您正苦于以下问题:PHP bytesToKbOrMbOrGb函数的具体用法?PHP bytesToKbOrMbOrGb怎么用?PHP bytesToKbOrMbOrGb使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bytesToKbOrMbOrGb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: md5_change_go

function md5_change_go()
{
    global $list, $PHP_SELF;
    if (isset($_POST['yes'])) {
        foreach ($_POST['files'] as $k => $v) {
            $name = $list[$v]['name'];
            $html_name = htmlentities(basename($name));
            if (file_exists($name)) {
                if (@write_file($name, chr(0), 0)) {
                    clearstatcache();
                    printf(lang(381), $html_name);
                    unset($list[$v]);
                    $time = filemtime($name);
                    while (isset($list[$time])) {
                        $time++;
                    }
                    $list[$time] = array('name' => $name, "size" => bytesToKbOrMbOrGb(filesize($name)), "date" => $time);
                } else {
                    printf(lang(382), $html_name);
                }
            } else {
                printf(lang(145), $html_name);
            }
            echo '<br />';
        }
        if (!updateListInFile($list)) {
            echo lang(146) . "<br /><br />";
        }
    } else {
        echo '<script type="text/javascript">location.href="' . $PHP_SELF . '?act=files";</script>';
    }
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:32,代码来源:md5change.php

示例2: check

function check($link, $x, $regex, $szpatern = '', $pattern = '', $replace = '')
{
    global $isDEBUG;
    if (!empty($pattern)) {
        $link = preg_replace($pattern, $replace, $link);
    }
    $page = curl($link);
    // treat for rapidshare
    if (preg_match("/https?:\\/\\/rapidshare\\.com\\/(?:(?:files\\/(\\d+))|(?:\\W{2}download\\|[^\\|]+.(\\d+)\\|([^\\|]+)))/", $link, $match)) {
        $files = $match[1] ? $match[1] : $match[2];
        $filename = isset($match[3]) ? $match[3] : preg_replace("/\\.html\$/", "", basename($link));
        $plink = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles&files=" . $files . "&filenames=" . $filename . "&cbid=0";
        $page = curl($plink);
        if (preg_match("/^(\\d+),([^,]+),([^,]+),/", $page, $match)) {
            $parts = explode(",", $page);
            $fsize = array(0, 0);
            $fsize[1] = bytesToKbOrMbOrGb($parts[2]);
        }
        $page = "";
    } elseif (!empty($szpatern)) {
        // already containing / and /
        preg_match("{$szpatern}", $page, $fsize);
        if (!$fsize) {
            $fsize = '';
        }
    }
    if ($isDEBUG) {
        echo htmlentities($link . "\n" . $plink . "\n" . $page . "\n");
        exit;
    }
    $link = htmlentities($link, ENT_QUOTES);
    flush();
    ob_flush();
    $picEror = "<img width='13' alt='error link' src='" . STATIC_DIR . "images/chk_error.png'>";
    $picGood = "<img width='13' alt='good link' src='" . STATIC_DIR . "images/chk_good.png'>";
    if ($_POST['d'] && preg_match("/{$regex}/i", $page)) {
        echo "<span class=\"g\">" . $picGood . "&nbsp;(" . trim($fsize[1]) . ")</span>\n";
    } elseif ($_POST['d'] && preg_match("/The file you are trying to access is temporarily unavailable./i", $page)) {
        echo "<span class=\"y\">{$picEror}</span>\n";
    } elseif ($_POST['d'] && !preg_match("/{$regex}/i", $page)) {
        echo "<span class=\"r\">{$picGood}&nbsp;(" . trim($fsize[1]) . ")</span>\n";
    } elseif (!$_POST['d'] && preg_match("/{$regex}/i", $page)) {
        echo "<span class=\"g\">{$picGood}&nbsp;(" . trim($fsize[1]) . ")</span>\n";
    } elseif (!$_POST['d'] && preg_match("/The file you are trying to access is temporarily unavailable./i", $page)) {
        echo "<span class=\"y\">{$picEror}</span>\n";
    } elseif (count($fsize) > 0) {
        echo "<span class=\"g\">" . $picGood . "&nbsp;(" . trim($fsize[1]) . ")</span>\n";
    } else {
        echo "<span class=\"r\">{$picEror}</span>\n";
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:51,代码来源:ajax_lnk.php

示例3: lang

</tr>
</tbody>
</table>
<br />
<table width="60%" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center"></div>
<script type="text/javascript">
var show = 0;
var show2 = 0;
</script>
<div align="center">
<?php 
if ($options['file_size_limit'] > 0) {
    echo '<span style="color:#FFCC00">' . lang(337) . ' <b>' . bytesToKbOrMbOrGb($options['file_size_limit'] * 1024 * 1024) . '</b></span>';
}
?>
<br />

<?php 
$delete_delay = $options['delete_delay'];
if (is_numeric($delete_delay) && $delete_delay > 0) {
    if ($delete_delay > 3600) {
        $ddelay = round($delete_delay / 3600, 1);
        print '<span class="autodel">' . lang(282) . ': <b>' . $ddelay . '</b>&nbsp;' . lang(283) . '</span>';
    } else {
        $ddelay = round($delete_delay / 60);
        print '<span class="autodel">' . lang(282) . ': <b>' . $ddelay . '</b>&nbsp;' . lang(284) . '</span>';
    }
}
开发者ID:mewtutorial,项目名称:rapidleech-ultimate,代码行数:31,代码来源:main.php

示例4: _create_list

function _create_list()
{
    global $list, $_COOKIE, $options;
    $glist = array();
    if ($options['show_all'] === true && (isset($_COOKIE['showAll']) && $_COOKIE['showAll'] == 1)) {
        $dir = dir(DOWNLOAD_DIR);
        while (false !== ($file = $dir->read())) {
            if (($tmp = file_data_size_time(DOWNLOAD_DIR . $file)) === false) {
                continue;
            }
            list($size, $time) = $tmp;
            if ($file != '.' && $file != '..' && (!is_array($options['forbidden_filetypes']) || !in_array(strtolower(strrchr($file, '.')), $options['forbidden_filetypes']))) {
                $file = DOWNLOAD_DIR . $file;
                while (isset($glist[$time])) {
                    $time++;
                }
                $glist[$time] = array('name' => realpath($file), 'size' => bytesToKbOrMbOrGb($size), 'date' => $time);
            }
        }
        $dir->close();
        @uasort($glist, '_cmp_list_enums');
    } else {
        if (@file_exists(CONFIG_DIR . 'files.lst') && ($glist = file(CONFIG_DIR . 'files.lst')) !== false) {
            foreach ($glist as $key => $record) {
                foreach (unserialize($record) as $field => $value) {
                    $listReformat[$key][$field] = $value;
                    if ($field == 'date') {
                        $date = $value;
                    }
                }
                $glist[$date] = $listReformat[$key];
                unset($glist[$key], $listReformat[$key]);
            }
        }
    }
    $list = $glist;
}
开发者ID:mewtutorial,项目名称:RapidTube,代码行数:37,代码来源:other.php

示例5: check

function check(&$link, $x, $regex, $szregex = '', $pattern = '', $replace = '', $opt = array())
{
    if (!empty($pattern)) {
        $link = preg_replace($pattern, $replace, $link);
    }
    $cook = $ref = $bytes = $fixsize = $size = 0;
    $fol = $head = 1;
    if (!empty($opt)) {
        if (array_key_exists('bytes', $opt)) {
            $bytes = $opt['bytes'] ? 1 : 0;
        }
        if (array_key_exists('fixsize', $opt)) {
            $fixsize = $opt['fixsize'] ? 1 : 0;
            $fixsizeP = $fixsizeR = '';
            if ($fixsize && array_key_exists('fixsizeP', $opt)) {
                $fixsizeP = $opt['fixsizeP'];
                if (array_key_exists('fixsizeR', $opt)) {
                    $fixsizeR = $opt['fixsizeR'];
                }
            }
        }
        if (array_key_exists('cookie', $opt) && $opt['cookie'] != false) {
            $cookie = $opt['cookie'];
        }
        if (array_key_exists('follow', $opt)) {
            $fol = $opt['follow'];
        }
        if (array_key_exists('referer', $opt) && $opt['referer'] != false) {
            $ref = $opt['referer'];
        }
        if (array_key_exists('header', $opt)) {
            $head = $opt['header'] ? 1 : 0;
        }
    }
    $page = curl($link, 0, $cookie, $fol, $ref, $head);
    $link = htmlentities($link, ENT_QUOTES);
    if ($szregex !== true && preg_match('@' . $regex . '@i', $page) || $szregex === true && preg_match('@' . $regex . '@i', $page, $fz)) {
        if (!empty($fz) || !empty($szregex) && preg_match('@' . $szregex . '@i', $page, $fz)) {
            if (!array_key_exists('size', $fz)) {
                $fz['size'] = $fz[1];
            }
            if ($bytes) {
                $size = bytesToKbOrMbOrGb($fz['size']);
            } else {
                if ($fixsize) {
                    if (!array_key_exists('XB', $fz)) {
                        $fz['XB'] = $fz[2];
                    }
                    $fz['XB'] = str_replace(array('YTES', 'YTE'), '', strtoupper($fz['XB']));
                    if (!empty($fixsizeP)) {
                        $fz['size'] = str_replace($fixsizeP, $fixsizeR, $fz['size']);
                    }
                    $fz['size'] = str_replace(',', '.', $fz['size']);
                    switch ($fz['XB']) {
                        // KbOrMbOrGbToBytes :D
                        case 'GB':
                            $fz['size'] *= 1024;
                        case 'MB':
                            $fz['size'] *= 1024;
                        case 'KB':
                            $fz['size'] *= 1024;
                    }
                    $size = bytesToKbOrMbOrGb($fz['size']);
                } else {
                    if (!array_key_exists('XB', $fz)) {
                        $fz['XB'] = strtoupper($fz[2]);
                    }
                    $fz['size'] = str_replace(',', '.', $fz['size']);
                    $size = $fz['size'] . ' ' . $fz['XB'];
                }
            }
            $size = explode(' ', $size);
            $size[0] = round($size[0], 2);
            $size = implode(' ', $size);
        }
        $chk = showlink($link, $size);
    } elseif (empty($page) || preg_match('@class="bott_p_access2?"@i', $page)) {
        $chk = showlink($link, 0, 2);
    } else {
        $chk = showlink($link, 0, 0);
    }
    return array($chk, $size);
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:83,代码来源:linkchecker.php

示例6: upfile

function upfile($host, $port, $url, $referer, $cookie, $post, $file, $filename, $fieldname, $field2name = '', $proxy = 0, $pauth = 0, $upagent = 0, $scheme = 'http')
{
    global $nn, $lastError, $sleep_time, $sleep_count;
    if (empty($upagent)) {
        $upagent = 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.12';
    }
    $scheme .= '://';
    $bound = '--------' . md5(microtime());
    $saveToFile = 0;
    $postdata = '';
    if ($post) {
        foreach ($post as $key => $value) {
            $postdata .= '--' . $bound . $nn;
            $postdata .= "Content-Disposition: form-data; name=\"{$key}\"{$nn}{$nn}";
            $postdata .= $value . $nn;
        }
    }
    $fileSize = getSize($file);
    $fieldname = $fieldname ? $fieldname : file . md5($filename);
    if (!is_readable($file)) {
        $lastError = sprintf(lang(65), $file);
        return FALSE;
    }
    if ($field2name != '') {
        $postdata .= '--' . $bound . $nn;
        $postdata .= "Content-Disposition: form-data; name=\"{$field2name}\"; filename=\"\"{$nn}";
        $postdata .= "Content-Type: application/octet-stream{$nn}{$nn}";
    }
    $postdata .= '--' . $bound . $nn;
    $postdata .= "Content-Disposition: form-data; name=\"{$fieldname}\"; filename=\"{$filename}\"{$nn}";
    $postdata .= "Content-Type: application/octet-stream{$nn}{$nn}";
    $cookies = '';
    if (!empty($cookie)) {
        if (is_array($cookie)) {
            if (count($cookie) > 0) {
                $cookies = 'Cookie: ' . CookiesToStr($cookie) . $nn;
            }
        } else {
            $cookies = 'Cookie: ' . trim($cookie) . $nn;
        }
    }
    $referer = $referer ? "Referer: {$referer}{$nn}" : '';
    if ($scheme == 'https://') {
        $scheme = 'ssl://';
        $port = 443;
    }
    if ($proxy) {
        list($proxyHost, $proxyPort) = explode(':', $proxy, 2);
        $host = $host . ($port != 80 && ($scheme != 'ssl://' || $port != 443) ? ':' . $port : '');
        $url = $scheme . $host . $url;
    }
    if ($scheme != 'ssl://') {
        $scheme = '';
    }
    $http_auth = !empty($auth) ? "Authorization: Basic {$auth}{$nn}" : '';
    $proxyauth = !empty($pauth) ? "Proxy-Authorization: Basic {$pauth}{$nn}" : '';
    $zapros = 'POST ' . str_replace(' ', "%20", $url) . ' HTTP/1.0' . $nn . 'Host: ' . $host . $nn . $cookies . "Content-Type: multipart/form-data; boundary=" . $bound . $nn . "Content-Length: " . (strlen($postdata) + strlen($nn . "--" . $bound . "--" . $nn) + $fileSize) . $nn . "User-Agent: " . $upagent . $nn . "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" . $nn . "Accept-Language: en-en,en;q=0.5" . $nn . "Accept-Charset: utf-8,windows-1251;koi8-r;q=0.7,*;q=0.7" . $nn . "Connection: Close" . $nn . $http_auth . $proxyauth . $referer . $nn . $postdata;
    $errno = 0;
    $errstr = '';
    $posturl = (!empty($proxyHost) ? $scheme . $proxyHost : $scheme . $host) . ':' . (!empty($proxyPort) ? $proxyPort : $port);
    $fp = @stream_socket_client($posturl, $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
    //$fp = @fsockopen ( $host, $port, $errno, $errstr, 150 );
    //stream_set_timeout ( $fp, 300 );
    if (!$fp) {
        $dis_host = !empty($proxyHost) ? $proxyHost : $host;
        $dis_port = !empty($proxyPort) ? $proxyPort : $port;
        html_error(sprintf(lang(88), $dis_host, $dis_port));
    }
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    if ($proxy) {
        echo '<p>' . sprintf(lang(89), $proxyHost, $proxyPort) . '<br />';
        echo "UPLOAD: <b>{$url}</b>...<br />\n";
    } else {
        echo '<p>';
        printf(lang(90), $host, $port);
        echo '</p>';
    }
    echo lang(104) . ' <b>' . $filename . '</b>, ' . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fileSize) . '</b>...<br />';
    global $id;
    $id = md5(time() * rand(0, 10));
    require TEMPLATE_DIR . '/uploadui.php';
    flush();
    $timeStart = getmicrotime();
    //$chunkSize = 16384;		// Use this value no matter what (using this actually just causes massive cpu usage for large files, too much data is flushed to the browser!)
    $chunkSize = GetChunkSize($fileSize);
    fputs($fp, $zapros);
    fflush($fp);
    $fs = fopen($file, 'r');
    $local_sleep = $sleep_count;
    //echo('<script type="text/javascript">');
    $totalsend = $time = $lastChunkTime = 0;
    while (!feof($fs) && !$errno && !$errstr) {
        $data = fread($fs, $chunkSize);
        if ($data === false) {
            fclose($fs);
            fclose($fp);
            html_error(lang(112));
//.........这里部分代码省略.........
开发者ID:mewtutorial,项目名称:RapidTube,代码行数:101,代码来源:http.php

示例7: xmail

function xmail($from, $to, $subj, $text, $filename, $partSize = FALSE, $method = FALSE)
{
    global $un;
    $fileContents = read_file($filename);
    $fileSize = strlen($fileContents);
    if ($partSize != FALSE & $method == "tc") {
        $crc = strtoupper(dechex(crc32($fileContents)));
        $crc = str_repeat("0", 8 - strlen($crc)) . $crc;
    } else {
        $file = base64_encode($fileContents);
        $file = chunk_split($file);
        unset($fileContents);
    }
    if (!$file && !$fileContents) {
        return FALSE;
    }
    printf(lang(121), basename($filename));
    echo "...<br />";
    flush();
    sleep(1);
    for ($i = 0; $i < strlen($subj); $i++) {
        $subzh .= "=" . strtoupper(dechex(ord(substr($subj, $i, 1))));
    }
    $subj = "=?UTF-8?Q?" . $subzh . '?=';
    $un = strtoupper(uniqid(time()));
    $head = "From: " . $from . "\n" . "X-Mailer: PHP RapidLeech PlugMod\n" . "Reply-To: " . $from . "\n" . "Mime-Version: 1.0\n" . "Content-Type: multipart/mixed; boundary=\"----------" . $un . "\"\n\n";
    $zag = "------------" . $un . "\nContent-Type: text/plain; charset=UTF-8\n" . "Content-Transfer-Encoding: 8bit\n\n" . $text . "\n\n" . "------------" . $un . "\n" . "Content-Type: application/octet-stream; name=\"" . basename($filename) . "\"\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: attachment; filename=\"" . basename($filename) . "\"\n\n";
    echo '<span id="mailPart.' . md5(basename($filename)) . '"></span><br />';
    flush();
    if ($partSize) {
        $partSize = round($partSize);
        if ($method == "rfc") {
            $multiHeadMain = "From: " . $from . "\n" . "X-Mailer: PHP RapidLeech PlugMod\n" . "Reply-To: " . $from . "\n" . "Mime-Version: 1.0\n" . "Content-Type: message/partial; ";
            $totalParts = ceil(strlen($file) / $partSize);
            if ($totalParts == 1) {
                echo lang(122) . "...<br />";
                flush();
                return mail($to, $subj, $zag . $file, $head) ? TRUE : FALSE;
            }
            printf(lang(123), bytesToKbOrMbOrGb($partSize));
            echo ", " . lang(124) . " - RFC 2046...<br />";
            echo "Total Parts: <b>" . $totalParts . "</b><br />";
            $mailed = TRUE;
            echo '<script type="text/javascript">';
            for ($i = 0; $i < $totalParts; $i++) {
                $multiHead = $multiHeadMain . "id=\"" . $filename . "\"; number=" . ($i + 1) . "; total=" . $totalParts . "\n\n";
                if ($i == 0) {
                    $multiHead = $multiHead . $head;
                    $fileChunk = $zag . substr($file, 0, $partSize);
                } elseif ($i == $totalParts - 1) {
                    $fileChunk = substr($file, $i * $partSize);
                } else {
                    $fileChunk = substr($file, $i * $partSize, $partSize);
                }
                echo "mail('" . sprintf(lang(125), $i + 1) . "...', '" . md5(basename($filename)) . "');\r\n";
                flush();
                $mailed = $mailed & mail($to, $subj, $fileChunk, $multiHead);
                if (!$mailed) {
                    return false;
                }
            }
            echo '</script>';
        } elseif ($method == "tc") {
            $totalParts = ceil($fileSize / $partSize);
            if ($totalParts == 1) {
                echo lang(126) . "...<br />";
                flush();
                return mail($to, $subj, $zag . chunk_split(base64_encode($fileContents)), $head) ? TRUE : FALSE;
            }
            printf(lang(123), bytesToKbOrMbOrGb($partSize));
            echo ", " . lang(124) . " - Total Commander...<br />";
            echo "Total Parts: <b>" . $totalParts . "</b><br />";
            $mailed = TRUE;
            $fileTmp = $filename;
            while (strpos($fileTmp, ".")) {
                $fileName .= substr($fileTmp, 0, strpos($fileTmp, ".") + 1);
                $fileTmp = substr($fileTmp, strpos($fileTmp, ".") + 1);
            }
            $fileName = substr($fileName, 0, -1);
            echo '<script type="text/javascript">';
            for ($i = 0; $i < $totalParts; $i++) {
                if ($i == 0) {
                    $fileChunk = substr($fileContents, 0, $partSize);
                    $addHeads = addAdditionalHeaders(array("msg" => $text . "\r\n" . "File " . basename($filename) . " (����� " . ($i + 1) . " �� " . $totalParts . ").", "file" => array("filename" => $fileName . ".crc", "stream" => chunk_split(base64_encode("filename=" . basename($filename) . "\r\n" . "size=" . $fileSize . "\r\n" . "crc32=" . $crc . "\r\n")))));
                    $addHeads .= addAdditionalHeaders(array("file" => array("filename" => $fileName . ".001", "stream" => chunk_split(base64_encode($fileChunk)))));
                } elseif ($i == $totalParts - 1) {
                    $fileChunk = substr($fileContents, $i * $partSize);
                    $addHeads = addAdditionalHeaders(array("msg" => "File " . basename($filename) . " (parts " . ($i + 1) . " from " . $totalParts . ").", "file" => array("filename" => $fileName . "." . (strlen($i + 1) == 2 ? "0" . ($i + 1) : (strlen($i + 1) == 1 ? "00" . ($i + 1) : $i + 1)), "stream" => chunk_split(base64_encode($fileChunk)))));
                } else {
                    $fileChunk = substr($fileContents, $i * $partSize, $partSize);
                    $addHeads = addAdditionalHeaders(array("msg" => "File " . basename($filename) . " (parts " . ($i + 1) . " from " . $totalParts . ").", "file" => array("filename" => $fileName . "." . (strlen($i + 1) == 2 ? "0" . ($i + 1) : (strlen($i + 1) == 1 ? "00" . ($i + 1) : $i + 1)), "stream" => chunk_split(base64_encode($fileChunk)))));
                }
                echo "mail('" . sprintf(lang(125), $i + 1) . "...', '" . md5(basename($filename)) . "');\r\n";
                flush();
                $mailed = $mailed & mail($to, $subj, $addHeads, $head);
                if (!$mailed) {
                    return false;
                }
            }
            echo '</script>';
//.........这里部分代码省略.........
开发者ID:SheppeR,项目名称:rapidleech,代码行数:101,代码来源:mail.php

示例8: file

        ?>
<td><b class='sorttable_nosort'>&nbsp;<?php 
        echo $L->say['act_del'];
        ?>
<\/b><\/td><?php 
    }
    ?>
<\/tr>";
tfoot = "<tfoot>";
tfoot+= "<tr class='filelist_title'><td><input type='checkbox' id='chksAll' onclick='javascript:sAll(this.checked);' \/><\/td>";
tfoot+= "<td id='totfile'><?php 
    echo "Total : <b class='y'>" . $c . "<\\/b> file(s)";
    ?>
<\/td>";
tfoot+= "<td align='right' id='totsz'><?php 
    echo '<b class=\\"y\\">' . bytesToKbOrMbOrGb($total_size) . '<\\/b>';
    ?>
 <\/td>";
tfoot+= "<td align='right'><\/td><?php 
    if ($lynx_del) {
        ?>
<td><\/td><?php 
    }
    ?>
<td><\/td><\/tr><\/tfoot>";

var dtemplate = "<tr id='brs((chkidx))' class='rowlist' onmousedown='clk(\"chkfL-((chkidx))\")' ";
dtemplate+= "onmouseout='if(d.getElementById(\"chkfL-((chkidx))\").checked){this.className=\"rowlist_checked\";}else{this.className=\"rowlist\";}'>";
dtemplate+= "<td><input type='checkbox' id='chkfL-((chkidx))' onclick='clk(\"chkfL-((chkidx))\")' \/><\/td>";
dtemplate+= "<td align='right'><span id='fN-((chkidx))'>((filename))<\/span><\/td>";
dtemplate+= "<td align='left'><a id='fL-((chkidx))' href='((filelink))' title='((filename))'>";
开发者ID:laiello,项目名称:rapidleech36b,代码行数:31,代码来源:lynx.php

示例9: _create_list

function _create_list()
{
    $glist = array();
    if ($GLOBALS['options']['show_all'] === true && (isset($_COOKIE['showAll']) && $_COOKIE['showAll'] == 1)) {
        $dir = dir(DOWNLOAD_DIR);
        while (false !== ($file = $dir->read())) {
            if (($tmp = file_data_size_time(DOWNLOAD_DIR . $file)) === false) {
                continue;
            }
            list($size, $time) = $tmp;
            if ($file != '.' && $file != '..' && (!is_array($GLOBALS['options']['forbidden_filetypes']) || !in_array(strtolower(strrchr($file, '.')), $GLOBALS['options']['forbidden_filetypes']))) {
                $file = DOWNLOAD_DIR . $file;
                while (isset($glist[$time])) {
                    $time++;
                }
                $glist[$time] = array('name' => realpath($file), 'size' => bytesToKbOrMbOrGb($size), 'date' => $time);
            }
        }
        $dir->close();
        @uasort($glist, '_cmp_list_enums');
    } else {
        if (@file_exists(CONFIG_DIR . 'files.lst') && ($glist = file(CONFIG_DIR . 'files.lst')) !== false) {
            foreach ($glist as $key => $record) {
                foreach (unserialize($record) as $field => $value) {
                    switch ($field) {
                        case 'date':
                            $date = $value;
                        default:
                            $listReformat[$key][$field] = $value;
                            break;
                        case 'comment':
                            $listReformat[$key][$field] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
                            break;
                    }
                }
                $glist[$date] = $listReformat[$key];
                unset($glist[$key], $listReformat[$key]);
            }
        }
    }
    $GLOBALS['list'] = $glist;
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:42,代码来源:other.php

示例10: _create_list

function _create_list($lynx = false, $medic = false, $d_showall = false)
{
    global $list, $_COOKIE, $options;
    $glist = array();
    $showall = $options['show_all'] && (isset($_COOKIE['showAll']) && $_COOKIE['showAll'] || $d_showall) || $medic ? true : false;
    //	if (!$d_showall) $d_showall = (isset($_COOKIE["showAll"]) ? $_COOKIE["showAll"] : false);
    //	if (($options["show_all"] && ($d_showall == 1)) || $medic) {
    if ($showall) {
        // Show Everything
        $totsize = 0;
        $cnt = 0;
        $dir = @dir(DOWNLOAD_DIR);
        while (false !== ($file = $dir->read())) {
            if ($file != "." && $file != ".." && is_array($options["forbidden_filetypes"]) && !in_array("." . get_extension($file), $options["forbidden_filetypes"]) && is_file(DOWNLOAD_DIR . $file) && basename($file) != basename(FILES_LST) && basename($file) != 'index.html' && basename($file) != 'index.php') {
                $file = DOWNLOAD_DIR . $file;
                if (($tmp = file_data_size_time($file)) === false) {
                    continue;
                }
                list($size, $time) = $tmp;
                $time = getNowzone($time);
                while (isset($glist[$time])) {
                    $time++;
                }
                $agefile = TIME_NOW - $time;
                $glist[$time] = array("name" => realpath($file), "size" => bytesToKbOrMbOrGb($size), "date" => $time, "age" => count_age($agefile));
                if ($options["show_column_sfile"]["md5"] && !$lynx) {
                    $glist[$time]["md5"] = md5_file($file);
                }
                $totsize += $size;
                $cnt++;
            }
        }
        $dir->close();
        @uasort($glist, "_cmp_list_enums");
        if ($cnt > 0) {
            $glist["files"]["totalsize"] = $totsize;
            $glist["files"]["totalfile"] = $cnt;
            $glist["files"]["misc"] = "files";
        }
    } else {
        // Show Downloaded
        if (@file_exists(FILES_LST)) {
            $glist = file(FILES_LST);
            $glistReformat = null;
            foreach ($glist as $key => $record) {
                $recfile = @unserialize($record);
                if (is_array($recfile)) {
                    foreach ($recfile as $field => $value) {
                        if (in_array($field, array("date", "age", "misc"))) {
                            $time = @filemtime($recfile["name"]);
                            $time = getNowzone($time);
                            //$unix_zone = ($time != $value ? $time - date("Z") + (3600 * $options["timezone"]) : $value);
                            if ($field == "age") {
                                $agefile = TIME_NOW - $time;
                                $listReformat[$key]["age"] = count_age($agefile);
                            }
                            if ($field == "date") {
                                $listReformat[$key][$field] = $time;
                                $date = $time;
                            }
                        }
                        if ($field != "age" && $field != "date") {
                            $listReformat[$key][$field] = $value;
                        }
                    }
                    $glist[$date] = $listReformat[$key];
                    unset($glist[$key], $glistReformat[$key]);
                }
            }
            @uasort($glist, "_cmp_list_enums");
        }
    }
    $list = $glist;
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:74,代码来源:other.php

示例11: get_traffic

        ?>
">&nbsp;<b class="g">day<small>(s)</small></b> Reset Traffic</div>
</div>
</td>
<td class="tdacc" id="limittraf2" style="display:<?php 
        echo $limitbytrafficchk ? 'none' : '';
        ?>
">
<div id="curtrafic" align="center" style="position:absolute;float:left;width:200px;padding-left:270px; margin-top:-10px; display:<?php 
        echo $limitbytraffic ? "" : "none;";
        ?>
"><div id="trafwaiting" align="left" style="display:none;"></div></div>
<div style="padding-left:20px; margin-top: 0px;">
<span>Quota Traffic allowed. Currently traffic:&nbsp;<span id="cur_traffic"><b class="g" style="position:absolute;"><span id="trafshowresults" style="position:float:center;display:;"><?php 
        $cur_trf = get_traffic(TRAFFIC_LST);
        echo bytesToKbOrMbOrGb($cur_trf[0]);
        ?>
</span>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="<?php 
        echo $ajax_serverfiles ? 'if(confirm(\'This will reset Current Traffic, proceed?\')){trafst();}' : 'alert(\'Ajax Disabled\');';
        ?>
;"><small>reset</small></a></b></span></span> 
<div style="height:3px;">&nbsp;</div>
<div style="float:left;">The D-Day traffic quota will expired</div><br><div style="height:3px;">&nbsp;</div>
<div style="float:left;">Auto-Reset traffic. set to 0 or blank to disable.
<?php 
        if ($day_reset_trafic > 0) {
            echo "<small class='g'>remain: " . sec2time(timeremain_traffic($day_reset_trafic, $cur_trf[1])) . "</small>";
        }
        ?>
</div>
<?php 
开发者ID:ahmednitul,项目名称:movie-thumbnailer,代码行数:31,代码来源:xpanelform.tpl.php

示例12: UploadToYoutube

function UploadToYoutube($host, $port, $url, $dkey, $uauth, $XMLReq, $file, $filename)
{
    global $nn, $lastError, $sleep_time, $sleep_count;
    if (!is_readable($file)) {
        $lastError = sprintf(lang(65), $file);
        return FALSE;
    }
    $fileSize = getSize($file);
    $bound = "--------" . md5(microtime());
    $saveToFile = 0;
    $postdata = "--" . $bound . $nn;
    $postdata .= 'Content-Type: application/atom+xml; charset=UTF-8' . $nn . $nn;
    $postdata .= $XMLReq . $nn;
    $postdata .= "--" . $bound . $nn;
    $postdata .= "Content-Type: application/octet-stream" . $nn . $nn;
    $zapros = "POST " . str_replace(" ", "%20", $url) . " HTTP/1.1{$nn}Host: {$host}{$nn}Authorization: GoogleLogin auth={$uauth}{$nn}GData-Version: 2.1{$nn}X-GData-Key: key={$dkey}{$nn}Slug: {$filename}{$nn}Content-Type: multipart/related; boundary={$bound}{$nn}Content-Length: " . (strlen($postdata) + strlen($nn . "--{$bound}--{$nn}") + $fileSize) . "{$nn}Connection: Close{$nn}{$nn}{$postdata}";
    $errno = 0;
    $errstr = "";
    $fp = @stream_socket_client("{$host}:{$port}", $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
    if (!$fp) {
        html_error(sprintf(lang(88), $host, $port));
    }
    if ($errno || $errstr) {
        html_error($errstr);
    }
    echo "<p>";
    printf(lang(90), $host, $port);
    echo "</p>";
    echo lang(104) . ' <b>' . $filename . '</b>, ' . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fileSize) . '</b>...<br />';
    global $id;
    $id = md5(time() * rand(0, 10));
    require TEMPLATE_DIR . '/uploadui.php';
    flush();
    $timeStart = getmicrotime();
    $chunkSize = GetChunkSize($fileSize);
    fputs($fp, $zapros);
    fflush($fp);
    $fs = fopen($file, 'r');
    $local_sleep = $sleep_count;
    $totalsend = $time = $lastChunkTime = 0;
    while (!feof($fs) && !$errno && !$errstr) {
        $data = fread($fs, $chunkSize);
        if ($data === false) {
            fclose($fs);
            fclose($fp);
            html_error(lang(112));
        }
        if ($sleep_count !== false && $sleep_time !== false && is_numeric($sleep_time) && is_numeric($sleep_count) && $sleep_count > 0 && $sleep_time > 0) {
            $local_sleep--;
            if ($local_sleep == 0) {
                usleep($sleep_time);
                $local_sleep = $sleep_count;
            }
        }
        $sendbyte = @fputs($fp, $data);
        fflush($fp);
        if ($sendbyte === false || strlen($data) > $sendbyte) {
            fclose($fs);
            fclose($fp);
            html_error(lang(113));
        }
        $totalsend += $sendbyte;
        $time = getmicrotime() - $timeStart;
        $chunkTime = $time - $lastChunkTime;
        $chunkTime = $chunkTime ? $chunkTime : 1;
        $chunkTime = !($chunkTime < 0) && $chunkTime > 0 ? $chunkTime : 1;
        $lastChunkTime = $time;
        $speed = round($sendbyte / 1024 / $chunkTime, 2);
        $percent = round($totalsend / $fileSize * 100, 2);
        echo "<script type='text/javascript'>pr('{$percent}', '" . bytesToKbOrMbOrGb($totalsend) . "', '{$speed}');</script>\n";
        flush();
    }
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    fclose($fs);
    fputs($fp, $nn . "--" . $bound . "--" . $nn);
    fflush($fp);
    $page = '';
    while (!feof($fp)) {
        $data = fgets($fp, 16384);
        if ($data === false) {
            break;
        }
        $page .= $data;
    }
    fclose($fp);
    return $page;
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:90,代码来源:youtube.com.php

示例13: get_inf

 private function get_inf($url = '')
 {
     if (!val('url', $url)) {
         return '["get_inf", "erro", "' . $this->msgs['url_invalido'] . '"]';
     }
     $inf = getheader($url);
     if (is_array($inf)) {
         if ($inf['http_code'] == 200) {
             $rpt = '<li><b>' . $this->msgs['tipo'] . ':</b> ' . $inf['content_type'] . '</li>';
             if ($inf['download_content_length']) {
                 $rpt .= '<li><b>' . $this->msgs['tamanho'] . ':</b> ' . bytesToKbOrMbOrGb($inf['download_content_length']) . '</li>';
             }
             $rpt .= '<br>';
             return '["get_inf", "' . $rpt . '"]';
         } elseif (isset($this->__config['http_code'][$inf['http_code']])) {
             $erro = str_replace('%file%', '<b>' . $url . '</b>', $this->__config['http_code'][$inf['http_code']]);
             return '["get_inf", "erro", "' . $erro . '"]';
         } else {
             return '["get_inf", "erro", "' . $this->msgs['erro_desconhecido'] . '"]';
         }
     }
     return '["get_inf", "erro", "' . $this->msgs['erro_desconhecido'] . '"]';
 }
开发者ID:lucascudo,项目名称:comunique,代码行数:23,代码来源:TretaImgUpload.class.php

示例14: T8_mega_upload

function T8_mega_upload($link, $ul_key, $file, $filename, &$mac_str = '')
{
    global $nn, $fp, $fs, $errno, $errstr, $fsize, $pbChunkSize, $T8, $chunk_UL, $calcMacEachChunk, $zapros;
    $pbChunkSize = GetChunkSize($fsize);
    $_link = parse_url($link);
    $scheme = $_link['scheme'] . '://';
    $host = $_link['host'];
    $port = defport($_link);
    $url = $_link['path'] . (!empty($_link['query']) ? '?' . $_link['query'] : '');
    unset($_link);
    $key = a32_to_str(array_slice($ul_key, 0, 4));
    $_td = mcrypt_module_open('rijndael-128', '', 'ctr', '');
    $init = mcrypt_generic_init($_td, $key, a32_to_str(array($ul_key[4], $ul_key[5], 0, 0)));
    if ($init === false || $init < 0) {
        html_error('Cannot init mcrypt');
    }
    if (!is_readable($file)) {
        html_error(sprintf(lang(65), $file));
    }
    echo "\n<p id='ul_con'></p>\n<p id='ul_fname' style='display:none'>" . lang(104) . " <b>{$filename}</b>, " . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fsize) . "</b>...<br /></p><p id='T8' style='display:none'></p>\n";
    flush();
    if ($chunk_UL) {
        global $chunkSize, $timeStart, $data, $totalsend, $time, $lastChunkTime;
    } else {
        chunk_ul($scheme, $host, $port, $url, true);
    }
    $fs = fopen($file, 'rb');
    $chunkSize = 131072;
    $totalsend = $time = $lastChunkTime = 0;
    $_data = '';
    if ($calcMacEachChunk) {
        global $m_td1, $m_td2;
        $m_td1 = mcrypt_module_open('rijndael-128', '', 'cbc', '');
        $m_td2 = mcrypt_module_open('rijndael-128', '', 'cbc', '');
        $init = mcrypt_generic_init($m_td1, $key, "");
        if ($init === false || $init < 0) {
            html_error('Cannot init mcrypt');
        }
        $c_mac = a32_to_str(array($ul_key[4], $ul_key[5], $ul_key[4], $ul_key[5]));
    }
    $timeStart = microtime(true);
    while (!feof($fs) && !$errno && !$errstr) {
        $data = fread($fs, $chunkSize);
        if ($data === false) {
            if (isset($GLOBALS['T8DEBUG'])) {
                textarea("UPLOAD\nRAW Request:\n" . $zapros . "[Incomplete File Content]", 200, 15);
            }
            //Debug
            fclose($fs);
            if (!$chunk_UL) {
                fclose($fp);
            }
            html_error(lang(112));
        }
        if ($_data !== '') {
            $data = $_data . $data;
            $_data = '';
        }
        if (strlen($data) < $chunkSize && !feof($fs)) {
            $_data .= $data;
            continue;
        }
        if (strlen($data) > $chunkSize) {
            $_data .= substr($data, $chunkSize);
            $data = substr($data, 0, $chunkSize);
        }
        if ($calcMacEachChunk) {
            $mac_str = calcChunkMac($data, $key, $c_mac);
        }
        if ($chunkSize < 1048576) {
            $chunkSize = getNextChunkLength($chunkSize);
        }
        $data = mcrypt_generic($_td, $data);
        if ($chunk_UL) {
            $page = chunk_ul($scheme, $host, $port, "{$url}/{$totalsend}-" . ($totalsend + strlen($data) - 1));
        } else {
            $dlen = strlen($data);
            $sended = 0;
            for ($s = 0; $s < $dlen - 1; $s += $pbChunkSize) {
                $chunk = $pbChunkSize >= $dlen - $s ? substr($data, $s) : substr($data, $s, $pbChunkSize);
                $sendbyte = @fputs($fp, $chunk);
                fflush($fp);
                if ($sendbyte === false || strlen($chunk) > $sendbyte) {
                    if (isset($GLOBALS['T8DEBUG'])) {
                        textarea("UPLOAD\n{$errstr}\n" . print_r(stream_get_meta_data($fp), true) . "\nRAW Request:\n" . $zapros . "[Incomplete File Content]", 200, 15);
                    }
                    //Debug
                    fclose($fs);
                    fclose($fp);
                    html_error(lang(113));
                }
                $totalsend += $sendbyte;
                $sended += $sendbyte;
                $time = getmicrotime() - $timeStart;
                $chunkTime = $time - $lastChunkTime;
                if ($s + $sendbyte <= $dlen - 1 && $chunkTime < 1) {
                    continue;
                }
                $chunkTime = !($chunkTime < 0) && $chunkTime > 0 ? $chunkTime : 1;
                $lastChunkTime = $time;
//.........这里部分代码省略.........
开发者ID:Transcodes,项目名称:rapidleech,代码行数:101,代码来源:mega.co.nz_member.php

示例15: unrar_go_go

function unrar_go_go()
{
    global $options, $list, $L;
    ?>
<script type="text/javascript">
/* <![CDATA[ */
function rar_st(elementid, st){
  document.getElementById(elementid).innerHTML = st;
  return true;
}
/* ]]> */
</script>
<?php 
    for ($i = 0; $i < count($_GET["files"]); $i++) {
        $file = $list[$_GET["files"][$i]];
        if (count($_GET['filestounrar'][$i]) == 0) {
            continue;
        }
        foreach ($_GET['filestounrar'][$i] as $rar_item) {
            flush();
            $rar = new rlRar($file["name"], $options['check_these_before_unzipping'] ? $options['forbidden_filetypes'] : array('.xxx'));
            if ($rar->rar_return === false) {
                ?>
<script type="text/javascript">rar_st('<?php 
                echo 'unrar' . $_GET["files"][$i] . '-' . str_replace('=', '-', $rar_item);
                ?>
', '<?php 
                echo $L->say['rar_disappear'];
                ?>
');</script>
<?php 
            } else {
                $rar_result = $rar->extract(base64_decode($rar_item), $options['download_dir'], $_GET['passwords'][$i], 'unrar' . $_GET["files"][$i] . '-' . str_replace('=', '-', $rar_item), $i);
                echo $rar_result;
                if (strpos($rar_result, ", 'OK')") !== false) {
                    _create_list();
                    $rar_tolist = realpath($options['download_dir']) . '/' . basename(base64_decode($rar_item));
                    $time = getNowzone(@filemtime($rar_tolist));
                    while (isset($list[$time])) {
                        $time++;
                    }
                    $list[$time] = array("name" => $rar_tolist, "size" => bytesToKbOrMbOrGb(filesize($rar_tolist)), "date" => $time);
                    if (!updateListInFile($list)) {
                        ?>
<script type="text/javascript">var tmp = document.getElementById('rar_finished'); tmp.innerHTML = "<?php 
                        echo $L->say['couldnt_upd_list'];
                        ?>
<br /><br />" + tmp.innerHTML</script>;
<?php 
                    }
                }
            }
        }
    }
    ?>
<script type="text/javascript">document.getElementById('unrar_finished').style.display = '';</script>
<?php 
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:58,代码来源:unrar.php


注:本文中的bytesToKbOrMbOrGb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。