(c) Anton Medvedev <anton@medv.io>
483896
private function doSetPermissions(): void
    {
        $permissionMethod = $this->getConfig(Option::permissionMethod);
        $writableDirs = implode(' ', $this->getConfig(Option::writableDirs));
        $this->log(sprintf('<h2>Setting permissions for writable dirs using the "%s" method</>', $permissionMethod));

        if ('chmod' === $permissionMethod) {
            $this->runRemote(sprintf('chmod -R %s %s', $this->getConfig(Option::permissionMode), $writableDirs));

            return;
        }

        if ('chown' === $permissionMethod) {
            $this->runRemote(sprintf('sudo chown -RL %s %s', $this->getConfig(Option::permissionUser), $writableDirs));

            return;
        }

        if ('chgrp' === $permissionMethod) {
            $this->runRemote(sprintf('sudo chgrp -RH %s %s', $this->getConfig(Option::permissionGroup), $writableDirs));

            return;
        }

        if ('acl' === $permissionMethod) {
            $this->runRemote(sprintf('sudo setfacl -RL -m u:"%s":rwX -m u:`whoami`:rwX %s', $this->getConfig(Option::permissionUser), $writableDirs));
            $this->runRemote(sprintf('sudo setfacl -dRL -m u:"%s":rwX -m u:`whoami`:rwX %s', $this->getConfig(Option::permissionUser), $writableDirs));

            return;
        }

        throw new InvalidConfigurationException(sprintf('The "%s" permission method is not valid. Select one of the supported methods.', $permissionMethod));
    }
711546
public function __HANDLER()
    {
        // Create query to get users
        $query = dbQuery('user')->Active(1)->order_by('UserID');

        // Create generic table for users
        $table = new Table($query);

        // Установим представление
        m()->view('main/index')->title(t('Пользователи системы', true))
            ->all_materials(true)
            // Установим шаблон таблицы пользователей
            ->user_table($table->render());
    }
60390
function () {
    var tmp_0 = this.get(2,2) * this.get(3,3);
    var tmp_1 = this.get(3,2) * this.get(2,3);
    var tmp_2 = this.get(1,2) * this.get(3,3);
    var tmp_3 = this.get(3,2) * this.get(1,3);
    var tmp_4 = this.get(1,2) * this.get(2,3);
    var tmp_5 = this.get(2,2) * this.get(1,3);
    var tmp_6 = this.get(0,2) * this.get(3,3);
    var tmp_7 = this.get(3,2) * this.get(0,3);
    var tmp_8 = this.get(0,2) * this.get(2,3);
    var tmp_9 = this.get(2,2) * this.get(0,3);
    var tmp_10 = this.get(0,2) * this.get(1,3);
    var tmp_11 = this.get(1,2) * this.get(0,3);
    var tmp_12 = this.get(2,0) * this.get(3,1);
    var tmp_13 = this.get(3,0) * this.get(2,1);
    var tmp_14 = this.get(1,0) * this.get(3,1);
    var tmp_15 = this.get(3,0) * this.get(1,1);
    var tmp_16 = this.get(1,0) * this.get(2,1);
    var tmp_17 = this.get(2,0) * this.get(1,1);
    var tmp_18 = this.get(0,0) * this.get(3,1);
    var tmp_19 = this.get(3,0) * this.get(0,1);
    var tmp_20 = this.get(0,0) * this.get(2,1);
    var tmp_21 = this.get(2,0) * this.get(0,1);
    var tmp_22 = this.get(0,0) * this.get(1,1);
    var tmp_23 = this.get(1,0) * this.get(0,1);

    var t0 = ((tmp_0 * this.get(1,1) + tmp_3 * this.get(2,1) + tmp_4 * this.get(3,1)) -
              (tmp_1 * this.get(1,1) + tmp_2 * this.get(2,1) + tmp_5 * this.get(3,1)));
    var t1 = ((tmp_1 * this.get(0,1) + tmp_6 * this.get(2,1) + tmp_9 * this.get(3,1)) -
              (tmp_0 * this.get(0,1) + tmp_7 * this.get(2,1) + tmp_8 * this.get(3,1)));
    var t2 = ((tmp_2 * this.get(0,1) + tmp_7 * this.get(1,1) + tmp_10 * this.get(3,1)) -
              (tmp_3 * this.get(0,1) + tmp_6 * this.get(1,1) + tmp_11 * this.get(3,1)));
    var t3 = ((tmp_5 * this.get(0,1) + tmp_8 * this.get(1,1) + tmp_11 * this.get(2,1)) -
              (tmp_4 * this.get(0,1) + tmp_9 * this.get(1,1) + tmp_10 * this.get(2,1)));

    var d = 1.0 / (this.get(0,0) * t0 + this.get(1,0) * t1 + this.get(2,0) * t2 + this.get(3,0) * t3);

    var out_00 = d * t0;
    var out_01 = d * t1;
    var out_02 = d * t2;
    var out_03 = d * t3;

    var out_10 = d * ((tmp_1 * this.get(1,0) + tmp_2 * this.get(2,0) + tmp_5 * this.get(3,0)) -
                      (tmp_0 * this.get(1,0) + tmp_3 * this.get(2,0) + tmp_4 * this.get(3,0)));
    var out_11 = d * ((tmp_0 * this.get(0,0) + tmp_7 * this.get(2,0) + tmp_8 * this.get(3,0)) -
                      (tmp_1 * this.get(0,0) + tmp_6 * this.get(2,0) + tmp_9 * this.get(3,0)));
    var out_12 = d * ((tmp_3 * this.get(0,0) + tmp_6 * this.get(1,0) + tmp_11 * this.get(3,0)) -
                      (tmp_2 * this.get(0,0) + tmp_7 * this.get(1,0) + tmp_10 * this.get(3,0)));
    var out_13 = d * ((tmp_4 * this.get(0,0) + tmp_9 * this.get(1,0) + tmp_10 * this.get(2,0)) -
                      (tmp_5 * this.get(0,0) + tmp_8 * this.get(1,0) + tmp_11 * this.get(2,0)));

    var out_20 = d * ((tmp_12 * this.get(1,3) + tmp_15 * this.get(2,3) + tmp_16 * this.get(3,3)) -
                      (tmp_13 * this.get(1,3) + tmp_14 * this.get(2,3) + tmp_17 * this.get(3,3)));
    var out_21 = d * ((tmp_13 * this.get(0,3) + tmp_18 * this.get(2,3) + tmp_21 * this.get(3,3)) -
                      (tmp_12 * this.get(0,3) + tmp_19 * this.get(2,3) + tmp_20 * this.get(3,3)));
    var out_22 = d * ((tmp_14 * this.get(0,3) + tmp_19 * this.get(1,3) + tmp_22 * this.get(3,3)) -
                      (tmp_15 * this.get(0,3) + tmp_18 * this.get(1,3) + tmp_23 * this.get(3,3)));
    var out_23 = d * ((tmp_17 * this.get(0,3) + tmp_20 * this.get(1,3) + tmp_23 * this.get(2,3)) -
                      (tmp_16 * this.get(0,3) + tmp_21 * this.get(1,3) + tmp_22 * this.get(2,3)));
    
    var out_30 = d * ((tmp_14 * this.get(2,2) + tmp_17 * this.get(3,2) + tmp_13 * this.get(1,2)) -
                      (tmp_16 * this.get(3,2) + tmp_12 * this.get(1,2) + tmp_15 * this.get(2,2)));
    var out_31 = d * ((tmp_20 * this.get(3,2) + tmp_12 * this.get(0,2) + tmp_19 * this.get(2,2)) -
                      (tmp_18 * this.get(2,2) + tmp_21 * this.get(3,2) + tmp_13 * this.get(0,2)));
    var out_32 = d * ((tmp_18 * this.get(1,2) + tmp_23 * this.get(3,2) + tmp_15 * this.get(0,2)) -
                      (tmp_22 * this.get(3,2) + tmp_14 * this.get(0,2) + tmp_19 * this.get(1,2)));
    var out_33 = d * ((tmp_22 * this.get(2,2) + tmp_16 * this.get(0,2) + tmp_21 * this.get(1,2)) -
                      (tmp_20 * this.get(1,2) + tmp_23 * this.get(2,2) + tmp_17 * this.get(0,2)));

    this.elements[0*4+0] = out_00;
    this.elements[0*4+1] = out_01;
    this.elements[0*4+2] = out_02;
    this.elements[0*4+3] = out_03;
    this.elements[1*4+0] = out_10;
    this.elements[1*4+1] = out_11;
    this.elements[1*4+2] = out_12;
    this.elements[1*4+3] = out_13;
    this.elements[2*4+0] = out_20;
    this.elements[2*4+1] = out_21;
    this.elements[2*4+2] = out_22;
    this.elements[2*4+3] = out_23;
    this.elements[3*4+0] = out_30;
    this.elements[3*4+1] = out_31;
    this.elements[3*4+2] = out_32;
    this.elements[3*4+3] = out_33;
    return this;
  }
1323759
def multicharacters(input)
      output = input.gsub(/\([Cc]\)/, "©")
      output = output.gsub(/\([Pp]\)/, "℗")
      output = output.gsub(/\([Rr]\)/, "®")
      output = output.gsub(/\((SM|sm|Sm)\)/, "℠")
      output = output.gsub(/\((TM|tm|Tm)\)/, "™")
      output = output.gsub(/\+-/, "±")
      output = output.gsub(/-\+/, "∓")
      output = output.gsub(/N[oO]\.?\s*(\d+)/, '№\1')
      output = output.gsub(/°C/, '℃')
      output = output.gsub(/°F/, '℉')
    end
960121
protected function adaptSourcesSearchPhrases()
    {
        $dataArray = [];

        //Формируем массив
        foreach ($this->data['data'] as $item) {
            $dataArray['data'][] = [
                'searchPhrase'            => $item['dimensions'][0]['name'],
                'searchEngineRoot'        => $item['dimensions'][1]['name'],
                'visits'                  => $item['metrics'][0],
                //Визиты
                'bounceRate'              => $item['metrics'][1],
                //Отказы %
                'pageDepth'               => $item['metrics'][2],
                //Глубина просмотра
                'avgVisitDurationSeconds' => date("i:s", $item['metrics'][3])
                //Время проведенное на сайте мин:сек.
            ];
        }

        //Итого и средние значения
        $dataArray['totals'] = [
            'visits'                  => $this->data['totals'][0],
            'bounceRate'              => $this->data['totals'][1],
            'pageDepth'               => $this->data['totals'][2],
            'avgVisitDurationSeconds' => date("i:s", $this->data['totals'][3]),
        ];

        $this->adaptData = $dataArray;
    }
73309
protected function adaptTechPlatforms()
    {
        $dataArray = [];

        //Формируем массив
        foreach ($this->data['data'] as $item) {
            $dataArray['data'][] = [
                'browser'                 => $item['dimensions'][0]['name'],
                'visits'                  => $item['metrics'][0],
                //Визиты
                'bounceRate'              => $item['metrics'][1],
                //Отказы %
                'pageDepth'               => $item['metrics'][2],
                //Глубина просмотра
                'avgVisitDurationSeconds' => date("i:s", $item['metrics'][3])
                //Время проведенное на сайте мин:сек.
            ];
        }

        //Итого и средние значения
        $dataArray['totals'] = [
            'visits'                  => $this->data['totals'][0],
            'bounceRate'              => $this->data['totals'][1],
            'pageDepth'               => $this->data['totals'][2],
            'avgVisitDurationSeconds' => date("i:s", $this->data['totals'][3]),
        ];

        $this->adaptData = $dataArray;
    }
486603
protected function getCurrentPort()
    {
        // Сначала проверьте наличие прокси-сервера
        $port = $this->getHeader('X_FORWARDED_PORT');
        if ($port) {
            return (string)$port;
        }

        $protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
        if ($protocol === 'https') {
            return '443';
        }

        return (string)$this->getServerVar('SERVER_PORT');
    }
1274032
public function endpointAuth()
	{
		/**
		 * @var Processor $processor
		 */

		$type = Type::PAYMENT;
		$input = Input::all();
		$input = Type::clearInput($type, $input);

		$term = Terminal::find($input['term']);
		Secure::sign($input, $type, $term->secret);

		$processor = $this->makeProcessor($type, $input);
		$errorMessage = null;

		try {
			$response = $processor->response();

			if ($response->rc !== '00') {
				$errorMessage = ProcessorException::getCodeMessage($response->rc);
			}

			// need auth
			if ($response->auth()) {
				return Redirect::to($response->auth());
			}

		} catch (ProcessorException $e) {
			$errorMessage = $e->getMessage();
		}


		if (!$errorMessage) {
			return Views::reload(
				Views::url(
					$input['back'],
					array('resultBankEmulatorPayment' => 'success')
				),
				array(
					'Платеж принят!',
					'Ждите перехода в интернет-магазин',
				),
				'success'
			);
		}

		return Views::reload(
			Views::url(
				$input['back'],
				array('resultBankEmulatorPayment' => 'error')
			),
			array(
				$errorMessage,
				'Ждите перехода в интернет-магазин',
			),
			'danger'
		);

	}
759733
function convertGrammar( $word, $case ) {
		global $wgGrammarForms;
		if ( isset( $wgGrammarForms['ru'][$case][$word] ) ) {
			return $wgGrammarForms['ru'][$case][$word];
		}

		# These rules are not perfect, but they are currently only used for site names so it doesn't
		# matter if they are wrong sometimes. Just add a special case for your site name if necessary.

		# join and array_slice instead mb_substr
		$ar = array();
		preg_match_all( '/./us', $word, $ar );
		if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
			switch ( $case ) {
				case 'genitive': # родительный падеж
					if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) )
						{ }
					elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ь' )
						$word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'я';
					elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ия' )
						$word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ии';
					elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' )
						$word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ки';
					elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' )
						$word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'тей';
					elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ды' )
						$word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дов';
					elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' )
						$word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
					break;
				case 'dative':  # дательный падеж
					# stub
					break;
				case 'accusative': # винительный падеж
					# stub
					break;
				case 'instrumental':  # творительный падеж
					# stub
					break;
				case 'prepositional': # предложный падеж
					# stub
					break;
			}
		return $word;
	}
598796
function evalInput() {
    'use strict';
    if (input.value != window.lastInput) {
        var theResult, evalSucceeded;
        try {
            theResult = eval(input.value);
            evalSucceeded = true;
        } catch (e) {
            output.innerHTML = e;
        }
        if (evalSucceeded) {
            // TODO: Обработать вывод ошибок (перевод)
            output.innerHTML = (theResult + "").replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r\n|\r|\n/g, '<br>');
        }
        window.lastInput = input.value;
    }
}
106120
function __content() // пока не используется, т.к. более древнее в base_object
	{
		if(($render_class = $this->render_class()))
		{
			if($render_class == 'self')
				$render = $this;
			elseif(!($render = bors_load($render_class)))
				debug_exit("Can't load global render engine {$render_class} for object '{$this}'");

			return $render->rendering($this);
		}
	}
1018214
function (_tahta_id, _kurum_id, _para_id) {
                return TEMP + ":" + TAHTA + ":" + _tahta_id + ":" + KURUM + ":" + _kurum_id + ":" + PARA_BIRIM + ":" + _para_id + ":" + TEKLIF;
            }
1126603
private function clientCheckRequest()
    {
        /* @var TClientUI $page */
        $page = Eresus_Kernel::app()->getPage();
        /* Собираем вместе ожидаемые элементы URL */
        $acceptUrl = Eresus_CMS::getLegacyKernel()->request['path'] .
            ($page->subpage !== 0 ? 'p' . $page->subpage . '/' : '');

        if ($page->topic)
        {
            $acceptUrl .= $page->topic !== false ? $page->topic . '/' : '';
        }

        /* Сравниваем с переданным URL */
        if ($acceptUrl != Eresus_CMS::getLegacyKernel()->request['url'])
        {
            throw new Eresus_CMS_Exception_NotFound;
        }
    }
236505
protected function adaptSourcesSummary()
    {
        $dataArray = [];

        //Формируем массив
        foreach ($this->data['data'] as $item) {
            $dataArray['data'][] = [
                'trafficSource'           => $item['dimensions'][0]['name'],
                'sourceEngine'            => $item['dimensions'][1]['name'],
                'visits'                  => $item['metrics'][0],
                //Визиты
                'bounceRate'              => $item['metrics'][1],
                //Отказы %
                'pageDepth'               => $item['metrics'][2],
                //Глубина просмотра
                'avgVisitDurationSeconds' => date("i:s", $item['metrics'][3])
                //Время проведенное на сайте мин:сек.
            ];
        }

        //Итого и средние значения
        $dataArray['totals'] = [
            'visits'                  => $this->data['totals'][0],
            'bounceRate'              => $this->data['totals'][1],
            'pageDepth'               => $this->data['totals'][2],
            'avgVisitDurationSeconds' => date("i:s", $this->data['totals'][3]),
        ];

        $this->adaptData = $dataArray;
    }
1238532
protected function adaptVisitsUsersSearchEngine()
    {
        $dataArray = [];

        //Формируем массив
        foreach ($this->data['data'] as $item) {
            $dataArray['data'][] = [
                'searchEngine' => $item['dimensions'][0]['name'],
                'users'        => $item['metrics'][0]              //Юзеры
            ];
        }

        //Итого
        $dataArray['totals'] = [
            'users' => $this->data['totals'][0],
        ];

        $this->adaptData = $dataArray;
    }
895107
def parse ( c )
      @parserstate = INITIAL_STATE
      retval = true
      #
      # * Фиксированное состояние (определенное): -1.
      # * Не фиксированное состояние (неопределенное): -2.
      # * Переход (смена состояний): >0.
      # 
      @buffer << c

      # Задан шаблон для игнорирования символов.
      if @chain.last.ignore[:all].size > 0 then
        return retval if @chain.last.ignore[:all].include?(c)
      end
      
      # Проверка переходов в другие состояния.
      r = classify( @chain.last )

      # Переход (прыжок) в другое состояние.
      # <branch>:
      if r >= 0 then
	@chain << @states[r]
	if @chain.last.run_init( @buffer ) == nil then
	  reset( )
	  @parserstate = 'branch'
	else
	  @parserstate = 'error'
	  retval = false
	end
	
      # Возврат из текущего состояния.
      # <back>:
      elsif r == -1 then
	if @chain.last.run_fini( @buffer ) == nil then
	  #
	  # если это состояние не первое в цепочке
	  # тогда откатываемся назад.
	  if @chain.size > 1 then
	    @chain.delete_at( @chain.size - 1 )
	  end
	  reset( )
	  @parserstate = 'back'
	else
	  @parserstate = 'error'
	  retval = false
	end
	
      # Нет совпадений.
      # <miss>:
      elsif r == -3 then
	#
	# если в процессе состояния <wait>
	# мы попали в <miss>, то накопленный
	# буфер надо обработать.
	@buffer.each do |ch|
	  @parserstate = 'miss'
	  tag = true
	  if @chain.last.ignore[:handler].size > 0 then
	    tag = false if @chain.last.ignore[:handler].include?(ch)
	  end
	  if tag == true then
	    if @chain.last.run_handler( ch ) != nil then
	      @parserstate = 'error'
	      retval = false
	      break
	    end
	  end
	end
	@buffer = []
      end
      return retval
    end
432721
function all($limit1=NULL, $limit2=NULL)
	{
		$args = func_get_args();
		if(count($args) == 0)
			$array = parent::all();
		elseif(count($args) == 1)
			// Формат all($limit)
			$array = parent::all($limit1);
		else
			// Формат all($page, $items_per_page)
			$array = parent::all($limit1, $limit2);

		return blib_array::factory($array);
	}