From ef0c512d747b08f080cc47b64eca0880645a545c Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 12 Apr 2013 19:51:23 +0200 Subject: [PATCH] Resolved some TODOs --- .../acp/templates/userEmailAddressExport.tpl | 2 +- .../install/files/lib/system/WCFACP.class.php | 21 +----- .../lib/system/style/StyleHandler.class.php | 6 +- .../TemplateScriptingCompiler.class.php | 2 - .../install/files/lib/util/FileUtil.class.php | 71 ------------------- 5 files changed, 4 insertions(+), 98 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl b/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl index 2d69583556..e484d31e5d 100644 --- a/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl +++ b/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl @@ -56,7 +56,7 @@ -
+
diff --git a/wcfsetup/install/files/lib/system/WCFACP.class.php b/wcfsetup/install/files/lib/system/WCFACP.class.php index f49c0e2aca..96f6c6d5df 100644 --- a/wcfsetup/install/files/lib/system/WCFACP.class.php +++ b/wcfsetup/install/files/lib/system/WCFACP.class.php @@ -117,9 +117,7 @@ class WCFACP extends WCF { $path = RouteHandler::getPath(); self::getTPL()->assign(array( - 'baseHref' => $host . $path, - 'quickAccessPackages' => $this->getQuickAccessPackages(), - // todo: 'timezone' => \wcf\util\DateUtil::getTimezone() + 'baseHref' => $host . $path )); } @@ -133,23 +131,6 @@ class WCFACP extends WCF { } } - /** - * Returns a list of all installed applications packages. - * - * @return array - */ - protected function getQuickAccessPackages() { - $quickAccessPackages = array(); - foreach (PackageCacheBuilder::getInstance()->getData(array(), 'packages') as $packageID => $package) { - if (!$package->isApplication) break; - if ($package->package != 'com.woltlab.wcf') { - $quickAccessPackages[] = $package; - } - } - - return $quickAccessPackages; - } - /** * Checks whether the active user has entered the valid master password. */ diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index c6943436bc..b20b881f60 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -116,21 +116,19 @@ class StyleHandler extends SingletonFactory { /** * Returns the HTML tag to include current stylesheet. * - * @todo Add RTL support - * * @return string */ public function getStylesheet() { if (RequestHandler::getInstance()->isACPRequest()) { // ACP - $filename = 'acp/style/style.css'; + $filename = 'acp/style/style'.(WCF::getLanguage()->get('wcf.global.pageDirection') == 'rtl' ? '-rtl' : '').'.css'; if (!file_exists(WCF_DIR.$filename)) { StyleCompiler::getInstance()->compileACP(); } } else { // frontend - $filename = 'style/style-'.$this->getStyle()->styleID.'.css'; + $filename = 'style/style-'.$this->getStyle()->styleID.(WCF::getLanguage()->get('wcf.global.pageDirection') == 'rtl' ? '-rtl' : '').'.css'; if (!file_exists(WCF_DIR.$filename)) { StyleCompiler::getInstance()->compile($this->getStyle()->getDecoratedObject()); } diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index ea3b6e3155..118b78f1d5 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -266,8 +266,6 @@ class TemplateScriptingCompiler { $compiledContent .= $textBlocks[$i]; $compiledContent = chop($compiledContent); - // @todo: INSERT POSTFILTERS HERE!? - // reinsert {literal} Tags $compiledContent = $this->reinsertLiterals($compiledContent); diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index c1e2ceb57a..de5bff87cd 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -412,77 +412,6 @@ final class FileUtil { return $newFileName; } - /** - * Strips supernumerous BOMs from a given bytestream. - * - * If we are dealing with bytestreams being pushed from one program or script to another in a UTF-8 - * environment, we might encounter problems with BOMs (Byte Order Marks). E.g., if there's a script - * that reads a .tar file via readfile(), and this script is encoded in UTF-8, and being called from another - * script which wants to handle the bytestream that results from readfile(). But apparently because of the - * UTF-8 encoding of the called script -- at least in some PHP versions -- readfile() adds a UTF-8 BOM - * at the beginning of the bytestream. If we do write this bytestream to disk and then try to open the - * resulting file, we will get an error because it is no more a valid .tar archive. The same thing happens - * if we handle an .xml file and then try to parse it. - * So, if bytestreams are being handled in a UTF-8 environment, be sure always to use this function - * before writing the bytestream to disk or trying to parse it with an xml parser. - * This works regardless of multibyte string support (mb_strpos and friends) being enabled or not. - * - * Btw, if you try to apply the following to a bytestream read from a .tar file, - * you will end up with a file sized zero bytes: - * while (($byte = fgetc($fileHandle)) !== false) { - * fwrite($fileHandle, $byte); - * } - * - * @param string $sourceContent - * @param string $characterEncoding - * @return string destinationContent - */ - public static function stripBoms($sourceContent = '', $characterEncoding = 'UTF-8') { - try { - // TODO: implement recognition of other BOMs (UTF-7, UTF-16 big endian, UTF-16 little endian etc.) - if ($characterEncoding == 'UTF-8') { - // get the ASCII codes for the three bytes the UTF-8 BOM is consisting of. - $firstByte = intval(0xEF); - $secondByte = intval(0xBB); - $thirdByte = intval(0xBF); - } - else { - return $sourceContent; - } - - // put the bytestream's first three bytes to an array. - $workArray = unpack('C3', $sourceContent); - if (!is_array($workArray)) { - throw new SystemException("Unable to process bytestream."); - } - - // detect the UTF-8 BOM. - if (($workArray['1'] == $firstByte) && ($workArray['2'] == $secondByte) && ($workArray['3'] == $thirdByte)) { - $tmpname = self::getTemporaryFilename('stripBoms_'); - $tmpStream = fopen($tmpname, 'w+'); - fwrite($tmpStream, $sourceContent); - rewind($tmpStream); - - // cut off the BOM. - fseek($tmpStream, 3); // compatibility for PHP < 5.1.0 - $destinationContent = stream_get_contents($tmpStream); - fclose($tmpStream); - @unlink($tmpname); - - return $destinationContent; - } - else { - return $sourceContent; - } - } - catch (SystemException $e) { - // clean up - if (isset($tmpname) && file_exists($tmpname)) @unlink($tmpname); - - throw $e; - } - } - /** * Determines whether a file is text or binary by checking the first few bytes in the file. * The exact number of bytes is system dependent, but it is typically several thousand. -- 2.20.1