コード例 #1
0
function download_item($dir, $item)
{
    // download file
    // Security Fix:
    $item = basename($item);
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $abs_item = get_abs_item($dir, $item);
    $browser = id_browser();
    header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . filesize($abs_item));
    if ($browser == 'IE') {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
    }
    @readfile($abs_item);
    exit;
}
コード例 #2
0
ファイル: search.php プロジェクト: BACKUPLIB/mwenhanced
/**
 * @version $Id: search.php 98 2008-02-11 17:56:04Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * @author The  The QuiX project (http://quixplorer.sourceforge.net)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 * File-Search Functions
 */
function find_item($dir, $pat, &$list, $recur)
{
    // find items
    $homedir = realpath($GLOBALS['home_dir']);
    $handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir));
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('search', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        if (!$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            continue;
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        // match?
        if (@eregi($pat, $new_item)) {
            $list[] = array($dir, $new_item);
        }
        // search sub-directories
        if (get_is_dir($abs_new_item) && $recur) {
            find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
        }
    }
    $GLOBALS['ext_File']->closedir($handle);
}
コード例 #3
0
function find_item($dir, $pat, &$list, $recur)
{
    // find items
    $handle = @opendir(get_abs_dir($dir));
    if ($handle === false) {
        return;
    }
    // unable to open dir
    while (($new_item = readdir($handle)) !== false) {
        if (!@file_exists(get_abs_item($dir, $new_item))) {
            continue;
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        // match?
        if (@eregi($pat, $new_item)) {
            $list[] = array($dir, $new_item);
        }
        // search sub-directories
        if (get_is_dir($dir, $new_item) && $recur) {
            find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
        }
    }
    closedir($handle);
}
コード例 #4
0
function download_item($dir, $item)
{
    // Security Fix:
    $item = basename($item);
    while (@ob_end_clean()) {
    }
    ob_start();
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $abs_item = get_abs_item($dir, $item);
    $browser = id_browser();
    header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . filesize(realpath($abs_item)));
    //header("Content-Encoding: none");
    if ($browser == 'IE') {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
    }
    @set_time_limit(0);
    @readfile($abs_item);
    ob_end_flush();
    exit;
}
コード例 #5
0
ファイル: delete.php プロジェクト: ejailesb/repo_empr
 function execAction($dir)
 {
     // delete files/dirs
     if (($GLOBALS["permissions"] & 01) != 01) {
         ext_Result::sendResult('delete', false, $GLOBALS["error_msg"]["accessfunc"]);
     }
     // CSRF Security Check
     if (!ext_checkToken($GLOBALS['__POST']["token"])) {
         ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
     }
     $cnt = count($GLOBALS['__POST']["selitems"]);
     $err = false;
     // delete files & check for errors
     for ($i = 0; $i < $cnt; ++$i) {
         $items[$i] = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
         if (ext_isFTPMode()) {
             $abs = get_item_info($dir, $items[$i]);
         } else {
             $abs = get_abs_item($dir, $items[$i]);
         }
         if (!@$GLOBALS['ext_File']->file_exists($abs)) {
             $error[$i] = $GLOBALS["error_msg"]["itemexist"];
             $err = true;
             continue;
         }
         if (!get_show_item($dir, $items[$i])) {
             $error[$i] = $GLOBALS["error_msg"]["accessitem"];
             $err = true;
             continue;
         }
         // Delete
         if (ext_isFTPMode()) {
             $abs = str_replace('\\', '/', get_abs_item($dir, $abs));
         }
         $ok = $GLOBALS['ext_File']->remove($abs);
         if ($ok === false || PEAR::isError($ok)) {
             $error[$i] = $GLOBALS["error_msg"]["delitem"];
             if (PEAR::isError($ok)) {
                 $error[$i] .= ' [' . $ok->getMessage() . ']';
             }
             $err = true;
             continue;
         }
         $error[$i] = NULL;
     }
     if ($err) {
         // there were errors
         $err_msg = "";
         for ($i = 0; $i < $cnt; ++$i) {
             if ($error[$i] == NULL) {
                 continue;
             }
             $err_msg .= $items[$i] . " : " . $error[$i] . ".\n";
         }
         ext_Result::sendResult('delete', false, $err_msg);
     }
     ext_Result::sendResult('delete', true, $GLOBALS['messages']['success_delete_file']);
 }
コード例 #6
0
ファイル: fun_del.php プロジェクト: kosmosby/medicine-prof
function del_items($dir)
{
    $mainframe =& JFactory::getApplication();
    // delete files/dirs
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    $err = false;
    // delete files & check for errors
    for ($i = 0; $i < $cnt; ++$i) {
        $items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        if (nx_isFTPMode()) {
            $abs = get_item_info($dir, $items[$i]);
        } else {
            $abs = get_abs_item($dir, $items[$i]);
        }
        if (!@$GLOBALS['nx_File']->file_exists($abs)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $items[$i])) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        // Delete
        if (nx_isFTPMode()) {
            $abs = get_abs_item($dir, $abs);
        }
        $ok = $GLOBALS['nx_File']->remove($abs);
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $GLOBALS["error_msg"]["delitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<br/>\n";
        }
        show_error($err_msg);
    }
    $mainframe->redirect(make_link("list", $dir, null), $GLOBALS['messages']['success_delete_file']);
}
コード例 #7
0
ファイル: fun_down.php プロジェクト: Caojunkai/arcticfox
function download_item($dir, $item, $unlink = false)
{
    // download file
    global $action, $mosConfig_cache_path;
    // Security Fix:
    $item = basename($item);
    while (@ob_end_clean()) {
    }
    ob_start();
    if (jx_isFTPMode()) {
        $abs_item = $dir . '/' . $item;
    } else {
        $abs_item = get_abs_item($dir, $item);
        if (!strstr($abs_item, realpath($GLOBALS['home_dir']))) {
            $abs_item = realpath($GLOBALS['home_dir']) . $abs_item;
        }
    }
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!$GLOBALS['jx_File']->file_exists($abs_item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    if (jx_isFTPMode()) {
        $abs_item = jx_ftp_make_local_copy($abs_item);
        $unlink = true;
    }
    $browser = id_browser();
    header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . filesize(realpath($abs_item)));
    //header("Content-Encoding: none");
    if ($browser == 'IE') {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
    }
    @set_time_limit(0);
    @readFileChunked($abs_item);
    if ($unlink == true) {
        unlink($abs_item);
    }
    ob_end_flush();
    jx_exit();
}
コード例 #8
0
ファイル: fun_down.php プロジェクト: gilshwartz/quixplorer
function _is_download_allowed($dir, $items)
{
    foreach ($items as $file) {
        if (!permissions_grant($dir, $file, "read")) {
            return false;
        }
        if (!get_show_item($dir, $file)) {
            return false;
        }
        if (!file_exists(get_abs_item($dir, $file))) {
            return false;
        }
    }
    return true;
}
コード例 #9
0
ファイル: down.php プロジェクト: rterbush/nas4free
function download_item($dir, $item)
{
    // Security Fix:
    $item = basename($item);
    if (!permissions_grant($dir, $item, "read")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $abs_item = get_abs_item($dir, $item);
    _download($abs_item, $item);
}
コード例 #10
0
/**
 * @version $Id: search.php 201 2011-06-27 09:45:09Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007-2013
 * @author The eXtplorer project (http://extplorer.net)
 * @author The	The QuiX project (http://quixplorer.sourceforge.net)
 *
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 *
 * File-Search Functions
 */
function find_item($dir, $pat, &$list, $recur, $content)
{
    // find items
    $homedir = realpath($GLOBALS['home_dir']);
    $opendir = $dir;
    if (!is_dir($dir)) {
        $opendir = get_abs_dir($dir);
    }
    $handle = @$GLOBALS['ext_File']->opendir($opendir);
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('search', false, $opendir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        //if(!$GLOBALS['ext_File']->file_exists($abs_new_item)) continue;
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        $isDir = get_is_dir($abs_new_item);
        // match?
        if (@preg_match('@' . $pat . '@is', $new_item) > 0) {
            $list[] = array($dir, $new_item);
        } else {
            if (!$isDir) {
                if ($content && $GLOBALS['ext_File']->filesize($abs_new_item) < 524288) {
                    $data = $GLOBALS['ext_File']->file_get_contents($abs_new_item);
                    //$data = fread($handle, 524288); // Only read first 512kb
                    if (preg_match('@' . $pat . '@is', $data) > 0) {
                        $list[] = array($dir, $new_item);
                    }
                }
            }
        }
        // search sub-directories
        if ($isDir && $recur) {
            find_item($abs_new_item, $pat, $list, $recur, $content);
        }
    }
    $GLOBALS['ext_File']->closedir($handle);
}
コード例 #11
0
ファイル: fun_del.php プロジェクト: morovan/granitpiestany.sk
function del_items($dir)
{
    // check if user is allowed to delete files
    if (!permissions_grant($dir, NULL, "delete")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    $err = false;
    // delete files & check for errors
    for ($i = 0; $i < $cnt; ++$i) {
        $items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        $abs = get_abs_item($dir, $items[$i]);
        if (!@file_exists(get_abs_item($dir, $items[$i]))) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $items[$i])) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        // Delete
        $ok = remove(get_abs_item($dir, $items[$i]));
        if ($ok === false) {
            $error[$i] = $GLOBALS["error_msg"]["delitem"];
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    miwoftp_redirect(make_link("list", $dir, NULL));
}
コード例 #12
0
ファイル: fun_del.php プロジェクト: Zhi2014/cogs
function del_items($dir)
{
    // delete files/dirs
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    $err = false;
    // delete files & check for errors
    for ($i = 0; $i < $cnt; ++$i) {
        $items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        $abs = get_abs_item($dir, $items[$i]);
        if (!@file_exists(get_abs_item($dir, $items[$i]))) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $items[$i])) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        // Delete
        $ok = remove(get_abs_item($dir, $items[$i]));
        if ($ok === false) {
            $error[$i] = $GLOBALS["error_msg"]["delitem"];
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
コード例 #13
0
ファイル: fun_down.php プロジェクト: ZenaVault/FreeNAS-Source
function download_item($dir, $item)
{
    // download file
    // Security Fix:
    $item = base_name($item);
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $abs_item = get_abs_item($dir, $item);
    $browser = id_browser();
    header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . get_file_size($dir, $item));
    header('Content-Description: File Download');
    if ($browser == 'IE') {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $item . '"');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
    }
    //@readfile($abs_item);
    flush();
    $fp = popen("tail -c " . get_file_size($dir, $item) . " {$abs_item} 2>&1", "r");
    while (!feof($fp)) {
        // Send the current file part to the browser.
        print fread($fp, 1024);
        // Flush the content to the browser.
        flush();
    }
    fclose($fp);
    exit;
}
コード例 #14
0
 function execAction($dir, $item, $unlink = false)
 {
     // Security Fix:
     $item = basename($item);
     while (@ob_end_clean()) {
     }
     ob_start();
     if (ext_isFTPMode()) {
         $abs_item = $dir . '/' . $item;
     } else {
         $abs_item = get_abs_item($dir, $item);
         //if( !strstr( $abs_item, $GLOBALS['home_dir']) )
         //	$abs_item = realpath($GLOBALS['home_dir']).$abs_item;
     }
     if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
         ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
         return false;
     }
     if (!get_show_item($dir, $item)) {
         ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
         return false;
     }
     @set_time_limit(0);
     if (ext_isFTPMode()) {
         $abs_item = ext_ftp_make_local_copy($abs_item);
         $unlink = true;
     }
     $browser = id_browser();
     header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . filesize(realpath($abs_item)));
     //header("Content-Encoding: none");
     if (isset($_GET['action2']) && $_GET['action2'] == 'view') {
         $content_disposition = 'inline';
         include_once _EXT_PATH . '/libraries/Archive/file.php';
         $extension = extFile::getExt($item);
         switch (strtolower($extension)) {
             case 'doc':
             case 'dot':
                 $extension = 'msword';
                 break;
             case 'docx':
             case 'dotx':
                 $extension = 'vnd.openxmlformats-officedocument.wordprocessingml.template';
                 break;
             case 'docm':
                 $extension = 'vnd.ms-word.document.macroEnabled.12';
                 break;
             case 'docm':
                 $extension = 'vnd.ms-word.template.macroEnabled.12';
                 break;
             case 'xls':
             case 'xlt':
             case 'xla':
                 $extension = 'vnd.ms-excel';
                 break;
             case 'xlsx':
                 $extension = 'vnd.openxmlformats-officedocument.spreadsheetml.sheet';
                 break;
             case 'xltx':
                 $extension = 'vnd.openxmlformats-officedocument.spreadsheetml.template';
                 break;
             case 'xlsm':
                 $extension = 'vnd.ms-excel.sheet.macroEnabled.12';
                 break;
             case 'xltm':
                 $extension = 'vnd.ms-excel.template.macroEnabled.12';
                 break;
             case 'xlam':
                 $extension = 'vnd.ms-excel.addin.macroEnabled.12';
                 break;
             case 'xlsb':
                 $extension = 'vnd.ms-excel.sheet.binary.macroEnabled.12';
                 break;
             case 'ppt':
             case 'pot':
             case 'pps':
             case 'ppa':
                 $extension = 'vnd.ms-powerpoint';
                 break;
             case 'pptx':
                 $extension = 'vnd.openxmlformats-officedocument.presentationml.presentation';
                 break;
             case 'potx':
                 $extension = 'vnd.openxmlformats-officedocument.presentationml.template';
                 break;
             case 'ppsx':
                 $extension = 'vnd.openxmlformats-officedocument.presentationml.slideshow';
                 break;
             case 'ppam':
                 $extension = 'vnd.ms-powerpoint.addin.macroEnabled.12';
                 break;
             case 'pptm':
                 $extension = 'vnd.ms-powerpoint.presentation.macroEnabled.12';
                 break;
             case 'potm':
                 $extension = 'vnd.ms-powerpoint.template.macroEnabled.12';
                 break;
             case 'ppsm':
                 $extension = 'vnd.ms-powerpoint.slideshow.macroEnabled.12';
                 break;
             case 'rtf':
                 $extension = 'application/rtf';
                 break;
         }
         header('Content-Type: application/' . $extension . '; Charset=' . $GLOBALS["system_charset"]);
     } else {
         $content_disposition = 'attachment';
         if ($browser == 'IE' || $browser == 'OPERA') {
             header('Content-Type: application/octetstream; Charset=' . $GLOBALS["system_charset"]);
         } else {
             header('Content-Type: application/octet-stream; Charset=' . $GLOBALS["system_charset"]);
         }
     }
     if ($browser == 'IE') {
         // http://support.microsoft.com/kb/436616/ja
         header('Content-Disposition: ' . $content_disposition . '; filename="' . urlencode($item) . '"');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Content-Disposition: ' . $content_disposition . '; filename="' . $item . '"');
         header('Cache-Control: no-cache, must-revalidate');
         header('Pragma: no-cache');
     }
     if ($GLOBALS['use_mb']) {
         if (mb_detect_encoding($abs_item) == 'ASCII') {
             @readFileChunked(utf8_decode($abs_item));
         } else {
             @readFileChunked($abs_item);
         }
     } else {
         @readFileChunked(utf8_decode($abs_item));
     }
     if ($unlink == true) {
         unlink(utf8_decode($abs_item));
     }
     ob_end_flush();
     ext_exit();
 }
コード例 #15
0
ファイル: edit.php プロジェクト: A-Bush/pprod
    function execAction($dir, $item)
    {
        // edit file
        global $mainframe, $mosConfig_live_site;
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('edit', false, ext_Lang::err('accessfunc'));
        }
        $fname = ext_TextEncoding::fromUTF8(get_abs_item($dir, $item));
        if (!get_is_file($fname)) {
            ext_Result::sendResult('edit', false, ext_TextEncoding::toUTF8($item) . ": " . ext_Lang::err('fileexist'));
        }
        if (!get_show_item($dir, $item)) {
            ext_Result::sendResult('edit', false, $item . ": " . ext_Lang::err('accessfile'));
        }
        if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
            // Save / Save As
            $item = basename(stripslashes($GLOBALS['__POST']["fname"]));
            $fname2 = ext_TextEncoding::fromUTF8(get_abs_item($dir, $item));
            if (!isset($item) || $item == "") {
                ext_Result::sendResult('edit', false, ext_Lang::err('miscnoname'));
            }
            if ($fname != $fname2 && @$GLOBALS['ext_File']->file_exists($fname2)) {
                ext_Result::sendResult('edit', false, $item . ": " . ext_Lang::err('itemdoesexist'));
            }
            $this->savefile($fname2);
            $fname = $fname2;
            ext_Result::sendResult('edit', true, ext_Lang::msg('savefile') . ': ' . $item);
        }
        if (isset($GLOBALS['__POST']["doreopen"]) && $GLOBALS['__POST']["doreopen"] == "yes") {
            // File Reopen
            $extra = array();
            $content = $GLOBALS['ext_File']->file_get_contents($fname);
            if (get_magic_quotes_runtime()) {
                $content = stripslashes($content);
            }
            $langs = $GLOBALS["language"];
            if ($langs == "japanese") {
                $_encoding = $GLOBALS['__POST']["file_encoding"];
                if ($content) {
                    $content = mb_convert_encoding($content, "UTF-8", $_encoding);
                }
                $extra["file_encoding"] = $_encoding;
            }
            $extra["content"] = $content;
            ext_Result::sendResult('edit', true, ext_Lang::msg('reopenfile') . ': ' . $item, $extra);
        }
        // header
        $s_item = get_rel_item($dir, $item);
        if (strlen($s_item) > 50) {
            $s_item = "..." . substr($s_item, -47);
        }
        $id_hash = substr('f' . md5($s_item), 0, 10);
        $s_info = pathinfo($s_item);
        $s_extension = str_replace('.', '', $s_info['extension']);
        switch (strtolower($s_extension)) {
            case 'txt':
                $cp_lang = 'text';
                break;
            case 'cs':
                $cp_lang = 'csharp';
                break;
            case 'css':
                $cp_lang = 'css';
                break;
            case 'html':
            case 'htm':
            case 'xhtml':
                $cp_lang = 'html';
                break;
            case 'java':
                $cp_lang = 'java';
                break;
            case 'js':
                $cp_lang = 'js';
                break;
            case 'pl':
                $cp_lang = 'perl';
                break;
            case 'py':
                $cp_lang = 'python';
                break;
            case 'ruby':
                $cp_lang = 'ruby';
                break;
            case 'sql':
                $cp_lang = 'sql';
                break;
            case 'vb':
            case 'vbs':
                $cp_lang = 'vb';
                break;
            case 'php':
                $cp_lang = 'php';
                break;
            case 'xml':
                $cp_lang = 'xml';
                break;
            default:
                $cp_lang = '';
        }
        $content = $GLOBALS['ext_File']->file_get_contents($fname);
        if (get_magic_quotes_runtime()) {
            $content = stripslashes($content);
        }
        $cw = 250;
        $langs = $GLOBALS["language"];
        if ($langs == "japanese") {
            $cw = 200;
            if ($content) {
                $_encoding = strtoupper(mb_detect_encoding($content, array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN"), true));
                $content = mb_convert_encoding($content, "UTF-8", $_encoding);
                if ($_encoding == "SJIS-WIN") {
                    $_encoding_label = "SJIS";
                } elseif ($_encoding == "EUCJP-WIN") {
                    $_encoding_label = "EUC-JP";
                } elseif ($_encoding == "ISO-2022-JP") {
                    $_encoding_label = "JIS";
                } elseif ($_encoding == "ASCII") {
                    $_encoding_label = "UTF-8";
                } else {
                    $_encoding_label = $_encoding;
                }
            } else {
                $_encoding_label = "UTF-8";
            }
        }
        ?>
{
	"xtype": "form",
	"id": "<?php 
        echo $id_hash;
        ?>
",
	"labelWidth": "300",
	"autoScroll": "true", 
	"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
	"title": "<?php 
        echo strlen($s_item) > 50 ? substr($s_item, strlen($s_item) - 30, 30) : $s_item;
        ?>
",
	"frame": "true",
	"closable": "true",
	"tbar": [{
 		"text": "<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
", 
		"handler": function() {
			statusBarMessage( '<?php 
        echo ext_Lang::msg('save_processing', true);
        ?>
', true );
			form = Ext.getCmp("<?php 
        echo $id_hash;
        ?>
").getForm();
			form.submit({
				waitMsg: 'Saving the File, please wait...',
				reset: false,
				success: function(form, action) {
					datastore.reload();
					statusBarMessage( action.result.message, false, true );
				},
				failure: function(form, action) {
					statusBarMessage( action.result.error, false, false );
					Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
!', action.result.error);
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {option: 'com_extplorer', 
						action: 'edit', 
						code: editAreaLoader.getValue("ext_codefield<?php 
        echo $id_hash;
        ?>
"),
						dir: '<?php 
        echo stripslashes($dir);
        ?>
', 
						item: '<?php 
        echo stripslashes($item);
        ?>
', 
						dosave: 'yes'
				}
			});
		},
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_save.png"
    },{
		"text": "<?php 
        echo ext_Lang::msg('btnreopen', true);
        ?>
", 
		"handler": function() { 
			statusBarMessage( '<?php 
        echo ext_Lang::msg('reopen_processing', true);
        ?>
', true );
			form = Ext.getCmp("<?php 
        echo $id_hash;
        ?>
").getForm();
			form.submit({
				waitMsg: 'Processing Data, please wait...',
				reset: false,
				success: function(form, action) {
					statusBarMessage( action.result.message, false, true );
					editAreaLoader.setValue("ext_codefield<?php 
        echo $id_hash;
        ?>
", action.result.content);
				},
				failure: function(form, action) {
					statusBarMessage( action.result.error, false, false );
					Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
!', action.result.error);
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {
					option: 'com_extplorer', 
					action: 'edit', 
					dir: '<?php 
        echo stripslashes($dir);
        ?>
', 
					item: '<?php 
        echo stripslashes($item);
        ?>
', 
					doreopen: 'yes'
				}
			});
		},	
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_reload.png"
    },
    {
    	"text": "<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
", 
		"handler": function() { 
			Ext.getCmp("mainpanel").remove( Ext.getCmp("mainpanel").getActiveTab() );
		},
        "cls":"x-btn-text-icon",
        "icon": "<?php 
        echo _EXT_URL;
        ?>
/images/_cancel.png"
	}],	
	"items": [{
		"xtype": "displayfield",
		"value": "<?php 
        echo $GLOBALS["messages"]["actedit"] . ": {$s_item}";
        ?>
"
		},
		{
		"xtype": "textarea",
		"hideLabel": true,
		"name": "thecode",
		"id": "ext_codefield<?php 
        echo $id_hash;
        ?>
",
		"fieldClass": "x-form-field",
		"value": "<?php 
        echo str_replace(array("\r", "\n"), array('\\r', '\\n'), addslashes($content));
        ?>
",
		"width": "100%",
		"height": 500,
		"plugins": new Ext.ux.plugins.EditAreaEditor({
			"id" : "ext_codefield<?php 
        echo $id_hash;
        ?>
",	
			"syntax": "<?php 
        echo $cp_lang;
        ?>
",
			"start_highlight": true,
			"display": "later",
			"toolbar": "search, go_to_line, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help" 
			<?php 
        if (array_key_exists($langs, $this->lang_tbl)) {
            ?>
				,"language": "<?php 
            echo $this->lang_tbl[$langs];
            ?>
"
				<?php 
        }
        ?>
		})
	},
	{
		
			"width": "<?php 
        echo $cw;
        ?>
", 
			"xtype": "textfield",
			"fieldLabel": "<?php 
        echo ext_Lang::msg('copyfile', true);
        ?>
",
			"name": "fname",
			"value": "<?php 
        echo $item;
        ?>
",
			"clear": "true"
			}
<?php 
        if ($langs == "japanese") {
            ?>
			,{
			 "width": "<?php 
            echo $cw;
            ?>
",  
			 "style":"margin-left:10px", 
			 "clear":"true",
			"xtype": "combo",
			"fieldLabel": "<?php 
            echo ext_Lang::msg('fileencoding', true);
            ?>
",
			"name": "file_encoding",
			"store": [
						["UTF-8", "UTF-8"],
						["SJIS-WIN", "SJIS"],
						["EUCJP-WIN", "EUC-JP"],
						["ISO-2022-JP","JIS"]
					],
			"value" : "<?php 
            echo $_encoding_label;
            ?>
",
			"typeAhead": "true",
			"mode": "local",
			"triggerAction": "all",
			"editable": "false",
			"forceSelection": "true"
			}
	
<?php 
        }
        ?>
		]

}
	
<?php 
    }
コード例 #16
0
ファイル: fun_list.php プロジェクト: Caojunkai/arcticfox
function list_dir($dir)
{
    // list directory contents
    global $dir_up, $mosConfig_live_site, $_VERSION;
    ?>
	<script type="text/javascript" src="<?php 
    echo $mosConfig_live_site;
    ?>
/includes/js/overlib_mini.js"></script>
	<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
	<?php 
    $allow = ($GLOBALS["permissions"] & 01) == 01;
    $admin = ($GLOBALS["permissions"] & 04) == 04 || ($GLOBALS["permissions"] & 02) == 02;
    $dir_up = dirname($dir);
    if ($dir_up == ".") {
        $dir_up = "";
    }
    if (!get_show_item($dir_up, basename($dir))) {
        show_error($dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
    }
    // make file & dir tables, & get total filesize & number of items
    make_tables($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    $dirs = explode("/", $dir);
    $implode = "";
    $dir_links = "<a href=\"" . make_link("list", "", null) . "\">..</a>/";
    foreach ($dirs as $directory) {
        if ($directory != "") {
            $implode .= $directory . "/";
            $dir_links .= "<a href=\"" . make_link("list", $implode, null) . "\">{$directory}</a>/";
        }
    }
    show_header($GLOBALS["messages"]["actdir"] . ": " . $dir_links);
    // Javascript functions:
    include _QUIXPLORER_PATH . "/include/javascript.php";
    // Sorting of items
    $images = "&nbsp;<img width=\"10\" height=\"10\" border=\"0\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/";
    if ($GLOBALS["srt"] == "yes") {
        $_srt = "no";
        $images .= "_arrowup.gif\" alt=\"^\">";
    } else {
        $_srt = "yes";
        $images .= "_arrowdown.gif\" alt=\"v\">";
    }
    // Toolbar
    echo "<br><table width=\"95%\"><tr><td><table><tr>\n";
    // PARENT DIR
    echo "<td>";
    if ($dir != "") {
        echo "<a href=\"" . make_link("list", $dir_up, NULL) . "\">";
        echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_up.png\" ";
        echo "alt=\"" . $GLOBALS["messages"]["uplink"] . "\" title=\"" . $GLOBALS["messages"]["uplink"] . "\"></a>";
    }
    echo "</td>\n";
    // HOME DIR
    echo "<td><a href=\"" . make_link("list", NULL, NULL) . "\">";
    echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_home.gif\" ";
    echo "alt=\"" . $GLOBALS["messages"]["homelink"] . "\" title=\"" . $GLOBALS["messages"]["homelink"] . "\"></a></td>\n";
    // RELOAD
    echo "<td><a href=\"javascript:location.reload();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_refresh.gif\" alt=\"" . $GLOBALS["messages"]["reloadlink"];
    echo "\" title=\"" . $GLOBALS["messages"]["reloadlink"] . "\"></A></td>\n";
    // SEARCH
    if (!jx_isFTPMode()) {
        echo "<td><a href=\"" . make_link("search", $dir, NULL) . "\">";
        echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_search.gif\" ";
        echo "alt=\"" . $GLOBALS["messages"]["searchlink"] . "\" title=\"" . $GLOBALS["messages"]["searchlink"];
        echo "\"></a></td>\n";
    }
    echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
    // Joomla Sysinfo
    echo "<td><a href=\"" . make_link("sysinfo", $dir, NULL) . "\">";
    echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/systeminfo.gif\" ";
    echo "alt=\"" . $GLOBALS['messages']['mossysinfolink'] . "\" title=\"" . $GLOBALS['messages']['mossysinfolink'] . "\"></a></td>\n";
    echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
    if ($allow) {
        // COPY
        echo "<td><a href=\"javascript:Copy();\"><img border=\"0\" width=\"22\" height=\"22\" ";
        echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_copy.gif\" alt=\"" . $GLOBALS["messages"]["copylink"];
        echo "\" title=\"" . $GLOBALS["messages"]["copylink"] . "\"></a></td>\n";
        // MOVE
        echo "<td><a href=\"javascript:Move();\"><img border=\"0\" width=\"22\" height=\"22\" ";
        echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_move.gif\" alt=\"" . $GLOBALS["messages"]["movelink"];
        echo "\" title=\"" . $GLOBALS["messages"]["movelink"] . "\"></A></td>\n";
        // DELETE
        echo "<td><a href=\"javascript:Delete();\"><img border=\"0\" width=\"22\" height=\"22\" ";
        echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_delete.gif\" alt=\"" . $GLOBALS["messages"]["dellink"];
        echo "\" title=\"" . $GLOBALS["messages"]["dellink"] . "\"></A></td>\n";
        // CHMOD
        echo "<td><a href=\"javascript:Chmod();\"><img border=\"0\" width=\"22\" height=\"22\" ";
        echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_chmod.gif\" alt=\"chmod\" title=\"" . $GLOBALS['messages']['chmodlink'] . "\"></a></td>\n";
        // UPLOAD
        if (ini_get("file_uploads")) {
            echo "<td><a href=\"" . make_link("upload", $dir, NULL) . "\">";
            echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_upload.gif\" alt=\"" . $GLOBALS["messages"]["uploadlink"];
            echo "\" title=\"" . $GLOBALS["messages"]["uploadlink"] . "\"></A></td>\n";
        } else {
            echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_upload_.gif\" alt=\"" . $GLOBALS["messages"]["uploadlink"];
            echo "\" title=\"" . $GLOBALS["messages"]["uploadlink"] . "\"></td>\n";
        }
        // ARCHIVE
        if (($GLOBALS["zip"] || $GLOBALS["tar"] || $GLOBALS["tgz"]) && !jx_isFTPMode()) {
            echo "<td><a href=\"javascript:Archive();\"><img border=\"0\" width=\"22\" height=\"22\" ";
            echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_archive.gif\" alt=\"" . $GLOBALS["messages"]["comprlink"];
            echo "\" title=\"" . $GLOBALS["messages"]["comprlink"] . "\"></a></td>\n";
        }
    } else {
        // COPY
        echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
        echo "src=\"" . _QUIXPLORER_URL . "/images/_copy_.gif\" alt=\"" . $GLOBALS["messages"]["copylink"] . "\" title=\"";
        echo $GLOBALS["messages"]["copylink"] . "\"></td>\n";
        // MOVE
        echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
        echo "src=\"" . _QUIXPLORER_URL . "/images/_move_.gif\" alt=\"" . $GLOBALS["messages"]["movelink"] . "\" title=\"";
        echo $GLOBALS["messages"]["movelink"] . "\"></td>\n";
        // DELETE
        echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
        echo "src=\"" . _QUIXPLORER_URL . "/images/_delete_.gif\" alt=\"" . $GLOBALS["messages"]["dellink"] . "\" title=\"";
        echo $GLOBALS["messages"]["dellink"] . "\"></td>\n";
        // UPLOAD
        echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
        echo "src=\"" . _QUIXPLORER_URL . "/images/_upload_.gif\" alt=\"" . $GLOBALS["messages"]["uplink"];
        echo "\" title=\"" . $GLOBALS["messages"]["uplink"] . "\"></td>\n";
    }
    // ADMIN & LOGOUT
    if ($GLOBALS["require_login"]) {
        echo "<td>::</td>";
        // ADMIN
        if ($admin) {
            echo "<td><a href=\"" . make_link("admin", $dir, NULL) . "\">";
            echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_admin.gif\" alt=\"" . $GLOBALS["messages"]["adminlink"] . "\" title=\"";
            echo $GLOBALS["messages"]["adminlink"] . "\"></A></td>\n";
        }
        // LOGOUT
        echo "<td><a href=\"" . make_link("logout", NULL, NULL) . "\">";
        echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
        echo "src=\"" . _QUIXPLORER_URL . "/images/_logout.gif\" alt=\"" . $GLOBALS["messages"]["logoutlink"] . "\" title=\"";
        echo $GLOBALS["messages"]["logoutlink"] . "\"></a></td>\n";
    }
    // Logo
    echo "<td style=\"padding-left:10px;\">";
    //echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >";
    echo "<a href=\"" . $GLOBALS['jx_home'] . "\" target=\"_blank\" title=\"joomlaXplorer Project\"><img border=\"0\" align=\"absmiddle\" id=\"jx_logo\" style=\"filter:alpha(opacity=10);-moz-opacity:.10;opacity:.10;\" onmouseover=\"opacity('jx_logo', 60, 99, 500);\" onmouseout=\"opacity('jx_logo', 100, 60, 500);\" ";
    echo "src=\"" . _QUIXPLORER_URL . "/images/logo.gif\" align=\"right\" alt=\"" . $GLOBALS['messages']['logolink'] . "\"></a>";
    //echo "</div>";
    echo "</td>\n";
    echo "</tr></table></td>\n";
    // Create File / Dir
    if ($allow && @$GLOBALS['jx_File']->is_writable(get_abs_dir($dir))) {
        echo "<td align=\"right\">\n\t\t\t\t<form action=\"" . make_link("mkitem", $dir, NULL) . "\" method=\"post\" name=\"mkitemform\">\n\n\t\t\t\t<table><tr><td>\n\t\t\t\t\t<select name=\"mktype\" onchange=\"checkMkitemForm(this.options[this.selectedIndex])\">\n\t\t\t\t\t\t<option value=\"file\">" . $GLOBALS["mimes"]["file"] . "</option>\n\t\t\t\t\t\t<option value=\"dir\">" . $GLOBALS["mimes"]["dir"] . "</option>";
        if (!jx_isFTPMode() && !$GLOBALS['isWindows']) {
            echo "\t\t\t<option value=\"symlink\">" . $GLOBALS["mimes"]["symlink"] . "</option>\n";
        }
        echo "\t\t</select>\n\t\t\t\t\t<input name=\"symlink_target\" type=\"hidden\" size=\"25\" title=\"{$GLOBALS['messages']['symlink_target']}\" value=\"{$GLOBALS['mosConfig_absolute_path']}\" />\n\t\t\t\t\t<input name=\"mkname\" type=\"text\" size=\"15\" title=\"{$GLOBALS['messages']['nameheader']}\" />\n\t\t\t\t\t<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btncreate"] . "\" />\n\t\t\t\t\t</td></tr>\n\t\t\t\t\t<tr><td id=\"quick_jumpto\">" . list_bookmarks($dir) . "</td></tr>\n\t\t\t\t</table>\n\t\t\t\t<script type=\"text/javascript\">function checkMkitemForm( el ) { if( el.value =='symlink' ) document.mkitemform.symlink_target.type='text'; else document.mkitemform.symlink_target.type='hidden';} </script>\n\t\t\t\t</form>\n\t\t\t  </td>\n";
    } else {
        echo "<td align=\"right\">\n\t\t\t\t<table><tr><td id=\"quick_jumpto\">" . list_bookmarks($dir) . "</td></tr></table>\n\t\t\t </td>";
    }
    echo "</tr></table>\n";
    // End Toolbar
    // Begin Table + Form for checkboxes
    echo "<form name=\"selform\" method=\"post\" action=\"" . make_link("post", $dir, null) . "\">\n\t<input type=\"hidden\" name=\"do_action\" /><input type=\"hidden\" name=\"first\" value=\"y\" />\n\t<table class=\"adminlist\" width=\"95%\">\n";
    if (extension_loaded("posix")) {
        $owner_info = '<th width="15%" class="title">' . $GLOBALS['messages']['miscowner'] . '&nbsp;';
        if (jx_isFTPMode()) {
            $my_user_info = posix_getpwnam($_SESSION['ftp_login']);
            $my_group_info = posix_getgrgid($my_user_info['gid']);
        } else {
            $my_user_info = posix_getpwuid(posix_geteuid());
            $my_group_info = posix_getgrgid(posix_getegid());
        }
        $owner_info .= mosTooltip(mysql_escape_string(sprintf($GLOBALS['messages']['miscownerdesc'], $my_user_info['name'], $my_user_info['uid'], $my_group_info['name'], $my_group_info['gid'])));
        // new [mic]
        $owner_info .= "</th>\n";
        $colspan = 8;
    } else {
        $owner_info = "";
        $colspan = 7;
    }
    // Table Header
    echo "<tr>\n\t<th width=\"2%\" class=\"title\">\n\t\t<input type=\"checkbox\" name=\"toggleAllC\" onclick=\"javascript:ToggleAll(this);\" />\n\t</th>\n\t<th width=\"34%\" class=\"title\">\n";
    if ($GLOBALS["order"] == "name") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "name", $new_srt) . "\">" . $GLOBALS["messages"]["nameheader"];
    if ($GLOBALS["order"] == "name") {
        echo $images;
    }
    echo '</a>';
    echo "</th>\n\t<th width=\"10%\" class=\"title\">";
    if ($GLOBALS["order"] == "size") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "size", $new_srt) . "\">" . $GLOBALS["messages"]["sizeheader"];
    if ($GLOBALS["order"] == "size") {
        echo $images;
    }
    echo "</a></th>\n\t<th width=\"14%\" class=\"title\">";
    if ($GLOBALS["order"] == "type") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "type", $new_srt) . "\">" . $GLOBALS["messages"]["typeheader"];
    if ($GLOBALS["order"] == "type") {
        echo $images;
    }
    echo "</a></th>\n\t<th width=\"14%\" class=\"title\">";
    if ($GLOBALS["order"] == "mod") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "mod", $new_srt) . "\">" . $GLOBALS["messages"]["modifheader"];
    if ($GLOBALS["order"] == "mod") {
        echo $images;
    }
    echo "</a></th>\n\t<th width=\"2%\" class=\"title\">" . $GLOBALS["messages"]["permheader"] . "\n";
    echo "</th>";
    echo $owner_info;
    echo "<th width=\"10%\" class=\"title\">" . $GLOBALS["messages"]["actionheader"] . "</th>\n\t\n\t</tr>\n";
    // make & print Table using lists
    print_table($dir, make_list($dir_list, $file_list), $allow);
    // print number of items & total filesize
    echo "<tr><td colspan=\"{$colspan}\"><hr/></td></tr><tr>\n<td class=\"title\"></td>";
    echo "<td class=\"title\">" . $num_items . " " . $GLOBALS["messages"]["miscitems"] . " (";
    if (function_exists("disk_free_space")) {
        $size = disk_free_space($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } elseif (function_exists("diskfreespace")) {
        $size = diskfreespace($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } else {
        $free = "?";
    }
    echo $GLOBALS["messages"]["miscfree"] . ": " . $free . ")</td>\n";
    echo "<td class=\"title\">" . parse_file_size($tot_file_size) . "</td>\n";
    for ($i = 0; $i < $colspan - 3; ++$i) {
        echo "<td class=\"title\"></td>";
    }
    echo "</tr>\n<tr><td colspan=\"{$colspan}\"><hr/></td></tr></table>\n\t\t</form>";
    ?>
<script type="text/javascript"><!--
	// Uncheck all items (to avoid problems with new items)
	var ml = document.selform;
	var len = ml.elements.length;
	for(var i=0; i<len; ++i) {
		var e = ml.elements[i];
		if(e.name == "selitems[]" && e.checked == true) {
			e.checked=false;
		}
	}
	opacity('jx_logo', 10, 60, 2000);
// --></script>

<?php 
}
コード例 #17
0
function copy_move_items($dir)
{
    // copy/move file/dir
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    $action = stripslashes(JRequest::getCmd('action'));
    if ($action == "post") {
        $action = JRequest::getCmd("do_action");
    } elseif (empty($action)) {
        $action = "list";
    }
    // Vars
    $first = $GLOBALS['__POST']["first"];
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // Copy or Move?
    if ($action != "move") {
        $images = "images/__copy.gif";
    } else {
        $images = "images/__cut.gif";
    }
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        show_header($action != "move" ? $GLOBALS["messages"]["actcopyitems"] : $GLOBALS["messages"]["actmoveitems"]);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function NewDir(newdir) {
		document.selform.new_dir.value = newdir;
		document.selform.submit();
	}

	function Execute() {
		document.selform.confirm.value = "true";
	}
//-->
</script><?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<br /><img src=\"" . _QUIXPLORER_URL . '/images/' . $images . "\" align=\"absmiddle\" alt=\"\" />&nbsp;<strong>";
        echo sprintf($action != "move" ? $GLOBALS["messages"]["actcopyfrom"] : $GLOBALS["messages"]["actmovefrom"], $s_dir, $s_ndir);
        echo "</strong><img src=\"" . _QUIXPLORER_URL . "/images/__paste.gif\" align=\"absmiddle\" alt=\"\">\n";
        // Form for Target Directory & New Names
        echo "<br /><br /><form name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><table style=\"width:500px;\" class=\"adminform\">\n";
        echo "<input type=\"hidden\" name=\"do_action\" value=\"" . $action . "\">\n";
        echo "<input type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        echo "<input type=\"hidden\" name=\"first\" value=\"n\">\n";
        echo "<input type=\"hidden\" name=\"new_dir\" value=\"" . $new_dir . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</table><br />\n\t\t<table style=\"width:500px;\" class=\"adminform\">\n";
        // Print Text Inputs to change Names
        for ($i = 0; $i < $cnt; ++$i) {
            $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
            if (isset($GLOBALS['__POST']["newitems"][$i])) {
                $newitem = stripslashes($GLOBALS['__POST']["newitems"][$i]);
                if ($first == "y") {
                    $newitem = $selitem;
                }
            } else {
                $newitem = $selitem;
            }
            $s_item = $selitem;
            if (strlen($s_item) > 50) {
                $s_item = substr($s_item, 0, 47) . "...";
            }
            echo "<tr><td><img src=\"" . _QUIXPLORER_URL . "/images/information.png\" align=\"absmiddle\" alt=\"\">";
            // old name
            echo "<input type=\"hidden\" name=\"selitems[]\" value=\"";
            echo $selitem . "\">&nbsp;" . $s_item . "&nbsp;";
            // New Name
            echo "</td><td><input type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
            echo $newitem . "\"></td></tr>\n";
        }
        // Submit & Cancel
        echo "</table><br /><table><tr>\n<td>";
        echo "<input type=\"submit\" value=\"";
        echo $action != "move" ? $GLOBALS["messages"]["btncopy"] : $GLOBALS["messages"]["btnmove"];
        echo "\" onclick=\"javascript:Execute();\"></td>\n<td>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></td>\n</tr></table><br /></form>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['nx_File']->file_exists(get_abs_dir($new_dir))) {
        show_error(get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        $new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
        if (nx_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = get_item_info('/' . $new_dir, $new);
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['nx_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['nx_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link($abs_item) || get_is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (nx_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['nx_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir($abs_item)) {
                $dir = nx_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (nx_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['nx_File']->copy_dir($dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['nx_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<br />\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
コード例 #18
0
ファイル: list.php プロジェクト: kostya1017/our
    function execAction($dir)
    {
        // list directory contents
        global $dir_up, $mosConfig_live_site, $_VERSION;
        $allow = ($GLOBALS["permissions"] & 01) == 01;
        $admin = ($GLOBALS["permissions"] & 04) == 04 || ($GLOBALS["permissions"] & 02) == 02;
        $dir_up = dirname($dir);
        if ($dir_up == ".") {
            $dir_up = "";
        }
        if (!get_show_item($dir_up, basename($dir))) {
            ext_Result::sendResult('list', false, $dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
        }
        // Sorting of items
        if ($GLOBALS["direction"] == "ASC") {
            $_srt = "no";
        } else {
            $_srt = "yes";
        }
        show_header();
        extHTML::loadExtJS();
        ?>
		
	<div id="dirtree-panel"></div>
	<div id="locationbar-panel"></div>
	<div id="item-grid"></div>
	<div id="ext_statusbar" class="ext_statusbar"></div>

	<?php 
        // That's the main javascript file to build the Layout & App Logic
        include _EXT_PATH . '/scripts/application.js.php';
    }
コード例 #19
0
ファイル: fun_list.php プロジェクト: RX78NY1/hustoj
function list_dir($dir)
{
    $dir_up = dirname($dir);
    if ($dir_up == ".") {
        $dir_up = "";
    }
    if (!get_show_item($dir_up, basename($dir))) {
        show_error($dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
    }
    // make file & dir tables, & get total filesize & number of items
    make_tables($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    $s_dir = $dir;
    if (strlen($s_dir) > 50) {
        $s_dir = "..." . substr($s_dir, -47);
    }
    show_header("<a href='javascript:history.go(-1);'><font color=#0a0a0a>Go Back to Problem List</font></a><br>" . $GLOBALS["messages"]["actdir"] . ": /" . get_rel_item("", $s_dir));
    // Javascript functions:
    include "./.include/javascript.php";
    // Sorting of items
    $_img = "&nbsp;<IMG width=\"10\" height=\"10\" border=\"0\" align=\"ABSMIDDLE\" src=\"_img/";
    if ($GLOBALS["srt"] == "yes") {
        $_srt = "no";
        $_img .= "_arrowup.gif\" ALT=\"^\">";
    } else {
        $_srt = "yes";
        $_img .= "_arrowdown.gif\" ALT=\"v\">";
    }
    // Toolbar
    echo "<BR><TABLE width=\"95%\"><TR><TD><TABLE><TR>\n";
    // PARENT DIR
    echo "<TD><A HREF=\"" . make_link("list", $dir_up, NULL) . "\">";
    echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" src=\"_img/_up.gif\" ";
    echo "ALT=\"" . $GLOBALS["messages"]["uplink"] . "\" TITLE=\"" . $GLOBALS["messages"]["uplink"] . "\"></A></TD>\n";
    // HOME DIR
    echo "<TD><A HREF=\"" . make_link("list", NULL, NULL) . "\">";
    echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" src=\"_img/_home.gif\" ";
    echo "ALT=\"" . $GLOBALS["messages"]["homelink"] . "\" TITLE=\"" . $GLOBALS["messages"]["homelink"] . "\"></A></TD>\n";
    // RELOAD
    echo "<TD><A HREF=\"javascript:location.reload();\"><IMG border=\"0\" width=\"16\" height=\"16\" ";
    echo "align=\"ABSMIDDLE\" src=\"_img/_refresh.gif\" ALT=\"" . $GLOBALS["messages"]["reloadlink"];
    echo "\" TITLE=\"" . $GLOBALS["messages"]["reloadlink"] . "\"></A></TD>\n";
    // SEARCH
    echo "<TD><A HREF=\"" . make_link("search", $dir, NULL) . "\">";
    echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" src=\"_img/_search.gif\" ";
    echo "ALT=\"" . $GLOBALS["messages"]["searchlink"] . "\" TITLE=\"" . $GLOBALS["messages"]["searchlink"];
    echo "\"></A></TD>\n";
    echo "<TD>::</TD>";
    // print the edit buttons
    _print_edit_buttons($dir);
    // ADMIN & LOGOUT
    if (login_ok()) {
        echo "<TD>::</TD>";
        // ADMIN
        _print_link("admin", permissions_grant(NULL, NULL, "admin") || permissions_grant(NULL, NULL, "password"), $dir, NULL);
        // LOGOUT
        _print_link("logout", true, $dir, NULL);
    }
    echo "</TR></TABLE></TD>\n";
    // Create File / Dir
    if (permissions_grant($dir, NULL, "create")) {
        echo "<TD align=\"right\"><TABLE><FORM action=\"" . make_link("mkitem", $dir, NULL) . "\" method=\"post\">\n<TR><TD>";
        echo "<SELECT name=\"mktype\"><option value=\"file\">" . $GLOBALS["mimes"]["file"] . "</option>";
        echo "<option value=\"dir\">" . $GLOBALS["mimes"]["dir"] . "</option></SELECT>\n";
        echo "<INPUT name=\"mkname\" type=\"text\" size=\"15\">";
        echo "<INPUT type=\"submit\" value=\"" . $GLOBALS["messages"]["btncreate"];
        echo "\"></TD></TR></FORM></TABLE></TD>\n";
    }
    echo "</TR></TABLE>\n";
    // End Toolbar
    // Begin Table + Form for checkboxes
    echo "<TABLE WIDTH=\"95%\"><FORM name=\"selform\" method=\"POST\" action=\"" . make_link("post", $dir, NULL) . "\">\n";
    echo "<INPUT type=\"hidden\" name=\"do_action\"><INPUT type=\"hidden\" name=\"first\" value=\"y\">\n";
    // Table Header
    echo "<TR><TD colspan=\"7\"><HR></TD></TR><TR><TD WIDTH=\"2%\" class=\"header\">\n";
    echo "<INPUT TYPE=\"checkbox\" name=\"toggleAllC\" onclick=\"javascript:ToggleAll(this);\"></TD>\n";
    echo "<TD WIDTH=\"44%\" class=\"header\"><B>\n";
    if ($GLOBALS["order"] == "name") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "name", $new_srt) . "\">" . $GLOBALS["messages"]["nameheader"];
    if ($GLOBALS["order"] == "name") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"10%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "size") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "size", $new_srt) . "\">" . $GLOBALS["messages"]["sizeheader"];
    if ($GLOBALS["order"] == "size") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"16%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "type") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "type", $new_srt) . "\">" . $GLOBALS["messages"]["typeheader"];
    if ($GLOBALS["order"] == "type") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"14%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "mod") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "mod", $new_srt) . "\">" . $GLOBALS["messages"]["modifheader"];
    if ($GLOBALS["order"] == "mod") {
        echo $_img;
    }
    echo "</A></B></TD><TD WIDTH=\"8%\" class=\"header\"><B>" . $GLOBALS["messages"]["permheader"] . "</B>\n";
    echo "</TD><TD WIDTH=\"6%\" class=\"header\"><B>" . $GLOBALS["messages"]["actionheader"] . "</B></TD></TR>\n";
    echo "<TR><TD colspan=\"7\"><HR></TD></TR>\n";
    // make & print Table using lists
    print_table($dir, make_list($dir_list, $file_list));
    // print number of items & total filesize
    echo "<TR><TD colspan=\"7\"><HR></TD></TR><TR>\n<TD class=\"header\"></TD>";
    echo "<TD class=\"header\">" . $num_items . " " . $GLOBALS["messages"]["miscitems"] . " (";
    if (function_exists("disk_free_space")) {
        $free = parse_file_size(disk_free_space(get_abs_dir($dir)));
    } elseif (function_exists("diskfreespace")) {
        $free = parse_file_size(diskfreespace(get_abs_dir($dir)));
    } else {
        $free = "?";
    }
    // echo "Total: ".parse_file_size(disk_total_space(get_abs_dir($dir))).", ";
    echo $GLOBALS["messages"]["miscfree"] . ": " . $free . ")</TD>\n";
    echo "<TD class=\"header\">" . parse_file_size($tot_file_size) . "</TD>\n";
    for ($i = 0; $i < 4; ++$i) {
        echo "<TD class=\"header\"></TD>";
    }
    echo "</TR>\n<TR><TD colspan=\"7\"><HR></TD></TR></FORM></TABLE>\n";
    ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	// Uncheck all items (to avoid problems with new items)
	var ml = document.selform;
	var len = ml.elements.length;
	for(var i=0; i<len; ++i) {
		var e = ml.elements[i];
		if(e.name == "selitems[]" && e.checked == true) {
			e.checked=false;
		}
	}
// -->
</script><?php 
}
コード例 #20
0
function list_dir($dir)
{
    // list directory contents
    global $dir_up, $mosConfig_live_site, $_VERSION;
    $allow = ($GLOBALS["permissions"] & 01) == 01;
    $admin = ($GLOBALS["permissions"] & 04) == 04 || ($GLOBALS["permissions"] & 02) == 02;
    $dir_up = dirname($dir);
    if ($dir_up == ".") {
        $dir_up = "";
    }
    if (!get_show_item($dir_up, basename($dir))) {
        ext_Result::sendResult('', false, $dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
    }
    // make file & dir tables, & get total filesize & number of items
    make_tables($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    $dirs = explode("/", $dir);
    $implode = "";
    $dir_links = "<a href=\"" . make_link("list", "", null) . "\">..</a>&nbsp;/&nbsp;";
    foreach ($dirs as $directory) {
        if ($directory != "") {
            $implode .= $directory . "/";
            $dir_links .= "<a href=\"" . make_link("list", $implode, null) . "\">{$directory}</a>&nbsp;/&nbsp;";
        }
    }
    echo '<div class="componentheading">' . $GLOBALS["messages"]["actdir"] . ": " . $dir_links . '</div>';
    // Sorting of items
    $images = "&nbsp;<img width=\"10\" height=\"10\" border=\"0\" align=\"absmiddle\" src=\"" . _EXT_URL . "/images/";
    if ($GLOBALS["direction"] == "ASC") {
        $_srt = "DESC";
        $images .= "_arrowup.gif\" alt=\"^\">";
    } else {
        $_srt = "ASC";
        $images .= "_arrowdown.gif\" alt=\"v\">";
    }
    // Toolbar
    /*echo "<br><table width=\"95%\"><tr><td><table><tr>\n";
    	
    	// PARENT DIR
    	echo "<td>";
    	if( $dir != "" ) {
    	  echo "<a href=\"".make_link("list",$dir_up,NULL)."\">";
    	  echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_up.png\" ";
    	  echo "alt=\"".$GLOBALS["messages"]["uplink"]."\" title=\"".$GLOBALS["messages"]["uplink"]."\"></a>";
    	}
    	echo "</td>\n";
    	// HOME DIR
    	echo "<td><a href=\"".make_link("list",NULL,NULL)."\">";
    	echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_home.gif\" ";
    	echo "alt=\"".$GLOBALS["messages"]["homelink"]."\" title=\"".$GLOBALS["messages"]["homelink"]."\"></a></td>\n";
    	// RELOAD
    	echo "<td><a href=\"javascript:location.reload();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    	echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_refresh.gif\" alt=\"".$GLOBALS["messages"]["reloadlink"];
    	echo "\" title=\"".$GLOBALS["messages"]["reloadlink"]."\"></A></td>\n";
    	// SEARCH
    	echo "<td><a href=\"".make_link("search",$dir,NULL)."\">";
    	echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_search.gif\" ";
    	echo "alt=\"".$GLOBALS["messages"]["searchlink"]."\" title=\"".$GLOBALS["messages"]["searchlink"];
    	echo "\"></a></td>\n";
    	
    	echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
    	
    	// Joomla Sysinfo
    	echo "<td><a href=\"".make_link("sysinfo",$dir,NULL)."\">";
    	echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/systeminfo.gif\" ";
    	echo "alt=\"" . $GLOBALS['messages']['mossysinfolink'] . "\" title=\"" .$GLOBALS['messages']['mossysinfolink'] . "\"></a></td>\n";
    	
    	echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
    	
    	if($allow) {
    		// COPY
    		echo "<td><a href=\"javascript:Copy();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    		echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_copy.gif\" alt=\"".$GLOBALS["messages"]["copylink"];
    		echo "\" title=\"".$GLOBALS["messages"]["copylink"]."\"></a></td>\n";
    		// MOVE
    		echo "<td><a href=\"javascript:Move();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    		echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_move.gif\" alt=\"".$GLOBALS["messages"]["movelink"];
    		echo "\" title=\"".$GLOBALS["messages"]["movelink"]."\"></A></td>\n";
    		// DELETE
    		echo "<td><a href=\"javascript:Delete();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    		echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_delete.gif\" alt=\"".$GLOBALS["messages"]["dellink"];
    		echo "\" title=\"".$GLOBALS["messages"]["dellink"]."\"></A></td>\n";
    		// CHMOD
    		echo "<td><a href=\"javascript:Chmod();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    		echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_chmod.gif\" alt=\"chmod\" title=\"" . $GLOBALS['messages']['chmodlink'] . "\"></a></td>\n";
    		// UPLOAD
    		if(ini_get("file_uploads")) {
    			echo "<td><a href=\"".make_link("upload",$dir,NULL)."\">";
    			echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    			echo "src=\""._EXT_URL."/images/_upload.gif\" alt=\"".$GLOBALS["messages"]["uploadlink"];
    			echo "\" title=\"".$GLOBALS["messages"]["uploadlink"]."\"></A></td>\n";
    		} else {
    			echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    			echo "src=\""._EXT_URL."/images/_upload_.gif\" alt=\"".$GLOBALS["messages"]["uploadlink"];
    			echo "\" title=\"".$GLOBALS["messages"]["uploadlink"]."\"></td>\n";
    		}
    		// ARCHIVE
    		if($GLOBALS["zip"] || $GLOBALS["tar"] || $GLOBALS["tgz"]) {
    			echo "<td><a href=\"javascript:Archive();\"><img border=\"0\" width=\"22\" height=\"22\" ";
    			echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_archive.gif\" alt=\"".$GLOBALS["messages"]["comprlink"];
    			echo "\" title=\"".$GLOBALS["messages"]["comprlink"]."\"></A></td>\n";
    		}
    	} else {
    		// COPY
    		echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    		echo "src=\""._EXT_URL."/images/_copy_.gif\" alt=\"".$GLOBALS["messages"]["copylink"]."\" title=\"";
    		echo $GLOBALS["messages"]["copylink"]."\"></td>\n";
    		// MOVE
    		echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    		echo "src=\""._EXT_URL."/images/_move_.gif\" alt=\"".$GLOBALS["messages"]["movelink"]."\" title=\"";
    		echo $GLOBALS["messages"]["movelink"]."\"></td>\n";
    		// DELETE
    		echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    		echo "src=\""._EXT_URL."/images/_delete_.gif\" alt=\"".$GLOBALS["messages"]["dellink"]."\" title=\"";
    		echo $GLOBALS["messages"]["dellink"]."\"></td>\n";
    		// UPLOAD
    		echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    		echo "src=\""._EXT_URL."/images/_upload_.gif\" alt=\"".$GLOBALS["messages"]["uplink"];
    		echo "\" title=\"".$GLOBALS["messages"]["uplink"]."\"></td>\n";
    	}
    
    	// ADMIN & LOGOUT
    	if($GLOBALS["require_login"]) {
    		echo "<td>::</td>";
    		// ADMIN
    		if($admin) {
    			echo "<td><a href=\"".make_link("admin",$dir,NULL)."\">";
    			echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    			echo "src=\""._EXT_URL."/images/_admin.gif\" alt=\"".$GLOBALS["messages"]["adminlink"]."\" title=\"";
    			echo $GLOBALS["messages"]["adminlink"]."\"></A></td>\n";
    		}
    		// LOGOUT
    		echo "<td><a href=\"".make_link("logout",NULL,NULL)."\">";
    		echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
    		echo "src=\""._EXT_URL."/images/_logout.gif\" alt=\"".$GLOBALS["messages"]["logoutlink"]."\" title=\"";
    		echo $GLOBALS["messages"]["logoutlink"]."\"></a></td>\n";
    	}
    	// Logo
    	echo "<td style=\"padding-left:10px;\">";
    	//echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >";
    	echo "<a href=\"".$GLOBALS['ext_home']."\" target=\"_blank\" title=\"joomlaXplorer Project\"><img border=\"0\" align=\"absmiddle\" id=\"ext_logo\" style=\"filter:alpha(opacity=10);-moz-opacity:.10;opacity:.10;\" onmouseover=\"opacity('ext_logo', 60, 99, 500);\" onmouseout=\"opacity('ext_logo', 100, 60, 500);\" ";
    	echo "src=\""._EXT_URL."/images/logo.gif\" align=\"right\" alt=\"" . $GLOBALS['messages']['logolink'] . "\"></a>";
    	//echo "</div>";
    	echo "</td>\n";
    	
    	echo "</tr></table></td>\n";
    	
    	// Create File / Dir
    	
    	if($allow && is_writable($GLOBALS['home_dir'].'/'.$dir)) {
    		echo "<td align=\"right\"><table><form action=\"".make_link("mkitem",$dir,NULL)."\" method=\"post\">\n<tr><td>";
    		echo "<select name=\"mktype\"><option value=\"file\">".$GLOBALS["mimes"]["file"]."</option>";
    		echo "<option value=\"dir\">".$GLOBALS["mimes"]["dir"]."</option></select>\n";
    		echo "<input name=\"mkname\" type=\"text\" size=\"15\">";
    		echo "<input type=\"submit\" value=\"".$GLOBALS["messages"]["btncreate"];
    		echo "\"></td></tr></form></table></td>\n";
    	}
    	
    	echo "</tr></table>\n";
    	*/
    // End Toolbar
    // Begin Table + Form for checkboxes
    echo "<table width=\"95%\" cellpadding=\"5\" cellspacing=\"2\"><tr class=\"sectiontableheader\">\n";
    echo "<th width=\"44%\"><b>\n";
    if ($GLOBALS["order"] == "name") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "name", $new_srt) . "\">" . $GLOBALS["messages"]["nameheader"];
    if ($GLOBALS["order"] == "name") {
        echo $images;
    }
    echo "</a></b></td>\n<th width=\"10%\"><b>";
    if ($GLOBALS["order"] == "size") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "size", $new_srt) . "\">" . $GLOBALS["messages"]["sizeheader"];
    if ($GLOBALS["order"] == "size") {
        echo $images;
    }
    echo "</a></b></th>\n<th width=\"12%\" ><b>";
    if ($GLOBALS["order"] == "type") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "type", $new_srt) . "\">" . $GLOBALS["messages"]["typeheader"];
    if ($GLOBALS["order"] == "type") {
        echo $images;
    }
    echo "</a></b></th>\n<th width=\"12%\"><b>";
    if ($GLOBALS["order"] == "mod") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<a href=\"" . make_link("list", $dir, NULL, "mod", $new_srt) . "\">" . $GLOBALS["messages"]["modifheader"];
    if ($GLOBALS["order"] == "mod") {
        echo $images;
    }
    echo "</a></b></th></tr>\n";
    // make & print Table using lists
    print_table($dir, make_list($dir_list, $file_list), $allow);
    // print number of items & total filesize
    echo "<tr><td colspan=\"4\"><hr/></td></tr><tr>\n<td>&nbsp;</td>";
    echo "<td>" . $num_items . " " . $GLOBALS["messages"]["miscitems"] . " " . parse_file_size($tot_file_size) . "</td>\n";
    echo "<td>&nbsp;</td><td>&nbsp;</td>";
    echo "</tr>\n<tr><td colspan=\"4\"><hr/></td></tr></table>\n";
}
コード例 #21
0
ファイル: fun_edit.php プロジェクト: ZenaVault/FreeNAS-Source
function edit_file($dir, $item)
{
    // edit file
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $fname = get_abs_item($dir, $item);
    if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
        // Save / Save As
        $item = base_name(stripslashes($GLOBALS['__POST']["fname"]));
        $fname2 = get_abs_item($dir, $item);
        if (!isset($item) || $item == "") {
            show_error($GLOBALS["error_msg"]["miscnoname"]);
        }
        if ($fname != $fname2 && @file_exists($fname2)) {
            show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
        }
        savefile($fname2);
        $fname = $fname2;
    }
    // open file
    $fp = @fopen($fname, "r");
    if ($fp === false) {
        show_error($item . ": " . $GLOBALS["error_msg"]["openfile"]);
    }
    // header
    $s_item = get_rel_item($dir, $item);
    if (strlen($s_item) > 50) {
        $s_item = "..." . substr($s_item, -47);
    }
    show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item);
    // Wordwrap (works only in IE)
    ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function chwrap() {
		if(document.editfrm.wrap.checked) {
			document.editfrm.code.wrap="soft";
		} else {
			document.editfrm.code.wrap="off";
		}
	}
// -->
</script><?php 
    // Form
    echo "<BR><FORM name=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n";
    echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\">\n";
    echo "<TEXTAREA NAME=\"code\" rows=\"25\" cols=\"120\" wrap=\"off\">";
    // Show File In TextArea
    $buffer = "";
    while (!feof($fp)) {
        $buffer .= fgets($fp, 4096);
    }
    @fclose($fp);
    echo htmlspecialchars($buffer);
    echo "</TEXTAREA><BR>\n<TABLE><TR><TD>Wordwrap: (IE only)</TD><TD><INPUT type=\"checkbox\" name=\"wrap\" ";
    echo "onClick=\"javascript:chwrap();\" value=\"1\"></TD></TR></TABLE><BR>\n";
    echo "<TABLE><TR><TD><INPUT type=\"text\" name=\"fname\" value=\"" . $item . "\"></TD>";
    echo "<TD><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"];
    echo "\"></TD>\n<TD><input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\"></TD>\n<TD>";
    echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onClick=\"javascript:location='";
    echo make_link("list", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR>\n";
    ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	if(document.editfrm) document.editfrm.code.focus();
// -->
</script><?php 
}
コード例 #22
0
ファイル: fun_chmod.php プロジェクト: Caojunkai/arcticfox
function chmod_item($dir, $item)
{
    // change permissions
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!empty($GLOBALS['__POST']["selitems"])) {
        $cnt = count($GLOBALS['__POST']["selitems"]);
    } else {
        $GLOBALS['__POST']["selitems"][] = $item;
        $cnt = 1;
    }
    if (!empty($GLOBALS['__POST']['do_recurse'])) {
        $do_recurse = true;
    } else {
        $do_recurse = false;
    }
    // Execute
    if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
        $bin = '';
        for ($i = 0; $i < 3; $i++) {
            for ($j = 0; $j < 3; $j++) {
                $tmp = "r_" . $i . $j;
                if (isset($GLOBALS['__POST'][$tmp]) && $GLOBALS['__POST'][$tmp] == "1") {
                    $bin .= '1';
                } else {
                    $bin .= '0';
                }
            }
        }
        if ($bin == '0') {
            // Changing permissions to "none" is not allowed
            show_error($item . ": " . $GLOBALS["error_msg"]["permchange"]);
        }
        $old_bin = $bin;
        for ($i = 0; $i < $cnt; ++$i) {
            if (jx_isFTPMode()) {
                $mode = decoct(bindec($bin));
            } else {
                $mode = bindec($bin);
            }
            $item = $GLOBALS['__POST']["selitems"][$i];
            if (jx_isFTPMode()) {
                $abs_item = get_item_info($dir, $item);
            } else {
                $abs_item = get_abs_item($dir, $item);
            }
            if (!$GLOBALS['jx_File']->file_exists($abs_item)) {
                show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
            }
            if (!get_show_item($dir, $item)) {
                show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
            }
            if ($do_recurse) {
                $ok = $GLOBALS['jx_File']->chmodRecursive($abs_item, $mode);
            } else {
                if (get_is_dir($abs_item)) {
                    // when we chmod a directory we must care for the permissions
                    // to prevent that the directory becomes not readable (when the "execute bits" are removed)
                    $bin = substr_replace($bin, '1', 2, 1);
                    // set 1st x bit to 1
                    $bin = substr_replace($bin, '1', 5, 1);
                    // set  2nd x bit to 1
                    $bin = substr_replace($bin, '1', 8, 1);
                    // set 3rd x bit to 1
                    if (jx_isFTPMode()) {
                        $mode = decoct(bindec($bin));
                    } else {
                        $mode = bindec($bin);
                    }
                }
                $ok = @$GLOBALS['jx_File']->chmod($abs_item, $mode);
            }
            $bin = $old_bin;
        }
        if (!$ok || PEAR::isError($ok)) {
            show_error($abs_item . ": " . $GLOBALS["error_msg"]["permchange"]);
        }
        header("Location: " . make_link("link", $dir, NULL));
        return;
    }
    if (jx_isFTPMode()) {
        $abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]);
    } else {
        $abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]);
    }
    $mode = parse_file_perms(get_file_perms($abs_item));
    if ($mode === false) {
        show_error($GLOBALS['__POST']["selitems"][0] . ": " . $GLOBALS["error_msg"]["permread"]);
    }
    $pos = "rwx";
    $text = "";
    for ($i = 0; $i < $cnt; ++$i) {
        $s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]);
        if (strlen($s_item) > 50) {
            $s_item = "..." . substr($s_item, -47);
        }
        $text .= ", " . $s_item;
    }
    show_header($GLOBALS["messages"]["actperms"]);
    echo "<br/><br/><div style=\"max-height: 200px; max-width: 800px;overflow:auto;\">/" . $text . '</div>';
    // Form
    echo '<br /><form method="post" action="' . make_link("chmod", $dir, $item) . "\">\n\t<input type=\"hidden\" name=\"confirm\" value=\"true\" />";
    if ($cnt > 1 || empty($GLOBALS['__GET']["item"])) {
        for ($i = 0; $i < $cnt; ++$i) {
            echo "<input type=\"hidden\" name=\"selitems[]\" value=\"" . stripslashes($GLOBALS['__POST']["selitems"][$i]) . "\" />\n";
        }
    } else {
        echo "<input type=\"hidden\" name=\"item\" value=\"" . stripslashes($GLOBALS['__GET']["item"]) . "\" />\n";
    }
    echo "\n\t<table class=\"adminform\" style=\"width:175px;\">\n";
    // print table with current perms & checkboxes to change
    for ($i = 0; $i < 3; ++$i) {
        echo "<tr><td>" . $GLOBALS["messages"]["miscchmod"][$i] . "</td>";
        for ($j = 0; $j < 3; ++$j) {
            echo "<td><label for=\"r_" . $i . $j . "\"\">" . $pos[$j] . "&nbsp;</label><input type=\"checkbox\"";
            if ($mode[3 * $i + $j] != "-") {
                echo " checked=\"checked\"";
            }
            echo " name=\"r_" . $i . $j . "\" id=\"r_" . $i . $j . "\" value=\"1\" /></td>";
        }
        echo "</tr>\n";
    }
    // Submit / Cancel
    echo "</table>\n<br/>";
    echo "<table>\n<tr><tr><td colspan=\"2\">\n<input name=\"do_recurse\" id=\"do_recurse\" type=\"checkbox\" value=\"1\" /><label for=\"do_recurse\">" . $GLOBALS["messages"]["recurse_subdirs"] . "</label></td></tr>\n";
    echo "<tr><tr><td>\n<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnchange"];
    echo "\"></td>\n<td><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
    echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</td></tr></form></table><br />\n";
}
コード例 #23
0
ファイル: unzip.php プロジェクト: sdoney/nas4free
function unzip_item($dir)
{
    _debug("unzip_item({$dir})");
    global $home_dir;
    // copy and move are only allowed if the user may read and change files
    if (!permissions_grant_all($dir, NULL, array("read", "create"))) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $new_dir = isset($GLOBALS['__POST']["new_dir"]) ? stripslashes($GLOBALS['__POST']["new_dir"]) : $dir;
    $_img = $GLOBALS["baricons"]["unzip"];
    // Get Selected Item
    if (!isset($GLOBALS['__POST']["item"]) && isset($GLOBALS['__GET']["item"])) {
        $s_item = $GLOBALS['__GET']["item"];
    } elseif (isset($GLOBALS['__POST']["item"])) {
        $s_item = $GLOBALS['__POST']["item"];
    }
    $dir_extract = "{$home_dir}/{$new_dir}";
    if ($new_dir != "") {
        $dir_extract .= "/";
    }
    $zip_name = "{$home_dir}/{$dir}/{$s_item}";
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        show_header($GLOBALS["messages"]["actunzipitem"]);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function NewDir(newdir) {
		document.selform.new_dir.value = newdir;
		document.selform.submit();
	}
	
	function Execute() {
		document.selform.confirm.value = "true";
	}
//-->
</script><?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<!-- dirextr = " . $dir_extract . " -->\n";
        echo "<!-- zipname = " . $zip_name . " -->\n";
        echo "<CENTER><BR><BR><IMG SRC=\"" . $_img . "\" align=\"ABSMIDDLE\" ALT=\"\">&nbsp;";
        echo "<IMG SRC=\"" . $GLOBALS["baricons"]["unzipto"] . "\" align=\"ABSMIDDLE\" ALT=\"\">\n";
        // Form for Target Directory & New Names
        echo "<BR><BR><FORM name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><TABLE>\n";
        echo "<INPUT type=\"hidden\" name=\"do_action\" value=\"" . $GLOBALS["action"] . "\">\n";
        echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        //echo "<INPUT type=\"hidden\" name=\"dir\" value=\"n\">\n";
        echo "<INPUT type=\"hidden\" name=\"new_dir\" value=\"" . $new_dir . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</TABLE><BR><TABLE>\n";
        // Print Text Inputs to change Names
        echo "<TR><TD><IMG SRC=\"" . $GLOBALS["baricons"]["zip"] . "\" align=\"ABSMIDDLE\" ALT=\"\">";
        echo "<INPUT type=\"hidden\" name=\"item\" value=\"" . $s_item . "\">&nbsp;" . $s_item . "&nbsp;";
        // Submit & Cancel
        echo "</TABLE><BR><TABLE><TR>\n<TD>";
        echo "<INPUT type=\"submit\" value=\"";
        echo $GLOBALS["messages"]["btnunzip"];
        echo "\" onclick=\"javascript:Execute();\"></TD>\n<TD>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></TD>\n</TR></FORM></TABLE><BR><BR><BR>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@file_exists(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    /*for($i=0;$i<$cnt;++$i) {
    		$tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
    		$new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
    		$abs_item = get_abs_item($dir,$tmp);
    		$abs_new_item = get_abs_item($new_dir,$new);
    		$items[$i] = $tmp;
    	
    		// Check
    		if($new=="") {
    			$error[$i]= $GLOBALS["error_msg"]["miscnoname"];
    			$err=true;	continue;
    		}
    		if(!@file_exists($abs_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["itemexist"];
    			$err=true;	continue;
    		}
    		if(!get_show_item($dir, $tmp)) {
    			$error[$i]= $GLOBALS["error_msg"]["accessitem"];
    			$err=true;	continue;
    		}
    		if(@file_exists($abs_new_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["targetdoesexist"];
    			$err=true;	continue;
    		}
    	*/
    // Copy / Move
    //if($GLOBALS["action"]=="copy") {
    //if($GLOBALS["action"]=="unzip") {
    /*
    	if(@is_link($abs_item) || @is_file($abs_item)) {
    		// check file-exists to avoid error with 0-size files (PHP 4.3.0)
    		$ok=@copy($abs_item,$abs_new_item);	//||@file_exists($abs_new_item);
    	} elseif(@is_dir($abs_item)) {
    		$ok=copy_dir($abs_item,$abs_new_item);
    	}
    */
    //----------------------------------          print_r($GLOBALS);
    _debug("unzip_item(): Extracting {$zip_name} to {$dir_extract}");
    //$dir_extract[0]='/';
    //$dir_extract = '.'. $dir_extract;
    //------------------------------------------------------echo $zip_name.' aa'.$dir_extract.'aa';
    $exx = pathinfo($zip_name, PATHINFO_EXTENSION);
    if ($exx == 'zip') {
        $zip = new ZipArchive();
        $res = $zip->open($zip_name);
        if ($res === TRUE) {
            $zip->extractTo($dir_extract);
            $zip->close();
        } else {
        }
    } else {
        // gz, tar, bz2, ....
        include_once './_lib/archive.php';
        extArchive::extract($zip_name, $dir_extract);
    }
    // FIXME $i is not set anymore.. remove code?
    if (!isset($i)) {
        $i = 0;
    }
    if ($res == false) {
        $error[$i] = $GLOBALS["error_msg"]["unzip"];
        $err = true;
        continue;
    }
    $error[$i] = NULL;
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
コード例 #24
0
ファイル: copy_move.php プロジェクト: shamblett/janitor
/**
 * File/Directory Copy & Move Functions
 */
function copy_move_items($dir)
{
    // copy/move file/dir
    $action = extGetParam($_REQUEST, 'action');
    if (($GLOBALS["permissions"] & 01) != 01) {
        ext_Result::sendResult($action, false, $GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $first = extGetParam($GLOBALS['__POST'], 'first');
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['ext_File']->file_exists(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        $new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = get_item_info('/' . $new_dir, $new);
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link($abs_item) || get_is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (ext_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['ext_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir($abs_item)) {
                $copy_dir = ext_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (ext_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['ext_File']->copy_dir($copy_dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['ext_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "\n";
        }
        ext_Result::sendResult($action, false, $err_msg);
    }
    ext_Result::sendResult($action, true, 'The File(s)/Directory(s) were successfully ' . ($action == 'copy' ? 'copied' : 'moved') . '.');
}
コード例 #25
0
ファイル: chmod.php プロジェクト: Gninety/Microweber
    function execAction($dir, $item)
    {
        // change permissions
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('chmod', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (!empty($GLOBALS['__POST']["selitems"])) {
            $cnt = count($GLOBALS['__POST']["selitems"]);
        } else {
            $GLOBALS['__POST']["selitems"][] = $item;
            $cnt = 1;
        }
        if (!empty($GLOBALS['__POST']['do_recurse'])) {
            $do_recurse = true;
        } else {
            $do_recurse = false;
        }
        // Execute
        if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
            $bin = '';
            for ($i = 0; $i < 3; $i++) {
                for ($j = 0; $j < 3; $j++) {
                    $tmp = "r_" . $i . $j;
                    if (!empty($GLOBALS['__POST'][$tmp])) {
                        $bin .= '1';
                    } else {
                        $bin .= '0';
                    }
                }
            }
            if ($bin == '0') {
                // Changing permissions to "none" is not allowed
                ext_Result::sendResult('chmod', false, $item . ": " . ext_Lang::err('chmod_none_not_allowed'));
            }
            $old_bin = $bin;
            for ($i = 0; $i < $cnt; ++$i) {
                if (ext_isFTPMode()) {
                    $mode = decoct(bindec($bin));
                } else {
                    $mode = bindec($bin);
                }
                $item = $GLOBALS['__POST']["selitems"][$i];
                if (ext_isFTPMode()) {
                    $abs_item = get_item_info($dir, $item);
                } else {
                    $abs_item = get_abs_item($dir, $item);
                }
                if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
                    ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
                }
                if (!get_show_item($dir, $item)) {
                    ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
                }
                if ($do_recurse) {
                    $ok = $GLOBALS['ext_File']->chmodRecursive($abs_item, $mode);
                } else {
                    if (get_is_dir($abs_item)) {
                        // when we chmod a directory we must care for the permissions
                        // to prevent that the directory becomes not readable (when the "execute bits" are removed)
                        $bin = substr_replace($bin, '1', 2, 1);
                        // set 1st x bit to 1
                        $bin = substr_replace($bin, '1', 5, 1);
                        // set  2nd x bit to 1
                        $bin = substr_replace($bin, '1', 8, 1);
                        // set 3rd x bit to 1
                        if (ext_isFTPMode()) {
                            $mode = decoct(bindec($bin));
                        } else {
                            $mode = bindec($bin);
                        }
                    }
                    //ext_Result::sendResult('chmod', false, $GLOBALS['FTPCONNECTION']->pwd());
                    $ok = @$GLOBALS['ext_File']->chmod($abs_item, $mode);
                }
                $bin = $old_bin;
            }
            if ($ok === false || PEAR::isError($ok)) {
                $msg = $item . ": " . $GLOBALS["error_msg"]["permchange"];
                $msg .= PEAR::isError($ok) ? ' [' . $ok->getMessage() . ']' : '';
                ext_Result::sendResult('chmod', false, $msg);
            }
            ext_Result::sendResult('chmod', true, ext_Lang::msg('permchange'));
            return;
        }
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]);
        } else {
            $abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]);
            $abs_item = utf8_decode($abs_item);
        }
        $mode = parse_file_perms(get_file_perms($abs_item));
        if ($mode === false) {
            ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["permread"]);
        }
        $pos = "rwx";
        $text = "";
        for ($i = 0; $i < $cnt; ++$i) {
            $s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]);
            if (strlen($s_item) > 50) {
                $s_item = "..." . substr($s_item, -47);
            }
            $text .= $s_item . ($i + 1 < $cnt ? ', ' : '');
        }
        ?>
		{
		"xtype": "form",
		"id": "simpleform",
		"width": "300",
		"labelWidth": 125,
		"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
		"dialogtitle": "<?php 
        echo ext_Lang::msg('actperms');
        ?>
",
		"title" : "<?php 
        echo $text;
        ?>
",
		"frame": true,
		"items": [{
			"layout": "column",
			"items": [{
	<?php 
        // print table with current perms & checkboxes to change
        for ($i = 0; $i < 3; ++$i) {
            ?>
			"width":80, 
			"title":"<?php 
            echo ext_Lang::msg(array('miscchmod' => $i), true);
            ?>
",					
			"items": [{
				<?php 
            for ($j = 0; $j < 3; ++$j) {
                ?>
					"xtype": "checkbox",
					"boxLabel":"<?php 
                echo $pos[$j];
                ?>
",
					<?php 
                if ($mode[3 * $i + $j] != "-") {
                    echo '"checked":true,';
                }
                ?>
						"name":"<?php 
                echo "r_" . $i . $j;
                ?>
"
					}	<?php 
                if ($j < 2) {
                    echo ',{';
                }
            }
            ?>
	
				]
			}
		<?php 
            if ($i < 2) {
                echo ',{';
            }
        }
        ?>
,{
			"width":400, 
			"style":"margin-left:10px", 
			"clear":true,
			"html": "&nbsp;"
		}]

	},{
		"xtype": "checkbox",
		"fieldLabel":"<?php 
        echo ext_Lang::msg('recurse_subdirs', true);
        ?>
",
		"name":"do_recurse"
	}],
	"buttons": [{
		"text": "<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
", 
		"handler": function() {
			statusBarMessage( '<?php 
        echo ext_Lang::msg('permissions_processing', true);
        ?>
', true );
			form = Ext.getCmp("simpleform").getForm();
			form.submit({
				//reset: true,
				reset: false,
				success: function(form, action) {
					statusBarMessage( action.result.message, false, true );
					datastore.reload();
					Ext.getCmp("dialog").destroy();
				},
				failure: function(form, action) {
					statusBarMessage( action.result.error, false, false );
					Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
', action.result.error);
				},
				scope: form,
				params: {
					"option": "com_extplorer", 
					"action": "chmod", 
					"dir": "<?php 
        echo stripslashes($GLOBALS['__POST']["dir"]);
        ?>
", 
					"selitems[]": ['<?php 
        echo implode("','", $GLOBALS['__POST']["selitems"]);
        ?>
'], 
					confirm: 'true'
				}
			});
		}
	},{
		"text": "<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
", 
		"handler": function() { Ext.getCmp("dialog").destroy(); }
	}]
}
	
		<?php 
    }
コード例 #26
0
ファイル: chmod.php プロジェクト: shamblett/janitor
    function execAction($dir, $item)
    {
        // change permissions
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('chmod', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (!empty($GLOBALS['__POST']["selitems"])) {
            $cnt = count($GLOBALS['__POST']["selitems"]);
        } else {
            $GLOBALS['__POST']["selitems"][] = $item;
            $cnt = 1;
        }
        if (!empty($GLOBALS['__POST']['do_recurse'])) {
            $do_recurse = true;
        } else {
            $do_recurse = false;
        }
        // Execute
        if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
            $bin = '';
            for ($i = 0; $i < 3; $i++) {
                for ($j = 0; $j < 3; $j++) {
                    $tmp = "r_" . $i . $j;
                    if (!empty($GLOBALS['__POST'][$tmp])) {
                        $bin .= '1';
                    } else {
                        $bin .= '0';
                    }
                }
            }
            if ($bin == '0') {
                // Changing permissions to "none" is not allowed
                ext_Result::sendResult('chmod', false, $item . ": " . ext_Lang::err('chmod_none_not_allowed'));
            }
            $old_bin = $bin;
            for ($i = 0; $i < $cnt; ++$i) {
                if (ext_isFTPMode()) {
                    $mode = decoct(bindec($bin));
                } else {
                    $mode = bindec($bin);
                }
                $item = $GLOBALS['__POST']["selitems"][$i];
                if (ext_isFTPMode()) {
                    $abs_item = get_item_info($dir, $item);
                } else {
                    $abs_item = get_abs_item($dir, $item);
                }
                if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
                    ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
                }
                if (!get_show_item($dir, $item)) {
                    ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
                }
                if ($do_recurse) {
                    $ok = $GLOBALS['ext_File']->chmodRecursive($abs_item, $mode);
                } else {
                    if (get_is_dir($abs_item)) {
                        // when we chmod a directory we must care for the permissions
                        // to prevent that the directory becomes not readable (when the "execute bits" are removed)
                        $bin = substr_replace($bin, '1', 2, 1);
                        // set 1st x bit to 1
                        $bin = substr_replace($bin, '1', 5, 1);
                        // set  2nd x bit to 1
                        $bin = substr_replace($bin, '1', 8, 1);
                        // set 3rd x bit to 1
                        if (ext_isFTPMode()) {
                            $mode = decoct(bindec($bin));
                        } else {
                            $mode = bindec($bin);
                        }
                    }
                    //ext_Result::sendResult('chmod', false, $GLOBALS['FTPCONNECTION']->pwd());
                    $ok = @$GLOBALS['ext_File']->chmod($abs_item, $mode);
                }
                $bin = $old_bin;
            }
            if ($ok === false || PEAR::isError($ok)) {
                $msg = $item . ": " . $GLOBALS["error_msg"]["permchange"];
                $msg .= PEAR::isError($ok) ? ' [' . $ok->getMessage() . ']' : '';
                ext_Result::sendResult('chmod', false, $msg);
            }
            ext_Result::sendResult('chmod', true, ext_Lang::msg('permchange'));
            return;
        }
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]);
        } else {
            $abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]);
            $abs_item = utf8_decode($abs_item);
        }
        $mode = parse_file_perms(get_file_perms($abs_item));
        if ($mode === false) {
            ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["permread"]);
        }
        $pos = "rwx";
        $text = "";
        for ($i = 0; $i < $cnt; ++$i) {
            $s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]);
            if (strlen($s_item) > 50) {
                $s_item = "..." . substr($s_item, -47);
            }
            $text .= $s_item . ($i + 1 < $cnt ? ', ' : '');
        }
        ?>
	<div style="width:auto;">
	    <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
	    <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
	
	        <h3 style="margin-bottom:5px;"><?php 
        echo ext_Lang::msg('actperms');
        ?>
</h3>
	        <?php 
        echo $text;
        ?>
	        <div id="adminForm">
	
	        </div>
	    </div></div></div>
	    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
	</div>
	<script type="text/javascript">
	var form = new Ext.form.Form({
	    labelWidth: 125, // label settings here cascade unless overridden
	    url:'<?php 
        echo basename($GLOBALS['script_name']);
        ?>
'
	});
	
	<?php 
        // print table with current perms & checkboxes to change
        for ($i = 0; $i < 3; ++$i) {
            ?>
			form.column(
		        {width:70, style:'margin-left:10px', clear:true}
		    );
			form.fieldset(
			        {legend:'<?php 
            echo ext_Lang::msg(array('miscchmod' => $i), true);
            ?>
', hideLabels:true},
			        <?php 
            for ($j = 0; $j < 3; ++$j) {
                ?>
				        new Ext.form.Checkbox({
				            boxLabel:'<?php 
                echo $pos[$j];
                ?>
',
				            <?php 
                if ($mode[3 * $i + $j] != "-") {
                    echo 'checked:true,';
                }
                ?>
				            name:'<?php 
                echo "r_" . $i . $j;
                ?>
'
				        })     <?php 
                if ($j < 2) {
                    echo ',';
                }
            }
            ?>
   );
	    	form.end();
	    <?php 
        }
        ?>
	form.column(
	        {width:400, style:'margin-left:10px', clear:true}
	    );
	form.add(new Ext.form.Checkbox({
		fieldLabel:'<?php 
        echo ext_Lang::msg('recurse_subdirs', true);
        ?>
',
		name:'do_recurse'
	}));
	form.end();
	
	form.addButton('<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
', function() {
		statusBarMessage( '<?php 
        echo ext_Lang::msg('permissions_processing', true);
        ?>
', true );
	    form.submit({
	        //reset: true,
	        reset: false,
	        success: function(form, action) {
	        	statusBarMessage( action.result.message, false, true );
	        	datastore.reload();
	    		dialog.hide();
	        	dialog.destroy();
	        },
	        failure: function(form, action) {
	        	statusBarMessage( action.result.error, false, false );
	        	Ext.MessageBox.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
', action.result.error);
	        },
	        scope: form,
	        // add some vars to the request, similar to hidden fields
	        params: {option: 'com_extplorer', 
	        		action: 'chmod', 
	        		dir: '<?php 
        echo stripslashes($GLOBALS['__POST']["dir"]);
        ?>
', 
	        		'selitems[]': ['<?php 
        echo implode("','", $GLOBALS['__POST']["selitems"]);
        ?>
'], 
	        		confirm: 'true'}
	    });
	});
	form.addButton('<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
', function() { dialog.hide();dialog.destroy(); } );
	form.render('adminForm');
	</script>
	
		<?php 
    }
コード例 #27
0
ファイル: list.php プロジェクト: shamblett/janitor
    function execAction($dir)
    {
        // list directory contents
        global $dir_up, $mosConfig_live_site, $_VERSION;
        $allow = ($GLOBALS["permissions"] & 01) == 01;
        $admin = ($GLOBALS["permissions"] & 04) == 04 || ($GLOBALS["permissions"] & 02) == 02;
        $dir_up = dirname($dir);
        if ($dir_up == ".") {
            $dir_up = "";
        }
        if (!get_show_item($dir_up, basename($dir))) {
            ext_Result::sendResult('list', false, $dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
        }
        // Sorting of items
        if ($GLOBALS["direction"] == "ASC") {
            $_srt = "no";
        } else {
            $_srt = "yes";
        }
        show_header();
        $scriptTag = '
		<script type="text/javascript" src="' . _EXT_URL . '/fetchscript.php?' . '&amp;subdir[]=scripts/editarea/&amp;file[]=edit_area_full_with_plugins.js' . '&amp;subdir[]=scripts/extjs/&amp;file[]=yui-utilities.js' . '&amp;subdir[]=scripts/extjs/&amp;file[]=ext-yui-adapter.js' . '&amp;subdir[]=scripts/extjs/&amp;file[]=ext-all.js&amp;gzip=1"></script>
		<script type="text/javascript" src="' . $GLOBALS['script_name'] . '?option=com_extplorer&amp;action=include_javascript&amp;file=functions.js"></script>		
		<link rel="stylesheet" href="' . _EXT_URL . '/fetchscript.php?subdir[0]=scripts/extjs/css/&file[0]=ext-all.css&amp;subdir[1]=scripts/extjs/css/&file[1]=xtheme-aero.css&amp;gzip=1" />';
        if (defined('EXT_STANDALONE')) {
            $GLOBALS['mainframe']->addcustomheadtag($scriptTag);
        } else {
            echo $scriptTag;
        }
        ?>
		<div id="dirtree"></div>
	<div id="dirtree-panel"></div>
	<div id="item-grid"></div>
	<div id="ext_statusbar" class="ext_statusbar"></div>
	
	<?php 
        // That's the main javascript file to build the Layout & App Logic
        include _EXT_PATH . '/scripts/application.js.php';
    }
コード例 #28
0
ファイル: search.php プロジェクト: ejailesb/repo_empr
function find_item_ftp($dir, $item, &$list, $recur, $content)
{
    // find items
    $homedir = realpath($GLOBALS['home_dir']);
    $opendir = $dir;
    // convert shell-wildcards to PCRE Regex Syntax
    $pat = str_replace("?", ".", str_replace("*", ".*", str_replace(".", "\\.", $item)));
    if (!is_dir($dir)) {
        $opendir = get_abs_dir($dir);
    }
    $handle = @$GLOBALS['ext_File']->opendir($opendir);
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('search', false, $opendir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        //if(!$GLOBALS['ext_File']->file_exists($abs_new_item)) continue;
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        $isDir = get_is_dir($abs_new_item);
        // match?
        $include = false;
        if (@preg_match('@' . $pat . '@is', $new_item) > 0) {
            $include = true;
        }
        if (!$isDir && $include && $content && $GLOBALS['ext_File']->filesize($abs_new_item) < 524288) {
            $data = $GLOBALS['ext_File']->file_get_contents($abs_new_item);
            $pattern = preg_quote($content, '/');
            // finalise the regular expression, matching the whole line
            $pattern = "/^.*{$pattern}.*\$/m";
            if (preg_match('@' . $pattern . '@is', $data) > 0) {
                $include = true;
            }
        }
        if ($include) {
            $list[] = array($dir, $new_item);
        }
        // search sub-directories
        if ($isDir && $recur) {
            find_item($abs_new_item, $pat, $list, $recur, $content);
        }
    }
    $GLOBALS['ext_File']->closedir($handle);
}
コード例 #29
0
ファイル: diff.php プロジェクト: ejailesb/repo_empr
    function execAction($dir, $item)
    {
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('diff', false, ext_Lang::err('accessfunc'));
        }
        $fname = get_abs_item($dir, $item);
        if (!get_is_file(utf8_decode($fname))) {
            ext_Result::sendResult('diff', false, $item . ": " . ext_Lang::err('fileexist'));
        }
        if (!get_show_item($dir, $item)) {
            ext_Result::sendResult('diff', false, $item . ": " . ext_Lang::err('accessfile'));
        }
        $cnt = 0;
        if (!empty($GLOBALS['__POST']["selitems"])) {
            $cnt = count($GLOBALS['__POST']["selitems"]);
        }
        $item2 = extGetParam($_POST, 'item2');
        if ($item2 !== null) {
            $fname2 = get_abs_item('', utf8_decode($item2));
        } elseif ($cnt >= 2) {
            $item2 = $GLOBALS['__POST']["selitems"][1];
            $fname2 = get_abs_item($dir, $item2);
        }
        if ($item2 !== null) {
            if (!get_is_file($fname2)) {
                ext_Result::sendResult('diff', false, $item2 . ": " . ext_Lang::err('fileexist'));
            }
            if (!get_show_item('', $item2)) {
                ext_Result::sendResult('diff', false, $item2 . ": " . ext_Lang::err('accessfile'));
            }
        } elseif (empty($cnt) && extGetParam($_POST, 'confirm') == 'true') {
            ext_Result::sendResult('diff', false, 'Please select a second file to diff to');
        }
        if ($item2 || $cnt >= 2) {
            // Show File In TextArea
            $content = $GLOBALS['ext_File']->file_get_contents($fname);
            $content2 = $GLOBALS['ext_File']->file_get_contents($fname2);
            //$content = nl2br(str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", htmlentities($content)));
            //$content2 = nl2br(str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", htmlentities($content2)));
            $diff = $this->inline_diff($content, $content2);
            if (empty($diff)) {
                ext_Result::sendResult('diff', true, 'Both Files are identical');
            }
            $diff = utf8_encode(nl2br($diff));
            echo '{ "xtype": "panel", "dialogtitle": "Diff Result", "html": "' . str_replace(array("\n", "\r"), array('', ''), $diff) . '" }';
            exit;
        }
        ?>
{
	"xtype": "form",
	"id": "simpleform",
	"width": "700",
	"labelWidth": 125,
	"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
	"dialogtitle": "Diff <?php 
        echo htmlentities($item);
        if ($item2) {
            echo ' and ' . htmlentities($item2);
        }
        ?>
",
	"title": "Diff",
	"items": [{
		xtype: "textfield",
		fieldLabel: 'File to Compare',
		name: 'item2',
		value: "<?php 
        echo $dir;
        ?>
/",
		width:175,
		allowBlank:false
		}],
    buttons: [{
		"text": "<?php 
        echo ext_Lang::msg('btndiff', true);
        ?>
", 
		"handler": function() {
			statusBarMessage( 'Please wait...', true );
			form = Ext.getCmp("simpleform").getForm();
			form.submit({
				//reset: true,
				reset: false,
				success: function(form, action) {
					Ext.getCmp("dialog").setContent( action.result.message, true );
				},
				failure: function(form, action) {
					if( !action.result ) return;
					Ext.MessageBox.alert('Error!', action.result.error);
					statusBarMessage( action.result.error, false, true );
				},
				scope: form,
				// add some vars to the request, similar to hidden fields
				params: {
					"option": "com_extplorer", 
					"action": "diff", 
					"dir": "<?php 
        echo stripslashes($GLOBALS['__POST']["dir"]);
        ?>
", 
					"item": "<?php 
        echo $item;
        ?>
",
					"selitems[]": ['<?php 
        echo implode("','", $GLOBALS['__POST']["selitems"]);
        ?>
'], 
					confirm: 'true'
				}
			});
		}
	},{
		"text": "<?php 
        echo ext_Lang::msg('btncancel', true);
        ?>
", 
		"handler": function() { Ext.getCmp("dialog").destroy(); }
	}]
}
	<?php 
    }
コード例 #30
0
function edit_file($dir, $item)
{
    if (!permissions_grant($dir, $item, "change")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!get_is_file($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
    }
    if (!get_show_item($dir, $item)) {
        show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
    }
    $fname = get_abs_item($dir, $item);
    if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
        // Save / Save As
        $item = basename(stripslashes($GLOBALS['__POST']["fname"]));
        $fname2 = get_abs_item($dir, $item);
        if (!isset($item) || $item == "") {
            show_error($GLOBALS["error_msg"]["miscnoname"]);
        }
        if ($fname != $fname2 && @file_exists($fname2)) {
            show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
        }
        savefile($fname2);
        $fname = $fname2;
    }
    // open file
    $fp = @fopen($fname, "r");
    if ($fp === false) {
        show_error($item . ": " . $GLOBALS["error_msg"]["openfile"]);
    }
    // header
    $s_item = get_rel_item($dir, $item);
    if (strlen($s_item) > 50) {
        $s_item = "..." . substr($s_item, -47);
    }
    show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item);
    // Wordwrap (works only in IE)
    ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function chwrap() {
		if(document.editfrm.wrap.checked) {
			document.editfrm.code.wrap="soft";
		} else {
			document.editfrm.code.wrap="off";
		}
	}
// -->
</script>

<script language="Javascript" type="text/javascript">
		// initialisation
		editAreaLoader.init({
			id: "txtedit"	// id of the textarea to transform		
			,start_highlight: true	// if start with highlight
			,allow_resize: "both"
			//,min_width = 400
			//,min_height = 100
			//,allow_resize: "y"
			,allow_toggle: true
			,word_wrap: true
			,language: "<?php 
    echo $GLOBALS["language"];
    ?>
"
			,syntax: "<?php 
    echo get_mime_type($dir, $item, "ext");
    ?>
"	
		});
</script>

<?php 
    // Form
    echo "<BR><FORM name=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n";
    echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\">\n";
    echo "<TEXTAREA NAME=\"code\" ID=\"txtedit\" rows=\"25\" cols=\"120\" wrap=\"off\">";
    // Show File In TextArea
    $buffer = "";
    while (!feof($fp)) {
        $buffer .= fgets($fp, 4096);
    }
    @fclose($fp);
    //echo htmlspecialchars($buffer);
    echo $buffer;
    echo "</TEXTAREA><BR>\n<TABLE><TR><TD>Wordwrap: (IE only)</TD><TD><INPUT type=\"checkbox\" name=\"wrap\" ";
    echo "onClick=\"javascript:chwrap();\" value=\"1\"></TD></TR></TABLE><BR>\n";
    echo "<TABLE><TR><TD><INPUT type=\"text\" name=\"fname\" value=\"" . $item . "\"></TD>";
    echo "<TD><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"];
    echo "\"></TD>\n<TD><input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\"></TD>\n<TD>";
    echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onClick=\"javascript:location='";
    echo make_link("list", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR>\n";
    ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	if(document.editfrm) document.editfrm.code.focus();
// -->
</script><?php 
}