Example #1
0
 public function verify()
 {
     $verifier = new Verification();
     $rules = $this->rules();
     //foreach($rules as $rule) {
     //}
     if ($verifier->ruleEmail($this->attributes['email']) && $verifier->rulePassword($this->attributes['password'])) {
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 public function loadADiscussion($id_topic, $id_discussion)
 {
     if (!empty($_POST)) {
         if (isset($_POST['PostMessage'])) {
             $verification = new Verification($_POST);
             $verification->notEmpty('titre', "Veuillez donner un titre à votre message.");
             $verification->notEmpty('reponse', "Vous ne pouvez poster un message vide.");
             $error .= $verification->error;
             if ($verification->isValid()) {
                 $this->forum->postMessage($id_topic, $id_discussion);
                 $succes = "Message posté!";
             }
         }
         if (isset($_POST['Modify'])) {
             $modification = 1;
             $id_modif = $_POST['id'];
             $titre_modif = $_POST['titre'];
             $reponse_modif = $_POST['reponse'];
         }
         if (isset($_POST['ModifyMessage'])) {
             $verification = new Verification($_POST);
             $verification->notEmpty('titre', "Veuillez donner un titre à votre message.");
             $verification->notEmpty('reponse', "Vous ne pouvez poster un message vide.");
             $error .= $verification->error;
             $id_publication = $_POST['id_message'];
             if ($verification->isValid()) {
                 $this->forum->UpdateMessage($id_topic, $id_discussion, $id_publication);
                 $succes = "Message modifié!";
             }
         }
         if (isset($_POST['Delete'])) {
             $this->forum->deleteMessage($id_topic, $id_discussion);
             $succes = "Message effacé avec succès!";
         }
     }
     $views = $this->forum->AddView($id_topic, $id_discussion);
     //compteur +1
     $topic = $this->forum->getTopic($id_topic)->fetch();
     $discussion = $this->forum->getDiscussion($id_topic, $id_discussion)->fetch();
     $messages = $this->forum->getMessages($id_topic, $id_discussion)->fetchAll();
     $nbTotalMessageUsers = $this->forum->countAllMessage();
     $pseudouser = $this->user->getPseudoAndId();
     $vue = new Vue("Discussion", "Forum", ['stylesheet.css']);
     $vue->loadpage(['discussion' => $discussion, 'topic' => $topic, 'modification' => $modification, 'messages' => $messages, 'nbTotalMessageUsers' => $nbTotalMessageUsers, 'error' => $error, 'succes' => $succes, 'id_modif' => $id_modif, 'titre_modif' => $titre_modif, 'reponse_modif' => $reponse_modif, 'pseudouser' => $pseudouser]);
 }
Example #3
0
/**
 * Проверка WebMoney WMID.
 * 
 * @param type $wmid
 *
 * @return \xajaxResponse
 */
function checkWebmoneyWMID($wmid)
{
    $objResponse = new xajaxResponse();
    $uid = get_uid(false);
    $error = false;
    if ($uid > 0) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
        $verification = new Verification();
        if (!$verification->webmoneyCheckWMID($wmid, $uid)) {
            $error = $verification->getError();
        }
        if ($error) {
            $objResponse->script("window.verification_popup.showError('{$error}');");
        } else {
            $objResponse->script("window.verification_popup.openWindowWM('{$verification->getWMLoginUrl()}');");
        }
    }
    return $objResponse;
}
 public function loadMessagePrive()
 {
     $error = '';
     $succes = '';
     if (!empty($_POST)) {
         $verification = new Verification($_POST);
         $verification->notEmpty('destinataire', "Précisez pour qui ce message est destiné.");
         $verification->notEmpty('objet', "Veuillez compléter le champ objet.");
         $verification->notEmpty('message', "Précisez votre message.");
         $error = $verification->error;
         if ($verification->isValid()) {
             //} && $verificationPhoto->isValid()){
             $donneesuser = $this->user->getDataUser($_POST['destinataire'])->fetch();
             $_POST['destinataire'] = $donneesuser['id'];
             $this->accueil->sendMessage();
             $succes = 'Message envoyé avec succès!';
         }
     }
     $vue = new Vue("MessagePrive", "Accueil", ['stylesheet.css'], ['RechercheUser.js']);
     $vue->loadpage(['error' => $error, 'succes' => $succes]);
 }
 function check_string($arParameters = array())
 {
     parent::check_string($arParameters);
     if (!$arParameters['PlatformID']) {
         unset($arParameters['PlatformID']);
     }
     return $arParameters;
 }
Example #6
0
// код ошибки ответа Яндекс.Денег
$sType = __paramInit('string', 'type', null, '');
// тип возврата
$sId = __paramInit('string', 'id', null, '');
// id проекта
$sfName = __paramInit('string', 'fname', null, '');
// Имя
$slName = __paramInit('string', 'lname', null, '');
// Фамилия
$error = '';
$exterr = '';
if ($uid) {
    if ($sError || !$sCode) {
        $error = 'Произошла ошибка во время верификации.';
    } else {
        $verification = new Verification();
        if ($verification->ydCheckUserReqvs($uid)) {
            $sIsEmp = is_emp() ? 't' : 'f';
            if (!$verification->ydVerification($uid, $sIsEmp, $sCode, $sfName, $slName)) {
                $error = $verification->error;
            }
        } else {
            $error = $verification->error;
        }
    }
} else {
    $error = Verification::ERROR_NO_AUTH;
    $exterr = 'noagain';
}
switch ($sType) {
    case 'promo':
Example #7
0
$meta->updateGoogleVer($_POST['site_url_add'], $_POST['keyword']);
echo "The token has been added";
?>
						</p>
				</div>	
		</div>
		<div class="container">
				<div id="input">
						<h1>Delete Google Verification Meta Tag</h1>
						<p>Input the URL below and the Google Site Verification token will be deleted</p>
						<form id="update" action="index.php">
							<input name="site_url_delete" type="text" placeholder="Enter URL Here"/>
							<br/>
							<input id="submitDelete" type="submit" class="submit-btn" name="submitDelete" value="Submit"/>
						</form>
						<p id="output3">
							<?php 
$meta = new Verification();
if ($meta->deleteGoogleVer($_POST['site_url_delete'])) {
    echo "The token has been added";
} else {
    echo "No token to delete";
}
?>
						</p>
				</div>
		</div>
	</body>
</html>

Example #8
0
 public function loadProfil()
 {
     $pseudouser = str_replace(' ', '-', $_SESSION['user']['pseudo']);
     $succes = "";
     $error = "";
     $nomville = "";
     if (!empty($_POST)) {
         if (!empty($_POST['modifyProfil'])) {
             $verification = new Verification($_POST);
             $verificationPhoto = new Verification($_FILES);
             $verification->notEmpty('email', "Veuillez compléter le champ email.");
             $verification->notEmpty('nom', "Spécifiez votre nom de famille.");
             $verification->notEmpty('prenom', "Spécifiez votre prénom.");
             $verification->notEmpty('sexe', "Êtes-vous un homme ou une femme?");
             $verification->notEmpty('ville', "Choississez une ville.");
             $error .= $verification->error;
             if ($verification->isValid()) {
                 if (!empty($_FILES['photo']['name'])) {
                     $verificationPhoto->PhotoOk('photo', $pseudouser . '.jpg', 'Users/Profil', false);
                 }
                 if (!empty($_FILES['couverture']['name'])) {
                     $verificationPhoto->PhotoOk('couverture', $pseudouser . '.jpg', 'Users/Bannière', false);
                 }
                 if (!$verificationPhoto->isValid()) {
                     $error .= "Un problème s'est produit lors de l'ajout des photos.";
                 } else {
                     if (!empty($_FILES['photo']['name'])) {
                         deletePhoto($pseudouser . '.jpg', 'Users/Profil', 'photo');
                     }
                     if (!empty($_FILES['couverture']['name'])) {
                         deletePhoto($pseudouser . '.jpg', 'Users/Bannière', 'couverture');
                     }
                     /*upload images*/
                     //
                     $error .= uploadPhoto($pseudouser . '.jpg', 'Users/Profil', 'photo');
                     $error .= uploadPhoto($pseudouser . '.jpg', 'Users/Bannière', 'couverture');
                 }
                 if (empty($error)) {
                     $ville = $this->groupe->getVilleByName($_POST['ville'])->fetch();
                     $id_ville = $ville['id'];
                     $this->user->modifierProfil($_SESSION['user']['pseudo'], $id_ville);
                     $succes = "Profil modifié avec succès!";
                 }
             }
         }
         if (!empty($_POST['changePw'])) {
             $verification = new Verification($_POST);
             $verificationPhoto = new Verification($_FILES);
             $verification->notEmpty('ex_mot_de_passe', "Veuillez spécifier votre ancien mot de passer.");
             $verification->notEmpty('mot_de_passe', "Spécifiez votre nouveau mot de passe.");
             $verification->notEmpty('mot_de_passe_confirmation', "Retapez votre nouveau mot de passe.");
             $error .= $verification->error;
             if ($verification->isValid()) {
                 if ($this->user->CheckPasswordUser()) {
                     if ($_POST['mot_de_passe'] == $_POST['mot_de_passe_confirmation']) {
                         if (passwordOk($_POST['mot_de_passe'])) {
                             $this->user->updatePw();
                             $data = $this->user->CheckUser()->fetch();
                             $_SESSION['user'] = $data;
                             $succes = "Mot de passe modifié avec succès.";
                         } else {
                             $error .= 'Le mot de passe ne possède pas les bons critères';
                         }
                     } else {
                         $error .= 'Les deux nouveaux mots de passent ne correspondent pas.';
                     }
                 } else {
                     $error .= "L'ancien mot de passe fourni n'est pas correcte.";
                 }
             }
         }
     }
     $id_ville = $_SESSION['user']['id_ville'];
     if (!empty($_SESSION['user']['id_ville'])) {
         $ville = $this->groupe->getVilleById($id_ville)->fetch();
         $nomville = $ville['name'];
     }
     $_SESSION['user'] = $this->user->getDataUser($_SESSION['user']['pseudo'])->fetch();
     //refresh la session.
     $vue = new Vue("Profil", "User", ['stylesheet.css'], ['calendrier.js', 'modifier_profil.js', 'showphoto.js', 'RechercheGroupe.js', 'Verification.js']);
     $vue->loadpage(['nomville' => $nomville, 'pseudouser' => $pseudouser, 'error' => $error, 'succes' => $succes]);
 }
Example #9
0
$verify_pskb_compl[$i]['frl'] = Verification::getStatVerify($fdate, $tdate, 'pskb', true, true);
$verify_okpay_compl[$i]['frl'] = Verification::getStatVerify($fdate, $tdate, 'okpay', true, true);
// Успешно - по странам
$verify_wm_compl[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'wm_country', true);
$verify_ff_compl[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'ff_country', true);
$verify_yd_compl[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'yd_country', true);
$verify_pskb_compl[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'pskb_country', true);
$verify_okpay_compl[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'okpay_country', true);
// Не успешно - по странам
$verify_wm[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'wm_country', false);
$verify_ff[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'ff_country', false);
$verify_yd[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'yd_country', false);
$verify_pskb[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'pskb_country', false);
$verify_okpay[$i]['country'] = Verification::getStatVerify($fdate, $tdate, 'okpay_country', false);
// Общая по странам
$verify_country[$i] = Verification::getStatVerify($fdate, $tdate, 'country');
?>
</form>


<?php 
if (count($stats) == 0) {
    ?>
<strong>Статистика пустая</strong>
<?php 
} else {
    ?>

<table  border="1" cellspacing="2" cellpadding="2">
    <colgroup>
        <col width="530"/>
Example #10
0
    	
        <page>

            <?php 
require 'header.php';
?>

            <?php 
require_once dirname(__FILE__) . "/php/class.verification.php";
global $app;
global $bdd;
global $_TABLES;
$content_html = "<content>\n                                    <div class='verification'>\n                                        <div class='message'>%%message%%</div>\n                                        <div class='redirection'>Vous allez être redirigé vers la page d'accueil dans <span class='redirection-time' time='5'></span></div>\n                                    </div>\n                                </content>";
$key = $app->router()->getCurrentRoute()->getParams()['key'];
if (!is_null($bdd) && !is_null($_TABLES)) {
    $objVerification = new Verification($bdd, $_TABLES);
    $message = $objVerification->getVerification($key);
    if (!empty($message)) {
        $content_html = str_replace('%%message%%', $message, $content_html);
        echo $content_html;
    } else {
        // 404
        echo "404 Not Found";
    }
} else {
    error_log("BDD ERROR : " . $bdd);
    error_log("TABLES ERROR : " . $_TABLES);
}
?>

            <?php 
Example #11
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
switch ($quick_verification_type) {
    case 'promo':
        $qver_title = 'Верификация';
        $qver_btn = 'Закрыть';
        break;
    case 'project':
        $qver_title = 'Верификация для ответа на проект';
        $qver_btn = 'Закрыть и ответить на проект';
        break;
}
$quser = new users();
$quser->GetUserByUID(get_uid(false));
$_yd_uri_auth = Verification::getYDUriAuth($quick_verification_type == 'project' ? $project['id'] : null);
?>
<script type="text/javascript">
    var _YD_URI_AUTH = "<?php 
echo $_yd_uri_auth;
?>
";
</script>

<div id="quick_ver_window" class=" b-shadow b-shadow_width_540 b-shadow_center b-shadow_pad_20 b-shadow_zindex_110 b-shadow_hide">
   <table class="b-layout__table b-layout__table_width_full">
      <tbody><tr class="b-layout__tr">
         <td class="b-layout__td b-layout__td_width_70 b-layout__td_padright_10">
             <span class="b-icon b-icon__ver-big b-icon__ver-big_empty"></span>
         </td>
         <td class="b-layout__td">
Example #12
0
 public function loadBackOfficeAide()
 {
     $succes = "";
     $error = "";
     if (!empty($_POST)) {
         if (isset($_POST['addQuest'])) {
             $verification = new Verification($_POST);
             $verification->notEmpty('section', "Veuillez compléter le champ section.");
             $verification->notEmpty('question', "Veuillez informer une question.");
             $verification->notEmpty('reponse', "Ne voulez vous pas répondre à la question?");
             $error = $verification->error;
             if ($verification->isValid()) {
                 if (empty($error)) {
                     $this->admin->addQuest();
                 }
             }
         }
         if (isset($_POST['delete'])) {
             $this->admin->deleteQuest();
         }
     }
     $aide = $this->accueil->getAide();
     $vue = new Vue("BackOfficeAide", "Admin", ['font-awesome.css', 'admin.css']);
     $vue->loadbackoffice(['aide' => $aide, 'error' => $error]);
 }
 public function equals(Verification $other)
 {
     return $this->getCode() === $other->getCode() && $this->getMsisdn() === $other->getMsisdn();
 }
Example #14
0
     } else {
         $_SESSION['errorCards'] = $status;
         header("Location: /bill/fail_card/");
         exit;
     }
 } else {
     if ($_GET['orderId'] == $_SESSION['quick_ver_card_num']) {
         // Верификация
         $walletAlpha->api->getAccessData('bind');
         $status = $walletAlpha->api->getOrderStatus($_SESSION['quick_ver_card_num']);
         if ($status['OrderStatus'] == API_AlphaBank::STATUS_SUCCESS_PAYMENT) {
             $res = $walletAlpha->api->reverse($_SESSION['quick_ver_card_num']);
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
             $_SESSION['verifyStatus'] = array('status' => 1);
             $_SESSION['is_verify'] = 't';
             $verification = new Verification();
             $verification->card(get_uid(), $status['Pan']);
             $redirect_part = "?vok=1&vuse=card";
         } else {
             $redirect_part = "?verror=1&vuse=card";
         }
         ?>
         <html><body><script>window.close();</script></body></html>
         <?php 
         exit;
     } elseif ($_SESSION['quickpro_card_orderid'] == $_GET['orderId']) {
         // Быстрая покупка pro
         $walletAlpha->api->getAccessData('bind');
         $status = $walletAlpha->api->getOrderStatus($_SESSION['quickpro_card_orderid']);
         if ($status['OrderStatus'] == API_AlphaBank::STATUS_SUCCESS_PAYMENT) {
             require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
Example #15
0
function __verify_user($user_id, $verification_type, $verification_code)
{
    $verification = Verification::where('user_id', $user_id)->where('verification_type', $verification_type)->first();
    $user = User::find($user_id);
    if ($verification == NULL) {
        return -2;
        // no such verification was requested.
    }
    if ($verification->verification_code != $verification_code) {
        return 0;
        // wrong code
    }
    $ptime = strtotime($verification->updated_at);
    $etime = time() - $ptime;
    if ($etime > 300) {
        return -1;
        // 5 minutes passed. this code is no need.
    }
    $verification->verification_code = substr(md5($user_id . date('Y-m-d H:i:s')), 0, 5);
    // change code randomly.
    $verification->save();
    if ($verification_type == 'phone') {
        $user->phone_verified = 1;
    } else {
        if ($verification_type == 'email') {
            $user->email_verified = 1;
        }
    }
    $user->save();
    return 1;
    // correct.
}
Example #16
0
/**
 * Проверка и обработка данных верификации
 */
//Если пришли от WM отключаем проверку CSRF
if (isset($_POST['WmLogin_WMID'])) {
    $allow_fp = true;
    define('NO_CSRF', 1);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
$uid = get_uid(false);
if ($uid <= 0) {
    header_location_exit('/promo/verification/');
}
$service = __paramInit('string', 'service');
$verification = new Verification();
switch ($service) {
    case 'webmoney':
        if (!$verification->webmoney($uid)) {
            $error = $verification->getError();
            session::setFlashMessage($error, 'verify_error');
        }
        break;
        //@todo: можно перенести из income обработку ЯД верификации
    //@todo: можно перенести из income обработку ЯД верификации
    default:
        header_location_exit('/promo/verification/');
}
?>
<html>
    <body>
Example #17
0
 public function loadCreationGroupe()
 {
     $succes = '';
     $error = '';
     if (!empty($_POST)) {
         $nomphoto = str_replace(' ', '-', $_POST['nom']);
         if (!empty($_FILES['photogroupe']['name'])) {
             $error .= "Veuillez selectionner une photo de groupe!";
         }
         if (!empty($_FILES['Bannière']['name'])) {
             $error .= "Veuillez selectionner une Bannière pour le groupe!";
         }
         $verification = new Verification($_POST);
         $verificationPhoto = new Verification($_FILES);
         $verification->notEmpty('nom', "Veuillez spécifier un nom à votre groupe.");
         $verificationPhoto->PhotoOk('photogroupe', $nomphoto . '.jpg', 'Groupes/Profil');
         $verificationPhoto->PhotoOk('Bannière', $nomphoto . '.jpg', 'Groupes/Bannière');
         $verification->notEmpty('categorie', "Veuillez séléctionner une catégorie.");
         $verification->notEmpty('nombre', "Indiquez le nombre maximal de membres.");
         $verification->notEmpty('sport', "Choississez un sport.");
         $verification->notEmpty('ville', "Choississez une ville.");
         $verification->notEmpty('description', "Décrivez votre groupe.");
         $verification->notEmpty('niveau', "Veuillez préciser le niveau.");
         //  $verification->notEmpty('visibilite', "Votre groupe sera-il privé ou public?");
         $error = $verification->error;
         $error .= $verificationPhoto->error;
         if (!$verificationPhoto->isValid()) {
             $error .= "Ce groupe existe déjà! Veuillez choisir un autre nom.";
         }
         if ($verification->isValid() && $verificationPhoto->isValid()) {
             // && $verificationPhoto->isValid()){
             /*upload images*/
             $error .= uploadPhoto($nomphoto . '.jpg', 'Groupes/Profil', 'photogroupe');
             $error .= uploadPhoto($nomphoto . '.jpg', 'Groupes/Bannière', 'Bannière');
             //Add BDD
             if (empty($error)) {
                 $ville = $this->groupe->getVilleByName($_POST['ville'])->fetch();
                 $_POST['ville'] = intval($ville['id']);
                 $id = $this->groupe->addGroupe();
                 $this->user->addLeader($id);
                 $succes = "Groupe ajouté avec succès!</br> Vous pouvez consulter sa page en cliquant ";
             }
         }
     }
     $categorie = $this->groupe->getCategory()->fetchAll();
     $sports = $this->sport->getSports()->fetchAll();
     $niveau = $this->groupe->getNiveau()->fetchAll();
     $vue = new Vue("CreationGroupe", "Groupe", ['font-awesome.css', 'stylesheet.css'], ['showphoto.js', 'RechercheGroupe.js']);
     // CSS a unifier dans le meme fichier
     $vue->loadpage(['sports' => $sports, 'categorie' => $categorie, 'error' => $error, 'succes' => $succes, 'id' => $id, 'niveau' => $niveau]);
 }
Example #18
0
/**
 * Отключаем/включаем верификацию пользователям.
 * 
 * @param int  $uid  ИД пользователя
 * @param bool $type вкючить/выключить
 *
 * @return \xajaxResponse
 */
function setVerification($uid = 0, $type = false)
{
    session_start();
    $objResponse = new xajaxResponse();
    if (hasPermissions('users')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $users = new users();
        $users->is_verify = $type;
        $sError = $users->Update($uid, $res);
        if ($type == false) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
            Verification::decrementStat($uid);
        }
        if (empty($sError)) {
            $text = $type ? 'Снять верификацию' : 'Дать верификацию';
            $html = '<a href="javascript:void(0);" onclick="user_search.setVerification(' . $uid . ', ' . ($type ? 'false' : 'true') . ');" class="lnk-dot-666" title="' . $text . '"><b>' . $text . '</b></a>';
            $objResponse->assign("verify{$uid}", 'innerHTML', $html);
            if ($type) {
                $objResponse->script("\$\$('#user{$uid} a.user-name').grab(new Element('span', {class:'b-icon b-icon__ver b-icon_valign_middle'}), 'before')");
            } else {
                $objResponse->script("\$\$('#user{$uid} .b-icon__ver').dispose();");
            }
            $objResponse->alert($type ? 'Верификация дана' : 'Верификация снята');
        } else {
            $objResponse->alert('Ошибка сохранения данных');
        }
    }
    return $objResponse;
}
 public function isValid($message)
 {
     $verification = new Verification($message, $this->keyStore);
     return $verification->isValid();
 }
Example #20
0
<?php

//Если пришли от WM отключаем проверку CSRF
if (isset($_POST['WmLogin_WMID'])) {
    $allow_fp = true;
    define('NO_CSRF', 1);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
$g_page_id = "0|35";
$stretch_page = true;
$showMainDiv = true;
session_start();
$uid = get_uid();
$rpath = "../../";
$page_title = "Верификация - фриланс, удаленная работа на FL.ru";
$header = "../../header.php";
$footer = "../../footer.html";
$content = "content.php";
$no_banner = true;
$verification = new Verification();
$verifyCount = $verification->verifyCount();
$js_file = array('/css/block/b-shadow/b-shadow.js', 'timer.js', 'verification.js');
include "../../template3.php";
Example #21
0
 /**
  * Оплата услуг.
  * 
  * @param array $order Данные по оплачивоемой услуге
  *
  * @return bool
  */
 public function paymentOrder($order)
 {
     $_op_code = self::getOpCodeByDiscount($order['op_code']);
     switch ($_op_code) {
         // Верификация банковской картой через ЯКассу
         case 191:
             $error = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment']);
             if (!$error) {
                 $success = true;
                 //Устанавливаем флаг верификации
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
                 $verify = new Verification();
                 $verify->cardYK($this->user['uid']);
                 //Обновляем сессию
                 //@todo: эта штука не работает!
                 $session = new session();
                 $session->UpdateVerification($this->user['login']);
                 //Обновляем имя и фамилию
                 $fio = mb_unserialize($order['option']);
                 if (isset($fio['uname']) && isset($fio['usurname'])) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
                     $u = new users();
                     $u->GetUserByUID($this->user['uid']);
                     $u->uname = $fio['uname'];
                     $u->usurname = $fio['usurname'];
                     $u->Update($this->user['uid'], $db_errors);
                 }
                 //Назначаем возврат
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/billing/BillPayback.php';
                 BillPayback::getInstance()->requestPayback($order['id'], $this->paymentSysParams['invoiceId'], $order['ammount']);
             }
             break;
             //------------------------------------------------------------------
             // Верификация через FF
         //------------------------------------------------------------------
         // Верификация через FF
         case 117:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Verification.php';
             $error = $this->account->Buy($account_operation_id, $this->transaction, Verification::FF_OP_CODE, $this->user['uid'], $order['comment'], $order['descr'], 1, 0);
             $verify = new Verification();
             $verify->data = unserialize($order['option']);
             $this->_db->query('UPDATE verify_ff SET is_pro = ?, bill_id = ?  WHERE id = ?', false, $account_operation_id, $order['src_id']);
             if ($verify->verify($this->user['uid'])) {
                 $this->_db->query('UPDATE verify_ff SET result = TRUE WHERE id = ?', $order['src_id']);
                 $success = true;
             }
             break;
             //------------------------------------------------------------------
             // Конкурс
         //------------------------------------------------------------------
         // Конкурс
         case 9:
         case 106:
         case 121:
         case 122:
         case 123:
         case 124:
         case 125:
         case 126:
         case 127:
         case 128:
         case 129:
         case 130:
             // Платный конкурс
         // Платный конкурс
         case 86:
             // Платный проект (вакансия, устаревший опкод)
         // Платный проект (вакансия, устаревший опкод)
         case 53:
             //Покупка вакансии
         //Покупка вакансии
         case 113:
             //пользователь не PRO
         //пользователь не PRO
         case 192:
             //пользователь PRO
             //Платные услуги проектов
         //пользователь PRO
         //Платные услуги проектов
         case 138:
         case 139:
         case 140:
         case 141:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/drafts.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
             // Публикуем платный проект
             if ($order['parent_table'] == 'draft_projects') {
                 $draft_id = $order['parent_id'];
                 $this->project_key = md5(uniqid($this->user['uid']));
                 $tmpPrj = new tmp_project($this->project_key);
                 $tmpPrj->initFromDraft($draft_id, $this->user['uid']);
                 $tproject = $tmpPrj->getProject();
                 $isMovedToVacancy = false;
                 // Нет конкурса значит его уже опубликовали и оплатили, оставляем деньги на личном счете
                 if ((int) $tproject['prj_id'] <= 0) {
                     // Не тратим деньги на такой конкурс
                     if ($tmpPrj->isKonkurs() && strtotime($tproject['end_date']) <= time()) {
                         $success = true;
                         break;
                     }
                     $error = $tmpPrj->saveProject($this->user['uid'], $proj, $this->ordersPromoCodes);
                     $success = !$error;
                     // Отработали все по конкурсу удаляем его чтобы не мешал (после отработки всех операций)
                     $this->setAfterQuery($this->_db->parse('DELETE FROM draft_projects WHERE id = ? AND uid = ?', $draft_id, $this->user['uid']), $order['parent_id']);
                     $sql = 'UPDATE draft_projects SET prj_id = ? WHERE id = ? AND uid = ?';
                     $this->_db->query($sql, $proj['id'], $draft_id, $this->user['uid']);
                 } else {
                     $success = true;
                 }
             } elseif ($order['parent_table'] == 'projects') {
                 $prj_id = $order['parent_id'];
                 $this->project_key = md5(uniqid($this->user['uid']));
                 $tmpPrj = new tmp_project($this->project_key);
                 $tmpPrj->setInitFromDB($prj_id);
                 $tproject = $tmpPrj->getProject();
                 $isMovedToVacancy = $tmpPrj->isStateMovedToVacancy();
                 // Если закрыт или заблокирован не тратим деньги
                 if ($tproject['closed'] == 't' || $tproject['is_blocked'] == 't') {
                     $success = true;
                     break;
                 }
                 switch ($order['option']) {
                     case 'top':
                         $tmpPrj->setAddedTopDays($order['op_count']);
                         break;
                     case 'logo':
                         $LogoFile = new CFile($order['src_id']);
                         $tmpPrj->initLogo($LogoFile, $order['descr']);
                         break;
                     case 'urgent':
                         $tmpPrj->setProjectField('urgent', 't');
                         break;
                     case 'hide':
                         $tmpPrj->setProjectField('hide', 't');
                         break;
                     case 'office':
                         $tmpPrj->setProjectField('old_state', $tproject['state']);
                         $tmpPrj->setProjectField('state', projects::STATE_PUBLIC);
                         //Если оплачивается не перемещенная вакансия
                         //то работаем как обычно и подымаем вверх
                         if ($tproject['state'] != projects::STATE_MOVED_TO_VACANCY) {
                             $tmpPrj->setProjectField('post_now', true);
                         }
                         break;
                 }
                 $error = $tmpPrj->saveProject($this->user['uid'], $proj, $this->ordersPromoCodes);
                 $success = !$error;
                 if ($success) {
                     if (isset($tmpPrj->account_operation_id) && $tmpPrj->account_operation_id > 0) {
                         $account_operation_id = $tmpPrj->account_operation_id;
                     }
                     switch ($order['option']) {
                         case 'office':
                             if ($tproject['state'] == projects::STATE_MOVED_TO_VACANCY) {
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
                                 $smail = new smail();
                                 $smail->sendMovedToVacancySuccessPayed($tproject);
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/guest/models/GuestInviteModel.php';
                                 $guestInviteModel = new GuestInviteModel();
                                 $guestInviteModel->updateDatePublicBySrc($prj_id, array(GuestConst::TYPE_PROJECT, GuestConst::TYPE_VACANCY));
                                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/autoresponse.php';
                                 $autoresponse = new autoresponse();
                                 $autoresponse->reduceByProject($prj_id);
                             }
                             break;
                     }
                 }
             }
             //Сохраняем, чтобы показать попап юзеру
             $memBuff = new memBuff();
             $memBuff->add('bill_ok_project_' . $this->user['uid'], $proj['id']);
             //Если это оплата вакансии или конкусра то предлагаем еще купить платные опции
             if (in_array($order['option'], array('office', 'contest')) && !$isMovedToVacancy) {
                 $memBuff->add('bill_ok_project_payed_' . $this->user['uid'], true);
             }
             break;
             //------------------------------------------------------------------
             // Платное место в карусели
         //------------------------------------------------------------------
         // Платное место в карусели
         case 65:
             // На главной странице
             $catalog = 0;
         case 73:
             // В каталоге
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
             $payPlace = new pay_place(isset($catalog) ? $catalog : 1);
             $buyMain = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['comment'], $order['descr'], $order['op_count'], 0, $order['promo_code']);
             if ($buyMain === 0) {
                 $options = unserialize($order['option']);
                 if (isset($options['adHead'])) {
                     //поддержка старого режима
                     $success = $payPlace->addUser($this->user['uid'], $options['adHead'], $options['adText'], $options['adImg']);
                 } else {
                     $success = $payPlace->addUserRequest($this->user['uid'], $options);
                 }
             }
             break;
             //------------------------------------------------------------------
             // ПРО аккаунт фрилансеры
         //------------------------------------------------------------------
         // ПРО аккаунт фрилансеры
         case 47:
             // Тестовый ПРО на 1 неделю
             if (payed::IsUserWasPro($this->user['uid'])) {
                 return false;
                 break;
             }
         case 15:
             // Про на 1 месяц (emp)
         // Про на 1 месяц (emp)
         case 48:
             // Про на 1 месяц (frl)
         // Про на 1 месяц (frl)
         case 118:
             // Про на 3 месяца (emp)
         // Про на 3 месяца (emp)
         case 49:
             // Про на 3 месяца (frl)
         // Про на 3 месяца (frl)
         case 119:
             // Про на 6 месяцeв (emp)
         // Про на 6 месяцeв (emp)
         case 50:
             // Про на 6 месяцев (frl)
         // Про на 6 месяцев (frl)
         case 120:
             // Про на 1 год (emp)
         // Про на 1 год (emp)
         case 51:
             // Про на 1 год (frl)
         // Про на 1 год (frl)
         case 132:
             // Про на 1 день (frl)
         // Про на 1 день (frl)
         case 131:
             // Про на 1 неделю (frl)
         // Про на 1 неделю (frl)
         case 163:
             // Тестовый ПРО на месяц
         // Тестовый ПРО на месяц
         case 164:
             // PROFI на 1 месяц
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php';
             $payed = new payed();
             $user = is_emp($this->user['role']) ? new employer() : new freelancer();
             $success = $payed->SetOrderedTarif($this->user['uid'], $this->transaction, $order['op_count'], $order['comment'], $order['op_code'], $order['promo_code'], $error);
             if ($success) {
                 if (isset($payed->account_operation_id) && $payed->account_operation_id > 0) {
                     $account_operation_id = $payed->account_operation_id;
                 }
                 // Обновим сессию сразу!
                 if (get_uid(false) == $this->user['uid']) {
                     $_SESSION['pro_last'] = payed::ProLast($this->user['login']);
                     $_SESSION['pro_last'] = $_SESSION['pro_last']['is_freezed'] ? false : $_SESSION['pro_last']['cnt'];
                     if ($_SESSION['pro_last']['is_freezed']) {
                         $_SESSION['payed_to'] = $_SESSION['pro_last']['cnt'];
                     }
                 } else {
                     $membuff = new memBuff();
                     $membuff->set('is_changed_pro_' . $this->user['uid'], true);
                     //Этот подход не работает
                     //$session = new session();
                     //$session->UpdateProEndingDate($this->user['login']);
                 }
                 if ($order['auto'] == 't') {
                     $user->setPROAutoProlong('on', $this->user['uid']);
                 } else {
                     $user->setPROAutoProlong('off', $this->user['uid']);
                 }
                 //Опубликовать перемещенные вакансии при покупке ПРО
                 //@todo: Теперь вакансии для всех платные разница лишь в цене для ПРО дешевле
                 //поэтому отключаем публикацию после покупки ПРО
                 //https://beta.free-lance.ru/mantis/view.php?id=28579
                 /*
                                     if (is_emp($this->user['role'])) { 	 
                                         require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"); 	
                                         $project = new projects();	 
                                         $project->publishedMovedToVacancy($this->user); 	
                                     }*/
                 //Чистим кеш каталога PROFI пользователей
                 if ($order['op_code'] == 164) {
                     freelancer::clearCacheProfiCatalog();
                 }
             }
             break;
             //------------------------------------------------------------------
         //------------------------------------------------------------------
         case 45:
             // рассылка по каталогу
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/masssending.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
             $masssending = masssending::Get($order['parent_id']);
             $masssending = $masssending[0];
             $error = $this->account->Buy($account_operation_id, $this->transaction, masssending::OPER_CODE, $this->user['uid'], $order['descr'], $order['comment'], $masssending['pre_sum'], 0, $order['promo_code']);
             if ($error) {
                 break;
             }
             masssending::UpdateAcOpID($order['parent_id'], $account_operation_id);
             $success = (bool) messages::Masssending($masssending['user_id'], $masssending['id'], $masssending['msgtext'], $masssending['posted_time']);
             break;
             //------------------------------------------------------------------
             /*
              * Погашение задолженности
              */
         //------------------------------------------------------------------
         /*
          * Погашение задолженности
          */
         case 135:
             $error = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], 1, 1, 0, 0, $order['ammount']);
             if (!$error) {
                 $success = true;
                 //Начисление погашенной комиссии и удаление блокировки ТУ
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/TServiceOrderModel.php';
                 TServiceOrderModel::model()->clearDebt($this->user['uid']);
             }
             break;
             //-------------------------------------------------------------------
             /*
              * Операции над бизнес логикой резерва средств 
              * при успешном зачислении денег
              */
         //-------------------------------------------------------------------
         /*
          * Операции над бизнес логикой резерва средств 
          * при успешном зачислении денег
          */
         case 136:
             $success = false;
             $data = @$this->list_service[$order['id']]['info'];
             if (!$data) {
                 break;
             }
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reserves/ReservesModelFactory.php';
             $reserveInstance = ReservesModelFactory::getInstance($data['type']);
             //Уже была зарезервирована или нет нужный параметров то
             //ничего не покупаем деньги остаются на ЛС
             if (!$reserveInstance || !isset($this->paymentSysParams['invoiceId'])) {
                 break;
             }
             //Невозможно сменить статус сделки выходим
             $reserveInstance->setReserveData($data);
             if (!$reserveInstance->allowChangeStatus(ReservesModel::STATUS_RESERVE)) {
                 break;
             }
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], $order['ammount']);
             if ($ret === 0) {
                 //Успешно купили услугу и теперь меняем статус резерва
                 $data['invoice_id'] = $this->paymentSysParams['invoiceId'];
                 $data['acc_op_id'] = $account_operation_id;
                 $reserveInstance->setReserveData($data);
                 $success = $reserveInstance->changeStatus(ReservesModel::STATUS_RESERVE);
             }
             break;
             //------------------------------------------------------------------
             /*
              * Завершение покупки автоответов.
              */
         //------------------------------------------------------------------
         /*
          * Завершение покупки автоответов.
          */
         case 137:
             $success = false;
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $order['descr'], $order['comment'], $order['ammount'], 1, $order['promo_code']);
             if ($ret === 0 && isset($order['parent_id']) && intval($order['parent_id'])) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/autoresponse.php';
                 autoresponse::$db = $GLOBALS['DB'];
                 // Активация покупки услуги автоответа
                 if ($autoresponse = autoresponse::get($order['parent_id'])) {
                     $autoresponse->activate();
                     $success = true;
                 }
             }
             break;
             //------------------------------------------------------------------
             // Закрепление в каталоге фрилансеров
         //------------------------------------------------------------------
         // Закрепление в каталоге фрилансеров
         case 142:
             // В корневом разделе
         // В корневом разделе
         case 143:
             // В разделе
             $is_spec = false;
         case 144:
             // В подразделе
             if (!isset($is_spec)) {
                 $is_spec = true;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $freelancer_binds->prepare($this->user['uid'], $order['src_id'], $is_spec, $order['op_count']);
             $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], $freelancer_binds->bind_info['comment'], $order['ammount'], 1, $order['promo_code']);
             if ($ret === 0) {
                 $success = $freelancer_binds->create();
             }
             break;
             //------------------------------------------------------------------
             // Продление закрепления в каталоге фрилансеров
         //------------------------------------------------------------------
         // Продление закрепления в каталоге фрилансеров
         case 148:
             // В корневом разделе
         // В корневом разделе
         case 149:
             // В разделе
             $is_spec = false;
         case 150:
             // В подразделе
             if (!isset($is_spec)) {
                 $is_spec = true;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $bind_id = $freelancer_binds->isUserBinded($this->user['uid'], $order['src_id'], $is_spec);
             $ret = true;
             if ($bind_id) {
                 $freelancer_binds->getProlongInfo($this->user['uid'], $order['src_id'], $is_spec, $order['op_count']);
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], $freelancer_binds->bind_info['comment'], $order['ammount']);
             }
             if ($ret === 0) {
                 $success = $freelancer_binds->prolong($bind_id, $order['op_count'], $order['src_id'], $is_spec);
             }
             break;
             //------------------------------------------------------------------
             // Поднятие закрепления в каталоге фрилансеров
         //------------------------------------------------------------------
         // Поднятие закрепления в каталоге фрилансеров
         case 151:
             // В корневом разделе
         // В корневом разделе
         case 152:
             // В разделе
             $is_spec = false;
         case 153:
             // В подразделе
         // В подразделе
         case 194:
             //Оплата из буфера
             if (!isset($is_spec)) {
                 $is_spec = $order['src_id'] > 0;
             }
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php';
             $freelancer_binds = new freelancer_binds();
             $bind_id = $freelancer_binds->isUserBinded($this->user['uid'], $order['src_id'], $is_spec);
             if ($bind_id) {
                 $freelancer_binds->getUpInfo($this->user['uid'], $order['src_id'], $is_spec);
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $freelancer_binds->bind_info['descr'], '', $order['ammount']);
                 if ($ret === 0) {
                     $success = $freelancer_binds->up($bind_id, $order['src_id'], $is_spec);
                 }
             }
             break;
             //------------------------------------------------------------------
             // Закрепление/продление в каталоге услуг
         //------------------------------------------------------------------
         // Закрепление/продление в каталоге услуг
         case 155:
             // В лендинге
         // В лендинге
         case 156:
             // В корневом разделе
         // В корневом разделе
         case 157:
             // В разделе
         // В разделе
         case 158:
             // В подразделе
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_binds.php';
             $tservices_binds = new tservices_binds(tservices_binds::KIND_LANDING);
             $tservices_binds->setKindByOpCode($_op_code);
             $option = unserialize($order['option']);
             $tservice_id = isset($option['tservice_id']) ? $option['tservice_id'] : $order['option'];
             $is_prolong = isset($option['is_prolong']) ? $option['is_prolong'] : false;
             $tservices_binds->prepare($this->user['uid'], $tservice_id, $order['src_id'], $order['op_count'], $is_prolong);
             if ($tservices_binds->bind_info) {
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $tservices_binds->bind_info['descr'], $tservices_binds->bind_info['comment'], $order['ammount']);
                 if ($ret === 0) {
                     $success = $is_prolong ? $tservices_binds->update() : $tservices_binds->create();
                 }
             }
             break;
             //------------------------------------------------------------------
             // Поднятие закрепления в каталоге услуг
         //------------------------------------------------------------------
         // Поднятие закрепления в каталоге услуг
         case 159:
             // В лендинге
         // В лендинге
         case 160:
             // В корневом разделе
         // В корневом разделе
         case 161:
             // В разделе
         // В разделе
         case 162:
             // В подразделе
         // В подразделе
         case 193:
             //Оплата из буфера
             $success = false;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_binds.php';
             $tservices_binds = new tservices_binds(tservices_binds::KIND_LANDING);
             $tservices_binds->setKindByOpCode($_op_code);
             $bind = $tservices_binds->getItemById($order['src_id']);
             $tservices_binds->makeUpInfo($bind);
             if ($tservices_binds->bind_info) {
                 $ret = $this->account->Buy($account_operation_id, $this->transaction, $order['op_code'], $this->user['uid'], $tservices_binds->bind_info['descr'], $tservices_binds->bind_info['comment'], $order['ammount']);
                 if ($ret === 0) {
                     $success = $tservices_binds->update();
                 }
             }
             break;
     }
     if ($success) {
         $update = array('status' => self::STATUS_COMPLETE);
         $this->update($order['id'], $update);
         $memBuff = new memBuff();
         $memBuff->delete('last_operation_' . $order['uid'] . '_' . $order['service']);
         //Если только что была оплата из яндекс.кассы
         if ($this->paymentSysParams['invoiceId']) {
             //Фиксируем ID транзакции
             $label = op_codes::getLabel($order['op_code']);
             if (isset($account_operation_id) && $account_operation_id > 0) {
                 $label = (empty($label) ? '' : "{$label},") . "trans_{$account_operation_id}";
             }
             // Посылаем данные о покупке в google analytics
             $this->_db->query("SELECT pgq.insert_event('statistic', 'service_payed', ?)", http_build_query(array('is_emp' => is_emp($this->user['role']), 'label' => $label, 'ammount' => floatval($order['ammount']), 'cid' => $this->getCid())));
         }
     }
     return $success;
 }