/** */ public function setHtml() { global $session; $html = array(); if ($result = $this->getRecords()) { foreach ($result as $key => $value) { list($text, $login, $uname, $usurname) = $this->mark(array((string) $value['n_text'], (string) $value['login'], (string) $value['uname'], (string) $value['usurname'])); $html[$key] = '<table cellpadding="0" cellspacing="0" style="width: 100%;">'; $html[$key] .= '<tr>'; $html[$key] .= '<td style="vertical-align: top; padding-right: 8px; width: 50px;">'; $html[$key] .= '<div class="upic">' . view_avatar($value['login'], $value['photosm']) . '</div>'; $html[$key] .= '</td>'; $html[$key] .= '<td style="vertical-align: top">'; $html[$key] .= view_mark_user($value); $html[$key] .= $session->view_online_status($value['login']); //if ($value['is_pro'] == 't') $html[$key] .= (is_emp($value['role']) ? view_pro_emp() : view_pro2($value['is_pro_test']=='t')); $cls = is_emp($value['role']) ? 'class="empname11"' : 'class="frlname11"'; $html[$key] .= ' <font ' . $cls . '><a href="/users/' . $value['login'] . '" title="' . $value['uname'] . " " . $value['usurname'] . '" ' . $cls . ' >' . $uname . " " . $usurname . '</a> [<a href="/users/' . $value['login'] . '/" title="' . $value['login'] . '" ' . $cls . '>' . $login . '</a>]</font>'; $html[$key] .= '</td>'; $html[$key] .= '<td style="width: 180px;height: 64px;" class="note_' . (is_emp($value['role']) ? 'emp' : 'frl') . '">'; $html[$key] .= $text; $html[$key] .= '</td>'; $html[$key] .= '</tr>'; $html[$key] .= '</table>'; } } $this->html = $html; }
/** * Создание нового предложения * * @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; } }
public function init() { $is_emp = is_emp(); $form = new ProForm($is_emp); $css_class = $is_emp ? 'g-color_64bc39' : 'g-color_ff7f1a'; $options = array('payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'is_emp' => $is_emp); $list = $form->getPayedList(); if ($list) { $clientside_templates = array(); foreach ($list as $item) { $key = "{$this->ID}Type{$item['opcode']}"; $value = sprintf(self::TXT_DTITLE, proItemToText($item)); if (isset($item['sale'])) { $value .= sprintf(self::TXT_DTITLE_SUFFIX, $css_class, $item['sale']); } else { $value .= ','; } $clientside_templates[$key] = $value; } $options['clientside_templates'] = $clientside_templates; } if ($is_emp) { $options['popup_title'] = sprintf(self::TXT_EMP_TITLE, view_pro_emp('b-icon__pro_va_baseline')); $options['popup_subtitle'] = self::TXT_EMP_SUBTITLE; } else { $options['popup_title'] = sprintf(self::TXT_FRL_TITLE, view_pro('b-icon__pro_va_baseline')); $options['popup_subtitle'] = self::TXT_FRL_SUBTITLE; } $this->addWaitMessageForAll(); $this->setContent($form->render()); parent::init($options); $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'аккаунт PRO'); }
/** * События в заказе ТУ * * @return array */ public static function getTServicesOrdersTip() { $uid = get_uid(FALSE); $is_emp = is_emp(); $tips = array("Новое сообщение в заказе", "В заказах %d %s", "Новое событие в заказе", "В заказах %d %s и %d %s"); $msg_ending = array("новое сообщение", "новых сообщения", "новых сообщений"); $event_ending = array("новое событие", "новых события", "новых событий"); $tip = 'Мои заказы'; $link = ''; //@todo: здесь используются каунты без кеша //по мере заполнения БД они будут тормозить. Нужно переделать! $tserviceMsgModel = TServiceMsgModel::model(); $newTserviceMsgCount = $tserviceMsgModel->countNew($uid); $tserviceOrderModel = TServiceOrderModel::model(); $newTserviceOrderEventCount = $tserviceOrderModel->getCountEvents($uid, $is_emp); $total = $newTserviceMsgCount + $newTserviceOrderEventCount; $code = $newTserviceMsgCount > 0 ? 1 : 0; $code .= $newTserviceOrderEventCount > 0 ? 1 : 0; switch ($code) { case '10': $tip = $newTserviceMsgCount == 1 ? sprintf($tips[0]) : sprintf($tips[1], $newTserviceMsgCount, ending($newTserviceMsgCount, $msg_ending[0], $msg_ending[1], $msg_ending[2])); break; case '01': $tip = $newTserviceOrderEventCount == 1 ? sprintf($tips[2]) : sprintf($tips[1], $newTserviceOrderEventCount, ending($newTserviceOrderEventCount, $event_ending[0], $event_ending[1], $event_ending[2])); $link = $tserviceOrderModel->getLastEventOrderURL($uid, $is_emp); break; case '11': $tip = sprintf($tips[3], $newTserviceMsgCount, ending($newTserviceMsgCount, $msg_ending[0], $msg_ending[1], $msg_ending[2]), $newTserviceOrderEventCount, ending($newTserviceOrderEventCount, $event_ending[0], $event_ending[1], $event_ending[2])); break; } return array('count' => $total, 'tip' => $tip, 'link' => !empty($link) ? $link : ($is_emp ? "/users/" . $_SESSION['login'] : '') . "/tu-orders/"); }
public function setHtml() { global $session; $html = array(); if ($result = $this->getRecords()) { foreach ($result as $key => $value) { $pfx = $value['from_id'] == $this->_engine->uid ? 't_' : 'f_'; list($msg_text, $login, $uname, $usurname) = $this->mark(array((string) $value['msg_text'], (string) $value[$pfx . 'login'], (string) $value[$pfx . 'uname'], (string) $value[$pfx . 'usurname'])); $msg_text = preg_replace('~(https?:/){[^}]+}/~', '$1/', $msg_text); $html[$key] = '<table cellpadding="0" cellspacing="0">'; $html[$key] .= '<tr>'; $html[$key] .= '<td style="vertical-align: top; padding-right: 8px;">'; $html[$key] .= '<div class="upic">' . view_avatar($value[$pfx . 'login'], $value[$pfx . 'photo']) . '</div>'; $html[$key] .= '</td>'; $html[$key] .= '<td style="vertical-align: top;">'; $html[$key] .= view_mark_user($value, $pfx); $html[$key] .= $session->view_online_status($value[$pfx . 'login']); //if ($value[$pfx . 'is_pro'] == 't') $html[$key] .= (is_emp($value[$pfx . 'role']) ? view_pro_emp() : view_pro2($value[$pfx . 'is_pro_test']=='t')); $cls = is_emp($value[$pfx . 'role']) ? 'class="empname11"' : 'class="frlname11"'; $html[$key] .= ' <font ' . $cls . '><a href="/users/' . $value[$pfx . 'login'] . '" title="' . $value[$pfx . 'uname'] . ' ' . $value[$pfx . 'usurname'] . '" ' . $cls . ' >' . $uname . ' ' . $usurname . '</a> [<a href="/users/' . $value[$pfx . 'login'] . '/" title="' . $value[$pfx . 'login'] . '" ' . $cls . '>' . $login . '</a>]</font>'; if ($msg_text != '') { $html[$key] .= '<div style="margin-top: 4px;"><a href="/contacts/?from=' . $value[$pfx . 'login'] . '">' . reformat($msg_text, 80, 0, 1) . '</a></div>'; } $html[$key] .= '</td>'; $html[$key] .= '</tr>'; $html[$key] .= '</table>'; } } $this->html = $html; }
/** * Инициализация контроллера. */ public function init() { parent::init(); $this->is_adm = hasPermissions('tservices'); $this->is_emp = (bool) is_emp(); $this->layout = '//layouts/content-with-right-sidebar-fixed'; $this->order_model = TServiceOrderModel::model(); }
/** * Инициализация попапа данными из карточки ТУ. * * @param type $data */ public function init($data = array()) { parent::init(); if (!empty($data)) { $this->data = $data; } $this->is_emp = is_emp(); $this->is_auth = get_uid(false) > 0; }
/** * возвращает статистику в промоблок Безопасной Сделки. */ function getPromoStats() { $objResponse = new xajaxResponse(); $promoStats = sbr_meta::getpromoStats(); $roleStr = is_emp() || !get_uid() ? 'emp' : 'frl'; ob_start(); include $_SERVER['DOCUMENT_ROOT'] . '/promo/sbr/new/tpl.stats.php'; $html = ob_get_clean(); $objResponse->assign('promo-stats', 'innerHTML', $html); return $objResponse; }
/** * ”становить параметры пагинации * * @param int $limit * @param int $page * @return \Tservices_Module */ public function setPage($limit, $page = 1, $count_bind = 0, $count_bind_cur_page = 0) { $page = $page > 0 ? $page : 1; $this->page = +$page - floor($count_bind / $limit); $this->limit = +$limit; //≈сли тизер открыт, то последнюю услугу с первой страницы дублируем на следующей //соответственно, будет сдвиг всего каталога $repeat_hidden = get_uid(false) && !is_emp() && !isset($_COOKIE['hide_tservices_teaser']) && $page > 1 ? 1 : 0; $this->offset = ($page - 1) * $limit - ($count_bind - $count_bind_cur_page) - $repeat_hidden; return $this; }
public function __construct($type = false, $tbl_name = false) { $this->is_pro = is_pro() ? '10' : '01'; $this->is_role = get_uid(false) ? is_emp() ? '01' : '10' : '00'; if ($tbl_name) { $this->tbl_name = $tbl_name; } if ($type) { $this->setType($type, 1); } }
/** * Получить станицу с выбором работ для таба. * * @param bool $params * * @return \xajaxResponse */ function FPEP_getTab($params) { $objResponse = new xajaxResponse(); $uid = get_uid(false); if ($uid > 0 && !is_emp() && is_pro()) { $query = http_build_query($params); $params['is_ajax'] = true; require_once ABS_PATH . '/freelancers/widgets/FreelancersPreviewEditorPopup.php'; $freelancersPreviewEditorPopup = new FreelancersPreviewEditorPopup($params); $html = $freelancersPreviewEditorPopup->render(); $objResponse->call("window.popups_factory.getPopup('freelancersPreviewEditorPopup').showTabContent", $freelancersPreviewEditorPopup->getCurrentTab(), $html, $query); } return $objResponse; }
/** * Выводит дерево комментариев. Используется здесь и в xajax/contest.server.php * @param integer $pid id проекта * @param string $name название проекта * @param array $comments массив с деревом комментариев (подробнее в classes/contest.php) * @param boolean $comm_blocked автор отключил возможность оставлять комментарии? * @param boolean $project_end проект закрыт? * @param integer $s_level уровень вложенности комментария * @return string HTML с кнопками управления */ function comments($pid, $name, &$comments, $comm_blocked, $project_end, $s_level = 0) { global $stop_words, $contest, $project, $session; static $level = 0; $level = ($s_level ? $s_level : $level) + 1; $html = ''; $set_branch_as_read = false; for ($i = 0, $c = count($comments); $i < $c; $i++) { if (($comments[$i]['is_banned'] || $comments[$i]['usr_banned'] || $comments[$i]['user_blocked'] === 't') && !hasPermissions('projects') && !$contest->is_owner) { $msg = $msg2 = 'Ответ от заблокированного пользователя'; } else { if (!trim($comments[$i]['deleted'])) { $sMsg = $comments[$i]['moderator_status'] === '0' ? $stop_words->replace($comments[$i]['msg']) : $comments[$i]['msg']; $msg = reformat($sMsg, 30, 0, 0, 1); $msg2 = reformat($comments[$i]['msg'], 30, 0, 0, 1); } else { $msg2 = $msg = "Комментарий удален модератором"; if (hasPermissions("comments")) { $moderator = ''; $moderatorData = new users(); $moderatorData->GetUserByUID($comments[$i]['deluser_id']); if ($moderatorData->login) { $moderator = ' ' . $moderatorData->login . ' (' . $moderatorData->uname . ' ' . $moderatorData->usurname . ') '; } $msg2 = $msg = $msg . " {$moderator}"; } if ($comments[$i]['deluser_id'] == $comments[$i]['user_id']) { $msg2 = $msg = "Комментарий удален автором"; } else { if (trim($comments[$i]['deleted_reason']) && (hasPermissions("comments") || $comments[$i]['user_id'] == get_uid(false))) { $msg2 = $msg = $msg . "<div style='color:#ff0000'>Причина: " . $comments[$i]['deleted_reason'] . "</div>"; } } } } $a_is_banned = ($comments[$i]['is_banned'] || $comments[$i]['usr_banned']) && hasPermissions('projects'); $html .= "\n\t\t\t<li class='thread' id='thread-{$comments[$i]['id']}'" . ($level >= 9 ? " style='margin-left: 0'" : "") . ">\n\t\t\t\t<a name='c-comment-{$comments[$i]['id']}'></a>\n\t\t\t\t<div class='comment-one" . ($comments[$i]['deleted'] || $comments[$i]['hidden'] ? " comment-deleted" : "") . "' id='comment-{$comments[$i]['id']}'>\n\t\t\t\t\t<div class='contest-ea'>" . view_avatar($comments[$i]['login'], $comments[$i]['photo'], 1) . "</div>\n\t\t\t\t\t<div class='comment-body'>\n\t\t\t\t\t\t<h3 class='username'>" . $session->view_online_status($comments[$i]['login']) . "\n\t\t\t\t\t\t\t<a href='/users/{$comments[$i]['login']}' class='" . (is_emp($comments[$i]['role']) ? 'employer-name' : 'freelancer-name') . "'>{$comments[$i]['uname']} {$comments[$i]['usurname']} [{$comments[$i]['login']}]</a> " . view_mark_user($comments[$i]) . " " . ($comments[$i]['completed_cnt'] > 0 ? '<a href="/promo/bezopasnaya-sdelka/" title="Пользователь работал через Безопасную Сделку" target="_blank"><span class="b-icon b-icon__shield b-icon_top_1"></span></a>' : '') . "\n\t\t\t\t\t\t\t<span>[" . dateFormat('d.m.Y | H:i', $comments[$i]['post_date']) . "]</span>\n\t\t\t\t\t\t\t<span id='comment-modified-{$comments[$i]['id']}'>" . ($comments[$i]['modified'] ? "[изменен " . dateFormat('d.m.Y | H:i', $comments[$i]['modified']) . "]" : ' ') . "</span>\n\t\t\t\t\t\t\t" . ($a_is_banned ? "<b style=\"color:#ff0000\">Пользователь забанен</b>" : "") . "\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t" . ($_SESSION['uid'] && $comments[$i]['is_new'] ? "<p><img src='/images/mark-new.png' width='53' height='12' alt='новое' class='mark-new' /></p>" : "") . "\n\t\t\t\t\t\t<div id='comment-change-{$comments[$i]['id']}'>\n\t\t\t\t\t\t<p id='comment-msg-{$comments[$i]['id']}' " . ($a_is_banned ? "style='color:silver'" : "") . ".>" . $msg . "</p>\n\t\t\t\t\t\t<div id='comment-msg-original-{$comments[$i]['id']}' style='display:none'>" . $msg2 . "</div>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n banned.addContext( 'p{$pid}c{$comments[$i]['id']}', 3, '" . HTTP_PREFIX . "{$_SERVER['HTTP_HOST']}" . getFriendlyURL("project", $pid) . "?comm={$comments[$i]['id']}#comment-{$comments[$i]['id']}', \"" . htmlspecialchars($name) . "\" );\n </script>\n\t\t\t\t\t\t<ul class='thread-options' id='comment-options-{$comments[$i]['id']}'>\n\t\t\t\t\t\t\t" . comment_options($pid, $comments[$i], $comm_blocked, $project_end, $level, $name) . "\n\t\t\t\t\t\t</ul>\n <div id='warnreason-" . $comments[$i]['id'] . "-" . $comments[$i]['user_id'] . "' style='display:none; padding: 0 0 5px 0px;'> </div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t" . (empty($comments[$i]['comments']) ? '' : '<ul>' . comments($pid, $name, $comments[$i]['comments'], $comm_blocked, $project_end) . '</ul>') . "\n\t\t\t</li>\n\t\t"; if ($comments[$i]['is_new']) { $set_branch_as_read = true; } } if ($set_branch_as_read) { $p = new projects(); $data = array("id" => $pid, "kind" => 7, "user_id" => $project["user_id"]); $p->SetRead($data, get_uid(false), true); } --$level; return $html; }
function tservices_order_auth($email, $name, $surname, $options) { $objResponse =& new xajaxResponse(); $name = substr(strip_tags(trim(stripslashes($name))), 0, 21); //Для регистрации $surname = substr(strip_tags(trim(stripslashes($surname))), 0, 21); //Для регистрации $email = substr(strip_tags(trim(stripslashes($email))), 0, 64); //Для регистрации и авторизации $tu_id = intval(@$options['tu_id']); $tservices = new tservices(); $tService = $tservices->getCard($tu_id); if (!$tService) { return $objResponse; } if (is_email($email)) { //Забираем только нужные нам ключи $options = array_intersect_key($options, array('extra' => '', 'is_express' => '', 'paytype' => '')); //Проверка входных параметров $is_valid_extra = !isset($options['extra']) || isset($options['extra']) && count(array_intersect(array_keys($tService['extra']), $options['extra'])) == count($options['extra']); $is_valid_express = !isset($options['is_express']) || isset($options['is_express']) && $options['is_express'] == '1' && $tService['is_express'] == 't'; $is_valid_paytype = isset($options['paytype']) && in_array($options['paytype'], array('0', '1')); if (!($is_valid_extra && $is_valid_express && $is_valid_paytype)) { return $objResponse; } $tservices_auth_smail = new tservices_auth_smail(); $user = new users(); $user->GetUser($email, true, true); //Проверяем на всякий случай там точно мыло совпало а то может логин $is_email = $user->email == $email; //Создаем хеш для ссылки активации $code = TServiceOrderModel::model()->newOrderActivation(array('user_id' => $user->uid > 0 ? $user->uid : null, 'tu_id' => $tService['id'], 'uname' => !empty($name) ? $name : null, 'usurname' => !empty($surname) ? $surname : null, 'email' => $email, 'options' => $options)); // Пользователь найден, ведь у него есть email. А как еще проверить? if ($user->uid > 0 && $is_email) { if (is_emp($user->role)) { $tservices_auth_smail->orderByOldUser($email, $tService, $code); $objResponse->call('TServices_Order_Auth.showSuccess', 'На указанную вами почту отправлено письмо со ссылкой-подтверждением. Пожалуйста, перейдите по ней для завершения процесса заказа услуги.'); } else { $objResponse->call('TServices_Order_Auth.showError', 'email', 'Данный e-mail принадлежит фрилансеру'); } } else { $tservices_auth_smail->orderByNewUser($email, $tService, $code); $objResponse->call('TServices_Order_Auth.showSuccess', 'На указанную вами почту отправлено письмо со ссылкой-подтверждением. Пожалуйста, перейдите по ней для завершения процесса заказа услуги.'); } } else { $objResponse->call('TServices_Order_Auth.showError', 'email', 'Неверно указана почта'); } return $objResponse; }
/** * Определяет, нужно ли показывать привязку телефона * Показываем уведомление только авторизованным фрилансерам, у которых не привязан номер телефона * * @return true/false */ public function checkAllow() { if ($this->_allow === null) { $uid = get_uid(false); if ($uid && !is_emp()) { $reqv = sbr_meta::getUserReqvs($uid); if ($reqv['is_activate_mob'] != 't') { $this->_allow = true; return $this->_allow; } } $this->_allow = false; } return $this->_allow; }
function AddUser($login) { $objResponse = new xajaxResponse(); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php"; $user = new users(); $user->GetUser($login); if ($user->login && !is_emp($user->role) && !$user->is_banned && $user->active == 't') { $inner = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tr>\n\t<td width=\"60\">" . view_avatar($user->login, $user->photo) . "</td>\n\t<td valign=\"top\"><a href=\"/users/" . $user->login . "\" class=\"frlname11\" title=\"" . $user->uname . " " . $user->usurname . "\">" . $user->uname . " " . $user->usurname . " [" . $user->login . "]" . "</a> \n\t<a href=\"javascript:reload_form();\" class=\"blue\">изменить</a></td>\n</tr>\n</table>"; $objResponse->assign("usersel", "innerHTML", $inner); $objResponse->script("document.getElementById('next').disabled = false;document.getElementById('login').value = '" . $login . "';"); } else { $objResponse->script("reload_form();\n\t\t document.getElementById('usersel').innerHTML = document.getElementById('usersel').innerHTML + '" . ref_scr(view_error("Такого фрилансера не существует")) . "';\n\t\t document.getElementById('elogin').value = '" . $login . "';"); } return $objResponse; }
protected function sendFromTemplateByUserId($template, $uid) { $user = new users(); $user->GetUserByUID($uid); if ($user->uid <= 0) { return false; } $is_emp = is_emp($user->role); $sufix = $is_emp ? 'emp' : 'frl'; $template = sprintf($this->template_format, $template, $sufix); $this->recipient = $this->_formatFullname($user, true); $content = Template::render(FINANCE_TPL_MAIL_PATH . $template, array('smail' => &$this, 'data' => $this->data, 'params' => $this->_addUrlParams($is_emp ? 'e' : 'f'), 'user' => (array) $user)); $message = Template::render(FINANCE_TPL_MAIL_PATH . FINANCE_TPL_BASE_LAYOUT, array('content' => $content)); $this->message = nl2br($message); return array('ret' => $this->send('text/html'), 'message' => $message); }
/** * @deprecated #0015627 */ function AddOpinion($source_uid, $dest_uid, $message, $rating, $counter, $from = 'frl') { return false; $source_uid = get_uid(false); $objResponse = new xajaxResponse(); $message = trim($message); if (!in_array($rating, array(-1, 0, 1))) { $objResponse->assign('rating_error', 'innerHTML', 'Вы не выбрали категорию отзыва'); } elseif (opinions::CheckUserCanPost($source_uid, $dest_uid) != 0) { // левый пользователь } elseif ($message == '') { $objResponse->script("opinionFormError('error_msg');"); } elseif (strlen($message) > opinions::$opinion_max_length) { $objResponse->script("opinionMaxLengthError('msg', " . opinions::$opinion_max_length . ');'); } else { $message = str_replace('&', '&', $message); $message = stripslashes($message); $message = change_q_x($message, FALSE, TRUE, '', false, false); $error = opinions::NewMsg($source_uid, $dest_uid, $message, $rating, getRemoteIP(), $new_id); if (!$error) { $msg = opinions::GetLastMessage($source_uid, $dest_uid); if ($msg) { $user = new users(); $user->GetUserByUID($dest_uid); $objResponse->remove('form_container'); if (is_emp() && $from == 'frl' || !is_emp() && $from == 'emp') { $from = $from == 'frl' ? 'emp' : 'frl'; $objResponse->redirect("/users/{$user->login}/opinions/?from={$from}#o_{$new_id}"); return $objResponse; } $objResponse->prepend('messages_container', 'innerHTML', opinions::printTheme($msg, $from, $counter, $user)); $objResponse->prepend('messages_container', 'innerHTML', opinions::printAddForm($source_uid, $dest_uid, $from)); $nt = $rating == 1 ? 'plus' : ($rating == -1 ? 'minus' : 'neitral'); $objResponse->call('opinionChConuters', NULL, 'ops-' . $from . $nt); $objResponse->script("opinionCheckMaxLengthStop('msg');"); $objResponse->assign('no_messages', 'innerHTML', ''); } else { $objResponse->script("alert('" . serialize($msg) . "')"); } } else { $objResponse->script("alert('" . $error . "')"); } } return $objResponse; }
/** * Вернуть контактные данные фрилансера если есть доступ их смотреть * * @param type $login * @param type $hash * @return \xajaxResponse */ function getContactsInfo($login, $hash) { $objResponse = new xajaxResponse(); if ($hash === paramsHash(array($login))) { $freelancer = new freelancer(); $freelancer->GetUser($login); if ($freelancer->uid > 0 && !is_emp($freelancer->role) && is_view_contacts($freelancer->uid) && is_contacts_not_empty($freelancer)) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/template.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php'; require_once ABS_PATH . '/classes/statistic/StatisticFactory.php'; require_once ABS_PATH . '/classes/users.php'; $html = Template::render($_SERVER['DOCUMENT_ROOT'] . '/user/contacts_info.php', array('user' => $freelancer)); $ga = StatisticFactory::getInstance('GA'); $ga->queue('event', array('uid' => isset($_SESSION['uid']) ? $_SESSION['uid'] : 0, 'cid' => users::getCid(), 'category' => 'Freelancer', 'action' => 'show_contacts', 'label' => "{'login': '******'}")); $objResponse->assign('contacts_info_block', 'innerHTML', $html); } } return $objResponse; }
function GetMoreSBR($uid, $i) { session_start(); $objResponse = new xajaxResponse(); $html = ''; $user = new users(); $user->GetUserByUID($uid); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php'; $MONTHA = $GLOBALS['MONTHA']; if ($i > 5 || $i <= 0) { $i = 5; } $sbr_ratings = sbr_meta::getUserRatings($user->uid, is_emp($user->role), 'ALL', 5); ob_start(); include $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.rating-sbr.php'; $html = ob_get_contents(); ob_end_clean(); $objResponse->assign('more_sbr_content', 'innerHTML', $html); return $objResponse; }
/** * Заполняет значения в зависимости от для профиля юзера. * * @param array $user Информация о пользователе */ public function initByUser($user) { $role_text = is_emp($user->role) ? SeoText::ROLE_EMP : SeoText::ROLE_FRL; $user_name = trim(sprintf(SeoText::USER_NAME, (string) $user->uname, (string) $user->usurname, $user->login)); //Получаем названия страны и города if ($user->country > 0) { $country = new country(); $country_name = $country->GetCountryName($user->country); } if ($user->city > 0) { $city = new city(); $city_name = $city->GetCityName($user->city); } if ($user->spec) { $this->seo_value = new SeoValues(); $this->seo_value->initCard($user->spec); $this->title = !$user->is_banned ? sprintf(SeoText::USER_TITLE_SPEC, $role_text, $user_name, $this->seo_value->getKey(1), @$country_name, @$city_name) : sprintf(SeoText::USER_TITLE_BLOCKED, $user->login); $this->description = sprintf(SeoText::USER_DESC_SPEC, $user_name, @$country_name, @$city_name, $this->seo_value->getFTitle(1), $this->seo_value->getFTitle(2), $this->seo_value->getKey(1), $this->seo_value->getKey(2), $this->seo_value->getKey(3)); $this->keywords = sprintf(SeoText::USER_KEY_SPEC, $user_name, $this->seo_value->getFTitle(1), $this->seo_value->getKeysString()); $tags = ($this->seo_value->getFTitle(1) ? sprintf(SeoText::REMOTELY, $this->seo_value->getFTitle(1)) : '') . $this->seo_value->getKeysString(); $this->footer_text = $tags ? sprintf(SeoText::TAGS, $tags) : ''; $this->image_description = sprintf(SeoText::REMOTELY, $this->seo_value->getFTitle(1)) . $this->seo_value->getKey(1); } else { $this->title = !$user->is_banned ? sprintf(SeoText::USER_TITLE_DEF, $role_text, $user_name, @$country_name, @$city_name) : sprintf(SeoText::USER_TITLE_BLOCKED, $user->login); $this->description = sprintf(SeoText::USER_DESC_DEF, $user_name, @$country_name, @$city_name); $this->keywords = sprintf(SeoText::USER_KEY_DEF, $user_name); $this->footer_text = SeoText::USER_FOOTER_DEF; $this->image_description = SeoText::IMAGE_DESC_DEF; } if ($user->is_pro == 't' && $user->pname) { //если в настройках задан пользовательский заголовок $stop_words = new stop_words(hasPermissions('projects')); $own_title = $user->isChangeOnModeration($user->uid, 'pname') && $user->is_pro != 't' ? $stop_words->replace($user->pname, 'plain', false) : $user->pname; $this->title = $own_title; } if (is_emp($user->role)) { $this->description = sprintf(SeoText::EMP_DESC, $user_name, @$country_name, @$city_name); $this->keywords = sprintf(SeoText::EMP_KEY, $user_name); $this->footer_text = sprintf(SeoText::TAGS, SeoText::EMP_KEY); } }
function AddUser($login) { $objResponse = new xajaxResponse(); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php'; $user = new users(); $user->GetUser($login); if ($user->login && !is_emp($user->role) && !$user->is_banned && $user->active == 't') { $inner = '<table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="60">' . view_avatar($user->login, $user->photo) . '</td> <td valign="top"><a href="/users/' . $user->login . '" class="frlname11" title="' . $user->uname . ' ' . $user->usurname . '">' . $user->uname . ' ' . $user->usurname . ' [' . $user->login . ']' . '</a> <a href="javascript:reload_form();" class="blue">изменить</a></td> </tr> </table>'; $objResponse->assign('usersel', 'innerHTML', $inner); $objResponse->script("document.getElementById('next').disabled = false;document.getElementById('login').value = '" . $login . "';"); } else { $objResponse->script("reload_form();\n\t\t document.getElementById('usersel').innerHTML = document.getElementById('usersel').innerHTML + '" . ref_scr(view_error('Такого фрилансера не существует')) . "';\n\t\t document.getElementById('elogin').value = '" . $login . "';"); } return $objResponse; }
public function isValid($value) { $isValid = true; $this->_setValue($value); $this->user = new users(); switch ($this->_by) { case 'login': $this->user->GetUser($value, true, false); break; case 'email': $this->user->GetUser($value, true, true); break; case 'uid': $this->user->GetUserByUID($value); break; } if ($this->user->uid > 0 && $this->user->{$this->_by} == $value && ($this->_is_emp === null || is_emp($this->user->role) == $this->_is_emp)) { $this->_error(self::ERROR_USER_FOUND); $isValid = false; } return $isValid; }
/** * Функция оплаты акции. * * @global object $DB база данных * * @param int $transaction_id ИД транзакции сделки * @param int $user_id ИД пользователя * * @return int */ public function setPayed($transaction_id, $user_id) { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php'; $account = new account(); if (is_emp($_SESSION['role'])) { return 0; } $bill_id = 0; $error = $account->Buy($bill_id, $transaction_id, $this->getConst_OP_CODE(), $user_id, $this->title, $this->descr, $this->getConst_PAYED_SUM(), 0); if ($error !== 0) { return 0; } if ($bill_id) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php'; $pay_place = new pay_place(1); $account->commit_transaction($transaction_id, $user_id, $bill_id); $this->setUserPro($user_id, $bill_id); $pay_place->addUserTop($user_id); return $bill_id; } return 0; }
function NewAdvice($to_user, $msgtext) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/sbr.php"; $objResponse = new xajaxResponse(); $to_user = intval($to_user); $sbr = new sbr(get_uid(false)); $isReqvsFilled = !$sbr->checkUserReqvs(); if ($isReqvsFilled && !is_emp($_SESSION['role'])) { $objResponse->call('alert', 'Заполните раздел «Финансы»'); $objResponse->script("\$\$('a.advice-new').store('lock', 0);"); return $objResponse; } if (!$to_user) { $objResponse->call('alert', 'Ошибка'); $objResponse->script("\$\$('a.advice-new').store('lock', 0);"); return $objResponse; } if (is_empty_html($msgtext)) { $objResponse->call('alert', 'Вы не заполнили форму.'); $objResponse->script("\$\$('a.advice-new').store('lock', 0);"); return $objResponse; } if (strlen_real($msgtext) > paid_advices::MAX_DESCR_ADVICE) { $objResponse->call('alert', 'Рекомендация не должна быть больше ' . paid_advices::MAX_DESCR_ADVICE . ' символов'); $objResponse->script("\$\$('a.advice-new').store('lock', 0);"); return $objResponse; } $advice = new paid_advices(); $new = $advice->add($to_user, $msgtext); if ($new === false) { $objResponse->call('alert', 'Ошибка отправки рекомендации.'); $objResponse->script("\$\$('a.advice-new').store('lock', 0);"); return $objResponse; } $objResponse->call('newAdviceResp', $res); return $objResponse; }
</form> </td> </tr> </table> </td> </tr> </table> <br> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <?php $info_iter = 0; $fpinfo_iter = 0; if ($users) { foreach ($users as $ikey => $user) { $utype = is_emp($user['role']) ? 'emp' : 'frl'; if ($user['login'] == $old_user['login']) { continue; } $old_user['login'] = $user['login']; $safety_ip = ''; $safety_ips = users::GetSafetyIP($user['uid']); while (list($k, $v) = each($safety_ips)) { $safety_ip .= $v . ', '; } $safety_ip = preg_replace('/, $/', '', $safety_ip); ?> <tr class="qpr"> <td> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr valign="top" class="n_qpr">
<ul class="search-tabs" data-ga_role="<?php echo is_emp() ? 'Employer' : (get_uid(false) ? 'Freelance' : 'Unauthorized'); ?> "> <li <?php echo $type == 'users' ? 'class="active"' : ''; ?> > <a href="/search/?type=users" data-ga_type="performer"> Поиск <span class="b-page__desktop b-page__ipad">исполнителя</span><div class="b-page__iphone">исполнителя</div> </a> </li> <li <?php echo $type == 'projects' ? 'class="active"' : ''; ?> > <a href="/search/?type=projects" data-ga_type="project"> Поиск <span class="b-page__desktop b-page__ipad">проекта</span><div class="b-page__iphone">проекта</div> </a> </li> <li <?php echo $sections ? 'class="active"' : ''; ?> > <a href="/search/?type=works" data-ga_type="section"> Поиск по <span class="b-page__desktop b-page__ipad">разделам сайта</span><div class="b-page__iphone">разделам сайта</div> </a> </li> </ul>
<?php $g_page_id = '0|62'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/splash_screens.php'; session_start(); $prj_id = __paramInit('int', 'prj_id', null, 0); $contest = __paramInit('int', 'contest', null, 0); $top = __paramInit('int', 'top', null, 0); $top_days = __paramInit('int', 'top_days', null, 0); $color = __paramInit('int', 'color', null, 0); $bold = __paramInit('int', 'bold', null, 0); $logo = __paramInit('int', 'logo', null, 0); // страницу могут смотреть только зарегистрированые работодатели if (!get_uid(0) || !is_emp() || !$prj_id) { include $_SERVER['DOCUMENT_ROOT'] . '/403.php'; exit; } $prj_url = getFriendlyURL('project', $prj_id); $stretch_page = true; $header = '../header.php'; $footer = '../footer.html'; $content = 'tpl.contest_published.php'; $_SESSION['splash_prj_id'] = $prj_id; //$_SESSION['do_show_splash'] = splash_screens::SPLASH_KONKURS; include '../template2.php';
function setReadAllProject() { session_start(); $objResponse = new xajaxResponse(); if (is_emp()) { projects::SetReadAll(get_uid(false)); $tip = notifications::getEmpGroupTip(); $objResponse->script("\n \$('new_offers_content').dispose();\n \$\$('.new-offer-image').each(function(elm) {\n var span = new Element('span', {'html': \$(elm).getNext().get('html')});\n \$(elm).getNext().dispose();\n \$(elm).grab(span, 'after');\n \$(elm).dispose();\n });\n \n var mt = \$\$('.b-user-menu-tasks-clause a');\n if(mt)\n {\n mt.set('title','{$tip['tip']}');\n var mt_cnt = mt.getElement('.b-user-menu-clause-quantity'); \n if(mt_cnt){" . ($tip['count'] > 0 ? "mt_cnt.set('html',{$tip['count']})" : "mt_cnt.destroy();") . "}\n }\n "); } return $objResponse; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; $redirect = is_emp() ? '/payed-emp/' : '/payed/'; header_location_exit($redirect); /* session_start(); $uid = get_uid(false); $stretch_page = true; $no_banner = 1; if (!$fpath) $fpath = ""; $header = $fpath."header.php"; $footer = $fpath."footer.html"; $css_file = 'payed.css'; $js_file = array( 'payed.js' ); if (!$uid) { header_location_exit('/fbd.php'); } elseif (is_emp()) { $content = $fpath."proonly_inner_emp.php"; $js_file = array( 'payed.js' ); } else { $content = $fpath."proonly_inner_frl.php"; } include("template2.php");*/
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php"; /** массив шаблонов тизеров * ключ file - обязательно * необязательно: exclude - тизеры с этими параметрами исключить */ $teasersEmp = array(array('file' => 'tpl.teaser-masssending.php', 'exclude' => array('no-public', 'masssending')), array('file' => 'tpl.teaser-pro-emp.php', 'exclude' => array('no-public', 'pro')), array('file' => 'tpl.teaser-public.php', 'exclude' => array('project')), array('file' => 'tpl.teaser-sbr-emp.php', 'exclude' => array('no-public')), array('file' => 'tpl.teaser-top.php', 'exclude' => array('public', 'top'))); $teasersFrl = array(array('file' => 'tpl.teaser-sbr-frl.php', 'exclude' => array()), array('file' => 'tpl.teaser-pro-frl.php', 'exclude' => array('pro')), array('file' => 'tpl.teaser-test-pro-frl.php', 'exclude' => array('pro', 'test-pro'))); $filteredTeasers = array(); if (!$teasersExclude) { $teasersExclude = array(); } // тизеры разные для фрилансеров и работодателей $uid = get_uid(0); if ($uid) { if (is_emp()) { $teasers = $teasersEmp; } else { $teasers = $teasersFrl; } } else { $teasers = $teasersEmp; } // для про пользователей не показвыаем рекламу ПРО аккаунта if (is_pro()) { if ($_SESSION['pro_test'] === 'f') { // тизер ПРО показываем если куплен тестовый ПРО $teasersExclude[] = 'pro'; } $teasersExclude[] = 'test-pro'; $teasersExclude[] = 'offers';