Exemplo n.º 1
0
if ($pretty_url_base && !mu_url() && !('http://' . $subdomain . "." . $rest == $pretty_url_base)) {
    $request->base = 'http://' . $subdomain . "." . $rest;
    $request->domain = $subdomain . "." . $rest;
    $pretty_url_base = $request->base;
    $stream = $subdomain;
    // XXX subdomain upgrade
} elseif (mu_url()) {
    $pattern = '/(\\?)?twitter\\/([a-z]+)(\\/?)/';
    if (1 <= preg_match_all($pattern, $request->uri, $found)) {
        $uri = $request->uri;
        $tags[] = $found;
        // XXX subdomain upgrade
        $repl = 'twitter/' . $tags[0][2][0] . $tags[0][3][0];
        $request->uri = str_replace($repl, '', $uri);
        $request->prefix = $repl;
        $request->setup();
        $trail = '';
        if (empty($tags[0][3][0])) {
            $trail = "/";
        }
        $request->base = substr($uri, 0, strpos($uri, $tags[0][0][0]) + (strlen($repl) + 1)) . $trail;
    }
    $stream = $tags[0][2][0];
} elseif (isset($params['username']) && isset($params['password'])) {
    $sql = "SELECT nickname,profile_id FROM shorteners WHERE nickname LIKE '" . $db->escape_string($params['username']) . "'";
    $sql .= " AND password LIKE '" . $db->escape_string($params['password']) . "'";
    $result = $db->get_result($sql);
    if ($db->num_rows($result) == 1) {
        $stream = $db->result_value($result, 0, "nickname");
        $request->base = 'http://' . $stream . "." . $rest;
        $request->domain = $stream . "." . $rest;