Exemplo n.º 1
0
 /**
  * getListSearchArray
  *
  * @param string $where    where
  * @param string $pattern  regexp pattern
  * @param bool   $inText   in text
  * @param int    $limit    max file size
  * @param bool   $archive  in gz archives
  * @param string $t target
  * @return array
  */
 private static function _getListSearchArray($where = '', $pattern = '', $inText = false, $limit = 8388608, $archive = false, $t = '')
 {
     static $count = 0;
     static $page = array();
     $where = str_replace('//', '/', $where . '/');
     $obj = Gmanager::getInstance();
     foreach ($obj->iterator($where) as $f) {
         if ($obj->is_dir($where . $f)) {
             self::_getListSearchArray($where . $f . '/', $pattern, $inText, $limit, $archive, $t);
             continue;
         }
         $type = htmlspecialchars(Helper_System::getType(Helper_System::basename($f)), ENT_NOQUOTES);
         $arch = Helper_Archive::isArchive($type);
         $stat = $obj->stat($where . $f);
         $pname = $pdown = $ptype = $psize = $pchange = $pdel = $pchmod = $pdate = $puid = $pgid = $pn = $in = null;
         if ($inText) {
             if ($stat['size'] > $limit || $arch && !$archive || $arch && $archive && $type != Archive::FORMAT_GZ) {
                 continue;
             }
             $in = preg_match_all($pattern, $type == Archive::FORMAT_GZ ? $obj->getGzContent($where . $f) : $obj->file_get_contents($where . $f), $match);
             unset($match);
             if ($in) {
                 $in = ' (' . $in . ')';
             } else {
                 continue;
             }
         } else {
             $in = preg_match_all($pattern, $f, $match);
             unset($match);
             if (!$in) {
                 continue;
             }
         }
         $count++;
         //$h_file = htmlspecialchars($c . $f, ENT_COMPAT);
         $r_file = Helper_View::getRawurl($where . $f);
         if (Config::get('Display', 'name')) {
             $name = htmlspecialchars(Helper_View::strLink($where . $f, true), ENT_NOQUOTES);
             if ($arch) {
                 $pname = '<a href="index.php?' . $r_file . '">' . $name . '</a>' . $in . '';
             } else {
                 $pname = '<a href="edit.php?' . $r_file . '"' . $t . '>' . $name . '</a>' . $in . '';
             }
         }
         if (Config::get('Display', 'size')) {
             $psize = '' . Helper_View::formatSize($stat['size']) . '';
         }
         if (Config::get('Display', 'chmod')) {
             $pchmod = '<a href="change.php?go=chmod&amp;c=' . $r_file . '">' . $obj->lookChmod($where . $f) . '</a>';
         }
         $page[$f] = '<input name="check[]" type="checkbox" value="' . $r_file . '"/>' . $pname . $psize . $pchmod . $pn;
     }
     //natcasesort($page);
     return $page;
 }
Exemplo n.º 2
0
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
 * @link http://wapinet.ru/gmanager/
 * @version 0.8.1 beta
 * 
 * PHP version >= 5.2.3
 * 
 */
if (Registry::get('current') == '.') {
    Registry::set('current', Gmanager::getInstance()->getcwd() . '/');
    Registry::set('hCurrent', htmlspecialchars(Gmanager::getInstance()->getcwd(), ENT_COMPAT) . '/');
    Registry::set('rCurrent', Helper_View::getRawurl(Gmanager::getInstance()->getcwd()));
}
if (Registry::get('currentType') == 'dir') {
    $archive = null;
} else {
    $archive = Helper_Archive::isArchive(Helper_System::getType(Helper_System::basename(Registry::get('current'))));
}
$f = 0;
$if = isset($_GET['f']);
$ia = isset($_GET['add_archive']);
Gmanager::getInstance()->sendHeader();
echo str_replace('%title%', Registry::get('hCurrent'), Registry::get('top')) . '<div class="w2">' . Language::get('title_index') . '<br/></div>' . Gmanager::getInstance()->head() . Gmanager::getInstance()->langJS();
if (Config::get('Gmanager', 'addressBar')) {
    echo '<div class="edit"><form action="?" method="get"><div class="bar">';
    if ($ia) {
        echo '<input type="hidden" name="add_archive" value="' . htmlspecialchars($_GET['add_archive']) . '"/><input type="hidden" name="go" value="1"/>';
    }
    echo '<input type="text" name="c" value="' . Registry::get('hCurrent') . '"/> <input type="submit" value="' . Language::get('go') . '"/></div></form></div>';
}
if ($idown = isset($_GET['down'])) {
    $down = '&amp;up';
Exemplo n.º 3
0
 /**
  * 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&amp;c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>';
     }
 }