Пример #1
0
 /**
  * Конструктор класса.
  * 
  * @param string $sender Логин автора рассылки
  */
 public function __construct($sender = 'admin')
 {
     $this->_sender = new users();
     $this->_sender->GetUser($sender);
     $this->_dbMaster = new DB('master');
     $this->_dbProxy = new DB('plproxy');
 }
Пример #2
0
function CheckUser($login, $a = false)
{
    $objResponse = new xajaxResponse();
    $err = 'null';
    if (!preg_match("/^[a-zA-Z0-9]+[-a-zA-Z0-9_]{2,}\$/", $login)) {
        $err = "'Поле заполнено некорректно'";
    } else {
        $user = new users();
        $user->GetUser($login);
        if ($user->uid > 0) {
            $err = "'Извините, этот логин занят. Придумайте другой. <a class=\"b-form__close\" href=\"#\"></a>'";
        }
    }
    if (in_array(strtolower($login), $GLOBALS['disallowUserLogins'])) {
        $err = "'Извините, такой логин использовать нельзя <a class=\"b-form__close\" href=\"#\"></a>'";
    }
    if ($a) {
        if ($err != 'null') {
            $err = strip_tags($err);
            $objResponse->script("show_error('login', {$err});");
        }
    } else {
        $objResponse->script("regs.prnErr('login', {$err})");
        $objResponse->script("\$\$(\".b-form__close\").addEvent(\"click\", function() {\n                regs.prnErr('login', '');\n                \$('login_block').getElement('input').set('value', '');\n            });");
    }
    return $objResponse;
}
Пример #3
0
 /**
  * Добавить пользователя в избарнное
  *
  * @param integer $user_id       ИД пользователя, к которому добавляем
  * @param string  $target_login  Логин или uid добавляемого пользователя
  * @return string Сообщение об ошибке
  */
 function teamsAddFavorites($user_id, $target, $by_login = true)
 {
     $DB = new DB();
     $error = '';
     $user = new users();
     if ($by_login) {
         $user->GetUser($target);
         $target = $user->uid;
     } else {
         $user->GetUserByUID($target);
     }
     if ($user_id && $target && $user_id != $target) {
         if ($DB->val("SELECT teams_check(?i, ?i)", $user_id, $target)) {
             $error = 'Пользователь уже добавлен';
         } else {
             $DB->val("SELECT teams_add(?i, ?i)", $user_id, $target);
             if ($user->subscr[9]) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pmail.php";
                 $mail = new pmail();
                 $mail->addTeamPeople($user_id, $target);
             }
         }
     } else {
         $error = "Пользователь не определен";
     }
     return $error;
 }
Пример #4
0
 public function run()
 {
     $uid = get_uid(false);
     if ($uid = get_uid(false)) {
         $user = new users();
         $user->GetUser($_SESSION['login']);
     } else {
         $user = null;
     }
     $this->render('t-service-catalog-promo', array('user' => $user));
 }
Пример #5
0
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;
}
Пример #6
0
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;
}
Пример #7
0
 /**
  * Основная функция для пополнения. В нее нужно передать POST данны, которые пришли от веб-кошелька.
  * 
  * @param  array    массив с данным от webpay
  *
  * @return успех
  */
 public function income($data)
 {
     global $DB;
     $this->_fields = array();
     $id = $DB->insert('webpay_log', array('request' => serialize($data)), 'id');
     if (empty($data['amount']) || empty($data['userid']) || empty($data['userid_extra']) || empty($data['paymentid']) || empty($data['key']) || empty($data['paymode'])) {
         $this->_error($id, self::ERR_DATA);
         return false;
     }
     $amount = floatval($data['amount']);
     $login = (string) $data['userid_extra'];
     $this->_fields['payment_id'] = $paymentid = (string) $data['paymentid'];
     if ($amount <= 0) {
         $this->_error($id, self::ERR_AMOUNT);
         return false;
     }
     $this->_fields['amount'] = $amount;
     if ($data['key'] != md5($data['amount'] . $data['userid'] . $data['paymentid'] . onlinedengi_cards::SECRET)) {
         $this->_error($id, self::ERR_SECRET);
         return false;
     }
     $user = new users();
     $user->GetUser($login);
     if (empty($user->uid)) {
         $this->_error($id, self::ERR_USER);
         return false;
     }
     $this->_fields['user_id'] = $user->uid;
     if ($DB->val('SELECT COUNT(*) FROM webpay_log WHERE payment_id = ?', $paymentid)) {
         $this->_success($id, true);
     } else {
         $account = new account();
         $account->GetInfo($user->uid);
         $comment = 'Пополнение через Веб-кошелек';
         if ($account->deposit($op_id, $account->id, $amount, $comment, self::PAYMENT_SYS_CODE, $amount)) {
             $this->_error($id, self::ERR_DEPOSIT);
             return false;
         }
         $this->_fields['billing_id'] = $op_id;
         $this->_success($id);
     }
     return true;
 }
Пример #8
0
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;
}
Пример #9
0
function delAttach($id, $login)
{
    $objResponse = new xajaxResponse();
    if (!hasPermissions('users')) {
        $login = $_SESSION['login'];
    }
    $user = new users();
    $user->GetUser($login);
    if ($user->uid) {
        $account = new account();
        $account->GetInfo($user->uid);
    }
    if (!$account->id) {
        $err = 'Ошибка';
    }
    //if(!sbr::isFileInReqvHistory($user->uid,$id)) {
    if (!$account->delAttach($id)) {
        $err = 'Ошибка';
    }
    //}
    $objResponse->call('delFinAttach', $id, $login, 1, $err);
    return $objResponse;
}
Пример #10
0
 public function actionRegistrationOpauth($data)
 {
     $this->setFieldInfo('role', (int) $data['role']);
     $this->setFieldInfo('login', trim($data['login']));
     $this->setFieldInfo('email', trim($data['email']));
     //Кастомная валидация для этого способа регистрации
     $this->is_validate = true;
     $users = new users();
     $users->GetUser($data['email'], true, true);
     if ($users->uid) {
         $this->error['email'] = "Пользователь с таким email-адресом существует.";
         $this->is_validate = false;
     }
     $users = new users();
     $users->GetUser($data['login'], true, false);
     if ($users->uid) {
         $this->error['login'] = "******";
         $this->is_validate = false;
     }
     //Если кастомную прошли, проводим стандартную
     if ($this->is_validate) {
         $this->checkedFields();
     }
     if ($this->is_validate) {
         $this->setFieldInfo('password', substr(md5(uniqid(mt_rand(), true)), 10, 10));
         $this->setFieldInfo('subscr_news', 1);
     }
     return $this->actionRegistration(true);
 }
Пример #11
0
$rpath = '../';
$header = '../header.php';
$footer = '../footer.html';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/portfolio.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/links.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/seo/SeoTags.php';
session_start();
//$stop_words = new stop_words( hasPermissions('users') );
$GLOBALS[LINK_INSTANCE_NAME] = new links();
$name = htmlspecialchars(trim($_GET['user']));
$user_obj = new users();
$user_obj->GetUser($name);
$uid = $user_obj->uid;
if (!$uid) {
    header('Location: /404.php');
    exit;
}
// Если юзер забанен, то не показываем его работу.
if ($user_obj->is_banned == 1 && !hasPermissions('users')) {
    $fpath = '../';
    include ABS_PATH . '/404.php';
    exit;
}
$prjid = __paramInit('int', 'prjid');
if (!$prjid) {
    header('Location: /404.php');
    exit;
Пример #12
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_phone.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/seo/SeoTags.php';
session_start();
$footer_profile = true;
$uid = get_uid();
$stop_words = new stop_words(hasPermissions('users'));
$name = trim($_GET['user']);
$page = trim($_GET['p']);
$css_file = array('profile.css', 'opinions.css', '/css/block/b-icon/__cont/b-icon__cont.css', '/css/block/b-prev/b-prev.css', '/css/block/b-status/b-status.css', '/css/block/b-voting/b-voting.css', '/css/block/b-button/_vote/b-button_vote.css', '/css/nav.css', '/css/main.css', '/css/block/b-free-share/b-free-share.css', '/css/block/b-work/b-work.css');
$js_file = array('warning.js', 'note.js', 'status.js', 'banned.js', 'paid_advices.js', '/css/block/b-filter/b-filter.js', '/css/block/b-fon/b-fon.js', '/css/block/b-layout/b-layout.js', 'del_acc.js', 'sbr.js', 'specadd.js', 'drafts.js', 'polls.js', 'mAttach.js', 'blogs_cnt.js', 'blogs.js', 'opinions.js', '/css/block/b-layout/b-layout.js', '/css/block/b-textarea/b-textarea.js', 'tawl_bem.js', 'user_profile.js');
//rus
$user = new users();
if (strtolower($name) != 'admin' && strtolower($name) != 'anonymous') {
    $user->GetUser($name);
} else {
    include ABS_PATH . '/403.php';
    exit;
}
$p_user = $user;
if ($user->uid === NULL) {
    include ABS_PATH . '/404.php';
    exit;
}
$user_phone_block = user_phone::getInstance()->render(user_phone::PLACE_HEADER);
users::execOnFirstVisit($user);
if (strtolower($user->uid) == strtolower($uid) && is_pro(true)) {
    $no_adv = true;
} else {
    $no_adv = false;
Пример #13
0
 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/ignor.php";
 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/messages_spam.php";
 $msgs = new messages();
 $curpage = intval(trim($_GET['curpage']));
 if (!$curpage) {
     $curpage = intval(trim($_POST['curpage']));
 }
 if (!$curpage || $curpage < 0) {
     $curpage = 1;
 }
 $page_size = $PDA ? 10 : $GLOBALS['msgspp'];
 $dialog = $msgs->GetMessages(get_uid(), $chat_with, $num_msgs_from, $curpage, $page_size);
 //$_SESSION['newmsgs'] = $msgs->GetNewMsgCount($_SESSION['uid'], $err);
 $user = new users();
 $user->GetUser($chat_with);
 if (!is_pro(true, $user->uid) && !is_emp($user->role) && count($dialog) == 0 && is_emp($_SESSION['role'])) {
     $is_contact_splash = true;
 }
 if ($user->login == '') {
     header("Location: /404.php");
 }
 // Если пользователь забанен
 if ($user->is_banned && !hasPermissions('users')) {
     $error_flag = 1;
     $alert[3] = "Этот пользователь заблокирован. Вы не можете отправить ему личное сообщение";
 }
 $dlg_user = users::GetUid($err, $user->login);
 $dlg_user_login = $user->login;
 if ($post_denied = ignor::CheckIgnored($dlg_user, $_SESSION['uid']) || in_array($user->login, array('admin', 'Anonymous'))) {
     $error = "Пользователь запретил отправлять ему сообщения";
Пример #14
0
$t_ip = __paramInit('string', 't_ip', null, '');
$admins = $gray_ip->getAdmins();
$search_name = clearInputText($search_name);
if (!$page) {
    $page = 1;
} elseif ($page < 0) {
    header_location_exit('/404.php');
    exit;
}
if ($task == 'checklogin') {
    $login = __paramInit('string', 'login', 'login');
    $result = array();
    $result['success'] = false;
    if ($login) {
        $users = new users();
        $users->GetUser($login);
        if ($users->uid) {
            $result['success'] = true;
            $result['user'] = array('uid' => $users->uid, 'login' => $users->login, 'uname' => iconv('CP1251', 'UTF-8', $users->uname), 'usurname' => iconv('CP1251', 'UTF-8', $users->usurname));
        }
    }
    $result['test'] = $login;
    echo json_encode($result);
    exit;
} elseif ($task == 'pdel') {
    $gray_ip->deletePrimaryUser(__paramInit('int', 'puid'));
    $_SESSION['gray_ip_parent_reload'] = $primary_id ? 'yes' : '';
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
} elseif ($task == 'sdel') {
    $gray_ip->deleteSecondaryIp($_REQUEST['chk_users']);
Пример #15
0
/**
 * Сохраняет изменения рейтинга СБР.
 */
function editFeedback($stage_id, $feedback_id, $ops_type, $mesg, $login)
{
    $stage_id = intval($stage_id);
    $objResponse = new xajaxResponse();
    $request = array('id' => intval($feedback_id), 'descr' => $mesg);
    if ($ops_type !== null) {
        $request += array('ops_type' => intval($ops_type));
    }
    if ($login && hasPermissions('sbr')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $user = new users();
        $user->GetUser($login);
        if (!$user->uid) {
            $err = 'Ошибка';
        }
        $sbr = sbr_meta::getInstance(sbr_meta::ADMIN_ACCESS, $user, is_emp($user->role));
    } else {
        $sbr = sbr_meta::getInstance();
    }
    if ($sbr) {
        $stage = $sbr->getStage($stage_id);
    }
    if ($stage) {
        if ($feedback = $stage->feedback($request)) {
            $objResponse->call('saveRating', null, $stage->id, $feedback['id'], reformat($feedback['descr'], 30, 0, 1, 1), $feedback['p_rate'], $feedback['n_rate'], $feedback['a_rate']);
        }
        if ($stage->error['feedback']) {
            $err = 'Ошибка';
            if ($stage->error['feedback']['descr']) {
                $err = $stage->error['feedback']['descr'];
            }
        }
    }
    if ($err) {
        $objResponse->call('saveRating', $err, $stage_id);
    }
    return $objResponse;
}
Пример #16
0
 /**
  * Удаление рассылки
  *
  * @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);
 }
Пример #17
0
    /**
     * Регистрирует сообщение-предупреждение о некорректном проекте.
     *
     * @param int $login логин пользователя-получателя
     * @param int $prjid id проекта
     *
     * @return @see messages::Add()
     */
    public function SendProjectWarn($login, $prjid = 0)
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
        $f_user = new users();
        $f_user->GetUser($login);
        $obj_project = new projects();
        $project = $obj_project->GetPrjCust($prjid);
        $message = "\n{$f_user->uname} {$f_user->usurname}!\n\nМодераторы нашего ресурса нашли ваш проект некорректным:\n\n\"{$f_user->uname} {$f_user->usurname}. [{$login}] " . date('[d.m.Y | H:i]', strtotimeEx($project['post_date'])) . '
' . reformat($project['name']) . '
' . reformat($project['descr']) . '
"
Мы призываем вас впредь не публиковать подобных проектов, иначе модераторы лишат ваш аккаунт доступа к сайту.

Это сообщение было выслано автоматически, и ответ на него не будет рассматриваться.

Надеемся на понимание, Команда Free-lance.ru.';
        self::Add(users::GetUid($err, 'admin'), $login, $message, '', 1);
    }
Пример #18
0
/**
* Добавляет жалобу на проект.
*
* @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;
}
Пример #19
0
 /**
  * Изменяет статус жалобы на проект
  *
  * @param  int $complain_id идентификатор жалобы
  * @param  bool $status флаг статуса
  * @param  bool $bMemDel флаг сброса мэмкэша
  * @return null
  */
 protected function SetComplainStatus($complain_id, $status, $bMemDel = true)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
     global $DB;
     $sql = "SELECT p.user_id as emp_id, c.files FROM projects_complains c LEFT JOIN projects p ON p.id=c.project_id WHERE c.id=?i";
     $row = $DB->row($sql, $complain_id);
     $user_id = $row['emp_id'];
     $emp = new users();
     $emp->GetUser($emp->GetField($user_id, $ee, 'login'));
     $login = $emp->login;
     $files_str = $row['files'];
     if ($files_str) {
         $files = preg_split("/,/", $files_str);
         if ($files) {
             $f = new CFile();
             foreach ($files as $file) {
                 $f->Delete(0, "users/" . substr($login, 0, 2) . "/" . $login . "/upload/", $file);
             }
         }
     }
     $complain_id = (int) $complain_id;
     $sql = "\n        \tupdate projects_complains \n        \tset is_satisfied = ?b, admin_user_id = ?i, processed_at = now()\n        \tWHERE id=?i\n        \t and is_satisfied is null\n        ";
     $DB->query($sql, $status, $_SESSION['uid'], $complain_id);
     //echo $sql; exit;
     if ($bMemDel && !$DB->error) {
         $oMemBuf = new memBuff();
         $oMemBuf->delete('complain_projects_count');
     }
 }
Пример #20
0
                            <span class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_weight_normal">(контакты заказчика видны только пользователям с аккаунтом <?php 
        echo view_pro();
        ?>
)</span>
                      <?php 
    }
    ?>
                  <?php 
}
//else
?>
    
              
              <?php 
$user = new users();
$user->GetUser($user->GetField($project['user_id'], $ee, 'login'));
setlocale(LC_ALL, 'ru_RU.CP1251');
$registered = strtolower(ElapsedMnths(strtotime($project['reg_date'])));
setlocale(LC_ALL, 'en_US.UTF-8');
?>
          <?php 
/*<?=$user->getOnlineStatus4Profile()?> */
?>
              <?php 
if (hasPermissions('projects') && ($project['ico_payed'] == 't' || $project['is_upped'] == 't')) {
    ?>
              <b class="pay-prj">Внимание! Это платный проект!</b>
              <?php 
}
//if
?>
Пример #21
0
function GetRating($type, $login = null, $width = null)
{
    session_start();
    $objResponse = new xajaxResponse();
    $login = change_q_x($login, TRUE);
    $user = new users();
    $user->GetUser($login);
    $uid = $user->uid;
    if (!$uid) {
        $uid = get_uid(false);
    }
    if (!$uid) {
        $objResponse->script('this.document.location.reload();');
        return $objResponse;
    }
    $user->GetUserByUID($uid);
    $rating = new rating();
    switch ($type) {
        case 'year':
            $TIME = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
            $pro_periods_date = date('Y-01-01', $TIME);
            $res = $rating->getRatingByYear($uid, date('Y', $TIME));
            $periods = rating::getMonthParts(date('Y-01-01'));
            $data = array();
            if ($res) {
                foreach ($periods as $m => $mm) {
                    if ($m < date('m')) {
                        foreach ($mm as $d) {
                            if ($d > time() || $d < strtotime($user->reg_date)) {
                                continue;
                            }
                            $data[$m][date('Y-m-d', $d)] = null;
                            if ($d >= strtotime($user->reg_date)) {
                                $data[$m][date('Y-m-d', $d)] = 0;
                            }
                        }
                    }
                }
            }
            $start_r = null;
            if ($res) {
                if (date('Y', strtotime($res[0]['_date'])) == date('Y') - 1) {
                    $start_r = $res[0]['rating'];
                    if (isset($res[1]) && strtotime($res[1]['_date']) != $periods[0][0]) {
                        $res[0]['_date'] = date('Y-m-d', $periods[0][0]);
                    } else {
                        $res = array_slice($res, 1);
                    }
                }
            } else {
                $res = array();
            }
            $verify_factor = 0;
            $verify_date = rating::GetVerifyDate($uid);
            foreach ($res as $row) {
                $t = strtotime($row['_date']);
                $m = (int) date('m', $t);
                $verify_factor = 0;
                if ($row['is_verify'] == 't') {
                    if ($verify_date) {
                        if (strtotime($verify_date) < $t) {
                            $verify_factor = 0.2;
                        }
                    } else {
                        $verify_factor = 0.2;
                    }
                }
                $data[$m - 1][date('Y-m-d', $t)] = array('rating' => floatval($row['rating']), 'verify' => floatval($row['rating'] * $verify_factor), 'pro' => 0);
            }
            $lastval = null;
            foreach ($data as $i => $mon) {
                foreach ($mon as $d => $prt) {
                    $vl = !$prt ? $lastval : $prt;
                    $data[$i][$d] = $vl;
                    //                    if($prt !== null)
                    $lastval = $vl;
                }
            }
            $pro_periods = promotion::GetUserProPeriods($uid, $pro_periods_date, TRUE);
            if ($pro_periods) {
                $pro = array();
                foreach ($pro_periods as $p => $period) {
                    if (date('Y', strtotime($period['from_time'])) > date('Y', $TIME) && date('Y', strtotime($period['to_time']) > date('Y', $TIME))) {
                        continue;
                    }
                    $d1 = (int) date('z', strtotime($period['from_time']));
                    $d2 = (int) date('z', strtotime($period['to_time']));
                    if (date('Y', strtotime($period['from_time'])) < date('Y', $TIME)) {
                        $d1 = 0;
                    }
                    if (date('Y', strtotime($period['to_time'])) > date('Y', $TIME)) {
                        $d2 = (int) date('z', mktime(0, 0, 0, 12, 31, date('Y')));
                    }
                    $_factor = 0.2;
                    if ($period['is_profi'] == 1) {
                        $_factor = 0.4;
                    }
                    foreach ($data as $mon => $val) {
                        foreach ($val as $per => $r) {
                            $day = (int) date('z', strtotime($per));
                            if ($d1 < $day && $d2 >= $day) {
                                $data[$mon][$per]['pro'] = floatval($data[$mon][$per]['rating'] * $_factor);
                            }
                        }
                    }
                    $pro[$p] = $d1 != $d2 ? array($d1, $d2) : array($d1);
                }
                $config['pro'] = $pro;
            }
            $new_data = array();
            if ($data) {
                foreach ($data as $mon => $val) {
                    foreach ($val as $per => $r) {
                        $new_data[$mon][$per] = $r['rating'] + $r['verify'] + $r['pro'];
                    }
                }
            }
            $config['data'] = $new_data;
            $config['cur'] = intval(date('m', $TIME));
            $config['days'] = date('z', mktime(0, 0, 0, 12, 31, date('Y'))) + 1;
            $config['regdate'] = $user->reg_date;
            break;
        case 'prev':
        default:
            $config = array();
            $data = array();
            $config['hilight'] = array();
            if ($type == 'prev') {
                $TIME = mktime(0, 0, 0, date('m') - 1, 1, date('Y'));
                $res = $rating->getRatingByMonth($uid, date('Y-m-d', $TIME));
                if (!$res) {
                    $res = array();
                }
                $graphstart = strtotime($user->reg_date);
                if (count($res) && date('Ym', strtotime($res[0]['_date'])) == date('Ym', $TIME)) {
                    $graphstart = strtotime($res[0]['_date']);
                } else {
                    if (!count($res)) {
                        $graphstart = time();
                    }
                }
                $rating_data = array();
                $verify_date = null;
                $verify_factor = 0;
                $n = 0;
                foreach ($res as $d) {
                    if (date('Y-m', strtotime($d['_date'])) != date('Y-m', $TIME)) {
                        continue;
                    }
                    //$rating_data[intval(date('d', strtotime($d['_date'])))] = $d['rating'];
                    $verify_factor = 0;
                    if ($verify_date === null) {
                        $verify_date = rating::GetVerifyDate($d['user_id']);
                    }
                    if ($d['is_verify'] == 't') {
                        if ($verify_date) {
                            if (strtotime($verify_date) < strtotime($d['_date'])) {
                                $verify_factor = 0.2;
                            }
                        } else {
                            $verify_factor = 0.2;
                        }
                    }
                    if ($n == 0) {
                        $res[0]['verify_factor'] = $verify_factor;
                    }
                    $rating_data[intval(date('d', strtotime($d['_date'])))] = array('rating' => floatval($d['rating']), 'verify' => floatval($d['rating'] * $verify_factor), 'pro' => 0);
                    ++$n;
                }
                $last = null;
                for ($i = 0; $i < date('t', $TIME); ++$i) {
                    if (strtotime(date('Y-m-' . ($i + 1), $TIME)) < $graphstart) {
                        $last = null;
                    } else {
                        $last = $last !== null ? $last : 0;
                        if ($i == 0 && !isset($rating_data[$i + 1])) {
                            $last = array('rating' => floatval($res[0]['rating']), 'verify' => floatval($res[0]['rating'] * $res[0]['verify_factor']), 'pro' => 0);
                        }
                    }
                    if (isset($rating_data[$i + 1])) {
                        $last = $rating_data[$i + 1];
                    }
                    $data[$i] = $last;
                }
            } else {
                $TIME = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
                $res = $rating->getRatingByMonth($uid, date('Y-m-d', $TIME));
                if (!$res) {
                    $res = array();
                }
                $graphstart = strtotime($user->reg_date);
                if (count($res) && date('Ym', strtotime($res[0]['_date'])) == date('Ym', $TIME)) {
                    $graphstart = strtotime($res[0]['_date']);
                }
                $rating_data = array();
                $verify_date = null;
                $verify_factor = 0;
                $n = 0;
                foreach ($res as $d) {
                    if (date('Y-m', strtotime($d['_date'])) != date('Y-m', $TIME)) {
                        continue;
                    }
                    $verify_factor = 0;
                    if ($verify_date === null) {
                        $verify_date = rating::GetVerifyDate($d['user_id']);
                    }
                    if ($d['is_verify'] == 't') {
                        if ($verify_date) {
                            if (strtotime($verify_date) < strtotime($d['_date'])) {
                                $verify_factor = 0.2;
                            }
                        } else {
                            $verify_factor = 0.2;
                        }
                    }
                    if ($n == 0) {
                        $res[0]['verify_factor'] = $verify_factor;
                    }
                    $rating_data[intval(date('d', strtotime($d['_date'])))] = array('rating' => floatval($d['rating']), 'verify' => floatval($d['rating'] * $verify_factor), 'pro' => 0);
                    ++$n;
                }
                $config['cur'] = intval(date('d', $TIME));
                $last = 0;
                for ($i = 0; $i < date('d', $TIME); ++$i) {
                    if (strtotime(date('Y-m-' . ($i + 1), $TIME)) < $graphstart) {
                        $last = null;
                    } else {
                        $last = $last !== null ? $last : 0;
                        if ($i == 0 && !isset($rating_data[$i + 1])) {
                            $last = array('rating' => floatval($res[0]['rating']), 'verify' => floatval($res[0]['rating'] * $res[0]['verify_factor']), 'pro' => 0);
                        }
                    }
                    if (isset($rating_data[$i + 1])) {
                        $last = $rating_data[$i + 1];
                    }
                    $data[$i] = $last;
                }
            }
            $pro_periods_date = date('Y-01-01', $TIME);
            for ($i = 1; $i <= date('t', $TIME); ++$i) {
                $t = mktime(0, 0, 0, date('m', $TIME), $i, date('Y', $TIME));
                if (date('w', $t) == 0 || date('w', $t) == 6) {
                    $config['hilight'][] = $i;
                }
            }
            $pro_periods = promotion::GetUserProPeriods($uid, $pro_periods_date, TRUE);
            if ($pro_periods) {
                $pro = array();
                $tmp = array();
                foreach ($pro_periods as $p => $period) {
                    if (date('Ym', strtotime($period['from_time'])) > date('Ym', $TIME)) {
                        continue;
                    }
                    if (date('Ym', strtotime($period['to_time'])) < date('Ym', $TIME)) {
                        continue;
                    }
                    $d1 = (int) date('d', strtotime($period['from_time']));
                    $d2 = (int) date('d', strtotime($period['to_time']));
                    if (date('Ym', strtotime($period['from_time'])) < date('Ym', $TIME)) {
                        $d1 = 1;
                    }
                    if (date('Ym', strtotime($period['to_time'])) > date('Ym', $TIME)) {
                        $d2 = (int) date('t', $TIME);
                    }
                    $_factor = 0.2;
                    //PRO ONLY
                    if ($period['is_profi'] == 1) {
                        $_factor = 0.4;
                        //PROFI
                    }
                    foreach ($data as $day => $val) {
                        if (isset($tmp[$day]) || $val === null) {
                            continue;
                        }
                        if ($d1 <= $day + 1 && $d2 >= $day + 1) {
                            $data[$day]['pro'] = floatval($data[$day]['rating'] * $_factor);
                            //rating::PRO_FACTOR;
                            $tmp[$day] = 1;
                        }
                    }
                    $pro[$p] = $d1 != $d2 ? array($d1, $d2) : array($d1);
                }
                $config['pro'] = $pro;
            }
            if (strtotime($user->reg_date) > strtotime($pro_periods_date)) {
                $config['regdate'] = date('Y-m-d', strtotime($user->reg_date));
            }
            $new_data = array();
            if ($data) {
                foreach ($data as $day => $value) {
                    $new_data[$day] = $value['rating'] + $value['verify'] + $value['pro'];
                }
            }
            // сегодняшний рейтинг берем из $user - тут он актуальный и не зависит от кэша
            if ($type === 'month') {
                array_pop($new_data);
                $new_data[] = floatval($user->rating);
            }
            $config['data'] = $new_data;
            $config['days'] = date('t', $TIME);
            $config['startdate'] = date('Y-m-01', $TIME);
    }
    if ($width) {
        $config['w'] = (int) $width;
    }
    $config = json_encode($config);
    $objResponse->script("loadGraph('{$type}', {$config});");
    return $objResponse;
}
Пример #22
0
    		case 16: $pr_txt = "Аккаунт ПРО"; break;
    		case 17: $pr_txt = "Первая страница &#150; 1 неделя"; break;
    		case 18: $pr_txt = "Первая страница &#150; 1 месяц"; break;
    		case 23: $pr_txt = $opinfo['ammount']." FM"; break;
    		case 26: $pr_txt = "Аккаунт ПРО"; break;
    		case 27: $pr_txt = "Первая страница &#150; 1 неделя"; break;
    		case 34: $pr_txt = "Первая страница &#150; новогодний подарок &#150; 1 неделя"; break;
    		case 35: $pr_txt = "Аккаунт ПРО &#150; новогодний подарок"; break;
    		case 42: $pr_txt = "Аккаунт ПРО &#150; подарок на 8 марта"; break;
    		default: $pr_txt = "";
    	}
    */
    if ($pr_txt && $opinfo['billing_id'] == $acc->id) {
        $info = $acc->GetHistoryInfo($opinfo['id'], $_SESSION['uid'], 3);
        $user = new users();
        $user->GetUser($opinfo['login']);
        $cnt_role = !is_emp($user->role) ? 'frl' : 'emp';
        present::SetGiftResv($id, $_SESSION['uid']);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
        $is_pro = payed::CheckPro($user->login);
        $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
        $_SESSION['pro_last'] = $_SESSION['pro_last']['freeze_to'] ? false : $_SESSION['pro_last']['cnt'];
    }
}
if (!$user) {
    header('Location: /404.php');
    exit;
}
$css_file[] = '/css/styles/present.css';
$header = '../header.php';
$footer = '../footer.html';
Пример #23
0
 /**
  * Добавление Комментария/Сообщения
  *
  */
 function addComment()
 {
     $DB = new DB('master');
     if ($_SESSION['last_comment_add'] + 5 > time()) {
         return false;
     }
     $_SESSION['last_comment_add'] = time();
     /* Данные комментария */
     $blog = $_POST['blogID'];
     $user = get_uid();
     $parent = $_POST['parent'];
     $alert = array();
     if (strlen($_POST['msg']) > blogs::MAX_DESC_CHARS) {
         $error_flag = 1;
         $alert[2] = "Максимальный размер сообщения " . blogs::MAX_DESC_CHARS . " символов!";
         $msg =& $_POST['msg'];
     } else {
         $msg = $_POST['msg'];
         $msg = preg_replace("/<ul.*>/Ui", "<ul>", $msg);
         $msg = preg_replace("/<li.*>/Ui", "<li>", $msg);
         $msg = change_q_x_a(antispam($msg), false, false);
     }
     $msg_name = substr(change_q_x(antispam($_POST['title']), true), 0, 96);
     $yt_link = substr(change_q_x(antispam(str_replace('watch?v=', 'v/', $_POST['yt_link'])), true), 0, 128);
     if ($yt_link != '') {
         if (strpos($yt_link, 'http://ru.youtube.com/v/') !== 0 && strpos($yt_link, 'http://youtube.com/v/') !== 0 && strpos($yt_link, 'http://www.youtube.com/v/') !== 0) {
             $error_flag = 1;
             $alert[4] = "Неверная ссылка.";
         }
     }
     if (is_empty_html($msg)) {
         $msg = '';
     }
     // загрузка файлов
     $attach = $_FILES['attach'];
     if (is_array($attach) && sizeof($attach) <= 10) {
         if (is_array($attach) && !empty($attach['name'])) {
             foreach ($attach['name'] as $key => $v) {
                 if (!$attach['name'][$key]) {
                     continue;
                 }
                 $files[] = new CFile(array('name' => $attach['name'][$key], 'type' => $attach['type'][$key], 'tmp_name' => $attach['tmp_name'][$key], 'error' => $attach['error'][$key], 'size' => $attach['size'][$key]));
             }
         }
         if ($group == 7) {
             $max_image_size = array('width' => 400, 'height' => 600, 'less' => 0);
         } else {
             $max_image_size = array('width' => 470, 'height' => 1000, 'less' => 0);
         }
         list($files, $alert_, $error_flag___) = self::uploadFile($files, $max_image_size);
         $error_flag = max($error_flag___, $error_flag);
         if (is_array($alert_)) {
             $alert = array_merge($alert, $alert_);
         }
     } else {
         if (is_array($attach) && !empty($attach['name'])) {
             $error_flag = 1;
             $alert[2] = "Файлов не должно быть больше 10";
         }
     }
     if (!$msg && !count($files)) {
         $error_flag = 1;
         $alert[2] = "Поле заполнено некорректно";
     }
     if (($msg || $files['f_name'][0]) && get_uid() && !$error_flag) {
         //if($files['f_name'][0])
         //error_reporting(E_ALL);
         $eUser = $DB->row("SELECT email, uid FROM corporative_blog LEFT JOIN users ON users.uid = corporative_blog.id_user WHERE corporative_blog.id = ?", $parent);
         $e_user = new users();
         $e_user->GetUser($e_user->GetField($eUser['uid'], $ee, 'login'));
         $sql = "INSERT INTO corporative_blog (title, yt_link, msg, id_blog, id_user, id_reply) VALUES(?, ?, ?, ?, ?, ?) RETURNING id;";
         $res = $DB->row($sql, $msg_name, $yt_link, $msg, $blog, $user, $parent);
         $idCom = $res['id'];
         //            $idCom =  front::og("db")->select("SELECT id FROM corporative_blog WHERE title = ? AND msg = ? AND id_blog = ? AND id_user = ?", $msg_name, $msg, $blog, $user)->fetchOne();
         if (substr($e_user->subscr, 2, 1) == '1' && $idCom && $eUser['uid'] != $user) {
             $p_user = new users();
             $p_user->GetUser($p_user->GetField($user, $ee, 'login'));
             $smail = new smail();
             $link = "http://free-lance.ru/about/corporative/post/{$blog}/link/{$idCom}/#c{$idCom}";
             $smail->CorporativeBlogNewComment(array("title" => $msg_name, "msgtext" => $msg), $p_user, $e_user, $link);
         }
         if (is_array($files)) {
             $asql = '';
             for ($i = 0; $i < count($files['f_name']); $i++) {
                 if ($files['f_name'][$i]) {
                     $asql .= ", (currval('corporative_blog_id_seq'), '{$files['f_name'][$i]}', '{$files['tn'][$i]}')";
                 }
             }
             if ($asql) {
                 $asql = substr($asql, 2);
             }
         }
         if ($asql) {
             $DB->squery("INSERT INTO corporative_blog_attach(msg_id, \"name\", small) VALUES {$asql}");
         }
         $tags = $_POST['tags'];
         if ($tags) {
             $tags_arr = $tags;
             //explode(",", $tags);
             array_unique($tags_arr);
             $this->tagsDelete($idCom);
             $tg = tags::Add($tags_arr);
             $this->tagsAdd($idCom, $tg);
         }
         //Уведомление о комментарии
         //list($alert1, $error_flag, $error) = $sql_error;
         //list($alert1, $error_flag, $error) = $blog_obj->NewThread(get_uid(), $gr, $base, $name, $msg, $files, getRemoteIP(), $mod, 0, $tags, $yt_link, $ontop);
     }
     //if ($alert1) $alert = $alert + $alert1;
     //vardump($alert);
     front::og("tpl")->error_flag = $error_flag;
     //
     front::og("tpl")->alert = $alert;
     front::og("tpl")->post = array("blog" => $blog, "user" => $user, "parent" => $parent, "msg" => $msg, "title" => $msg_name, "yt_link" => $yt_link, "tags" => $_POST['tags']);
     return array($error_flag, $error, $idCom);
 }
Пример #24
0
 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;
Пример #25
0
<?php

if (!defined('IS_SITE_ADMIN')) {
    header('Location: /404.php');
    exit;
}
$action = $_POST['action'];
$users = new users();
if ($action) {
    switch ($action) {
        case "addteam":
            $users->GetUser($_POST['login']);
            if ($users->uid && $users->is_team == 'f') {
                $users->is_team = 't';
                $user_update = new users();
                $user_update->is_team = 't';
                $error = $user_update->Update($users->uid, $error);
                if ($error) {
                    $error_login = $error;
                }
            } else {
                if ($users->is_team == 't') {
                    $error_login = "******" . $users->login . " уже находится в команде Free-lance.ru";
                } else {
                    $error_login = "******" . $_POST['login'] . " не существует";
                }
            }
            break;
        case "delteam":
            $users->GetUser($_POST['login']);
            if ($users->uid && $users->is_team == 't') {
Пример #26
0
$css_file = array('settings.css', 'profile.css', 'nav.css', '/css/block/b-voting/b-voting.css');
$js_file = array('warning.js', 'note.js', 'status.js', 'banned.js', 'tawl_bem.js', 'raphael-min.js', 'svg.js', 'paid_advices.js', '/css/block/b-filter/b-filter.js', '/css/block/b-fon/b-fon.js', '/css/block/b-layout/b-layout.js', 'del_acc.js', 'kwords.js', 'sbr.js', 'specadd.js', 'drafts.js', 'polls.js', 'mAttach.js', 'blogs_cnt.js', 'blogs.js', 'opinions.js', '/kword_js.php', 'finance.js', 'user_langs.js', 'user_setup.js');
$DB = new DB('master');
$uid = get_uid();
$login = $_SESSION['login'];
$role = $_SESSION['role'];
$page = trim($_GET['p']);
$user = trim($_GET['user']);
if (!$page) {
    header_location_exit('/users/' . $user . '/setup/main/');
}
$template = in_array($page, array('main', 'mailer')) ? "template2.php" : "template.php";
if (strtolower($user) != strtolower($login)) {
    if ($page == 'finance' && hasPermissions('users')) {
        $u = new users();
        $u->GetUser($user);
        $uid = $u->uid;
        $login = $u->login;
        $role = $u->role;
    } else {
        include ABS_PATH . "/403.php";
        exit;
    }
}
$_in_setup = 1;
$fpath = '';
$inner = '';
if ($page != 'main') {
    $user_phone_block = user_phone::getInstance()->render(user_phone::PLACE_HEADER);
}
// Сообщение сверху страницы
Пример #27
0
            2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2259,2260,2261,2263,2264,2265,2266,2267,2268,2269,2271,2272,2273,
            2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,
            2302,2303,2304,2305,2306,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2322,2323,2324,2325,2326,2327,2328,2330,
            2331,2332,2333,2334,2335,2336,2337,2338,2340,2341,2342,2343,2344,2345,2346,2347,2349,2350,2351,2352,2353,2355,2356,2357,2358,2359,2360,2361,
            2362,2363,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2384,2385,2386,2387,2388,2389,2390,
            2391,2392,2393,2394,2395,2396,2397,2398,2399,2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2410,2411,2412,2416

        ) ORDER BY sbr_id";
*/
$data = $DB->rows($sql);
//$sbr = sbr_meta::getInstance( sbr_meta::ADMIN_ACCESS );
$sbr = new sbr_adm(103, 'admin');
if ($data) {
    foreach ($data as $row) {
        $user = new users();
        $user->GetUser($row['login']);
        $letter = array();
        $letter['title'] = "СБР-{$row['sbr_id']}-Б/О#{$row['lc_id']}";
        $letter['user_add'] = 57748;
        $letter['user_1'] = 6;
        $letter['user_2'] = $user->uid;
        $letter['user_status_2'] = 11;
        $recipient = sbr_meta::getUserReqvs($letter['user_2']);
        if ($row['form_type'] == 1) {
            $address = (bool) trim($recipient[1]['address']);
        } else {
            $address = (bool) trim($recipient[2]['address']) || (bool) trim($recipient[2]['address_fct']) || (bool) trim($recipient[2]['address_jry']);
        }
        if (empty($address)) {
            $res['a'][] = $row['sbr_id'];
            echo "{$row['sbr_id']} - Havn't address!\n";
Пример #28
0
function getFileUrl($file)
{
    if (!$file) {
        return 0;
    }
    return WDCPREFIX . '/' . $file->path . $file->name;
}
try {
    if (!$login) {
        throw new Exception('No login param');
    }
    if (!$sum) {
        throw new Exception('No sum param');
    }
    $userObj = new users();
    $userObj->GetUser($login);
    if ($userObj->uid <= 0) {
        throw new Exception("Not find user with login: {$login}");
    }
    $doc = new DocGenBill();
    $results['generateBankInvoice'] = getFileUrl($doc->generateBankInvoice($userObj->uid, $login, $sum));
} catch (\Exception $e) {
    $message = $e->getMessage();
    $results['Error Message'] = iconv('cp1251', 'utf-8', $message);
}
//------------------------------------------------------------------------------
array_walk($results, function (&$value, $key) {
    $value = sprintf('%s = %s' . PHP_EOL, $key, $value);
});
print_r(implode('', $results));
exit;
Пример #29
0
    $additsql = "(role&'{$empmask}')='" . ${$type} . "' AND is_banned='0'";
    $no_more = 1;
}
$can_modify = hasPermissions('users');
switch ($action) {
    case 'activate':
        $login = trim(stripslashes($_GET['login']));
        if ($login) {
            $error = users::SetActive($login);
        }
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/wizard_registration.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_employer.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_freelancer.php';
        $user = new users();
        $user->GetUser($login);
        if ($user->role[0] == 1) {
            $wiz_user = wizard::isUserWizard($user->uid, step_employer::STEP_REGISTRATION_CONFIRM, wizard_registration::REG_EMP_ID);
        } else {
            $wiz_user = wizard::isUserWizard($user->uid, step_freelancer::STEP_REGISTRATION_CONFIRM, wizard_registration::REG_FRL_ID);
        }
        if ($wiz_user['id'] > 0) {
            step_wizard::setStatusStepAdmin(step_wizard::STATUS_COMPLITED, $user->uid, $wiz_user['id']);
        }
        break;
        /*case "delete":
          $login = trim($_GET['login']);
          if ($login) $error = users::DeleteUser(0, 0, $error, $login, hasPermissions('users'));
          break;*/
    /*case "delete":
      $login = trim($_GET['login']);
Пример #30
0
 /**
  * Вывод страницы для оплаты пластиковыми картами.
  */
 public function cardAction()
 {
     front::og('tpl')->page = 'index';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/card_account.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_meta.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/settings.php';
     $user = new users();
     $user->GetUser($_SESSION['login']);
     $city = $user->city ? city::GetCityName($user->city) : '';
     $reqv = sbr_meta::getUserReqvs($user->uid);
     $card_account = new card_account();
     $card_account->account_id = $this->account->id;
     $order_id = $card_account->Add();
     $sum = round(trim($_REQUEST['sum']), 4);
     $merchant = settings::GetVariable('billing', 'card_merchant');
     front::og('tpl')->sum = $sum;
     front::og('tpl')->card_account = $card_account;
     front::og('tpl')->order_id = $order_id;
     front::og('tpl')->city = $city;
     front::og('tpl')->user = $user;
     front::og('tpl')->reqv = $reqv[sbr::FT_PHYS];
     front::og('tpl')->script = '/scripts/bill2.js';
     if ($order_id > 0) {
         $tpl_file = '';
         if ($merchant) {
             $tpl_file = '_dol';
         }
         front::og('tpl')->display("bill/bill_card_step2{$tpl_file}.tpl");
     }
 }