コード例 #1
0
ファイル: filelistwidget.php プロジェクト: srueegger/1zu12bB
 public function load()
 {
     $this->headline = $GLOBALS['language']->getString("FILES");
     if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
         $_GET['dir'] = "";
     }
     $uploadpath = Settings::getInstance()->get("root") . "content/uploads/";
     $this->template = new Template();
     $this->template->load("plugin_filelistwidget_filelist");
     $this->template->show_if("FILES_EXIST", false);
     $this->template->show_if("NOFILES", false);
     $this->template->assign_var("DIR", htmlentities($_GET['dir']));
     $actions = ActionList::get("plugin_filelistwidget");
     $dir = $_GET['dir'];
     if (file_exists($uploadpath . $dir)) {
         $this->delete($uploadpath);
         $this->rename($dir, $uploadpath);
         $verzeichnis = openDir($uploadpath . $dir);
         $pre = "";
         $path = "";
         foreach (explode("/", $dir) as $cDir) {
             $index = $this->template->add_loop_item("PATH");
             $path .= "/" . $cDir;
             if ($path == "/") {
                 $this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files");
                 $this->template->assign_loop_var("PATH", $index, "LABEL", "/");
                 $path = "";
             } else {
                 $this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files&dir=" . $path);
                 $this->template->assign_loop_var("PATH", $index, "LABEL", $cDir);
             }
         }
         if (trim($_GET['dir']) != "" & trim($_GET['dir']) != "/") {
             $this->template->assign_var("DELETEFOLDERLINK", "<a href=\"/admin/index.php?page=files&rmdir=" . $_GET['dir'] . "\">Ordner l&ouml;schen</a>");
         } else {
             $this->template->assign_var("DELETEFOLDERLINK", "");
         }
         $files = FileServer::getFiles($uploadpath . $dir);
     }
     if (isset($files) && sizeOf($files) > 0) {
         $this->template->show_if("FILES_EXIST", true);
         $this->template->show_if("NOFILES", false);
         foreach ($files as $file) {
             $index = $this->template->add_loop_item("FILES");
             $this->template->assign_loop_var("FILES", $index, "IMAGE", $this->getImageCode($uploadpath, $dir, $file));
             $this->template->assign_loop_var("FILES", $index, "FILELINK", "<a href=\"../content/uploads" . $dir . "/" . $file . "\">" . $file . "</a>");
             $params = array();
             $params['dir'] = $_GET['dir'];
             $params['file'] = $file;
             $this->template->assign_loop_var("FILES", $index, "ACTIONS", $actions->getCode($params));
         }
     } else {
         $this->template->show_if("FILES_EXIST", false);
         $this->template->show_if("NOFILES", true);
     }
     $this->template->assign_var("MESSAGE", "");
     $this->content = $this->template->getCode();
 }