403Webshell
Server IP : 195.134.90.114  /  Your IP : 216.73.217.33
Web Server : Apache/2.4.58
System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : OFF
Directory :  /var/www/html/public_html/plugins/generic/customLocale/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /var/www/html/public_html/plugins/generic/customLocale/CustomLocaleHandler.inc.php
<?php

/**
 * @file CustomLocaleHandler.inc.php
 *
 * Copyright (c) 2016-2023 Language Science Press
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 *
 * @class CustomLocaleHandler
 */

import('classes.handler.Handler');

class CustomLocaleHandler extends Handler {
	/**
	 * Print the custom locale changes.
	 * @param $args array
	 * @param $request PKPRequest
	 */
	function printCustomLocaleChanges($args, $request) {
		$context = $request->getContext();

		$contextFileManager = new ContextFileManager($context ? $context->getId() : CONTEXT_SITE);
		$customLocaleDir = $contextFileManager->getBasePath() . 'customLocale';
		if (!file_exists($customLocaleDir) || !is_dir($customLocaleDir)) throw new Exception("Path \"$customLocaleDir\" does not exist!");

		// get all xml-files in the custom locale directory
		$directory = new RecursiveDirectoryIterator($customLocaleDir);
		$iterator = new RecursiveIteratorIterator($directory);
		$regex = new RegexIterator($iterator, '/^.+\.xml$/i', RecursiveRegexIterator::GET_MATCH);
		$files = iterator_to_array($regex);
		$fileKeys = array_keys($files);

		$output = '';

		import('lib.pkp.classes.i18n.LocaleFile');
		// iterate through all customized files
		foreach ($fileKeys as $pathToFile) {
			$posLib = strpos($pathToFile,'lib');
			$posLocale = strpos($pathToFile,'locale');
			$posPlugins = strpos($pathToFile,'plugins');

			$localeFile = '';
			if (!$posLib===false) {
				$localeFile = substr($pathToFile,$posLib);
			} else if (!$posPlugins===false) {
				$localeFile = substr($pathToFile,$posPlugins);
			}
			else {
				$localeFile = substr($pathToFile,$posLocale);
			}

			$localeContentsCustomized = null;
			if ($contextFileManager->fileExists($pathToFile)) {
				$localeContentsCustomized = LocaleFile::load($pathToFile);
			}

			$localeContents = null;
			if ($contextFileManager->fileExists($localeFile)) {
				$localeContents = LocaleFile::load($localeFile);
			}

			$localeKeys = array_keys($localeContentsCustomized);

			if (sizeof($localeKeys)>0) {
				$output = $output . "\nFile: " . $localeFile;
			}

			foreach ($localeKeys as $index => $localeKey) {
				$output = $output . "\n\n" . $index+1 . '. locale key: ' . $localeKey;
				$output = $output . "\n\n	original content:   " . $localeContents[$localeKey];
				$output = $output . "\n	customized content: " . $localeContentsCustomized[$localeKey];
			}
			if (!empty($localeKeys)) {
				$output = $output . "\n\n__________________________________________________________________________________\n\n";
			}
		}

		$filename = 'customLocale_changes.txt';
		header('Content-Type: text/plain');
		header('Content-Disposition: attachment; filename="'.$filename.'"');
		header('Content-Length: ' . strlen($output));
		echo $output;
	}
}


Youez - 2016 - github.com/yon3zu
LinuXploit