/** * @version $Id: header.php 187 2011-01-18 15:25:24Z soeren $ * @package eXtplorer * @copyright soeren 2007-2009 * @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." * * This is the file, which prints the header row with the Logo */ function show_header($dirlinks = '') { $url = str_replace(array('&dir=', '&action=', '&file_mode='), array('&a=', '&b=', '&c='), $_SERVER['REQUEST_URI']); $url_appendix = strpos($url, '?') === false ? '?' : '&'; echo "<link rel=\"stylesheet\" href=\"" . _EXT_URL . "/style/style.css\" type=\"text/css\" />\n"; echo "<div id=\"ext_header\">\n"; echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n"; $mode = extGetParam($_SESSION, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']); $logoutlink = ' <a href="' . $GLOBALS['script_name'] . '?option=com_extplorer&action=logout" title="' . $GLOBALS['messages']['logoutlink'] . '">[' . $GLOBALS['messages']['logoutlink'] . ']</a>'; $alternate_modes = array(); foreach ($GLOBALS['ext_conf']['authentication_methods_allowed'] as $method) { if ($method != $mode) { $onclick = ''; if (empty($_SESSION['credentials_' . $method])) { $onclick = "onclick=\"openActionDialog('switch_file_mode', '" . $method . "_authentication');return false;\""; } $alternate_modes[] = "<a {$onclick} href=\"{$url}" . $url_appendix . "file_mode={$method}\">{$method}</a>"; } } echo '<tr><td width="20%">'; if (is_object($GLOBALS['_VERSION']) || class_exists('jversion')) { echo '<a href="' . basename($_SERVER['SCRIPT_NAME']) . '">Back to ' . (!empty($GLOBALS['_VERSION']->PRODUCT) ? @$GLOBALS['_VERSION']->PRODUCT : 'Joomla!') . '</a>'; } else { echo ext_selectList('language_selector', $GLOBALS['language'], get_languages(), 1, '', 'onchange="document.location.href=\'' . $GLOBALS['script_name'] . '?lang=\' + this.options[this.selectedIndex].value;"'); } // Logo echo "</td><td style=\"color:black;\" width=\"10%\">"; //echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >"; echo "<a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\" title=\"eXtplorer Project\">\r\n\t\t<img src=\"" . _EXT_URL . "/images/eXtplorer_logo.png\" alt=\"eXtplorer Logo\" border=\"0\" /></a>\r\n\t\t</td>"; //echo "</div>"; echo "<td style=\"padding-left: 15px; color:black;\" id=\"bookmark_container\" width=\"35%\"></td>\n"; echo "<td width=\"25%\" style=\"padding-left: 15px; color:black;\">" . sprintf($GLOBALS['messages']['switch_file_mode'], $mode . $logoutlink, implode(', ', $alternate_modes)) . "\r\n\t</td>\n"; echo '</tr></table>'; echo '</div>'; }
/** * @version $Id: header.php 116 2009-01-15 20:39:58Z 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." * * This is the file, which prints the header row with the Logo */ function show_header($dirlinks = '') { $url = str_replace('&dir=', '&ignore=', $_SERVER['REQUEST_URI']); $url_appendix = strpos($url, '?') === false ? '?' : '&'; echo "<link rel=\"stylesheet\" href=\"" . _EXT_URL . "/style/style.css\" type=\"text/css\" />\n"; echo "<div id=\"ext_header\">\n"; echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n"; $mode = extGetParam($_SESSION, 'file_mode', 'file'); $logoutlink = $mode == 'ftp' ? ' <a href="' . $GLOBALS['script_name'] . '?option=com_extplorer&action=ftp_logout" title="' . $GLOBALS['messages']['logoutlink'] . '">[' . $GLOBALS['messages']['logoutlink'] . ']</a>' : ''; $alternate_mode = $mode == 'file' ? 'ftp' : 'file'; echo '<tr><td width="20%">'; if (is_object($GLOBALS['_VERSION']) || class_exists('jversion')) { echo "<a href=\"index2.php\">Back to " . (!empty($GLOBALS['_VERSION']->PRODUCT) ? @$GLOBALS['_VERSION']->PRODUCT : 'Joomla!') . '</a>'; } else { echo ext_selectList('language_selector', $GLOBALS['language'], get_languages(), 1, '', 'onchange="document.location.href=\'' . $GLOBALS['script_name'] . '?lang=\' + this.options[this.selectedIndex].value;"'); } // Logo echo "</td><td style=\"color:black;\" width=\"10%\">"; //echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >"; echo "<a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\" title=\"eXtplorer Project\">\r\n\t\t<img src=\"" . _EXT_URL . "/images/eXtplorer.gif\" alt=\"eXtplorer Logo\" border=\"0\" /></a>\r\n\t\t</td>"; //echo "</div>"; echo "<td style=\"padding-left: 15px; color:black;\" id=\"bookmark_container\" width=\"35%\"></td>\n"; echo "<td width=\"25%\" style=\"padding-left: 15px; color:black;\">" . sprintf($GLOBALS['messages']['switch_file_mode'], $mode . $logoutlink, "<a id=\"switch_file_mode\" href=\"{$url}" . $url_appendix . "file_mode={$alternate_mode}\">{$alternate_mode}</a>") . "\r\n\t</td>\n"; echo '</tr></table>'; echo '</div>'; }
/** * Returns select lists with all the subdirectories along the current directory path * * @param string $dir * @return string */ function get_dir_selects($dir) { $dirs = explode("/", str_replace("\\", '/', $dir)); $subdirs = get_dir_list(); if (sizeof($subdirs) > 0) { $subdirs = array_merge(array('ext_disabled' => '-'), $subdirs); } if (empty($dirs[0])) { array_shift($dirs); } $dirsCopy = $dirs; $implode = ''; $selectedDir = @$dirs[0]; foreach ($subdirs as $index => $val) { if ($GLOBALS['use_mb']) { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[$index] = utf8_encode($val); } else { $subdirs[$index] = $val; } } else { $subdirs[$index] = utf8_encode($val); } } $dir_links = ext_selectList('dirselect1', $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'ext_disabled\' ) chDir(theDir);"'); $i = 2; foreach ($dirs as $directory) { if ($directory != "") { $implode .= $directory; $next = next($dirsCopy); $subdirs = get_dir_list($implode); foreach ($subdirs as $index => $val) { unset($subdirs[$index]); if ($GLOBALS['use_mb']) { if (mb_detect_encoding($index) == 'ASCII') { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[utf8_encode($index)] = utf8_encode($val); } else { $subdirs[utf8_encode($index)] = $val; } } else { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[$index] = utf8_encode($val); } else { $subdirs[$index] = $val; } } } else { $subdirs[utf8_encode($index)] = utf8_encode($val); } } if ($next !== false) { $selectedDir .= '/' . $next; } else { if (sizeof($subdirs) > 0) { $subdirs = array_merge(array('ext_disabled' => '-'), $subdirs); } } $dir_links .= ' / ' . ext_selectList('dirselect' . $i++, $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'ext_disabled\' ) chDir(theDir);"'); $implode .= '/'; } } //echo '<pre>'.htmlspecialchars($dir_links).'</pre>';exit; return $dir_links; }
/** * Lists all bookmarked directories in a dropdown list. * * @param string $dir */ function 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="' . 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 . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" >' . $img_add . '</a>'; } elseif ($dir != '' && $dir != '/') { $removelink = '<a href="' . 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 . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '">' . $img_remove . '</a>'; } $html .= $addlink . ' ' . $removelink; return $html; }