• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP updateListInFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rename_go

function rename_go()
{
    global $list, $options;
    $smthExists = FALSE;
    for ($i = 0; $i < count($_POST["files"]); $i++) {
        $file = $list[$_POST["files"][$i]];
        if (file_exists($file["name"])) {
            $smthExists = TRUE;
            $newName = dirname($file["name"]) . PATH_SPLITTER . stripslashes(basename($_POST["newName"][$i]));
            $filetype = strrchr($newName, ".");
            if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
                printf(lang(82), $filetype);
                echo "<br /><br />";
            } else {
                if (@rename($file["name"], $newName)) {
                    printf(lang(194), $file['name'], basename($newName));
                    echo "<br /><br />";
                    $list[$_POST["files"][$i]]["name"] = $newName;
                } else {
                    printf(lang(202), $file['name']);
                    echo "<br /><br />";
                }
            }
        } else {
            printf(lang(145), $file['name']);
            echo "<br /><br />";
        }
    }
    if ($smthExists) {
        if (!updateListInFile($list)) {
            echo lang(9) . "<br /><br />";
        }
    }
}
开发者ID:leglo,项目名称:rapidleech,代码行数:34,代码来源:rename.php


示例2: 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


示例3: delete_go

function delete_go()
{
    global $list, $PHP_SELF;
    if (isset($_POST["yes"])) {
        for ($i = 0; $i < count($_POST["files"]); $i++) {
            $file = $list[$_POST["files"][$i]];
            if (file_exists($file["name"])) {
                if (@unlink($file["name"])) {
                    printf(lang(151), $file['name']);
                    echo "<br />";
                    unset($list[$_POST["files"][$i]]);
                } else {
                    printf(lang(152), $file['name']);
                    echo "<br />";
                }
            } else {
                unset($list[$_POST["files"][$i]]);
                printf(lang(145), $file['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:mewtutorial,项目名称:rapidleech-ultimate,代码行数:28,代码来源:delete.php


示例4: delete_go

function delete_go()
{
    global $list, $PHP_SELF, $L;
    if (isset($_POST["yes"])) {
        for ($i = 0; $i < count($_POST["files"]); $i++) {
            $file = $list[$_POST["files"][$i]];
            if (file_exists($file["name"])) {
                if (@unlink($file["name"])) {
                    echo $L->sprintf($L->say['_filedel'], htmlspecialchars(basename($file['name']))) . "<br /><br />";
                    unset($list[$_POST["files"][$i]]);
                } else {
                    echo $L->sprintf($L->say['error_delete'], htmlspecialchars(basename($file['name']))) . "<br /><br />";
                }
            } else {
                unset($list[$_POST["files"][$i]]);
                echo $L->sprintf($L->say['not_found'], htmlspecialchars(basename($file['name']))) . "<br />";
            }
        }
        if (!updateListInFile($list)) {
            echo "<b class=\"r\">" . $L->say['error_upd_list'] . "</b><br /><br />";
        }
    } else {
        echo '<script type="text/javascript">location.href="' . $PHP_SELF . '?act=files";</script>';
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:25,代码来源:delete.php


示例5: mrename_go

function mrename_go()
{
    global $list, $options, $PHP_SELF, $L;
    if ($_POST["yes"] && @trim($_POST['extension'])) {
        $_POST['extension'] = @trim($_POST['extension']);
        while ($_POST['extension'][0] == '.') {
            $_POST['extension'] = substr($_POST['extension'], 1);
        }
        if ($_POST[extension]) {
            for ($i = 0; $i < count($_POST["files"]); $i++) {
                $file = $list[$_POST["files"][$i]];
                if (file_exists($file["name"])) {
                    $filetype = '.' . strtolower($_POST['extension']);
                    if (is_array($options['forbidden_filetypes']) && in_array('.' . strtolower($_POST['extension']), $options['forbidden_filetypes'])) {
                        echo $L->sprintf($L->say['forbidden_rename'], $filetype) . '<br /><br />';
                    } else {
                        if (@rename($file["name"], fixfilename($file["name"] . ".{$_POST['extension']}"))) {
                            echo $L->sprintf($L->say['_renamed_to'] . '<br />', basename($file['name']), fixfilename(basename($file["name"] . ".{$_POST['extension']}")));
                            $list[$_POST["files"][$i]]["name"] .= '.' . $_POST['extension'];
                            $list[$_POST["files"][$i]]["name"] = fixfilename($list[$_POST["files"][$i]]["name"]);
                        } else {
                            echo $L->sprintf($L->say['_error_ren'], basename($file['name'])) . '<br />';
                        }
                    }
                } else {
                    echo $L->sprintf($L->say['not_found'], basename($file['name'])) . '<br />';
                }
            }
            if (!updateListInFile($list)) {
                echo "<b class=\"r\">" . $L->say['error_upd_list'] . "</b><br />";
            }
        }
    } else {
        ?>
<script type="text/javascript">location.href="<?php 
        echo $PHP_SELF . "?act=files";
        ?>
";</script>
<?php 
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:41,代码来源:mrename.php


示例6: 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


示例7: merge_go


//.........这里部分代码省略.........
                        $data_ = explode('=', trim(fgets($fs)), 2);
                        $data[$data_[0]] = $data_[1];
                    }
                    fclose($fs);
                }
                $path = realpath(DOWNLOAD_DIR) . PATH_SPLITTER;
                $filename = basename($data['filename']);
                $partfiles = array();
                $partsSize = 0;
                for ($j = 1; $j < 10000; $j++) {
                    if (!is_file($path . $filename . '.' . sprintf("%03d", $j))) {
                        if ($j == 1) {
                            $partsSize = -1;
                        }
                        break;
                    }
                    $partfiles[] = $path . $filename . '.' . sprintf("%03d", $j);
                    $partsSize += filesize($path . $filename . '.' . sprintf("%03d", $j));
                }
                if (file_exists($path . $filename)) {
                    printf(lang(179), $path . $filename);
                    echo "<br /><br />";
                } elseif ($usingcrcfile && $partsSize != $data['size']) {
                    echo lang(180) . "<br /><br />";
                } elseif ($options['check_these_before_unzipping'] && is_array($options['forbidden_filetypes']) && in_array(strtolower(strrchr($filename, ".")), $options['forbidden_filetypes'])) {
                    printf(lang(181), strrchr($filename, "."));
                    echo "<br /><br />";
                } else {
                    $merge_buffer_size = 2 * 1024 * 1024;
                    $merge_dest = @fopen($path . $filename, "wb");
                    if (!$merge_dest) {
                        printf(lang(182), $path . $filename);
                        echo "<br /><br />";
                    } else {
                        $merge_ok = true;
                        foreach ($partfiles as $part) {
                            $merge_source = @fopen($part, "rb");
                            while (!feof($merge_source)) {
                                $merge_buffer = fread($merge_source, $merge_buffer_size);
                                if ($merge_buffer === false) {
                                    printf(lang(65), $part);
                                    echo "<br /><br />";
                                    $merge_ok = false;
                                    break;
                                }
                                if (fwrite($merge_dest, $merge_buffer) === false) {
                                    printf(lang(183), $path . $filename);
                                    echo "<br /><br />";
                                    $merge_ok = false;
                                    break;
                                }
                            }
                            fclose($merge_source);
                            if (!$merge_ok) {
                                break;
                            }
                        }
                        fclose($merge_dest);
                        if ($merge_ok) {
                            $fc = $_POST['crc_mode'] == 'file_read' ? dechex(crc32(read_file($path . $filename))) : ($_POST['crc_mode'] == 'hash_file' && function_exists('hash_file') ? hash_file('crc32b', $path . $filename) : '111111');
                            $fc = str_repeat("0", 8 - strlen($fc)) . strtoupper($fc);
                            if ($fc != strtoupper($data["crc32"])) {
                                echo lang(184) . "<br /><br />";
                            } else {
                                printf(lang(185), $filename);
                                echo '!<br /><br />';
                                if ($usingcrcfile && $fc != '00111111' && $_POST["del_ok"] && !$options['disable_deleting']) {
                                    if ($usingcrcfile) {
                                        $partfiles[] = $file["name"];
                                    }
                                    foreach ($partfiles as $part) {
                                        if (@unlink($part)) {
                                            foreach ($list as $list_key => $list_file) {
                                                if ($list_file["name"] === $part) {
                                                    unset($list[$list_key]);
                                                }
                                            }
                                            echo "<b>" . basename($part) . "</b> " . lang(186) . ".<br />";
                                        } else {
                                            echo "<b>" . basename($part) . "</b> " . lang(187) . ".<br />";
                                        }
                                    }
                                    echo "<br />";
                                }
                                $time = filemtime($path . $filename);
                                while (isset($list[$time])) {
                                    $time++;
                                }
                                $list[$time] = array("name" => $path . $filename, "size" => bytesToKbOrMbOrGb($partsSize), "date" => $time);
                                if (!updateListInFile($list)) {
                                    echo lang(146) . "<br /><br />";
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:sayedharounokpay,项目名称:LikesPlanet,代码行数:101,代码来源:merge.php


示例8: rename_go

function rename_go()
{
    global $list, $options, $L;
    $smthExists = FALSE;
    for ($i = 0; $i < count($_POST["files"]); $i++) {
        $file = $list[$_POST["files"][$i]];
        if (file_exists($file["name"])) {
            $smthExists = TRUE;
            $newName = dirname($file["name"]) . PATH_SPLITTER . stripslashes(basename($_POST["newName"][$i]));
            $rest = substr($newName, -1);
            if (!preg_match("/^[a-zA-Z0-9_]+\$/i", $rest)) {
                $alpnum = false;
            } else {
                $alpnum = true;
            }
            while (!$alpnum and strlen($newName) > 0) {
                $newName = substr($newName, 0, -1);
                $rest = substr($newName, -1);
                if (!preg_match("/^[a-zA-Z0-9_]+\$/i", $rest)) {
                    $alpnum = false;
                } else {
                    $alpnum = true;
                }
            }
            $filetype = strrchr($newName, ".");
            if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
                echo $L->sprintf($L->say['forbidden_rename'], $filetype) . "<br /><br />";
            } else {
                if (@rename($file["name"], $newName)) {
                    echo $L->sprintf($L->say['_renamed_to'], htmlspecialchars($file["name"]), htmlspecialchars(basename($newName))) . "<br /><br />";
                    $list[$_POST["files"][$i]]["name"] = $newName;
                } else {
                    echo $L->sprintf($L->say['couldnt_rename_to'], $file['name']) . "<br /><br />";
                }
            }
        } else {
            echo $L->sprintf($L->say['not_found'], $file['name']) . "<br /><br />";
        }
    }
    if ($smthExists) {
        if (!updateListInFile($list)) {
            echo $L->say['couldnt_upd'] . "<br /><br />";
        }
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:45,代码来源:rename.php


示例9: pack_go

function pack_go()
{
    global $list, $options;
    $arc_name = basename($_POST["arc_name"] . '.' . $_POST["arc_ext"]);
    $saveTo = ($options['download_dir_is_changeable'] ? stripslashes($_POST["saveTo"][$i]) : realpath($options['download_dir'])) . '/';
    $v_list = array();
    if (!$_POST["arc_name"] || !$_POST["arc_ext"]) {
        echo lang(196) . "<br /><br />";
    } elseif (file_exists($saveTo . $arc_name)) {
        printf(lang(179), $arc_name);
        echo "<br /><br />";
    } else {
        for ($i = 0; $i < count($_POST["files"]); $i++) {
            $file = $list[$_POST["files"][$i]];
            if (file_exists($file["name"])) {
                $v_list[] = $file["name"];
            } else {
                printf(lang(145), $file['name']);
                echo "<br /><br />";
            }
        }
        if (count($v_list) < 1) {
            echo lang(137) . "<br /><br />";
        } else {
            $arc_name = $saveTo . $arc_name;
            require_once CLASS_DIR . "tar.php";
            $tar = new Archive_Tar($arc_name);
            if ($tar->error != '') {
                echo $tar->error . "<br /><br />";
            } else {
                $remove_path = realpath($options['download_dir']) . '/';
                $tar->createModify($v_list, '', $remove_path);
                if (!file_exists($arc_name)) {
                    echo lang(197) . "<br /><br />";
                } else {
                    if (count($v_list = $tar->listContent()) > 0) {
                        for ($i = 0; $i < sizeof($v_list); $i++) {
                            printf(lang(198), $v_list[$i]['filename']);
                            echo " <br />";
                        }
                        printf(lang(199), $arc_name);
                        echo "<br />";
                        $stmp = strtolower($arc_name);
                        $arc_method = "Tar";
                        if (!$options['disable_archive_compression']) {
                            if (strrchr($stmp, "tar.gz") + 5 == strlen($stmp)) {
                                $arc_method = "Tar.gz";
                            } elseif (strrchr($stmp, "tar.bz2") + 6 == strlen($stmp)) {
                                $arc_method = "Tar.bz2";
                            }
                        }
                        unset($stmp);
                        $time = explode(" ", microtime());
                        $time = str_replace("0.", $time[1], $time[0]);
                        $list[$time] = array("name" => $arc_name, "size" => bytesToKbOrMbOrGb(filesize($arc_name)), "date" => $time, "link" => "", "comment" => "archive " . $arc_method);
                    } else {
                        echo lang(200) . "<br /><br />";
                    }
                    if (!updateListInFile($list)) {
                        echo lang(9) . '<br /><br />';
                    }
                }
            }
        }
    }
}
开发者ID:mewtutorial,项目名称:RapidTube,代码行数:66,代码来源:pack.php


示例10: boxes_go

function boxes_go()
{
    global $list, $options, $fromaddr, $L;
    require_once CLASS_DIR . "mail.php";
    $_POST["partSize"] = isset($_POST["partSize"]) & $_POST["split"] == "on" ? $_POST["partSize"] * 1024 * 1024 : FALSE;
    $v_mails = explode("\n", $_POST['emails']);
    $v_min = count(count($_POST["files"]) < count($v_mails) ? $_POST["files"] : $v_mails);
    for ($i = 0; $i < $v_min; $i++) {
        $file = $list[$_POST["files"][$i]];
        $v_mail = trim($v_mails[$i]);
        if (!checkmail($v_mail)) {
            echo $L->sprintf($L->say['invalid_email_addr'], $v_mail) . "<br /><br />";
        } elseif (file_exists($file["name"])) {
            if (xmail("{$fromaddr}", $v_mail, "File " . basename($file["name"]), "File: " . basename($file["name"]) . "\r\n" . "Link: " . $file["link"] . ($file["comment"] ? "\r\nComments: " . str_replace("\\r\\n", "\r\n", $file["comment"]) : ""), $file["name"], $_POST["partSize"], $_POST["method"])) {
                if ($_POST["del_ok"] && !$options['disable_to']['act_del']) {
                    if (@unlink($file["name"])) {
                        $v_ads = " " . $L->says['_and_del'];
                        unset($list[$_POST["files"][$i]]);
                    } else {
                        $v_ads = ", " . $L->say['_but'] . " <b>" . $L->say['_not_del'] . "</b>";
                    }
                } else {
                    $v_ads = " !";
                }
                echo '<script type="text/javascript">' . "mail('File <b>" . basename($file["name"]) . "</b> it is sent for the address <b>" . $v_mail . "</b>" . $v_ads . "', '" . md5(basename($file["name"])) . "');</script>\r\n<br />";
            } else {
                echo "<b class=\"r\">" . $L->say['error_send'] . "</b><br />";
            }
        } else {
            echo $L->sprintf($L->say['not_found'], $file['name']) . "<br /><br />";
        }
    }
    if (count($_POST["files"]) < count($v_mails)) {
        for ($i = count($_POST["files"]); $i < count($v_mails); $i++) {
            $v_mail = trim($v_mails[$i]);
            echo "{$v_mail}.</b><br /><br />";
        }
        echo "</b><br />";
    } elseif (count($_POST["files"]) > count($v_mails)) {
        for ($i = count($v_mails); $i < count($_POST["files"]); $i++) {
            $file = $list[$_POST["files"][$i]];
            if (file_exists($file["name"])) {
                echo $file["name"] . "<br /><br />";
            } else {
                echo $L->sprintf($L->say['not_found'], $file['name']) . "<br /><br />";
            }
        }
        echo "<br />";
    }
    if ($_POST["del_ok"]) {
        if (!updateListInFile($list)) {
            echo $L->say['error_upd_list'] . "<br /><br />";
        }
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:55,代码来源:boxes.php


示例11: str_replace

        $oldName = $fileName;
        $newName = str_replace("~", "", iconv("UTF-8", "ISO-8859-1//TRANSLIT", rawurldecode(base64_decode($partFN[1]))));
        $newName = dirname($oldName) . PATH_SPLITTER . $newName;
        $filetype = strrchr($newName, ".");
        if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
            // ERROR
            echo "((suc))0((/suc))<msg>" . $L->sprintf($L->say['forbidden_rename'], $filetype) . "</msg>";
        } else {
            if (@rename($oldName, $newName)) {
                $smthExists = TRUE;
                foreach ($list as $key => $file) {
                    if ($file["name"] == $oldName) {
                        $list[$key] = $lineset;
                        $list[$key]["name"] = $newName;
                    }
                }
                echo "((suc))1((/suc))<msg>" . $L->say['_file'] . " " . basename($oldName) . " " . $L->say['rename_to'] . " <b>" . basename($newName) . " {$postFName}</msg>";
            } else {
                // ERROR
                echo "((suc))0((/suc))<msg>" . $L->sprintf($L->say['forbidden_rename'], $filetype) . "</msg>";
            }
        }
    } else {
        echo "((suc))0((/suc))<msg>" . $L->say['_file'] . " [" . $partFN[0] . "] " . $fileName . " " . $L->say['not_found'] . "\n" . print_r($list, true) . "</msg>";
    }
    if ($smthExists) {
        if (!updateListInFile($list)) {
            echo "((suc))0((/suc))<msg>" . $L->say['couldnt_upd'] . "</msg>";
        }
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:31,代码来源:inst_rename.php


示例12: split_go

function split_go()
{
    global $list, $options, $L;
    for ($i = 0; $i < count($_POST["files"]); $i++) {
        $split_ok = true;
        $file = $list[$_POST["files"][$i]];
        $partSize = round($_POST["partSize"][$i] * 1024 * 1024);
        $saveTo = ($options['download_dir_is_changeable'] ? stripslashes($_POST["saveTo"][$i]) : realpath($options['download_dir'])) . '/';
        $dest_name = basename($file["name"]);
        $fileSize = filesize($file["name"]);
        $totalParts = ceil($fileSize / $partSize);
        $crc = $_POST['crc_mode'][$i] == 'file_read' ? dechex(crc32(read_file($file["name"]))) : ($_POST['crc_mode'][$i] == 'hash_file' && function_exists('hash_file') ? hash_file('crc32b', $file["name"]) : '111111');
        $crc = str_repeat("0", 8 - strlen($crc)) . strtoupper($crc);
        echo $L->say["start_split"] . " <b>" . basename($file["name"]) . "</b> parts of " . bytesToKbOrMbOrGb($partSize) . ", Using Method - Total Commander...<br />";
        echo $L->say["tot_part"] . ": <b>" . $totalParts . "</b><br /><br />";
        for ($j = 1; $j <= $totalParts; $j++) {
            if (file_exists($saveTo . $dest_name . '.' . sprintf("%03d", $j))) {
                echo $L->say["split_error"] . " " . $L->say["piece_exist"] . "<b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                continue 2;
            }
        }
        if (file_exists($saveTo . $dest_name . '.crc')) {
            echo $L->say["split_error"] . " " . $L->say["crc_exist"] . "<b>" . $dest_name . '.crc' . "</b> !<br /><br />";
        } elseif (!is_file($file["name"])) {
            echo $L->say["split_error"] . " " . $L->say["src_notfound"] . "<b>" . $file["name"] . "</b> !<br /><br />";
        } elseif (!is_dir($saveTo)) {
            echo $L->say["split_error"] . " " . $L->say["dir_inexist"] . "<b>" . $saveTo . "</b> !<br /><br />";
        } elseif (!@write_file($saveTo . $dest_name . ".crc", "filename=" . $dest_name . "\r\n" . "size=" . $fileSize . "\r\n" . "crc32=" . $crc . "\r\n")) {
            echo $L->say["split_error"] . " CRC Error<b>" . $dest_name . ".crc" . "</b> !<br /><br />";
        } else {
            $time = getNowzone(@filemtime($saveTo . $dest_name . '.crc'));
            while (isset($list[$time])) {
                $time++;
            }
            $list[$time] = array("name" => $saveTo . $dest_name . '.crc', "size" => bytesToKbOrMbOrGb(filesize($saveTo . $dest_name . '.crc')), "date" => $time);
            $split_buffer_size = 2 * 1024 * 1024;
            $split_source = @fopen($file["name"], "rb");
            if (!$split_source) {
                echo $L->say["crc_error_open"] . " <b>" . $file["name"] . "</b> !<br /><br />";
                continue;
            }
            for ($j = 1; $j <= $totalParts; $j++) {
                $split_dest = @fopen($saveTo . $dest_name . '.' . sprintf("%03d", $j), "wb");
                if (!$split_dest) {
                    echo $L->say["error_open_file"] . " <b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                    $split_ok = false;
                    break;
                }
                $split_write_times = floor($partSize / $split_buffer_size);
                for ($k = 0; $k < $split_write_times; $k++) {
                    $split_buffer = fread($split_source, $split_buffer_size);
                    if (fwrite($split_dest, $split_buffer) === false) {
                        echo $L->say["error_write_file"] . " <b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                        $split_ok = false;
                        break;
                    }
                }
                $split_rest = $partSize - $split_write_times * $split_buffer_size;
                if ($split_ok && $split_rest > 0) {
                    $split_buffer = fread($split_source, $split_rest);
                    if (fwrite($split_dest, $split_buffer) === false) {
                        echo $L->say["error_write_file"] . " <b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                        $split_ok = false;
                    }
                }
                fclose($split_dest);
                if ($split_ok) {
                    $time = getNowzone(@filemtime($saveTo . $dest_name . '.' . sprintf("%03d", $j)));
                    while (isset($list[$time])) {
                        $time++;
                    }
                    $list[$time] = array("name" => $saveTo . $dest_name . '.' . sprintf("%03d", $j), "size" => bytesToKbOrMbOrGb(filesize($saveTo . $dest_name . '.' . sprintf("%03d", $j))), "date" => $time);
                }
            }
            fclose($split_source);
            if ($split_ok) {
                if ($_POST["del_ok"] && !$options['disable_to']['act_del']) {
                    if (@unlink($file["name"])) {
                        unset($list[$_POST["files"][$i]]);
                        echo $L->say["source_del"] . "<br /><br />";
                    } else {
                        echo $L->say["source_file_is"] . "<b>" . $L->say["_not_del"] . "</b><br /><br />";
                    }
                }
            }
            if (!updateListInFile($list)) {
                echo $L->say["couldnt_upd_list"] . "<br /><br />";
            }
        }
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:91,代码来源:split.php


示例13: merge_go


//.........这里部分代码省略.........
            if ($usingcrcfile && !$fs) {
                echo $L->say['cant_read_crc_file'] . "<br /><br />";
            } else {
                if ($usingcrcfile) {
                    $data = array();
                    while (!feof($fs)) {
                        $data_ = explode('=', trim(fgets($fs)), 2);
                        $data[$data_[0]] = $data_[1];
                    }
                    fclose($fs);
                }
                $path = realpath(DOWNLOAD_DIR) . '/';
                $filename = basename($data['filename']);
                $partfiles = array();
                $partsSize = 0;
                for ($j = 1; $j < 10000; $j++) {
                    if (!is_file($path . $filename . '.' . sprintf("%03d", $j))) {
                        if ($j == 1) {
                            $partsSize = -1;
                        }
                        break;
                    }
                    $partfiles[] = $path . $filename . '.' . sprintf("%03d", $j);
                    $partsSize += filesize($path . $filename . '.' . sprintf("%03d", $j));
                }
                if (file_exists($path . $filename)) {
                    echo $L->sprintf($L->say['err_output_file_exist'], $path . $filename) . "<br /><br />";
                } elseif ($usingcrcfile && $partsSize != $data['size']) {
                    echo $L->say['err_missing_parts'] . "<br /><br />";
                } elseif ($options['check_these_before_unzipping'] && is_array($options['forbidden_filetypes']) && in_array(strtolower(strrchr($filename, ".")), $options['forbidden_filetypes'])) {
                    echo $L->sprintf($L->say['_err_filetype'], strrchr($filename, ".")) . "<br /><br />";
                } else {
                    $merge_buffer_size = 2 * 1024 * 1024;
                    $merge_dest = @fopen($path . $filename, "wb");
                    if (!$merge_dest) {
                        echo $L->sprintf($L->say['imposible_open_dir'], $path . $filename) . "<br /><br />";
                    } else {
                        $merge_ok = true;
                        foreach ($partfiles as $part) {
                            $merge_source = @fopen($part, "rb");
                            while (!feof($merge_source)) {
                                $merge_buffer = fread($merge_source, $merge_buffer_size);
                                if ($merge_buffer === false) {
                                    echo $L->sprintf($L->say['error_read_file'], $part) . "<br /><br />";
                                    $merge_ok = false;
                                    break;
                                }
                                if (fwrite($merge_dest, $merge_buffer) === false) {
                                    echo $L->sprintf($L->say['error_write_file'], $path . $filename) . "<br /><br />";
                                    $merge_ok = false;
                                    break;
                                }
                            }
                            fclose($merge_source);
                            if (!$merge_ok) {
                                break;
                            }
                        }
                        fclose($merge_dest);
                        if ($merge_ok) {
                            $fc = $_POST['crc_mode'] == 'file_read' ? dechex(crc32(read_file($path . $filename))) : ($_POST['crc_mode'] == 'hash_file' && function_exists('hash_file') ? hash_file('crc32b', $path . $filename) : '111111');
                            $fc = str_repeat("0", 8 - strlen($fc)) . strtoupper($fc);
                            if ($fc != strtoupper($data["crc32"])) {
                                echo $L->say['crc32_unmatch'] . "<br /><br />";
                            } else {
                                echo $L->sprintf($L->say['success_merge'], $filename) . '!<br /><br />';
                                if ($usingcrcfile && $fc != '00111111' && $_POST["del_ok"] && !$options['disable_to']['act_del']) {
                                    if ($usingcrcfile) {
                                        $partfiles[] = $file["name"];
                                    }
                                    foreach ($partfiles as $part) {
                                        if (@unlink($part)) {
                                            foreach ($list as $list_key => $list_file) {
                                                if ($list_file["name"] === $part) {
                                                    unset($list[$list_key]);
                                                }
                                            }
                                            echo "<b>" . basename($part) . "</b> " . $L->say['_deleted'] . ".<br />";
                                        } else {
                                            echo "<b>" . basename($part) . "</b> " . $L->say['_not_del'] . ".<br />";
                                        }
                                    }
                                    echo "<br />";
                                }
                                $time = getNowzone(@filemtime($path . $filename));
                                while (isset($list[$time])) {
                                    $time++;
                                }
                                $list[$time] = array("name" => $path . $filename, "size" => bytesToKbOrMbOrGb($partsSize), "date" => $time);
                                if (!updateListInFile($list)) {
                                    echo $L->say['couldnt_upd_list'] . "<br /><br />";
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:laiello,项目名称:rapidleech36b,代码行数:101,代码来源:merge.php


示例14: split_go

function split_go()
{
    global $list, $options;
    for ($i = 0; $i < count($_POST["files"]); $i++) {
        $split_ok = true;
        $file = $list[$_POST["files"][$i]];
        $partSize = round($_POST["partSize"][$i] * 1024 * 1024);
        $saveTo = ($options['download_dir_is_changeable'] ? stripslashes($_POST["saveTo"][$i]) : realpath($options['download_dir'])) . '/';
        $dest_name = basename($file["name"]);
        $fileSize = filesize($file["name"]);
        $totalParts = ceil($fileSize / $partSize);
        $crc = $_POST['crc_mode'][$i] == 'file_read' ? dechex(crc32(read_file($file["name"]))) : ($_POST['crc_mode'][$i] == 'hash_file' && function_exists('hash_file') ? hash_file('crc32b', $file["name"]) : '111111');
        $crc = str_repeat("0", 8 - strlen($crc)) . strtoupper($crc);
        echo "Started to split file <b>" . basename($file["name"]) . "</b> parts of " . bytesToKbOrMbOrGb($partSize) . ", Using Method - Total Commander...<br />";
        echo "Total Parts: <b>" . $totalParts . "</b><br /><br />";
        for ($j = 1; $j <= $totalParts; $j++) {
            if (file_exists($saveTo . $dest_name . '.' . sprintf("%03d", $j))) {
                echo "It is not possible to split the file. A piece already exists<b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                continue 2;
            }
        }
        if (file_exists($saveTo . $dest_name . '.crc')) {
            echo "It is not possible to split the file. CRC file already exists<b>" . $dest_name . '.crc' . "</b> !<br /><br />";
        } elseif (!is_file($file["name"])) {
            echo "It is not possible to split the file. Source file not found<b>" . $file["name"] . "</b> !<br /><br />";
        } elseif (!is_dir($saveTo)) {
            echo "It is not possible to split the file. Directory doesn't exist<b>" . $saveTo . "</b> !<br /><br />";
        } elseif (!@write_file($saveTo . $dest_name . ".crc", "filename=" . $dest_name . "\r\n" . "size=" . $fileSize . "\r\n" . "crc32=" . $crc . "\r\n")) {
            echo "It is not possible to split the file. CRC Error<b>" . $dest_name . ".crc" . "</b> !<br /><br />";
        } else {
            $time = filemtime($saveTo . $dest_name . '.crc');
            while (isset($list[$time])) {
                $time++;
            }
            $list[$time] = array("name" => $saveTo . $dest_name . '.crc', "size" => bytesToKbOrMbOrGb(filesize($saveTo . $dest_name . '.crc')), "date" => $time);
            $split_buffer_size = 2 * 1024 * 1024;
            $split_source = @fopen($file["name"], "rb");
            if (!$split_source) {
                echo "It is not possible to open source file <b>" . $file["name"] . "</b> !<br /><br />";
                continue;
            }
            for ($j = 1; $j <= $totalParts; $j++) {
                $split_dest = @fopen($saveTo . $dest_name . '.' . sprintf("%03d", $j), "wb");
                if (!$split_dest) {
                    echo "Error openning file <b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                    $split_ok = false;
                    break;
                }
                $split_write_times = floor($partSize / $split_buffer_size);
                for ($k = 0; $k < $split_write_times; $k++) {
                    $split_buffer = fread($split_source, $split_buffer_size);
                    if (fwrite($split_dest, $split_buffer) === false) {
                        echo "Error writing the file <b>" . $dest_name . '.' . sprintf("%03d", $j) . "</b> !<br /><br />";
                        $split_ok = false;
                        break;
                    }
                }
                $split_rest = $partSize - $split_write_times * $spli 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP updateLog函数代码示例发布时间:2022-05-23
下一篇:
PHP updateLastMessages函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap