// Get Sortorder $GLOBALS["direction"] = extGetParam($_REQUEST, 'direction', 'ASC'); // show hidden files in QuiXplorer: (hide files starting with '.', as in Linux/UNIX) $GLOBALS["show_hidden"] = true; // filenames not allowed to access: (uses PCRE regex syntax) $GLOBALS["no_access"] = "^\\.ht"; // user permissions bitfield: (1=modify, 2=password, 4=admin, add the numbers) $GLOBALS["permissions"] = 1; $GLOBALS['file_mode'] = 'file'; //------------------------------------------------------------------------------ $GLOBALS['ext_File'] = new ext_File(); $abs_dir = get_abs_dir($GLOBALS["dir"]); if (!file_exists($GLOBALS["home_dir"])) { if (!file_exists($GLOBALS["home_dir"] . $GLOBALS["separator"])) { if (!empty($GLOBALS["require_login"])) { $extra = "<a href=\"" . ext_make_link("logout", NULL, NULL) . "\">" . $GLOBALS["messages"]["btnlogout"] . "</A>"; } else { $extra = NULL; } $GLOBALS['ERROR'] = $GLOBALS["error_msg"]["home"]; } } if (!down_home($abs_dir)) { ext_Result::sendResult('', false, $GLOBALS["dir"] . " : " . $GLOBALS["error_msg"]["abovehome"]); $dir = $GLOBALS['dir'] = $_SESSION['ext_dir'] = ''; return false; } if (!is_dir($abs_dir) && !is_dir($abs_dir . $GLOBALS["separator"])) { $GLOBALS['ERROR'] = $abs_dir . " : " . $GLOBALS["error_msg"]["direxist"]; $dir = $GLOBALS['dir'] = $_SESSION['ext_dir'] = ''; }
function get_result_array($list) { // print table of found items if (!is_array($list)) { return; } $cnt = count($list); $array = array(); for ($i = 0; $i < $cnt; ++$i) { $dir = $list[$i][0]; $item = $list[$i][1]; $s_dir = str_replace($GLOBALS['home_dir'], '', $dir); if (strlen($s_dir) > 65) { $s_dir = substr($s_dir, 0, 62) . "..."; } $s_item = $item; if (strlen($s_item) > 45) { $s_item = substr($s_item, 0, 42) . "..."; } $link = ""; $target = ""; if (get_is_dir($dir, $item)) { $img = "dir.png"; $link = ext_make_link("list", get_rel_item($dir, $item), NULL); } else { $img = get_mime_type($item, "img"); //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) { $link = $GLOBALS["home_url"] . "/" . get_rel_item($dir, $item); $target = "_blank"; //} } $array[$i]['last_mtime'] = ext_isFTPMode() ? $GLOBALS['ext_File']->filemtime($GLOBALS['home_dir'] . '/' . $dir . '/' . $item) : filemtime($dir . '/' . $item); $array[$i]['file_id'] = md5($s_dir . $s_item); $array[$i]['dir'] = str_replace($GLOBALS['home_dir'], '', $dir); $array[$i]['s_dir'] = empty($s_dir) ? '' : $s_dir; $array[$i]['file'] = $s_item; $array[$i]['link'] = $link; $array[$i]['icon'] = _EXT_URL . "/images/{$img}"; } return $array; }
function execAction($dir) { if (($GLOBALS["permissions"] & 01) != 01) { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["accessfunc"]); } if (!$GLOBALS["zip"] && !$GLOBALS["tgz"]) { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnofunc"]); } $allowed_types = array('zip', 'tgz', 'tbz', 'tar'); // If we have something to archive, let's do it now if (extGetParam($_POST, 'confirm') == 'true') { $saveToDir = utf8_decode($GLOBALS['__POST']['saveToDir']); if (!file_exists(get_abs_dir($saveToDir))) { ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_notexists')); } if (!is_writable(get_abs_dir($saveToDir))) { ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_unwritable')); } require_once _EXT_PATH . '/libraries/Archive/archive.php'; if (!in_array(strtolower($GLOBALS['__POST']["type"]), $allowed_types)) { ext_Result::sendResult('archive', false, ext_Lang::err('extract_unknowntype') . ': ' . htmlspecialchars($GLOBALS['__POST']["type"])); } // This controls how many files are processed per Step (it's split up into steps to prevent time-outs) $files_per_step = 2000; $cnt = count($GLOBALS['__POST']["selitems"]); $abs_dir = get_abs_dir($dir); $name = basename(stripslashes($GLOBALS['__POST']["name"])); if ($name == "") { ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnoname"]); } $startfrom = extGetParam($_REQUEST, 'startfrom', 0); $dir_contents_cache_name = 'ext_' . md5(implode(null, $GLOBALS['__POST']["selitems"])); $dir_contents_cache_file = _EXT_FTPTMP_PATH . '/' . $dir_contents_cache_name . '.txt'; $archive_name = get_abs_item($saveToDir, $name); $fileinfo = pathinfo($archive_name); if (empty($fileinfo['extension'])) { $archive_name .= "." . $GLOBALS['__POST']["type"]; $fileinfo['extension'] = $GLOBALS['__POST']["type"]; foreach ($allowed_types as $ext) { if ($GLOBALS['__POST']["type"] == $ext && @$fileinfo['extension'] != $ext) { $archive_name .= "." . $ext; } } } if ($startfrom == 0) { for ($i = 0; $i < $cnt; $i++) { $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]); if ($selitem == 'ext_root') { $selitem = ''; } if (is_dir(utf8_decode($abs_dir . "/" . $selitem))) { $items = extReadDirectory(utf8_decode($abs_dir . "/" . $selitem), '.', true, true); foreach ($items as $item) { if (is_dir($item) || !is_readable($item) || $item == $archive_name) { continue; } $v_list[] = str_replace('\\', '/', $item); } } else { $v_list[] = utf8_decode(str_replace('\\', '/', $abs_dir . "/" . $selitem)); } } if (count($v_list) > $files_per_step) { if (file_put_contents($dir_contents_cache_file, implode("\n", $v_list)) == false) { ext_Result::sendResult('archive', false, 'Failed to create a temporary list of the directory contents'); } } } else { $file_list_string = file_get_contents($dir_contents_cache_file); if (empty($file_list_string)) { ext_Result::sendResult('archive', false, 'Failed to retrieve the temporary list of the directory contents'); } $v_list = explode("\n", $file_list_string); } $cnt_filelist = count($v_list); // Now we go to the right range of files and "slice" the array $v_list = array_slice($v_list, $startfrom, $files_per_step - 1); $remove_path = $GLOBALS["home_dir"]; if ($dir) { $remove_path .= $dir; } $remove_path = str_replace('\\', '/', realpath($remove_path)) . '/'; $debug = 'Starting from: ' . $startfrom . "\n"; $debug .= 'Files to process: ' . $cnt_filelist . "\n"; $debug .= implode("\n", $v_list); //file_put_contents( 'log.txt', $debug, FILE_APPEND ); // Do some setup stuff ini_set('memory_limit', '128M'); @set_time_limit(0); //error_reporting( E_ERROR | E_PARSE ); $result = extArchive::create($archive_name, $v_list, $GLOBALS['__POST']["type"], '', $remove_path); if (PEAR::isError($result)) { ext_Result::sendResult('archive', false, $name . ': ' . ext_Lang::err('archive_creation_failed') . ' (' . $result->getMessage() . $archive_name . ')'); } $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON'; $json = new $classname(); if ($cnt_filelist > $startfrom + $files_per_step) { $response = array('startfrom' => $startfrom + $files_per_step, 'totalitems' => $cnt_filelist, 'success' => true, 'action' => 'archive', 'message' => sprintf(ext_Lang::msg('processed_x_files'), $startfrom + $files_per_step, $cnt_filelist)); } else { @unlink($dir_contents_cache_file); if ($GLOBALS['__POST']["type"] == 'tgz' || $GLOBALS['__POST']["type"] == 'tbz') { chmod($archive_name, 0644); } $response = array('action' => 'archive', 'success' => true, 'message' => ext_Lang::msg('archive_created'), 'newlocation' => ext_make_link('download', $dir, basename($archive_name))); } echo $json->encode($response); ext_exit(); } $default_archive_type = 'zip'; ?> { "xtype": "form", "id": "simpleform", "height": "200", "width": "350", "labelWidth": 125, "url":"<?php echo basename($GLOBALS['script_name']); ?> ", "dialogtitle": "<?php echo $GLOBALS["messages"]["actarchive"]; ?> ", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('archive_name', true); ?> ", "name": "name", "value": "<?php echo $GLOBALS['item'] . '.' . $default_archive_type; ?> ", "width": "200" }, { "xtype": "combo", "fieldLabel": "<?php echo ext_Lang::msg('typeheader', true); ?> ", "store": [ ['zip', 'Zip (<?php echo ext_Lang::msg('normal_compression', true); ?> )'], ['tgz', 'Tar/Gz (<?php echo ext_Lang::msg('good_compression', true); ?> )'], <?php if (extension_loaded("bz2")) { echo "['tbz', 'Tar/Bzip2 (" . ext_Lang::msg('best_compression', true) . ")'],"; } ?> ['tar', 'Tar (<?php echo ext_Lang::msg('no_compression', true); ?> )'] ], "displayField":"typename", "valueField": "type", "name": "type", "value": "<?php echo $default_archive_type; ?> ", "triggerAction": "all", "hiddenName": "type", "disableKeyFilter": "true", "editable": "false", "mode": "local", "allowBlank": "false", "selectOnFocus":"true", "width": "200", "listeners": { "select": { fn: function(o, record ) { form = Ext.getCmp("simpleform").getForm(); var nameField = form.findField("name").getValue(); if( nameField.indexOf( '.' ) > 0 ) { form.findField('name').setValue( nameField.substring( 0, nameField.indexOf('.')+1 ) + o.getValue() ); } else { form.findField('name').setValue( nameField + '.'+ o.getValue()); } } } } }, { "xtype": "textfield", "fieldLabel": "<?php echo ext_Lang::msg('archive_saveToDir', true); ?> ", "name": "saveToDir", "value": "<?php echo str_replace("'", "\\'", $dir); ?> ", "width": "200" },{ "xtype": "checkbox", "fieldLabel": "<?php echo ext_Lang::msg('downlink', true); ?> ?", "name": "download", "checked": "true" } ], "buttons": [{ "text": "<?php echo ext_Lang::msg('btncreate', true); ?> ", "type": "submit", "handler": function() { Ext.ux.OnDemandLoad.load( "<?php echo $GLOBALS['script_name']; ?> ?option=com_extplorer&action=include_javascript&file=archive.js", function(options) { submitArchiveForm(0) } ); } },{ "text": "<?php echo ext_Lang::msg('btncancel', true); ?> ", "handler": function() { Ext.getCmp("dialog").destroy() } }] } <?php }
function onLogout() { unset($_SESSION['credentials_ftp']); unset($_SESSION['ftp_host']); unset($_SESSION['ftp_login']); session_write_close(); extRedirect(ext_make_link(null, null, null, null, null, null, '&file_mode=' . $GLOBALS['ext_conf']['authentication_method_default'])); }
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=\"" . ext_make_link("list", "", null) . "\">..</a> / "; foreach ($dirs as $directory) { if ($directory != "") { $implode .= $directory . "/"; $dir_links .= "<a href=\"" . ext_make_link("list", $implode, null) . "\">{$directory}</a> / "; } } echo '<div class="componentheading">' . $GLOBALS["messages"]["actdir"] . ": " . $dir_links . '</div>'; // Sorting of items $images = " <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=\"".ext_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=\"".ext_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=\"".ext_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=\"".ext_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=\"".ext_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=\"".ext_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=\"".ext_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=\"eXtplorer 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=\"".ext_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=\"" . ext_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=\"" . ext_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=\"" . ext_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=\"" . ext_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> </td>"; echo "<td>" . $num_items . " " . $GLOBALS["messages"]["miscitems"] . " " . parse_file_size($tot_file_size) . "</td>\n"; echo "<td> </td><td> </td>"; echo "</tr>\n<tr><td colspan=\"4\"><hr/></td></tr></table>\n"; }
} ?> { // LOGOUT xtype: "tbbutton", id: 'tb_logout', icon: '<?php echo _EXT_URL; ?> /images/_logout.png', tooltip: '<?php echo ext_Lang::msg('logoutlink', true); ?> ', cls:'x-btn-icon', handler: function() { document.location.href='<?php echo ext_make_link('logout', null); ?> '; } }, '-', <?php } ?> new Ext.Toolbar.Button( { text: '<?php echo ext_Lang::msg('show_directories', true); ?> ', enableToggle: true, pressed: true,
function onLogout() { unset($_SESSION['credentials_ssh2']); unset($_SESSION['ssh2_host']); session_write_close(); extRedirect(ext_make_link(null, null, null, null, null, null, '&file_mode=file')); }
/** * Lists all bookmarked directories in a dropdown list. * * @param string $dir */ function ext_list_bookmarks($dir) { $bookmarks = read_bookmarks(); $bookmarks = array_flip($bookmarks); foreach ($bookmarks as $bookmark) { $len = strlen($bookmark); if ($len > 40) { $first_part = substr($bookmark, 0, 20); $last_part = substr($bookmark, -20); $bookmarks[$bookmark] = $first_part . '...' . $last_part; } } $html = $GLOBALS['messages']['quick_jump'] . ': '; if (!empty($dir[0]) && @$dir[0] == '/') { $dir = substr($dir, 1); } $html .= ext_selectList('favourites', $dir, $bookmarks, 1, '', 'onchange="chDir( this.options[this.options.selectedIndex].value);" style="max-width: 200px;"'); $img_add = '<img src="' . _EXT_URL . '/images/_bookmark_add.png" border="0" alt="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" align="absmiddle" />'; $img_remove = '<img src="' . _EXT_URL . '/images/_remove.png" border="0" alt="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '" align="absmiddle" />'; $addlink = $removelink = ''; if (!isset($bookmarks[$dir]) && $dir != '' && $dir != '/') { $addlink = '<a href="' . ext_make_link('modify_bookmark', $dir) . '&task=add" onclick="' . 'Ext.Msg.prompt(\'' . ext_Lang::msg('lbl_add_bookmark', true) . '\', \'' . ext_Lang::msg('enter_alias_name', true) . ':\', ' . 'function(btn, text){ ' . 'if (btn == \'ok\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'add\', ' . 'requestType: \'xmlhttprequest\', ' . 'alias: text, ' . 'dir: \'' . $dir . '\', ' . 'token: \'' . ext_getToken() . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" >' . $img_add . '</a>'; } elseif ($dir != '' && $dir != '/') { $removelink = '<a href="' . ext_make_link('modify_bookmark', $dir) . '&task=remove" onclick="' . 'Ext.Msg.confirm(\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '\',\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '?\', ' . 'function(btn, text){ ' . 'if (btn == \'yes\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'remove\', ' . 'dir: \'' . $dir . '\', ' . 'token: \'' . ext_getToken() . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '">' . $img_remove . '</a>'; } $html .= $addlink . ' ' . $removelink; return $html; }
function execAction($dir, $item) { // show file contents global $action; $item = basename($item); if (@eregi($GLOBALS["images_ext"], $item)) { $html = '<img src="' . ext_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="' . ext_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 }
function onLogout() { unset($_SESSION['credentials_ftp']); unset($_SESSION['ftp_host']); session_write_close(); extRedirect(ext_make_link(null, null, null, null, null, null, '&file_mode=extplorer')); }