当前位置: 首页>>代码示例>>PHP>>正文


PHP payed::CheckPro方法代码示例

本文整理汇总了PHP中payed::CheckPro方法的典型用法代码示例。如果您正苦于以下问题:PHP payed::CheckPro方法的具体用法?PHP payed::CheckPro怎么用?PHP payed::CheckPro使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在payed的用法示例。


在下文中一共展示了payed::CheckPro方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_event

 public function process_event(&$event)
 {
     global $DB;
     $this->force_connect();
     $r = false;
     switch ($event->type) {
         case 'ProjectPosted':
             $project_id = $event->data['id'];
             $this->log->notice('New project posted #id = ' . $project_id);
             $obj_project = new projects();
             $project = $obj_project->GetPrjCust($project_id);
             // Не выбран испольнитель (если испольнитель выбран, то не пишем ответ на этот проект)
             if ($project && $project['exec_id'] == 0 && $project['kind'] == 1) {
                 $autoresponses = autoresponse::getListForProject($project);
                 foreach ($autoresponses as $autoresponse) {
                     $freelancer = $autoresponse->data['freelancer'];
                     $contacts_freelancer = $autoresponse->data['contacts_freelancer'];
                     // Проверяем если проект только для про, то и пользователь который на него отвечает должен быть ПРО
                     if ($project['pro_only'] == 't' && !payed::CheckPro($freelancer->login)) {
                         continue;
                     }
                     // Проверяем если проект только для верифицированных, то и пользователь который на него отвечает должен быть верифицирован
                     if ($project['verify_only'] == 't' && !$freelancer->IsVerified()) {
                         continue;
                     }
                     // Проверка, что текущий пользователь не является владельцем проекта
                     if ($project['user_id'] == $freelancer->uid) {
                         continue;
                     }
                     // Добавление нового отзыва к проекту
                     $obj_offer = new projects_offers();
                     $save_contacts = serialize($contacts_freelancer);
                     $DB->start();
                     $error_offer = $obj_offer->AddOffer($freelancer->uid, $project['id'], '', '', '', '', '', '', antispam(stripslashes($autoresponse->data['descr'])), '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $autoresponse->toBoolean($autoresponse->data['only_4_cust']), 0, 0, false, false, $save_contacts, 0, $autoresponse->data['id']);
                     // В случае добавление автоответа, уменьшаем счетчик автоответов для пользователя (в транзакции)
                     if ($error_offer || !$autoresponse->reduce($freelancer, $obj_offer, $project_id)) {
                         $this->log->notice('Rollback autoresponse posted for project #id = ' . $project_id);
                         $DB->rollback();
                     } else {
                         $obj_project->incrementViews($project_id);
                         $this->log->notice(sprintf('New autoresponse #%d posted for project #%d', $obj_offer->offer_id, $project_id));
                         $DB->commit();
                     }
                 }
             }
             break;
     }
     return PGQ_EVENT_OK;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:49,代码来源:autoresponse.php

示例2: _HideProject

/**
 * Скрывает или отображает платные проекты.
 *
 * @see projects_filter::ShowClosedProjects()
 * @see projects_filter::initClosedProjects()
 *
 * @param string $id     id определенного или all для всех
 * @param string $type   скрыть (hide) или показать (unhide)
 * @param int $kind  тип текущей закладки главной страницы (см. new_projects::getProjects())
 * @param int $page  номер текущей страницы.
 * @param bool $filter  включен ли фильтр у юзера.
 *
 * @return object xajaxResponse
 */
function _HideProject($id, $type, $kind, $page, $filter)
{
    session_start();
    $objResponse = new xajaxResponse();
    $all = $id == 'all';
    $id = (int) $id;
    $uid = $_SESSION['uid'];
    if ($type == 'hide') {
        $prj = new new_projects();
        $content = $prj->SearchDB((int) $kind, 2, 0, $uf, true, true);
        $prjs = $prj->getProjects($num_prjs, (int) $kind, 2, true, $uf, true, true);
        $num = 0;
        $nDH = $nH;
        $_SESSION['ph'][$id] = base64_encode(projects::GetField($id, 'name'));
        $_SESSION['top_payed']--;
        $objResponse->assign("project-item{$id}", 'outerHTML', '');
        if ($filter) {
            $prj_filter = new projects_filters();
            $uf = $prj_filter->GetFilter($uid, $error);
        }
        if ($prjs[$num]) {
            $this_kind = $prjs[$num]['kind'];
            $this_uid = get_uid(false);
            $this_pro_last = $_SESSION['pro_last'];
            $this_is_pro = payed::CheckPro($_SESSION['login']);
            $this_edit_mode = hasPermissions('projects');
            if ($this_uid) {
                $this_user_role = $_SESSION['role'];
            }
            $this_project = $prjs[$num];
            $row = $this_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;
                $row['show_data'] = 1;
            } else {
                $this_show_data = 0;
                $row['show_data'] = 0;
            }
            $descr = $row['descr'];
            $descr = preg_replace("/^ /", "", $descr);
            $descr = preg_replace("/(\n) /", "\$1", $descr);
            $descr = reformat(strip_tags(LenghtFormatEx($descr, 180), "<br />"), 50, 1, 0, 1);
            $descr = preg_replace("//", "&nbsp;", $descr);
            $row['descr'] = $descr;
            $row['t_is_payed'] = $this_project['payed'] && $this_project['kind'] != 2 && $this_project['kind'] != 7;
            $row['t_is_contest'] = $this_project['kind'] == 2 || $this_project['kind'] == 7;
            $row['t_pro_only'] = $this_project['pro_only'] == "t";
            $row['t_prefer_sbr'] = $this_project['prefer_sbr'] == "t";
            $row['priceby'] = $this_project['priceby'];
            $row['t_is_adm'] = hasPermissions('projects');
            $row['t_is_ontop'] = strtotime($this_project['top_to']) >= time();
            $row['unread'] = (int) $this_project['unread_p_msgs'] + (int) $this_project['unread_c_msgs'] + (int) $this_project['unread_c_prjs'];
            $row['t_is_proonly'] = $this_project['pro_only'] == 't' && !$_SESSION['pro_last'] && !$this_edit_mode && $this_uid != $this_project['user_id'];
            $row['friendly_url'] = getFriendlyURL('project', array('id' => $row['id'], 'name' => $row['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;
            }
            $row['attaches'] = $this_project['attaches'] = $attaches;
            $is_ajax = true;
            $can_change_prj = hasPermissions("projects");
            ob_start();
            require $_SERVER['DOCUMENT_ROOT'] . '/projects/tpl.lenta-item.php';
            $prj_html = ob_get_contents();
            ob_end_clean();
            $objResponse->script('ndiv = new Element("div", {id: "project-item' . $prjs[$num]['id'] . '", class: "b-post b-post_pad_10_15_15_20 b-post_margleft_-20 b-post_margright_-15 b-post_margbot_15 b-layout b-post_relative b-post_overflow_hidden' . ($row['is_color'] == 't' ? ' b-post_bg_fffded' : '') . '"});');
            $objResponse->script('ndiv.inject($("projects-list").getLast("div[id^=project-item]"), "after");');
            $objResponse->assign("project-item" . $prjs[$num]['id'], "innerHTML", $prj_html);
        }
    } else {
        if ($all && $_SESSION['ph']) {
            $nDH = -1 * $nH * count($_SESSION['ph']);
            unset($_SESSION['ph']);
        } else {
            $nDH = -1 * $nH;
            unset($_SESSION['ph'][$id]);
            if (!$_SESSION['ph']) {
                unset($_SESSION['ph']);
            }
        }
        if ($filter) {
            $prj_filter = new projects_filters();
            $uf = $prj_filter->GetFilter($uid, $error);
        }
//.........这里部分代码省略.........
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:projects.server.php

示例3: __paramInit

        //$page_keyw = '';
        break;
    case "projects":
    default:
        //if ($_SESSION['login'] == $name) { $inner = "setup/projects_inner.php"; $_in_setup = 1;}
        //else {$inner = "projects_inner.php";}
        $inner = "projects_inner.php";
        $activ_tab = 1;
        $page = __paramInit('page', 'page', 'page', 1);
        break;
}
if ($_SESSION['p_ref']) {
    unset($_SESSION['p_ref']);
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php";
$is_pro = payed::CheckPro($user->login);
$no_banner = !!$is_pro;
$action = trim(__paramInit('string', 'action', 'action'));
switch ($action) {
    case 'activated':
        $alert_message = "Аккаунт активирован";
        break;
    case "prj_close":
        $kind = __paramInit('int', null, 'kind', 0);
        $prj_id = __paramInit('int', null, 'project_id');
        $do_close = __paramInit('bool', null, 'do_close');
        $projects = new projects();
        if ($prj_id) {
            $error .= $projects->SwitchStatusPrj(get_uid(), $prj_id);
        }
        $location = "/users/{$name}/projects/?kind={$kind}" . ($do_close ? '&closed=1' : '');
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例4: trim

}
$_in_setup = 1;
$fpath = '';
$inner = '';
if ($page != 'main') {
    $user_phone_block = user_phone::getInstance()->render(user_phone::PLACE_HEADER);
}
// Сообщение сверху страницы
$alert_message = '';
if (is_emp($role)) {
    $fpath = "../employer/setup/";
    include $fpath . "index.php";
    exit;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php";
$is_pro = payed::CheckPro($login);
$no_banner = !!$is_pro;
$action = trim($_POST['action']);
if (strtolower($user) == strtolower($login) && is_pro(true)) {
    $no_adv = true;
} else {
    $no_adv = false;
}
switch ($page) {
    case "info":
        $inner = "inform_inner.php";
        $activ_tab = 3;
        break;
    case "mailer":
        $inner = "mailer_inner.php";
        $activ_tab = 0;
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例5: session_start

<?php

$rpath = "../";
$g_page_id = "0|5";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
session_start();
$uid = get_uid(false);
$is_pro = payed::CheckPro($_SESSION['login']);
$is_adm = false;
// чтобы админ мог редактировать предложения по проектам
if (hasPermissions('projects') && InGetPost('uid')) {
    $uid = InGetPost('uid');
    $is_pro = payed::checkProByUid($uid);
    $is_adm = true;
}
$error = false;
$err = '';
$pict_added = false;
//die ("DUMP: " . var_export($_FILES, true));
if (isset($_POST['action']) && $_POST['action'] == 'add_pic' && is_array($_FILES['ps_attach'])) {
    $prj_id = isset($_POST['pid']) ? intval($_POST['pid']) : 0;
    $img = new CFile($_FILES['ps_attach']);
    if ($img->size > 0) {
        $dir = get_login($uid);
        // чтобы админ мог редактировать предложения по проектам
        if ($is_adm) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
            $user = new users();
            $user->GetUserByUID($uid);
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:upload.php

示例6: is_pro

/**
 * Является ли пользователь ПРО
 *
 * @param boolean $exact Проверять заного. либо взять из сессии пользователя
 * @param integer $uid   Проверять значение для пользователя c uid = $uid а не для текущего
 * @return boolean
 */
function is_pro($exact = false, $uid = false)
{
    if ($exact) {
        require_once ABS_PATH . "/classes/payed.php";
        if ($uid === false) {
            return payed::CheckPro($_SESSION['login']);
        } else {
            global $DB;
            $sql = "SELECT login FROM users\n\t\t          WHERE uid=?";
            $login = $DB->val($sql, $uid);
            return payed::CheckPro($login);
        }
    } else {
        return $_SESSION['pro_last'];
    }
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:23,代码来源:stdf.php

示例7: quickprjedit_save_prj


//.........这里部分代码省略.........
                    $tmpPrj->setProjectField('win_date', $frm['win_date']);
                    $tmpPrj->clearWinners();
                }
                $tmpPrj->setCategories($categories);
                $tmpPrj->setProjectField('link', $frm['link']);
                $tmpPrj->setProjectField('is_color', $frm['is_color'] == 1 ? 't' : 'f');
                $tmpPrj->setProjectField('is_bold', $frm['is_bold'] == 1 ? 't' : 'f');
                $tmpPrj->setAddedTopDays($frm['top_ok'] == 1 ? $frm['top_days'] : 0);
                if (!$project['folder_id']) {
                    $tmpPrj->setProjectField('folder_id', 0);
                }
                require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
                $attachedfiles = new attachedfiles($frm['attachedfiles_session']);
                $attachedfiles_files = $attachedfiles->getFiles(array(1, 3, 4));
                $tmpPrj->addAttachedFiles($attachedfiles_files);
                $attachedfiles->clear();
                $tmpPrj->saveProject(get_uid(false), $ttt);
                require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php';
                require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
                $stop_words = new stop_words(hasPermissions('projects'));
                $objResponse->script('popupQEditPrjHide();');
                switch ($type) {
                    case 1:
                    case 4:
                        // Лента проектов
                        global $session;
                        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
                        $prj_id = $project['id'];
                        $obj_project = new new_projects();
                        $tproject = $obj_project->getProjects($num, -1, 1, false, null, false, true, $prj_id);
                        $this_kind = $tproject[0]['kind'];
                        $this_uid = get_uid(false);
                        $this_pro_last = $_SESSION['pro_last'];
                        $this_is_pro = payed::CheckPro($_SESSION['login']);
                        $this_edit_mode = hasPermissions('projects');
                        if ($this_uid) {
                            $this_user_role = $_SESSION['role'];
                        }
                        $this_project = $tproject[0];
                        $row = $this_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;
                            $row['show_data'] = 1;
                        } else {
                            $this_show_data = 0;
                            $row['show_data'] = 0;
                        }
                        $descr = $row['descr'];
                        $descr = preg_replace('/^ /', "", $descr);
                        $descr = preg_replace("/(\n) /", "\$1", $descr);
                        $descr = reformat(strip_tags(LenghtFormatEx($descr, 180), '<br />'), 50, 1, 0, 1);
                        $descr = preg_replace("//", '&nbsp;', $descr);
                        $row['descr'] = $descr;
                        $row['t_is_payed'] = $this_project['payed'] && $this_project['kind'] != 2 && $this_project['kind'] != 7;
                        $row['t_is_contest'] = $this_project['kind'] == 2 || $this_project['kind'] == 7;
                        $row['t_pro_only'] = $this_project['pro_only'] == 't';
                        $row['t_verify_only'] = $this_project['verify_only'] == 't';
                        $row['t_hide'] = $this_project['hide'] == 't';
                        $row['t_urgent'] = $this_project['urgent'] == 't';
                        $row['t_prefer_sbr'] = $this_project['prefer_sbr'] == 't';
                        $row['priceby'] = $this_project['priceby'];
                        $row['t_is_adm'] = hasPermissions('projects');
                        $row['t_is_ontop'] = strtotime($this_project['top_to']) >= time();
                        $row['unread'] = (int) $this_project['unread_p_msgs'] + (int) $this_project['unread_c_msgs'] + (int) $this_project['unread_c_prjs'];
                        $row['t_is_proonly'] = $this_project['pro_only'] == 't' && !$_SESSION['pro_last'] && !$this_edit_mode && $this_uid != $this_project['user_id'];
                        $attaches = projects::GetAllAttach($this_project['id']);
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:67,代码来源:projects-quick-edit.server.php

示例8: ShowProjects

 /**
  * Функция генерации ленты проектов.
  *
  * @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("//", '&nbsp;', $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();
//.........这里部分代码省略.........
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:101,代码来源:projects_lenta.php

示例9: SetGiftResv

/**
 * Делает отметку о получении подарка(просмотре подарка) по id подарка и UID
 *
 * @param integer $uid
 */
function SetGiftResv($gid)
{
    session_start();
    $uid = get_uid(false);
    $gid = intval($gid);
    $uid = intval($uid);
    if (!$gid || !$uid) {
        $resp['success'] = false;
        echo json_encode($resp);
        return;
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/present.php";
    present::SetGiftResv($gid, $uid);
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php";
    $is_pro = payed::CheckPro($_SESSION['login']);
    $pro_last = payed::ProLast($_SESSION['login']);
    if ($pro_last['freeze_to']) {
        $_SESSION['freeze_from'] = $pro_last['freeze_from'];
        $_SESSION['freeze_to'] = $pro_last['freeze_to'];
        $_SESSION['is_freezed'] = $pro_last['is_freezed'];
        $_SESSION['payed_to'] = $pro_last['cnt'];
    }
    $_SESSION['pro_last'] = $pro_last['is_freezed'] ? false : $pro_last['cnt'];
    $resp['id'] = $gid;
    $resp['success'] = true;
    echo json_encode($resp);
    return;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:33,代码来源:users.server.php

示例10: __commShaolin

/**
 * Проверяет туда ли попал пользователь и есть ли у него на это право.
 * Возвращает адрес переброски пользователя, если он не туда попал,
 * и если не NULL, то надо будет вызвать header().
 * Если NULL, но $error не пуст, то надо будет выдать страницу ошибок __COMMUNES__ERROR и
 * прекратить операцию.
 * Заодно заполняет необходимые переменные.
 *
 * @global $uid    Ид пользователя
 * @global $id     Ид сообщения
 * @global $top_id Ид вкладки ТОП
 * @global $site   Сайт
 * @global $action Действие для данной функции при отсылке данных (submit)
 * 
 * @param string  $error Возвращает сообщение об ошибке
 * @param array   $comm  Возвращает данные по комментариям
 * @param array   $top   Возвращает популярные сообщения
 * @param integer $restrict_type  Возвращает тип пользования
 * @param integer $user_mod Возвращает битовую маску прав пользователя
 * @return string если не null, название страницы куда перенести пользователя
 */
function __commShaolin(&$error, &$comm, &$top, &$restrict_type, &$user_mod)
{
    global $uid, $id, $top_id, $site, $action, $draft_id;
    $comm = NULL;
    $user_mod = 0;
    if ($uid) {
        $user_mod = commune::MOD_ADMIN * hasPermissions('communes');
        $user_mod |= commune::MOD_MODER * ($user_mod & commune::MOD_ADMIN || hasPermissions('communes'));
        $user_mod |= commune::MOD_PRO * (payed::CheckPro(get_login($uid)) ? 1 : 0);
        $user_mod |= commune::MOD_EMPLOYER * (int) is_emp();
        $user_mod |= commune::MOD_BANNED * is_banned($uid);
    }
    if (!$id) {
        if (!$site) {
            return NULL;
        }
        if ($site == 'Create') {
            if (!$uid) {
                return '/fbd.php';
            }
            if (!($user_mod & (commune::MOD_PRO | commune::MOD_ADMIN))) {
                /*if ($user_mod & commune::MOD_EMPLOYER)
                  return '/payed-emp/';*/
                return '/proonly.php';
            }
            if (($limit = commune::GetUserCommunesLimits($uid)) && $limit['user_communes_count']) {
                if ($limit['user_communes_count'] >= commune::MAX_COUNT) {
                    $error['name'] = 'Создание вашего сообщества';
                    $error['message'] = 'Вы уже создали максимальное количество сообществ.';
                    return NULL;
                }
                $seconds = $limit['seconds_passed_since_user_created_his_last_commune'];
                if ($seconds < commune::CREATION_INTERVAL) {
                    $error['name'] = 'Создание вашего сообщества';
                    $wait = commune::CREATION_INTERVAL - $seconds;
                    $error['message'] = "Подождите {$wait} " . getSymbolicName($wait, 'second') . '.';
                    return NULL;
                }
            }
        } else {
            return '/404.php';
        }
        return NULL;
    }
    if (!($comm = commune::GetCommune($id, !$uid ? NULL : $uid, $user_mod))) {
        return '/commune/';
    }
    if (!$uid) {
        if ($action) {
            return "/commune/?id={$id}";
        }
        if ($site == 'Topic') {
        } else {
            if ($site == 'Join') {
                return '/fbd.php';
            } else {
                if ($site == 'Members') {
                    return '/fbd.php';
                } else {
                    if ($site) {
                        return "/commune/?id={$id}";
                    }
                }
            }
        }
    } else {
        if ($uStatus = commune::GetUserCommuneRel($id, $uid)) {
            $user_mod |= commune::MOD_COMM_MODERATOR * $uStatus['is_moderator'];
            $user_mod |= commune::MOD_COMM_MANAGER * $uStatus['is_manager'];
            $user_mod |= commune::MOD_COMM_ADMIN * ($uStatus['is_admin'] || $uStatus['is_moderator'] || $uStatus['is_manager']);
            $user_mod |= commune::MOD_COMM_AUTHOR * $uStatus['is_author'];
            $user_mod |= commune::MOD_COMM_ASKED * $uStatus['is_asked'];
            $user_mod |= commune::MOD_COMM_ACCEPTED * ($uStatus['is_accepted'] || $user_mod & commune::MOD_COMM_ADMIN);
            $user_mod |= commune::MOD_COMM_BANNED * $uStatus['is_banned'];
        }
    }
    if ($comm['is_blocked'] && !($user_mod & commune::MOD_MODER)) {
        if ($comm['author_id'] != $uid || $comm['author_id'] == $uid && ($site && $site != 'Members' || $action)) {
            return '/commune/';
//.........这里部分代码省略.........
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:commune.php


注:本文中的payed::CheckPro方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。