<?php /// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; // get style files list in current skin. $styleFileList = array(); $tempStyleFileList = Utils_Misc::getFileListByRegExp(getSkinPath($skinSetting['skin']), '\\.css$', true); foreach ($tempStyleFileList as $styleFile) { $styleFileList[basename($styleFile)] = $styleFile; } @ksort($styleFileList); unset($tempStyleFileList); // set current css. if (isset($_GET['style'])) { $currentStyleFile = $_GET['style']; } else { $tempKeys = array_keys($styleFileList); $currentStyleFile = str_replace(getSkinPath($skinSetting['skin']) . '/', '', $styleFileList[$tempKeys[0]]); } $skin = ''; if (file_exists(getSkinPath($skinSetting['skin']) . "/skin.html")) { $skin = @file_get_contents(getSkinPath($skinSetting['skin']) . "/skin.html"); } $skin_keyword = ''; if (file_exists(getSkinPath($skinSetting['skin']) . "/skin_keyword.html")) { $skin_keyword = @file_get_contents(getSkinPath($skinSetting['skin']) . "/skin_keyword.html"); } $htmlFilePerms = preg_replace('@^[0-9]{2}|[0-9]{2}$@', '', strrev(decoct(fileperms(getSkinPath($skinSetting['skin']) . "/skin.html")))); $styleFilePerms = preg_replace('@^[0-9]{2}|[0-9]{2}$@', '', $temp = strrev(decoct(fileperms(getSkinPath($skinSetting['skin']) . "/" . $currentStyleFile))));
static function getFileListByRegExp($path, $pattern, $deepScan = false) { $path = preg_replace('@/$@', '', $path); $fileList = array(); if ($dirHandle = @dir($path)) { while (false !== ($tempSrc = $dirHandle->read())) { if ($tempSrc == '.' || $tempSrc == '..' || preg_match('@^\\.@', $tempSrc)) { continue; } if (is_dir($path . '/' . $tempSrc)) { $tempList = Utils_Misc::getFileListByRegExp($path . '/' . $tempSrc, $pattern, $deepScan); if (is_array($tempList)) { $fileList = array_merge($fileList, $tempList); } } if (is_file($path . '/' . $tempSrc)) { if ($pattern == '' || preg_match("@{$pattern}@", $tempSrc)) { array_push($fileList, $path . '/' . $tempSrc); } } } $dirHandle->close(); } return $fileList; }