function SaveStatus($text, $statusType, $login = NULL) { session_start(); $freelancer = new freelancer(); $text = addslashes(substr(stripslashes(trim($text)), 0, 200)); close_tags($text, 's'); $freelancer->status_text = antispam(htmlspecialchars(htmlspecialchars_decode(change_q_x(trim($text), true, false), ENT_QUOTES), ENT_QUOTES)); $freelancer->status_type = intval($statusType); if ($freelancer->statusToStr($statusType)) { $stdStatus = ""; $objResponse = new xajaxResponse(); $uid = hasPermissions('users') && $login != $_SESSION['login'] ? $freelancer->GetUid($err, $login) : get_uid(false); $pro = hasPermissions('users') && $login != $_SESSION['login'] ? is_pro(true, $uid) : is_pro(); $error = $freelancer->Update($uid, $res); if (!$freelancer->status_text) { $freelancer->status_text = $stdStatus; } $freelancer->status_text = stripslashes($freelancer->status_text); switch ($freelancer->status_type) { case 1: $status_cls = 'b-status b-status_busy'; break; case 2: $status_cls = 'b-status b-status_abs'; break; case -1: $status_cls = 'b-status b-status_no'; break; default: $status_cls = 'b-status b-status_free'; } if (!$noassign) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('users')); $sStatusText = $pro ? $freelancer->status_text : $stop_words->replace($freelancer->status_text); //$GLOBALS['xajax']->setCharEncoding("windows-1251"); $jsobj = json_encode(array('data' => iconv('CP1251', 'UTF8', $freelancer->status_text))); $objResponse->assign("statusText", "innerHTML", $freelancer->status_text == $stdStatus ? "" : reformat($sStatusText, 40, 0, 1, 25)); $objResponse->assign("statusTitle", "innerHTML", $freelancer->statusToStr($statusType)); // $objResponse->assign("statusTitle", "style.display", $statusType > -1 ? '' : 'none'); $objResponse->script("statusType = {$statusType};\n\t\t\t statusTxt = document.getElementById('statusText').innerHTML;\n\t\t\t statusTxtSrc = {$jsobj};"); } $objResponse->script("\$('bstatus').erase('class');\n \$('bstatus').addClass('{$status_cls}');"); } return $objResponse; }
/** * @see parent::initHtmlData */ public function initHtmlData() { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $pid = $this->parseLinks(); if ($pid) { $pid = array_map('intval', $pid); $stop_words = new stop_words(); $projects = new_projects::getProjectsById($pid); foreach ($projects as $i => $project) { $sTitle = $project['moderator_status'] === '0' && $project['kind'] != 4 && $project['is_pro'] != 't' ? $stop_words->replace($project['name']) : $project['name']; $projects[$i]['sTitle'] = reformat2($sTitle, 30, 0, 1); $projects[$i]['friendly_url'] = $this->getLinkById($project['id']); $projects[$i]['str_cost'] = $project['cost'] ? CurToChar($project['cost'], $project['currency']) . getPricebyProject($project['priceby']) : 'По договоренности'; } $this->html_data = $projects; } }
//Если не участник персонального проекта if ($project['kind'] == 9 && (!$uid || !(hasPermissions('projects') || $project['user_id'] == $uid || $project['exec_id'] == $uid || projects_offers::IsPrjOfferExists($project['id'], get_uid(false))))) { include ABS_PATH . '/404.php'; exit; } //404 если проект заблокирован if ($project['is_blocked'] && $_SESSION['uid'] != $project['user_id'] && !hasPermissions('projects')) { include ABS_PATH . '/prj_blocked.php'; exit; } // Платные ответы $answers = new projects_offers_answers(); $answers->GetInfo($uid); $pr_emp = is_emp($project['role']); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('projects')); $title = $project['moderator_status'] === '0' && $project['kind'] != 4 && $project['is_pro'] != 't' ? $stop_words->replace($project['name'], 'plain', false) : $project['name']; $sTitle = htmlspecialchars($title, ENT_QUOTES, 'CP1251', false); if ($project['cost'] != 0) { switch ($project['priceby']) { case '1': $priceby_str = '/час'; break; case '2': $priceby_str = '/день'; break; case '3': $priceby_str = '/месяц'; break; case '4': $priceby_str = '/проект';
<?php if (!defined('IN_STDF')) { header("HTTP/1.0 404 Not Found"); exit; } //require_once($_SERVER['DOCUMENT_ROOT'] . "/xajax/projects.common.php"); //$xajax->printJavascript('/xajax/'); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/HTML/projects_lenta.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/sbr.php"; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $projects = new projects(); $stop_words = new stop_words(hasPermissions('projects')); if ($_POST['openclose'] == 1) { $_GET["open"] = 1; $_GET["closed"] = 0; } elseif ($_POST['openclose'] == 2) { $_GET["closed"] = 1; $_GET["open"] = 0; } $uid = $user->uid; $is_emp = is_emp(); $is_owner = $uid == get_uid(false); $is_adm = !$is_owner && hasPermissions('projects'); //print_r($_POST); $closed = $_GET["closed"] ? "true" : ($_GET["all"] ? "" : "false"); $kind = __paramInit('int', 'kind', 'kind', 0); $trash = __paramInit('int', 'trash', 'trash', 0); if ($trash) {
/** * Возвращает несколько (@see self::HISTORY_COUNT) последних сообщений с контактом. * * @param stdClass $attr - список параметров * mixed uid: uid пользователя или массив с uid'ами историю с которым нужно получить * @param bool - если true - разрешено передавать в качестве uid массив, если false - только одного * * @return array - массив с историей */ protected function _ceHistory($attr, $mmode = false) { $messages = new messages(); $stopWords = new stop_words(false); $res = array(); $c = 0; if ($mmode) { $uids = $attr->uid; $oneUser = false; $maxid = 0; } else { $uids = intval($attr->uid); $oneUser = true; $maxid = isset($attr->maxid) ? intval($attr->maxid) : 0; } $rows = $messages->GetHistory($this->_uid, $uids, self::HISTORY_COUNT, $maxid); if ($rows) { for ($i = count($rows) - 1; $i >= 0; --$i) { $message = $rows[$i]['msg_text']; if ($rows[$i]['moderator_status'] === '0') { $message = $stopWords->replace($message); } $message = reformat($message, 14, 0, 0, 1); $res[$c] = array('id' => $rows[$i]['id'], 'text' => iconv('CP1251', 'UTF-8', $message), 'incoming' => $rows[$i]['from_id'] == $this->_uid ? 0 : 1, 'time' => dateFormat('Y-m-d H:i:s', $rows[$i]['post_time']), 'files' => array()); if (!$oneUser) { $res[$c]['cuid'] = $rows[$i]['to_id'] == $this->_uid ? $rows[$i]['from_id'] : $rows[$i]['to_id']; } if ($rows[$i]['files']) { foreach ($rows[$i]['files'] as $file) { if (preg_match('/^users\\/[-_a-z0-9]{2}\\/([-_a-z0-9]+)/i', $file['path'], $o)) { $res[$c]['files'][] = array('link' => WDCPREFIX . '/users/' . $o[1] . '/contacts/' . $file['fname'], 'filename' => $file['original_name']); } } } ++$c; } } return $res; }
$boldPrc = !false * (new_projects::PRICE_BOLD + $addedPrc) * (1 - (int) $project['payed_items'][new_projects::PAYED_IDX_BOLD]); $logoPrc = !false * (new_projects::PRICE_LOGO + $addedPrc) * (1 - (int) $project['payed_items'][new_projects::PAYED_IDX_LOGO]); $topDays = $tmpPrj->getTopDays(); $remTPeriod = $tmpPrj->getRemainingTopPeriod($remTD, $remTH, $remTM, $remtverb); $addedTD = $tmpPrj->getAddedTopDays(); $pex = project_exrates::GetAll(false); $cex = array(project_exrates::USD, project_exrates::EUR, project_exrates::RUR, project_exrates::FM); $PROprice = 0; $price = $tmpPrj->getPrice($items, $PROprice) + $logoPrc * !!$error['logo']; $PROprice += ($logoPrc - $addedPrc) * !!$error['logo']; $contestPriceTop = is_pro() ? new_projects::PRICE_CONTEST_TOP1DAY_PRO : new_projects::PRICE_CONTEST_TOP1DAY; $nTopPrice = $tmpPrj->isKonkurs() ? $contestPriceTop + $addedPrc : (is_pro() ? new_projects::PRICE_TOP1DAYPRO : new_projects::PRICE_TOP1DAY) + $addedPrc; $nTopProPrice = $tmpPrj->isKonkurs() ? new_projects::PRICE_CONTEST_TOP1DAY_PRO : new_projects::PRICE_TOP1DAYPRO; if (isset($project['descr'])) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(false); $project['descr'] = $project['kind'] != 4 && !is_pro() ? $stop_words->replace($project['descr']) : $project['descr']; $project['descr'] = preg_replace("/^ /", "", $project['descr']); $project['descr'] = preg_replace("/(\n) /", "\$1", $project['descr']); $project['descr'] = reformat($project['descr'], 100, 0, 0, 1); $project['descr'] = preg_replace("//", " ", $project['descr']); } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/project_exrates.php"; $project_exRates = project_exrates::GetAll(); $exch = array(1 => 'FM', 'USD', 'Euro', 'Руб'); $translate_exRates = array(0 => 2, 1 => 3, 2 => 4, 3 => 1); ?> <script> var ge=function(id){return document.getElementById(id);} var S=<?php echo round($price);
/** * Редактировать проект * * @param array $prj Данные для редактирования * @param object $newattach Новые файлы (@see class CFile) * @return boolean true если редактирование прошло успешно, иначе false */ function editPrj($prj, $newattach, $categories = false) { global $DB; if ($prj['kind'] == 7) { preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $prj['end_date'], $o1); preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $prj['win_date'], $o2); if ($o1) { $end_date = date('Y-m-d', mktime(0, 0, 0, $o1[2], $o1[1], $o1[3])); } else { $end_date = $prj['end_date']; } if ($o2) { $win_date = date('Y-m-d', mktime(0, 0, 0, $o2[2], $o2[1], $o2[3])); } else { $win_date = $prj['win_date']; } } else { $end_date = NULL; $win_date = NULL; } $top_set = $post_set = ''; if ($prj['top_days']) { $top_set = $DB->parse(",\n top_from = CASE WHEN COALESCE(top_to,'epoch') >= now() THEN top_from ELSE now() END,\n top_to = CASE WHEN COALESCE(top_to,'epoch') >= now() THEN top_to + '?i days'::interval ELSE now() + '?i days'::interval END\n ", $prj['top_days'], $prj['top_days']); } if ($prj['post_now']) { $post_set = ", post_date = NOW()"; } $sql = ''; if ($prj['user_id'] == $_SESSION['uid'] && !hasPermissions('projects')) { // автор, не админ, не про - отправить на модерирование $sModeration = 'moderator_status = 0, '; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($prj['name'], $prj['descr']); $this->addModeration($prj['id'], $nStopWordsCnt); } $prj['payed'] = round($prj['payed'], 0); $prj['strong_top'] = hasPermissions('projects') ? (int) $prj['strong_top'] : 0; $sql .= $DB->parse("UPDATE projects\n SET state = ?i,\n name = ?,\n cost = ?f,\n descr = ?,\n currency = ?i,\n kind = ?i,\n country = ?i,\n city = ?i,\n payed = ?,\n pro_only = ?b,\n verify_only = ?b,\n videolnk = ?,\n strong_top = ?i,\n logo_id = ?i,\n link = ?,\n is_color = ?b,\n is_bold = ?b,\n billing_id = ?i,\n payed_items = ?,\n edit_date = NOW(),\n\t\t\t\tend_date = ?,\n\t\t\t\tbudget_type = ?i,\n\t\t\t\tpriceby = ?i,\n prefer_sbr = ?b,\n urgent = ?b,\n hide = ?b,\n o_urgent = ?b,\n o_hide = ?b,\n contacts = ?,\n {$sModeration}\n\t\t\t\twin_date = ?\n {$top_set}\n {$post_set}\n WHERE id = ?i\n ", $prj['state'], $prj['name'], $prj['cost'], $prj['descr'], $prj['currency'], $prj['kind'], $prj['country'], $prj['city'], $prj['payed'], $prj['pro_only'], $prj['verify_only'], $prj['videolnk'], $prj['strong_top'], $prj['logo_id'], $prj['link'], $prj['is_color'], $prj['is_bold'], $prj['billing_id'], $prj['payed_items'], $end_date, $prj['budget_type'], $prj['priceby'], $prj['prefer_sbr'], $prj['urgent'], $prj['hide'], $prj['urgent'], $prj['hide'], $prj['contacts'], $win_date, $prj['id']); if ($categories) { $this->saveSpecs($prj['id'], $categories); } $DB->query("DELETE FROM project_attach WHERE project_id = ?i", $prj['id']); // Удаляем все if ($newattach && is_array($newattach)) { $sql .= ";INSERT INTO project_attach (project_id, file_id) VALUES "; $i = 0; foreach ($newattach as $a) { $sql .= ($i++ ? ',' : '') . $DB->parse('(?i, ?i)', $prj['id'], $a['file_id']); } } //Обновляем информацию в старых преоктах (которые хранились также в таблице blogs_msgs) if (is_new_prj($prj['post_date'])) { $base = $prj['kind'] == 2 ? 5 : 3; $sql .= $DB->parse(";UPDATE blogs_msgs b\n SET title = ?,\n msgtext = ?,\n modified = NOW()\n FROM blogs_themes_old t\n WHERE t.id_gr = ?i\n AND t.base = ?i\n AND b.thread_id = t.thread_id\n AND b.reply_to IS NULL", $prj['name'], $prj['descr'], $prj['id'], $base); } return !!$DB->squery($sql); }
/** * Восстанавливает комментарий. * * @param int $cid id комментария * * @return string сообщение об ошибке или пустая строка, если все нормально */ public function RestoreComment($cid) { global $DB; if ($this->is_moder) { $cid = intval($cid); $sModer = ''; if (!hasPermissions('projects') && !is_pro()) { $p_comment = $this->GetComment($cid); if ($p_comment['user_id'] == $_SESSION['uid']) { 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($p_comment['msg']); $sModer = ' , moderator_status =' . ($nStopWordsCnt ? ' 0 ' : ' NULL '); if ($nStopWordsCnt) { $DB->insert('moderation', array('rec_id' => $cid, 'rec_type' => user_content::MODER_CONTEST_COM, 'stop_words_cnt' => $nStopWordsCnt)); } else { $DB->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i;', $cid, user_content::MODER_CONTEST_COM); } } } $DB->query("UPDATE projects_contest_msgs SET deleted = NULL, deluser_id = NULL {$sModer} WHERE id = ?i", $cid); return $DB->error; } }
/** * Редактирование комментария. * * @param integer id комментария * @param string комментарий * * @return xajaxResponse */ function ChangeComment($cid, $comment) { global $contest, $stop_words; session_start(); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/contest.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php'; $objResponse = new xajaxResponse(); if (!trim($comment)) { $objResponse->alert('Комментарий не может быть пустым'); return $objResponse; } if (!($uid = $_SESSION['uid'])) { return $objResponse; } $contest = new contest(0, $uid, is_emp(), FALSE, hasPermissions('projects')); // если пользователь не про или не верифицирован, то есть смысл проверить, может быть конкурс только для про или только для верифицированных $project = contest::getProjectByCommentID($cid); if ((!is_pro() || !is_verify()) && $project['user_id'] != get_uid() && !hasPermissions('projects')) { if ($project['pro_only'] == 't' && !is_pro()) { $objResponse->call('comment.reset'); $objResponse->alert('Данная функция доступна только пользователям с аккаунтом PRO.'); return $objResponse; } elseif ($project['verify_only'] == 't' && !is_verify()) { $objResponse->call('comment.reset'); $objResponse->alert('Данная функция доступна только верифицированным пользователям.'); return $objResponse; } } if (!($offer = $contest->GetOffer($oid))) { return $objResponse; } $contest->pid = $offer['project_id']; $comment = change_q_x(antispam(substr(rtrim(ltrim($comment, "\r\n")), 0, 5000)), false, true, 'b|br|i|p|ul|li|cut|h[1-6]{1}', false, false); if ($error = $contest->ChangeComment($cid, $comment)) { $objResponse->alert($error); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('projects')); $html = reformat(stripslashes($stop_words->replace($comment)), 30, 0, 0, 1); $original = reformat(stripslashes($comment), 30, 0, 0, 1); $objResponse->call('comment.changed', $html, $original, dateFormat('[изменен: d.m.Y | H:i]', $comments[$i]['modified'])); } return $objResponse; }
?> <span class="b-pay-tu__hidden">(<span class="b-pay-tu__decor">добавить</span>)</span><br/>ближайшее будет в <?php echo date('H:i', $next_date); ?> </span> <?php } ?> </a> </div> </li> <?php } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('users')); if (is_array($ppAds)) { foreach ($ppAds as $ppAd) { $ppAd['ad_img_file_name'] = $ppAd['photo']; $adUid = $ppAd['uid']; $adLogin = $toppay_usr[$adUid]['login']; $adLink = '/users/' . $toppay_usr[$adUid]['login'] . '/?f=6&stamp=' . $_SESSION['stamp']; $cls = "b-carusel__pic"; if ($ppAd['ad_img_file_name'] && $ppAd['ad_img_file_name'] != '/images/temp/small-pic.gif') { $adImg = '<img width=50 height=50 src="' . WDCPREFIX . '/users/' . $adLogin . '/foto/' . $ppAd['ad_img_file_name'] . '" alt="' . $adLogin . '" class="' . $cls . '" border="0" />'; } else { $adImg = '<img width=50 height=50 src="' . WDCPREFIX . '/images/user-default-small.png" class="' . $cls . '" border="0" />'; } if (is_array($pp_h[$adUid])) { $adHeader = $ppAd['ad_header'] ? $ppAd['ad_header'] : $pp_h[$adUid]['title']; $adHeaderDots = strlen(html_entity_decode($adHeader, ENT_QUOTES)) > 22;
/** * Функция генерации ленты проектов. * * @param int $num_prjs проектов на странице * @param array $projects массив проектов (результат работы projects::GetProjects()) * @param int $kind закладка * @param int $page номер страницы * @param inetger $is_ajax если функция вызвана через ajax @see JS seo_print(); * * @return HTML */ public function ShowProjects($num_prjs, $projects, $kind, $page, $filter, $is_ajax) { $this->projects = $projects; $this->num_prjs = $num_prjs; $this->kind = $this_kind = $kind; $this->page = $this_page = $page == '' ? 1 : $page; $this->pages = ceil($this->num_prjs / new_projects::PAGE_SIZE); $this->filter = $this_filter = (int) ($filter && $filter['active'] == 't'); $this->uid = $this_uid = get_uid(false); $this->pro_last = $this_pro_last = $_SESSION['pro_last']; $this->is_pro = $this_is_pro = payed::CheckPro($_SESSION['login']); $this->edit_mode = $this_edit_mode = hasPermissions('projects'); if ($this->uid) { $this->user_role = $this_user_role = $_SESSION['role']; } $outHTML = ''; $outHTML .= $this->ShowHeader(); $list = array(); if ($projects) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('projects')); foreach ($projects as $i => $project) { $this->project = $project; $list[$i] = $project; if ($this->edit_mode || $this->project['kind'] == 2 || $this->project['user_id'] == $this->uid || $this->project['offer_id'] || $this->pro_last) { $this->show_data = 1; $list[$i]['show_data'] = 1; } else { $this->show_data = 0; $list[$i]['show_data'] = 0; } $descr = $list[$i]['descr']; $descr = $list[$i]['moderator_status'] === '0' && $list[$i]['kind'] != 4 && $list[$i]['is_pro'] != 't' ? $stop_words->replace($descr) : $descr; $descr = preg_replace('/^ /', "", $descr); $descr = preg_replace("/(\n) /", "\$1", $descr); $descr = LenghtFormatEx($descr, 180); $descr = htmlspecialchars($descr, ENT_QUOTES, 'CP1251', false); $descr = reformat($descr, 50, 1, 0, 1); $descr = preg_replace("//", ' ', $descr); $list[$i]['name'] = htmlspecialchars($list[$i]['name'], ENT_QUOTES, 'CP1251', false); $list[$i]['descr'] = $descr; $list[$i]['t_is_payed'] = $this->project['payed'] && $this->project['kind'] != 2 && $this->project['kind'] != 7 && $this->project['kind'] != 4; $list[$i]['t_is_contest'] = $this->project['kind'] == 2 || $this->project['kind'] == 7; $list[$i]['t_pro_only'] = $this->project['pro_only'] == 't'; $list[$i]['t_verify_only'] = $this->project['verify_only'] == 't'; $list[$i]['t_prefer_sbr'] = $this->project['prefer_sbr'] == 't'; $list[$i]['priceby'] = $this->project['priceby']; $list[$i]['t_is_adm'] = hasPermissions('projects'); $list[$i]['t_is_ontop'] = strtotime($this->project['top_to']) >= time(); $list[$i]['unread'] = (int) $this->project['unread_p_msgs'] + (int) $this->project['unread_c_msgs'] + (int) $this->project['unread_c_prjs']; $list[$i]['t_is_proonly'] = $this->project['pro_only'] == 't' && !$_SESSION['pro_last'] && !$this->edit_mode && $this->uid != $this->project['user_id']; $list[$i]['friendly_url'] = getFriendlyURL('project', array('id' => $this->project['id'], 'name' => $this->project['name'])); $attaches = projects::GetAllAttach($this->project['id']); $attaches = !$attaches ? array() : $attaches; foreach ($attaches as $k => $a) { $a['virus'] = is_null($a['virus']) ? $a['virus'] : bindec($a['virus']); $attaches[$k] = $a; } $list[$i]['attaches'] = $this->project['attaches'] = $attaches; $list[$i]['view_cnt'] = projects::getProjectViews($this->project['id']); } } elseif ($page == 1) { $outHTML .= '<div class="project-preview">Ничего не найдено</div>'; } $kind = $this->kind; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; switch ($kind) { case 0: case 1: $rss_link = 'projects.xml'; break; case 2: $rss_link = 'competition.xml'; break; case 4: $rss_link = 'office.xml'; break; case 6: $rss_link = 'pro.xml'; break; case 5: $rss_link = 'all.xml'; break; default: $rss_link = 'all.xml'; break; } $isPrjOpened = isset($_COOKIE['isPrjOpened']) ? $_COOKIE['isPrjOpened'] : true; ob_start(); include ABS_PATH . $this->template; $out = ob_get_clean(); if ($page <= $this->pages) { $out .= '<!--data_found-->'; } return $out; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stat_collector.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php"; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $team = new teams(); $stop_words = new stop_words(hasPermissions('projects')); stat_collector::setStamp(); foreach ($f_offers as $i => $offer) { unset($user_ago); if ($offer['birthday'] !== NULL && $offer['birthday'] > "1910-01-01") { $user_ago = ElapsedYears(strtotime($offer['birthday'])); } $info_for_reg = @unserialize($offer['info_for_reg']); $offer['sf'] = abs($offer['se']) + abs($offer['sg']) + abs($offer['sl']); $offer['ef'] = abs($offer['e_plus']) + abs($offer['e_null']) + abs($offer['e_minus']); if (get_uid(false)) { $offer['is_fav'] = $team->teamsIsInFavorites($_SESSION['uid'], $offer['uid']); } $sTitle = htmlspecialchars($offer['title']); $sTitle = $offer['moderator_status'] === '0' && $offer['is_pro'] != 't' ? $stop_words->replace($sTitle) : $sTitle; $sTitle = reformat($sTitle, 35, 0, 1); $sDescr = htmlspecialchars($offer['descr']); $sDescr = $offer['moderator_status'] === '0' && $offer['is_pro'] != 't' ? $stop_words->replace($sDescr) : $sDescr; $sDescr = reformat($sDescr, 50); ?> <a name="o_<?php echo $offer['id']; ?>
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stop_words.php"; session_start(); $uid = get_uid(); $site = __paramInit('string', 'site', 'site', 'words'); if (!in_array($site, stop_words::$site_allow)) { header_location_exit('/404.php'); exit; } if (!hasPermissions('all')) { // TODO: сделать разграничение прав header_location_exit('/404.php'); exit; } $error = ''; $cmd = __paramInit('string', null, 'cmd', ''); $stop_words = new stop_words(true); if ($site == 'words') { // Подозрительные слова if ($cmd == 'go') { $sStopWords = clearInputText(__paramInit('array', null, 'words', '')); if (stop_words::updateAdminStopWords($sStopWords)) { $_SESSION['admin_stop_words_success'] = TRUE; header('Location: /siteadmin/stop_words/?site=words'); exit; } else { $error = 'Ошибка при сохранеии стоп-слов'; } } else { $sStopWords = implode(', ', stop_words::getAdminStopWords(false)); } } else {
if ($rating && $rating instanceof rating && $rating->data['user_id'] == $user->uid) { $rating_total = rating::round($rating->data['total']); } else { $rating_total = rating::round($additinfo['rating']); } $info_for_reg = @unserialize($user->info_for_reg); $reg_string = "только для <A class=\"blue\" href=\"/registration/\">зарегистрированных</A>"; if ($_SESSION['uid']) { $note = notes::GetNotes($_SESSION['uid'], null, $error); if (count($note) > 0) { foreach ($note as $key => $value) { $notes[$value['to_id']] = $value; } } } $stop_words = new stop_words(hasPermissions('users')); ?> <!-- NEW --> <div class="b-layout b-layout_pad_20 b-layout_box"> <table class="user-info-tbl"> <colgroup> <col width="170" /> <col /> <col width="20" /> </colgroup> <tbody> <tr class="first"> <th>Рейтинг:</th> <td><?php echo $rating_total;
<?php if (!defined('IS_SITE_ADMIN')) { header('Location: /404.php'); exit; } if (!hasPermissions('adm') && hasPermissions('masssending')) { exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/xajax/masssending.common.php'; $xajax->printJavascript('/xajax/'); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(true); if (!($pss = masssending::Get(null, $om, ($page - 1) * $per_page, $per_page))) { $pss = array(); } $newCnt = masssending::GetCount(masssending::OM_NEW); $acceptedCnt = masssending::GetCount(masssending::OM_ACCEPTED); $deniedCnt = masssending::GetCount(masssending::OM_DENIED); $pages = 1; if ($om == masssending::OM_NEW) { $pages = ceil($newCnt / $per_page); } elseif ($om == masssending::OM_ACCEPTED) { $pages = ceil($acceptedCnt / $per_page); } elseif ($om == masssending::OM_DENIED) { $pages = ceil($deniedCnt / $per_page); } function chel($num) { return 'человек' . ($num % 100 >= 11 && $num % 100 <= 14 || $num % 10 > 4 || !($num % 10) || $num % 10 == 1 ? '' : 'а'); }
/** * Отправить на модерирование запись какой-либо сущности * * @param int $rec_id - ID записи * @param int $rec_type - ID в admin_contents - сущность для модерирования * @param array $data - тестовые данные для автоматической проверки на стоп-слова */ static function sendToModeration($rec_id, $rec_type, $data = null) { $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($data); $GLOBALS['DB']->insert('moderation', array('rec_id' => $rec_id, 'rec_type' => $rec_type, 'stop_words_cnt' => $nStopWordsCnt)); }
/** * Изменение данных пользователя * Должны быть определены только те переменные, которые надо изменять * Перед вызовом проверить переменные класса! * * @param integer $fid id пользователя * @param array $res ошибки базы данных * @param string $eddition дополнительное условие SQL * * @return string (error) */ public function Update($fid, &$res, $eddition = '') { global $DB; if (!$fid) { return 'Пользователь не определен!'; } //Хотфикс $parnames = array('skype_as_link', 'skype_1_as_link', 'skype_2_as_link', 'skype_3_as_link', 'email_as_link', 'email_1_as_link', 'email_2_as_link', 'email_3_as_link'); $current = get_class($this); $class_vars = get_class_vars(get_class($this)); $fields = array(); $pwd_changed = false; if (!isset($this->moduser_id)) { $this->moduser_id = $fid; } $this->modified_time = 'now'; if (isset($this->photo)) { $this->photo_modified_time = 'now'; } // отправка на модерирование ----------- require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(); $aModerFields = array('uname', 'usurname', 'pname', 'spec_text', 'resume_file', 'resume', 'konk', 'company', 'status_text', 'photo', 'logo', 'compname'); $aModerUpdate = array(); $aOldValues = array(); //-------------------------------------- foreach ($class_vars as $name => $value) { if (!in_array($name, $parnames) && isset($this->{$name})) { if ($name == 'passwd') { $fields[] = $name . "= '" . self::hashPasswd($this->{$name}) . "'"; $pwd_changed = true; } else { if ($name == 'rating') { // рейтинг напрямую в users менять нельзя continue; } else { //$fields[] = $name."= '".$this->$name."'"; $fields[] = $DB->parse("{$name} = ?", $this->{$name}); // отправка на модерирование ----------- if ($this->moduser_id == $fid && in_array($name, $aModerFields)) { $aModerUpdate[] = $name; $aOldValues[$name] = $this->GetField($fid, $sGetFieldError, $name); } //-------------------------------------- } } } } $fld = implode(', ', $fields); if ($fld) { $fid = intval($fid); $sql .= $DB->parse("UPDATE {$current} SET {$fld} WHERE (uid = ?i " . $eddition . ')', $fid); if ($res = $DB->squery($sql)) { // отправка на модерирование ----------- if ($aModerUpdate) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $aModerNoWord = array('resume_file', 'photo', 'logo'); $nOrderId = $DB->val("SELECT from_id FROM orders WHERE from_id= ?i \n AND from_date <= now() AND from_date + to_date + COALESCE(freeze_to, '0')::interval >= now() \n AND NOT (freeze_from_time IS NOT NULL AND NOW() >= freeze_from_time::date AND NOW() < freeze_to_time)", $fid); foreach ($aModerUpdate as $name) { $sChangeId = $DB->val('SELECT id FROM users_change WHERE user_id = ?i AND ucolumn = ?', $fid, $name); if (!$sChangeId && ($stop_words->calculate($this->{$name}) || in_array($name, $aModerNoWord))) { if (!empty($this->{$name})) { $aData = array('user_id' => $fid, 'utable' => $current, 'ucolumn' => $name, 'old_val' => $aOldValues[$name], 'new_val' => $this->{$name}, 'moderator_status' => $nOrderId ? -2 : 0); $sChangeId = $DB->insert('users_change', $aData, 'id'); if (!$nOrderId) { $aData = array('rec_id' => $sChangeId, 'rec_type' => user_content::MODER_PROFILE, 'status' => 0); if (!in_array($name, $aModerNoWord)) { $stop_words->calculateRegexNoWords(); // устанавливаем спец режим $aData['stop_words_cnt'] = $stop_words->calculate($this->{$name}); } $DB->insert('moderation', $aData); } } } else { if (!empty($this->{$name}) && ($stop_words->calculate($this->{$name}) || in_array($name, $aModerNoWord))) { $stop_words->calculateRegexNoWords(); // устанавливаем спец режим $DB->update('users_change', array('new_val' => $this->{$name}), 'id = ?i', $sChangeId); $DB->update('moderation', array('stream_id' => null, 'stop_words_cnt' => $stop_words->calculate($this->{$name})), 'rec_id = ?i AND rec_type = ?i', $sChangeId, user_content::MODER_PROFILE); } else { $DB->query('DELETE FROM users_change WHERE id = ?i', $sChangeId); $DB->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i', $sChangeId, user_content::MODER_PROFILE); } } } } //-------------------------------------- if ($pwd_changed) { // убиваем сессии клиентов внешнего api. require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/external/session.php'; $sess = new externalSession(); $sess->destroy($fid); // сброс привязки аккаунтов фрилансера и работодателя ----- if ($aAnti = $DB->col('SELECT "login" FROM users WHERE anti_uid = ?i', $fid)) { foreach ($aAnti as $sLogin) { $GLOBALS['session']->logout($sLogin); } if ($_SESSION['uid'] == $fid) { $_SESSION['anti_uid'] = $_SESSION['anti_login'] = $_SESSION['anti_surname'] = $_SESSION['anti_name'] = ''; } $DB->query('UPDATE users SET anti_uid = NULL WHERE uid = ?i OR anti_uid = ?i', $fid, $fid); } //--------------------------------------------------------- } //если человек отписался от всех рассылок, удалить запись из users_subscribe_keys if (strpos($this->subscr, '1') === false && strlen($this->subscr) > 0) { $DB->query('DELETE FROM users_subscribe_keys WHERE uid = ?i', $fid); } } else { if ($error = $DB->error) { $error = parse_db_error($error); } } } return $error; }
/** * Редактирование сообщения в диалоге предложения к проекту. * * @param integer $user_id id пользователя * @param string $message текст сообщения * @param integer $comment_id id комментария * @param integer $po_id id ветки комментариев проекта * @param boolean $is_first первый комментарий в ветке (продложение) или комментарии * @param integer $moduser_id UID пользователя (админа), изменяющего предложение. если null - то берется $user_id * @param string $modified_reason причина редактирования * * @return string пустая строка если метод выполнен успешно или сообщение об ошибке */ public function SaveDialogueMessage($user_id, $message, $comment_id, $po_id, $is_first = false, $moduser_id = null, $modified_reason = '') { $user_id = intval($user_id); $comment_id = intval($comment_id); $message = preg_replace("/(\r\n|\r|\n){3,100}/i", "\r\n\r\n", $message); $message = rtrim(ltrim($message, "\r\n")); $message = change_q_x(substr(stripcslashes($message), 0, 1000), false, true, '', false, false); $moduser_id = $moduser_id ? $moduser_id : $user_id; if ($is_first) { $GLOBALS['DB']->query('UPDATE projects_offers_dialogue SET post_text = ?, post_date = NOW(), moduser_id = ?i, modified = now() WHERE id = ?', $message, $moduser_id, $comment_id); return $DB->error; } else { $ret = $GLOBALS['DB']->row('SELECT d.user_id, d.post_text, e.is_pro AS emp_is_pro, f.is_pro AS frl_is_pro FROM projects_offers_dialogue d LEFT JOIN projects_offers po ON po.id = d.po_id LEFT JOIN projects p ON p.id = po.project_id LEFT JOIN employer e ON e.uid = p.user_id LEFT JOIN freelancer f ON f.uid = po.user_id WHERE po_id = ? LIMIT 1', $po_id); if ($ret['user_id'] == $user_id || hasPermissions('projects')) { if ($ret['emp_is_pro'] != 't' && $ret['frl_is_pro'] != 't' && $ret['user_id'] == $moduser_id && !hasPermissions('projects') && $ret['post_text'] != $message) { // автор, не админ, не про меняет заголовок либо текст - отправить на модерирование 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($message); $sModer = ' , moderator_status =' . ($nStopWordsCnt ? ' 0 ' : ' NULL '); if ($nStopWordsCnt) { $GLOBALS['DB']->insert('moderation', array('rec_id' => $comment_id, 'rec_type' => user_content::MODER_PRJ_DIALOG, 'stop_words_cnt' => $nStopWordsCnt)); } else { $GLOBALS['DB']->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i;', $comment_id, user_content::MODER_PRJ_DIALOG); } } $GLOBALS['DB']->query("UPDATE projects_offers_dialogue SET post_text = ?, post_date = NOW(), moduser_id = ?i, modified = now(), modified_reason = ? {$sModer} WHERE id = ? AND user_id = ?", $message, $moduser_id, $modified_reason, $comment_id, $user_id); return $GLOBALS['DB']->error; } else { return 1; } } }
/** * Заполняет значения в зависимости от проекта. * * @param array $project данные проекта */ public function initProject($project) { $stop_words = new stop_words(hasPermissions('projects')); $title = $project['moderator_status'] === '0' && $project['kind'] != 4 && $project['is_pro'] != 't' ? $stop_words->replace($project['name'], 'plain', false) : $project['name']; $title50 = LenghtFormatEx(trim(strip_tags($title)), 50); $title100 = LenghtFormatEx(trim(strip_tags($title)), 100); $sp = new_projects::getSpecs($project['id']); $is_spec = $sp[0]['subcategory_id'] > 0; $prof_id = $is_spec ? $sp[0]['subcategory_id'] : $sp[0]['category_id']; $this->seo_value = new SeoValues(); $this->seo_value->initCard($prof_id, $is_spec); $this->title = sprintf(SeoText::PRJ_TITLE, $title50, $this->seo_value->getKey(1)); $this->description = sprintf(SeoText::PRJ_DESC, $title100, $this->seo_value->getKeysString(3)); $this->keywords = sprintf(SeoText::PRJ_KEY, $this->seo_value->getFTitle(1), $this->seo_value->getKeysString()); $this->footer_text = sprintf(SeoText::PRJ_TAGS, $this->seo_value->getFTitle(1), $this->seo_value->getKeysString()); }
<?php if (!defined('IN_STDF')) { header("HTTP/1.0 404 Not Found"); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/kwords.php"; $stop_words = new stop_words(hasPermissions('users')); setlocale(LC_ALL, 'ru_RU.CP1251'); $portf = new portfolio(); $prjs = $portf->GetPortf($user->uid, 'NULL', true); $prfs = new professions(); $profs = $prfs->GetAllProfessionsPortfWithoutMirrored($user->uid, "AND t.user_id IS NOT NULL"); $is_not_spec = sizeof($profs) <= 0; $first_profs = current($profs); $specs_add = professions::GetProfsAddSpec($user->uid); if ($specs_add) { $specs_add_array = array(); for ($si = 0; $si < sizeof($specs_add); $si++) { $specs_add_array[$si] = professions::GetProfNameWP($specs_add[$si], ' / '); } $specs_add_string = join(", ", $specs_add_array); } else { $specs_add_string = "Нет"; } $html_keyword_js = '<a href="/freelancers/?word=$1" class="inherit">$2</a>'; $html_keyword = preg_replace('/\\$\\d/', '%s', $html_keyword_js); if ($prjs) {
/** * Добавление предложения к проекту. * * @param integer $user_id id фрилансера * @param integer $prj_id id проекта * @param integer $cost_from цена ОТ * @param integer $cost_to цена ДО * @param integer $cost_type валюта цены * @param integer $time_from время ОТ * @param integer $time_to время ДО * @param integer $time_type тип времени (0 - часы, 1 - дни. 2 - месяцы) * @param string $text текст предложения * @param string $work1_id id 1 прикрепленной работы * @param string $work2_id id 2 прикрепленной работы * @param string $work3_id id 3 прикрепленной работы * @param string $work1_link ссылка на 1 прикрепленную работы * @param string $work2_link ссылка на 2 прикрепленную работы * @param string $work3_link ссылка на 3 прикрепленную работы * @param string $work1_name название 1 прикрепленной работы * @param string $work2_name название 2 прикрепленной работы * @param string $work3_name название 3 прикрепленной работы * @param array $work1_pict файл 1 работы * @param array $work2_pict файл 2 работы * @param array $work3_pict файл 3 работы * @param array $work1_prev_pict файл превью 1 работы * @param array $work2_prev_pict файл превью 2 работы * @param array $work3_prev_pict файл превью 3 работы * @param boolean $for_customer_only показывать предложение только работоадетлю * @param integer $dialogueId id ветки диалога * @param integer $emp_read прочитано работодателем или нет * @param boolean $prefer_sbr предпочитаю работать с СБР * @param boolean $auto 0 или ID автоответа (не обновляется) * @param integer $moduser_id UID пользователя (админа), изменяющего предложение. если null - то $user_id id фрилансера * @param string modified_reason Причина редактирования * * @return string текст ошибки в случае неуспеха */ public function AddOffer($user_id, $prj_id, $cost_from, $cost_to, $cost_type, $time_from, $time_to, $time_type, $text, $work1_id, $work2_id, $work3_id, $work1_link, $work2_link, $work3_link, $work1_name, $work2_name, $work3_name, $work1_pict, $work2_pict, $work3_pict, $work1_prev_pict, $work2_prev_pict, $work3_prev_pict, $for_customer_only = false, $dialogueId = 0, $emp_read = 0, $prefer_sbr = false, $is_color = false, $contacts = null, $payed_items = '0', $auto = 0, $moduser_id = null, $modified_reason = '') { global $DB; $obj_portfolio = new portfolio(); $obj_dialogue = new projects_offers_dialogue(); if ((int) $user_id <= 0 || (int) $prj_id <= 0) { return false; } $is_color = $is_color ? 't' : 'f'; if ($cost_from < 0 && $cost_from !== '') { $cost_from = 0; //$error = 'Начальная стоимость должна быть положительным числом.'; } if ($cost_to < 0 && $cost_to !== '') { $cost_to = 0; //$error = 'Конечная стоимость должна быть положительным числом.'; } if ($cost_to !== '' && $cost_from !== '' && ($cost_to < $cost_from && $cost_to > 0)) { $wrk = $cost_to; $cost_to = $cost_from; $cost_from = $wrk; } if ($time_from < 0 && $time_from !== '') { $time_from = 0; } if ($time_to < 0 && $time_to !== '') { $time_to = 0; } if ($time_to !== '' && $time_from !== '' && $time_to < $time_from && intval($time_to) > 0) { $wrk = $time_to; $time_to = $time_from; $time_from = $wrk; } $prj_id = intval($prj_id); $user_id = intval($user_id); $cost_from = floatval(str_replace(',', '.', str_replace(' ', '', $cost_from))); $cost_to = floatval(str_replace(',', '.', str_replace(' ', '', $cost_to))); $cost_type = intval($cost_type); $time_from = intval($time_from); $time_to = intval($time_to); $time_type = intval($time_type); $text = __paramValue('string', $text); $text = str_replace("\r\n", "\n", $text); // Cчитается как два символа -- поэтому надо заменить на один, чтобы при подсчете символов последние символы не обрезались //$text = preg_replace("/(\r\n|\r|\n){3,100}/i", "\r\n\r\n", $text);//trim(substr(change_q(trim($text), true, 90), 0, 3000)); $for_customer_only = $for_customer_only ? 't' : 'f'; $prefer_sbr = $prefer_sbr ? 't' : 'f'; $work1_id = intval($work1_id); $work2_id = intval($work2_id); $work3_id = intval($work3_id); $work1_pict = substr(change_q(trim($work1_pict), false, 25), 0, 24); $work2_pict = substr(change_q(trim($work2_pict), false, 25), 0, 24); $work3_pict = substr(change_q(trim($work3_pict), false, 25), 0, 24); $work1_prev_pict = substr(change_q(trim($work1_prev_pict), false, 30), 0, 29); $work2_prev_pict = substr(change_q(trim($work2_prev_pict), false, 30), 0, 29); $work3_prev_pict = substr(change_q(trim($work3_prev_pict), false, 30), 0, 29); $work1_pict = $work1_pict == '' && $work1_prev_pict != '' ? $work1_prev_pict : $work1_pict; $work2_pict = $work2_pict == '' && $work2_prev_pict != '' ? $work2_prev_pict : $work2_pict; $work3_pict = $work3_pict == '' && $work3_prev_pict != '' ? $work3_prev_pict : $work3_pict; $moduser_id = $moduser_id ? $moduser_id : $user_id; $payed_items = $payed_items == '1' ? $payed_items : '0'; $sql = "SELECT po.*, pb.id IS NOT NULL AS is_blocked \n FROM projects_offers AS po\n LEFT JOIN projects_offers_blocked pb ON pb.src_id = po.id\n WHERE po.project_id = '{$prj_id}' AND po.user_id = " . $user_id; $po = $DB->row($sql, $prj_id, $user_id); if ($DB->error) { return $DB->error; } $sql = 'SELECT e.is_pro FROM projects p INNER JOIN employer e ON e.uid = p.user_id WHERE p.id = ?i'; $emp_is_pro = $DB->val($sql, $prj_id); if ($po['is_blocked'] == 't' && $moduser_id == $user_id) { return 'OfferIsBlocked'; } $slashedText = addslashes($text); if ($po['id']) { if ($po['refused'] == 't' && $moduser_id == $user_id) { return 403; } $sql = ''; $sModer = ''; if ($emp_is_pro != 't' && $moduser_id == $user_id && !hasPermissions('projects') && !is_pro() && ($po['descr'] != $slashedText || $po['pict1'] != $work1_pict && !empty($work1_pict) || $po['pict2'] != $work2_pict && !empty($work2_pict) || $po['pict3'] != $work3_pict && !empty($work3_pict) || $po['prev_pict1'] != $work1_prev_pict && !empty($work1_prev_pict) || $po['prev_pict2'] != $work2_prev_pict && !empty($work2_prev_pict) || $po['prev_pict3'] != $work3_prev_pict && !empty($work3_prev_pict))) { // автор, не админ, не про меняет заголовок либо текст - отправить на модерирование 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($slashedText); $sModer = ' , moderator_status =' . ($nStopWordsCnt ? ' 0 ' : ' NULL '); if ($nStopWordsCnt) { // если есть что то подозрительное - на модерирование $DB->insert('moderation', array('rec_id' => $po['id'], 'rec_type' => user_content::MODER_PRJ_OFFERS, 'stop_words_cnt' => $nStopWordsCnt)); } else { // иначе на модерирование не отправляем $DB->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i;', $po['id'], user_content::MODER_PRJ_OFFERS); } } $sql .= "UPDATE projects_offers SET\n descr = '{$slashedText}',\n cost_from = {$cost_from},\n cost_to = {$cost_to},\n cost_type = {$cost_type},\n time_from = {$time_from},\n time_to = {$time_to},\n time_type = {$time_type},\n portf_id1 = '{$work1_id}',\n portf_id2 = '{$work2_id}',\n portf_id3 = '{$work3_id}',\n pict1 = '{$work1_pict}',\n pict2 = '{$work2_pict}',\n pict3 = '{$work3_pict}',\n prev_pict1 = '{$work1_prev_pict}',\n prev_pict2 = '{$work2_prev_pict}',\n prev_pict3 = '{$work3_prev_pict}',\n only_4_cust = '{$for_customer_only}',\n prefer_sbr = '{$prefer_sbr}',\n po_emp_read = '{$emp_read}',\n is_color = '{$is_color}',\n payed_items = B'{$payed_items}',\n moduser_id = {$moduser_id}, \n modified_reason = '{$modified_reason}',\n " . ($contacts !== null ? "offer_contacts = '{$contacts}'," : '') . "\n modified = now() \n {$sModer} \n WHERE id = {$po['id']} AND refused = false"; $this->offer_id = $po['id']; $DB->squery($sql); $error = $DB->error; if ($dialogueId) { $error .= $obj_dialogue->SaveDialogueMessage($user_id, $text, $dialogueId, 0, true, $moduser_id); $authorId = $DB->val('SELECT user_id FROM projects WHERE id = ?', $prj_id); $memBuff = new memBuff(); $memBuff->delete("prjEventsCnt{$authorId}"); } return $error; } else { $nStopWordsCnt = 0; if ($emp_is_pro != 't' && !is_pro()) { // если нужно считаем стоп-слова require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($slashedText); } include_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_offers_answers.php'; $sModVal = !is_pro() && $emp_is_pro != 't' && $nStopWordsCnt ? '0' : 'NULL'; $sql = "INSERT INTO projects_offers (project_id, user_id, cost_from, cost_to, cost_type, time_from, time_to, time_type, portf_id1, portf_id2, portf_id3, pict1, pict2, pict3, prev_pict1, prev_pict2, prev_pict3, only_4_cust, prefer_sbr, po_emp_read, descr, is_color, payed_items, offer_contacts, po_frl_read, moderator_status, auto)\n ( SELECT {$prj_id}, {$user_id}, {$cost_from}, {$cost_to}, {$cost_type}, {$time_from}, {$time_to}, {$time_type}, '{$work1_id}', '{$work2_id}', '{$work3_id}', '{$work1_pict}', '{$work2_pict}', '{$work3_pict}', '{$work1_prev_pict}', '{$work2_prev_pict}', '{$work3_prev_pict}', '{$for_customer_only}', '{$prefer_sbr}', '{$emp_read}', '{$slashedText}', '{$is_color}', B'{$payed_items}', '{$contacts}', TRUE, {$sModVal}, {$auto} \n WHERE NOT EXISTS(SELECT 1 FROM projects_blocked WHERE project_id = {$prj_id}) ); \n SELECT currval('projects_offers_id_seq');"; $po_id = $DB->val($sql); $error = $DB->error; $this->offer_id = $po_id; if ($po_id) { if ($emp_is_pro != 't' && !is_pro() && $nStopWordsCnt) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $DB->insert('moderation', array('rec_id' => $po_id, 'rec_type' => user_content::MODER_PRJ_OFFERS, 'stop_words_cnt' => $nStopWordsCnt)); } $error .= $obj_dialogue->AddDialogueMessage($po_id, $user_id, $text, true, false, true); } if (!$error) { $_SESSION['po_count'] = (int) $_SESSION['po_count'] + 1; } return $error; } }
/** * Отправка уточнения к разделу в портфолио на модерирование * * @global DB $DB * @param int $uid UID пользователя * @param int $prof_id ID профессии * @param string $text новый текст уточнения * @param string $old_text старый текст уточнения */ public function checkUserContent($uid, $prof_id, $text, $old_text) { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $choise_id = $DB->val("SELECT id FROM portf_choise_change WHERE user_id = ?i AND prof_id = ?i AND ucolumn = 'text';", $uid, $prof_id); $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($text); // сам юзер if (!$choise_id && !empty($text) && $text != "" && $nStopWordsCnt) { $nModeratorStatus = is_pro() ? -2 : 0; $sId = $DB->val("INSERT INTO portf_choise_change (user_id, prof_id, ucolumn, stop_words_cnt, old_val, moderator_status) \n VALUES (?i, ?i, 'text', ?i, ?, ?i) RETURNING id", $uid, $prof_id, $nStopWordsCnt, $old_text, $nModeratorStatus); if ($nModeratorStatus == 0) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $DB->insert('moderation', array('rec_id' => $sId, 'rec_type' => user_content::MODER_PORTF_CHOISE, 'stop_words_cnt' => $nStopWordsCnt)); } } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; if ($choise_id && !empty($text) && $text != "" && $nStopWordsCnt) { $DB->query('UPDATE portf_choise_change SET stop_words_cnt = ?i WHERE id = ?i', $nStopWordsCnt, $choise_id); $DB->query('UPDATE moderation SET stream_id = NULL, stop_words_cnt = ?i WHERE rec_id = ?i AND rec_type = ?i', $nStopWordsCnt, $choise_id, user_content::MODER_PORTF_CHOISE); } else { $DB->query('DELETE FROM portf_choise_change WHERE id = ?i; DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i', $choise_id, $choise_id, user_content::MODER_PORTF_CHOISE); } } }
function AddDialogueMessage($form) { global $session; session_start(); $objResponse = new xajaxResponse(); $offerIsBlocked = projects_offers::isOfferBlocked(false, get_uid(), $form['prj_id']); if ($offerIsBlocked) { $objResponse->alert('Ваше предложение заблокировано, вы не можете отправить это сообщение'); return $objResponse; } $prj = new projects(); $project = $prj->GetPrjCust(intval($form['prj_id'])); $is_pro = is_pro(); if ($project['pro_only'] == 't' && !$is_pro && !is_emp() && !hasPermissions('projects')) { if ($project['kind'] == 7) { if (contest::IsContestOfferExists($project['id'], get_uid(false))) { $is_pro = true; } } else { if (projects_offers::IsPrjOfferExists($project['id'], get_uid(false))) { $is_pro = true; } } } if ($project['pro_only'] == 't' && !$is_pro && $project['user_id'] != get_uid() && !hasPermissions('projects')) { $objResponse->alert('Данная функция доступна только пользователям с аккаунтом PRO.'); $objResponse->script("\$('savebtn').set('disabled', false);"); return $objResponse; } elseif ($project['verify_only'] == 't' && !($_SESSION['is_verify'] == 't') && $project['user_id'] != get_uid() && !hasPermissions('projects')) { $objResponse->alert('Данная функция доступна только верифицированным пользователям.'); $objResponse->script("\$('savebtn').set('disabled', false);"); return $objResponse; } if (!trim($form['po_text'])) { $objResponse->alert('Невозможно отправить пустое сообщение.'); $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); return $objResponse; } if (!is_emp() && $form['from'] == 'emp') { $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта работодателя.'); return $objResponse; } elseif (is_emp() && $form['from'] == 'frl') { $objResponse->script("\n \$('savebtn').set('disabled', false);\n "); $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта фрилансера.'); return $objResponse; } //Не позволяем производить действия с заблокированным проектом if (projects::CheckBlocked(intval($form['prj_id']))) { $objResponse->script("document.location.href='/projects/index.php?pid=" . intval($form['prj_id']) . "'"); } elseif (intval($_SESSION['uid'])) { $po_id = intval($form['po_id']); //$po_text = substr(change_q_x($form['po_text'], false), 0, 1000); $po_text = antispam(trim($form['po_text'])); $po_text = preg_replace("/(\r\n|\r|\n){3,100}/i", "\r\n\r\n", $po_text); $po_commentid = intval($form['po_commentid']); $user_id = get_uid(false); $user = new users(); $user_name = $user->GetName($user_id, $error); $pod = new projects_offers_dialogue(); $project_dialogue = $pod->GetDialogueForOffer($po_id); $project = $pod->GetProjectFromDialogue($po_id); if (count($project_dialogue)) { for ($i = count($project_dialogue) - 1; $i >= 0; --$i) { if ($project_dialogue[$i]['user_id'] != $user_id) { $to_user_name = $project_dialogue[$i]['login']; break; } } } if (is_emp()) { $emp_read = true; $frl_read = false; } else { $emp_read = false; $frl_read = true; } if (!$po_commentid) { $error = $pod->AddDialogueMessage($po_id, $user_id, $po_text, $frl_read, $emp_read); $last_comment = $pod->GetLastDialogueMessage($user_id, $po_id); $objResponse->script("last_commentid={$last_comment};"); $objResponse->script("edit_block[{$po_id}] = ' <span><a href=\"javascript:void(null)\" onClick=\"answer({$po_id}, {$last_comment});markRead(\\'{$po_id}\\');\" class=\"internal\">Редактировать</a></span>';"); // $objResponse->script("alert(last_commentid);"); // $objResponse->script("alert(edit_block);"); } else { $error = $pod->SaveDialogueMessage($user_id, $po_text, $po_commentid, $po_id, false); if ($error == 1) { $objResponse->alert('Вы не можете редактировать комментарий, так как на него уже ответили.'); return $objResponse; } } $po_text = rtrim(ltrim($po_text, "\r\n")); $po_text = substr(change_q_x($po_text, false, true, '', false, false), 0, 1000); $po_text = stripslashes($po_text); if ($error == '') { $sPostText = $po_text; if ($project['kind'] != 4) { $sId = $po_commentid ? $po_commentid : $last_comment; $aComment = $pod->getDialogueMessageById($sId); if ($aComment['moderator_status'] === '0') { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(hasPermissions('projects')); $sPostText = $stop_words->replace($sPostText); } } if (!$po_commentid) { $objResponse->append('po_dialogue_talk_' . $po_id, 'innerHTML', '<div style="margin-bottom:8px;font-size:100%;"><span class="' . (is_emp() ? 'emp' : 'frl') . 'name11"><a href="/users/' . get_login($user_id) . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['uname'] . ' ' . $user_name['usurname'] . '">' . $user_name['uname'] . ' ' . $user_name['usurname'] . '</a> [<a href="/users/' . $user_name['login'] . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['login'] . '">' . $user_name['login'] . '</a>]</span> <span id="po_date_' . $last_comment . '">[' . strftime('%d.%m.%Y | %H:%M', time()) . ']</span><br /><div id="po_comment_' . $last_comment . '">' . reformat($sPostText, 50, 0, 0, 1) . '</div><div id="po_comment_original_' . $last_comment . '" style="display:none;">' . str_replace(' ', ' ', reformat($po_text, 1000, 0, 1)) . '</div></div>'); // $objResponse->call('resetfld', $po_id); $objResponse->script('dialogue_count[' . $po_id . '] = ' . (count($project_dialogue) + 1)); } else { $objResponse->assign('po_comment_' . $po_commentid, 'innerHTML', reformat($sPostText, 50, 0, 0, 1)); $objResponse->assign('po_comment_original_' . $po_commentid, 'innerHTML', str_replace(' ', ' ', reformat($po_text, 1000, 0, 1))); $objResponse->assign('po_date_' . $po_commentid, 'innerHTML', dateFormat('[d.m.Y | H:i]', date('Y-m-d H:i:s'))); } $objResponse->call('answer', $po_id); if ($to_user_name && $project['id'] && $project['name'] && !$po_commentid) { /*require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php"); $smail = new smail(); if ($project['user_id'] == $user_id) { $error = $smail->NewPrjMessageOnOfferFrl($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text); } else { $error = $smail->NewPrjMessageOnOfferEmp($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text); }*/ } } else { $objResponse->alert('Ошибка сохранения.'); } } else { $objResponse->alert('Ошибка сохранения. Авторизируйтесь на сайте.'); } return $objResponse; }
/** * Привязать объявление к платному месту * * @param int $nId ID платного места из users_first_page * @param string $sError опционально. возвращает сообщение об ошибке. * если функция вернула false, но ошибки нет - значит просто нет объявления. * @return bool true - успех, false - провал */ function bindDescription($nId = 0, &$sError = '') { $bRet = false; if ($nId) { $nModeratorStatus = null; $nDescriptionId = self::GetLastUfpID($nId, $nModeratorStatus); if ($nDescriptionId) { $GLOBALS['DB']->query('UPDATE users_first_page SET ufp_description_id = ?i WHERE id = ?i', $nDescriptionId, $nId); $bRet = true; $sError = $GLOBALS['DB']->error; if (empty($sError) && !$nModeratorStatus) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $GLOBALS['DB']->query('DELETE FROM moderation WHERE rec_type = ?i AND rec_id IN (SELECT id FROM users_first_page WHERE ufp_description_id = ?i)', user_content::MODER_FIRST_PAGE, $nDescriptionId); $aDescr = firstpage::GetFullDescription($nId); if (!empty($aDescr['title']) || !empty($aDescr['descr']) || !empty($aDescr['full_descr']) || !empty($aDescr['portfolio'])) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(true); $nStopWordsCnt = $stop_words->calculate($aDescr['title'], $aDescr['descr'], $aDescr['full_descr']); $GLOBALS['DB']->insert('moderation', array('rec_id' => $nId, 'rec_type' => user_content::MODER_FIRST_PAGE, 'stop_words_cnt' => $nStopWordsCnt)); } } } } return $bRet; }
function addUserTopNew($ad) { global $DB; $insert = array(); $insert['uid'] = $ad['uid']; $insert['type_place'] = $ad['type_place']; if ($ad['ad_header']) { $insert['ad_header'] = $ad['ad_header']; } if ($ad['ad_text']) { $insert['ad_text'] = $ad['ad_text']; } if ($ad['ad_img_file_name']) { $insert['ad_img_file_name'] = $ad['ad_img_file_name']; } $DB->setCheckAutoSlashes(false); $nId = $DB->insert('paid_places', $insert, 'id'); if ($nId) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(true); $nStopWordsCnt = $stop_words->calculate($ad['ad_header'], $ad['ad_text']); $DB->insert('moderation', array('rec_id' => $nId, 'rec_type' => user_content::MODER_CAROUSEL, 'stop_words_cnt' => $nStopWordsCnt)); } $DB->setCheckAutoSlashes(true); return !empty($nId); }
/** * Обновление предложения * * @param integer $fid ИД обновляемого предложения * @param array $update Переменная типа array(name=>value) где name - поле таблицы, value - значение для записи (@see Таблица freelance_offers) * @return boolean */ public function Update($fid, $update) { global $DB; if (!hasPermissions('projects') && !is_pro()) { // автор, не админ, не про $update['moderator_status'] = 0; 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' => $fid, 'rec_type' => user_content::MODER_SDELAU, 'stop_words_cnt' => $nStopWordsCnt)); } if (isset($update['is_blocked']) && $update['is_blocked']) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $DB->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i;', $fid, user_content::MODER_SDELAU); } $DB->update("freelance_offers", $update, "id = ?i {$this->access}", $fid); return true; }
/** * Отправить услугу на модерацию. * * @param int $id * @param array $data */ public function sendToModeration($id, $data, $status = 0) { $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($data['title'], $data['description'], $data['requirement']); $this->db()->insert($this->TABLE_MODERATION, array('rec_id' => $id, 'rec_type' => 22, 'stop_words_cnt' => $nStopWordsCnt, 'status' => $status)); }
/** * Сохраняет изменения ключевые слова пользователя для модерирование * * @param int $uid UID Пользователя * @param int $prof ID Профессии * @param array $old_ids массив ID старых ключевых слов * @param array $new_ids массив ID новых ключевых слов * @param integer $moduser_id UID изменяющего пользователя (админа). если null - то берется $uid * @param string $keys строка с ключевыми словами через запятую * @return bool true - успех, false - провал */ function moderUserKeys($uid = 0, $prof = 0, $old_ids = array(), $new_ids = array(), $moduser_id = null, $keys = '') { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $bRet = true; $moduser_id = $moduser_id ? $moduser_id : $uid; $new_ids = $new_ids ? $new_ids : array(); if ($uid && $uid == $moduser_id && !hasPermissions('users') && $prof && (array_diff($new_ids, $old_ids) || array_diff($old_ids, $new_ids))) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $sId = $GLOBALS['DB']->val("SELECT id FROM portf_choise_change \n WHERE user_id = ?i AND prof_id = ?i AND ucolumn = 'kwords'", $uid, $prof); $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($keys); if (!$sId && $new_ids && $nStopWordsCnt) { $aData = array('user_id' => $uid, 'prof_id' => $prof, 'ucolumn' => 'kwords', 'stop_words_cnt' => $nStopWordsCnt, 'old_val' => implode(',', $old_ids), 'moderator_status' => is_pro() ? -2 : 0); $sId = $GLOBALS['DB']->insert('portf_choise_change', $aData, 'id'); $bRet = empty($GLOBALS['DB']->error); if ($bRet && !is_pro()) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $GLOBALS['DB']->insert('moderation', array('rec_id' => $sId, 'rec_type' => user_content::MODER_PORTF_CHOISE, 'stop_words_cnt' => $nStopWordsCnt)); } } elseif ($sId && $new_ids && $nStopWordsCnt) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $GLOBALS['DB']->query('UPDATE portf_choise_change SET stop_words_cnt = ?i WHERE id = ?i', $nStopWordsCnt, $sId); $GLOBALS['DB']->query('UPDATE moderation SET stream_id = NULL, stop_words_cnt = ?i WHERE rec_id = ?i AND rec_type = ?i', $nStopWordsCnt, $sId, user_content::MODER_PORTF_CHOISE); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $GLOBALS['DB']->query('DELETE FROM portf_choise_change WHERE id = ?i', $sId); $GLOBALS['DB']->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i', $sId, user_content::MODER_PORTF_CHOISE); } } elseif ($uid && $moduser_id && $uid != $moduser_id && hasPermissions('users') && $prof) { $sId = $GLOBALS['DB']->val("SELECT id FROM portf_choise_change \n WHERE user_id = ?i AND prof_id = ?i AND ucolumn = 'kwords'", $uid, $prof); if ($sId) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $GLOBALS['DB']->query('DELETE FROM portf_choise_change WHERE id = ?i', $sId); $GLOBALS['DB']->query('DELETE FROM moderation WHERE rec_id = ?i AND rec_type = ?i', $sId, user_content::MODER_PORTF_CHOISE); } } return $bRet; }
if ($rating && $rating instanceof rating && $rating->data['user_id'] == $user->uid) { $rating_total = rating::round($rating->data['total']); } else { $rating_total = rating::round($additinfo['rating']); } $info_for_reg = unserialize($user->info_for_reg); $reg_string = 'только для <A class="blue" href="/registration/">зарегистрированных</A>'; if ($_SESSION['uid']) { $note = notes::GetNotes($_SESSION['uid'], null, $error); if (count($note) > 0) { foreach ($note as $key => $value) { $notes[$value['to_id']] = $value; } } } $stop_words = new stop_words(hasPermissions('users')); ?> <!-- NEW --> <!-- NEW --> <script type="text/javascript"> window.addEvent('domready', function() { $$('.izbr-choose li a').addEvent('click', function(){ this.getParent('li').getParent('.izbr-choose').getElements('li').removeClass('active'); this.getParent('li').addClass('active'); return false; }); } );
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/mess_folders.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/messages.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/drafts.php"; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $stop_words = new stop_words(false); $is_pro1 = payed::CheckPro($user->login); $cf = new mess_folders(); $cf->from_id = get_uid(); $folders = $cf->GetAll(); $msgs = new messages(); $users_folders = $msgs->GetContactFolders(get_uid(), $dlg_user, $err); $isNeedUseCaptcha = $msgs->isNeedUseCaptcha(get_uid(false)); if ($isNeedUseCaptcha) { $SESSION['need_captcha_messages'] = 1; } if ($draft_id) { $draft = drafts::getDraft($draft_id, get_uid(), 2); if ($draft['msg']) { $msg = $draft['msg']; } } $userNotBeSpam = array_merge($GLOBALS['usersNotBeIgnored'], $GLOBALS['ourUserLoginsInCatalog']); require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/contacts.common.php"; $xajax->printJavascript('/xajax/'); ?> <script type="text/javascript"> <!-- var inner = false;