示例#1
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;
 }
示例#2
0
 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}");
     }
 }