Skip to content

Commit

Permalink
streams fix
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Jul 31, 2009
1 parent 77d2f7e commit 92b9a27
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
5 changes: 4 additions & 1 deletion app/omb/models/Post.php
Expand Up @@ -6,7 +6,10 @@ function Post() {

// fields

$this->char_field( 'title', TWEET_SIZE );
if (TWEET_SIZE)
$this->char_field( 'title', TWEET_SIZE );
else
$this->char_field( 'title' );

$this->text_field( 'body' );

Expand Down
46 changes: 24 additions & 22 deletions db/boot.php
Expand Up @@ -380,33 +380,35 @@
* OMB MU setup
*/

if (isset($pretty_url_base) && !empty($pretty_url_base)) {
list($subdomain, $rest) = explode('.', $_SERVER['SERVER_NAME'], 2);
if (!strpos($request->uri, 'twitter/') && !($subdomain.".".$rest == $pretty_url_base)) {
$request->base = 'http://'.$subdomain.".".$rest;
$request->domain = $subdomain.".".$rest;
$pretty_url_base = $request->base;
} elseif (strpos($request->uri, 'twitter/')) {
$pattern='/(\?)?twitter\/([a-z]+)(\/?)/';
if ( 1 <= preg_match_all( $pattern, $request->uri, $found )) {
$uri = $request->uri;
$tags[] = $found;
$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;
}
$subdomain = $tags[0][2][0];
$stream = false;
list($subdomain, $rest) = explode('.', $_SERVER['SERVER_NAME'], 2);
if (!strpos($request->uri, 'twitter/') && !('http://'.$subdomain.".".$rest == $pretty_url_base)) {
$request->base = 'http://'.$subdomain.".".$rest;
$request->domain = $subdomain.".".$rest;
$pretty_url_base = $request->base;
$stream = $subdomain;
} elseif (strpos($request->uri, 'twitter/')) {
$pattern='/(\?)?twitter\/([a-z]+)(\/?)/';
if ( 1 <= preg_match_all( $pattern, $request->uri, $found )) {
$uri = $request->uri;
$tags[] = $found;
$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];
}
if ($stream) {
if (!$db->table_exists('blogs')) {
$Blog =& $db->model('Blog');
$Blog->save();
}
$sql = "SELECT prefix FROM blogs WHERE nickname LIKE '".$db->escape_string($subdomain)."'";
$sql = "SELECT prefix FROM blogs WHERE nickname LIKE '".$db->escape_string($stream)."'";
$result = $db->get_result( $sql );
if ( $db->num_rows($result) == 1 ) {
global $prefix;
Expand Down

0 comments on commit 92b9a27

Please sign in to comment.