/** * Returns full path to specified image. * * @param string $image * @return string */ public function getImage($image) { if ($this->imagePath && file_exists(WCF_DIR.$this->imagePath.$image)) { return WCF::getPath().$this->imagePath.$image; } return WCF::getPath().'images/'.$image; }
/** * Returns the url to this picture. * * @return string */ public function getURL() { if ($this->pictureID) { return WCF::getPath('news') . 'images/news/' . ($this->categoryID ? $this->categoryID . '/' : '') . $this->getFilename(); } return WCF::getPath('news') . 'images/news/dummyPicture.png'; }
/** * Creates a Member * * A Single Wow Member * * @param array $data * * @link http://dev.battle.net */ function __construct(array $data) { $this->baseUrl = WCF::getPath('cms'); $this->data = $data; $inflector = new Inflector(); $this->inflector = $inflector; }
/** * @see \wcf\data\user\avatar\IUserAvatar::getURL() */ public function getURL($size = null) { if ($size === null) { $size = $this->size; } return WCF::getPath() . 'images/avatars/avatar-default.svg'; }
/** * calculate the final config of $this->cfg through $this->cfg default value and MbqMain::$customConfig and MbqMain::$oMbqAppEnv and the plugin support degree */ public function calCfg() { $url = WCF::getPath(); MbqMain::$oMbqAppEnv->siteRootUrl = substr($url, 0, strlen($url) - 4); //init user $oUser = DefaultUserAuthentication::getInstance()->loginAutomatically(true); if ($oUser && $oUser->userID) { MbqMain::$oMbqAppEnv->oCurrentUser = $oUser; $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser'); $oMbqRdEtUser->initOCurMbqEtUser(); } if (MbqMain::hasLogin()) { //!!! header('Mobiquo_is_login: true'); } else { header('Mobiquo_is_login: false'); } $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum'); MbqMain::$oMbqAppEnv->exttForumTree = $oMbqRdEtForum->getForumTree(); //!!! parent::calCfg(); /* calculate the final config */ $this->cfg['base']['sys_version']->setOriValue(PACKAGE_VERSION); if (OFFLINE) { $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.no')); } else { $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.yes')); } if (!MODULE_CONVERSATION || !WCF::getSession()->getPermission('user.conversation.canUseConversation')) { $this->cfg['pc']['module_enable']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.module_enable.range.disable')); $this->cfg['pc']['conversation']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.conversation.range.notSupport')); } }
/** * Returns full path to specified image. * * @param string $image * @return string */ public function getImage($image) { if (preg_match('~^https?://~', $image)) { return $image; } if ($this->imagePath && file_exists(WCF_DIR . $this->imagePath . $image)) { return WCF::getPath() . $this->imagePath . $image; } return WCF::getPath() . 'images/' . $image; }
/** * Returns the image of this user rank. * * @return string html code */ public function getImage() { if ($this->rankImage) { $image = '<img src="' . (!preg_match('~^(/|https?://)~i', $this->rankImage) ? WCF::getPath() : '') . StringUtil::encodeHTML($this->rankImage) . '" alt="" />'; if ($this->repeatImage > 1) { $image = str_repeat($image, $this->repeatImage); } return $image; } return ''; }
private function getSchemeURL(&$location) { $params = array(); $baseUrl = str_replace(RouteHandler::getProtocol(), 'tapatalk://', WCF::getPath('wbb')) . '?'; $routeData = RouteHandler::getInstance()->getRouteData(); $controller = strtolower(isset($routeData['controller']) ? $routeData['controller'] : ''); $userID = WCF::getUser()->userID; if ($userID) { $params['user_id'] = $userID; } if (!empty($this->eventObj->pageNo)) { $params['page'] = intval($this->eventObj->pageNo); } if (!empty($this->eventObj->itemsPerPage)) { $params['perpage'] = intval($this->eventObj->itemsPerPage); } switch ($controller) { case 'thread': $params['location'] = $location = 'topic'; $params['tid'] = intval($this->eventObj->threadID); $params['fid'] = intval($this->eventObj->board->boardID); break; case 'board': $params['location'] = $location = 'forum'; $params['fid'] = intval($this->eventObj->boardID); break; case 'user': $params['location'] = $location = 'profile'; $params['uid'] = intval($this->eventObj->userID); break; case 'conversation': $params['location'] = $location = 'message'; $params['mid'] = intval($this->eventObj->conversationID); break; case 'users-online-list': case 'usersonlinelist': $params['location'] = $location = 'online'; break; case 'search-result': case 'searchresult': $params['location'] = $location = 'search'; $params['search_id'] = intval($this->eventObj->searchID); break; case 'login': $params['location'] = $location = 'login'; break; default: $params['location'] = $location = 'home'; break; } return $baseUrl . http_build_query($params, '&'); }
public function __construct() { parent::__construct($this); $this->oDb = WCF::getDB(); $oUser = WCF::getUser(); if ($oUser && $oUser->userID) { $this->oUser = $oUser; } $this->loadImActive(); $this->loadPushStatus(); $this->loadSlug(); $this->siteUrl = WCF::getPath('wbb'); $this->pushKey = WBB_TAPATALK_API_KEY; $this->pushNotification = WBB_TAPATALK_PUSH_NOTIFICATION_TYPE; }
/** * calculate the final config of $this->cfg through $this->cfg default value and MbqMain::$customConfig and MbqMain::$oMbqAppEnv and the plugin support degree */ public function calCfg() { $url = WCF::getPath(); MbqMain::$oMbqAppEnv->siteRootUrl = substr($url, 0, strlen($url) - 4); //init current user //$oUser = DefaultUserAuthentication::getInstance()->loginAutomatically(true); //$oUser = WCF::getSession()->getUser(); $oUser = WCF::getUser(); if ($oUser && $oUser->userID) { MbqMain::$oMbqAppEnv->oCurrentUser = $oUser; $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser'); $oMbqRdEtUser->initOCurMbqEtUser($oUser->userID); } if (MbqMain::hasLogin()) { //!!! header('Mobiquo_is_login: true'); } else { header('Mobiquo_is_login: false'); } $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum'); MbqMain::$oMbqAppEnv->exttForumTree = $oMbqRdEtForum->getForumTree(); //!!! MbqMain::$oMbqAppEnv->accessibleBoardIds = Board::getAccessibleBoardIDs(array('canViewBoard', 'canEnterBoard', 'canReadThread')); parent::calCfg(); /* calculate the final config */ $this->cfg['base']['sys_version']->setOriValue(PACKAGE_VERSION); if (OFFLINE) { $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.no')); } else { $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.yes')); } //if (!MODULE_CONVERSATION || !WCF::getSession()->getPermission('user.conversation.canUseConversation')) { if (!MODULE_CONVERSATION) { $this->cfg['pc']['module_enable']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.module_enable.range.disable')); $this->cfg['pc']['conversation']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.conversation.range.notSupport')); } if (!MbqMain::$oMbqAppEnv->accessibleBoardIds) { $this->cfg['user']['guest_okay']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.user.guest_okay.range.notSupport')); $this->cfg['forum']['guest_search']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.forum.guest_search.range.notSupport')); } if ($this->getCfg('base.push')->oriValue == MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.support') && !OFFLINE && (@ini_get('allow_url_fopen') || function_exists('curl_init'))) { $this->cfg['base']['push']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.support')); } else { $this->cfg['base']['push']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.notSupport')); } }
/** * Returns the url of the compiled css file. The stylesheet will be * compiled automatically in case it doesn't exist yet. * * @param integer $styleID * @param boolean $rtl * @return string */ public function getURL($styleID = null, $rtl = null) { // default values if ($styleID === null) { $styleID = StyleCacheBuilder::getInstance()->getData(array(), 'default'); } if ($rtl === null) { $rtl = WCF::getLanguage()->get('wcf.global.pageDirection') == 'rtl'; } // compile stylesheet if necessary if (!file_exists($this->getLocation($styleID, $rtl))) { $this->compile($styleID); } //return filename with appended caching parameter $filename = 'style/style-' . $styleID . '-' . $this->stylesheetID . ($rtl ? '-rtl' : '') . '.css'; return WCF::getPath('cms') . $filename . '?m=' . filemtime(CMS_DIR . $filename); }
/** * 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'; if (!file_exists(WCF_DIR.$filename)) { StyleCompiler::getInstance()->compileACP(); } } else { // frontend $filename = 'style/style-'.$this->getStyle()->styleID.'.css'; if (!file_exists(WCF_DIR.$filename)) { StyleCompiler::getInstance()->compile($this->getStyle()->getDecoratedObject()); } } return '<link rel="stylesheet" type="text/css" href="'.WCF::getPath().$filename.'?m='.filemtime(WCF_DIR.$filename).'" />'; }
/** * Handles logo upload. * * @return array<string> */ public function uploadLogo() { // save files $files = $this->parameters['__files']->getFiles(); $file = $files[0]; try { if (!$file->getValidationErrorType()) { // shrink avatar if necessary $fileLocation = $file->getLocation(); // move uploaded file if (@copy($fileLocation, WCF_DIR . 'images/styleLogo-' . $this->parameters['tmpHash'] . '.' . $file->getFileExtension())) { @unlink($fileLocation); // store extension within session variables WCF::getSession()->register('styleLogo-' . $this->parameters['tmpHash'], $file->getFileExtension()); // return result return array('url' => WCF::getPath() . 'images/styleLogo-' . $this->parameters['tmpHash'] . '.' . $file->getFileExtension()); } else { throw new UserInputException('image', 'uploadFailed'); } } } catch (UserInputException $e) { $file->setValidationErrorType($e->getType()); } return array('errorType' => $file->getValidationErrorType()); }
/** * Get Fraction Background * * @return string */ public function getFractionBackground() { $basePath = WCF::getPath('cms'); $fraction = $this->getHordeOrAlliance() === static::HORDE ? 'horde' : 'alliance'; return $basePath . "/images/wowrooster/background/{$fraction}.png"; }
/** * Returns language icon path. * * @return string */ public function getIconPath() { return WCF::getPath() . 'icon/flag/'.$this->countryCode.'.svg'; }
/** * Returns the cover tag of the given size. If the entry has no cover, the * imagePlacholder is returned. * * @param string $size * @return string */ public function getIconTag($size = Entry::ICON_SIZE) { $src = WCF::getPath('wcf') . 'images/placeholderTiny.png'; if ($this->getCover() && $this->getCover()->showAsImage()) { $src = LinkHandler::getInstance()->getLink('Attachment', array('application' => 'wcf', 'object' => $this->getCover())) . '&tiny=1'; } return '<img class="filebasePreviewImage" src="' . $src . '" alt="" style="width: ' . $size . 'px; height: ' . $size . 'px" />'; }
/** * @see \wcf\data\user\avatar\IUserAvatar::getURL() */ public function getURL($size = null) { if ($size !== null && $size !== 'resized') { if ($size >= $this->width || $size >= $this->height) { $size = null; } } return WCF::getPath() . 'images/avatars/' . $this->getFilename($size); }
/** * Returns the url to this smiley. * * @return string */ public function getURL() { return WCF::getPath() . $this->smileyPath; }
/** * Handles uploaded preview images. * * @return array<string> */ public function upload() { // save files $files = $this->parameters['__files']->getFiles(); $file = $files[0]; try { if (!$file->getValidationErrorType()) { // shrink avatar if necessary $fileLocation = $file->getLocation(); $imageData = getimagesize($fileLocation); if ($imageData[0] > Style::PREVIEW_IMAGE_MAX_WIDTH || $imageData[1] > Style::PREVIEW_IMAGE_MAX_HEIGHT) { try { $adapter = ImageHandler::getInstance()->getAdapter(); $adapter->loadFile($fileLocation); $fileLocation = FileUtil::getTemporaryFilename(); $thumbnail = $adapter->createThumbnail(Style::PREVIEW_IMAGE_MAX_WIDTH, Style::PREVIEW_IMAGE_MAX_HEIGHT, false); $adapter->writeImage($thumbnail, $fileLocation); $imageData = getimagesize($fileLocation); } catch (SystemException $e) { throw new UserInputException('image'); } } // move uploaded file if (@copy($fileLocation, WCF_DIR.'images/stylePreview-'.$this->parameters['tmpHash'].'.'.$file->getFileExtension())) { @unlink($fileLocation); // store extension within session variables WCF::getSession()->register('stylePreview-'.$this->parameters['tmpHash'], $file->getFileExtension()); // return result return array( 'errorType' => '', 'url' => WCF::getPath().'images/stylePreview-'.$this->parameters['tmpHash'].'.'.$file->getFileExtension() ); } else { throw new UserInputException('image', 'uploadFailed'); } } } catch (UserInputException $e) { $file->setValidationErrorType($e->getType()); } return array('errorType' => $file->getValidationErrorType()); }
/** * Returns the HTML tag to include current stylesheet. * * @param boolean $isACP indicates if the request is an acp request * @return string */ public function getStylesheet($isACP = false) { if ($isACP) { // ACP $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 . (WCF::getLanguage()->get('wcf.global.pageDirection') == 'rtl' ? '-rtl' : '') . '.css'; if (!file_exists(WCF_DIR . $filename)) { StyleCompiler::getInstance()->compile($this->getStyle()->getDecoratedObject()); } } return '<link rel="stylesheet" type="text/css" href="' . WCF::getPath() . $filename . '?m=' . filemtime(WCF_DIR . $filename) . '" />'; }
/** * @see \wcf\data\user\avatar\IUserAvatar::getURL() */ public function getURL($size = null) { if ($size === null) { $size = $this->size; } else { switch ($size) { case 16: case 24: $size = 32; break; case 48: case 64: $size = 96; break; } } if (!isset($this->url[$size])) { // try to use cached gravatar $cachedFilename = sprintf(self::GRAVATAR_CACHE_LOCATION, md5(mb_strtolower($this->gravatar)), $size, $this->fileExtension); if (file_exists(WCF_DIR . $cachedFilename) && filemtime(WCF_DIR . $cachedFilename) > TIME_NOW - self::GRAVATAR_CACHE_EXPIRE * 86400) { $this->url[$size] = WCF::getPath() . $cachedFilename; } else { $this->url[$size] = LinkHandler::getInstance()->getLink('GravatarDownload', array('forceFrontend' => true), 'userID=' . $this->userID . '&size=' . $size); } } return $this->url[$size]; }
public function getForumUrl() { return WCF::getPath('wbb'); }
private function replaceOldFileIDs($string) { // bbcode $string = preg_replace_callback('/\\[cmsfile=([0-9]+)\\]/', function ($match) { if (isset($match[1]) && isset($this->tmp['files'][$match[1]])) { $newFileID = $this->tmp['files'][$match[1]]; return '[cmsfile=' . $newFileID . ']'; } else { return $match[0]; } }, $string); // urls $cmsUrl = WCF::getPath('cms'); $typhoon = '/[^\\/ ][index\\.php]{0,}\\?file\\-download\\/([0-9]+)\\-|' . str_replace('/', '\\/', str_replace('.', '\\.', $cmsUrl)) . '[index\\.php]{0,}\\?file\\-download\\/([0-9]+)\\-/'; $maelstrom = '/[^\\/ ][index\\.php]{0,}\\/FileDownload\\/([0-9]+)\\-|' . str_replace('/', '\\/', str_replace('.', '\\.', $cmsUrl)) . '[index\\.php]{0,}\\/FileDownload\\/([0-9]+)\\-/'; $string = preg_replace_callback($typhoon, function ($match) { $cmsUrl = WCF::getPath('cms'); if (isset($match[1]) && isset($this->tmp['files'][$match[1]])) { $newFileID = $this->tmp['files'][$match[1]]; return 'index.php?file-download/' . $newFileID . '-'; } else { if (isset($match[2]) && isset($this->tmp['files'][$match[2]])) { $newFileID = $this->tmp['files'][$match[2]]; return $cmsUrl . 'index.php?file-download/' . $newFileID . '-'; } else { return $match[0]; } } }, $string); $string = preg_replace_callback($maelstrom, function ($match) { $cmsUrl = WCF::getPath('cms'); if (isset($match[1]) && isset($this->tmp['files'][$match[1]])) { $newFileID = $this->tmp['files'][$match[1]]; return 'index.php/FileDownload/' . $newFileID . '-'; } else { if (isset($match[2]) && isset($this->tmp['files'][$match[2]])) { $newFileID = $this->tmp['files'][$match[2]]; return $cmsUrl . 'index.php/FileDownload/' . $newFileID . '-'; } else { return $match[0]; } } }, $string); // new domain if (!empty($this->cmsUrl)) { $cmsUrl = WCF::getPath('cms'); $string = str_replace($this->cmsUrl, $cmsUrl, $string); } return $string; }
/** * Returns the style preview image path. * * @return string */ public function getPreviewImage() { if ($this->image && file_exists(WCF_DIR.'images/'.$this->image)) { return WCF::getPath().'images/'.$this->image; } return WCF::getPath().'images/stylePreview.png'; }