Пример #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
 function sDisplay()
 {
     global $goApp, $webyep_bOpenFullURLsInNewWindow, $webyep_iUseImageBox, $webyep_oCurrentLoop;
     $sHTML = "";
     $oImg = od_clone($this->oImage());
     $sAltText = $this->sAltText();
     $sAtt = "";
     $sAnchor = "";
     $iLoop = 0;
     $oURL = od_nil;
     $iDW = $this->bIsThumb ? $this->iThumbWidth : $this->iImageWidth;
     $iDH = $this->bIsThumb ? $this->iThumbHeight : $this->iImageHeight;
     if ($oImg) {
         if ($iDW != 0 || $iDH != 0) {
             $iW = $oImg->iWidth();
             $iH = $oImg->iHeight();
             if ($iW != 0 && $iH != 0) {
                 // if image size could be determined
                 if ($iW > $iDW || $iH > $iDH) {
                     // image has not the correct size
                     list($iW, $iH) = $this->aContrainedSize($iW, $iH, $this->bIsThumb);
                     $this->sAttributes .= ($this->sAttributes ? " " : "") . "width=\"{$iW}\" height=\"{$iH}\"";
                 }
             }
         }
         if ($this->sAttributes) {
             if (stristr($this->sAttributes, "width=") || stristr($this->sAttributes, "height=")) {
                 // width or height can only be set in attributes if $this->iImageWidth/iThumbWidth are _not_ used!
                 $oImg->removeAttribute("width");
                 $oImg->removeAttribute("height");
             }
             if (stristr($this->sAttributes, "alt=")) {
                 $oImg->removeAttribute("alt");
             }
         }
         if ($this->sAttributes) {
             $sAtt = " " . $this->sAttributes;
         }
         if ($sAltText) {
             $oImg->setAttribute("alt", $sAltText);
         }
         $sHTML .= str_replace("<img", "<img{$sAtt}", $oImg->sDisplay());
         $oLink = od_nil;
         $sURL = $this->dContent[WY_DK_URL] ? $this->dContent[WY_DK_URL] : $this->sURL;
         if ($sURL) {
             $oURL = new WYURL($sURL);
             if (!$this->dContent[WY_DK_URL]) {
                 $iLoop = $goApp->oDocument->iLoopID();
                 if ($iLoop) {
                     $oURL->dQuery[WY_QK_DI] = $goApp->oDocument->iDocumentInstanceForLoopID($iLoop);
                 }
             }
             $oLink = new WYLink($oURL, "", true);
             if ($webyep_bOpenFullURLsInNewWindow && WYURL::bIsAbsolute($sURL)) {
                 $this->sTarget = "_blank";
             }
             if ($this->sTarget) {
                 $oLink->setAttribute("target", $this->sTarget);
             }
         }
         if ($this->bIsThumb && !$oLink) {
             if ($webyep_iUseImageBox == WEBYEP_LIGHTBOX) {
                 $oImg = $this->oDetailImage();
                 $oURL = $oImg->oURL;
                 if (!$oLink) {
                     $oLink = new WYLink($oURL);
                     if ($webyep_oCurrentLoop != od_nil) {
                         $sGroup = $webyep_oCurrentLoop->sFieldNameForFile();
                     } else {
                         $sGroup = "";
                     }
                     $oLink->setAttribute("rel", "lightbox" . ($sGroup ? "[{$sGroup}]" : ""));
                     $oLink->setAttribute("class", "WYPopUpImage");
                 }
             } else {
                 if ($webyep_iUseImageBox == WEBYEP_FANCYBOX) {
                     // use jquery.fancybox
                     $oImg = $this->oDetailImage();
                     $oURL = $oImg->oURL;
                     if (!$oLink) {
                         $oLink = new WYLink($oURL);
                         if ($webyep_oCurrentLoop != od_nil) {
                             $sGroup = $webyep_oCurrentLoop->sFieldNameForFile();
                         } else {
                             $sGroup = md5($oURL->sEURL());
                         }
                         // 'unique' ID to prevent Fancybox from grouping single pictures
                         $oLink->setAttribute("rel", "fancybox" . ($sGroup ? "_{$sGroup}" : ""));
                         $oLink->setAttribute("class", "WYPopUpImage");
                     }
                 } else {
                     $oURL = $this->oDetailWindowURL();
                     $oImg = $this->oDetailImage();
                     $iW = $oImg->iWidth();
                     $iH = $oImg->iHeight();
                     if ($iW == 0) {
                         $iW = 400;
                     }
                     if ($iH == 0) {
                         $iH = 400;
                     }
                     $oURL->dQuery[WY_QK_IMAGE_DETAIL] = $oImg->oURL->sBasename();
                     $oURL->dQuery[WY_QK_IMAGE_ALTTEXT] = $sAltText;
                     $oURL->dQuery[WY_QK_IMAGE_DEMOCONTENT] = $this->bDemoContent;
                     if (!$oLink) {
                         $oLink = new WYLink(new WYURL("javascript:void(0)"));
                     }
                     $oLink->setAttribute("onclick", sprintf("wydw=window.open(\"%s\", \"WYDetail\", \"width=%d,height=%d,status=yes,scrollbars=yes,resizable=yes\"); wydw.focus();", $oURL->sEURL(true, true, true), $iW, $iH));
                     $oLink->setAttribute("class", "WYPopUpImage");
                     if (!$sAltText) {
                         $oLink->setToolTip(WYTS("ClickToZoom"));
                     }
                 }
             }
         }
         if ($oLink) {
             // $oLink->setAttribute("class", "WYPopUpImage");
             if ($sAltText) {
                 $oLink->setToolTip($sAltText);
             }
             $oLink->setInnerHTML($sHTML);
             $sHTML = $oLink->sDisplay();
         }
     }
     return $sHTML;
 }
Пример #4
0
 function makeSiteRelative()
 {
     if (substr($this->sPath, 0, 1) != "/") {
         $this->sPath = WYURL::_sSiteRelativeURL($this->sPath);
     }
 }
Пример #5
0
// (C) Objective Development Software GmbH
// http://www.obdev.at
$webyep_bDocumentPage = false;
$webyep_sIncludePath = ".";
include_once "{$webyep_sIncludePath}/webyep.php";
include_once "lib/WYApplication.php";
include_once "lib/WYTextField.php";
include_once "lib/WYHiddenField.php";
include_once "lib/WYEditor.php";
define("WY_QV_LOGON", "LOGON");
$bSuccess = false;
$oPageURL = od_nil;
$bDoLogon = $goApp->sFormFieldValue(WY_QK_ACTION) == WY_QV_LOGON;
$oHFPageURL = new WYHiddenField(WY_QK_LOGON_PAGE_URL);
if ($oHFPageURL->sValue()) {
    $oPageURL = new WYURL($oHFPageURL->sValue());
    $oPageURL->dQuery[WY_QK_EDITMODE] = "yes" . mt_rand(1000, 9999);
    unset($oPageURL->dQuery[WY_QK_LOGOUT]);
}
$oTFUsername = new WYTextField("USERNAME");
$oTFPassword = new WYTextField("PASSWORD");
$oTFPassword->makePasswordField();
if ($bDoLogon) {
    $bSuccess = $goApp->bAuthenticate($oTFUsername->sValue(), $oTFPassword->sValue());
    webyep_checkDataFolderIntegrity();
    if (webyep_bHasFilemanager()) {
        session_start();
        $_SESSION[WY_SV_IS_AUTH] = $bSuccess;
    }
}
if (!$bDoLogon) {
Пример #6
0
 /**
  * Recursive function to build an HTML tree from a nested dictionary (v2)
  *
  * @param  mixed  $subtree The (nested) dictionary, containing the menu data
  * @return string          Nested list (HTML)
  */
 function buildHtmlTree($subtree)
 {
     global $goApp, $webyep_iMenuID, $webyep_bUseJavaScriptMenus, $webyep_bMenuJSInserted, $webyep_bAutoCloseMenus, $webyep_bOpenFullURLsInNewWindow, $webyep_bTitleAlwaysOpensPage;
     $sElementID = "WYMUTREE_{$webyep_iMenuID}_" . $this->iLastTitleID;
     if ($this->iLastTitleID != 0 && !in_array($this->iLastTitleID, $this->aCurrentPath) && !in_array($sElementID, $this->aOpenTrees)) {
         $this->aCloseTrees[] = $this->iLastTitleID;
     }
     if ($this->iLastTitleID == 0) {
         // first ul doesn't get an ID
         $sHTML = "\n<" . $this->sListType . ' class="' . WEBYEP_MENU_CSS . "\">\n";
     } else {
         $sHTML = "\n<" . $this->sListType . ' class="' . WEBYEP_MENU_CSS . " WYMUTREE_{$webyep_iMenuID}\" id=\"{$sElementID}\">\n";
     }
     $iEntryNr = 0;
     foreach ($subtree as $dEntry) {
         $iEntryNr++;
         $aClass = array(WEBYEP_MENU_CSS_ITEM);
         $bIsTitle = count($dEntry['SUBITEMS']) ? true : false;
         $bUseTitleAsItem = false;
         $bIsCurrentEntry = false;
         if ($dEntry['VISIBLE']) {
             if ($dEntry['URL']) {
                 $oURL = new WYURL($dEntry['URL']);
                 $bOpenInNewWindow = $webyep_bOpenFullURLsInNewWindow && WYURL::bIsAbsolute($dEntry['URL']);
                 $bUseTitleAsItem = true;
             } else {
                 $oURL = od_clone($this->oURL);
             }
             // new feature: suppress DI, if user specifies somepage.php?DOC_INST=0 in URL field
             if (!isset($oURL->dQuery[WY_QK_DI]) || $oURL->dQuery[WY_QK_DI] > 0) {
                 $oURL->dQuery[WY_QK_DI] = $dEntry[WY_DK_ITEMID];
                 // overwrite existing DI, otherwise we could not delete those contents!
                 if ($webyep_bTitleAlwaysOpensPage) {
                     $bUseTitleAsItem = true;
                 }
             } else {
                 unset($oURL->dQuery[WY_QK_DI]);
                 // really dispose
             }
             $sURL = $oURL->sEURL(true, true, $dEntry['URL'] != "");
             // is this entry expanded?
             if (!$webyep_bUseJavaScriptMenus || in_array($dEntry[WY_DK_ITEMID], $this->aCurrentPath) || in_array($sElementID, $this->aOpenTrees)) {
                 $bIsExpanded = true;
             }
             // CSS
             $bIsCurrentEntry = $this->_bIsCurrentEntry($dEntry[WY_DK_ITEMID], $dEntry['URL']);
             if (!$bIsCurrentEntry && in_array($dEntry[WY_DK_ITEMID], $this->aCurrentPath)) {
                 $aClass[] = WEBYEP_MENU_CSS_CURRENT_PATH;
             }
             if ($bIsCurrentEntry) {
                 $aClass[] = WEBYEP_MENU_CSS_CURRENT_ITEM;
             }
             if ($iEntryNr == 1) {
                 $aClass[] = WEBYEP_MENU_CSS_FIRST_ITEM;
             }
             if ($bIsTitle) {
                 unset($aClass[0]);
                 // no WEBYEP_MENU_CSS_ITEM for titles
                 $aClass[] = WEBYEP_MENU_CSS_TITLE;
                 $aClass[] = WEBYEP_MENU_CSS_EXPANDED;
             }
             $sClass = implode(' ', $aClass);
             // assemble HTML
             $sText = str_replace("\\", "<br />", webyep_sHTMLEntities($dEntry['TITLE']));
             $sID = $bIsTitle ? ' id="WYMUTITLE' . $webyep_iMenuID . $dEntry[WY_DK_ITEMID] . '"' : '';
             $sHTML .= '<li class="' . $sClass . '"' . $sID . '>';
             $sHTML .= $this->buildLink($bIsTitle, $bUseTitleAsItem, $bIsExpanded, $sClass, $dEntry[WY_DK_ITEMID], $sText, $sURL);
             if ($bIsTitle) {
                 $this->iLastTitleID = $dEntry[WY_DK_ITEMID];
                 $sHTML .= $this->buildHtmlTree($dEntry['SUBITEMS']);
             }
             $sHTML .= "</li>\n";
         }
     }
     $sHTML .= '</' . $this->sListType . ">\n";
     return $sHTML;
 }
Пример #7
0
 function sAuthWindowJS()
 {
     $s = "";
     $oURL = od_nil;
     $oPageURL = od_clone(WYURL::oCurrentURL());
     $oURL = od_clone($this->oProgramURL);
     $oURL->addComponent("logon.php");
     $oURL->dQuery[WY_QK_LOGON_PAGE_URL] = $oPageURL->sURL();
     $s .= WYPopupWindowLink::sOpenWindowCode($oURL, "WebYepLogon", 400, 300, WY_POPWIN_TYPE_PLAIN);
     return $s;
 }
Пример #8
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();
             }
         }
     }
 }
Пример #9
0
 /**
  * Liefert das Markup für die EditButtons eines Bildes
  *
  * @access 		private
  *	@param		int		$iID	imageID
  *	@return		string			HTML der Bearbeitungselemente
  */
 function _sEditButtons($iID)
 {
     global $goApp, $webyep_bShowDisabledEditButtons;
     $sHTML = "";
     $oURL = od_clone(WYURL::oCurrentURL());
     $oLink = od_nil;
     $oImg = od_nil;
     $oImgURL = od_clone($goApp->oImageURL);
     $dEditQuery = WYEditor::dQueryForElement($this);
     $aItems =& $this->_aItems();
     $iCount = count($aItems);
     if ($goApp->bEditMode) {
         if ($this->iEditedID === $iID) {
             $sHTML .= $this->sAnchor();
         }
         $sHTML .= "<div style=\"white-space: nowrap; text-align: center; margin-top: 4px\">";
         if ($this->bUserMayEditThisElement()) {
             $dEditQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditQuery));
             $oURL->sAnchor = "WEBYEP_CURRENT_GALLERY_ITEM";
             $this->dEditorQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $this->dEditorQuery[WY_QK_THUMB_WIDTH] = $this->iTNWidth;
             $this->dEditorQuery[WY_QK_THUMB_HEIGHT] = $this->iTNHeight;
             $this->dEditorQuery[WY_QK_IMAGE_WIDTH] = $this->iImageWidth;
             $this->dEditorQuery[WY_QK_IMAGE_HEIGHT] = $this->iImageHeight;
             $this->dEditorQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $this->dEditorQuery[WY_QK_GALLERY_ADD] = "true";
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_UP);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 1 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryUpButton"));
             $oImgURL->addComponent("gallery-move-left-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepGalleryUpButton");
             $sHTML .= $oLink->sDisplay();
             $this->sEditButtonCSSClass = "WebYepGalleryAddButton";
             $sHTML .= $this->sEditButtonHTML("gallery-add-button.gif", WYTS("GalleryAddButton"), $goApp->bIsiPhone ? $this->oIPhoneEditURL() : od_nil);
             $dEditQuery = $oURL->dQuery;
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_REMOVE);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 0 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryRemoveButton"));
             $oImgURL->addComponent("gallery-remove-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GalleryRemoveConfirm") . "\");");
             $oLink->setAttribute("class", "WebYepGalleryRemoveButton");
             $sHTML .= $oLink->sDisplay();
             $oLink->removeAttribute("onclick");
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_DOWN);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 1 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryDownButton"));
             $oImgURL->addComponent("gallery-move-right-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepGalleryDownButton");
             $sHTML .= $oLink->sDisplay();
             if ($iCount > 0) {
                 $sHTML .= "<br />";
                 $this->dEditorQuery[WY_QK_GALLERY_ADD] = "false";
                 $this->sEditButtonCSSClass = "WebYepGalleryEditButton";
                 $sHTML .= $this->sEditButtonHTML("gallery-edit-button.gif", WYTS("GalleryEditButton"), $goApp->bIsiPhone ? $this->oIPhoneEditURL() : od_nil);
             }
         } else {
             // editing not allowed
             if ($webyep_bShowDisabledEditButtons) {
                 $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
                 $oImgURL = od_clone($goApp->oImageURL);
                 $oImgURL->addComponent("gallery-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);
                 $sHTML .= $oLink->sDisplay();
             }
         }
         $sHTML .= "</div>";
     }
     return $sHTML;
 }
Пример #10
-1
 $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;
 $oTrashLink = new WYLink($oTrashLinkURL);
 $oTrashLink->setAttribute("onclick", "return confirmDelete()");
 $oTrashLink->setInnerHTML($oTrashImg->sDisplay());
 $oTrashLink->setToolTip(WYTS("DeleteImageButton"));
 unset($oSelectLink);
 $oSelectLink = new WYLink(new WYURL("javascript:void(0)"));
 $oSelectLink->setAttribute("onclick", "returnURL(\"" . $sURL . "\"); return false;");
 $oSelectLink->setInnerHTML($oImg->sDisplay());
 $oSelectLink->setToolTip($sDisplayFilename);
 echo "<td>";
 echo $oSelectLink->sDisplay();
 echo "<div style=\"margin-bottom: 16px; margin-top: 6px; text-align: center\">";
 echo $oTrashLink->sDisplay();