| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/plugins/system/ |
Upload File : |
<?php
/*
* Fix Greek Search Plugin by Efthimios Mavrogeorgiadis for Joomla! 1.5.x - Version 1.0.0
* Copyright (c) 2008 Efthimios Mavrogeorgiadis. All rights reserved.
* Released under the GNU/GPL license: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$file = JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'utilities' . DS . 'string.php';
$splitter = 'function stristr($str, $search)';
$firstline = 'if (extension_loaded(\'mbstring\')';
$theData = readFileToChange($file, $firstline);
$parts = explode($splitter, $theData);
$parts[0] .= 'function stristr_regex($str, $search){return preg_match(\'/\'.str_replace(\'/\', \'\/\', $search).\'/\', $str);}';
$fullcode = implode($splitter, $parts);
eval($fullcode);
$file = JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_search' . DS. 'helpers' . DS . 'search.php';
$splitter = 'function checkNoHtml($object, $searchTerm, $fields)';
$firstline = 'class SearchHelper';
$theData = readFileToChange($file, $firstline);
$parts = explode($splitter, $theData);
$fullcode = 'function checkNoHtmlForRegex($object, $searchTerm, $fields)';
$fullcode .= str_replace('JString::stristr', 'JString::stristr_regex', substr($parts[1], 0, strpos($parts[1], '/**') - 1));
eval($fullcode);
$searchfiles = array('categories', 'contacts', 'content', 'newsfeeds', 'sections', 'weblinks');
foreach ($searchfiles as $s) {
eval(getSearchFile($s));
}
function readFileToChange($file, $firstline) {
$fh = fopen($file, 'r');
$theData = fread($fh, filesize($file));
fclose($fh);
$theData = preg_replace('/^(.|\n)+?'.quotemeta($firstline).'/', $firstline, $theData);
return $theData;
}
function getSearchFile($filename) {
$file = JPATH_SITE . DS . 'plugins' . DS . 'search' . DS . $filename . '.php';
$firstline = '$mainframe';
$theData = readFileToChange($file, $firstline);
$theData = str_replace('$searchText = $text;', '$searchText = $text = turnTextIntoRegex($text);', $theData);
$theData = str_replace('$text = trim( $text );', '$text = trim( $text );$text = turnTextIntoRegex($text);', $theData);
$theData = str_replace('LIKE', 'REGEXP', $theData);
$theData = str_replace('searchHelper::checkNoHTML', 'checkNoHtmlForRegex', $theData);
$theData = str_replace("'%'", "''", $theData);
return $theData;
}
function turnTextIntoRegex($text) {
if (!$text) return '';
$a = array(
'Α' => '(Α|Ά|α|ά)',
'Ά' => '(Α|Ά|α|ά)',
'α' => '(Α|Ά|α|ά)',
'ά' => '(Α|Ά|α|ά)',
'Β' => '(Β|β)',
'β' => '(Β|β)',
'Γ' => '(Γ|γ)',
'γ' => '(Γ|γ)',
'Δ' => '(Δ|δ)',
'δ' => '(Δ|δ)',
'Ε' => '(Ε|Έ|ε|έ)',
'Έ' => '(Ε|Έ|ε|έ)',
'ε' => '(Ε|Έ|ε|έ)',
'έ' => '(Ε|Έ|ε|έ)',
'Ζ' => '(Ζ|ζ)',
'ζ' => '(Ζ|ζ)',
'Η' => '(Η|Ή|η|ή)',
'Ή' => '(Η|Ή|η|ή)',
'η' => '(Η|Ή|η|ή)',
'ή' => '(Η|Ή|η|ή)',
'Θ' => '(Θ|θ)',
'θ' => '(Θ|θ)',
'Ι' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'Ί' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'Ϊ' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'ι' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'ί' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'ϊ' => '(Ι|Ί|Ϊ|ι|ί|ϊ|ΐ)',
'ΐ' => '(Ι|Ί|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