/** * head * * @return string */ public function head() { if (Config::get('Gmanager', 'mode') != 'FTP') { $realpath = self::$_instance->realpath(Registry::get('current')); $realpath = $realpath ? $realpath : Registry::get('current'); } else { $realpath = Registry::get('current'); } $chmod = $this->lookChmod(Registry::get('current')); $chmod = $chmod ? $chmod : (isset($_POST['chmod'][0]) ? htmlspecialchars($_POST['chmod'][0], ENT_NOQUOTES) : (isset($_POST['chmod']) ? htmlspecialchars($_POST['chmod'], ENT_NOQUOTES) : 0)); $d = dirname(str_replace('\\', '/', $realpath)); $archive = Helper_Archive::isArchive(Helper_System::getType(Helper_System::basename(Registry::get('current')))); if (Registry::get('currentType') == 'dir' || Registry::get('currentTypeLink') == 'dir') { if (Registry::get('current') == '.') { return '<div class="border">' . Language::get('dir') . ' <a href="?">' . htmlspecialchars(Helper_View::strLink(self::$_instance->getcwd()), ENT_NOQUOTES) . '</a> (' . $this->lookChmod(self::$_instance->getcwd()) . ')<br/></div>'; } else { return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . $d . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>'; } } elseif (Registry::get('currentType') == 'file' && $archive) { $up = dirname($d); return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($up) . '">' . htmlspecialchars(Helper_View::strLink($up), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($up) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . htmlspecialchars(Helper_View::strLink($d), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('file') . ' <a href="?c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>'; } else { $up = dirname($d); return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($up) . '">' . htmlspecialchars(Helper_View::strLink($up), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($up) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . htmlspecialchars(Helper_View::strLink($d), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('file') . ' <a href="?gmanager_action=edit&c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>'; } }
/** * createDir * * @param string $dir * @param mixed $chmod * @return string */ public function createDir($dir = '', $chmod = 0755) { $tmp = $tmp2 = $err = ''; $i = 0; $g = explode(DIRECTORY_SEPARATOR, self::$_instance->getcwd()); foreach (explode('/', $dir) as $d) { $tmp .= $d . '/'; if (isset($g[$i])) { $tmp2 .= $g[$i] . '/'; } if ($tmp == $tmp2 || self::$_instance->is_dir($tmp)) { $i++; continue; } if (!self::$_instance->mkdir($tmp, $chmod)) { $err .= Errors::get() . ' -> ' . htmlspecialchars($tmp, ENT_NOQUOTES) . '<br/>'; } $i++; } if ($err) { return Helper_View::message(Language::get('create_dir_false') . '<br/>' . $err, Helper_View::MESSAGE_ERROR_EMAIL); } else { return Helper_View::message(Language::get('create_dir_true'), Helper_View::MESSAGE_SUCCESS); } }