Пример #1
1
 function sDisplay()
 {
     global $goApp;
     $s = "";
     $aEntries =& $this->dContent[WY_DK_GB_ENTRIES];
     $dEntry = array();
     $sName = $sEMail = $sMessage = $sClientIP = "";
     $iTime = $iID = 0;
     if ($goApp->sFormFieldValue(WY_QK_GB_MAGIC, "") == WY_QV_GB_MAGIC && ($sMessage = $goApp->sFormFieldValue(WY_QK_GB_MESSAGE, ""))) {
         // new message arrived
         $sName = $goApp->sFormFieldValue(WY_QK_GB_NAME, "");
         $sEMail = $goApp->sFormFieldValue(WY_QK_GB_EMAIL, "");
         if (!$this->bAddEntry($sName, $sEMail, $sMessage)) {
             $s .= sprintf("<script type=\"text/javascript\"> alert(\"%s\"); </script>", WYTS("IPIsBlocked"));
         }
     }
     if ($goApp->bEditMode) {
         if ($goApp->sCurrentAction() == WY_QV_GB_REMOVE) {
             $iID = $goApp->sFormFieldValue(WY_QK_GB_ID, 0);
             $this->removeEntry($iID);
         }
         if ($goApp->sCurrentAction() == WY_QV_GB_BLOCK) {
             $sIP = $goApp->sFormFieldValue(WY_QK_GB_IP, 0);
             $this->blockIP($sIP);
         }
         if ($goApp->sCurrentAction() == WY_QV_GB_UNBLOCK) {
             $sIP = $goApp->sFormFieldValue(WY_QK_GB_IP, 0);
             $this->unblockIP($sIP);
         }
     }
     foreach ($aEntries as $dEntry) {
         $sName = $dEntry[WY_DK_GB_NAME];
         $sEMail = $dEntry[WY_DK_GB_EMAIL];
         $sMessage = $dEntry[WY_DK_GB_MESSAGE];
         // backward comp.: check isset($dEntry[WY_DK_GB_IP])
         $sClientIP = isset($dEntry[WY_DK_GB_IP]) ? $dEntry[WY_DK_GB_IP] : "";
         $iTime = $dEntry[WY_DK_GB_TIME];
         $iID = $dEntry[WY_DK_GB_ID];
         $s .= "<div class='" . WY_GB_CSS_ALL . "'>";
         if ($goApp->bEditMode) {
             $oURL = od_clone(WYURL::oCurrentURL());
             $oImgURL = od_clone($goApp->oImageURL);
             $dEditorQuery = $this->dEditorQuery;
             $dEditorQuery[WY_QK_GB_ID] = $iID;
             $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_REMOVE);
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditorQuery));
             $oLink = new WYLink($oURL, WYTS("GuestbookRemoveButton"));
             $oImgURL->addComponent("remove-button.gif");
             $oImg = new WYImage($oImgURL);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookRemoveConfirm") . "\");");
             $s .= $oLink->sDisplay();
         }
         $s .= "<div>";
         if ($sName) {
             $s .= "<span class='" . WY_GB_CSS_NAME . "'>" . webyep_sHTMLEntities($sName) . "</span>";
         }
         if ($sEMail) {
             $s .= ($sName ? " " : "") . "<span class='" . WY_GB_CSS_EMAIL . "'>(" . $this->_sEMailLink($sEMail) . ")</span>";
         }
         if ($sName || $sEMail) {
             $s .= ", ";
         }
         $s .= "<span class='" . WY_GB_CSS_DATETIME . "'>" . WYTS("AtDate") . " " . sWYTDate($iTime) . " " . WYTS("AtTime") . " " . sWYTTime($iTime) . "</span>:</div>\n";
         if ($goApp->bEditMode) {
             $s .= "<div class='" . WY_GB_CSS_MESSAGE . "'>";
             $s .= WYTS("ClientIP") . ": ";
             $bIsBlocked = in_array($sClientIP, $this->dContent[WY_DK_GB_BLOCKED_IPS]);
             if ($sClientIP) {
                 if (!$bIsBlocked) {
                     $oURL = od_clone(WYURL::oCurrentURL());
                     $oImgURL = od_clone($goApp->oImageURL);
                     $dEditorQuery = $this->dEditorQuery;
                     $dEditorQuery[WY_QK_GB_IP] = $sClientIP;
                     $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_BLOCK);
                     $oURL->setQuery($dEditorQuery);
                     $oLink = new WYLink($oURL, WYTS("GuestbookBlockButton"));
                     $oImgURL->addComponent("block-button.gif");
                     $oImg = new WYImage($oImgURL);
                     $oImg->setAttribute("style", "vertical-align: middle");
                     $oLink->setInnerHTML($oImg->sDisplay());
                     $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookBlockConfirm") . "\");");
                 }
                 $s .= $sClientIP;
                 if (!$bIsBlocked) {
                     $s .= "&nbsp;" . $oLink->sDisplay();
                 }
             } else {
                 $s .= WYTS("unknown");
             }
             $s .= "</div>\n";
         }
         // make content secure:
         $sMessage = str_replace("<", "", $sMessage);
         $sMessage = str_replace(">", "", $sMessage);
         $s .= "<div class='" . WY_GB_CSS_MESSAGE . "'>" . WYLongTextElement::_sFormatContent($sMessage, $this->bHideEMailAddresses) . "</div>";
         $s .= "</div>\n";
     }
     if ($goApp->bEditMode && count($this->dContent[WY_DK_GB_BLOCKED_IPS])) {
         unset($a);
         $a =& $this->dContent[WY_DK_GB_BLOCKED_IPS];
         $s .= "<div class='" . WY_GB_CSS_ALL . "'>";
         $s .= "<strong>" . WYTS("BlockedIPs") . ":</strong><br />\n";
         $oURL = od_clone(WYURL::oCurrentURL());
         $dEditorQuery = $this->dEditorQuery;
         $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_UNBLOCK);
         $oURL->setQuery($dEditorQuery);
         $oImgURL = od_clone($goApp->oImageURL);
         $oImgURL->addComponent("unblock-button.gif");
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("style", "vertical-align: middle");
         foreach ($a as $sIP) {
             $oURL->dQuery[WY_QK_GB_IP] = $sIP;
             $oLink = new WYLink($oURL, WYTS("GuestbookUnBlockButton"));
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookUnBlockConfirm") . "\");");
             $s .= $sIP . "&nbsp;" . $oLink->sDisplay() . "<br />\n";
         }
         $s .= "</div>";
     }
     return $s;
 }
Пример #2
0
 function sDisplay()
 {
     global $goApp, $webyep_sProductName;
     $s = "";
     $oImg = od_nil;
     $oLink = od_nil;
     $oImgURL = od_clone($goApp->oImageURL);
     $oPageURL = od_clone(WYURL::oCurrentURL());
     $oNoticeURL = od_clone($goApp->oProgramURL);
     unset($oPageURL->dQuery[WY_QK_LOGOUT]);
     $oNoticeURL->addComponent(WYTS("LogonURL"));
     if (!$goApp->bEditMode) {
         if ($this->bVisible) {
             $oImgURL->addComponent("logon-button.gif");
             $oImg = new WYImage($oImgURL);
         } else {
             $oImgURL->addComponent("nix.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("width", 16);
             $oImg->setAttribute("height", 16);
         }
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("WebYepLogon"));
         $oLink = new WYLink($oNoticeURL);
         if ($goApp->bValidUser()) {
             $oPageURL->dQuery[WY_QK_EDITMODE] = "yes" . mt_rand(1000, 9999);
             $oLink->setAttribute("onclick", "document.location=\"" . $oPageURL->sEURL() . "\"; return false;");
         } else {
             $oLink->setAttribute("onclick", webyep_sHTMLEntities($goApp->sAuthWindowJS()) . "; return false;");
         }
         $oLink->setInnerHTML($oImg->sDisplay());
         $sToolTip = WYTS("LogonButton");
         $sToolTip = str_replace("WebYep", $webyep_sProductName, $sToolTip);
         $oLink->setToolTip($sToolTip);
         $s = $oLink->sDisplay();
     } else {
         $oImgURL->addComponent("logoff-button.gif");
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("LogoffButton"));
         $oPageURL->dQuery[WY_QK_EDITMODE] = "no" . mt_rand(1000, 9999);
         $oLink = new WYLink($oPageURL);
         $oLink->setInnerHTML($oImg->sDisplay());
         $oLink->setToolTip(WYTS("LogoffButton"));
         $oLink->setAttribute("onclick", "if (event.shiftKey || event.altKey) this.href += \"&" . WY_QK_LOGOUT . "=1\"; return true;");
         $s = $oLink->sDisplay();
     }
     return $s;
 }
Пример #3
0
          <td align="left" valign="top" nowrap><?php 
    echo $oTA->sDisplay();
    ?>
</td>
        </tr>
        <tr>
          <td style="height: 20px" nowrap>&nbsp;</td>
          <td align="left" valign="top"><input type="button" class="formButton" value="<?php 
    WYTSD("CancelButton", true);
    ?>
" onclick="window.close();">&nbsp;<input type="submit" class="formButton" value="<?php 
    WYTSD("SaveButton", true);
    ?>
">
<?php 
    if (!WYImage::bCanResizeImages()) {
        ?>
   <div class="warning remark" style="padding-top: 8px"><?php 
        echo WYTS("ImageCannotResize");
        ?>
</div>
<?php 
    }
    ?>
              <?php 
    echo WYEditor::sHiddenFieldsForElement($oElement);
    echo $oHFImageID->sDisplay();
    echo $oHFTNWidth->sDisplay();
    echo $oHFTNHeight->sDisplay();
    echo $oHFImageWidth->sDisplay();
    echo $oHFImageHeight->sDisplay();
Пример #4
0
 function sDisplay()
 {
     global $goApp;
     $sHTML = "";
     $sFN = $this->sDownloadFileName();
     $oURL = $oLink = od_nil;
     if ($sFN) {
         $oURL = od_clone($goApp->oProgramURL);
         $oURL->addComponent("download.php");
         $oURL->dQuery[WY_QK_DOWNLOAD_FILENAME] = $sFN;
         $oURL->dQuery[WY_QK_ORIGINAL_FILENAME] = $this->sOriginalFilename();
         $oLink = new WYLink($oURL, WYTS("DownloadHint"));
         if ($this->sCustomIcon) {
             $oImg = new WYImage(new WYURL($this->sCustomIcon));
             $oImg->setAttribute("class", WY_ATTACHMENT_CSS_ICON);
             $oLink->setInnerHTML($this->sOriginalFilename() . "&nbsp;" . $oImg->sDisplay());
         } else {
             $oLink->setInnerHTML($this->sOriginalFilename());
         }
         $sHTML .= $oLink->sDisplay();
     }
     return $sHTML;
 }
Пример #5
0
 function bResizeImage($oPIn, $oPOut, $iW, $iH)
 {
     // replace the image with the resized one
     global $goApp;
     $bSuccess = false;
     $rInImage = $rOutImage = false;
     WYImage::_allocateMemoryForImage($oPIn);
     if (!function_exists('imagejpeg')) {
         $goApp->log('bResizeImage: no GD lib with JPEG support installed');
         return false;
     }
     if (strtolower($oPIn->sExtension()) == 'jpg') {
         if (!function_exists('imagecreatefromjpeg')) {
             $goApp->log('bResizeImage: no imagecreatefromjpeg function found');
             return false;
         } else {
             $rInImage = @imagecreatefromjpeg($oPIn->sPath);
         }
     } else {
         if (strtolower($oPIn->sExtension()) == 'gif') {
             if (!function_exists('imagecreatefromgif')) {
                 $goApp->log('bResizeImage: no imagecreatefromgif function found');
                 return false;
             } else {
                 $rInImage = @imagecreatefromgif($oPIn->sPath);
             }
         } else {
             if (strtolower($oPIn->sExtension()) == 'png') {
                 if (!function_exists('imagecreatefrompng')) {
                     $goApp->log('bResizeImage: no imagecreatefrompng function found');
                     return false;
                 } else {
                     $rInImage = @imagecreatefrompng($oPIn->sPath);
                 }
             }
         }
     }
     if (!$rInImage) {
         $goApp->log('bResizeImage: could not create image from ' . $oPIn->sPath);
         return false;
     }
     if (WYImage::bGD2Installed() && function_exists('imagecreatetruecolor')) {
         $rOutImage = @imagecreatetruecolor($iW, $iH);
     } else {
         if (function_exists('imagecreate')) {
             $rOutImage = @imagecreate($iW, $iH);
         }
     }
     if (!$rOutImage) {
         $goApp->log("bResizeImage: could not create output image of size {$iW}/{$iH}");
         return false;
     }
     // preserve transparency
     if (strtolower($oPIn->sExtension()) == 'gif' || strtolower($oPIn->sExtension()) == 'png') {
         if (function_exists('imagecolortransparent') && function_exists('imagecolorallocatealpha') && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
             @imagecolortransparent($rOutImage, @imagecolorallocatealpha($rOutImage, 0, 0, 0, 127));
             @imagealphablending($rOutImage, false);
             @imagesavealpha($rOutImage, true);
         } else {
             $goApp->log('bResizeImage: unable to create transparent image');
         }
     }
     if (WYImage::bGD2Installed() && function_exists('imagecopyresampled')) {
         $bSuccess = @imagecopyresampled($rOutImage, $rInImage, 0, 0, 0, 0, $iW, $iH, imagesx($rInImage), imagesy($rInImage));
     }
     if (!$bSuccess && function_exists('imagecopyresized')) {
         $bSuccess = @imagecopyresized($rOutImage, $rInImage, 0, 0, 0, 0, $iW, $iH, imagesx($rInImage), imagesy($rInImage));
     }
     if (!$bSuccess) {
         $goApp->log('bResizeImage: could not use imagecopyresampled or imagecopyresized');
         return false;
     }
     unset($rInImage);
     // close input file
     switch (strtolower($oPIn->sExtension())) {
         // save image as the right file type
         case 'gif':
             $bSuccess = @imagegif($rOutImage, $oPOut->sPath);
             break;
         case 'png':
             $bSuccess = @imagepng($rOutImage, $oPOut->sPath, 9);
             break;
         case 'jpg':
             $bSuccess = @imagejpeg($rOutImage, $oPOut->sPath, 100);
             break;
         case 'jpeg':
             $bSuccess = @imagejpeg($rOutImage, $oPOut->sPath, 100);
             break;
     }
     chmod($oPIn->sPath, 0644);
     if (!$bSuccess) {
         $goApp->log("bResizeImage: could not create output image");
     }
     return $bSuccess;
 }
Пример #6
0
 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;
         }
     }
 }
Пример #7
0
 function showEditButtons()
 {
     global $goApp, $webyep_bShowDisabledEditButtons, $webyep_bOtherLoginsMayEditGlobalData;
     if ($goApp->bEditMode) {
         if ($this->iEditedID == $this->iLoopID) {
             $this->showAnchor();
         }
         if ($this->bUserMayEditThisElement()) {
             $oURL = od_clone(WYURL::oCurrentURL());
             unset($oURL->dQuery[WY_QK_LOOP_ADD_ABOVE]);
             $oLink = od_nil;
             $oImg = od_nil;
             $oImgURL = od_clone($goApp->oImageURL);
             $dEditQuery = WYEditor::dQueryForElement($this);
             $aLoopIDs = $this->_aLoopIDs();
             $iCount = count($aLoopIDs);
             $dEditQuery[WY_QK_LOOP_ID] = $this->iCurrentLoopID();
             $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_ADD);
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditQuery));
             $oURL->sAnchor = "WEBYEP_CURRENT_LOOP_ITEM";
             $oLink = new WYLink($oURL, WYTS("LoopAddButton"));
             $oImgURL->addComponent("add-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImg->setAttribute("alt", WYTS("LoopAddButton"));
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepLoopAddButton");
             $oLink->setAttribute("onclick", "webyep_loopAddBlockAboveBelow(this); return true;");
             echo $oLink->sDisplay();
             if ($iCount > 1) {
                 $dEditQuery = $oURL->dQuery;
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_REMOVE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopRemoveButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("remove-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopRemoveButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("LoopRemoveConfirm") . "\");");
                 $oLink->setAttribute("class", "WebYepLoopRemoveButton");
                 echo $oLink->sDisplay();
                 $oLink->removeAttribute("onclick");
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_UP);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopUpButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("up-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopUpButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopUpButton");
                 echo $oLink->sDisplay();
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_DOWN);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopDownButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("down-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopDownButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopDownButton");
                 echo $oLink->sDisplay();
             }
             if ($this->bIDIsDisabled($this->iCurrentLoopID())) {
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_ENABLE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopEnableButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("enable-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopEnableButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopEnabledButton");
                 echo $oLink->sDisplay();
             } else {
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_DISABLE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopDisableButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("disable-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopDisableButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopEnabledButton");
                 echo $oLink->sDisplay();
             }
         } else {
             // editing now allowed
             if ($webyep_bShowDisabledEditButtons) {
                 $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
                 $oImgURL = od_clone($goApp->oImageURL);
                 $oImgURL->addComponent("loop-buttons-disabled.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("border", 0);
                 $oImg->setAttribute("alt", $sToolTip);
                 $oLink = new WYLink(new WYURL("javascript:void(0);"), $sToolTip);
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", $this->sEditButtonCSSClass);
                 echo $oLink->sDisplay();
             }
         }
     }
 }
Пример #8
0
 function sEditButtonHTML($sButtonImage = "edit-button.gif", $sToolTip = "", $oCustomEditURL = false)
 {
     global $goApp, $webyep_bShowDisabledEditButtons, $webyep_bOtherLoginsMayEditGlobalData;
     $oImgURL = od_nil;
     $oImg = od_nil;
     $oEditorURL = od_nil;
     $oNeedJSURL = od_nil;
     $dQuery = array();
     $iEW = $iEH = 0;
     $sWCookie = $sHCookie = "";
     $bUsesCustomURL = false;
     if ($this->bUserMayEditThisElement()) {
         if (!$sToolTip) {
             $sToolTip = sprintf(WYTS("editTheField"), $this->sName);
         }
         $oImgURL = od_clone($goApp->oImageURL);
         $oImgURL->addComponent($sButtonImage);
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("border", 0);
         $oImg->setAttribute("alt", $sToolTip);
         if ($oCustomEditURL === false || $oCustomEditURL === od_nil) {
             $oEditorURL = od_clone($goApp->oProgramURL);
             $oEditorURL->addComponent("editors/" . $this->sEditorPageName);
             $dQuery = array_merge(WYEditor::dQueryForElement($this), $this->dEditorQuery);
             $oEditorURL->setQuery($dQuery);
         } else {
             $oEditorURL = $oCustomEditURL;
             $bUsesCustomURL = true;
         }
         $this->getSizeCookieNames($sWCookie, $sHCookie);
         if (isset($_COOKIE[$sWCookie])) {
             $iEW = (int) $_COOKIE[$sWCookie];
             $iEH = (int) $_COOKIE[$sHCookie];
             WYEditor::tranformSizeForOperation($iEW, $iEH, WY_EDITOR_OPEN);
         } else {
             $iEW = $this->iEditorWidth;
             $iEH = $this->iEditorHeight;
         }
         if ($bUsesCustomURL) {
             $oLink = new WYLink($oEditorURL, $sToolTip);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", $this->sEditButtonCSSClass);
             return $oLink->sDisplay();
         } else {
             $oWin = new WYPopupWindowLink($oEditorURL, "WebYepEditor" . mt_rand(1000, 9999), $iEW, $iEH, WY_POPWIN_TYPE_PLAIN);
             $oNeedJSURL = od_clone($goApp->oProgramURL);
             $oNeedJSURL->addComponent(WYTS("LogonURL"));
             $oWin->setAttribute("href", $oNeedJSURL->sEURL());
             // special href: JS warning
             $oWin->setInnerHTML($oImg->sDisplay());
             $oWin->setToolTip($sToolTip);
             $oWin->setAttribute("class", $this->sEditButtonCSSClass);
             return $oWin->sDisplay();
         }
     } else {
         if ($webyep_bShowDisabledEditButtons) {
             $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
             $oImgURL = od_clone($goApp->oImageURL);
             $oImgURL->addComponent("edit-button-disabled.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("border", 0);
             $oImg->setAttribute("alt", $sToolTip);
             $oLink = new WYLink(new WYURL("javascript:void(0);"), $sToolTip);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", $this->sEditButtonCSSClass);
             return $oLink->sDisplay();
         } else {
             return "";
         }
     }
 }
Пример #9
0
<?php 
$iCol = 0;
$oURL = od_clone($goApp->oImageURL);
$oURL->addComponent("remove-button.gif");
$oTrashImg = new WYImage($oURL);
$oTrashImg->setAttribute("style", "border: 0");
foreach ($aEntries as $dEntry) {
    if ($iCol == 0) {
        echo "<tr>";
    }
    $sFilename = $dEntry[FILENAME];
    $sDisplayFilename = str_replace("rtimg-", "", $sFilename);
    $sDisplayFilename = preg_replace('|([-_])|', '\\1&shy;', $sDisplayFilename);
    $sURL = $dEntry[URL];
    $sPath = $dEntry[PATH];
    $oImg = new WYImage(new WYURL($sURL));
    $iWidth = $oImg->iWidth();
    $iHeight = $oImg->iHeight();
    if ($iWidth != 0 && $iHeight != 0) {
        WYImage::bLimitSize($iWidth, $iHeight, IMG_SIZE, IMG_SIZE);
    } else {
        $iWidth = $iHeight = IMG_SIZE;
    }
    $oImg->setAttribute("width", $iWidth);
    $oImg->setAttribute("height", $iHeight);
    $oImg->setAttribute("style", "border: 0");
    unset($oTrashLink);
    unset($oTrashLinkURL);
    $oTrashLinkURL = od_clone(WYURL::oCurrentURL());
    $oTrashLinkURL->dQuery[ACTION] = ACTION_DELETE;
    $oTrashLinkURL->dQuery[FILENAME] = $sFilename;
Пример #10
0
 /**
  * Liefert den HTML-Code für das GalleryElement
  *
  * Diese Methode liefert den HTML-Code, der das GalleryElement in der Webseite darstellt.
  * Folgende globale Variablen beeinflussen die Arbeitsweise:
  * - $goApp										das globale Application-Objekt (gibt Auskunft über EditMode J/N, Programmpfad, Datenpfad)
  * - $webyep_bUseTablesForGalleries    sollen Tablellen oder DIVs für die Gallerie verwendet werden?
  * - $webyep_iUseImageBox					wird eine JavaScript-Anwendung zur Anzeige der Bilder verwendet?
  * - $webyep_sLiveDemoSlotID				TODO description
  *
  *	@return		string		HTML-Code des GalleryElement
  */
 function sDisplay()
 {
     global $goApp, $webyep_bUseTablesForGalleries, $webyep_iUseImageBox, $webyep_sLiveDemoSlotID;
     $sHTML = "";
     $iCount = count($this->_aItems());
     $i = 0;
     $iCols = $this->iCols;
     $bEditMode = $goApp->bEditMode;
     $sTNName = "";
     $oTN = $oLink = $oDetailURL = od_nil;
     $sText = $sFilename = "";
     $sBoxName = $this->sDataFileName(false);
     if ($iCount == 0 && !$bEditMode) {
         return "";
     }
     if ($webyep_iUseImageBox == WEBYEP_NOBOX) {
         $oDetailURL = od_clone($goApp->oProgramURL);
         $oDetailURL->addComponent("image-detail.php");
     }
     $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("<table class=\"%s\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n", WY_GALLERY_CSS_CONTAINER) : sprintf("<div class=\"%s\">\n", WY_GALLERY_CSS_CONTAINER);
     while ($i < $iCount || $iCount == 0 && $i == 0 && $bEditMode || $i % $iCols) {
         // new row?
         if (!($i % $iCols)) {
             $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("   <tr%s>\n", $i < $iCols ? " class=\"" . WY_GALLERY_CSS_FIRSTROW . "\"" : "") : sprintf("   <div style=\"overflow: hidden; zoom: 1.0\" class=\"%s%s\">\n", WY_GALLERY_CSS_ROW, $i < $iCols ? " " . WY_GALLERY_CSS_FIRSTROW : "");
         }
         $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("      <td style=\"width: %dpx\"%s>", $this->iCellWidth, $i % $iCols == 0 ? " class=\"" . WY_GALLERY_CSS_FIRSTCOLUMN . "\"" : "") : sprintf("      <div style=\"float: left; width: %dpx\" class=\"%s%s\">", $this->iCellWidth, WY_GALLERY_CSS_CELL, $i % $iCols == 0 ? " " . WY_GALLERY_CSS_FIRSTCOLUMN : "");
         if ($i < $iCount) {
             $sHTML .= sprintf("<div class=\"%s\">", WY_GALLERY_CSS_IMAGE);
             $sFilename = $this->sFilenameForID($i);
             $sText = $this->sTextForID($i);
             if ($sFilename) {
                 $oTN =& $this->_oTNImage($sFilename);
                 unset($oLink);
                 if ($webyep_iUseImageBox == WEBYEP_LIGHTBOX) {
                     unset($oImgURL);
                     $oImgURL = od_clone($goApp->oDataURL);
                     $oImgURL->addComponent($sFilename);
                     if ($webyep_sLiveDemoSlotID) {
                         $oImg = new WYImage($oImgURL);
                         if (!$oImg->bExists()) {
                             $oImgURL->removeDemoSlotID();
                         }
                     }
                     $oLink = new WYLink($oImgURL, $sText ? $this->sStripFormatting($sText) : " ");
                     $oLink->setAttribute("rel", "lightbox[{$sBoxName}]");
                     $oLink->sInnerHTML = $oTN->sDisplay();
                     $sHTML .= $oLink->sDisplay();
                 } else {
                     if ($webyep_iUseImageBox == WEBYEP_FANCYBOX) {
                         unset($oImgURL);
                         $oImgURL = od_clone($goApp->oDataURL);
                         $oImgURL->addComponent($sFilename);
                         if ($webyep_sLiveDemoSlotID) {
                             $oImg = new WYImage($oImgURL);
                             if (!$oImg->bExists()) {
                                 $oImgURL->removeDemoSlotID();
                             }
                         }
                         $oLink = new WYLink($oImgURL, $sText ? $this->sStripFormatting($sText) : " ");
                         $oLink->setAttribute("rel", "fancybox_{$sBoxName}");
                         $oLink->setAttribute("class", "WYPopUpImage");
                         $oLink->sInnerHTML = $oTN->sDisplay();
                         $sHTML .= $oLink->sDisplay();
                     } else {
                         $oDetailURL->dQuery[WY_QK_IMAGE_DETAIL] = $sFilename;
                         $oDetailURL->dQuery[WY_QK_IMAGE_ALTTEXT] = $this->sStripFormatting($sText);
                         $oDetailURL->dQuery[WY_QK_IMAGE_DEMOCONTENT] = $this->bDemoContent;
                         $oLink = new WYLink(new WYURL("javascript:void(0)"));
                         $oLink->setAttribute("onclick", sprintf("wydw=window.open(\"%s\", \"WYDetail\", \"width=%d,height=%d,status=yes,scrollbars=no,resizable=yes\"); wydw.focus();", $oDetailURL->sEURL(true, true, true), $this->iImageWidth, $this->iImageHeight));
                         $oLink->setToolTip(WYTS("ClickToZoom"));
                         $oLink->sInnerHTML = $oTN->sDisplay();
                         $sHTML .= $oLink->sDisplay();
                     }
                 }
             } else {
                 if ($bEditMode) {
                     $sHTML .= WYTS("GalleryNoImage");
                 }
             }
             $sHTML .= "</div>";
         }
         if ($bEditMode && ($i < $iCount || $i == 0)) {
             $sHTML .= "\n<div>";
             $sHTML .= $this->_sEditButtons($i < $iCount ? $i : -1);
             $sHTML .= "</div>";
         }
         if ($i < $iCount) {
             if ($sText) {
                 $sHTML .= sprintf("<div class=\"%s\">", WY_GALLERY_CSS_TEXT);
                 // $sHTML .= webyep_sHTMLEntities($sText);
                 $sHTML .= WYLongTextElement::_sFormatContent($sText, true);
                 $sHTML .= "</div>";
             }
         }
         $sHTML .= $webyep_bUseTablesForGalleries ? "</td>\n" : "</div>\n";
         // /WY_GALLERY_CSS_CELL
         $i++;
         if (!($i % $iCols)) {
             $sHTML .= $webyep_bUseTablesForGalleries ? "   </tr>\n" : "   </div>\n";
         }
         // WY_GALLERY_CSS_ROW
     }
     $sHTML .= $webyep_bUseTablesForGalleries ? "</table>\n" : "</div>\n";
     // /WY_GALLERY_CSS_CONTAINER
     return $sHTML;
 }
Пример #11
0
$sFilename = "";
if (isset($_GET[WY_QK_IMAGE_DETAIL])) {
    $sFilename = $_GET[WY_QK_IMAGE_DETAIL];
    $sAltText = $_GET[WY_QK_IMAGE_ALTTEXT];
    $bDemoContent = $_GET[WY_QK_IMAGE_DEMOCONTENT];
    $oP = new WYPath($sFilename);
    if (!$oP->bCheck(WYPATH_CHECK_NOPATH | WYPATH_CHECK_JUSTIMAGE)) {
        $goApp->log("illegal filename in image-detail: <{$sFilename}>");
        exit(-1);
    }
    $oURL = od_clone($goApp->oDataURL);
    if ($bDemoContent) {
        $oURL->removeDemoSlotID();
    }
    $oURL->addComponent($sFilename);
    $oImage = new WYImage($oURL);
    if ($sAltText) {
        $oImage->setAttribute("alt", $sAltText);
    }
    $iW = $oImage->iWidth();
    $iH = $oImage->iHeight();
    if (!$sAltText) {
        $sAltText = WYTS("GalleryCloseWindow");
    }
} else {
    exit(-1);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
Пример #12
-1
 function oSpacerImg($iW, $iH)
 {
     $oImgURL = od_clone($this->oImageURL);
     $oImgURL->addComponent("nix.gif");
     $oImg = new WYImage($oImgURL);
     $oImg->setAttribute("width", $iW);
     $oImg->setAttribute("height", $iH);
     return $oImg;
 }