function ext_copy_dir($abs_item, $abs_new_item)
 {
     if (ext_isFTPMode()) {
         $tmp_dir = ext_ftp_make_local_copy($abs_item);
         $res = $GLOBALS['FTPCONNECTION']->putRecursive($tmp_dir, $abs_new_item);
         remove($tmp_dir);
         return $res;
     } else {
         return ext_copy_dir($abs_item, $abs_new_item);
     }
 }
示例#2
0
 function execAction($dir, $item, $unlink = false)
 {
     // download file
     global $action, $mosConfig_cache_path;
     // 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["permissions"] & 01) != 01) {
         ext_Result::sendResult('download', false, $GLOBALS["error_msg"]["accessfunc"]);
     }
     if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
         ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
     }
     if (!get_show_item($dir, $item)) {
         ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
     }
     if (ext_isFTPMode()) {
         $abs_item = ext_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(utf8_decode($abs_item));
     if ($unlink == true) {
         unlink(utf8_decode($abs_item));
     }
     ob_end_flush();
     ext_exit();
 }
示例#3
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();
 }
示例#4
0
文件: view.php 项目: elevenfox/VTree
    function execAction($dir, $item)
    {
        // show file contents
        global $action;
        if (@eregi($GLOBALS["images_ext"], $item)) {
            $html = '<img src="' . make_link('get_image', $dir, rawurlencode($item)) . '" alt="' . $GLOBALS["messages"]["actview"] . ": " . $item . '" /><br /><br />';
        } elseif (@eregi($GLOBALS["editable_ext"], $item)) {
            $geshiFile = _EXT_PATH . '/libraries/geshi/geshi.php';
            ext_RaiseMemoryLimit('32M');
            // GeSHi 1.0.7 is very memory-intensive
            include_once $geshiFile;
            // Create the GeSHi object that renders our source beautiful
            $geshi = new GeSHi('', '', dirname($geshiFile) . '/geshi');
            $file = get_abs_item($dir, $item);
            $pathinfo = pathinfo($file);
            if (ext_isFTPMode()) {
                $file = ext_ftp_make_local_copy($file);
            }
            if (is_callable(array($geshi, 'load_from_file'))) {
                $geshi->load_from_file($file);
            } else {
                $geshi->set_source(file_get_contents($file));
            }
            if (is_callable(array($geshi, 'get_language_name_from_extension'))) {
                $lang = $geshi->get_language_name_from_extension($pathinfo['extension']);
            } else {
                $pathinfo = pathinfo($item);
                $lang = $pathinfo['extension'];
            }
            $geshi->set_language($lang);
            $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
            $langs = $GLOBALS["language"];
            if ($langs == "japanese") {
                $enc_list = array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN");
                $_e0 = strtoupper(mb_detect_encoding($geshi->source, $enc_list, true));
                if ($_e0 == "SJIS-WIN") {
                    $_encoding = "Shift_JIS";
                } elseif ($_e0 == "EUCJP-WIN") {
                    $_e0 = "EUC-JP";
                } elseif ($_e0 == "ASCII") {
                    $_e0 = "UTF-8";
                } else {
                    $_encoding = $_e0;
                }
                $geshi->set_encoding($_encoding);
            }
            $html = $geshi->parse_code();
            if ($langs == "japanese") {
                if (empty($lang) || strtoupper(mb_detect_encoding($html, $enc_list)) != "UTF-8") {
                    $html = mb_convert_encoding($html, "UTF-8", $_e0);
                }
            }
            if (ext_isFTPMode()) {
                unlink($file);
            }
            $html .= '<hr /><div style="line-height:25px;vertical-align:middle;text-align:center;" class="small">Rendering Time: <strong>' . $geshi->get_time() . ' Sec.</strong></div>';
        } else {
            $html = '
			<iframe src="' . make_link('download', $dir, $item, null, null, null, '&action2=view') . '" id="iframe1" width="100%" height="100%" frameborder="0"></iframe>';
        }
        $html = str_replace(array("\r", "\n"), array('\\r', '\\n'), addslashes($html));
        ?>
		{

	"dialogtitle": "<?php 
        echo $GLOBALS['messages']['actview'] . ": " . $item;
        ?>
",
	"height": 500,
	"autoScroll": true,
	"html": "<?php 
        echo $html;
        ?>
"

}
		<?php 
    }
示例#5
0
    function execAction($dir, $item)
    {
        // show file contents
        echo '<div>
    <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;">' . $GLOBALS["messages"]["actview"] . ": " . $item . '</h3>';
        echo '</div></div></div>
	    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
	</div><hr />';
        /*$index2_edit_link = str_replace('/index3.php', '/index2.php', make_link('edit', $dir, $item ));
        		echo '<a name="top" class="componentheading" href="javascript:window.close();">[ '._PROMPT_CLOSE.' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		$abs_item = get_abs_item($dir, $item);
        		if( get_is_editable( $abs_item) && $GLOBALS['ext_File']->is_writable( $abs_item )) {
        			// Edit the file in the PopUp
        			echo '<a class="componentheading" href="'.make_link('edit', $dir, $item ).'&amp;return_to='.urlencode($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ).'">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        			// Edit the file in the parent window
        			//echo '<a class="componentheading" href="javascript:opener.location=\''.$index2_edit_link.'\'; window.close();">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		}
        		echo '<a class="componentheading" href="#bottom">[ '._CMN_BOTTOM.' ]</a>';
        		
        		echo '<br /><br />';
        		*/
        if (@eregi($GLOBALS["images_ext"], $item)) {
            echo '<img src="' . make_link('get_image', $dir, rawurlencode($item)) . '" alt="' . $GLOBALS["messages"]["actview"] . ": " . $item . '" /><br /><br />';
        } else {
            $geshiFile = _EXT_PATH . '/libraries/geshi/geshi.php';
            if (file_exists($geshiFile)) {
                ext_RaiseMemoryLimit('32M');
                // GeSHi 1.0.7 is very memory-intensive
                include_once $geshiFile;
                // Create the GeSHi object that renders our source beautiful
                $geshi = new GeSHi('', '', dirname($geshiFile) . '/geshi');
                $file = get_abs_item($dir, $item);
                $pathinfo = pathinfo($file);
                if (ext_isFTPMode()) {
                    $file = ext_ftp_make_local_copy($file);
                }
                if (is_callable(array($geshi, 'load_from_file'))) {
                    $geshi->load_from_file($file);
                } else {
                    $geshi->set_source(file_get_contents($file));
                }
                if (is_callable(array($geshi, 'getlanguagesuage_name_from_extension'))) {
                    $lang = $geshi->getlanguagesuage_name_from_extension($pathinfo['extension']);
                } else {
                    $pathinfo = pathinfo($item);
                    $lang = $pathinfo['extension'];
                }
                $geshi->set_language($lang);
                $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
                $text = $geshi->parse_code();
                if (ext_isFTPMode()) {
                    unlink($file);
                }
                echo $text;
                echo '<hr /><div style="line-height:25px;vertical-align:middle;text-align:center;" class="small">Rendering Time: <strong>' . $geshi->get_time() . ' Sec.</strong></div>';
            } else {
                // When GeSHi is not available, just display the plain file contents
                echo '<div class="quote" style="text-align:left;">' . nl2br(htmlentities($GLOBALS['ext_File']->file_get_contents(get_abs_item($dir, $item)))) . '</div>';
            }
        }
        //echo '<a href="#top" name="bottom" class="componentheading">[ '._CMN_TOP.' ]</a><br /><br />';
    }