Skip to:
Content
Pages
Categories
Search
Top
Bottom

XMLRPC and a Poster's IP address.


  • master5o1
    Participant

    @master5o1

    While developing and testing my bbPress Mobile XMLRPC interface, I have come across a situation where the poster IP would be of the server that bbPress Mobile is hosted on, not the actual poster’s IP address.

    I would like to suggest that it be possible for the poster’s IP address be able to be set if the post is sent through XMLRPC. This way, I would be able to pass-through the IP address of the poster through bbPress Mobile. Fall back would be of the server’s IP that hosts bbPress Mobile.

    I understand that it would currently be working correctly for a client that is on the user’s machine, such as a native Android application.

    I’m going to try and figure out whether I can incorporate this functionality into my XMLRPC Client Info plugin or whether I need to patch bbPress core.

Viewing 6 replies - 1 through 6 (of 6 total)

  • master5o1
    Participant

    @master5o1

    Sweet. In my plugin, I just made this:

    if ( isset($_GET['poster_ip']) && !empty($_GET['poster_ip']) ) {
    $bbdb->query( $bbdb->prepare( "UPDATE $bbdb->posts SET poster_ip = %s WHERE post_id = %d", $_GET['poster_ip'], $post_id ) );
    }

    And the .'&poster_ip='.$_SERVER['REMOTE_ADDR'] is in bbPress Mobile.

    It would probably be better doing it a different way, can anyone suggest something?


    master5o1
    Participant

    @master5o1

    Sweet. In my plugin, I just made this:

    if ( isset($_GET['poster_ip']) && !empty($_GET['poster_ip']) ) {
    $bbdb->query( $bbdb->prepare( "UPDATE $bbdb->posts SET poster_ip = %s WHERE post_id = %d", $_GET['poster_ip'], $post_id ) );
    }

    And the .'&poster_ip='.$_SERVER['REMOTE_ADDR'] is in bbPress Mobile.

    It would probably be better doing it a different way, can anyone suggest something?


    master5o1
    Participant

    @master5o1

    Just managed another way by patching bbPress’ xmlrpc.php and overwriting $_SERVER with the desired value.

    // Poster IP
    $_SERVER['REMOTE_ADDR'] = isset( $structure['poster_ip'] ) ? $structure['poster_ip'] : $_SERVER['REMOTE_ADDR'];

    Then what I do on the bbPress Mobile side is send the data:

    $params_array = new xmlrpcval(
    array(
    "title" => new xmlrpcval($title, "string"),
    "text" => new xmlrpcval($text, "string"),
    "forum_id" => new xmlrpcval($forum_id, "int"),
    "tags" => new xmlrpcval($tags, "string"),
    "poster_ip" => new xmlrpcval($_SERVER['REMOTE_ADDR'], "string")),
    "struct");


    master5o1
    Participant

    @master5o1

    Just managed another way by patching bbPress’ xmlrpc.php and overwriting $_SERVER with the desired value.

    // Poster IP
    $_SERVER['REMOTE_ADDR'] = isset( $structure['poster_ip'] ) ? $structure['poster_ip'] : $_SERVER['REMOTE_ADDR'];

    Then what I do on the bbPress Mobile side is send the data:

    $params_array = new xmlrpcval(
    array(
    "title" => new xmlrpcval($title, "string"),
    "text" => new xmlrpcval($text, "string"),
    "forum_id" => new xmlrpcval($forum_id, "int"),
    "tags" => new xmlrpcval($tags, "string"),
    "poster_ip" => new xmlrpcval($_SERVER['REMOTE_ADDR'], "string")),
    "struct");


    master5o1
    Participant

    @master5o1

    https://trac.bbpress.org/ticket/1355

    I have opened a ticket that provides a patch for xmlrpc.php.


    master5o1
    Participant

    @master5o1

    https://trac.bbpress.org/ticket/1355

    I have opened a ticket that provides a patch for xmlrpc.php.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar