403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/icd/plugins/system/jbroadsearch.php
<?php
/*
 * JBroadSearch Plugin by Efthimios Mavrogeorgiadis for Joomla! 1.5.x - Version 1.0.0
 * Copyright (c) 2009 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' );

if (!function_exists('runkit_method_add') or !function_exists('runkit_method_redefine')) return;

if (!preg_match('/search/', $_SERVER['REQUEST_URI'])) return;

global $jbschars, $jbslangs, $jbsaccented, $mainframe;

$plugins = array('categories' => 1, 'contacts' => 1, 'content' => 1,
                 'newsfeeds' => 1, 'sections' => 1, 'weblinks' => 1);

if (jbsIsOtherActive($plugins)) return;

$where = "WHERE element = 'jbroadsearch'";
$params = jbsGetParams($where);

if (array_key_exists('fixchars', $params)) {
    $jbschars = $params['fixchars'];
    unset($params['fixchars']);
}
else $jbschars = 'äàáâãāåăąæçčćĉďđðëèéêēěęğĝĥïìíîīıĵłñňńöòóôőōœøřßšśșşŝțťþüùúûűūůŭÿýžźżάέήίϊΐόύϋΰώς¿¡';
if (array_key_exists('fixlangs', $params)) {
    $jbslangs = explode(',', preg_replace('/\s+/', '', $params['fixlangs']));
    unset($params['fixlangs']);
}
else $jbslangs = 'el,fr,de';

if (!count($params)) $params = $plugins;
else {
    $total = 0;
    foreach ($params as $k => $v) {
        $total += $v;
    }
    if (!$total) return;
}
$jbsaccented = getFullAccentedLetters();

$file = realpath(JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'utilities' . DS . 'string.php');
require_once $file;

$newfunc = '{return preg_match(\'/\'.str_replace(\'/\', \'\/\', $search).\'/\', $str);}';
runkit_method_add('JString', 'stristr_regex', '$str, $search', $newfunc);

$file = JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_search' . DS. 'helpers' . DS . 'search.php';
$splitter = 'function checkNoHtml($object, $searchTerm, $fields)';
$splitter1 = '/**';
$firstline = 'class SearchHelper';

$theData = readFileToChange($file, $firstline);
$parts = explode($splitter, $theData);
$parts = explode($splitter1, $parts[1]);

$fullcode = 'function checkNoHtmlForRegex($object, $searchTerm, $fields)';
$fullcode .= str_replace('JString::stristr', 'JString::stristr_regex', $parts[0]);
eval($fullcode);

$splitter = 'function prepareSearchContent( $text, $length = 200, $searchword )';
$parts = explode($splitter, $theData);
$parts = explode($splitter1, $parts[1]);

$fullcode = 'function prepareSearchContentJBS( $text, $length = 200, $searchword )';
$fullcode .= str_replace('SearchHelper::_smartSubstr', 'smartSubstrJBS', $parts[0]);
eval($fullcode);

$splitter = 'function _smartSubstr($text, $length = 200, $searchword)';
$parts = explode($splitter, $theData);
$parts = explode($splitter1, $parts[1]);

$fullcode = 'function smartSubstrJBS($text, $length = 200, $searchword)';
$newcode = '$regexfgs = turnTextIntoRegex(\'#\'.$lsearchword.\'#\', \''.$jbschars.'\');'."\n";
$newcode .= 'preg_match($regexfgs, JString::strtolower($chunk), $matchesfgs, PREG_OFFSET_CAPTURE);'."\n";
$newcode .= 'if (count($matchesfgs)) { $wordfound = $matchesfgs[0][1]; }'."\n";
$newcode .= 'else $wordfound = false;'."\n";
$fullcode .= str_replace('$wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);', $newcode, preg_replace('/\n\}/', '', $parts[0]));
eval($fullcode);

if ($mainframe->_name == 'site') {
    $file = JPATH_SITE . DS . 'components' . DS . 'com_search' . DS. 'views' . DS. 'search' . DS . 'view.html.php';
    require_once $file;

    $splitter = 'function display($tpl = null)';
    $firstline = 'class SearchViewSearch extends JView';

    $theData = readFileToChange($file, $firstline);
    $parts = explode($splitter, $theData);
    $newfunc = $parts[1];
    while(substr($newfunc, -1) != '}') {
        $newfunc = substr($newfunc, 0, -1);
    }
    $newfunc = substr($newfunc, 0, -1);
    $search = '$row = preg_replace($searchRegex, \'<span class="highlight">\0</span>\', $row );';
    $replace = 'jbsHighlight($row, $searchRegex);';
    $newfunc = str_replace($search, $replace, $newfunc);
    $newfunc = str_replace('$row = SearchHelper::prepareSearchContent( $row, 200, $needle );', '$row = prepareSearchContentJBS( $row, 200, $needle );', $newfunc);
    runkit_method_redefine('SearchViewSearch', 'display', '$tpl = null', $newfunc);
}

foreach ($params as $s => $v) {
    if ($v) eval(getSearchFile($s, $jbschars));
}

function jbsHighlight(&$row, $searchRegex) {
    global $jbschars;
    $ngrx = turnTextIntoRegex($searchRegex, $jbschars);
    preg_match_all($ngrx, JString::strtolower($row), $mfgs, PREG_PATTERN_ORDER|PREG_OFFSET_CAPTURE);
    for ($jj = count($mfgs[0]) - 1; $jj >= 0; $jj--) {
        $length = strlen($mfgs[0][$jj][0]);
        $pos = $mfgs[0][$jj][1];
        $row = substr($row, 0, $pos) . '<span class="highlight">' . substr($row, $pos, $length) . '</span>' . substr($row, $pos + $length);
    }
}

function readFileToChange($file, $firstline) {
    $fh = fopen($file, 'r');
    $theData = fread($fh, filesize($file));
    fclose($fh);
    if ($firstline) $theData = preg_replace('/^(.|\n)+?'.quotemeta($firstline).'/', $firstline, $theData);
    return $theData;
}

function jbsIsOtherActive($plugins) {
    $ret = false;
    $db =& JFactory::getDBO();
    $query = "SELECT element FROM #__plugins WHERE folder = 'search' AND published = 1";
    $db->setQuery($query);
    $result = $db->loadResultArray();
    foreach (array_keys($plugins) as $p) {
        if (in_array($p, $result)) $ret = true;
    }
    return $ret;
}

function jbsGetParams($where) {
    $db =& JFactory::getDBO();
    $query = "SELECT params FROM #__plugins $where";
    $db->setQuery($query);
    $result = preg_split('/\n/', $db->loadResult());
    foreach ($result as $r) {
        $key = substr($r, 0, strpos($r, '='));
        $value = substr($r, strpos($r, '=')+1);
        if ($key) $params[$key] = $value;
    }
    return $params;
}

function getSearchFile($filename, &$chars) {
    $where = "WHERE folder = 'search' AND element = '$filename'";
    $plugin_params = jbsGetParams($where);
    $fields = array('a.name', 'a.title', 'a.description', 'a.misc', 'a.con_position',
                    'a.address', 'a.suburb', 'a.state', 'a.country', 'a.introtext',
                    'a.`fulltext`', 'a.fulltext','a.metakey', 'a.metadesc', 'a.link', 'a.url');
    $file = JPATH_SITE . DS . 'plugins' . DS . 'search' . DS . $filename . '.php';
    $firstline = '$mainframe';
    $theData = readFileToChange($file, $firstline);
    foreach ($plugin_params as $k => $v) {
        $theData = preg_replace('/\$pluginParams->def\s*\(\s*["\']'.$k.'["\'][^;]+;/', $v.';', $theData);
        $theData = preg_replace('/\$pluginParams->get\s*\(\s*["\']'.$k.'["\'][^;]+;/', $v.';', $theData);
    }
    $theData = str_replace('$searchText = $text;', '$text_parsed = false;$searchText = $text = fixTextForQuery($text, $text_parsed, \''.$chars.'\');', $theData);
    $theData = str_replace('$text = trim( $text );', '$text = trim( $text );$text = fixTextForQuery($text, $text_parsed, \''.$chars.'\');', $theData);
    $theData = str_replace('searchHelper::checkNoHTML', 'checkNoHtmlForRegex', $theData);
    $theData = str_replace('REGEXP', 'LIKE', $theData);
    $accented = getAccentedLettersJBS($chars);
    $like = ' LIKE';
    foreach ($fields as $f) {
        $r = 'LOWER(' . $f . ')';
        foreach ($accented as $k => $v) {
            if (is_array($v)) {
                $r = 'REPLACE(' . $r . ',\\\'' . $k . '\\\',\\\'' . $v[0] . '\\\')';
            }
            else $r = 'REPLACE(' . $r . ',\\\'' . $k . '\\\',\\\'' . $v . '\\\')';
        }
        $theData = str_replace($f . $like, $r . $like, $theData);
    }
    return $theData;
}

function getAccentedLettersJBS($chars) {
    global $jbsaccented;
    $ret = array();
    for ($i = 0; $i < mb_strlen($chars); $i++) {
        $ltr = mb_substr($chars, $i, 1);
        if (array_key_exists($ltr, $jbsaccented) and $jbsaccented[$ltr]) $ret[$ltr] = $jbsaccented[$ltr];
    }
    return $ret;
}

function fixTextForQuery($text, &$text_parsed=false, $chars) {
    if ($text_parsed) return $text;
    if (!$text) return '';
    $accented = getAccentedLettersJBS($chars);
    foreach ($accented as $k => $v) {
        if (is_array($v)) $text = str_replace($k, $v[0], $text);
        else $text = str_replace($k, $v, $text);
    }
    $text_parsed = true;
    return $text;
}

function turnTextIntoRegex($regex, $chars) {
    if (!$regex) return '';
    $firstchar = mb_substr($regex, 0, 1);
    $main_regex = mb_substr($regex, 1, mb_strrpos($regex, $firstchar)-1);
    $lastpart = mb_substr($regex, mb_strrpos($regex, $firstchar));
    $accented = getAccentedLettersJBS($chars);
    $acc = array();
    foreach ($accented as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $c) {
                $acc[$c][] = $k;
            }
        }
        else $acc[$v][] = $k;
        $main_regex = str_replace($k, $v, $main_regex);
    }
    krsort($acc);
    foreach ($acc as $k => $v) {
        $v[] = $k;
        $main_regex = str_replace($k, '('.implode('|', $v).')', $main_regex);
    }
    return $firstchar.$main_regex.$lastpart;
}

function getFullAccentedLetters() {
    global $jbslangs;
    $file = realpath(dirname(__FILE__) . DS . 'jbroadsearch_data.ini');
    $firstline = '';
    $theData = readFileToChange($file, $firstline);
    $comma = 'xxxjbsxxx';
    $theData = preg_replace('/\\\,/', $comma, $theData);
    $lines = preg_split('/\n/', $theData);
    $chars = array();
    foreach ($lines as $l) {
        $l = str_replace(' ', '', $l);
        if (preg_match('/^\[(\w+)\]/', $l, $matches)) $key = $matches[1];
        elseif (strpos($l, '=') and $key) {
            $values = substr($l, strpos($l, '=')+1);
            $char = str_replace($comma, ',', substr($l, 0, strpos($l, '=')));
            if (strpos($values, ',')) {
                $linearray = explode(',', $values);
                if (preg_match('/'.$comma.'/', $values)) {
                    for ($i = 0; $i < count($linearray); $i++) {
                        $linearray[$i] = str_replace($comma, ',', $linearray[$i]);
                    }
                }
            }
            else $linearray = str_replace($comma, ',', $values);
            $chars[$key][$char] = $linearray;
        }
    }
    $ret = array();
    foreach ($chars as $k => $v) {
        if (is_array($jbslangs) and in_array($k, $jbslangs)) jbs_array_merge($ret, $v);
    }
    return $ret;
}

function jbs_array_merge(&$a, &$b) {
    foreach ($b as $k => $v) {
        if (array_key_exists($k, $a) and is_array($a[$k])) $a[$k][] = $v;
        elseif (array_key_exists($k, $a) and !is_array($a[$k]) and $a[$k]) $a[$k] = array($a[$k], $v);
        else $a[$k] = $v;
        if (is_array($a[$k])) sort($a[$k]);
    }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit