示例#1
0
 function main($id, $mode)
 {
     global $auth, $db, $user, $template, $action;
     global $config, $phpbb_root_path, $phpEx, $request;
     global $phpbb_dispatcher;
     $quickmod = $mode == 'quickmod' ? true : false;
     switch ($action) {
         case 'lock':
         case 'unlock':
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             lock_unlock($action, $topic_ids);
             break;
         case 'lock_post':
         case 'unlock_post':
             $post_ids = !$quickmod ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             lock_unlock($action, $post_ids);
             break;
         case 'make_announce':
         case 'make_sticky':
         case 'make_global':
         case 'make_normal':
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             change_topic_type($action, $topic_ids);
             break;
         case 'move':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_move_topic($topic_ids);
             break;
         case 'fork':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_fork_topic($topic_ids);
             break;
         case 'delete_topic':
             $user->add_lang('viewtopic');
             // f parameter is not reliable for permission usage, however we just use it to decide
             // which permission we will check later on. So if it is manipulated, we will still catch it later on.
             $forum_id = $request->variable('f', 0);
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             $soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true));
             break;
         case 'delete_post':
             $user->add_lang('posting');
             // f parameter is not reliable for permission usage, however we just use it to decide
             // which permission we will check later on. So if it is manipulated, we will still catch it later on.
             $forum_id = $request->variable('f', 0);
             $post_ids = !$quickmod ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
             $soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true));
             break;
         case 'restore_topic':
             $user->add_lang('posting');
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_restore_topic($topic_ids);
             break;
         default:
             /**
              * This event allows you to handle custom quickmod options
              *
              * @event core.modify_quickmod_actions
              * @var	string	action		Topic quick moderation action name
              * @var	bool	quickmod	Flag indicating whether MCP is in quick moderation mode
              * @since 3.1.0-a4
              * @change 3.1.0-RC4 Added variables: action, quickmod
              */
             $vars = array('action', 'quickmod');
             extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
             break;
     }
     switch ($mode) {
         case 'front':
             include $phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx;
             $user->add_lang('acp/common');
             mcp_front_view($id, $mode, $action);
             $this->tpl_name = 'mcp_front';
             $this->page_title = 'MCP_MAIN';
             break;
         case 'forum_view':
             include $phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx;
             $user->add_lang('viewforum');
             $forum_id = $request->variable('f', 0);
             $forum_info = phpbb_get_forum_data($forum_id, 'm_', true);
             if (!sizeof($forum_info)) {
                 $this->main('main', 'front');
                 return;
             }
             $forum_info = $forum_info[$forum_id];
             mcp_forum_view($id, $mode, $action, $forum_info);
             $this->tpl_name = 'mcp_forum';
             $this->page_title = 'MCP_MAIN_FORUM_VIEW';
             break;
         case 'topic_view':
             include $phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx;
             mcp_topic_view($id, $mode, $action);
             $this->tpl_name = 'mcp_topic';
             $this->page_title = 'MCP_MAIN_TOPIC_VIEW';
             break;
         case 'post_details':
             include $phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx;
             mcp_post_details($id, $mode, $action);
             $this->tpl_name = $action == 'whois' ? 'mcp_whois' : 'mcp_post';
             $this->page_title = 'MCP_MAIN_POST_DETAILS';
             break;
         default:
             if ($quickmod) {
                 switch ($action) {
                     case 'lock':
                     case 'unlock':
                     case 'make_announce':
                     case 'make_sticky':
                     case 'make_global':
                     case 'make_normal':
                     case 'make_onindex':
                     case 'move':
                     case 'fork':
                     case 'delete_topic':
                         trigger_error('TOPIC_NOT_EXIST');
                         break;
                     case 'lock_post':
                     case 'unlock_post':
                     case 'delete_post':
                         trigger_error('POST_NOT_EXIST');
                         break;
                 }
             }
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
 }
示例#2
0
    header('Location: /index.html');
    exit(0);
} else {
    // Если пользователь является заказчиком, ему доступна данная операция
    if ($_SESSION['profile']['type'] == 0) {
        $order = null;
        if (array_key_exists('order', $_SERVER)) {
            $orderId = filter_var($_SERVER['order'], FILTER_VALIDATE_INT);
            if ($orderId !== false) {
                includeModule('order');
                // Атомарно отмечаем заказ удаленным
                if (lock_lock($orderId, 2, 1)) {
                    if (order_delete($orderId, $_SESSION['profile']['user_id'])) {
                        // Если удалось удалить заказ, прогреваем кеш для поиска заказов соответсвующим образом
                        includeModule('cache');
                        cache_delete($orderId);
                        lock_unlock($orderId);
                        return ['completed' => true];
                    } else {
                        lock_unlock($orderId);
                    }
                } else {
                    return ['error' => 'order locked'];
                }
            }
        }
        return ['error' => 'order not found'];
    } else {
        return ['error' => 'permission denied'];
    }
}
示例#3
0
switch ($mode) {
    case 'lock':
    case 'unlock':
        $topic_ids = get_topic_ids($quick_mod);
        if (empty($topic_ids)) {
            trigger_error('NO_TOPIC_SELECTED');
        }
        lock_unlock($mode, $topic_ids);
        break;
    case 'lock_post':
    case 'unlock_post':
        $post_ids = get_post_ids($quick_mod);
        if (empty($post_ids)) {
            trigger_error('NO_POST_SELECTED');
        }
        lock_unlock($mode, $post_ids);
        break;
    case 'make_announce':
    case 'make_sticky':
    case 'make_global':
    case 'make_normal':
        $topic_ids = get_topic_ids($quick_mod);
        $forum_id = get_variable('f', 'REQUEST');
        if (empty($topic_ids)) {
            trigger_error('NO_TOPIC_SELECTED');
        }
        change_topic_type($mode, $topic_ids, $forum_id);
        break;
    case 'move':
        $_CLASS['core_user']->add_lang('viewtopic');
        $topic_ids = get_topic_ids($quick_mod);
示例#4
0
 function main($id, $mode)
 {
     global $auth, $db, $user, $template, $action;
     global $config, $phpbb_root_path, $phpEx;
     $quickmod = $mode == 'quickmod' ? true : false;
     switch ($action) {
         case 'lock':
         case 'unlock':
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             lock_unlock($action, $topic_ids);
             break;
         case 'lock_post':
         case 'unlock_post':
             $post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             lock_unlock($action, $post_ids);
             break;
         case 'make_announce':
         case 'make_sticky':
         case 'make_global':
         case 'make_normal':
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             change_topic_type($action, $topic_ids);
             break;
         case 'move':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_move_topic($topic_ids);
             break;
         case 'fork':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_fork_topic($topic_ids);
             break;
         case 'delete_topic':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_delete_topic($topic_ids);
             break;
         case 'delete_post':
             $user->add_lang('posting');
             $post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             mcp_delete_post($post_ids);
             break;
     }
     switch ($mode) {
         case 'front':
             include $phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx;
             $user->add_lang('acp/common');
             mcp_front_view($id, $mode, $action);
             $this->tpl_name = 'mcp_front';
             $this->page_title = 'MCP_MAIN';
             break;
         case 'forum_view':
             include $phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx;
             $user->add_lang('viewforum');
             $forum_id = request_var('f', 0);
             $forum_info = get_forum_data($forum_id, 'm_', true);
             if (!sizeof($forum_info)) {
                 $this->main('main', 'front');
                 return;
             }
             $forum_info = $forum_info[$forum_id];
             mcp_forum_view($id, $mode, $action, $forum_info);
             $this->tpl_name = 'mcp_forum';
             $this->page_title = 'MCP_MAIN_FORUM_VIEW';
             break;
         case 'topic_view':
             include $phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx;
             mcp_topic_view($id, $mode, $action);
             $this->tpl_name = 'mcp_topic';
             $this->page_title = 'MCP_MAIN_TOPIC_VIEW';
             break;
         case 'post_details':
             include $phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx;
             mcp_post_details($id, $mode, $action);
             $this->tpl_name = $action == 'whois' ? 'mcp_whois' : 'mcp_post';
             $this->page_title = 'MCP_MAIN_POST_DETAILS';
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
 }
$action = get_variable('action', 'REQUEST');
$icon_id = get_variable('icon', 'REQUEST', false, 'int');
$subject = get_variable('subject', 'POST');
$start = get_variable('start', 'REQUEST', false, 'int');
$to_topic_id = get_variable('to_topic_id', 'REQUEST', false, 'int');
$to_forum_id = get_variable('to_forum_id', 'REQUEST', false, 'int');
$post_id_list = array_unique(get_variable('post_id_list', 'REQUEST', array(), 'array:int'));
switch ($action) {
    case 'lock_post':
    case 'unlock_post':
        $post_ids = get_post_ids($quick_mod);
        if (empty($post_ids)) {
            trigger_error('NO_POST_SELECTED');
        }
        require_once SITE_FILE_ROOT . 'includes/forums/mcp/mcp_main.php';
        lock_unlock($action, $post_ids);
        break;
    case 'delete_post':
        $_CLASS['core_user']->add_lang('posting');
        $post_ids = get_post_ids($quick_mod);
        if (empty($post_ids)) {
            trigger_error('NO_POST_SELECTED');
        }
        require_once SITE_FILE_ROOT . 'includes/forums/mcp/mcp_main.php';
        mcp_delete_post($post_ids);
        break;
    case 'split_all':
    case 'split_beyond':
        if ($message = split_topic($action, $post_id_list, $topic_id, $to_forum_id, $subject)) {
            $_CLASS['core_template']->assign('MESSAGE', $_CLASS['core_user']->get_lang($message));
        }