<commit_before><?php
namespace wcf\data\style;
use wcf\data\DatabaseObjectDecorator;
use wcf\system\WCF;

/**
 * Represents the active user style.
 * 
 * @author	<NAME>
 * @copyright	2001-2017 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Data\Style
 *
 * @method	Style	getDecoratedObject()
 * @mixin	Style
 */
class ActiveStyle extends DatabaseObjectDecorator {
	/**
	 * @inheritDoc
	 */
	protected static $baseClass = Style::class;
	
	/**
	 * 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 page logo.
	 * 
	 * @return	string
	 */
	public function getPageLogo() {
		if ($this->getDecoratedObject()->getVariable('pageLogo')) {
			return $this->getImage($this->getDecoratedObject()->getVariable('pageLogo'));
		}
		
		return WCF::getPath() . 'images/default-logo.png';
	}
	
	/**
	 * Returns mobile page logo.
	 *
	 * @return	string
	 */
	public function getPageLogoMobile() {
		if ($this->getDecoratedObject()->getVariable('pageLogoMobile')) {
			return $this->getImage($this->getDecoratedObject()->getVariable('pageLogoMobile'));
		}
		
		return WCF::getPath() . 'images/default-logo-small.png';
	}
}
<commit_msg>Force https for page logo for secure pages<commit_after><?php
namespace wcf\data\style;
use wcf\data\DatabaseObjectDecorator;
use wcf\system\request\RouteHandler;
use wcf\system\WCF;

/**
 * Represents the active user style.
 * 
 * @author	<NAME>
 * @copyright	2001-2017 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Data\Style
 *
 * @method	Style	getDecoratedObject()
 * @mixin	Style
 */
class ActiveStyle extends DatabaseObjectDecorator {
	/**
	 * @inheritDoc
	 */
	protected static $baseClass = Style::class;
	
	/**
	 * Returns full path to specified image.
	 * 
	 * @param	string		$image
	 * @return	string
	 */
	public function getImage($image) {
		if (preg_match('~^(https?)://~', $image, $matches)) {
			// rewrite protocol
			if ($matches[1] === 'http' && RouteHandler::secureConnection()) {
				return 'https' . mb_substr($image, 4);
			}
			
			return $image;
		}
		
		if ($this->imagePath && file_exists(WCF_DIR.$this->imagePath.$image)) {
			return WCF::getPath().$this->imagePath.$image;
		}
		
		return WCF::getPath().'images/'.$image;
	}
	
	/**
	 * Returns page logo.
	 * 
	 * @return	string
	 */
	public function getPageLogo() {
		if ($this->getDecoratedObject()->getVariable('pageLogo')) {
			return $this->getImage($this->getDecoratedObject()->getVariable('pageLogo'));
		}
		
		return WCF::getPath() . 'images/default-logo.png';
	}
	
	/**
	 * Returns mobile page logo.
	 *
	 * @return	string
	 */
	public function getPageLogoMobile() {
		if ($this->getDecoratedObject()->getVariable('pageLogoMobile')) {
			return $this->getImage($this->getDecoratedObject()->getVariable('pageLogoMobile'));
		}
		
		return WCF::getPath() . 'images/default-logo-small.png';
	}
}

{'fraction_non_alphanumeric': 0.16596512327119664, 'fraction_numerical': 0.005411906193625977, 'mean_word_length': 3.8498542274052476, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6034477', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1097, 'n_words': 216}