Example #1
0
function mob_m_move_post($rpcmsg)
{
    global $board, $sc, $topic, $mobdb, $user_info, $context, $sourcedir, $func;
    checkSession('session');
    require_once $sourcedir . '/SplitTopics.php';
    require_once $sourcedir . '/Subs-Boards.php';
    require_once $sourcedir . '/Subs-Post.php';
    $postinfo = get_postinfo($rpcmsg->getScalarValParam(0));
    $topicinfo = get_topicinfo($postinfo['id_topic']);
    $topic = $postinfo['id_topic'];
    $board = $postinfo['id_board'];
    loadBoard();
    loadPermissions();
    // Make sure this is not the first post
    if ($postinfo['id_msg'] == $topicinfo['id_first_msg']) {
        mob_error('cannot move first post of the topic');
    }
    // Are we moving the post to a new topic?
    if (!is_null($rpcmsg->getScalarValParam(1)) && $rpcmsg->getScalarValParam(1) != '') {
        // We need to have move_any for this
        if (!allowedTo('move_any')) {
            mob_error('cannot move post to a topic');
        }
        $topicinfo = get_topicinfo($rpcmsg->getScalarValParam(1));
        if (empty($topicinfo)) {
            mob_error('topic not found');
        }
        // Split the post into a new one first
        $new_topic = splitTopic($postinfo['id_topic'], array($postinfo['id_msg']), $postinfo['subject']);
        if (empty($new_topic)) {
            mob_error('something bad happened');
        }
        // Merge the topic into the existing one
        do_merge(array($topicinfo['id_topic'], $new_topic));
    } else {
        $topicinfo = get_topicinfo($topic);
        // We can have move_own for this
        if (!(allowedTo('move_any') || allowedTo('move_own') && $user_info['id'] == $topicinfo['id_member_started'])) {
            mob_error('cannot move post to a new topic');
        }
        $subject = strtr($func['htmlspecialchars']($rpcmsg->getScalarValParam(2)), array("\r" => '', "\n" => '', "\t" => ''));
        $new_board = $rpcmsg->getParam(3) ? get_boardinfo($rpcmsg->getScalarValParam(3)) : get_boardinfo($postinfo['id_board']);
        if (trim($subject) == '' || empty($new_board)) {
            mob_error('subject or board invalid');
        }
        // Split the topic
        $new_topic = splitTopic($postinfo['id_topic'], array($postinfo['id_msg']), $subject);
        if (empty($new_topic)) {
            mob_error('something bad happened');
        }
        if ($board != $new_board['id_board']) {
            move_topic($new_topic, $board, $new_board, $topicinfo);
        }
    }
    // Return a true response
    return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean')), 'struct'));
}
Example #2
0
<?php 
// blocco topic
if (@$_POST['block'] == 1) {
    manage_block_topic($username, $id);
}
// cancello topic
if (@$_POST['delete_topic'] == 1) {
    delete_topic($username, $id);
}
// aggiunta nuovo messaggio
if (@$_GET['send'] == 1) {
    insert_topic(@$_POST['reply'], $id);
}
// sposto topic
if (@$_GET['move_topic'] == 1) {
    move_topic(@$_POST['move_t_id'], @$_POST['to_forum']);
}
// setta topic
if (@$_GET['set_topic'] == 1) {
    set_topic(@$_POST['set_topic'], $id);
}
$t_id = check_t_id($id);
$query = "SELECT  id, f_id, t_id, author, title, data, replyof, last, ora, date \n\t\t    FROM " . __PREFIX__ . "topic \n\t\t   WHERE id = '" . $id . "' \n\t\t      OR replyof = '" . $id . "' \n\t\t   ORDER BY id, last DESC";
$res = mysql_query($query);
while ($row = mysql_fetch_row($res)) {
    $query_2 = "SELECT email, web_site, msn, level, id, firma \n\t\t\t\t   FROM " . __PREFIX__ . "users \n\t\t\t\t  WHERE username = '******'";
    $row_info = mysql_fetch_row(mysql_query($query_2));
    $mail = login($username, $password) == FALSE ? '<i>Login richiesto!</i>' : check_null($row_info[0], 1);
    ?>

<div id="content">