Отправка писем.
@return Boolean
549999
public function sendMail($subject, $message, $allMails = true)
	{
		if ($allMails ==  true) {
			$this->addMails();
		}
		$mail 					= new PhpMailer;
		$mail->IsMAIL();
		$mail->CharSet  = "utf-8";
		$mail->From     = $this->config->fromMail;
		$mail->FromName = $this->config->fromName;
		$mail->Host     = "localhost";
		$mail->Subject  = $subject;
		foreach ($this->_mails as $to) {
			$mail->AddAddress($to);
		}
		$mail->IsHTML(0);
		$mail->Body = $message;
		$mail->Send();
		$mail->ClearAddresses();
		return true;
	}
18930
public function hasPost()
    {
        if (func_num_args() == 0) {
            return !empty($this->post);
        }

        foreach (func_get_args() as $key) {
            if (!$this->hasParam($this->post, $key)) {
                return false;
            }
        }

        return true;
    }
611436
public function requestValid()
    {
        $requestValid = true;

        $request = $this->getRequest();

        $ipnRequestVerifier = $this->getIPNRequestVerifier();
        $ipnRequestVerifier->setRequest($request);
        $ipnRequestVerifier->setShopOwner($this->getPayPalConfig()->getUserEmail());
        $requestCorrect = $ipnRequestVerifier->requestCorrect();

        if (!$requestCorrect) {
            $requestValid = false;

            $logger = $this->getLogger();
            $logger->setTitle("IPN VERIFICATION FAILURE BY PAYPAL");
            $logger->log($ipnRequestVerifier->getFailureMessage());
        }

        return $requestValid;
    }
846786
public function isPair()
    {
        if (0 === strpos(trim($this->text), '#')) {
            return false;
        }
        
        $pieces = explode('=', $this->text, 2);
        $pieces = array_map('trim', $pieces);

        return 2 === count($pieces);
    }
804470
public function is()
    {
        $patterns = func_get_args();

        $name = $this->currentRouteName();

        foreach ($patterns as $pattern) {
            if (Str::is($pattern, $this->currentRouteName())) {
                return true;
            }
        }

        return false;
    }
724682
public function isValid()
    {
        $payPalRequest = $this->getPayPalRequest();
        $payPalResponse = $this->getPayPalResponse();
        $shopOwnerUserName = $this->getShopOwnerUserName();
        $receiverEmailPayPal = $payPalRequest[self::RECEIVER_EMAIL];

        return ($payPalResponse->isPayPalAck() && $receiverEmailPayPal == $shopOwnerUserName);
    }
309110
public static function isDebug()
    {

        $result = self::$enabled;
        if ($result) {

            if (self::$_config['personal']['ip']) {

                if (is_array(self::$_config['personal']['ip'])) {
                    $result = in_array(self::getClientIP(), self::$_config['personal']['ip']);

                } else {
                    $result = self::getClientIP() == self::$_config['personal']['ip'];

                }

            }

            if (self::$_config['personal']['requestParam'] && $result) {

                if (isset($_REQUEST[self::$_config['personal']['requestParam']])
                    &&
                    $_REQUEST[self::$_config['personal']['requestParam']] == self::$_config['personal']['requestValue']
                ) {
                    $result = true;
                } else {
                    $result = false;
                }
            }

        }

        return $result;
    }
731878
public function isEnabled ()
    {   
		try {
			// Если не хватает требуемых модулей, то отключаем
			$this->checkRequirements();
			// Проверяем соответствует ли версия CMS
			$this->checkVersion();
		}
		catch(\Exception $e) {
			return false;
		}		
		
        if (self::$disabled === null) {
			self::$disabled = Application::getInstance()->getVar('module_disable');
			if (!is_array(self::$disabled)) self::$disabled = array();
		}
        return !(boolean)(self::$disabled && self::$disabled[$this->name]);
    }
1221952
public static function isItSelfContact(){

        $ppcn_id = false;
        $action = Yii::app()->controller->action->id;
        switch (Yii::app()->controller->action->id) {
            
            //update
            case 'editableSaver':
                $ppcn_id = yii::app()->request->getParam('pk');
            //delete
            case 'delete':                
                if(!$ppcn_id){
                    $ppcn_id = yii::app()->request->getParam('ppcn_id');
                }
                if(!$ppcn_id){
                    return false;
                }
                
                $ppcn = PpcnPersonContact::model()->findByPk($ppcn_id);
                if(!$ppcn || $ppcn->ppcnPprs->pprs_id != Yii::app()->getModule('user')->user()->profile->person_id){
                    return false;            
                }
                
                break;

            //create
            case 'ajaxCreate':
                if(yii::app()->request->getParam('value') != Yii::app()->getModule('user')->user()->profile->person_id){
                    return false;            
                }

                break;

            default:
                return false;
                break;
        }

        return true;
        
    }
441449
private function isValidRequest()
    {
        $request = Eresus_CMS::getLegacyKernel()->request;
        /** @var TClientUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $options = $page->options;
        $disallowPOST = array_key_exists('disallowPOST', $options) && $options['disallowPOST'];
        if ('POST' == $request['method'] && $disallowPOST)
        {
            return false;
        }

        $disallowGET = array_key_exists('disallowGET', $options) && $options['disallowGET'];
        $hasGetArgs = $request['url'] != $request['path'];
        if ($hasGetArgs && $disallowGET)
        {
            return false;
        }
        return true;
    }
552593
public function run() {
		$this->resetParser();
		if(function_exists('pcntl_signal')) {
			if(! $this->signal_handlers_installed) {
				pcntl_signal(SIGTERM, array($this, 'handleSignal'), false);
				pcntl_signal(SIGINT, array($this, 'handleSignal'), false);
				pcntl_signal(SIGHUP, array($this, 'handleSignal'), false);
				pcntl_signal(SIGUSR1, array($this, 'handleSignal'), false);
			}
			pcntl_signal_dispatch();
			// Следующее нужно, если обработчик сигнала надумал нас отключить
			if($this->disconnect) {
				return $this->result = 0; // Если мы сами отключились, то это можно считать успехом по определению
			}
		}
		
		if(!$this->socket = @ socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) {
			$this->result = socket_last_error($this->socket);
			$errstr = socket_strerror($this->result);
			@ socket_clear_error($this->socket);
			$this->log("error {$this->result}: $errstr", PHP_COMPONENT_MESSAGE_ERROR, true);
			return $this->result;
		}
		
		if(! @ socket_connect($this->socket, $this->hostname, $this->port)) {
			$this->result = socket_last_error($this->socket);
			$errstr = socket_strerror($this->result);
			@ socket_clear_error($this->socket);
			$this->log("error {$this->result}: $errstr", PHP_COMPONENT_MESSAGE_ERROR, true);
			@ socket_close($this->socket);
			return $this->result;
		}
		
		$this->send('<stream:stream xmlns="jabber:component:accept" xmlns:stream="http://etherx.jabber.org/streams" to="' . $this->component_name . '">');
		
		socket_set_nonblock($this->socket);
		
		while(true) {
			$read = array($this->socket);
			$write = $except = NULL;
			
			if(($socket = @ socket_select($read, $write, $except, 1)) === false) {
				if(function_exists('pcntl_signal_dispatch')) {
					pcntl_signal_dispatch();
				}
				@ socket_close($this->socket);
				return $this->result;
			}
			
			if($socket === 0) {
				if(function_exists('pcntl_signal_dispatch')) {
					pcntl_signal_dispatch();
				}
				$this->checkTimers();
				continue;
			}
			
			if(($buf = @ socket_read($this->socket, 1024, PHP_BINARY_READ)) === false) {
				if(function_exists('pcntl_signal_dispatch')) {
					pcntl_signal_dispatch();
				}
				if(($this->result = socket_last_error($this->socket)) === 4) {
					@ socket_clear_error($this->socket);
					$this->result = 0;
					break; // корректное отключение
				}
				if(($this->result = socket_last_error($this->socket)) === 11) {
					continue; // системный вызов прерван по сигналу
				}
				$errstr = socket_strerror($this->result);
				$this->log("error {$this->result}: $errstr", PHP_COMPONENT_MESSAGE_ERROR, true);
				@ socket_clear_error($this->socket);
				@ socket_close($this->socket);
				return $this->result;
			}
			if($buf == '') {
				// Не совсем понятно, почему при закрытии соединения сервером не генерируется никакая ошибка
				// Возможно, это некорректный способ определить, отключили ли нас, надо ещё уточнить
				$this->log('the remote server has dropped the connection', PHP_COMPONENT_MESSAGE_ERROR, true);
				return 104; // код ошибки connection reset by peer
			}
			$this->feed($buf);
			// Следующее сработает, если мы отключились в обработчике некоторой станзы
			if($this->disconnect) {
				$this->result = 0;
				break;
			}
		}
		
		@ socket_close($this->socket);
		return $this->result;
	}
1049012
public static function check()
    {
        // Проверим значение установленной текущей локализации, если оно не входит в список доступных локализаций
        // установим локализацию по умолчанию
        if (!in_array(strtolower(self::$current_locale), self::$locales)) self::$current_locale = self::DEF;
    }
1035308
protected function hasPermission()
    {
        $request = $this->request;
        $do = $this->getAction('can');

        return ! $this->forbiddenRoute() && $request->user()->can($do);
    }
327842
public function getIsSecureConnection()
    {
        $https = $this->getServerParam('HTTPS');
        if ($https !== null && (strcasecmp($https, 'on') === 0 || $https == 1)) {
            return true;
        }
        foreach ($this->secureProtocolHeaders as $header => $values) {
            if ($this->hasHeader($header)) {
                foreach ($values as $value) {
                    if (strcasecmp($this->getHeaderLine($header), $value) === 0) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
1278360
public function processCallback()
	{
		$request = Request::header();
		Log::info('Пришёл запрос callback с такими заголовками ', $request);
		$provider = $this->getProvider();
		$oSettings = Setting::whereGateId($provider['login'])->first();
		$this->setConfigForGateway($oSettings);

		$requestParams = Input::all();
		Log::info('Получены параметры в qiwi-shop для обработки callback:', array(
			'$requestParams' => $requestParams,
			'$provider'      => $provider,
		));
		$gate = new Gateway($this->makeCurl());
		if ($gate->doParseCallback($requestParams)) {
			$order = Order::find($gate->getCallbackOrderId());
			if (!$order) {
				$gate->createCallbackResponse(Gateway::C_BILL_NOT_FOUND);

				return $gate->doCallbackResponse();
			}
			$newStatus = $gate->getValueBillStatus();
			Log::info('Статусы заказов после обработки callback:', array(
				'oldStatus' => $order->status,
				'newStatus' => $newStatus,
			));
			if ($order->status != $newStatus) {
				$order->status = $newStatus;
				$order->save();
			}
		}

		return $gate->doCallbackResponse();
	}
161173
public static function ipn()
        {
            // only accept post data
            if (!count($_POST)) {
                return false;
            }

            // if production mode...
            if (Config::get('paypal.production_mode')) {
                // use production endpoint
                $endpoint = 'https://www.paypal.com/cgi-bin/webscr';
            } else {
                // use sandbox endpoint
                $endpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
            }

            // build response
            $fields = http_build_query(array('cmd' => '_notify-validate') + Input::all());

            // curl request
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $endpoint);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
            $response = curl_exec($ch);
            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

            // if errors...
            if (curl_errno($ch)) {
                #$errors = curl_error($ch);
                curl_close($ch);

                // return false
                return false;
            } else {
                // close connection
                curl_close($ch);

                // if success...
                if ($code === 200 and $response === 'VERIFIED') {
                    return true;
                } else {
                    return false;
                }
            }
        }
223565
public function getRegionString()
    {
        //Оно может быть не сохранено если определяли по ip
        $result = [];

        $result[] = ArrayHelper::getValue($this->data, 'region_with_type');
        $result[] = ArrayHelper::getValue($this->data, 'area_with_type');
        $result[] = ArrayHelper::getValue($this->data, 'city_with_type');
        $result[] = ArrayHelper::getValue($this->data, 'settlement_with_type');

        $result = array_unique($result);

        foreach ($result as $key => $value)
        {
            if (!$value)
            {
                unset($result[$key]);
            }
        }

        return implode(", ", $result);
    }