$sql = "UPDATE wcf".WCF_N."_application
SET isPrimary = ?
- WHERE applicationID = ?";
+ WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
1,
}
// search language file
- $filename = WCF_DIR.'language/'.$this->packageID.'_'.$this->languageID.'_'.$category.'.php';
+ $filename = WCF_DIR.'language/'.$this->languageID.'_'.$category.'.php';
if (!@file_exists($filename)) {
if ($this->editor === null) {
$this->editor = new LanguageEditor($this);
// rebuild language file
$languageCategory = LanguageFactory::getInstance()->getCategory($category);
- $this->editor->updateCategory(array($languageCategory->languageCategoryID), array($this->packageID));
+ $this->editor->updateCategory(array($languageCategory->languageCategoryID));
}
// include language file
/**
* Updates the language files for the given category.
*
- * @param array $categoryIDs
- * @param array $packageIDs
+ * @param array<integer> $categoryIDs
*/
- public function updateCategory(array $categoryIDs = array(), array $packageIDs = array()) {
+ public function updateCategory(array $categoryIDs = array()) {
if (empty($categoryIDs)) {
// get all categories
$sql = "SELECT languageCategoryID
}
}
- $this->writeLanguageFiles($categoryIDs, $packageIDs);
+ $this->writeLanguageFiles($categoryIDs);
}
/**
* Write the languages files.
*
* @param array $categoryIDs
- * @param array $packageIDs
*/
- protected function writeLanguageFiles(array $categoryIDs, array $packageIDs) {
+ protected function writeLanguageFiles(array $categoryIDs) {
// get categories
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageCategoryID IN (?)", array($categoryIDs));
$categoryName = $category['languageCategory'];
$categoryID = $category['languageCategoryID'];
- // loop packages
- foreach ($packageIDs as $packageID) {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("languageID = ?", array($this->languageID));
- $conditions->add("languageCategoryID = ?", array($categoryID));
-
- // get language items
- $conditions->add("packageID IS NULL");
- $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue
- FROM wcf".WCF_N."_language_item
- ".$conditions;
-
- $statement2 = WCF::getDB()->prepareStatement($sql);
- $statement2->execute($conditions->getParameters());
- $items = array();
- while ($row = $statement2->fetchArray()) {
- if ($row['languageUseCustomValue'] == 1) {
- $items[$row['languageItem']] = $row['languageCustomItemValue'];
- }
- else {
- $items[$row['languageItem']] = $row['languageItemValue'];
- }
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("languageID = ?", array($this->languageID));
+ $conditions->add("languageCategoryID = ?", array($categoryID));
+
+ // get language items
+ $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue
+ FROM wcf".WCF_N."_language_item
+ ".$conditions;
+
+ $statement2 = WCF::getDB()->prepareStatement($sql);
+ $statement2->execute($conditions->getParameters());
+ $items = array();
+ while ($row = $statement2->fetchArray()) {
+ if ($row['languageUseCustomValue'] == 1) {
+ $items[$row['languageItem']] = $row['languageCustomItemValue'];
}
+ else {
+ $items[$row['languageItem']] = $row['languageItemValue'];
+ }
+ }
+
+ if (!empty($items)) {
+ $content = "<?php\n/**\n* WoltLab Community Framework\n* language: ".$this->languageCode."\n* encoding: UTF-8\n* category: ".$categoryName."\n* generated at ".gmdate("r")."\n* \n* DO NOT EDIT THIS FILE\n*/\n";
- if (!empty($items)) {
- $content = "<?php\n/**\n* WoltLab Community Framework\n* language: ".$this->languageCode."\n* encoding: UTF-8\n* category: ".$categoryName."\n* generated at ".gmdate("r")."\n* \n* DO NOT EDIT THIS FILE\n*/\n";
+ foreach ($items as $languageItem => $languageItemValue) {
+ $content .= "\$this->items['".$languageItem."'] = '".str_replace("'", "\'", $languageItemValue)."';\n";
- foreach ($items as $languageItem => $languageItemValue) {
- $content .= "\$this->items['".$languageItem."'] = '".str_replace("'", "\'", $languageItemValue)."';\n";
-
- // compile dynamic language variables
- if ($categoryName != 'wcf.global' && strpos($languageItemValue, '{') !== false) {
- $output = LanguageFactory::getInstance()->getScriptingCompiler()->compileString($languageItem, $languageItemValue);
- $content .= "\$this->dynamicItems['".$languageItem."'] = '".str_replace("'", "\'", $output['template'])."';\n";
- }
+ // compile dynamic language variables
+ if ($categoryName != 'wcf.global' && strpos($languageItemValue, '{') !== false) {
+ $output = LanguageFactory::getInstance()->getScriptingCompiler()->compileString($languageItem, $languageItemValue);
+ $content .= "\$this->dynamicItems['".$languageItem."'] = '".str_replace("'", "\'", $output['template'])."';\n";
}
-
- $file = new File(WCF_DIR.'language/'.$packageID.'_'.$this->languageID.'_'.$categoryName.'.php');
- @$file->chmod(0777);
- $file->write($content . '?>');
- $file->close();
}
+
+ $file = new File(WCF_DIR.'language/'.$this->languageID.'_'.$categoryName.'.php');
+ @$file->chmod(0777);
+ $file->write($content . '?>');
+ $file->close();
}
}
}
// write general information
$file->write("// general info\n");
$file->write("if (!defined('RELATIVE_WCF_DIR')) define('RELATIVE_WCF_DIR', RELATIVE_".$prefix."_DIR.'".FileUtil::getRelativePath($packageDir, WCF_DIR)."');\n");
- $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".$row['packageID'].");\n");
+ $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".($row === false ? $packageID : $row['packageID']).");\n");
$file->write("if (!defined('PACKAGE_NAME')) define('PACKAGE_NAME', '".str_replace("'", "\'", $package->getName())."');\n");
$file->write("if (!defined('PACKAGE_VERSION')) define('PACKAGE_VERSION', '".$package->packageVersion."');\n");
use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\cronjob\CronjobScheduler;
+use wcf\system\exception\IPrintableException;
+use wcf\system\exception\PermissionDeniedException;
+use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\session\SessionFactory;
use wcf\system\style\StyleHandler;
use wcf\system\template\TemplateEngine;
use wcf\system\user\storage\UserStorageHandler;
-use wcf\system\exception;
use wcf\util;
// try to disable execution time limit
*/
public static final function handleException(\Exception $e) {
try {
- if ($e instanceof exception\IPrintableException) {
+ if ($e instanceof IPrintableException) {
$e->show();
exit;
}
// repack Exception
- self::handleException(new exception\SystemException($e->getMessage(), $e->getCode(), '', $e));
+ self::handleException(new SystemException($e->getMessage(), $e->getCode(), '', $e));
}
catch (\Exception $exception) {
die("<pre>WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
break;
}
- throw new exception\SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0);
+ throw new SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0);
}
}
protected function initBlacklist() {
if (defined('BLACKLIST_IP_ADDRESSES') && BLACKLIST_IP_ADDRESSES != '') {
if (!util\StringUtil::executeWordFilter(WCF::getSession()->ipAddress, BLACKLIST_IP_ADDRESSES)) {
- throw new exception\PermissionDeniedException();
+ throw new PermissionDeniedException();
}
}
if (defined('BLACKLIST_USER_AGENTS') && BLACKLIST_USER_AGENTS != '') {
if (!util\StringUtil::executeWordFilter(WCF::getSession()->userAgent, BLACKLIST_USER_AGENTS)) {
- throw new exception\PermissionDeniedException();
+ throw new PermissionDeniedException();
}
}
if (defined('BLACKLIST_HOSTNAMES') && BLACKLIST_HOSTNAMES != '') {
if (!util\StringUtil::executeWordFilter(@gethostbyaddr(WCF::getSession()->ipAddress), BLACKLIST_HOSTNAMES)) {
- throw new exception\PermissionDeniedException();
+ throw new PermissionDeniedException();
}
}
}
require_once($configPath);
}
else {
- throw new exception\SystemException('Unable to load configuration for '.$package->package);
+ throw new SystemException('Unable to load configuration for '.$package->package);
}
// load options
}
else {
unset(self::$autoloadDirectories[$abbreviation]);
- throw new exception\SystemException("Unable to run '".$package->package."', '".$className."' is missing or does not implement 'wcf\system\application\IApplication'.");
+ throw new SystemException("Unable to run '".$package->package."', '".$className."' is missing or does not implement 'wcf\system\application\IApplication'.");
}
// register template path in ACP
return $this->$method();
}
- throw new exception\SystemException("method '".$method."' does not exist in class WCF");
+ throw new SystemException("method '".$method."' does not exist in class WCF");
}
/**
$objectName = self::getCoreObject($className);
if ($objectName === null) {
- throw new exception\SystemException("Core object '".$className."' is unknown.");
+ throw new SystemException("Core object '".$className."' is unknown.");
}
if (class_exists($objectName)) {
if (!(util\ClassUtil::isInstanceOf($objectName, 'wcf\system\SingletonFactory'))) {
- throw new exception\SystemException("class '".$objectName."' does not implement the interface 'SingletonFactory'");
+ throw new SystemException("class '".$objectName."' does not implement the interface 'SingletonFactory'");
}
self::$coreObject[$className] = call_user_func(array($objectName, 'getInstance'));
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array(
- 'packageID' => $packageID,
'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'],
'parentMenuItem' => 'wcf.acp.menu.link.option.category',
'menuItemLink' => 'index.php/Option/'.$row['categoryID'].'/',
// assign wcf pseudo-application
if (PACKAGE_ID) {
$data['wcf'] = $data['application'][1];
+ unset($data['application'][1]);
}
return $data;
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
- list($packageID, $environment, $templateName) = explode('-', $cacheResource['cache']);
+ list($environment, $templateName) = explode('-', $cacheResource['cache']);
// get template codes for specified template
$templateListenerList = new TemplateListenerList();