Example #1
0
function mob_get_id_by_url($rpcmsg)
{
    global $boardurl;
    $topic = '';
    $post = '';
    $board = '';
    $url = $rpcmsg->getScalarValParam(0);
    $url = parse_url($url);
    $host = parse_url($boardurl);
    // Make sure this belongs to the same site
    if ($url['host'] == $host['host'] && $host['path'] == substr($url['path'], 0, strlen($host['path']))) {
        // Parse the GET
        $get = parse_get($url['query']);
        $topic = isset($get['topic']) ? strpos($get['topic'], '.') !== false ? substr($get['topic'], 0, strpos($get['topic'], '.')) : $get['topic'] : '';
        $board = isset($get['board']) ? strpos($get['board'], '.') !== false ? substr($get['board'], 0, strpos($get['board'], '.')) : $get['board'] : '';
        $post = isset($get['msg']) ? $get['msg'] : (isset($get['topic']) && substr($get['topic'], strpos($get['topic'], '.') + 1, 3) == 'msg' ? substr($get['topic'], strpos($get['topic'], '.') + 4) : '');
    }
    return new xmlrpcresp(new xmlrpcval(array('post_id' => new xmlrpcval($post, 'string'), 'forum_id' => new xmlrpcval($board, 'string'), 'topic_id' => new xmlrpcval($topic, 'string')), 'struct'));
}
Example #2
0
function parse_struct($struct)
{
    //Now let's deal with struct
    global $stringType;
    $reg = "/<struct-" . $stringType . ">(.+?)<\\/struct-" . $stringType . ">/is";
    $all_names = parse_get($struct, 'name');
    $all_values = parse_get($struct, 'struct-value');
    foreach ($all_values as $single_value) {
        $try = preg_match($reg, $single_value, $matches);
        @(list($whole, $type, $value) = $matches);
        $result_values[] = $value;
        //I don't care any types
        unset($whole, $type, $value);
    }
    $all_values = $result_values;
    for ($i = 0; $i < count($all_names); $i++) {
        $key = $all_names[$i];
        $value = $all_values[$i];
        $result[$key] = $value;
    }
    return $result;
}