当前位置: 首页>>代码示例>>PHP>>正文


PHP account::start_transaction方法代码示例

本文整理汇总了PHP中account::start_transaction方法的典型用法代码示例。如果您正苦于以下问题:PHP account::start_transaction方法的具体用法?PHP account::start_transaction怎么用?PHP account::start_transaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::start_transaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Create

 /**
  * Создание нового предложения
  *
  * @param array $create    Переменная типа array(name=>value) где name - поле таблицы, value - значение для записи (@see Таблица freelance_offers) 
  * @return boolean|string
  */
 public function Create($create)
 {
     global $DB;
     $uid = $create['user_id'];
     if ($_SESSION['uid'] == $uid && !is_emp()) {
         $account = new account();
         $transaction_id = $account->start_transaction($uid, $tr_id);
         $error = $account->Buy($billing_id, $transaction_id, self::FM_OP_CODE, $uid, "Покупка публикации предложения фрилансера", "Покупка публикации предложения", 1, 0);
         if ($error) {
             return $error;
         }
         $account->commit_transaction($transaction_id, $uid, $billing_id);
         $create['bill_id'] = $billing_id;
         $create['moderator_status'] = is_pro() ? NULL : 0;
         $id_offer = $DB->insert('freelance_offers', $create, 'id');
         if ($id_offer > 0) {
             if (!is_pro()) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php';
                 $stop_words = new stop_words();
                 $nStopWordsCnt = $stop_words->calculate($fields['descr'], $fields['title']);
                 $DB->insert('moderation', array('rec_id' => $id_offer, 'rec_type' => user_content::MODER_SDELAU, 'stop_words_cnt' => $nStopWordsCnt));
             }
             return $id_offer;
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:36,代码来源:freelancer_offers.php

示例2: paymentOptions

 /**
  * Обработка оплаты операций
  * 
  * @param type $operations  Операции к оплате
  * @return boolean 
  */
 function paymentOptions($operations)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_freelancer.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_employer.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects_offers_answers.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/drafts.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/log.php";
     $this->log = new log('wizard/payed-' . SERVER . '-%d.log', 'a', '%d.%m.%Y %H:%M:%S : ');
     $payed_operation = $this->getDraftAccountOperationsByIds($operations, $this->uid);
     $account = new account();
     if ($payed_operation) {
         // выбран ли или уже куплен аккаунт ПРО
         $is_pro = is_pro();
         if (!$is_pro) {
             foreach ($payed_operation as $option) {
                 if ($option['op_code'] == 15) {
                     $is_pro = true;
                     break;
                 }
             }
         }
         // перебираем все позиции и переделываем с учетом ПРО
         if ($is_pro) {
             foreach ($payed_operation as &$option) {
                 switch ($option['op_code']) {
                     case new_projects::OPCODE_KON_NOPRO:
                         $option['op_code'] = new_projects::OPCODE_KON;
                         break;
                     case new_projects::OPCODE_PAYED:
                         $option['ammount'] = $option['ammount'] - new_projects::PRICE_ADDED;
                         break;
                     default:
                         break;
                 }
             }
         }
         unset($option);
         $transaction_id = $account->start_transaction($this->uid);
         foreach ($payed_operation as $option) {
             $ok[$option['id']] = $this->billingOperation($option, $transaction_id);
             if ($ok[$option['id']]) {
                 $delete = $this->deleteDraftAccountOperation($option['id']);
                 if (!$delete) {
                     $this->log->writeln("Error delete draft account operation - user (" . wizard::getUserIDReg() . ") - option #{$option['id']}");
                 }
             } else {
                 $this->log->writeln("Error billing operation - user (" . wizard::getUserIDReg() . ") - option #{$option['id']}");
             }
         }
         $account->commit_transaction($transaction_id, $this->uid, null);
         return true;
     }
     return false;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:63,代码来源:wizard_billing.php

示例3: Add

 /**
  * Изменение логина юзера. Перед вызовом необходимо проинициализировать члены класса
  * old_login, new_login, save_old.
  * 
  * @param string $error	возвращает сообщение об ошибке	
  *
  * @return 0
  *
  * @see classes/db_access#Add($error, $return_id)
  */
 public function Add(&$error)
 {
     global $DB;
     require_once ABS_PATH . '/classes/users.php';
     $user = new users();
     $this->user_id = $user->GetUid($error, $this->old_login);
     if (!$this->user_id) {
         $error = 'Пользователь не найден!';
         return 0;
     }
     $new_user = $user->GetUid($error, $this->new_login);
     if ($new_user) {
         $error = 'Логин занят!';
         return 0;
     }
     if ($this->save_old) {
         require_once ABS_PATH . '/classes/users_old.php';
         require_once ABS_PATH . '/classes/account.php';
         $account = new account();
         $tr_id = $account->start_transaction($this->user_id);
         $id = 0;
         $error = $account->Buy($id, $tr_id, self::OP_CODE, $this->user_id, 'Изменеие логина', 'Изменение логина');
         if ($error) {
             return 0;
         }
         $this->operation_id = $id;
         $users_old = new users_old();
         $users_old->Add($this->old_login);
     }
     if (!$error) {
         $aData = array('user_id' => '', 'old_login' => '', 'new_login' => '', 'save_old' => '', 'operation_id' => '');
         foreach ($aData as $key => $val) {
             $aData[$key] = $this->{$key};
         }
         $CFile = new CFile();
         if (!$CFile->MoveDir($this->new_login, $this->old_login)) {
             $error = "Директория не создана! {$this->new_login}, {$this->old_login}";
             if ($this->operation_id) {
                 $account->Del($this->user_id, $this->operation_id);
             }
         } else {
             $DB->insert('login_change', $aData);
             $user->login = $this->new_login;
             $user->Update($this->user_id, $res);
         }
     }
     return 0;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:58,代码来源:login_change.php

示例4: error_reporting

<?php

$login = 'vladsoft';
error_reporting(E_ERROR);
require_once realpath(dirname(__FILE__) . '/../') . '/classes/stdf.php';
require_once realpath(dirname(__FILE__) . '/../') . '/classes/account.php';
require_once realpath(dirname(__FILE__) . '/../') . '/classes/session.php';
require_once realpath(dirname(__FILE__) . '/../') . '/classes/payed.php';
require_once realpath(dirname(__FILE__) . '/../') . '/classes/users.php';
$ses = new session();
$user = $DB->row("\n                SELECT uid, login\n                FROM users\n                WHERE login='{$login}';\n                ");
$payed = new payed();
$sess = new session();
$transaction_id = account::start_transaction($user['uid']);
$payed->AdminAddPRO($user['uid'], $transaction_id, '2 days');
$sess->UpdateProEndingDate($user['login']);
echo date('H:m:s') . " - {$login}\n\n";
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:17,代码来源:updateproendingdate.php

示例5: count

        $filteredTeasers[] = $teaser;
    }
}
// количество тизеров
$teasersCount = count($filteredTeasers);
if (!$teasersCount) {
    return;
}
// случайный тизер
$teaserKey = mt_rand(0, $teasersCount - 1);
$teaser = $filteredTeasers[$teaserKey]['file'];
// для "поднять проект"
if ($teaser === 'tpl.teaser-up.php' || $teaser === 'tpl.teaser-up-conk.php' || $teaser === 'tpl.teaser-up-top.php') {
    $account = new account();
    $account->GetInfo(get_uid());
    $transaction_id = $account->start_transaction(get_uid());
    ?>
    <form action="/users/<?php 
    echo $_SESSION['login'];
    ?>
/setup/" id="upprj" name="frm" method="POST">
        <input type="hidden" name="action" value="prj_up">
        <input type="hidden" name="transaction_id" value="<?php 
    echo $transaction_id;
    ?>
" />
        <input type="hidden" name="prjid" value="<?php 
    echo $prj_id;
    ?>
">
        <input type="hidden" value="<?php 
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:include-teaser.php

示例6: intval

require_once $_SERVER["DOCUMENT_ROOT"] . '/classes/users.php';
DB::setStandby('master', NULL);
$uid = __paramInit("int", "uid", null, 0);
$uid = intval($uid);
$admin = 103;
if ($uid > 0) {
    global $DB;
    //Есть ли такой незабаненый не про, заходивший в проследний раз более года назад?
    $targetUser = users::userWasInOldYear($uid);
    if (is_array($targetUser)) {
        //Даем про на неделю
        $account = new account();
        $payed = new payed();
        $op_code = 115;
        // 52
        $tr_id = $account->start_transaction($admin);
        $interval = "7 days";
        if ($targetUser["role"][0] == 1) {
            $interval = "1 month";
        }
        $success = $payed->GiftOrderedTarif($bill_id, $gift_id, $uid, $admin, $tr_id, $interval, "Аккаунт PRO в подарок", $op_code);
        if (!$success) {
            $rpath = "./";
            if (!$fpath) {
                $fpath = "";
            }
            $header = ABS_PATH . "/header.new.php";
            $footer = ABS_PATH . "/footer.new.html";
            $content = ABS_PATH . "/gift_pro_week_error.php";
            $page_title = "Ошибка при активации подарка";
            include "template3.php";
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:gift_pro.php

示例7: _admEditPrjOfferSaveForm

/**
 * Сохранение предложения по проектам
 * 
 * @param object $objResponse xajaxResponse
 * @param string $rec_id идентификатор записи
 * @param string $rec_type тип записи
 * @param array $aForm массив данных
 * @param string $sDrawFunc имя функции для выполнения после сохранения
 */
function _admEditPrjOfferSaveForm(&$objResponse, $rec_id = '', $rec_type = '', $aForm = array(), $sDrawFunc = '')
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_offers.php';
    $obj_offer = new projects_offers();
    $payed_items = $aForm['ps_payed_items'];
    $payed_color = $aForm['ps_payed_items'][0] == '1';
    if ($aForm['is_color'] && !$payed_color) {
        $account = new account();
        $transaction_id = $account->start_transaction(get_uid());
        $error_buy = $account->Buy($billing_id, $transaction_id, $answers->color_op_code, get_uid(), "Выделение ответа на проект цветом", "Выделение <a href='" . getFriendlyURL("project", $project['id']) . "#freelancer_{$_SESSION['uid']}' target='_blank'>предложения</a> цветом", 1, 1);
        $payed_items = '1';
        if ($error_buy) {
            $aForm['is_color'] = false;
            $payed_items = '0';
        }
    }
    $sReason = _parseReason($aForm['user_id'], $aForm['adm_edit_text']);
    $error = $obj_offer->AddOffer($aForm['user_id'], $aForm['pid'], $aForm['ps_cost_from'], $aForm['ps_cost_to'], $aForm['ps_cost_type'], $aForm['ps_time_from'], $aForm['ps_time_to'], $aForm['ps_time_type'], antispam(stripslashes($aForm['ps_text'])), $aForm['ps_work_1_id'], $aForm['ps_work_2_id'], $aForm['ps_work_3_id'], $aForm['ps_work_1_link'], $aForm['ps_work_2_link'], $aForm['ps_work_3_link'], $aForm['ps_work_1_name'], $aForm['ps_work_2_name'], $aForm['ps_work_3_name'], $aForm['ps_work_1_pict'], $aForm['ps_work_2_pict'], $aForm['ps_work_3_pict'], $aForm['ps_work_1_prev_pict'], $aForm['ps_work_2_prev_pict'], $aForm['ps_work_3_prev_pict'], isset($aForm['ps_for_customer_only']), $aForm['edit'], 0, isset($aForm['prefer_sbr']), $aForm['is_color'], null, $payed_items, 0, $_SESSION['uid'], $sReason);
    if (!$error && !$error_buy && !$payed_color && $account) {
        $account->commit_transaction($transaction_id, get_uid(), $billing_id);
        $is_payed_color = true;
    }
    if ($error) {
        $objResponse->alert('Ошибка сохранения предложения' . $error);
        $sParent = $sDrawFunc == 'stream0' || $sDrawFunc == 'stream1' || $sDrawFunc == 'stream2' ? 'parent.' : '';
        $objResponse->script("{$sParent}adm_edit_content.disabled = false; {$sParent}adm_edit_content.button();");
    } else {
        messages::prjOfferModifiedNotification($aForm['user_id'], $aForm['pid'], $sReason);
        $content_id = user_content::MODER_PRJ_OFFERS;
        _admEditAfterAll($objResponse, $content_id, $rec_id, $rec_type, $sDrawFunc, $aForm);
    }
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:43,代码来源:adm_edit_content.server.php

示例8: saveProject

 /**
  * Сохраняет временный проект в базу.
  *
  * @param integer $buyer_id     ид. юзера-покупателя проекта. Если указан, то проект будет куплен за его счет (например, для админов).
  * @param mixed &$proj     сюда сохранится информация о проекте после его сохранения
  * @return integer|string   0 в случае успешной покупки или текст ошибки.
  */
 function saveProject($buyer_id = NULL, &$proj, $promo_codes = array())
 {
     $price = 0;
     // Если проект новый добаляется, то надо отослать уведомление
     if (!$this->isEdit()) {
         $need_send_email = true;
     } else {
         $need_send_email = false;
     }
     $operations = array();
     if ($ammount = $this->getAmmount()) {
         $buyer_id = $buyer_id ? $buyer_id : $this->_uid;
         $account = new account();
         if (!$account->GetInfo($buyer_id, true)) {
             return 'Ошибка в получении информации по счету.';
         }
         $is_pro = is_pro(true, $this->_project["user_id"]);
         $price = $this->getPrice($items);
         if ($this->isKonkurs()) {
             if ($items['contest']) {
                 $operations['contest'] = array('op_code' => $is_pro ? self::OPCODE_KON : self::OPCODE_KON_NOPRO, 'op_code_bns' => $is_pro ? self::OPCODE_KON_BNS : self::OPCODE_KON_BNS_NOPRO, 'ammount' => 1, 'comment' => $this->getOperationComment('contest'));
             }
         }
         if ($this->isVacancy()) {
             if ($items['office']) {
                 $operations['office'] = array('op_code' => $this->getVacancyOpCode(), 'op_code_bns' => self::OPCODE_PAYED_BNS, 'ammount' => 1, 'comment' => $this->getOperationComment('office'));
             }
         }
         $services = array('top', 'logo', 'urgent', 'hide');
         foreach ($services as $service) {
             if ($items[$service]) {
                 $operations[$service] = array('op_code' => self::getOpCodeByService($service), 'ammount' => $items[$service], 'comment' => $this->getOperationComment($service));
             }
         }
         foreach ($operations as $service => $operation) {
             $bill_id = 0;
             $this->_transactionId = $account->start_transaction($buyer_id, $this->_transactionId);
             if (!isset($operation['op_code_bns'])) {
                 $operation['op_code_bns'] = $operation['op_code'];
             }
             $descr = trim($operation['comment'], '&');
             if ($this->_project['billing_id']) {
                 $descr .= ' - дополнение к операции #' . $this->_project['billing_id'];
             }
             if ($account->bonus_sum >= $price) {
                 $error = $account->BuyFromBonus($bill_id, $this->_transactionId, $operation['op_code_bns'], $buyer_id, "{$descr} за счет подарка", "{$operation['comment']} за счет подарка", $operation['ammount'], true);
                 if ($error) {
                     return $error;
                 }
             } else {
                 $error = $account->Buy($bill_id, $this->_transactionId, $operation['op_code'], $buyer_id, $descr, $operation['comment'], $operation['ammount'], 0, isset($promo_codes[$service]) ? $promo_codes[$service] : 0);
                 if ($error) {
                     return $error;
                 }
             }
             if (!$bill_id) {
                 return 'Не хватает денег. ' . $account->sum . ' из ' . $price;
             }
             $this->account_operation_id = $bill_id;
             $operations[$service]['bill_id'] = $bill_id;
         }
     }
     $prePrj = $this->_preDb($price, $bill_id);
     $success = $this->isEdit() ? $this->editPrj($this->_project, $this->_attach, array_reverse($this->getCategories())) : $this->addPrj($this->_project, $this->_attach, array_reverse($this->_categories));
     if (!$this->isEdit()) {
         foreach ($operations as $service => $operation) {
             $account->updateComment($this->getOperationComment($service), $operation['bill_id'], array($operation['op_code'], $operation['op_code_bns']));
         }
     }
     $proj = $this->_project;
     if (!$success) {
         $this->_postDbFailed($prePrj, $bill_id, $buyer_id);
         return $error ? $error : 'Error';
     }
     $this->SavePayedInfo($items, $this->_project['id'], $bill_id, $topDays ? $topDays : 1);
     $this->_postDbSuccess();
     if (!$_SESSION['quickprjbuy_ok_id']) {
         $_SESSION['quickprjbuy_ok_id'] = $this->_project['id'];
     }
     return 0;
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:88,代码来源:projects.php

示例9: freelancer

        $opcodes = $op_codes->getCodes('80,16,65');
        $user = new freelancer();
        $user->GetUser($_SESSION['login']);
        $account = new account();
        $ok = $account->GetInfo($uid, true);
        $u_is_pro_auto_prolong = $user->GetField($uid, $e, 'is_pro_auto_prolong', false);
        // Включено ли у юзера автоматическое продление PRO
        $is_user_was_pro = $bill->IsUserWasPro(array(billing::STATUS_RESERVE, billing::STATUS_NEW));
        //payed::IsUserWasPro($uid);
        $dateFrozenMaxLimit = 'date_max_limit_' . date('Y_m_d', strtotime($_SESSION['pro_last'] ? $_SESSION['pro_last'] : ($is_user_was_pro ? '+30 day' : '+ 7 day')));
        $dateFrozenMinLimit = 'date_min_limit_' . date('Y_m_d', strtotime('+ 1 day'));
        $pro_last = false;
        if ($_SESSION['freeze_from'] && $_SESSION['is_freezed']) {
            $pro_last = $_SESSION['payed_to'];
        } elseif ($_SESSION['pro_last']) {
            $pro_last = $_SESSION['pro_last'];
        }
        $mod = hasPermissions('users') ? 0 : 1;
        $tr_id = intval($_REQUEST['transaction_id']);
        $transaction_id = $account->start_transaction($uid, $tr_id);
        include_once 'freeze.php';
        //Инициализация попапа оплаты
        require_once ABS_PATH . '/classes/quick_payment/quickPaymentPopupPro.php';
        quickPaymentPopupPro::getInstance()->init();
    }
    $content = 'content.new.php';
}
$page_title = 'Профессиональный аккаунт - фриланс, удаленная работа на FL.ru';
$css_file = array('/css/block/b-promo/__buy/b-promo__buy.css');
$template = 'template3.php';
include '../' . $template;
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例10: toAutoPayed

 /**
  * DEPRECATED
  * Автопродление платных мест
  *
  * @return 
  */
 function toAutoPayed()
 {
     global $DB;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/messages.php";
     $smail = new smail();
     $sql = "SELECT ap.*, a.sum, p.name as prof_name, u.uname, u.login, u.email, u.usurname, u.subscr\n            FROM users_first_page  fp\n            INNER JOIN users_first_page_autopay ap ON ap.user_id = fp.user_id AND ap.profession = fp.profession\n            INNER JOIN professions p ON p.id = ap.profession\n            INNER JOIN (\n                SELECT user_id, profession, MAX(from_date + to_date) as maxdate FROM users_first_page\n                WHERE payed = TRUE AND ordered = true\n                GROUP BY user_id, profession\n            ) mx ON mx.user_id = fp.user_id AND mx.profession = ap.profession\n            INNER JOIN users u ON u.uid = fp.user_id AND u.is_banned = '0'\n            INNER JOIN account a ON a.uid = fp.user_id\n            WHERE fp.payed = TRUE AND fp.ordered = true\n            AND mx.maxdate <= (fp.from_date+fp.to_date)  \n                AND ((fp.from_date+fp.to_date) >= NOW() AND (fp.from_date+fp.to_date) < NOW() + interval '2 hours')\n        ";
     $ret = $DB->rows($sql);
     if (!$ret) {
         return false;
     }
     $price = self::getPrice();
     $result = array();
     foreach ($ret as $k => $user) {
         if ($val['sum_cost'] > $val['sum']) {
             continue;
         }
         $cost = $price[$user['profession']] ? $price[$user['profession']] : $price['n'];
         $p[$user['user_id']]['prof'][] = array('id' => $user['profession'], "cost" => $cost, 'name' => $user['prof_name']);
         $p[$user['user_id']]['sum_cost'] += $cost;
         $p[$user['user_id']]['sum'] = $user['sum'];
         $p[$user['user_id']]['user'] = $user;
     }
     foreach ($p as $uid => $val) {
         if ($val['sum_cost'] <= $val['sum']) {
             $result[$uid] = $val;
         }
     }
     foreach ($result as $uid => $val) {
         foreach ($val['prof'] as $prof) {
             $prof_id = $prof['id'];
             if (intval($prof_id) || intval($prof_id) === 0) {
                 $fp_request[$uid][intval($prof_id)] = 1;
             }
         }
     }
     if ($fp_request) {
         $account = new account();
         foreach ($fp_request as $user_id => $profs) {
             $tr_id = $account->start_transaction($user_id, $tr_id);
             $order_id = self::SetOrdered($user_id, $tr_id, $profs);
         }
     }
     if ($order_id) {
         // $smail->SuccessAutopayed($result);
         // messages::SuccessAutopayed($result);
     }
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:55,代码来源:firstpage.php

示例11: getRemoteIP

     // ѕишем в лог смены паролей
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/restorepass_log.php";
     restorepass_log::SaveToLog($uid, getRemoteIP(), 4, get_uid(false));
     header("Location: /siteadmin/rating/?result=success");
     break;
 case "addserv":
     $login = __paramInit('string', NULL, 'login');
     $days = __paramInit('string', NULL, 'days');
     $type = __paramInit('int', NULL, 'type');
     $where = __paramInit('int', NULL, 'where');
     $fid = users::GetUid($err, $login);
     if ($fid && $login) {
         if (preg_match('#^[1-9]+[\\d]*$#', $days)) {
             require_once ABS_PATH . '/classes/account.php';
             $nDays = intval($days);
             $trsn_id = account::start_transaction($fid);
             switch ($type) {
                 case 1:
                     require_once ABS_PATH . '/classes/payed.php';
                     $pro = new payed();
                     $pro->AdminAddPRO($fid, $trsn_id, $nDays . ' days');
                     break;
             }
             header('Location: /siteadmin/rating/?result=success');
         } else {
             $sError = 'ќшибка,  ол-во дней должно быть целым числом.';
         }
     } else {
         $sError = 'ќшибка, пользователь не найден.';
     }
     break;
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例12: prolongSpecs

 /**
  * Продляет специализации по ID пользователя
  *
  * @param integer $uid ID пользователя
  * @param boolean $is_autopaid Учитывать только отмеченные для автопродления
  * @param string $period Период продления
  * @param boolean $prolong_only
  * @return string Сообщение об ошибке если есть
  */
 function prolongSpecs($uid, $is_autopaid = false, $period = '1 mon', $prolong_only = false)
 {
     global $DB;
     return;
     // #0022795
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     $account = new account();
     $specs = self::getPaidSpecs($uid, true, $is_autopaid, $prolong_only);
     if (!$specs) {
         return 'Нет специализаций';
     }
     $transaction_id = $account->start_transaction($uid);
     $billing_id = NULL;
     $sum = 0;
     foreach ($specs as $i => $spec) {
         $DB->start();
         $sql = "UPDATE spec_paid_choise SET paid_to = paid_to + '{$period}'::interval\n                    WHERE id = {$spec['id']} AND user_id = {$uid} RETURNING paid_to, (paid_to - '{$period}'::interval) as paid_from";
         if ($res = $DB->query($sql)) {
             $paid_to = pg_fetch_result($res, 0, 0);
             $paid_from = pg_fetch_result($res, 0, 1);
             $descr = 'Продление "' . $spec['name'] . '" до ' . date('d.m.Y', strtotime($paid_to));
             if ($error = $account->Buy($bill_id, $transaction_id, self::OP_PAID_SPEC, $uid, $descr, $descr, 1, 0)) {
                 $DB->rollback();
                 break;
             }
             if ($DB->commit()) {
                 $billing_id = $bill_id;
                 $sum++;
                 $sql = "INSERT INTO spec_paid_acc_operations (billing_id, paid_from, paid_to)\n                            VALUES ({$bill_id}, '{$paid_from}'::timestamp, '{$paid_to}'::timestamp)";
                 $rs = $DB->query($sql);
             }
         }
     }
     if ($billing_id) {
         $account->commit_transaction($transaction_id, $uid, $billing_id);
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php";
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/op_codes.php";
         $mail = new smail();
         $ops = new op_codes();
         $price = $ops->getCodes(self::OP_PAID_SPEC);
         if ($price) {
             $price = $price[self::OP_PAID_SPEC];
             $mail->PaidSpecsAutopayed($uid, $sum * $price['sum']);
         }
     }
     return $error;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:56,代码来源:professions.php

示例13: paidOperation

 public function paidOperation($id)
 {
     global $DB;
     if (!$id) {
         return false;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     $operation = $DB->row('SELECT * FROM draft_account_operations WHERE id = ? AND status IS NULL', $id);
     $account = new account();
     $this->_transactionId = $account->start_transaction($_SESSION['uid'], $this->_transactionId);
     switch ($operation['op_type']) {
         case 'project':
             $project = $DB->row('SELECT id, payed_info FROM projects WHERE id = ?i', $operation['parent']);
             if (!$project['id']) {
                 return 'Ошибка обработки операции.';
             }
             if ($account->sum >= $operation['ammount']) {
                 if ($error = $account->Buy($bill_id, $this->_transactionId, $operation['op_code'], $_SESSION['uid'], trim($operations['descr'], '/'), trim($operations['comments'], '/'), 1, true)) {
                     return $error;
                 }
             }
             if (!$bill_id) {
                 return 'Не хватает денег.';
             }
             $update = array();
             switch ($operation['option']) {
                 case 'color':
                     $update['is_color'] = true;
                     $update['payed_items'] = $project['payed_info'] | '010';
                     break;
                 case 'bold':
                     $update['is_bold'] = true;
                     $update['payed_items'] = $project['payed_info'] | '001';
                     break;
                 case 'top':
                     $update['top_from'] = date('d.m.Y H:i', strtotime('now'));
                     $update['top_to'] = date('d.m.Y H:i', strtotime("now +{$operation['op_count']} day"));
                     break;
                 case 'logo':
                     $update['logo_id'] = $operation['src_id'];
                     $update['payed_items'] = $project['payed_info'] | '100';
                     break;
             }
             $update['billing_id'] = $bill_id;
             $DB->update('projects', $update, 'id = ?', $operation['parent']);
             header('Location: /bill/success/');
             exit;
             break;
         case 'contest':
             // Публикация конкурса
             if ($account->sum >= $operation['ammount']) {
                 if ($error = $account->Buy($bill_id, $this->_transactionId, $operation['op_code'], $_SESSION['uid'], trim($operations['descr'], '/'), trim($operations['comments'], '/'), 1, true)) {
                     return $error;
                 }
             }
             if (!$bill_id) {
                 return 'Не хватает денег.';
             }
             $key = md5(microtime());
             $prj = new tmp_project($key);
             if (get_uid()) {
                 $prj->init(1);
             }
             $draft = new drafts();
             $project = $drafts->getDraft($operation['parent'], $_SESSION['uid'], 1);
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
             $attachedfiles = new attachedfiles();
             $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($operation['parent'], 4);
             if ($attachedfiles_tmpdraft_files) {
                 $attachedfiles_prj_files = array();
                 foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
                     $attachedfiles_draft_files[] = $attachedfiles_draft_file;
                 }
                 $attachedfiles->setFiles($attachedfiles_draft_files, 1);
             }
             $insert = array('user_id' => $_SESSION['uid'], 'name' => $project['name'], 'descr' => $project['descr'], 'kind' => $project['kind'], 'cost' => $project['cost'], 'currency' => $project['currency'], 'country' => $project['country'] > 0 ? $project['country'] : 'NULL', 'city' => $project['city'] > 0 ? $project['city'] : 'NULL', 'payed' => '0', 'pro_only' => $project['pro_only'], 'logo_id' => 'NULL', 'link' => $project['logo_link'], 'is_color' => 'f', 'is_bold' => 'f', 'billing_id' => 0, 'payed_items' => '000', 'folder_id' => 0, 'budget_type' => $project['budget_type'], 'priceby' => $project['priceby'], 'prefer_sbr' => $project['prefer_sbr'], 'end_date' => $project['p_end_date'], 'win_date' => $project['p_win_date']);
             if (!empty($project['categories'])) {
                 $cat = explode('|', $project['categories']);
                 $categories[0] = array('category_id' => intval($cat[0]), 'subcategory_id' => intval($cat[1]));
             }
             $create = $prj->addPrj($insert, $attachedfiles_draft_files, $categories);
             // Добавляем проект
             if ($create) {
                 $drafts->DeleteDraft($draft_id, $uid, 1);
                 header('Location: /bill/success/');
                 exit;
             }
             break;
         case 'account':
             // Покупка ПРО
             break;
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:93,代码来源:pending_operations.php

示例14: ReturnAnswers

 /**
  * Возврат ответов в случае блокировки проекта.
  *
  * @param int $project_id - ID проекта
  *
  * @return mixed - сообщение об ошибке или 0 в случае успеха
  */
 public function ReturnAnswers($project_id)
 {
     global $DB;
     $descr = 'Возврат ответа на проект в связи с блокировкой проекта';
     $op_code = $this->return_op_code;
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_offers.php';
     $of = new projects_offers();
     $offers = $of->GetPrjOffers($count, $project_id, 'ALL', 0, 0, true);
     if (!$count) {
         return;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php';
     $account = new account();
     foreach ($offers as $offer) {
         $uid = $offer['user_id'];
         if ($offer['type'] == 0) {
             continue;
         }
         $transaction_id = $account->start_transaction($uid);
         $error = $account->Buy($billing_id, $transaction_id, $op_code, $uid, $descr, $descr, 0, 0);
         if ($error) {
             return $error;
         }
         if ($offer['type'] == 2) {
             $DB->query('UPDATE projects_offers_answers SET pay_offers = pay_offers + 1 WHERE uid = ?', $uid);
         } else {
             $free_cnt = self::FREE_ANSWERS_CNT;
             $DB->query("UPDATE projects_offers_answers \n                    SET free_offers = free_offers + (CASE WHEN free_offers < {$free_cnt} THEN 1 ELSE 0 END) WHERE uid = ?", $uid);
         }
         $account->commit_transaction($transaction_id, $uid, $billing_id);
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:39,代码来源:projects_offers_answers.php

示例15: array

 $payed_list = payed::getPayedPROList(is_emp() ? 'emp' : 'frl');
 $is_not_enough = array('' => 'default');
 foreach ($payed_list as $value) {
     if ($value['is_test'] && payed::IsUserWasPro($uid)) {
         continue;
     }
     $dcost = $value['cost'] - $account->sum;
     if ($dcost <= 0) {
         continue;
     }
     $is_not_enough[$value['opcode']] = $dcost;
 }
 payed::UpdateProUsers();
 $result['success'] = true;
 $result['opcode'] = $oppro;
 $result['transaction'] = $account->start_transaction($uid, $tr_id);
 $result['acc_sum'] = $account->sum;
 $result['pro_last'] = date('d.m.Y', strtotime($is_freezed ? $_SESSION['payed_to'] : $_SESSION['pro_last']));
 $result['date_max_limit'] = 'date_max_limit_' . date('Y_m_d', strtotime($is_freezed ? $_SESSION['payed_to'] : $_SESSION['pro_last']));
 $result['is_not_enough'] = $is_not_enough;
 echo json_encode($result);
 exit;
 // PRO для работтодателя
 //    if (is_emp()) {
 //        $result['oppro'] = ;
 //        exit;
 //    // тестовый PRO
 //    } elseif ($oppro == 47 || $oppro == 114) {
 //        header("Location: /payed/pro_test_payed.php");
 //        exit;
 //    // PRO для фрилансера
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:ajax_buy.php


注:本文中的account::start_transaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。