Пример #1
0
 function WYTextField($sN)
 {
     global $goApp;
     parent::WYHTMLTag("input");
     $this->sQuote = '"';
     $this->dAttributes["type"] = "text";
     $this->dAttributes["name"] = $sN;
     $this->setValue($goApp->sFormFieldValue($sN));
 }
Пример #2
0
 function WYLink($oURL, $sTT = "", $bAbsolute = false)
 {
     global $goApp;
     parent::WYHTMLTag("a");
     $this->bSingular = false;
     $this->dAttributes["href"] = $oURL->sEURL(true, true, $bAbsolute);
     if ($sTT) {
         $this->setToolTip($sTT);
     }
 }
Пример #3
0
 function WYHiddenField($sN, $sDefault = "")
 {
     global $goApp;
     $sV = "";
     parent::WYHTMLTag("input");
     $this->dAttributes["type"] = "hidden";
     $this->dAttributes["name"] = $sN;
     $sV = $goApp->sFormFieldValue($sN, $sDefault);
     $this->setValue($sV);
 }
Пример #4
0
 function WYTextArea($sN, $sDefault = "")
 {
     global $goApp;
     $sV = $goApp->sFormFieldValue($sN, $sDefault);
     parent::WYHTMLTag("textarea");
     $this->bSingular = false;
     $this->dAttributes["wrap"] = "virtual";
     $this->dAttributes["name"] = $sN;
     $this->setText($sV);
 }
Пример #5
0
 function WYPopupWindowLink($oURL, $sName, $iW, $iH, $iType)
 {
     global $goApp;
     $sJS = "";
     parent::WYHTMLTag("a");
     $this->bSingular = false;
     $this->dAttributes["href"] = $oURL->sEURL();
     $sJS = WYPopupWindowLink::sOpenWindowCode($oURL, $sName, $iW, $iH, $iType);
     $sJS .= "; return false;";
     $this->dAttributes["onclick"] = webyep_sHTMLEntities($sJS);
 }
Пример #6
0
 function WYFileUpload($sN, $multiple = false)
 {
     global $goApp;
     parent::WYHTMLTag("input");
     $this->dAttributes["type"] = "file";
     if ($multiple) {
         $this->dAttributes["name"] = $sN . '[]';
         $this->dAttributes["multiple"] = "multiple";
     } else {
         $this->dAttributes["name"] = $sN;
     }
     $this->dFileInfos = od_nil;
     if (isset($_FILES[$sN])) {
         $this->dFileInfos = $_FILES[$sN];
         // how many files?
         if (is_array($this->dFileInfos["name"])) {
             $this->iNrOfFiles = count($this->dFileInfos["name"]);
         } else {
             $this->iNrOfFiles = 1;
             $tmpFI = array("name" => array($this->dFileInfos["name"]), "type" => array($this->dFileInfos["type"]), "tmp_name" => array($this->dFileInfos["tmp_name"]), "error" => array($this->dFileInfos["error"]), "size" => array($this->dFileInfos["size"]));
             $this->dFileInfos = $tmpFI;
             $tmpFI = NULL;
         }
         for ($i = 0; $i < $this->iNrOfFiles; $i++) {
             // security check
             $sOFN = isset($this->dFileInfos["name"][$i]) ? $this->dFileInfos["name"][$i] : "";
             $oOFN = new WYPath($sOFN);
             if (!$oOFN->bCheck(WYPATH_CHECK_NOSCRIPT | WYPATH_CHECK_NOPATH)) {
                 $goApp->log("error on file upload: illegal file type/name <{$sOFN}>");
                 @unlink($this->dFileInfos["tmp_name"][$j]);
                 // delete evil uploaded file
             } else {
                 if ($this->bFileUploaded($i) && $this->bUploadOK($i)) {
                     $oTmpPath = new WYPath($this->dFileInfos["tmp_name"][$i]);
                     $oToPath = od_clone($goApp->oDataPath);
                     $oToPath->addComponent($oTmpPath->sBasename());
                     if (!$goApp->move_uploaded_file($oTmpPath, $oToPath)) {
                         $goApp->log("WYFileUpload: Could not move uploaded file " . $oTmpPath->sPath . " to " . $oToPath->sPath);
                     } else {
                         $this->dFileInfos["tmp_name"][$i] = $oToPath->sPath;
                     }
                 } else {
                     $goApp->log("error on file upload: " . $this->iErrorCode() . ": " . $this->sErrorMessage());
                 }
             }
         }
     }
 }
Пример #7
0
 function WYSelectMenu($sN, $dItems, $sSelKeyApp = "", $bUseEntities = true)
 {
     global $goApp;
     $sSelKeyForm = $goApp->sFormFieldValue($sN);
     $sKey = "";
     $sValue = "";
     parent::WYHTMLTag("select");
     $this->bSingular = false;
     $this->dAttributes["name"] = $sN;
     $this->sSelectedKey = $sSelKeyForm ? $sSelKeyForm : $sSelKeyApp;
     $this->aItems = array();
     $o = new WYHTMLTag("option");
     $o->setSingular(false);
     foreach ($dItems as $sKey => $sValue) {
         $o->setAttribute("value", $sKey);
         if ($sKey == $this->sSelectedKey) {
             $o->setAttribute("selected", "");
         } else {
             $o->removeAttribute("selected");
         }
         $o->setInnerHTML($bUseEntities ? webyep_sHTMLEntities($sValue) : $sValue);
         $this->sInnerHTML .= $o->sDisplay();
     }
 }
Пример #8
0
 function WYImage($oURL, $sN = '')
 {
     global $goApp;
     $aDim = array();
     $oP = od_nil;
     $sDocRoot = '';
     $sURL = '';
     $iW = 0;
     $iH = 0;
     parent::WYHTMLTag('img');
     $oURL->makeSiteRelative();
     $this->oURL = $oURL;
     $sURL = $this->oURL->sEURL();
     $this->dAttributes['src'] = $sURL;
     if ($sN) {
         $this->dAttributes['name'] = $sN;
     }
     $oP = $this->oPath();
     if (is_readable($oP->sPath)) {
         $aDim = getimagesize($oP->sPath);
         $iW = $aDim[0];
         $iH = $aDim[1];
     }
     if ($iW && $iH) {
         $this->dAttributes['width'] = $iW;
         $this->dAttributes['height'] = $iH;
     }
     // $this->dAttributes["border"] = 0;
     $this->dAttributes['alt'] = '';
 }