private function getLanguageVar($prefix, $id, $suffix = '')
 {
     if ($this->languageStatement === null) {
         $sql = "SELECT\tword_custom\n\t\t\t\tFROM\t" . $this->databasePrefix . "core_sys_lang_words\n\t\t\t\tWHERE\tlang_id = ?\n\t\t\t\t\tAND word_key = ?";
         $this->languageStatement = $this->database->prepareStatement($sql, 1);
     }
     $this->languageStatement->execute(array($this->getDefaultLanguageID(), $prefix . '_' . $id . ($suffix ? '_' . $suffix : '')));
     $row = $this->languageStatement->fetchArray();
     if ($row !== false) {
         return $row['word_custom'];
     }
     return '';
 }
Exemplo n.º 2
0
 /**
  * Prints the error page.
  */
 public function show()
 {
     $this->information .= '<b>sql type:</b> ' . StringUtil::encodeHTML($this->getDBType()) . '<br />';
     $this->information .= '<b>sql error:</b> ' . StringUtil::encodeHTML($this->getErrorDesc()) . '<br />';
     $this->information .= '<b>sql error number:</b> ' . StringUtil::encodeHTML($this->getErrorNumber()) . '<br />';
     $this->information .= '<b>sql version:</b> ' . StringUtil::encodeHTML($this->getSQLVersion()) . '<br />';
     if ($this->preparedStatement !== null) {
         $this->information .= '<b>sql query:</b> ' . StringUtil::encodeHTML($this->preparedStatement->getSQLQuery()) . '<br />';
         $parameters = $this->preparedStatement->getSQLParameters();
         if (!empty($parameters)) {
             foreach ($parameters as $index => $parameter) {
                 $this->information .= '<b>sql query parameter ' . $index . ':</b>' . StringUtil::encodeHTML($parameter) . '<br />';
             }
         }
     }
     parent::show();
 }
	/**
	 * Saves a localized package info.
	 * 
	 * @param	wcf\system\database\statement\PreparedStatement		$statement
	 * @param	wcf\data\language\LanguageList				$languageList
	 * @param	wcf\data\language\category\LanguageCategory		$languageCategory
	 * @param	wcf\data\package\Package				$package
	 * @param	string							$infoName
	 */
	protected function saveLocalizedPackageInfo(PreparedStatement $statement, $languageList, LanguageCategory $languageCategory, Package $package, $infoName) {
		$infoValues = $this->getArchive()->getPackageInfo($infoName);
		
		// get default value for languages without specified information
		$defaultValue = '';
		if (isset($infoValues['default'])) {
			$defaultValue = $infoValues['default'];
		}
		else if (isset($infoValues['en'])) {
			// fallback to English
			$defaultValue = $infoValues['en'];
		}
		else if (isset($infoValues[WCF::getLanguage()->getFixedLanguageCode()])) {
			// fallback to the language of the current user
			$defaultValue = $infoValues[WCF::getLanguage()->getFixedLanguageCode()];
		}
		else if ($infoName == 'packageName') {
			// fallback to the package identifier for the package name
			$defaultValue = $this->getArchive()->getPackageInfo('name');
		}
		
		foreach ($languageList as $language) {
			$value = $defaultValue;
			if (isset($infoValues[$language->languageCode])) {
				$value = $infoValues[$language->languageCode];
			}
			
			$statement->execute(array(
				$language->languageID,
				'wcf.acp.package.'.$infoName.'.package'.$package->packageID,
				$value,
				$languageCategory->languageCategoryID,
				1
			));
		}
	}