Esempio n. 1
0
 function deleteTmpFile($iIndex = 0)
 {
     $sTmpPath = $this->dFileInfos["tmp_name"][$iIndex];
     if ($sTmpPath) {
         $oFile = new WYFile(new WYPath($sTmpPath));
         if ($oFile->bExists()) {
             $oFile->bDelete();
         }
     }
 }
Esempio n. 2
0
 function deleteFile()
 {
     global $goApp;
     $oFile = od_nil;
     $sFN = $this->sDownloadFileName();
     if ($sFN) {
         $oPath = od_clone($goApp->oDataPath);
         $oPath->addComponent($sFN);
         $oFile = new WYFile($oPath);
         if ($oFile->bExists() && !$oFile->bDelete()) {
             $goApp->log("could not delete attachment file " . $oPath->sPath);
         }
         $this->setOriginalFilename("");
         $this->save();
     }
 }
Esempio n. 3
0
 /**
  * Löscht das Vorschaubild
  *
  * no implicit save!
  */
 function deleteThumbnail()
 {
     global $goApp;
     $oFile = od_nil;
     $sFN = $this->dContent[WY_DK_THUMBNAIL_FILENAME];
     if ($sFN) {
         $oPath = od_clone($goApp->oDataPath);
         $oPath->addComponent($sFN);
         $oFile = new WYFile($oPath);
         if ($oFile->bExists() && !$oFile->bDelete()) {
             $goApp->log("could not delete thumbnail file " . $oPath->sPath);
         }
         $this->dContent[WY_DK_THUMBNAIL_FILENAME] = "";
     }
 }
Esempio n. 4
0
 function iPageIDForDocumentPath($oP, &$iMaxID)
 {
     $aLines = array();
     $sFileContent = "";
     $sDocPath = "";
     $iDocID = 0;
     $iPos = 0;
     $sLine = "";
     $iID = 0;
     $oDocFilePath = od_clone($this->oDocumentsFilePath());
     $oF = new WYFile($oDocFilePath);
     $iMaxID = 0;
     if ($oF->bExists()) {
         $aLines = $oF->aContentLines();
     }
     foreach ($aLines as $sLine) {
         $dEntry = $this->dParseDocumentsFileLine($sLine);
         if ($dEntry['id']) {
             $sDocPath = $dEntry['path'];
             $iDocID = $dEntry['id'];
             $iMaxID = max($iMaxID, $iDocID);
             if ($sDocPath == $oP->sPath) {
                 $iID = $iDocID;
                 break;
             }
         }
     }
     return $iID;
 }
Esempio n. 5
0
}
$sOrgFilename = str_replace(" ", "_", $oOrgFilename->sPath);
$oPath = od_clone($goApp->oDataPath);
$oPath->addComponent($oFilename->sPath);
if (strpos($oPath->sPath, "webyep-system") === false) {
    // goApp's log won't work when data path was modified! -> echo
    echo "missuse of download script from {$sClientIP}, mangled data path: " . $oPath->sPath;
    exit(0);
}
$sExtenstion = $oPath->sExtension();
$oF = new WYFile($oPath);
if (!$oF->bExists()) {
    $oPath->removeDemoSlotID();
    $oF = new WYFile($oPath);
}
if (!$oF->bExists()) {
    $goApp->log("download file not found: " . $oPath->sPath);
    exit(0);
}
if (isset($aMimeTypes[$sExtenstion])) {
    $sMimeType = $aMimeTypes[$sExtenstion];
} else {
    $sMimeType = "application/binary";
}
header("Content-Type: {$sMimeType}");
header("Content-Disposition: attachment; filename={$sOrgFilename}");
// work around strange IE/Win bug:
// when clicking "open" in the download dialog
// app can't open the downloaded doc
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
Esempio n. 6
0
 /**
  * Liefert den Dateinamen des Vorschaubildes zum Dateinamen eines Bildes
  *
  * @access 		private
  *	@param		string		der Dateiname des Bildes
  *	@return		string		der Dateiname des Vorschaubildes
  */
 function _sThumbnailName($sFilename)
 {
     global $goApp;
     $oP = $oF = od_nil;
     $sOrgExt = "";
     $sTN = "";
     $oP = new WYPath($sFilename);
     $sOrgExt = $oP->sExtension();
     $oP = od_clone($goApp->oDataPath);
     $iPos = strrpos($sFilename, ".");
     $sTN = substr($sFilename, 0, $iPos) . "-tn.jpg";
     $oP->addComponent($sTN);
     $oF = new WYFile($oP);
     if (!$oF->bExists()) {
         $oP->removeDemoSlotID();
         // try again without demo slot ID
         unset($oF);
         $oF = new WYFile($oP);
         if (!$oF->bExists()) {
             $oP->setExtension($sOrgExt);
             $sTN = $oP->sBasename();
         }
     }
     return $sTN;
 }