function deleteTmpFile($iIndex = 0) { $sTmpPath = $this->dFileInfos["tmp_name"][$iIndex]; if ($sTmpPath) { $oFile = new WYFile(new WYPath($sTmpPath)); if ($oFile->bExists()) { $oFile->bDelete(); } } }
function useUploadedFile(&$oFromPath, &$oOrgFilename) { global $goApp; $sFN = ""; if ($oFromPath) { $oFromFile = new WYFile($oFromPath); $this->deleteFile(); $this->setOriginalFilename($oOrgFilename->sPath); $sFN = $this->sDownloadFileName(); $oToPath = od_clone($goApp->oDataPath); $oToPath->addComponent($sFN); if (!$oFromFile->bMoveTo($oToPath)) { $goApp->log("could not move attachment file: " . $oFromPath->sPath . " to " . $oToPath->sPath); $this->deleteFile(); $this->setOriginalFilename(""); } else { chmod($oToPath->sPath, 0644); } } }
$oFU = new WYFileUpload("upload"); $bOK = false; $sResponse = ""; $sURL = ""; if (isset($_REQUEST['CKEditor'])) { if ($oFU->bUploadOK()) { $oOriginalName = od_clone($oFU->oOriginalFilename()); if ($oOriginalName->bCheck(WYPATH_CHECK_NOSCRIPT | WYPATH_CHECK_NOPATH | WYPATH_CHECK_JUSTIMAGE)) { $sFilename = $oOriginalName->sPath; $sExtension = $oOriginalName->sExtension(); $sFilename = str_replace(".{$sExtension}", "", $sFilename); $sFilename = WYPath::sMakeFilename($sFilename); $oDestPath = od_clone($goApp->oDataPath); $sDestFilename = "rtimg-{$sFilename}.{$sExtension}"; $oDestPath->addComponent($sDestFilename); $oFile = new WYFile($oFU->oFilePath()); if (!$oFile->bCopyTo($oDestPath)) { $goApp->log("Could not copy uploaded image file"); $sResponse = WYTS("FileUploadErrorUnknown", false); } else { $sResponse = ""; $bOK = true; $oURL = od_clone($goApp->oDataURL); $oURL->addComponent($sDestFilename); $sURL = $oURL->sURL(false, false, true); } } else { $goApp->log("Illegal file/type on attachment upload: " . $oOFP->sPath); $sResponse = WYTS("FileUploadErrorUnknown", false); } $oFU->deleteTmpFile();
function sMD5() { $oP =& $this->oPath(); $oF = new WYFile($oP); $sC = $oF->sContent(); return md5($sC); }
} //--> </script> </head> <?php // WebYep // (C) Objective Development Software GmbH // http://www.obdev.at $bPermOK = false; $oP = od_nil; $oF = od_nil; srand((double) microtime() * 1000000); $sFilename = "permission-test" . mt_rand(1000, 9999); $oP = od_clone($goApp->oDataPath); $oP->addComponent($sFilename); $oF = new WYFile($oP); $oF->setContent("write test"); $bPermOK = $oF->bWrite(); @$oF->bDelete(); ?> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="pageTitle" align="left" valign="middle">WebYep System Infos</td> <td align="right" valign="top"><a href="http://www.obdev.at/webyep/" target="_blank"><img src="program/images/logo.gif" align="top" border="0" alt="WebYep WebSite"></a></td> </tr> </table> <hr size="1" noshade> <h2>Installed WebYep-Version</h2> <p><b>Version <?php echo "{$webyep_iMajorVersion}.{$webyep_iMinorVersion}.{$webyep_iSubVersion} {$webyep_sVersionPostfix}";
function bUseUploadedImageFile(&$oFromPath, &$oOrgFilename) { global $goApp; $sNewFilename = ""; $sExt = $oOrgFilename->sExtension(); if ($oFromPath) { $oFromFile = new WYFile($oFromPath); $oToPath = od_clone($goApp->oDataPath); $sNewFilename = $this->sDataFileName(true) . "-" . mt_rand(1000, 9999) . "." . $sExt; $oToPath->addComponent($sNewFilename); if ($oFromFile->bMoveTo($oToPath)) { $this->deleteImage(); // delete old image chmod($oToPath->sPath, 0644); list($iOW, $iOH) = WYImage::aGetImageSize($oToPath); if ($this->iImageWidth != 0 || $this->iImageHeight != 0) { // image dimensions set? list($iCW, $iCH) = $this->aContrainedSize($iOW, $iOH, false); // constrained image size if ($iCW != $iOW || $iCH != $iOH) { $oResizedPath = od_clone($oToPath); if (!WYImage::bResizeImage($oToPath, $oResizedPath, $iCW, $iCH)) { $goApp->log("resizing failed for: " . $oToPath->sPath); } } } if ($this->bIsThumb) { list($iCW, $iCH) = $this->aContrainedSize($iOW, $iOH, true); // constrained size for thumbnail $this->deleteThumbnail(); $oResizedPath = $this->oThumbnailPathFor($oToPath); $this->dContent[WY_DK_THUMBNAIL_FILENAME] = $oResizedPath->sBasename(); if (!WYImage::bResizeImage($oToPath, $oResizedPath, $iCW, $iCH)) { $goApp->log("resizing failed for: " . $oToPath->sPath . ", " . $oResizedPath->sPath); $this->deleteThumbnail(); } } $this->dContent[WY_DK_IMAGEFILENAME] = $sNewFilename; return true; } else { $goApp->log("could not move image file: " . $oFromPath->sPath . " to " . $oToPath->sPath); return false; } } }
function iAddPageIDForDocumentPath($oP, $iNewID) { global $goApp; $oF = new WYFile($this->oDocumentsFilePath()); $sFileContent = "\r\n" . $oP->sPath . "\t" . $iNewID; if (!$oF->bAppend($sFileContent)) { $sFileContent = $oF->sContent() . $sFileContent; $oF->setContent($sFileContent); if (!$oF->bWrite()) { $goApp->log("could not store new page iD " . $iNewID); $iNewID = 0; } } @$oF->chmod(0644); return $iNewID; }
$goApp->log("missuse of download script from {$sClientIP}, org file path: " . $oOrgFilename->sPath); exit(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
function save() { global $goApp; $oP =& $this->oDataFilePath(true, false); $oF = new WYFile($oP); $oF->setContent(serialize($this->dContent)); if (!$oF->bWrite()) { $goApp->log("could not write element data to " . $oP->sPath); $goApp->setDataAccessProblem(true); } @$oF->chmod(0644); }
$sAction = $oHFAction->sValue(); // $sResponse = WYTS("RichTextSaved"); // $oCKBaseURL = od_clone($goApp->oProgramURL); // $oCKBaseURL->addComponent("opt"); // $oCKBaseURL->addComponent("ckeditor"); // $oCKJSURL = od_clone($oCKBaseURL); // $oCKJSURL->addComponent("ckeditor.js"); $goApp->outputWarningPanels(); // give App a chance to say something if ($sAction == ACTION_DELETE) { $oHFFilename = new WYHiddenField(FILENAME); $oFullPath = od_clone($goApp->oDataPath); $oFilename = new WYPath($oHFFilename->sValue()); if ($oFilename->bCheck(WYPATH_CHECK_JUSTIMAGE | WYPATH_CHECK_NOPATH)) { $oFullPath->addComponent($oFilename->sPath); $oFile = new WYFile($oFullPath); $oFile->bDelete(); } } $aEntries = array(); $r = opendir($goApp->oDataPath->sPath); while (($sEntry = readdir($r)) !== false) { if ($sEntry[0] == ".") { continue; } if (substr($sEntry, 0, 5) != "rtimg") { continue; } unset($dEntry); $oPath = od_clone($goApp->oDataPath); $oPath->addComponent($sEntry);
/** * 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; }
function setup() { global $webyep_iLanguageID, $webyep_dLanguageStrings, $webyep_sLang, $goApp; $oLangFile = od_nil; $aLines = array(); $iLineCount = 0; $sLine = ""; $sKey = ""; $oP = od_clone($goApp->oProgramPath); $oP->addComponent("lstrings.dat"); $oLangFile = new WYFile($oP); $aLines = $oLangFile->aContentLines(); $iLineCount = count($aLines); for ($i = 0; $i < $iLineCount; $i++) { $sLine = $aLines[$i]; if (substr(trim($sLine), 0, 2) == "/*") { continue; } if (!$sKey && $sLine) { $sKey = $sLine; } else { if ($sLine) { $webyep_dLanguageStrings[$sKey][] = $sLine; } else { $sKey = ""; } } } $webyep_sLang = strtolower($webyep_sLang); if ($webyep_sLang == "" || $webyep_sLang == "auto") { // tetermine language: for now by looking at the spelling of the program folder if (strstr(WYApplication::sScriptPath(__FILE__), "/programm/lib/WYLanguage")) { $webyep_iLanguageID = WYLANG_GERMAN; } else { if (strstr(WYApplication::sScriptPath(__FILE__), "/program/lib/WYLanguage")) { $webyep_iLanguageID = WYLANG_ENGLISH; } else { $goApp->fatalError("Could not tetermine language"); } } } else { if ($webyep_sLang == "srpski") { $webyep_iLanguageID = WYLANG_SRPSKI; } else { if ($webyep_sLang == "polski") { $webyep_iLanguageID = WYLANG_POLISH; } else { if ($webyep_sLang == "swedish") { $webyep_iLanguageID = WYLANG_SWEDISH; } else { if ($webyep_sLang == "portuguese") { $webyep_iLanguageID = WYLANG_PORTUGUESE; } else { if ($webyep_sLang == "swedish") { $webyep_iLanguageID = WYLANG_SWEDISH; } else { if ($webyep_sLang == "dutch") { $webyep_iLanguageID = WYLANG_DUTCH; } else { if ($webyep_sLang == "french") { $webyep_iLanguageID = WYLANG_FRENCH; } } } } } } } } if (isset($GLOBALS["webyep_iForcedLanguageID"])) { $webyep_iLanguageID = $GLOBALS["webyep_iForcedLanguageID"]; $goApp->log("forced language ID to: {$webyep_iLanguageID}"); } }