本文整理汇总了PHP中users::GetField方法的典型用法代码示例。如果您正苦于以下问题:PHP users::GetField方法的具体用法?PHP users::GetField怎么用?PHP users::GetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users
的用法示例。
在下文中一共展示了users::GetField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
function processForm($aFormValues)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
global $session;
session_start();
get_uid(false);
$objResponse = new xajaxResponse();
//$pname = change_q($_POST['name'], true);
$msg = change_q($aFormValues['calltext'], false, 0);
//$mail = trim($_POST['mail']);
//$attach = $_FILES['attach'];
$login = $_SESSION['login'] ? $_SESSION['login'] : 'Anonymous';
$tn = 0;
$f_name = '';
$uid = get_uid(false);
$usr = new users($uid);
$pname = $_SESSION['name'] . ' ' . $_SESSION['surname'];
$mail = $usr->GetField($uid, $error, 'email');
if (!$msg) {
$alert['msg'] = 'Поле заполнено некорректно';
$error_flag = 1;
}
if (!$error_flag) {
$error .= blogs::NewThread($uid, 3, 0, $name, $msg, $f_name, getRemoteIP(), 1, $tn);
}
if (!$error && !$error_flag) {
$sm = new smail();
$error .= $sm->NewFeedbackPost($pname, $msg, $mail, $_SESSION['login'], 4);
$msg = $name = $mail = '';
$info_msg = '<br><center><table class="view_info" border="0" cellpadding="2" cellspacing="0"><tbody><tr class="n_qpr"><td height="20"><img src="/images/ico_ok.gif" alt="" border="0" height="18" width="19"></td><td nowrap>Ваше сообщение отправлено</td></tr></tbody></table>';
$objResponse->assign('calltext', 'value', '');
$objResponse->assign('cbok', 'innerHTML', $info_msg);
//$objResponse->assign("submitButton","disabled",false);
$objResponse->assign('submitButton', 'value', 'Отправить');
}
return $objResponse;
}
示例2: SendMailToContacts
/**
* Отправляет email контакам из /siteadmin/contacts/. Вызвается из hourly.php.
*
* @return string возможная ошибка
*/
public function SendMailToContacts()
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/contacts.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$mails = contacts::GetMails();
if ($mails) {
$fromSave = $this->from;
foreach ($mails as $mail) {
$user = new users();
$user->GetUser($user->GetField($mail['user_id'], $ee, 'login'));
$this->subject = $mail['subject'];
$attaches = array();
if ($mail['attaches']) {
$files = preg_split('/,/', $mail['attaches']);
foreach ($files as $a) {
$attaches[] = new CFile('users/' . substr($user->login, 0, 2) . '/' . $user->login . '/upload/' . $a);
}
$attaches = $this->CreateAttach($attaches);
}
$contact_ids = preg_split('/,/', $mail['contact_ids']);
foreach ($contact_ids as $contact_id) {
$contact = contacts::getContactInfo($contact_id);
if ($contact['emails']) {
$msg_text = $mail['message'];
$msg_text = preg_replace('/%CONTACT_NAME%/', $contact['name'], $msg_text);
$msg_text = preg_replace('/%CONTACT_SURNAME%/', $contact['surname'], $msg_text);
$msg_text = preg_replace('/%CONTACT_COMPANY%/', $contact['company'], $msg_text);
foreach ($contact['emails'] as $email) {
$this->from = 'ekaterina@FL.ru';
$this->recipient = $contact['name'] . ' <' . $email . '>';
$this->message = $msg_text;
$this->SmtpMail('text/html', $attaches);
}
}
}
contacts::DeleteMail($mail['id']);
}
$this->from = $fromSave;
}
return '';
}
示例3: DeleteMail
/**
* Удаление рассылки
*
* @param integer $id идентификатор рассылки
*/
function DeleteMail($id)
{
global $DB;
$sql = "SELECT attaches,user_id FROM contacts_mails WHERE id=?i";
$mail = $DB->row($sql, $id);
$user = new users();
$user->GetUser($user->GetField($mail['user_id'], $ee, 'login'));
$m_files = preg_split("/,/", $mail['attaches']);
if ($m_files) {
foreach ($m_files as $a) {
$f = new CFile();
$f->Delete(0, $user->login . '/', $a);
}
}
$sql = "DELETE FROM contacts_mails WHERE id=?i";
$DB->query($sql, $id);
}
示例4: getLastIps
/**
* Возвращает список последних IP с которых заходил пользователь.
*
* @param int $sUid UID пользователя
* @param int $nCount опционально. количество, 0 - не ограничено
*
* @return object xajaxResponse
*/
function getLastIps($sUid = '', $nCount = 10)
{
session_start();
$objResponse = new xajaxResponse();
if (hasPermissions('users')) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$sTable = '<table id="t_last_ten" class="notice-table">';
$user = new users();
$user->GetUserByUID($sUid);
$objResponse->script('adminLogOverlayClose();');
if ($aRows = $user->getLastIps($sUid, $nCount)) {
$nCount = 1;
foreach ($aRows as $aOne) {
$sTable .= '<tr>
<td class="cell-number">' . $nCount . '.</td>
<td><a href="https://www.nic.ru/whois/?query=' . long2ip($aOne['ip']) . '" target="_blank">' . long2ip($aOne['ip']) . '</a></td>
<td class="cell-date">' . date('d.m.Y H:i:s', strtotime($aOne['date'])) . '</td>
</tr>';
++$nCount;
}
} else {
$sIp = $user->GetField($sUid, $error, 'last_ip');
$sTable .= '<tr>
<td class="cell-number">1.</td>
<td><a href="https://www.nic.ru/whois/?query=' . $sIp . '" target="_blank">' . $sIp . '</a></td>
<td class="cell-date">' . date('d.m.Y H:i:s', strtotime($user->last_time)) . '</td>
</tr>';
}
$sTable .= '</table>';
$objResponse->assign('a_last_ten', 'href', '/users/' . $user->login);
$objResponse->assign('s_last_ten', 'innerHTML', $user->uname . ' ' . $user->usurname . ' [' . $user->login . ']');
$objResponse->assign('w_last_ten', 'innerHTML', 'IP');
$objResponse->assign('d_last_ten', 'innerHTML', $sTable);
$objResponse->script("\$('ov-notice5').setStyle('display', '');");
$objResponse->script('adjustLastTenHTML();');
}
return $objResponse;
}
示例5: CFile
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/static_compress.php';
session_start();
$uid = $_SESSION['WUID'];
if (!$uid) {
return false;
}
$type = __paramInit('string', 'type', null, null);
switch ($type) {
case 'logo_company':
if (is_array($_FILES['logo_attach']) && $_SESSION['RUID']) {
$img = new CFile($_FILES['logo_attach']);
$img->disable_animate = true;
if ($img->size > 0) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$user = new users();
$login = $user->GetField($_SESSION['RUID'], $error, 'login');
$dir = 'users/' . substr($login, 0, 2) . '/' . $login . '/';
$img->max_size = 51200;
$img->proportional = 1;
$img->topfill = 1;
$img->server_root = 1;
$dir .= '/logo/';
$pictname = $img->MoveUploadedFile($dir);
if (!isNulArray($img->error)) {
if (is_array($img->error)) {
$err = $img->error[0];
} else {
$err = $img->error;
}
$error = true;
$pictname = $prevname = '';
示例6: array
if ($prj['id'] == $prj_id && $_POST['emp_id'] == $prj['user_id']) {
$attaches = array();
if (is_array($_FILES['attach']) && !empty($_FILES['attach']['name'])) {
foreach ($_FILES['attach']['name'] as $key => $v) {
if (!$_FILES['attach']['name'][$key]) {
continue;
}
$attaches[] = new CFile(array('name' => $_FILES['attach']['name'][$key], 'type' => $_FILES['attach']['type'][$key], 'tmp_name' => $_FILES['attach']['tmp_name'][$key], 'error' => $_FILES['attach']['error'][$key], 'size' => $_FILES['attach']['size'][$key]));
}
}
if ($attaches) {
$files = array();
$error = false;
$err = '';
$emp = new users();
$emp->GetUser($emp->GetField($prj['user_id'], $ee, 'login'));
$dir = $emp->login;
foreach ($attaches as $attach) {
$attach->max_size = 2097152;
$attach->proportional = 1;
$fname = $attach->MoveUploadedFile($dir . "/upload");
if ($attach->error) {
$err = $attach->error;
$error = true;
if ($attach->size > $attach->max_size) {
$err = 'Недопустимый размер файла';
}
} else {
if (!in_array($attach->getext(), array_merge($GLOBALS['graf_array'], array('doc', 'docx', 'txt', 'xls', 'xlsx')))) {
$err = 'Недопустимый тип файла';
$error = true;
示例7: isNeedUseCaptcha
/**
* Нужно ли использовать капчу для защиты от рассылки спама.
*
* @param int $uid ID пользователя
*
* @return bool true - да, false - нет
*/
public function isNeedUseCaptcha($uid)
{
global $DB, $ourUserLogins;
$ret = null;
$user = new users();
$login = $user->GetField($uid, $ee, 'login');
foreach ($ourUserLogins as $ourUserLogin) {
if (strtolower($login) == strtolower($ourUserLogin)) {
$ret = false;
}
}
if (hasGroupPermissions('administrator') || hasGroupPermissions('moderator')) {
$ret = false;
}
if ($ret === null) {
$sql = 'SELECT EXTRACT(EPOCH FROM date) as date, count FROM messages_sendlog WHERE uid=?i';
$log = $DB->row($sql, $uid);
if ($log) {
$spam_msg_count = account::checkPayOperation($uid) ? self::SPAM_CAPTCHA_MSG_COUNT_PAY : self::SPAM_CAPTCHA_MSG_COUNT;
if ($log['count'] >= $spam_msg_count && $log['date'] + self::SPAM_CAPTCHA_TIME_SHOW > time()) {
$ret = true;
} else {
$ret = false;
}
} else {
$ret = false;
}
}
return $ret;
}
示例8: users
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/bill/widget/tpl.last_history.php";
?>
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/bill/widget/tpl.right_help.php";
?>
<span class="walletRightBlock">
<?php
$wallet = $bill->wallet;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
$u = new users();
$u->GetUserByUID(get_uid('false'));
?>
<?php
if ($u->GetField(get_uid(false), $e, 'is_pro_auto_prolong', false) == 't' && WalletTypes::checkWallet($wallet)) {
?>
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/bill/widget/tpl.right_wallet.php";
?>
<?php
}
?>
</span>
示例9: chooseStream
/**
* Захват/перехват потока пользователем
*
* @param int $content_id идентификатор сущности из admin_contents
* @param string $stream_id идентификатор потока
* @param int $user_id UID пользователя
* @return string идентификатор захваченного потока - успех, пустая строка - провал
*/
function chooseStream($content_id = 0, $stream_id = '', $user_id = 0)
{
$sStreamId = '';
if ($this->content_streams === false || $this->first_update === false || $this->last_update === false) {
$this->_initStreams();
} else {
if (isset($this->content_streams[$content_id]) && count($this->content_streams[$content_id])) {
$bChoose = false;
foreach ($this->content_streams[$content_id] as $sKey => $aOne) {
if ($aOne['stream_id'] == $stream_id) {
if ($aOne['admin_id'] == $user_id) {
// пользователь пытается захватить свой же поток
$sStreamId = 'user_id';
} else {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$users = new users();
$login = $users->GetField($user_id, $error, 'login');
if (empty($aOne['admin_id'])) {
// захват свободного потока
$bChoose = true;
$aOne['resolve_cnt'] = 0;
}
$aOne['admin_id'] = $user_id;
$aOne['admin_name'] = iconv('CP1251', 'UTF-8', $login);
$aOne['time'] = time();
$this->content_streams[$content_id][$sKey] = $aOne;
$sStreamId = $stream_id;
}
break;
}
}
if ($bChoose) {
$stream_num = $this->_countChosenStreams($content_id, $stream_id);
if ($stream_num !== false) {
$nLimit = $content_id == self::MODER_MSSAGES ? self::MESSAGES_PER_PAGE : self::CONTENTS_PER_PAGE;
$this->chooseContent($content_id, $stream_id, $stream_num, $nLimit);
$memBuff = new memBuff();
$memBuff->delete('ucs_streams_queue');
}
}
}
$this->last_update = time();
$this->_saveStreams();
}
return $sStreamId;
}
示例10: DeleteMsg
/**
* Полностью удалить сообщение.
*
* @param integer $fid ID Пользователя
* @param integer $id ИД блога
* @param integer $group Возвращает раздел для тем
* @param integer $base Возвращает "базу" для темы
* @param integer $thread_id Возвращает идентификатор сообщения
* @param integer $page Возвращает страницу
* @param string $msg Возвращает текст сообщения
* @param integer $mod Имеет ли юзер права на удаление
*
* @return string Возвращает сообщение об ошибке
*/
public function DeleteMsg($fid, $id, &$group, &$base, &$thread_id, &$page, &$msg, $mod = 1)
{
global $DB;
$curname = get_class($this);
$sql = "SELECT fromuser_id, item_id, reply_to FROM {$curname} WHERE id=?i";
$res = $DB->query($sql, $id);
list($from_id, $thread_id, $reply) = pg_fetch_row($res);
if ($from_id != $fid) {
$addit = "(id = '{$id}' AND reply_to = (SELECT id FROM {$curname} WHERE id = '{$reply}' AND fromuser_id='{$fid}')) OR (id = '{$id}' AND portf_id = (SELECT id FROM portfolio WHERE id = '{$thread_id}' AND user_id='{$fid}'))";
} else {
$addit = "id = '{$id}' AND fromuser_id = '{$fid}'";
}
if (!$mod) {
$addit = "id = '{$id}'";
}
$sql = "DELETE FROM {$curname} WHERE ({$addit}) RETURNING attach, small";
$res = $DB->query($sql);
list($attach, $small) = pg_fetch_row($res);
$error = $DB->error;
if ($attach) {
$user = new users();
$dir = $user->GetField($from_id, $error, 'login');
$file = new CFile();
$file->Delete(0, 'users/' . substr($dir, 0, 2) . '/' . $dir . '/upload/', $attach);
if ($small == 2) {
$file->Delete(0, 'users/' . substr($dir, 0, 2) . '/' . $dir . '/upload/', 'sm_' . $attach);
}
}
return $error;
}
示例11: loadMainDataFrl
/**
* Информация по покупкам для фрилансеров.
*
* «Подключенные» – активные услуги, действующие в данный момент; (active)
* «Вы недавно покупали» – уже неактивные услуги, которыми юзер пользовался в ближайшие полгода; (lately)
* «Вы еще не использовали» – услуги, которыми не пользовались свыше полугода (с даты истечения срока действия прошло больше 6 месяцев); (notused)
*/
public function loadMainDataFrl()
{
$sql = "\n WITH active_service AS (\n SELECT MAX(from_date + to_date) as d, 'pro' as service, 1 as sort \n FROM orders WHERE from_id = ?i AND from_date + to_date > now()\n UNION\n SELECT MAX(date_create) as d, 'pay_place' as service, 2 as sort \n FROM paid_places WHERE uid = ?i AND is_done = 0\n UNION\n -- сначала находим сроки окончания для всех активных объявлений\n -- а потом минимальный из них\n SELECT MIN(d) as d, 'first_page' as service, 3 as sort\n FROM (\n SELECT MAX(from_date + to_date) as d\n FROM users_first_page\n WHERE user_id = ?i AND from_date + to_date > now() AND payed = true\n GROUP BY profession\n ) as ufp\n ), lately_service AS (\n SELECT MAX(from_date + to_date) as d, 'pro' as service, 1 as sort \n FROM orders WHERE from_id = ?i AND (from_date + to_date + interval '6 month') > NOW() \n UNION\n SELECT MAX(posted_time) as d, 'massending' as service, 1 as sort \n FROM mass_sending WHERE user_id = ?i AND (posted_time + interval '6 month') > NOW() \n UNION\n SELECT MAX(date_create) as d, 'pay_place' as service, 2 as sort \n FROM paid_places WHERE uid = ?i AND (date_create + interval '6 month') > NOW()\n UNION\n SELECT MAX(from_date + to_date) as d, 'first_page' as service, 3 as sort \n FROM users_first_page where user_id = ?i AND payed = true AND (from_date + to_date + interval '6 month') > NOW()\t\n )\n SELECT active_service.*, 'active' as type FROM active_service\n UNION\n SELECT lately_service.*, 'lately' as type FROM lately_service\n ORDER BY type, sort ASC\n ";
$services = $this->_db->rows($sql, $this->user['uid'], $this->user['uid'], $this->user['uid'], $this->user['uid'], $this->user['uid'], $this->user['uid'], $this->user['uid']);
foreach ($services as $service) {
if ($service['d'] == null || isset($result[$service['service']])) {
continue;
}
$service['expired'] = self::expiredTime($service['d']);
if ($service['service'] == 'pro') {
// Обновляем сессию
if ($service['type'] == 'active') {
$_SESSION['pro_last'] = payed::ProLast($this->user['login']);
$_SESSION['pro_last'] = $_SESSION['pro_last']['is_freezed'] ? false : $_SESSION['pro_last']['cnt'];
if ($_SESSION['pro_last']['is_freezed']) {
$_SESSION['payed_to'] = $_SESSION['pro_last']['cnt'];
}
}
$user = new users();
$service['is_auto'] = $user->GetField($this->user['uid'], $e, 'is_pro_auto_prolong', false);
$service['auto'] = $service['is_auto'];
$service['last_operation'] = $this->getLastOperation($service['service']);
// Тестовый не может быть куплен второй раз
if ($service['last_operation']['op_code'] == 47) {
$service['last_operation']['op_code'] = 48;
}
}
$result[$service['service']] = $service;
}
foreach (self::$frl_default_service as $type => $val) {
if (!isset($result[$type])) {
$result[$type] = array('type' => 'notused', 'service' => $type);
}
}
$this->services = $result;
return $this->services;
}
示例12: GetThread
/**
* Инициализирует дерево сообщений в данной теме
*
* @param integer $thread_id идентификатор темы
* @param string $error сообщение об ошибке
* @param integer $mod имеет ли текущий юзер права на просмотр данного раздела [1 - да, 0 - нет]
* @param integer $fid UID текущего юзера
* @return array [название раздела блогов, идентификатор раздела, идентификатор "базы"]
*/
function GetThread($thread_id, &$error, $mod = 1, $fid = 0)
{
global $DB;
$sql = "SELECT id_gr, base, is_private::int, close_comments::int, fav_cnt FROM blogs_themes WHERE thread_id='{$thread_id}'\n UNION ALL\n SELECT id_gr, base, null::int as is_private, null::int as close_comments, null as fav_cnt FROM blogs_themes_old WHERE thread_id='{$thread_id}'";
$res = $DB->row($sql);
if (!$res) {
$error = "Группа не найдена или недоступна.";
return 0;
}
$error = $DB->error;
if ($fid) {
$r = $DB->row("SELECT last_view, status FROM blogs_themes_watch WHERE user_id = ? AND theme_id = ?", $fid, $thread_id);
if ($r['last_view']) {
$new = $DB->parse(", (? < post_time) AS new, ?i AS read_comments", $r['last_view'], (int) $r['status']);
}
}
$this->id_gr = $res['id_gr'];
$this->base = $res['base'];
$this->is_private = $res['is_private'];
$this->close_comments = $res['close_comments'];
$this->fav_cnt = $res['fav_cnt'];
$name = $this->GetGroupName($this->id_gr, $this->base, $mod);
if (!$name) {
$error = "Группа не найдена или недоступна.";
return 0;
}
$sql = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tblogs_msgs.id, deleted_reason, fromuser_id, reply_to, post_time, msgtext, yt_link, blogs_msgs.title, modified, modified_id, deluser_id, deleted,\n\t\t\t\t\t\tusers.uname, users.usurname, users.login, users.photo, users.is_pro_test, users.role, users.is_chuck, users.is_team,\n\t\t\t\t\t\tusers.warn, users.is_banned, users.ban_where, users.is_pro as payed, users.is_pro_test as payed_test, users.reg_date, freelancer.spec, -- p.name as prof_name,\n\t\t\t\t\t\tadmins.uname AS modername, admins.usurname AS modersurname, admins.login AS moderlogin,\n\t\t\t\t\t\tblogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple, sbr_meta.completed_cnt, moderator_status {$new}\n\t\t\t\t\tFROM blogs_msgs\n\t\t\t\t\tINNER JOIN users ON fromuser_id=users.uid\n\t\t\t\t\tLEFT JOIN freelancer ON fromuser_id=freelancer.uid\n\t\t\t\t\tLEFT JOIN users AS admins ON moderator_status = admins.uid\n LEFT JOIN sbr_meta ON sbr_meta.user_id=fromuser_id\n\t\t\t\t\t-- LEFT JOIN professions p ON p.id = freelancer.spec_orig\n\t\t\t\t\tLEFT JOIN blogs_poll ON blogs_poll.thread_id = blogs_msgs.thread_id\n\t\t\t\t\t{$join}\n\t\t\t\t\tWHERE blogs_msgs.thread_id= ?i ORDER BY reply_to, post_time\n\t\t\t\t";
$this->thread = $DB->rows($sql, $thread_id);
$error .= $DB->error;
if ($error) {
$error = parse_db_error($error);
} else {
$this->msg_num = count($this->thread);
if ($this->msg_num > 0) {
// аттач файлов
$this->AddAttach($this->thread);
// заблокирован ли топик
if ($fid && $fid == $_SESSION['uid']) {
$role = $_SESSION['role'];
} else {
if ($fid) {
$users = new users();
$role = $users->GetField($fid, $error, 'role');
} else {
$role = 0;
}
}
$is_moder = hasPermissions('blogs');
if ($is_moder) {
$row = $DB->row("SELECT blogs_blocked.admin, blogs_blocked.reason, blogs_blocked.blocked_time, users.login as admin_login, users.uname as admin_name, users.usurname as admin_uname FROM blogs_blocked JOIN users ON blogs_blocked.admin = users.uid WHERE thread_id = ?i", $thread_id);
} else {
$row = $DB->row("SELECT admin, reason, blocked_time FROM blogs_blocked WHERE thread_id = ?i", $thread_id);
}
if ($row) {
$this->is_blocked = 1;
$this->thread[$this->msg_num - 1] = array_merge($this->thread[$this->msg_num - 1], $row);
} else {
$this->is_blocked = 0;
}
if ($this->thread[$this->msg_num - 1]['poll_question']) {
$r = $DB->rows("SELECT * FROM blogs_poll_answers WHERE thread_id = '{$thread_id}' ORDER BY id", $thread_id);
$this->thread[$this->msg_num - 1]['poll'] = $r;
}
// читаем тред
$this->SetVars($this->msg_num - 1);
if ($mod) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
$user = new users();
$user->GetUser($this->login);
if ($user->is_banned && $user->ban_where <= 1) {
$error = "Тред не найден или недоступен.";
return 0;
}
}
// доступ
if ($this->is_blocked && !($fid && $fid == $this->fromuser_id || $is_moder)) {
$error = "Тред заблокирован администрацией";
return 0;
}
}
}
return array($name, $this->id_gr, $this->base);
}
示例13: setViewed
function setViewed($type)
{
$users = new users();
$splash_show = $users->GetField(get_uid(), $error, 'splash_show');
$splash_show = $splash_show | $type;
$users->splash_show = $splash_show;
$users->update($_SESSION['uid'], $error);
$_SESSION['splash_show'] = $splash_show;
}
示例14: HideOpin
/**
* Посылает сообщение пользователю о том, что отзыв, оставленный ему удален
*
* @param string $fromuser_login login пользователя, который написал отзыв
*
* @return mixed
*/
function HideOpin($fromuser_login)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php";
$usr = new users();
$usr->GetUser($fromuser_login);
$fromuser_id = $usr->uid;
global $DB;
$sql = "SELECT touser_id, rating FROM opinions WHERE fromuser_id = ?";
$res = $DB->query($sql, $fromuser_id);
while (list($touser_id, $raiting) = @pg_fetch_row($res)) {
$sub = $usr->GetField($touser_id, $error, "subscr");
}
}
示例15: SendComplain
/**
* Добавляет жалобу на проект.
*
* @param integer $project_id ID проекта
* @param integer $user_id ID пользователя
* @param integer $type тип жалобы
* @param string $msg текст жалобы
* @param string $files имена загруженных скриншотов
*
* @return xajax responce
*/
function SendComplain($project_id, $type, $msg, $files)
{
global $session;
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_complains.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/userecho.php';
$objResponse = new xajaxResponse();
$project_id = (int) $project_id;
$user_id = get_uid(false);
$type = (int) $type;
$msg = __paramValue('htmltext', $msg);
$error = false;
$project = new projects();
$prj = $project->GetPrj(0, $project_id, 1);
$file_list = array();
if ($files != '') {
$files = uploader::sgetFiles($files);
if (!empty($files)) {
$emp = new users();
$emp->GetUser($emp->GetField($prj['user_id'], $ee, 'login'));
$dir = 'users/' . substr($emp->login, 0, 2) . '/' . $emp->login . '/upload/';
foreach ($files as $file) {
$copy = uploader::remoteCopy($file['id'], 'file_projects', $dir);
$rfiles[] = $copy->name;
$file_list[] = array('name' => $copy->original_name, 'link' => WDCPREFIX . '/' . $copy->path . $copy->name);
}
$files = implode(',', $rfiles);
} else {
$files = '';
}
}
if (!$files) {
$files = '';
}
if (projects::IsHaveComplainType($project_id, $user_id, $type)) {
// Уже жаловался
return $objResponse;
}
$projects_complains = new projects_complains();
$type_name = $projects_complains->GetComplainType($type);
$project_url = getAbsUrl(getFriendlyURL('project', $project_id));
$is_moder = $projects_complains->isComplainTypeModer($type);
if ($is_moder) {
$userEcho = new UserEcho();
$topic_message = $userEcho->constructMessage($project_url, $prj['name'], $msg, $file_list);
$topicUrl = $userEcho->newTopicComplain($type_name, $topic_message, $file_list);
if ($topicUrl) {
messages::sendProjectComplain($user_id, $project_url, $prj['name'], $msg, $topicUrl);
} else {
$error = true;
}
}
if (!$error) {
$error = projects::AddComplain($project_id, $user_id, $type, $msg, $files, $is_moder && $topicUrl);
}
if ($error) {
$objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
if ($is_moder) {
$objResponse->script("\$('abuse-cause-error').removeClass('b-layout__txt_hide'); abuseResetSelection();");
} else {
$objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_rectangle_color_disable')");
}
} else {
$upl = array('umask' => uploader::umask('prj_abuse'), 'validation' => array('allowedExtensions' => array('jpg', 'gif', 'png', 'jpeg'), 'restrictedExtensions' => array()), 'text' => array('uploadButton' => iconv('cp1251', 'utf8', 'Прикрепить файлы')));
$objResponse->script("\n \$('abuse{$type}').addClass('abuse-checked');\n \$('abuse{$type}').getChildren().each(function(el) { \$(el).addClass('abuse-checked'); });\n ");
$objResponse->script("uploader.create('abuse_uploader', " . json_encode($upl) . ');');
$objResponse->script("\$('prj_abuse_msg').set('value', '')");
$objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_disabled')");
$objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
$objResponse->script("\$('project_abuse_success').removeClass('b-layout__txt_hide');");
$objResponse->script("\$('form_abuse').hide();");
$objResponse->script("setTimeout(\"\$('project_abuse_success').addClass('b-layout__txt_hide')\", 5000);");
if ($is_moder) {
$objResponse->script("\$('abuse-cause-error').addClass('b-layout__txt_hide');");
}
}
return $objResponse;
}