/** * Уведомление фрилансеру за 1 день до окончания * размещения в freelancer_binds. */ public function remindFreelancerbindsUp() { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_binds.php'; $binds = freelancer_binds::getDowned(); if (!$binds) { return false; } foreach ($binds as $val) { if ($val['bill_subscribe'] == 'f') { continue; } $catalog_name = ''; $catalog_url = "{$GLOBALS['host']}/freelancers/"; if ($val['prof_id'] == 0) { $catalog_name = 'общем разделе'; } elseif ($val['is_spec'] == 'f') { $group = professions::GetGroup($val['prof_id'], $error); $catalog_url .= $group['link']; $catalog_name = "разделе <a href='{$catalog_url}'>{$group['name']}</a>"; } else { $prof_name = professions::GetProfName($val['prof_id']); $catalog_url .= professions::GetProfLink($val['prof_id']); $catalog_name = "подразделе <a href='{$catalog_url}'>{$prof_name}</a>"; } $this->recipient = "{$val['uname']} {$val['usurname']} [{$val['login']}] <{$val['email']}>"; $this->message = Template::render($_SERVER['DOCUMENT_ROOT'] . '/templates/mail/freelancer_binds/remind_up.tpl.php', array('smail' => &$this, 'catalog_url' => $catalog_url, 'catalog_name' => $catalog_name)); $ok = $this->send('text/html'); if ($ok) { freelancer_binds::markSent('up', $val['uid'], $val['prof_id'], $val['is_spec']); } } return 0; }
} else { if (isset($_POST['prof'])) { if (preg_match("/^[0-9]+\$/", $_GET['prof'])) { $prof_id = intvalPgSql(trim($_POST['prof'])); } else { $prof_link = $_POST['prof']; $prof_id = professions::GetProfId($_POST['prof']); } } } //------------------------------------------------------------------------------ if (isset($_GET['profession_db_id']) && !($prof_id > 0 && $prof_id == $_GET['profession_db_id'] || $prof_group_id > 0 && $prof_group_id == $_GET['profession_db_id'])) { $link = null; if ($_GET['profession_db_id'] > 0) { if ($_GET['profession_column_id'] > 0) { $link = professions::GetProfLink($_GET['profession_db_id']); } else { $link = professions::GetGroupLink($_GET['profession_db_id']); } } unset($_GET['profession_db_id'], $_GET['profession_columns'], $_GET['profession_column_id'], $_GET['profession'], $_GET['prof']); $query_string = stripslashes(http_build_query($_GET)); header("HTTP/1.1 301 Moved Permanently"); header("Location: /freelancers/" . ($link ? "{$link}/" : "") . "?{$query_string}"); exit(0); } //------------------------------------------------------------------------------ $page = intval(trim($_GET['page'])); if (!$page) { $page = 1; } elseif ($page == 1) {
/** * Оплата через Плати потом * * @param type $type - тип оплаты * @param type $data - данные по параметрам покупаемой услуги * @return \xajaxResponse */ function quickPaymentFrlbindPlatipotom($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $prof_id = (int) @$data['prof_id']; $is_spec = (bool) @$data['is_spec']; $is_prolong = (bool) @$data['is_prolong']; $promo_code = (string) @$data['promo']; $freelancer_binds = new freelancer_binds(); $valid = $is_prolong ? $freelancer_binds->isUserBinded($uid, $prof_id, $is_spec) : $freelancer_binds->isAllowBind($uid, $prof_id, $is_spec); if ($valid) { $is_error = false; $bill = new billing($uid); //Допустимо использование промокодов $bill->setPromoCodes('SERVICE_FRLBIND', $promo_code); $op_code = $freelancer_binds->getOpCode($prof_id, $is_spec, $is_prolong); $option = array('weeks' => (int) @$data['weeks'], 'prof_id' => $prof_id); //Формируем заказ $billReserveId = $bill->addServiceAndCheckout($op_code, $option); $payed_sum = $bill->getRealPayedSum(); $platipotom = new platipotom(); $html_form = $platipotom->render($payed_sum, $bill->account->id, $billReserveId); if ($html_form) { $objResponse->script("\n var qp_form_wrapper = \$\$('#quick_payment_frlbind .__quick_payment_form');\n if(qp_form_wrapper){ \n qp_form_wrapper.set('html','{$html_form}');\n qp_form_wrapper.getElement('form')[0].submit();\n }\n "); $link = '/freelancers/'; if ($prof_id) { if ($is_spec) { $link .= professions::GetProfLink($prof_id) . '/'; } else { $group = professions::GetGroup($prof_id, $error); $link .= $group['link'] . '/'; } } //сохранаем в сессию куда перейти при успешной покупке $_SESSION[quickPaymentPopup::QPP_REDIRECT] = $link; } } // Показываем предупреждение в случае ошибки if ($is_error) { $action = $is_prolong ? 'продлении закрепления' : 'закреплении'; $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPayment('frlbind');\n if(qp) qp.show_error('Возникла ошибка при {$action} в каталоге!');\n "); } return $objResponse; }