示例#1
0
 protected function upload()
 {
     $template = new Template();
     $template->load("upload");
     $template->assign_var("REFERRER", $_POST['referrer']);
     $template->show_if("SHOW_MEDIALIBARY", false);
     if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
         mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
     }
     if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
         $name = $_FILES['file']['name'];
         $template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
         $path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
             $template->show_if("SHOW_MEDIALIBARY", true);
             $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
             $template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         }
     } else {
         if (FileServer::$uploadFailure != "") {
             $template->assign_var("MESSAGE", FileServer::$uploadFailure);
         } else {
             $template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
         }
     }
     $template->output();
 }
示例#2
0
 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();
 }
示例#3
0
 public function getCode()
 {
     $res = "<select name=\"" . $this->name . "\" style=\"" . $this->style . "\">";
     foreach (FileServer::getFolders(Settings::getInstance()->get("root") . "system/images/icons") as $iconset) {
         if ($this->value == $iconset) {
             $res .= "<option value=\"" . htmlentities($iconset) . "\" selected=\"1\">" . htmlentities($iconset) . "</option>";
         } else {
             $res .= "<option value=\"" . htmlentities($iconset) . "\">" . htmlentities($iconset) . "</option>";
         }
     }
     $res .= "</select>";
     return $res;
 }
示例#4
0
    public function display()
    {
        $contentpath = Settings::getInstance()->get("root") . "content/articles/" . $_SESSION['dir'] . "/";
        if (isset($_POST['name'])) {
            if (FileServer::IsValidFoldername($_POST['name'])) {
                FileServer::createFolder($contentpath, $_POST['name']);
                ?>
            <script language="JavaScript"><!--
                window.location.href="<?php 
                echo UrlRewriting::GetUrlByAlias("admin/home", "dir=" . $_SESSION['dir'] . "/" . $_POST['name']);
                ?>
";
            // --></script> 
            <?php 
            } else {
                echo Language::DirectTranslateHtml("INVALID_FOLDERNAME");
            }
        }
        $template = new Template();
        $template->load("new_folder");
        $template->output();
    }
示例#5
0
 /**
  *
  * @param string $file
  * @return boolean 
  */
 protected static function checkUploadFile($file)
 {
     $res = true;
     self::$uploadFailure = "";
     switch ($file['error']) {
         case 0:
             break;
         case 1:
             $res = false;
             self::$uploadFailure = str_replace("{VAR:MAX_FILESIZE}", ini_get('upload_max_filesize'), Language::DirectTranslate("UPlOAD_FAILED_SIZE"));
             break;
         case 2:
             $res = false;
             self::$uploadFailure = str_replace("{VAR:MAX_FILESIZE}", IMAGE_MAX_IMAGE_SIZE, Language::DirectTranslate("UPlOAD_FAILED_IMAGE_SIZE"));
             break;
         case 3:
             $res = false;
             self::$uploadFailure = Language::DirectTranslate("UPlOAD_FAILED_PARTIALLY");
         case 4:
             $res = false;
             self::$uploadFailure = Language::DirectTranslate("UPlOAD_FAILED_NONE");
     }
     return $res;
 }
示例#6
0
    function displayBreadcrumb($separator, $class, $idpraefix)
    {
        $host = Settings::getInstance()->get("host");
        ?>
        <script type="text/javascript" src="<?php 
        echo $host;
        ?>
/system/skins/backenddefault/breadcrumb.js"></script>
        <ul id="breadcrumb_dropdown">
          <li>
            <?php 
        $i = 1;
        $breadcrumb = $this->page->getBreadcrumb();
        while ($i <= count($breadcrumb)) {
            $url = UrlRewriting::GetUrlByAlias($breadcrumb[$i - 1][0]);
            echo "<a style='display:inline' href=\"" . $url . "\" class=\"" . $class . "\" \n                      id=\"" . $idpraefix . $i . "\">" . $breadcrumb[$i - 1][1] . "</a>";
            if ($i < count($breadcrumb)) {
                echo $separator;
            }
            $i++;
        }
        if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') {
            $_SESSION['dir'] = $_GET['dir'];
            $first = true;
            $fulldir = "";
            foreach (explode('/', $_GET['dir']) as $dir) {
                if (!$first) {
                    echo $separator . " ";
                    $fulldir .= "/" . $dir;
                } else {
                    $first = false;
                    $fulldir .= $dir;
                }
                $url = UrlRewriting::GetUrlByPage($this->page, "dir=" . $fulldir);
                echo "<a style='display:inline' href='" . $url . "'>" . $dir . "</a>";
            }
        } else {
            $_SESSION['dir'] = "";
        }
        if ($_SESSION['dir'] == "/") {
            $_SESSION['dir'] = "";
        }
        if (!isset($_GET['dir'])) {
            $_GET['dir'] = "/";
        }
        $subFolders = FileServer::getFolders(Settings::getInstance()->get("root") . "content/articles/" . $_GET['dir']);
        sort($subFolders);
        $host = Settings::getInstance()->get("host");
        if ($subFolders) {
            ?>
          </li>
          <li>
            <a href="#" onmouseover="openFolders()" onmouseout="closeFoldersTime()">-&gt; </a>
            <div id="subfolders" onmouseover="cancelClosingFolders()" onmouseout="closeFoldersTime()">
              <?php 
            foreach ($subFolders as $folder) {
                $url = UrlRewriting::GetUrlByPage($this->page, "dir=" . $_GET['dir'] . "/" . $folder);
                echo "<a href='" . $url . "'>" . $folder . "</a>";
            }
            ?>
            </div>
          </li>
        </ul>
      <?php 
        }
    }