/**
  * Loads the feed and displays it
  *
  * @return string the prepared html-output
  */
 public function loadData()
 {
     $strReturn = "";
     //Load all files in the folder
     $objFilesystem = new class_filesystem();
     $arrFiles = $objFilesystem->getFilelist($this->arrElementData["char2"]);
     $strWrapperTemplateID = $this->objTemplate->readTemplate("/element_directorybrowser/" . $this->arrElementData["char1"], "directorybrowser_wrapper");
     $strEntryTemplateID = $this->objTemplate->readTemplate("/element_directorybrowser/" . $this->arrElementData["char1"], "directorybrowser_entry");
     $strContent = "";
     foreach ($arrFiles as $strOneFile) {
         $arrDetails = $objFilesystem->getFileDetails($this->arrElementData["char2"] . "/" . $strOneFile);
         $arrTemplate = array();
         $arrTemplate["file_name"] = $arrDetails["filename"];
         $arrTemplate["file_href"] = _webpath_ . $this->arrElementData["char2"] . "/" . $strOneFile;
         $arrTemplate["file_date"] = timeToString($arrDetails["filechange"]);
         $arrTemplate["file_size"] = bytesToString($arrDetails["filesize"]);
         $strContent .= $this->fillTemplate($arrTemplate, $strEntryTemplateID);
     }
     $strReturn .= $this->fillTemplate(array("files" => $strContent), $strWrapperTemplateID);
     return $strReturn;
 }
 /**
  * @see interface_admin_systemtask::getAdminForm()
  * @return string
  */
 public function getAdminForm()
 {
     $strReturn = "";
     //show dropdown to select db-dump
     $objFilesystem = new class_filesystem();
     $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz"));
     $arrOptions = array();
     foreach ($arrFiles as $strOneFile) {
         $arrDetails = $objFilesystem->getFileDetails(_projectpath_ . "/dbdumps/" . $strOneFile);
         $strTimestamp = "";
         if (uniStrpos($strOneFile, "_") !== false) {
             $strTimestamp = uniSubstr($strOneFile, uniStrrpos($strOneFile, "_") + 1, uniStrpos($strOneFile, ".") - uniStrrpos($strOneFile, "_"));
         }
         if (uniStrlen($strTimestamp) > 9 && is_numeric($strTimestamp)) {
             $arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefilename") . " " . timeToString($strTimestamp) . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
         } else {
             $arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
         }
     }
     $strReturn .= $this->objToolkit->formInputRadiogroup("dbImportFile", $arrOptions, $this->getLang("systemtask_dbimport_file"));
     return $strReturn;
 }
 /**
  * Returns details and additional functions handling the current image.
  *
  * @return string
  */
 protected function actionImageDetails()
 {
     $strReturn = "";
     //overlay-mode
     $this->setArrModuleEntry("template", "/folderview.tpl");
     $strFile = $this->getParam("file");
     $strFile = uniStrReplace(_webpath_, "", $strFile);
     if (is_file(_realpath_ . $strFile)) {
         $objFilesystem = new class_filesystem();
         $arrDetails = $objFilesystem->getFileDetails($strFile);
         $arrSize = getimagesize(_realpath_ . $strFile);
         //Generate Dimensions
         $intHeight = $arrSize[1];
         $intWidth = $arrSize[0];
         while ($intWidth > 500 || $intHeight > 400) {
             $intWidth *= 0.8;
             $intHeight *= 0.8;
         }
         //Round
         $intWidth = number_format($intWidth, 0);
         $intHeight = number_format($intHeight, 0);
         $strImage = "<img src=\"" . _webpath_ . "/image.php?image=" . urlencode($strFile) . "&amp;maxWidth=" . $intWidth . "&amp;maxHeight=" . $intHeight . "\" id=\"fm_mediamanagerPic\" style=\"max-width: none;\" />";
         $arrActions = array();
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" onclick=\"KAJONA.admin.mediamanager.imageEditor.showRealSize(); return false;\"", "", $this->getLang("showRealsize"), "icon_zoom_in"));
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" onclick=\"KAJONA.admin.mediamanager.imageEditor.showPreview(); return false;\"", "", $this->getLang("showPreview"), "icon_zoom_out")) . " ";
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" onclick=\"KAJONA.admin.mediamanager.imageEditor.rotate(90); return false;\"", "", $this->getLang("rotateImageLeft"), "icon_rotate_left"));
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" onclick=\"KAJONA.admin.mediamanager.imageEditor.rotate(270); return false;\"", "", $this->getLang("rotateImageRight"), "icon_rotate_right")) . " ";
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" onclick=\"KAJONA.admin.mediamanager.imageEditor.showCropping(); return false;\"", "", $this->getLang("cropImage"), "icon_crop"));
         $arrActions[] = $this->objToolkit->listButton(class_link::getLinkAdminManual("href=\"#\" id=\"accept_icon\"  onclick=\"KAJONA.admin.mediamanager.imageEditor.saveCropping(); return false;\"", "", $this->getLang("cropImageAccept"), "icon_crop_acceptDisabled")) . " ";
         $strReturn .= $this->objToolkit->getContentToolbar($arrActions);
         $strReturn .= "<div class=\"imageContainer\"><div class=\"image\">" . $strImage . "</div></div>";
         $strJs = "<script type=\"text/javascript\">\n                KAJONA.admin.loader.loadFile([\n                    '" . class_resourceloader::getInstance()->getCorePathForModule("module_mediamanager") . "/module_mediamanager/admin/scripts/mediamanager.js',\n                    '" . class_resourceloader::getInstance()->getCorePathForModule("module_mediamanager") . "/module_mediamanager/admin/scripts/jcrop/jquery.Jcrop.js',\n                    '" . class_resourceloader::getInstance()->getCorePathForModule("module_mediamanager") . "/module_mediamanager/admin/scripts/jcrop/css/jquery.Jcrop.min.css'\n                ]);\n\n                var fm_image_rawurl = '" . _webpath_ . "/image.php?image=" . urlencode($strFile) . "&quality=80';\n                var fm_image_scaledurl = '" . _webpath_ . "/image.php?image=" . urlencode($strFile) . "&maxWidth=__width__&maxHeight=__height__';\n                var fm_image_scaledMaxWidth = {$intWidth};\n                var fm_image_scaledMaxHeight = {$intHeight};\n                var fm_image_isScaled = true;\n                var fm_file = '" . $strFile . "' ;\n\n                function init_fm_crop_save_warning_dialog() { jsDialog_1.setTitle('" . $this->getLang("cropWarningDialogHeader") . "'); jsDialog_1.setContent('" . $this->getLang("cropWarningSaving") . "', '" . $this->getLang("cropWarningCrop") . "', 'javascript:KAJONA.admin.mediamanager.imageEditor.saveCroppingToBackend()'); jsDialog_1.init(); }\n                function init_fm_screenlock_dialog() { jsDialog_3.init(); }\n                function hide_fm_screenlock_dialog() { jsDialog_3.hide(); }\n\n\n                KAJONA.admin.strCropEnabled= '" . addslashes(class_adminskin_helper::getAdminImage("icon_crop_accept", $this->getLang("cropImageAccept"))) . "';\n                KAJONA.admin.strCropDisabled = '" . addslashes(class_adminskin_helper::getAdminImage("icon_crop_acceptDisabled", $this->getLang("cropImageAccept"))) . "';\n\n                </script>";
         $strJs .= "<input type=\"hidden\" name=\"fm_int_realwidth\" id=\"fm_int_realwidth\" value=\"" . $arrSize[0] . "\" />";
         $strJs .= "<input type=\"hidden\" name=\"fm_int_realheight\" id=\"fm_int_realheight\" value=\"" . $arrSize[1] . "\" />";
         $strReturn .= $strJs;
         $arrTable = array();
         $arrTable[] = array($this->getLang("commons_path"), $strFile);
         $arrTable[] = array($this->getLang("image_dimensions"), $arrSize[0] . " x " . $arrSize[1]);
         $arrTable[] = array($this->getLang("file_size"), bytesToString($arrDetails["filesize"]));
         $arrTable[] = array($this->getLang("file_editdate"), timeToString($arrDetails["filechange"]));
         $strReturn .= $this->objToolkit->divider() . $this->objToolkit->dataTable(null, $arrTable);
     }
     return $strReturn;
 }
 /**
  * Fetches the latest entries from the current systemlog.
  * The entries can be limited by the optional param latestEntry.
  * If given, only entries created after the passed date will be returned.
  * The format of latestEntry is similar to the date returned, so YYYY-MM-DD HH:MM:SS
  * The structure is returned like:
  * <entries>
  *   <entry>
  *      <level></level>
  *      <date></date>
  *      <session></session>
  *      <content></content>
  *   </entry>
  * </entries>
  *
  * @return string
  * @permissions right3
  */
 protected function actionSystemLog()
 {
     $strReturn = "";
     $intStartDate = false;
     if ($this->getParam("latestEntry") != "") {
         $intStartDate = strtotime($this->getParam("latestEntry"));
     }
     //read the last few lines
     $objFile = new class_filesystem();
     $arrDetails = $objFile->getFileDetails("/system/debug/systemlog.log");
     $intOffset = 0;
     $bitSkip = false;
     if ($arrDetails["filesize"] > 20000) {
         $intOffset = $arrDetails["filesize"] - 20000;
         $bitSkip = true;
     }
     $objFile->openFilePointer("/system/debug/systemlog.log", "r");
     //forward to the new offset, skip entry
     if ($intOffset > 0) {
         $objFile->setFilePointerOffset($intOffset);
     }
     $arrRows = array();
     $strRow = $objFile->readLineFromFile();
     while ($strRow !== false) {
         if (!$bitSkip && trim($strRow) > 0) {
             $arrRows[] = $strRow;
         }
         $bitSkip = false;
         $strRow = $objFile->readLineFromFile();
     }
     $objFile->closeFilePointer();
     $strReturn .= "<entries>\n";
     $arrRows = array_reverse($arrRows);
     foreach ($arrRows as $strSingleRow) {
         //parse entry
         $strDate = uniSubstr($strSingleRow, 0, 19);
         $strSingleRow = uniSubstr($strSingleRow, 20);
         $intTempPos = uniStrpos($strSingleRow, " ");
         $strLevel = uniSubstr($strSingleRow, 0, $intTempPos);
         $strSingleRow = uniSubstr($strSingleRow, $intTempPos + 1);
         $intTempPos = uniStrpos($strSingleRow, ")") + 1;
         $strSession = uniSubstr($strSingleRow, 0, $intTempPos);
         $strLogEntry = uniSubstr($strSingleRow, $intTempPos);
         if ($intStartDate !== false) {
             $intCurDate = strtotime($strDate);
             if ($intStartDate >= $intCurDate) {
                 continue;
             }
         }
         $strReturn .= "\t<entry>\n";
         $strReturn .= "\t\t<level>" . $strLevel . "</level>\n";
         $strReturn .= "\t\t<date>" . $strDate . "</date>\n";
         $strReturn .= "\t\t<session>" . $strSession . "</session>\n";
         $strReturn .= "\t\t<content>" . xmlSafeString(strip_tags($strLogEntry)) . "</content>\n";
         $strReturn .= "\t</entry>\n";
     }
     $strReturn .= "</entries>";
     return $strReturn;
 }
Exemplo n.º 5
0
    } else {
        echo "\n<span style='color: red;font-weight:bold;'>import failed!!</span>\n";
    }
} else {
    echo "Searching for dumps in dbdumps under: " . _projectpath_ . "\n";
    $objFilesystem = new class_filesystem();
    if ($objFilesystem->isWritable("/project/dbdumps")) {
        echo "Searching dbdumps available...\n";
        $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".zip", ".gz", ".sql"));
        echo "Found " . count($arrFiles) . " dump(s)\n\n";
        echo "<form method='post'>";
        echo "Dump to import:\n";
        $arrImportfileData = array();
        foreach ($arrFiles as $strOneFile) {
            $strFileInfo = "";
            $arrDetails = $objFilesystem->getFileDetails(_projectpath_ . "/dbdumps/" . $strOneFile);
            $strTimestamp = "";
            if (uniStrpos($strOneFile, "_") !== false) {
                $strTimestamp = uniSubstr($strOneFile, uniStrrpos($strOneFile, "_") + 1, uniStrpos($strOneFile, ".") - uniStrrpos($strOneFile, "_"));
            }
            if (uniStrlen($strTimestamp) > 9 && is_numeric($strTimestamp)) {
                //if the timestamp is the last part of the filename, we can use $strTimestamp
                $strFileInfo = $strOneFile . " (" . bytesToString($arrDetails['filesize']) . ")" . "\n    Timestamp according to file name: " . timeToString($strTimestamp) . "\n    Timestamp according to file info: " . timeToString($arrDetails['filechange']);
            } else {
                $strFileInfo = $strOneFile . " (" . bytesToString($arrDetails['filesize']) . ")" . "\n    Timestamp according to file info: " . timeToString($arrDetails['filechange']);
            }
            $arrImportfileData[$strOneFile] = $strFileInfo;
        }
        $bitShowButton = false;
        foreach ($arrImportfileData as $strFilename => $strFileInfo) {
            echo "\n<input type='radio' name='dumpname' id='dumpname_" . $strFilename . "' value='{$strFilename}' /><label for='dumpname_" . $strFilename . "'>" . $strFileInfo . "</label>";