diff --git a/README b/README deleted file mode 100755 index fbd9e2c..0000000 --- a/README +++ /dev/null @@ -1,255 +0,0 @@ - - -OpenMicroBlogger -- Standards-based Microblog -Copyright (C) 2009 Brian Hendrickson - -This application is free software; you can redistribute it and/or -modify it under the terms of the MIT License. - -This application is distributed in the hope that it will be useful, -but without any warranty; without even the implied warranty of -merchantability or fitness for a particular purpose. - -Author - Brian Hendrickson - http://brianhendrickson.com - -Project Manager - Johannes Schirge - http://tiquer.me - - -Version 0.1, 1-Sep-2008 - initial release - -Version 0.2, 22-Oct-2008 - sms, app store - -Version 0.3, 10-July-2009 - admin, themes, intranet, search - -Version 0.4, 12-Dec-2009 - wiki, twitter, facebook - -Version 0.5, 1-Mar-2010 - rssCloud, rssWave - - -REQUIREMENTS - - - PHP > 4.2 - - MySQL or PostgreSQL - - -INSTALLATION - -///////////////////// -// 7 steps to install -///////////////////// - -1. obtain OpenMicroBlogger http://dbscript.net/omb.zip - -2. unzip the files on your computer - -3. copy the files to your Web server folder - -4. open your Web browser and run - yourdomain.com/install.php - -5. follow the installation instructions - -6. if installation succeeded, open your Web browser and browse to the installation folder - -7. set in app/config/config.yml your - - site_title: Your Site Title - site_subtitle: Your Site Subtitle - site_description: Your Site Description - - [[ that is it! ]] - - -///////////////////////////////// -// Facebook, Twitter, Zeep Mobile -///////////////////////////////// - -Facebook: - - 1. http://www.facebook.com/developers/apps.php - 2. click "Edit Settings" - 3. click "Connect" -your connect URL is - http://yoursite.com/?email_login -get an infinite session key: 3 steps: - http://www.facebook.com/code_gen.php?v=1.0&api_key=[api key] - http://yoursite.com/permanent_facebook_key/[code from step 1] - add to config.yml -> facebookSession: [key from step 2] - -Twitter: - - 1. http://twitter.com/oauth_clients -your callback URL is - http://yoursite.com/?oauth_login [or] - http://yoursite.com/oauth_login (pretty URLs) - -Zeep Mobile: - - 1. https://secure.zeepmobile.com/account/create_app -your callback URL is - http://yoursite.com/?mobile_event [or] - http://yoursite.com/mobile_event (pretty URLs) -your website URL is - http://yoursite.com/?mobile_settings [or] - http://yoursite.com/mobile_settings (pretty URLs) - -Google: - - 1. https://www.google.com/accounts/ManageDomains - - -///////////////////////////// -// use pretty URLs (optional) -///////////////////////////// - -To enable pretty URLs: - -1) edit config.php (or config/config.php if you used Web installer) - -2) change the 2 lines at the bottom of config.php - - // global $pretty_url_base; - // $pretty_url_base = "http://openmicroblogger.com"; - - [[ change the 2 lines like this ]] - - global $pretty_url_base; - $pretty_url_base = "http://yoursite.com"; - -3) copy the file /resource/prettyurls/.htaccess to the top level folder - -4) change these 2 lines in .htaccess - - RewriteCond %{HTTP_HOST} ^www.openmicroblogger.com$ [NC] - RewriteRule ^(.*)$ http://openmicroblogger.com/$1 [R=301,L] - - [[ change the 2 lines like this ]] - - RewriteCond %{HTTP_HOST} ^www.yoursite.com$ [NC] - RewriteRule ^(.*)$ http://yoursite.com/$1 [R=301,L] - -5) if you need to use [www.]yoursite.com or [blog.]yoursite.com - - [[ use this 1 line instead of 2 in your.htaccess ]] - - RewriteRule ^(.*)$ http://blah.yoursite.com/$1 [R=301,L] - -Notes: - "AllowEncodedSlashes On" is required in the VirtualHost (Apache > 2.0.46) - todo: add a test for this problem XXX - - -/////////////////////////////////////// -// (optional) choose a file upload mode -/////////////////////////////////////// - -1) upload FILES to /uploads (do not create BLOBs) (default) - - set permissions on the /cache and /uploads folders - - next, edit app/config/config.yml - - look for - - collection_cache: - - posts: - duration : 0 - location : cache // and change 'cache' to 'uploads' - -2) upload as SQL BLOBs - - maximum upload size is 5MB or so, not that great for big MP3s, but maximizes privacy - - you must set the /cache folder permissions so the Flash uploader can put files there - -3) upload as SQL BLOBs (WITH CACHING) - - first set up your /cache folder as described in option 2 - - then, edit app/config/config.yml - - look for - - collection_cache: - - posts: - duration : 0 // and change this 0 to the number of seconds to cache - location : cache - -4) upload to Amazon S3 (do not create BLOBs) - - set permissions on the /cache folder - - then, edit app/config/config.yml - - look for - - collection_cache: - - posts: - duration : 0 - location : cache // and change 'cache' to 'aws' - - look for - - awsAccessKey: // and put your AWS login info here - awsSecretKey: - awsBucket: - - -UPDATING - -///////////////////////////// -// use the /wp-content folder -///////////////////////////// - -If you want to customize OpenMicroBlogger with your own theme and plugins: - -1) copy /app/config/config.yml to /wp-content/config - -2) duplicate a theme in /wp-content/themes - -3) optionally, add plugins to /wp-content/plugins - - note: plugins in this folder override same-name plugins in /app/plugins - - -/////////////////////////// -// get the latest build -/////////////////////////// - -you can grab the almost-nightly build from http://dbscript.net/omb.zip - - - -////////////////// - -OTHER DOCUMENTATION - -1. changing the maximum number of tags shown in the sidebar - - The /app/omb/views/categories/_block.js file can be edited to change this setting. - At the top of this file the $category_count variable is set to 10 by default. - -2. login timeout can be set by changing "cookielife" in config.yml - -3. creating a Contact Page/Impressum/About page: as an administrator you will have an app called "Pages" - use this app to add new pages, links to these will appear in the footer of your P2-themed site - -4. to change the allowed file-types for uploads, in config.yml is the "upload_types" list - -5. configuring twitter-follow feature: in the site Admin panel is a new tab called 'Sources' - choose from the full list of your site's OAuth-authenticated twitter users - set "friends_timeline" on the users you want to import automatically - here are the steps to set up the automatic twitter feed: - 1. see instructions above to set your "callback url" at Twitter and put key/secret in config.yml - 2. authenticate to the site as the Twitter user whose friends you want to import automatically - 3. set up a cron job to run db/library/remy-tweed/cron.php -- this example runs once a minute: - 0-59 * * * * /usr/bin/php /home/webuser/public_html/db/library/remy-tweed/cron.php 2>&1 - - diff --git a/app/apps/apps.php b/app/apps/apps.php deleted file mode 100644 index 073ad93..0000000 --- a/app/apps/apps.php +++ /dev/null @@ -1,20 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->url_for(array('action'=>'entry','resource'=>'auctions','id'=>$request->params['auctionbullet']['auction_id'] ))); -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->url_for(array('action'=>'entry','resource'=>'auctions','id'=>$request->params['auctionbullet']['auction_id'] ))); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -?> \ No newline at end of file diff --git a/app/auction/controllers/auction_photos.php b/app/auction/controllers/auction_photos.php deleted file mode 100755 index 15519b8..0000000 --- a/app/auction/controllers/auction_photos.php +++ /dev/null @@ -1,135 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->url_for(array('action'=>'entry','resource'=>'auctions','id'=>$request->params['auctionphoto']['auction_id'] ))); -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->url_for(array('action'=>'entry','resource'=>'auctions','id'=>$request->params['auctionphoto']['auction_id'] ))); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -?> \ No newline at end of file diff --git a/app/auction/controllers/auctions.php b/app/auction/controllers/auctions.php deleted file mode 100755 index 8558241..0000000 --- a/app/auction/controllers/auctions.php +++ /dev/null @@ -1,206 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->url_for(array('resource'=>'auctions','id'=>$request->id,'action'=>'entry'))); -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->url_for(array('resource'=>'auctions','id'=>$request->id,'action'=>'entry'))); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function post_as_notice( &$vars ) { - - extract($vars); - - $Member = $Auction->find($request->id); - - $o = owner_of($Member); - - if (!($o->id == get_profile_id())) - trigger_error('your profile id does not match the owner of the auction', E_USER_ERROR); - - $adsrc = ' - -
- -

'.$Member->headline.'

- -

'.$Member->body.'

- - - -

- '.$Member->close.' -

'; - - while ($photo = $Member->NextChild("auction_photos")) { - $adsrc .= ' "auction_photos","id"=>$photo->id,"action"=>"photo.jpg")).'" border="0" />'; - } - - $adsrc .= '
'; - - $p = $Post->base(); - $p->set_value( 'profile_id', $o->id ); - $p->set_value( 'parent_id', 0 ); - $p->set_value( 'title', $Member->headline ); - $p->set_value( 'body', $adsrc ); - $p->save_changes(); - $p->set_etag(); - - header_status( '200 OK' ); - redirect_to( $request->base ); - -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - -function _list( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - -function _show( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -?> \ No newline at end of file diff --git a/app/auction/models/Auction.php b/app/auction/models/Auction.php deleted file mode 100755 index 041f2c3..0000000 --- a/app/auction/models/Auction.php +++ /dev/null @@ -1,46 +0,0 @@ -auto_field( 'id' ); - $this->int_field( 'entry_id' ); - $this->text_field( 'headline' ); - $this->text_field( 'body' ); - $this->text_field( 'close' ); - - $this->char_field( 'href' ); - - $this->set_primary_key( 'id' ); - - $this->has_one( 'entry' ); - - $this->has_many( 'auction_bullets.auction_id' ); - $this->has_many( 'auction_photos.auction_id' ); - - $this->has_one('entry'); - - $this->let_access( 'all:administrators' ); - - $this->let_read( 'all:everyone' ); - $this->let_create( 'all:members' ); - $this->let_delete( 'all:members' ); - - } - -} - -function auction_show() { - // profile action - app_profile_show( 'auctions', 'list.html' ); -} - -function auction_init() { - // admin action - app_register_init( 'auctions', 'index.html', 'Auctions', 'auction', 2 ); -} - -?> diff --git a/app/auction/models/AuctionBullet.php b/app/auction/models/AuctionBullet.php deleted file mode 100755 index b9aab6f..0000000 --- a/app/auction/models/AuctionBullet.php +++ /dev/null @@ -1,30 +0,0 @@ -auto_field( 'id' ); - $this->int_field( 'entry_id' ); - $this->int_field( 'auction_id' ); - $this->text_field( 'bullet' ); - - $this->set_primary_key( 'id' ); - - $this->has_one( 'entry' ); - - $this->let_access( 'all:administrators' ); - - $this->let_read( 'all:everyone' ); - $this->let_create( 'all:members' ); - $this->let_delete( 'all:members' ); - - } - -} - - - -?> diff --git a/app/auction/models/AuctionPhoto.php b/app/auction/models/AuctionPhoto.php deleted file mode 100755 index 8d588ca..0000000 --- a/app/auction/models/AuctionPhoto.php +++ /dev/null @@ -1,33 +0,0 @@ -auto_field( 'id' ); - - $this->int_field( 'entry_id' ); - - $this->int_field( 'auction_id' ); - - $this->file_field( 'photo' ); - - $this->set_primary_key( 'id' ); - - $this->has_one( 'entry' ); - - $this->let_access( 'all:administrators' ); - - $this->let_read( 'all:everyone' ); - $this->let_create( 'all:members' ); - $this->let_delete( 'all:members' ); - - } - -} - - - -?> diff --git a/app/auction/views/auction_bullets/_entry.html b/app/auction/views/auction_bullets/_entry.html deleted file mode 100755 index 8254da5..0000000 --- a/app/auction/views/auction_bullets/_entry.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -

Bullet:

- bullet ?> -
- - \ No newline at end of file diff --git a/app/auction/views/auction_bullets/_new.html b/app/auction/views/auction_bullets/_new.html deleted file mode 100755 index d17c27d..0000000 --- a/app/auction/views/auction_bullets/_new.html +++ /dev/null @@ -1,26 +0,0 @@ - - -
-
- - - - - - - - - - - - - - -
- -
Bullet
- -
-
-
- diff --git a/app/auction/views/auction_photos/_entry.html b/app/auction/views/auction_photos/_entry.html deleted file mode 100755 index e4435c5..0000000 --- a/app/auction/views/auction_photos/_entry.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -

Photo:

- content_type) == 'mp3') : ?> - - - - - - - - content_type), array('jpg','png','gif'))) : ?> - - - - - -
- - diff --git a/app/auction/views/auction_photos/_new.html b/app/auction/views/auction_photos/_new.html deleted file mode 100755 index 72a8c76..0000000 --- a/app/auction/views/auction_photos/_new.html +++ /dev/null @@ -1,27 +0,0 @@ - - -
-
- - - - - - - - - - - - - - - -
- -
Photo
- -
-
-
- diff --git a/app/auction/views/auctions/_edit.html b/app/auction/views/auctions/_edit.html deleted file mode 100755 index d5145ce..0000000 --- a/app/auction/views/auctions/_edit.html +++ /dev/null @@ -1,36 +0,0 @@ - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- -
Headline
Body
Close
- -
-
-
- diff --git a/app/auction/views/auctions/_entry.html b/app/auction/views/auctions/_entry.html deleted file mode 100755 index 0251f33..0000000 --- a/app/auction/views/auctions/_entry.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - -

Preview:

-
- -

headline ?>

- -

body ?>

- - - -

- close ?> -

- -NextChild('auction_photos')) : ?> - - - -
- -


- - - - - -
-
- - - - - -

Add a photo:

- - - - - - - - - - - - -
- -
- -
-
-
- - -


-

Add a bullet point:

-
-
- - - - - - - -

- - - - - - - -
- -

- -
-
-
- -


- - - - -rewindchildren(); - global $db; - $Auction =& $db->model( 'Auction' ); - $Member = $Auction->find( $Member->id ); -?> - - - - -
-


Source code:

-

copy and paste from this box to eBay and Craigslist

-
- - -
- - - - -


- -

Edit your Ad:

- - - - - - - - - - - - - -rewindchildren(); - global $db; - $Auction =& $db->model( 'Auction' ); - $Member = $Auction->find( $Member->id ); -?> - - - - - - - - - - - - - - - - - - -

- headline ?>    -[Change Headline]

-

- body ?>    -[Change Description]

-

-
    -NextChild('auction_bullets')) : ?> - -
  • bullet ?> - - - -
    - - - - -
    - -
  • - -
-

- close ?>    -[Change Closing Statement]

-

- - NextChild('auction_photos')) : ?> - - - - - -
- - - - -
- - - - -
- - -


- - - - - - -
- - -
-


-


-


\ No newline at end of file diff --git a/app/auction/views/auctions/_index.html b/app/auction/views/auctions/_index.html deleted file mode 100755 index f7f1e63..0000000 --- a/app/auction/views/auctions/_index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - MoveNext() ) : ?> - - FirstChild('entries'); ?> - - - - - - - -
-
- - headline; ?> - -
- - headline; ?> - -
-


- diff --git a/app/auction/views/auctions/_list.html b/app/auction/views/auctions/_list.html deleted file mode 100755 index a493f25..0000000 --- a/app/auction/views/auctions/_list.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - -

My Auctions

- - - - - - - - MoveNext() ) : ?> - - FirstChild('entries'); ?> - - - - - - - -
-
- - headline; ?> - -
- - headline; ?> - -
- - - -
- - -


-


diff --git a/app/auction/views/auctions/_nav.html b/app/auction/views/auctions/_nav.html deleted file mode 100755 index 98fde53..0000000 --- a/app/auction/views/auctions/_nav.html +++ /dev/null @@ -1,11 +0,0 @@ - - -My Auctions | -New Auction - \ No newline at end of file diff --git a/app/auction/views/auctions/_new.html b/app/auction/views/auctions/_new.html deleted file mode 100755 index a31e7b3..0000000 --- a/app/auction/views/auctions/_new.html +++ /dev/null @@ -1,56 +0,0 @@ - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -


Headline

-   -

Description

-   -

Comments

-   -
- - -      - -
-
-
- diff --git a/app/auction/views/auctions/_show.html b/app/auction/views/auctions/_show.html deleted file mode 100755 index 308de33..0000000 --- a/app/auction/views/auctions/_show.html +++ /dev/null @@ -1,23 +0,0 @@ -
- -

headline ?>

- -

body ?>

- - - -

- close ?> -

- -NextChild('auction_photos')) : ?> - - - -
\ No newline at end of file diff --git a/app/auction/views/index.html b/app/auction/views/index.html deleted file mode 100755 index 906c9f1..0000000 --- a/app/auction/views/index.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - Tara's Ad Builder : <?php if (isset( $pagename )) print $pagename; ?> - - - - - - - - - -
- - - - -
-
- - - - -
Button 0Button 1
-
-
-
- - - - - - - - - - - - - - - - -
- - Tara's Ad Builder
-
-
-
-
- © 2009 - - - - - - - -   -  Signed in as url; ?>  - Sign Out  - My Profile - action, array('email','login'), true ) ) : ?> - Sign In - -
-
-
- - - - - - - - - - diff --git a/app/config/.htaccess b/app/config/.htaccess deleted file mode 100755 index a8e5f9b..0000000 --- a/app/config/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ -Order Allow,Deny -Deny from all - - Allow from all - \ No newline at end of file diff --git a/app/config/config.yml b/app/config/config.yml deleted file mode 100755 index 1c2c283..0000000 --- a/app/config/config.yml +++ /dev/null @@ -1,333 +0,0 @@ -# -# dbscript config file - config.yml -# -# author: [Brian Hendrickson, brian@dbscript.net] -# websites: [http://dbscript.net, http://brianhendrickson.com] -# copyright: (c) 2009 Brian Hendrickson -# ---- %YAML:1.1 - - - -# database settings - -development: - adapter: mysql - database: test - username: root - password: - host: localhost - -test: - adapter: mysql - database: test - username: root - password: - host: localhost - -production: - adapter: mysql - database: test - username: root - password: - host: localhost - - - -# environment settings - -env: - - site_title: Recent Updates - site_subtitle: - site_description: - - theme: p2 - - email_from: root@localhost - email_name: Notifier - email_server: localhost - email_port: 25 - email_user: - email_pass: - - threaded: false - - pretty_urls: false - - remote_sources: - dbscript: dbscript.net/?apps - - enable_db: development - - goes: posts - - authentication: email - - debug_enabled: true - - apps: - - omb - - twitter - - identica - - photos - - auction - - themepack1 - - all_in_one_seo_pack - - notifixious - - apps - - password - - streams - - translate - - facebook - - pages - - flickr - - rsscloud - - wiki - - shortener - - installed: - - twitter - - password - - streams - - translate - - facebook - - pages - - flickr - - rsscloud - - wiki - - shortener - - boot: omb - - plugins: - - sessions - - validation - - security - - ping - - omb - - omb_notice - - sms_notice - - email_notice - - wp - - profile: - - postcode - - timezone - - country - - gender - - language - - fullname - - dob - - email - - openid_server: https://e-cred.org/server - openid_version: 1 - - xrds_services: - oauth: - type: http://specs.openid.net/auth/2.0/server - uri: http://endpoint.example.net - namespace_id: openid - namespace_uri: http://openid.net/xmlns/1.0 - priority: 10 - local_id_handler: http://example.com - - twitterKey: - twitterSecret: - - flickrKey: - flickrSecret: - - facebookKey: - facebookSecret: - facebookAppId: - facebookAppName: - - awsAccessKey: - awsSecretKey: - awsBucket: - - zeepKeyWord: - zeepAccessKey: - zeepSecretKey: - zeepUrl: https://api.zeepmobile.com/messaging/2008-07-14/send_message - - ldap_server: - ldap_context: - ldap_user_field: - - ping_server: http://dejafeed.com/?submit - - blocks: - -pages - -categories - - collection_cache: - - posts: - duration : 0 - location : uploads - - identities: - duration : 0 - location : uploads - - cookielife: 1209600 - - upload_types: - -png - -gif - -jpg - -mp3 - -mov - -avi - - content_types: - - 0: - id : xhtml - qs : "1.000" - type : application/xhtml+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 1: - id : html - qs : "1.000" - type : text/html - encoding : null - charset : utf-8 - language : en - size : 3000 - - 2: - id : atom - qs : "0.900" - type : application/atom+xml - encoding : gzip - charset : utf-8 - language : en - size : 1500 - - 3: - id : json - qs : "0.000" - type : application/json - encoding : gzip - charset : utf-8 - language : en - size : 1500 - - 4: - id : wml - qs : "0.900" - type : text/vnd.wap.wml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 5: - id : ics - qs : "0.000" - type : text/plain - encoding : null - charset : iso-8859-1 - language : en - size : 3000 - - 6: - id : vcf - qs : "0.000" - type : text/plain - encoding : null - charset : iso-8859-1 - language : en - size : 3000 - - 7: - id : xml - qs : "0.000" - type : text/xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 8: - id : xrds - qs : "0.100" - type : application/xrds+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 9: - id : sqljson - qs : "0.000" - type : application/sparql-results+json - encoding : null - charset : utf-8 - language : en - size : 1500 - - 10: - id : sqlxml - qs : "0.000" - type : application/sparql-results+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 11: - id : js - qs : "0.000" - type : application/javascript - encoding : gzip - charset : utf-8 - language : en - size : 1500 - - 12: - id : rss - qs : "0.900" - type : application/rss+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 13: - id : rdf - qs : "0.000" - type : application/rdf+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - 14: - id : foaf - qs : "0.000" - type : application/rdf+xml - encoding : null - charset : utf-8 - language : en - size : 1500 - - app_folder: app - view_folder: views - layout_folder: views - show_timer: false - - enable_db_sessions: yes - enable_db_versions: yes - - project_name: - - package_name: - package_version: - - load_paths: - model : models - apphome : - apppath : - lib : - controller : - config : - router : - log : - public : - stylesheet : - javascript : - image : - - diff --git a/app/facebook/.DS_Store b/app/facebook/.DS_Store deleted file mode 100644 index 78ad2b6..0000000 Binary files a/app/facebook/.DS_Store and /dev/null differ diff --git a/app/facebook/controllers/facebook_users.php b/app/facebook/controllers/facebook_users.php deleted file mode 100644 index 0801296..0000000 --- a/app/facebook/controllers/facebook_users.php +++ /dev/null @@ -1,96 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - - - -function facebook_oauth_login_test(&$vars) { - extract($vars); - $success = false; - - if ($success) - echo 1; - else - echo 0; - - exit; - -} - - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - - - -function _edit( &$vars ) { - extract( $vars ); - - if (!(class_exists('Services_JSON'))) - lib_include('json'); - - $stat = $Setting->find_by(array('name'=>'facebook_status','profile_id'=>get_profile_id())); - - if (!$stat) { - $stat = $Setting->base(); - $stat->set_value('profile_id',get_profile_id()); - $stat->set_value('person_id',get_person_id()); - $stat->set_value('name','facebook_status'); - $stat->set_value('value','enabled'); - $stat->save_changes(); - $stat->set_etag(); - $stat = $Setting->find($stat->id); - } - - // get the one-to-one-related child-record from "entries" - $sEntry =& $stat->FirstChild('entries'); - - $staturl = $request->url_for(array('resource'=>'settings','id'=>$stat->id,'action'=>'put')); - - $status = $stat->value; - - $aktwitter_tw_text_options = array( - 'disabled'=>'disabled', - 'enabled'=>'enabled' - ); - - return vars( - array( &$aktwitter_tw_text_options,&$status,&$staturl,&$sEntry,&$profile ), - get_defined_vars() - ); - -} - diff --git a/app/facebook/facebook.php b/app/facebook/facebook.php deleted file mode 100644 index 45aab7f..0000000 --- a/app/facebook/facebook.php +++ /dev/null @@ -1,21 +0,0 @@ -auto_field('id'); - - $this->text_field('description'); - $this->text_field('location'); - - $this->char_field('screen_name'); - $this->char_field('url'); - $this->char_field('name'); - $this->char_field('protected'); - $this->char_field('profile_image_url'); - $this->char_field('facebook_id'); - - $this->char_field('oauth_key'); - $this->char_field('oauth_secret'); - - $this->int_field('profile_id'); - - $this->int_field('followers_count'); - - } - -} diff --git a/app/facebook/plugins/facebook.php b/app/facebook/plugins/facebook.php deleted file mode 100644 index 1eb2876..0000000 --- a/app/facebook/plugins/facebook.php +++ /dev/null @@ -1,221 +0,0 @@ -table == 'posts') - return; - - // if the Record does not have a title or uri, bail out - if (!(isset($rec->title)) || !(isset($rec->uri))) - return; - -if ($rec->parent_id > 0) - return; - - - global $db,$prefix,$request; - - - -// $sql = "SELECT facebook_id FROM ".$prefix."facebook_users WHERE profile_id = ".get_profile_id(); - if (!$db->table_exists('facebook')) - return true; - -$sql = "SELECT facebook_id,oauth_key FROM ".$prefix."identities,".$prefix."facebook_users WHERE ".$prefix."facebook_users.profile_id = ".$prefix."identities.id and ".$prefix."identities.person_id = ".get_person_id(); -$result = $db->get_result( $sql ); - -if (!$result){ - - $sql = "SELECT facebook_id,oauth_key FROM identities,facebook_users WHERE facebook_users.profile_id = identities.id and identities.person_id = ".get_person_id(); - $result = $db->get_result( $sql ); - - } - - if (!$result) - return; - - - ini_set('display_errors','1'); - ini_set('display_startup_errors','1'); - error_reporting (E_ALL & ~E_NOTICE ); - - $app_id = environment('facebookAppId'); - $consumer_key = environment('facebookKey'); - $consumer_secret = environment('facebookSecret'); - $agent = environment('facebookAppName')." (curl)"; - - $Post =& $db->model('Post'); - - if (!function_exists('json_encode')) - lib_include('json'); - - - - //$sesskey = environment('facebookSession'); - $sesskey = $db->result_value($result,0,'oauth_key'); - $uid = $db->result_value($result,0,'facebook_id'); - - - //$fb = new Facebook($consumer_key, $consumer_secret, true); - - //$fb->api_client->session_key = $sesskey; - //$fb->api_client->user = $uid; - - $notice_content = $rec->attributes['title']; - - if ($uid && isset($_SESSION['copied_blob'])) { - - //if (extension_for(type_of($_FILES['post']['name']['attachment'])) == 'jpg') - // $fs->photoUpload($_SESSION['copied_blob'], 0, $notice_content,$uid); - - unlink($_SESSION['copied_blob']); - unset($_SESSION['copied_blob']); - - } elseif ($uid) { - - $Upload =& $db->model('Upload'); - $Entry =& $db->model('Entry'); - $u = $Upload->find_by(array( - 'profile_id'=>get_profile_id(), - 'eq'=>'IS', - 'tmp_name'=>'NOT NULL' - )); - - if (!$u->exists) { - $download = false; - } else { - - $e = $Entry->find($u->entry_id); - - $download = false; - $origurl = $request->url_for(array('resource'=>'uploads','action'=>'entry.'.extension_for($e->content_type),'id'=>$u->id)); - $thumburl = $request->url_for(array('resource'=>'uploads','action'=>'preview.'.extension_for($e->content_type),'id'=>$u->id)); - $posturl = $request->url_for(array('resource'=>'posts','id'=>$rec->id)); - if (extension_for($e->content_type) == 'jpg'){ - $download = tempnam( "/tmp", "upload".$u->id.".jpg" ); - - set_time_limit(0); - ini_set('display_errors',false);//Just in case we get some errors, let us know.... - $fp = fopen ($download, 'w+');//This is the file where we save the information - $ch = curl_init($origurl);//Here is the file we are downloading - curl_setopt($ch, CURLOPT_TIMEOUT, 5000); - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_exec($ch); - curl_close($ch); - fclose($fp); - } - - - } - - - $Setting =& $db->model('Setting'); - - $stat = $Setting->find_by(array('name'=>'facebook_uid','person_id'=>get_person_id())); - - if ($stat->exists) - $uid = $stat->value; - - if ($download){ - - - add_include_path(library_path()); - add_include_path(library_path().'facebook-platform/php'); - add_include_path(library_path().'facebook_stream'); - - require_once "facebook.php"; - require_once "FacebookStream.php"; - require_once "Services/Facebook.php"; - $fs = new FacebookStream($consumer_key,$consumer_secret,$agent,$app_id); - - // $fs->api->sessionKey = $sesskey; - $fs->setSess($sesskey); - - - - $fs->photoUpload($download, 0, $notice_content,$uid); - - $message = $notice_content; - $attachment = array( - 'name' => $notice_content, - 'href' => $posturl, - 'caption' => '', - 'description' => $notice_content, - 'media' => array(array( - 'type' => 'image', - 'src' => $origurl, - 'href' => $posturl - ))); - - $attachment = json_encode($attachment); -// $fb->api_client->stream_publish($notice_content, $attachment); - - - } else { -// $fb->api_client->stream_publish($notice_content); - - - $next = $request->base; - - add_include_path(library_path().'facebook_stream'); - require_once "Services/Facebook.php"; -db_include('helper'); -db_include('facebook'); - $f = new Facebook( - $consumer_key, - $consumer_secret, - $appid, - $agent, - $sesskey, - $next - ); - - - $fb_post_id = $f->publish($notice_content,$uid); - - - $Like =& $db->model('Like'); - - $l = $Like->find_by(array('post_id'=>$rec->id)); - - if (!$l->exists){ - - $l = $Like->base(); - $l->set_value('post_id',$rec->id); - } - - $l->set_value('fb_post_id',$fb_post_id); - - $l->save_changes(); - } - - - - } -} - diff --git a/app/facebook/views/facebook_users/_edit.html b/app/facebook/views/facebook_users/_edit.html deleted file mode 100644 index 204586a..0000000 --- a/app/facebook/views/facebook_users/_edit.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - -
-
-

-
-
-

:

-

-
- -
- -

\ No newline at end of file diff --git a/app/flickr/controllers/flickr_users.php b/app/flickr/controllers/flickr_users.php deleted file mode 100644 index 4033951..0000000 --- a/app/flickr/controllers/flickr_users.php +++ /dev/null @@ -1,96 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - - - -function flickr_oauth_login_test(&$vars) { - extract($vars); - $success = false; - - if ($success) - echo 1; - else - echo 0; - - exit; - -} - - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - - - -function _edit( &$vars ) { - extract( $vars ); - - if (!(class_exists('Services_JSON'))) - lib_include('json'); - - $stat = $Setting->find_by(array('name'=>'flickr_status','profile_id'=>get_profile_id())); - - if (!$stat) { - $stat = $Setting->base(); - $stat->set_value('profile_id',get_profile_id()); - $stat->set_value('person_id',get_person_id()); - $stat->set_value('name','flickr_status'); - $stat->set_value('value','enabled'); - $stat->save_changes(); - $stat->set_etag(); - $stat = $Setting->find($stat->id); - } - - // get the one-to-one-related child-record from "entries" - $sEntry =& $stat->FirstChild('entries'); - - $staturl = $request->url_for(array('resource'=>'settings','id'=>$stat->id,'action'=>'put')); - - $status = $stat->value; - - $aktwitter_tw_text_options = array( - 'disabled'=>'disabled', - 'enabled'=>'enabled' - ); - - return vars( - array( &$aktwitter_tw_text_options,&$status,&$staturl,&$sEntry,&$profile ), - get_defined_vars() - ); - -} - diff --git a/app/flickr/flickr.php b/app/flickr/flickr.php deleted file mode 100644 index 63caf24..0000000 --- a/app/flickr/flickr.php +++ /dev/null @@ -1,29 +0,0 @@ -model('Setting'); - - $stat = $Setting->find_by(array('name'=>'flickr_frob','profile_id'=>get_profile_id())); - - if (!$stat) - echo ""; - -} \ No newline at end of file diff --git a/app/flickr/models/FlickrUser.php b/app/flickr/models/FlickrUser.php deleted file mode 100644 index 3307b13..0000000 --- a/app/flickr/models/FlickrUser.php +++ /dev/null @@ -1,12 +0,0 @@ -auto_field('id'); - - } - -} - diff --git a/app/flickr/plugins/flickr.php b/app/flickr/plugins/flickr.php deleted file mode 100644 index 924feb1..0000000 --- a/app/flickr/plugins/flickr.php +++ /dev/null @@ -1,160 +0,0 @@ -table == 'posts') - return; - - if (!(isset($rec->title)) || !(isset($rec->uri))) - return; - - $Setting =& $db->model('Setting'); - - $Post =& $db->model('Post'); - - $sql = "SELECT value FROM settings WHERE profile_id = '".get_profile_id()."' AND name = 'flickr_status'"; - $result = $db->get_result( $sql ); - $enabled = $db->result_value( $result, 0, "value" ); - - //$enabled = $Setting->find_by(array('settings.name'=>'flickr_status','settings.profile_id'=>get_profile_id())); - - - if (!($enabled == 'enabled')) - return; - - global $db,$prefix; - - $notice_content = $rec->attributes['title']; - - add_include_path(library_path()."phpFlickr"); - - include('phpFlickr.php'); - - $f = new phpFlickr( $key, $secret ); - - if (extension_for(type_of($_FILES['post']['name']['attachment'])) == 'jpg' - && (file_exists($_SESSION['copied_blob_flickr']))){ - - - $sql = "SELECT value FROM settings WHERE profile_id = '".get_profile_id()."' AND name = 'flickr_frob'"; - $result = $db->get_result( $sql ); - $stat = $db->result_value( $result, 0, "value" ); - - //$stat = $Setting->find_by(array('settings.name'=>'flickr_frob','settings.profile_id'=>get_profile_id())); - - if (!empty($stat)) { - $f->setToken($stat); - $f->sync_upload( - $_SESSION['copied_blob_flickr'], - $notice_content, - '', - null, - 1, - 1, - 1 - ); - unlink($_SESSION['copied_blob_flickr']); - unset($_SESSION['copied_blob_flickr']); - - //$photo, - //$title = null, - //$description = null, - //$tags = null, - //$is_public = null, - //$is_friend = null, - //$is_family = null - - } - } else { - - - $Setting =& $db->model('Setting'); - - $sql = "SELECT value FROM settings WHERE profile_id = '".get_profile_id()."' AND name = 'flickr_frob'"; - $result = $db->get_result( $sql ); - $stat = $db->result_value( $result, 0, "value" ); - - //$stat = $Setting->find_by(array('settings.name'=>'flickr_frob','settings.profile_id'=>get_profile_id())); - if (!empty($stat)) { - - // send jpegs to Flickr - $Upload =& $db->model('Upload'); - $Entry =& $db->model('Entry'); - - $Upload->set_param('find_by',array( - 'profile_id'=>get_profile_id(), - 'eq'=>'IS', - 'tmp_name'=>'NOT NULL' - )); - - $Upload->find(); - - $u = $Upload->MoveFirst(); - - if (!$u->exists) return; - - $e = $Entry->find($u->entry_id); - - $origurl = $request->url_for(array('resource'=>'uploads','action'=>'entry.'.extension_for($e->content_type),'id'=>$u->id)); - $thumburl = $request->url_for(array('resource'=>'uploads','action'=>'preview.'.extension_for($e->content_type),'id'=>$u->id)); - - if (extension_for($e->content_type) == 'jpg'){ - $download = tempnam( "/tmp", "upload".$u->id.".jpg" ); -// $result = download($e->uri.".jpg",$download); - -set_time_limit(0); -ini_set('display_errors',false);//Just in case we get some errors, let us know.... -$fp = fopen ($download, 'w+');//This is the file where we save the information -$ch = curl_init($origurl);//Here is the file we are downloading -curl_setopt($ch, CURLOPT_TIMEOUT, 5000); -curl_setopt($ch, CURLOPT_FILE, $fp); -curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); -curl_exec($ch); -curl_close($ch); -fclose($fp); - - } - $f->setToken($stat); - $f->sync_upload( - $download, - $rec->title, - '', - null, - 1, - 1, - 1 - ); - } -}} \ No newline at end of file diff --git a/app/flickr/views/flickr_users/_edit.html b/app/flickr/views/flickr_users/_edit.html deleted file mode 100644 index 763993a..0000000 --- a/app/flickr/views/flickr_users/_edit.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - -
-
-

-
-
-

:

-

-
- -
- -

\ No newline at end of file diff --git a/app/identica/controllers/dents.php b/app/identica/controllers/dents.php deleted file mode 100755 index 988407b..0000000 --- a/app/identica/controllers/dents.php +++ /dev/null @@ -1,154 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - - - -function _edit( &$vars ) { - extract( $vars ); - - $password = $Setting->find_by(array('name'=>'aktt_identica_password','profile_id'=>get_profile_id())); - if (!$password){ - $password = $Setting->base(); - $password->set_value('profile_id',get_profile_id()); - $password->set_value('person_id',get_person_id()); - $password->set_value('name','aktt_identica_password'); - $password->save_changes(); - $password->set_etag(); - $password = $Setting->find($password->id); - $pword = ""; - } - - if (!empty($password->value)) - $pword = "******"; - - // get the one-to-one-related child-record from "entries" - $pEntry =& $password->FirstChild('entries'); - - $passurl = $request->url_for(array('resource'=>'settings','id'=>$password->id,'action'=>'put')); - - $username = $Setting->find_by(array('name'=>'aktt_identica_username','profile_id'=>get_profile_id())); - - if (!$username) { - $username = $Setting->base(); - $username->set_value('profile_id',get_profile_id()); - $username->set_value('person_id',get_person_id()); - $username->set_value('name','aktt_identica_username'); - $username->save_changes(); - $username->set_etag(); - $username = $Setting->find($username->id); - } - - // get the one-to-one-related child-record from "entries" - $uEntry =& $username->FirstChild('entries'); - - $userurl = $request->url_for(array('resource'=>'settings','id'=>$username->id,'action'=>'put')); - - $stat = $Setting->find_by(array('name'=>'identica_status','profile_id'=>get_profile_id())); - - if (!$stat) { - $stat = $Setting->base(); - $stat->set_value('profile_id',get_profile_id()); - $stat->set_value('person_id',get_person_id()); - $stat->set_value('name','identica_status'); - $stat->set_value('value','enabled'); - $stat->save_changes(); - $stat->set_etag(); - $stat = $Setting->find($stat->id); - } - - // get the one-to-one-related child-record from "entries" - $sEntry =& $stat->FirstChild('entries'); - - $staturl = $request->url_for(array('resource'=>'settings','id'=>$stat->id,'action'=>'put')); - - $status = $stat->value; - - $akidentica_tw_text_options = array( - 'disabled'=>'disabled', - 'enabled'=>'enabled' - ); - - $RemoteServer =& $db->model('RemoteServer'); - $RemoteServer->find(); - $servers = array(); - while ($r = $RemoteServer->MoveNext()) - $servers[] = $r; - - return vars( - array( &$servers,&$akidentica_tw_text_options,&$status,&$staturl,&$pword,&$userurl,&$passurl,&$password,&$sEntry,&$username,&$uEntry,&$pEntry, &$profile ), - get_defined_vars() - ); - -} - - - - -function identica_login_test() { - global $db; - $test = @dent_login_test( - @stripslashes(get_option('aktt_identica_username')), - @md5_decrypt(stripslashes(get_option('aktt_identica_password')),$db->dbname) - ); - if ($test) - echo 1; - else - echo 0; - exit; -} - -function dent_login_test($username, $password) { - require_once(ABSPATH.WPINC.'/class-snoopy.php'); - $snoop = new Snoopy; - $snoop->agent = 'OpenMicroBlogger http://openmicroblogger.org'; - $snoop->user = $username; - $snoop->pass = $password; - $snoop->fetch('http://identi.ca/api/statuses/user_timeline.json'); - if (strpos($snoop->response_code, '200')) { - return true; - } - else { - return false; - } -} - - - diff --git a/app/identica/identica.php b/app/identica/identica.php deleted file mode 100755 index 2e4aabe..0000000 --- a/app/identica/identica.php +++ /dev/null @@ -1,74 +0,0 @@ -tweet_from_sidebar = false; - - // set the resource, action, button label, app name, grouplevel-unimplemented - app_register_init( 'dents', 'edit.html', $txt['identica_identica'], 'identica', 2 ); - -} - -function identica_show() { - // show something to profile visitors - // the_content -} - -function identica_head() { - // always load in head - // wp_head, admin_head -} - -function identica_menu() { - // trigger before Admin menu renders - // admin_menu -} - -function identica_post() { - // publish_post -} - - -function do_dent($tweet = '') { - - global $aktt; - - - if (empty($aktt->twitter_username) - || empty($aktt->twitter_password) - || empty($tweet) - || empty($tweet->tw_text) - ) { - return; - } - require_once(ABSPATH.WPINC.'/class-snoopy.php'); - $snoop = new Snoopy; - $snoop->agent = 'OpenMicroBlogger http://openmicroblogger.org'; - $snoop->rawheaders = array( - 'X-Twitter-Client' => 'OpenMicroBlogger' - , 'X-Twitter-Client-Version' => $aktt->version - , 'X-Twitter-Client-URL' => 'http://alexking.org/projects/wordpress/twitter-tools.xml' - ); - $snoop->user = $aktt->twitter_username; - $snoop->pass = $aktt->twitter_password; - $snoop->submit( - 'http://identi.ca/api/statuses/update.json' - , array( - 'status' => $tweet->tw_text - , 'source' => 'twittertools' - ) - ); - if (strpos($snoop->response_code, '200')) { - update_option('aktt_last_dent_download', strtotime('-28 minutes')); - return true; - } - return false; -} - - diff --git a/app/identica/models/Dent.php b/app/identica/models/Dent.php deleted file mode 100755 index 9979db6..0000000 --- a/app/identica/models/Dent.php +++ /dev/null @@ -1,29 +0,0 @@ -set_param('table','dents'); - - // data dictionary - $this->auto_field( 'id' ); - $this->char_field( 'tw_id' ); - $this->char_field( 'tw_text' ); - $this->time_field( 'tw_created_at' ); - $this->time_field( 'modified' ); - - // primary key - $this->set_primary_key( 'id' ); - - // permissions for this resource - $this->let_read( 'all:everyone' ); - - } - -} - - -?> diff --git a/app/identica/plugins/identica.php b/app/identica/plugins/identica.php deleted file mode 100755 index 610bd71..0000000 --- a/app/identica/plugins/identica.php +++ /dev/null @@ -1,49 +0,0 @@ -table == 'posts')) - return; - - if (!get_profile_id()) - return; - - // if the Record does not have a title or uri, bail out - if (!(isset($rec->title)) || !(isset($rec->uri))) - return; - - if (get_option('identica_status') != 'enabled') - return; - - // truncate the tweet at 140 chars - $notice_content = substr( $rec->title, 0, 140 ); - - // activate Twitter Tools - $_GET['activate'] = true; - - // trip the init() function - aktt_init(); - - // get the Twitter Tools object - global $aktt; - - // make a new tweet object - $tweet = new aktt_tweet(); - - // set the tweetbody - $tweet->tw_text = stripslashes($notice_content); - - // send the dent to Identica - global $db; - $aktt->twitter_username = get_option('aktt_identica_username'); - $aktt->twitter_password = md5_decrypt(stripslashes(get_option('aktt_identica_password')),$db->dbname); - - do_dent( $tweet ); - -} - -?> \ No newline at end of file diff --git a/app/identica/views/dents/_edit.html b/app/identica/views/dents/_edit.html deleted file mode 100755 index cb4d3a8..0000000 --- a/app/identica/views/dents/_edit.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - -
-
-

-
-
-

:

-

value; ?>

-
-

:

-

-
-

:

-

-
-

:

-

-
- -
- -

-

- - - - - - diff --git a/app/notifixious/models/notifix.php b/app/notifixious/models/notifix.php deleted file mode 100755 index e7bf8e0..0000000 --- a/app/notifixious/models/notifix.php +++ /dev/null @@ -1,100 +0,0 @@ -title))) - return; - - if (!get_profile_id()) - return; - - $installed = environment( 'installed' ); - - if ( !in_array( 'notifixious', $installed )) - return; - - if (!(class_exists('Services_JSON'))) - lib_include( 'json' ); - - $url = "http://".$notifixurl."/sources/find.json"; - $params = "url=".urlencode(get_bloginfo('rss2_url')); - - $results = notifixious_http_request($url."?".$params, "GET"); - - $jsonobj = json_decode($results[1]); - - $source_id = $jsonobj->sources->source->permalink; - - if($source_id != "") - { - update_option('notifixiousSourceId',''.$source_id.'', '', 'no'); - update_option('notifixiousRegistered','1', '', 'no'); - update_option('notifixiousClaimed','0', '', 'yes'); - } - else - { - update_option('notifixiousSourceId','0', '', 'no'); - update_option('notifixiousRegistered','0', '', 'no'); - } - - $post = get_post($rec); - - $title = urlencode($post->post_title); - $text = urlencode($post->post_content); - $link = urlencode($post->guid); - $url = "http://".urlencode($login).":".urlencode($pass)."@". - $notifixurl."/sources/".$source_id."/events.json?"."event[title]=".$title."&event[text]=".$text."&event[link]=".$link; - - echo $url; exit; - //http://:@?event[title]=&event[text]=&event[link]= - - $arr = notifixious_http_request($url, "POST"); - print_r($arr); - exit; -} - -function notifixious_http_request($link, $method){ - $url_parts = @parse_url( $link ); - $host = $url_parts["host"]; - $path = $url_parts["path"]; - if($url_parts["query"]) - { - $query = $url_parts["query"]; - $http_request = "$method $path?$query HTTP/1.0\r\n"; - } - else - { - $http_request = "$method $path HTTP/1.0\r\n"; - } - if($url_parts["user"] && $url_parts["pass"]) - { - $user = $url_parts["user"]; - $pass = $url_parts["pass"]; - $auth = $user.":".$pass ; - $encoded_auth = base64_encode($auth); - $http_request .= "Authorization: Basic ".$encoded_auth."\r\n"; - } - $port = 80; - $http_request .= "Host: $host\r\n"; - $http_request .= "User-Agent: WordPress \r\n"; - $http_request .= "\r\n"; - $response = ''; - if( false != ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { - fwrite($fs, $http_request); - while ( !feof($fs) ) - $response .= fgets($fs); // One TCP-IP packet - fclose($fs); - } - $response = explode("\r\n\r\n", $response, 2); - return $response; - - } \ No newline at end of file diff --git a/app/omb/controllers/admin.php b/app/omb/controllers/admin.php deleted file mode 100755 index c7596ce..0000000 --- a/app/omb/controllers/admin.php +++ /dev/null @@ -1,382 +0,0 @@ -model('Setting'); - $tp = $Setting->find_by('name','config.env.themepath'.$subfile); - if ($tp) - $db->delete_record($tp); - $tp = $Setting->base(); - $tp->set_value('name','config.env.themepath'.$subfile); - $tp->set_value('value',$subload); - $tp->save_changes(); - } - }} - }} - closedir($subhandle); - } - }} - closedir($handle); - } - - } - - - - return vars( - array( - &$previews, - &$installedtheme - ), - get_defined_vars() - ); - -} - -function _config( &$vars ) { - - // admin/index() is executing before this code - // good for security, !member_of test - // but it's slow XXX - - extract( $vars ); - $Setting =& $db->model('Setting'); - - $Setting->find_by(array( - 'eq' => 'like', - 'name' => 'config%' - )); - - $setenv = array(); - $setperm = array(); - $setother = array(); - - $returnvars = array(); - - while ($s = $Setting->MoveNext()) { - - $set = split('\.',$s->name); - - if (is_array($set) && $set[0] == 'config') { - - if ($set[1] == 'env') { - - - $modevar = 'n'.$set[2].'mode'; - $urlvar = 'n'.$set[2].'url'; - $entryvar = 'n'.$set[2].'entry'; - - $$modevar = $s; - - if ($$modevar->id) { - $setenv[$set[2]] = $s->value; - $$urlvar = $request->url_for(array('resource'=>'settings','id'=>$$modevar->id,'action'=>'put')); - $$entryvar = $$modevar->FirstChild('entries'); - - $returnvars[] = &$$modevar; - $returnvars[] = &$$urlvar; - $returnvars[] = &$$entryvar; - } - - } elseif ($set[1] == 'perms') { - - $setperm[$set[2]] = $s->value; - //$tab =& $db->models[$set[2]]; - //if ($tab) - // $tab->permission_mask( $set[3],$s->value,$set[4] ); - - } else { - - $setother[$set[2]] = $s->value; - - } - } - } - global $env; - - $envpost = array(); - foreach ($env as $k=>$v) { - if (!is_array($v) && !isset($setenv[$k]) && substr($k,0,5) =='site_') { - $envpost[$k] = $v; - $urlvar = 'n'.$k.'url'; - $$urlvar = $request->url_for(array('resource'=>'settings','action'=>'post')); - $returnvars[] = &$$urlvar; - } - } - - $envpost2 = array(); - foreach ($env as $k=>$v) { - if (!is_array($v) && !isset($setenv[$k]) && substr($k,0,5) !='site_') { - $envpost2[$k] = $v; - $urlvar = 'n'.$k.'url'; - $$urlvar = $request->url_for(array('resource'=>'settings','action'=>'post')); - $returnvars[] = &$$urlvar; - } - } - - $returnvars[] = &$envpost; - $returnvars[] = &$envpost2; - $returnvars[] = &$setenv; - $returnvars[] = &$setperm; - $returnvars[] = &$setother; - $returnvars[] = &$env; - - return vars( - $returnvars, - get_defined_vars() - ); - -} - - -function index( &$vars ) { - extract( $vars ); - - if (!member_of('administrators')) - trigger_error('sorry you must be an administrator to do that', E_USER_ERROR); - - $aktwitter_tw_text_options = array( - '0'=>'false', - '1'=>'true' - ); - - $Setting =& $db->model('Setting'); - - $threadmode = $Setting->find_by(array('name'=>'config.env.threaded','profile_id'=>get_profile_id())); - if (!$threadmode) { - $threadmode = $Setting->base(); - $threadmode->set_value('profile_id',get_profile_id()); - $threadmode->set_value('person_id',get_person_id()); - $threadmode->set_value('name','config.env.threaded'); - $threadmode->set_value('value',1); - $threadmode->save_changes(); - $threadmode->set_etag(); - $threadmode = $Setting->find($threadmode->id); - } - $threadurl = $request->url_for(array('resource'=>'settings','id'=>$threadmode->id,'action'=>'put')); - $threadentry = $threadmode->FirstChild('entries'); - - $catmode = $Setting->find_by(array('name'=>'config.env.categories','profile_id'=>get_profile_id())); - if (!$catmode) { - $catmode = $Setting->base(); - $catmode->set_value('profile_id',get_profile_id()); - $catmode->set_value('person_id',get_person_id()); - $catmode->set_value('name','config.env.categories'); - $catmode->set_value('value',0); - $catmode->save_changes(); - $catmode->set_etag(); - $catmode = $Setting->find($catmode->id); - } - $caturl = $request->url_for(array('resource'=>'settings','id'=>$catmode->id,'action'=>'put')); - $catentry = $catmode->FirstChild('entries'); - - $uplmode = $Setting->find_by(array('name'=>'config.env.uploads','profile_id'=>get_profile_id())); - if (!$uplmode) { - $uplmode = $Setting->base(); - $uplmode->set_value('profile_id',get_profile_id()); - $uplmode->set_value('person_id',get_person_id()); - $uplmode->set_value('name','config.env.uploads'); - $uplmode->set_value('value',0); - $uplmode->save_changes(); - $uplmode->set_etag(); - $uplmode = $Setting->find($uplmode->id); - } - $uplurl = $request->url_for(array('resource'=>'settings','id'=>$uplmode->id,'action'=>'put')); - $uplentry = $uplmode->FirstChild('entries'); - - // n1mode = upload max size in MB, default = 4 - $n1mode = $Setting->find_by(array('name'=>'config.env.max_upload_mb','profile_id'=>get_profile_id())); - if (!$n1mode) { - $n1mode = $Setting->base(); - $n1mode->set_value('profile_id',get_profile_id()); - $n1mode->set_value('person_id',get_person_id()); - $n1mode->set_value('name','config.env.max_upload_mb'); - $n1mode->set_value('value',4); - $n1mode->save_changes(); - $n1mode->set_etag(); - $n1mode = $Setting->find($n1mode->id); - } - $n1url = $request->url_for(array('resource'=>'settings','id'=>$n1mode->id,'action'=>'put')); - $n1entry = $n1mode->FirstChild('entries'); - - global $timezone_offsets; - $n2list = $timezone_offsets; - - // n2mode = upload max size in MB, default = 4 - $n2mode = $Setting->find_by(array('name'=>'config.env.timezone','profile_id'=>get_profile_id())); - if (!$n2mode) { - $n2mode = $Setting->base(); - $n2mode->set_value('profile_id',get_profile_id()); - $n2mode->set_value('person_id',get_person_id()); - $n2mode->set_value('name','config.env.timezone'); - $n2mode->set_value('value','-8'); - $n2mode->save_changes(); - $n2mode->set_etag(); - $n2mode = $Setting->find($n2mode->id); - } - $n2url = $request->url_for(array('resource'=>'settings','id'=>$n2mode->id,'action'=>'put')); - $n2entry = $n2mode->FirstChild('entries'); - - // n3mode = image upload thumbnail size - $n3mode = $Setting->find_by(array('name'=>'config.env.max_pixels','profile_id'=>get_profile_id())); - if (!$n3mode) { - $n3mode = $Setting->base(); - $n3mode->set_value('profile_id',get_profile_id()); - $n3mode->set_value('person_id',get_person_id()); - $n3mode->set_value('name','config.env.max_pixels'); - $n3mode->set_value('value',200); - $n3mode->save_changes(); - $n3mode->set_etag(); - $n3mode = $Setting->find($n3mode->id); - } - $n3url = $request->url_for(array('resource'=>'settings','id'=>$n3mode->id,'action'=>'put')); - $n3entry = $n3mode->FirstChild('entries'); - - return vars( - array( - &$collection, - &$aktwitter_tw_text_options, - &$profile, - &$threadmode, - &$threadurl, - &$threadentry, - &$catmode, - &$caturl, - &$catentry, - &$uplmode, - &$uplurl, - &$uplentry, - &$n1mode, - &$n1url, - &$n1entry, - &$n2mode, - &$n2url, - &$n2entry, - &$n2list, - &$n3mode, - &$n3url, - &$n3entry - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( - &$collection, - &$profile - ), - get_defined_vars() - ); -} - -function _sources( &$vars ) { -extract( $vars ); - - if (!member_of('administrators')) - trigger_error('sorry you must be an administrator to do that', E_USER_ERROR); - - $aktwitter_tw_text_options = array( - '0'=>'false', - '1'=>'true' - ); - - $Setting =& $db->model('Setting'); - - $returnvars = array(); - - $TwitterUser =& $db->model('TwitterUser'); - $TwitterUser->set_limit(1000); - $TwitterUser->find_by( array('eq'=>'not like','oauth_key'=>''),1 ); - $i=1; - while ($tu = $TwitterUser->MoveNext()) { - - $modevar = 'n'.$i.'mode'; - $urlvar = 'n'.$i.'url'; - $entryvar = 'n'.$i.'entry'; - $nickvar = 'n'.$i.'nick'; - $i++; - - $$nickvar = $tu->screen_name; - $$modevar = $Setting->find_by('name','config.env.importtwitter_'.$tu->id); - - if (!$$modevar) { - $$modevar = $Setting->base(); - $$modevar->set_value('profile_id',get_profile_id()); - $$modevar->set_value('person_id',get_person_id()); - $$modevar->set_value('name','config.env.importtwitter_'.$tu->id); - $$modevar->set_value('value',0); - $$modevar->save_changes(); - $$modevar->set_etag(); - $$modevar = $Setting->find($$modevar->id); - } - - $$urlvar = $request->url_for(array('resource'=>'settings','id'=>$$modevar->id,'action'=>'put')); - $$entryvar = $$modevar->FirstChild('entries'); - - $returnvars[] = &$$modevar; - $returnvars[] = &$$urlvar; - $returnvars[] = &$$entryvar; - $returnvars[] = &$$nickvar; - - } - - $returnvars[] = &$collection; - $returnvars[] = &$profile; - $returnvars[] = &$aktwitter_tw_text_options; - - $listvars = array(1=>'friends_timeline',0=>'disabled'); - $returnvars[] = &$listvars; - - $returnvars[] = &$i; - - return vars( - $returnvars, - get_defined_vars() - ); - -} - -function _cloud( &$vars ) { - - extract( $vars ); - - admin_display_cloud_options(); - - return vars( - array( - ), - get_defined_vars() - ); - -} - diff --git a/app/omb/controllers/blogs.php b/app/omb/controllers/blogs.php deleted file mode 100644 index 111fe94..0000000 --- a/app/omb/controllers/blogs.php +++ /dev/null @@ -1,202 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - - $nickname = ''; - $letters = str_split(strtolower($request->params['blog']['title'])); - - foreach ($letters as $letter) - if (ereg("([a-z])", $letter)) - $nickname .= $letter; - - $prefix = substr($nickname,0,2); - - for ($i=0;$i<10;$i++) { - $b = $Blog->find_by('prefix',$prefix); - if (!$b && !in_array($prefix."_db_sessions",$db->tables) && strlen($prefix) > 1) - continue; - else - $prefix = randomstring(2); - } - - $request->set_param( array( 'blog', 'prefix' ), $prefix ); - $request->set_param( array( 'blog', 'nickname' ), $nickname ); - - $resource->insert_from_post( $request ); - - header_status( '201 Created' ); - redirect_to( $request->url_for('admin').'#ui-tabs-11' ); - -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - if (!member_of('administrators')) - trigger_error('you must be an administrator to do that', E_USER_ERROR); - $b = $collection->MoveFirst(); - if (!empty($b->prefix)) { - $Shortener =& $db->model('Shortener'); - $short = $Shortener->find_by('nickname',$b->nickname); - if ($short) - $db->delete_record($short); - $tabresult = $db->get_result("SHOW tables"); - $tables = array(); - for($i=0;$tables[$i]=mysql_fetch_assoc($tabresult);$i++) { - $key = $tables[$i]['Tables_in_'.$db->dbname]; - if (substr($key,0,3) == $b->prefix.'_' && !in_array($key,array('categories_entries','aggregates_entries','twitter_users','db_sessions'))) { - $sql = "DROP TABLE ".$key; - $result = $db->get_result( $sql ); - } - } - } - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - -function _mystreams( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - - $Blog =& $db->model('Blog'); - $Blog->set_param( 'find_by', array( - 'entries.person_id'=>get_person_id() - )); - $collection = new Collection('blogs'); - - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); - -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - -function _newajax( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - diff --git a/app/omb/controllers/categories.php b/app/omb/controllers/categories.php deleted file mode 100755 index 48cb7b4..0000000 --- a/app/omb/controllers/categories.php +++ /dev/null @@ -1,190 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - -function put( &$vars ) { - extract( $vars ); - $rec = $Category->find( $request->id ); - $rec->set_value('name',$request->params['category']['name']); - $rec->set_value('term',$request->params['category']['term']); - if (isset($request->params['category']['scheme'])) - $rec->set_value('scheme',$request->params['category']['scheme']); - $rec->save_changes(); - //$Category->update_from_post( $request ); - header( 'Status: 200 OK' ); - redirect_to( array('resource'=>'categories','action'=>'manage') ); -} - -function post( &$vars ) { - extract( $vars ); - $Category->insert_from_post( $request ); - header( 'Status: 201 Created' ); - redirect_to( $request->url_for('admin').'#ui-tabs-9' ); -} - -function delete( &$vars ) { - extract( $vars ); - - //$Category->delete_from_post( $request ); - - $rec = $Category->find( $request->id ); - - $result = $db->delete_record($rec); - - header( 'Status: 200 OK' ); - redirect_to( $request->url_for('admin').'#ui-tabs-9' ); -} - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$Category, - &$profile, - &$atomfeed, - &$collection, - &$theme - ), - get_defined_vars() - ); -} - - -function _manage( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -function _index( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - if ( $request->error ) - $Category = session_restore( $db->models['categories'] ); - else - $Category = $Category->find( $request->id ); - - return vars( - array( - // return vars to the _new partial - &$Category, - ), - get_defined_vars() - ); - -} - - - -function _edit( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - if ( $request->error ) - $Category = session_restore( $db->models['categories'] ); - else - $Category = $Category->find( $request->id ); - - $Entry = $Entry->find_by( array('resource'=>'categories', 'record_id'=>$Category->id), $Category->id ); - - return vars( - array( - - // return vars to the _edit partial - &$Category, - &$Entry - - ), - get_defined_vars() - ); - -} - - -function _entry( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - $Category = $Category->find( $request->id ); - - if (!$Category) - trigger_error( "Sorry, I could not find that entry in categories.", E_USER_ERROR ); - - $Category->set_etag(); - - $Entry = $Entry->find_by( array('resource'=>'categories', 'record_id'=>$Category->id), $Category->id ); - - return vars( - array( - - // return vars to the _entry partial - &$Category, - &$Entry - - ), - get_defined_vars() - ); - -} - diff --git a/app/omb/controllers/groups.php b/app/omb/controllers/groups.php deleted file mode 100755 index 741a5ac..0000000 --- a/app/omb/controllers/groups.php +++ /dev/null @@ -1,339 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - -function put( &$vars ) { - - extract( $vars ); - - $Group->update_from_post( $request ); - - $subscribers = explode( "\n", $request->subscribers ); - - $g = $Group->find($request->id); - - if ($g && count($subscribers) > 0) - $result = $db->get_result( "DELETE FROM ".$db->prefix."memberships WHERE group_id = ".$g->id ); - - foreach ( $subscribers as $addr ) { - $p = false; - $i = false; - $a = trim( $addr ); - $i = $Identity->find_by( 'email_value', $a ); - if (is_email($a) && $i) { - $p = $i->FirstChild( 'people' ); - } elseif (is_email($a)) { - $p = $Person->base(); - $p->save(); - $i = $Identity->base(); - $i->set_value( 'url', $a ); - $i->set_value( 'email_value', $a ); - $i->set_value( 'given_name', '' ); - $i->set_value( 'label', 'profile 1' ); - $token = make_token($p->id); - $i->set_value( 'token', $token); - $i->set_value( 'person_id', $p->id ); - $i->save_changes(); - $i->set_etag($p->id); - do_invite_email($a,$token); - } - if ($g && is_email($a) && $p) { - $m = $Membership->base(); - $m->set_value( 'group_id', $g->id ); - $m->set_value( 'person_id', $p->id ); - $m->save_changes(); - } - } - - header( 'Status: 200 OK' ); - redirect_to( 'groups' ); - -} - - - -function do_invite_email($addr,$token, &$group) { - - global $request; - - $link = $request->url_for(array('ident'=>$token)); - - $subject = 'You were added to a group on '.$request->base; - - $email = "Hi, you have been invited to join the ".$group->name." group on ".$request->base.".\n\n"; - - $email .= "Click here to check it out --> $link \n\n"; - - - $html = false; - - send_email( $addr, $subject, $email, environment('email_from'), environment('email_name'), $html ); - -} - - -function post( &$vars ) { - - - extract( $vars ); - - $g = $Group->base(); - - $fields = $Group->fields_from_request( $request ); - - foreach ( $fields['groups'] as $field=>$type ) - $g->set_value( $field, $request->params['group'][$field] ); - - $g->save_changes(); - - $g->set_etag(get_person_id()); - - $subscribers = explode( "\n", $request->subscribers ); - - foreach ( $subscribers as $addr ) { - $p = false; - $i = false; - $a = trim( $addr ); - $i = $Identity->find_by( 'email_value', $a ); - if (is_email($a) && $i) { - $p = $i->FirstChild( 'people' ); - } elseif (is_email($a)) { - $p = $Person->base(); - $p->save(); - $i = $Identity->base(); - $i->set_value( 'url', $a ); - $i->set_value( 'email_value', $a ); - $i->set_value( 'given_name', '' ); - $i->set_value( 'label', 'profile 1' ); - $token = make_token($p->id); - $i->set_value( 'token', $token); - $i->set_value( 'person_id', $p->id ); - $i->save_changes(); - $i->set_etag($p->id); - do_invite_email($a,$token,$g); - } - if (is_email($a) && $p) { - $m = $Membership->base(); - $m->set_value( 'group_id', $g->id ); - $m->set_value( 'person_id', $p->id ); - $m->save_changes(); - } - } - - header( 'Status: 201 Created' ); - - redirect_to( 'groups' ); - -} - -function delete( &$vars ) { - extract( $vars ); - $e = $Entry->find_by('etag',$request->etag); - if ($e) { - $g = $Group->find($e->record_id); - if ($g) - $result = $db->get_result( "DELETE FROM ".$db->prefix."memberships WHERE group_id = ".$g->id ); - } - $Group->delete_from_post( $request ); - header( 'Status: 200 OK' ); - redirect_to( 'groups' ); -} - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - - - -function _index( &$vars ) { - - extract( $vars ); - $Group->find_by(array('eq'=>'<','id'=>4)); - while ($g = $collection->MoveNext()) - $g->set_etag(); - $collection = new Collection( 'groups' ); - return vars( - array( - - &$collection - ), - get_defined_vars() - ); - -} - - -function _entry( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - $Member = $Group->find( $request->id ); - - $Member->set_etag(); - - if (!$Member) - trigger_error( "Sorry, I could not find that entry in groups.", E_USER_ERROR ); - - $Membership = $Member->FirstChild( "memberships" ); - - $Entry = $Member->FirstChild( "entries" ); - - - - - return vars( - array( - - // return vars to the _entry partial - &$Member, - &$Membership, - &$Entry - - ), - get_defined_vars() - ); - -} - - - - -function _remove( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - $Member = $Group->find( $request->id ); - - $Member->set_etag(); - - if (!$Member) - trigger_error( "Sorry, I could not find that entry in groups.", E_USER_ERROR ); - - $Membership = $Member->FirstChild( "memberships" ); - - $Entry = $Member->FirstChild( "entries" ); - - return vars( - array( - - // return vars to the _entry partial - &$Member, - &$Membership, - &$Entry - - ), - get_defined_vars() - ); - -} - -function _edit( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - if ( $request->error ) - $Member = session_restore( $db->models['groups'] ); - else - $Member = $Group->find( $request->id ); - - $Entry = $Member->FirstChild( "entries" ); - - if (empty($Entry->etag)) { - $Member->set_etag(); - $Member = $Group->find( $request->id ); - $Entry = $Member->FirstChild( "entries" ); - } - - $subscribers = ""; - $arr = resource_group_members($Member->id); - $avatars = array(); - foreach ( $arr as $member_ident ) { - $subscribers .= htmlentities($member_ident->email_value)."\n"; - $avatars[$member_ident->person_id] = $member_ident->avatar; - } - - // custom controller adds $group_perms named variable - - $group_perms = array(); - - foreach ( $db->models as $model ) { - foreach( $model->access_list as $permission=>$values ) { - foreach($values as $fieldname=>$listofgroups) { - if (in_array($Member->name,$listofgroups)) { - if (!(is_array($group_perms[$model->table]))) - $group_perms[$model->table] = array(); - if (empty($model->table)) - admin_alert( "table name not set for object ".get_class($model) ); - $group_perms[$model->table][$permission] = $values; - break; - } - } - } - } - - return vars( - array( - - // return vars to the _edit partial - &$avatars, - &$Member, - &$Entry, - &$group_perms, // << I added this one to the standard list - &$subscribers - - ), - get_defined_vars() - ); - -} - - - -function _new( &$vars ) { - - // bring controller vars into scope - extract( $vars ); - - - $Member = $Group->base(); - - - return vars( - array( - - // return vars to the _new partial - &$Member - - ), - get_defined_vars() - ); - -} - diff --git a/app/omb/controllers/identities.php b/app/omb/controllers/identities.php deleted file mode 100755 index 48c17e6..0000000 --- a/app/omb/controllers/identities.php +++ /dev/null @@ -1,615 +0,0 @@ - 409600) { - if (file_exists($_FILES['identity']['tmp_name']['photo'])) - unlink($_FILES['identity']['tmp_name']['photo']); - trigger_error( "That photo is too big. Please find one that is smaller than 400K.", E_USER_ERROR ); - } - - $upl = $_FILES['identity']['tmp_name']['photo']; - - $ext = '.'.type_of_image($upl); - - if (!$ext) - trigger_error( "Sorry for the trouble, but your photo must be a JPG, PNG or GIF file.", E_USER_ERROR ); - - $orig = $_FILES['identity']['tmp_name']['photo']; - $newthumb = tempnam( "/tmp", "new".$rec->id.$ext ); - photoCreateCropThumb( $newthumb, $orig, 96, 100, $upl ); - $rec->attributes['photo'] = $newthumb; - -} - - -function validate_identities_url( $value ) { - - if ($value == 'http://') - return true; - - if (environment('authentication') == 'password') - return true; - - if (!(environment('openid_version') > 1)) - return true; - - global $db; - - wp_plugin_include(array( - 'wp-openid' - )); - - $logic = new WordPressOpenID_Logic(null); - - $logic->activate_plugin(); - - if ( !WordPressOpenID_Logic::late_bind() ) - trigger_error( 'Sorry, there was an error in the OpenID plugin.', E_USER_ERROR); - - $consumer = WordPressOpenID_Logic::getConsumer(); - - $auth_request = $consumer->begin( $value ); - - if ( null === $auth_request ) - trigger_error('Sorry, an OpenID server could not be located from: '.htmlentities( $value ), E_USER_ERROR); - - return true; - -} - - -function validate_identities_nickname( $nick ) { - - if (!ereg("^([a-zA-Z0-9]+)$", $nick)) - trigger_error('Sorry, the username can\'t have numbers, spaces, punctuation, etc.', E_USER_ERROR); - - return true; - -} - - -function get( &$vars ) { - extract( $vars ); - switch ( count( $collection->members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $a = trim( $request->params['identity']['email_value'] ); - $i = $Identity->find_by( 'email_value', $a ); - if (is_email($a) && $i) - trigger_error( 'Sorry, the e-mail address already exists.', E_USER_ERROR ); - $p = $Person->base(); - $p->save(); - if (empty($request->params['identity']['url'])) - $request->params['identity']['url'] = $a; - $request->params['identity']['token'] = make_token($p->id); - $request->params['identity']['person_id'] = $p->id; - $resource->insert_from_post( $request ); - $i = $Identity->find( $request->id ); - $i->set_etag(); - - $installed = environment('installed'); - - if (is_array($installed)) { - - foreach($installed as $appname) { - - $app = $Setting->base(); - $app->set_value('profile_id',$i->id); - $app->set_value('person_id',$p->id); - $app->set_value('name','app'); - $app->set_value('value',$appname); - $app->save_changes(); - $app->set_etag(); - - } - - } - - header_status( '201 Created' ); - redirect_to( $request->resource ); -} - - -function put( &$vars ) { - extract( $vars ); - - // save a revision - $rec = $collection->MoveFirst(); - $Revision =& $db->model('Revision'); - $r = $Revision->base(); - $r->set_value( 'data', serialize($rec) ); - $r->set_value( 'profile_id', get_profile_id() ); - $r->set_value( 'target_id', $rec->entry_id ); - $r->save(); - - if (isset($request->params['identity']['nickname'])) { - $nick = strtolower($request->params['identity']['nickname']); - - $request->set_param( array( 'identity', 'nickname' ), $nick ); - - if ($profile->nickname == $nick) { - // nickname did not change - } else { - global $prefix; - // if post_notice is set it's a remote user and can share a nickname with a local user - $sql = "SELECT nickname FROM ".$prefix."identities WHERE nickname LIKE '".$db->escape_string($nick)."' AND (post_notice = '' OR post_notice IS NULL)"; - $result = $db->get_result( $sql ); - if ($db->num_rows($result) > 0) - trigger_error( 'Sorry, that nickname is already being used.', E_USER_ERROR ); - } - - } else { - - } - - if (isset($request->params['identity']['url'])) { - if (strpos($request->params['identity']['url'], 'http') === false) - $request->params['identity']['url'] = 'http://'.$request->params['identity']['url']; - } - - if (isset($request->params['identity']['password'])) - $request->params['identity']['password'] = md5($request->params['identity']['password']); - - $resource->update_from_post( $request ); - - $rec = $Identity->find($request->id); - - if (is_upload('identities','photo')) { - $sql = "SELECT photo FROM ".$prefix."identities WHERE id = ".$db->escape_string($request->id); - $result = $db->get_result($sql); - - $upl = $_FILES['identity']['tmp_name']['photo']; - - $ext = '.'.type_of_image($upl); - - if (!$ext) - trigger_error( "Sorry for the trouble, but your photo must be a JPG, PNG or GIF file.", E_USER_ERROR ); - - $content_type = type_of($ext); - - if ($blobval = $db->result_value($result,0,"photo")) - $rec->set_value( 'avatar', $request->url_for(array('resource'=>"_".$rec->id)) . $ext ); - elseif (exists_uploads_blob( 'identities',$rec->id )) - $rec->set_value( 'avatar', $request->url_for(array('resource'=>"_".$rec->id)) . $ext ); - else - $rec->set_value( 'avatar', '' ); - if (empty($rec->profile)) - $rec->set_value( 'profile', $request->url_for(array('resource'=>"_".$rec->id))); - if (empty($rec->profile_url)) - $rec->set_value( 'profile_url', $request->url_for(array('resource'=>"".$rec->nickname))); - - $rec->save_changes(); - - $atomentry = $Identity->set_metadata($rec,$content_type,$rec->table,'id'); - - } - - broadcast_omb_profile_update(); - - header_status( '200 OK' ); - redirect_to( base_url(true) ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _profile( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - //echo $Identity->get_query(); exit; - return vars( - array( &$collection, &$profile,&$Identity ), - get_defined_vars() - ); -} - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - $installed_apps = array(); - while ($s = $Member->NextChild('settings')) { - if ($s->name == 'app') - $installed_apps[] = $s->value; - } - $Subscription->set_limit(10); - return vars( - array( &$collection, &$Member, &$Entry, &$profile, &$Identity, &$Subscription, &$installed_apps ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - $identity_tz_options = array( - 'PST', - 'MST', - 'CST', - 'EST' - ); - - return vars( - array( &$Member, &$profile, &$identity_tz_options ), - get_defined_vars() - ); -} - -function _pass( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - $identity_tz_options = array( - 'PST', - 'MST', - 'CST', - 'EST' - ); - return vars( - array( &$Member, &$Entry, &$profile, &$identity_tz_options ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - $identity_tz_options = array( - 'PST', - 'MST', - 'CST', - 'EST' - ); - - $Setting =& $db->model('Setting'); - global $timezone_offsets; - $n2list = $timezone_offsets; - - // n2mode = upload max size in MB, default = 4 - $n2mode = $Setting->find_by(array('name'=>'timezone','profile_id'=>get_profile_id())); - if (!$n2mode) { - $n2mode = $Setting->base(); - $n2mode->set_value('profile_id',get_profile_id()); - $n2mode->set_value('person_id',get_person_id()); - $n2mode->set_value('name','timezone'); - $n2mode->set_value('value','-8'); - $n2mode->save_changes(); - $n2mode->set_etag(); - $n2mode = $Setting->find($n2mode->id); - } - $n2url = $request->url_for(array('resource'=>'settings','id'=>$n2mode->id,'action'=>'put')); - $n2entry = $n2mode->FirstChild('entries'); - - $settingvalue = $Setting->find_by(array('name'=>'background_image','profile_id'=>get_profile_id())); - - if (!$settingvalue) { - $settingvalue = $Setting->base(); - $settingvalue->set_value('profile_id',get_profile_id()); - $settingvalue->set_value('person_id',get_person_id()); - $settingvalue->set_value('name','background_image'); - $settingvalue->save_changes(); - $settingvalue->set_etag(); - $settingvalue = $Setting->find($settingvalue->id); - } - - // get the one-to-one-related child-record from "entries" - $sEntry =& $settingvalue->FirstChild('entries'); - - $settingurl = $request->url_for(array('resource'=>'settings','id'=>$settingvalue->id,'action'=>'put')); - - $setting_name = 'background_tile'; - $boolean_options = array( - '0'=>'false', - '1'=>'true' - ); - $setting_list = $boolean_options; - $setting_mode = $Setting->find_by(array('name'=>$setting_name,'profile_id'=>get_profile_id())); - if (!$setting_mode) { - $setting_mode = $Setting->base(); - $setting_mode->set_value('profile_id',get_profile_id()); - $setting_mode->set_value('person_id',get_person_id()); - $setting_mode->set_value('name',$setting_name); - $setting_mode->set_value('value','0'); - $setting_mode->save_changes(); - $setting_mode->set_etag(); - $setting_mode = $Setting->find($setting_mode->id); - } - $setting_url = $request->url_for(array('resource'=>'settings','id'=>$setting_mode->id,'action'=>'put')); - $setting_entry = $setting_mode->FirstChild('entries'); - - - return vars( - array( &$Member, &$Entry, &$profile, &$identity_tz_options, &$n2mode,&$n2url,&$n2entry,&$n2list,&$setting_mode,&$setting_url,&$setting_entry,&$setting_list, &$settingurl, &$settingvalue, &$boolean_options, &$sEntry ), - get_defined_vars() - ); -} - -function _admin( &$vars ) { - include 'wp-content/language/lang_chooser.php'; //Loads the language-file - extract($vars); - global $submenu,$current_user; - trigger_before( 'admin_menu', $current_user, $current_user ); - $menuitems = array(); - $apps_list = array(); - global $env; - if (is_array($env['apps'])) - $apps_list = $env['apps']; - $i = $Identity->find(get_profile_id()); - while ($s = $i->NextChild('settings')){ - $s = $Setting->find($s->id); - $e = $s->FirstChild('entries'); - $apps_list[] = $s->value; - } - $menuitems[$request->url_for(array( - 'resource'=>'identities', - 'id'=>get_profile_id(), - 'action'=>'edit' - )).'/partial'] = $txt['identities_settings']; - $menuitems[$request->url_for(array( - 'resource'=>'identities', - 'id'=>get_profile_id(), - 'action'=>'subs' - )).'/partial'] = $txt['identities_friends']; - //$menuitems[$request->url_for(array( - // 'resource'=>'identities', - // 'id'=>get_profile_id(), - // 'action'=>'apps' - // )).'/partial'] = 'Apps'; - foreach ($submenu as $arr) { - if (in_array($arr[0][0],$apps_list)) - $menuitems[$arr[0][4]] = $arr[0][3]; - } - return vars( - array(&$menuitems), - get_defined_vars() - ); -} - - -function _subs( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile, &$Identity, &$Subscription, &$installed_apps ), - get_defined_vars() - ); -} - - -function _apps( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - $curl = curl_init("http://openappstore.com/?apps/show/partial"); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec( $curl ); - $store = ""; - if ($result) { - $store = $result; - } - //curl_close( $curl ); - - return vars( - array( &$store,&$collection, &$Member, &$Entry, &$profile, &$Identity, &$Subscription, &$installed_apps ), - get_defined_vars() - ); -} - - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - -function app_installer_json( &$vars ) { - extract($vars); - if (!(class_exists('Services_JSON'))) - lib_include( 'json' ); - $json = new Services_JSON(); - $apps_list = array(); - - if (isset($GLOBALS['PATH']['apps'])) - foreach($GLOBALS['PATH']['apps'] as $k=>$v) - if ($k != 'omb') - $apps_list[$k] = $k; - - // apps_list = physical apps on this host - - $sources = environment('remote_sources'); - $remote_list = array(); - - // remote_list = all not-installed apps on remote sources - - foreach($sources as $name=>$url) { - $url = "http://".$url."&p=".urlencode($request->uri); - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = false; - $result = curl_exec( $curl ); - if ($result) { - $data = mb_unserialize($result); - foreach($data as $appname=>$appdata) { - $remote_list[$appname] = $appname; - } - } - curl_close( $curl ); - } - - $i = $Identity->find(get_app_id()); - - while ($s = $i->NextChild('settings')) { - if ($s->name == 'app' && in_array($s->value, $apps_list)) - $apps_list = drop_array_element($apps_list,$s->value); - } - - $i = $Identity->find(get_app_id()); - - while ($s = $i->NextChild('settings')) { - if ($s->name == 'app' && in_array($s->value, $remote_list)) - $remote_list = drop_array_element($remote_list,$s->value); - } - - $all_apps = array_merge($apps_list,$remote_list); - - header( "Content-Type: application/javascript" ); - - print $json->encode($all_apps); - - exit; -} - - -function installed_apps_json( &$vars ) { - extract($vars); - if (!(class_exists('Services_JSON'))) - lib_include( 'json' ); - $json = new Services_JSON(); - $apps_list = array(); - $i = $Identity->find(get_profile_id()); - while ($s = $i->NextChild('settings')){ - if ($s->name == 'app') { - $s = $Setting->find($s->id); - $e = $s->FirstChild('entries'); - $apps_list[$e->etag] = $s->value; - } - } - - header( "Content-Type: application/javascript" ); - - print $json->encode($apps_list); - exit; -} - -function _background( &$vars ) { - extract( $vars ); - - $settingvalue = $Setting->find_by(array('name'=>'background_image','profile_id'=>get_profile_id())); - - if (!$settingvalue) { - $settingvalue = $Setting->base(); - $settingvalue->set_value('profile_id',get_profile_id()); - $settingvalue->set_value('person_id',get_person_id()); - $settingvalue->set_value('name','background_image'); - $settingvalue->save_changes(); - $settingvalue->set_etag(); - $settingvalue = $Setting->find($settingvalue->id); - } - - // get the one-to-one-related child-record from "entries" - $Entry =& $settingvalue->FirstChild('entries'); - - $settingurl = $request->url_for(array('resource'=>'settings','id'=>$settingvalue->id,'action'=>'put')); - - $setting_name = 'background_tile'; - $boolean_options = array( - '0'=>'false', - '1'=>'true' - ); - $setting_list = $boolean_options; - $setting_mode = $Setting->find_by(array('name'=>$setting_name,'profile_id'=>get_profile_id())); - if (!$setting_mode) { - $setting_mode = $Setting->base(); - $setting_mode->set_value('profile_id',get_profile_id()); - $setting_mode->set_value('person_id',get_person_id()); - $setting_mode->set_value('name',$setting_name); - $setting_mode->set_value('value','0'); - $setting_mode->save_changes(); - $setting_mode->set_etag(); - $setting_mode = $Setting->find($setting_mode->id); - } - $setting_url = $request->url_for(array('resource'=>'settings','id'=>$setting_mode->id,'action'=>'put')); - $setting_entry = $setting_mode->FirstChild('entries'); - - - return vars( - array( &$setting_mode,&$setting_url,&$setting_entry,&$setting_list,&$Member, &$Entry, &$profile, &$settingurl, &$settingvalue, &$boolean_options ), - get_defined_vars() - ); - -} diff --git a/app/omb/controllers/index.php b/app/omb/controllers/index.php deleted file mode 100755 index d1622c8..0000000 --- a/app/omb/controllers/index.php +++ /dev/null @@ -1,149 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->resource ); -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -function preview( &$vars ) { - extract($vars); - $model =& $db->get_table( $request->resource ); - $Entry =& $db->model('Entry'); - $p = $model->find($request->id); - $e = $Entry->find($p->entry_id); - $t = $Thumbnail->find_by('target_id',$e->id); - if ($t) { - $request->set_param('resource','thumbnails'); - $request->set_param('id',$t->id); - render_blob($t->attachment,extension_for($e->content_type)); - } else { - render_blob($p->attachment,extension_for($e->content_type)); - } -} - diff --git a/app/omb/controllers/methods.php b/app/omb/controllers/methods.php deleted file mode 100644 index 9994595..0000000 --- a/app/omb/controllers/methods.php +++ /dev/null @@ -1,149 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function post( &$vars ) { - extract( $vars ); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->url_for(array('action'=>'edit','resource'=>'methods','id'=>$request->id))); -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - - $method_resource_options = array(); - foreach($db->tables as $tab) - if (isset($db->models[$tab])) - $method_resource_options[] = $tab; - $method_permission_options = array( - 'read', - 'write', - 'create', - 'delete' - ); - - - return vars( - array( &$Member, - &$method_resource_options, - &$method_permission_options, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - diff --git a/app/omb/controllers/posts.php b/app/omb/controllers/posts.php deleted file mode 100644 index b43d660..0000000 --- a/app/omb/controllers/posts.php +++ /dev/null @@ -1,844 +0,0 @@ -members )) { - case ( 1 ) : - if ($request->id && $request->entry_url()) - render( 'action', 'entry' ); - default : - render( 'action', 'index' ); - } -} - - -function handle_twitter_cmdline(&$request){ - $commands = array( - 'follow ', - 'unfollow ', - 'addtolist ' - ); - $parts = explode(" ",$request->params['post']['title']); - $c = $parts[0]." "; - $result = false; - if (in_array($c,$commands)){ - $c = trim($c)."_cmdfunc"; - if (function_exists($c)) - $result = $c($parts); - } - return $result; -} - -class RSSActivityHandler { - var $data; - var $new_item; - var $current_tag; - var $parsing_item; - function RSSActivityHandler(){ - $this->parsing_item = false; - $this->data = array( - 'items' => array(), - 'channel' => array() - ); - } - function openHandler(& $parser,$name,$attrs) { - $this->current_tag = $name; - if ($name == 'item'){ - $this->new_item = array(); - $this->parsing_item = true; - } elseif ($name == 'textInput'){ - $this->new_item = array(); - $this->parsing_item = true; - } elseif ($this->parsing_item) { - $this->new_item[$name] = $attrs; - } else { - $this->data['channel'][$name] = $attrs; - } - } - function closeHandler(& $parser,$name) { - if ($name == 'item'){ - $this->data['items'][] = $this->new_item; - $this->parsing_item = false; - } - if ($name == 'textInput'){ - $this->data['channel']['textInput'] = $this->new_item; - $this->parsing_item = false; - } - } - function dataHandler(& $parser,$data) { - if ($this->parsing_item) - if (count($this->new_item[$this->current_tag]) > 0) - $this->new_item[$this->current_tag.'_data'] = $data; - else - $this->new_item[$this->current_tag] = $data; - else - if (count($this->data['channel'][$this->current_tag]) > 0) - $this->data['channel'][$this->current_tag.'_data'] = $data; - else - $this->data['channel'][$this->current_tag] = $data; - } - function escapeHandler(& $parser,$data) { - if ($this->parsing_item) - $this->new_item[$this->current_tag.'_escape'] = $data; - else - $this->data['channel'][$this->current_tag.'_escape'] = $data; - } - function piHandler(& $parser,$target,$data) { - if ($this->parsing_item) - $this->new_item[$this->current_tag.'_pi'] = $data; - else - $this->data['channel'][$this->current_tag.'_pi'] = $data; - } - function jaspHandler(& $parser,$data) { - if ($this->parsing_item) - $this->new_item[$this->current_tag.'_jasp'] = $data; - else - $this->data['channel'][$this->current_tag.'_jasp'] = $data; - } -} - - -function discover_feeds($url){ - - add_include_path(library_path()); - include 'Zend/Uri.php'; - - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec( $curl ); - - if ($result) - $contents = $result; - else - $contents = ''; - - @ini_set('track_errors', 1); - $pattern = '~(]+)/?>~i'; - $result = @preg_match_all($pattern, $contents, $matches); - @ini_restore('track_errors'); - $feeds = array(); - if (isset($matches[1]) && count($matches[1]) > 0) { - foreach ($matches[1] as $link) { - if (!mb_check_encoding($link, 'UTF-8')) { - $link = mb_convert_encoding($link, 'UTF-8'); - } - $xml = @simplexml_load_string(rtrim($link, ' /') . ' />'); - if ($xml === false) { - continue; - } - $attributes = $xml->attributes(); - if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) { - continue; - } - if (!isset($attributes['type']) || - !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) { - continue; - } - if (!isset($attributes['href'])) { - continue; - } - try { - // checks if we need to canonize the given uri - try { - $uri = Zend_Uri::factory((string) $attributes['href']); - } catch (Zend_Uri_Exception $e) { - // canonize the uri - $path = (string) $attributes['href']; - $query = $fragment = ''; - if (substr($path, 0, 1) != '/') { - // add the current root path to this one - $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path; - } - if (strpos($path, '?') !== false) { - list($path, $query) = explode('?', $path, 2); - } - if (strpos($query, '#') !== false) { - list($query, $fragment) = explode('#', $query, 2); - } - $uri = Zend_Uri::factory($client->getUri(true)); - $uri->setPath($path); - $uri->setQuery($query); - $uri->setFragment($fragment); - } - - } catch (Exception $e) { - continue; - } - $feeds[] = $uri->getUri(); - } - } - return $feeds; -} - -function discover_textInput($url){ - - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec( $curl ); - - if ($result) - $body = $result; - else - $body = false; - - if ($body) { - - lib_include('parser'); - - $parser =& new HtmlParser(); - $handler=& new RSSActivityHandler(); - - $parser->set_object($handler); - - $parser->set_option('trimDataNodes', TRUE); - - $parser->set_element_handler('openHandler','closeHandler'); - $parser->set_data_handler('dataHandler'); - $parser->set_escape_handler('escapeHandler'); - $parser->set_pi_handler('piHandler'); - $parser->set_jasp_handler('jaspHandler'); - - $parser->parse($body); - - return $handler->data['channel']['textInput']; - - } - - return false; - -} - - -function discover_twitter_person( $nickname ) { - $url = false; - $parts = str_split($nickname); - if ($parts[0] == '@') - array_shift($parts); - $endpoint = 'http://api.twitter.com/1/users/show/'.implode($parts).'.json'; - $ch = curl_init(); - if (defined("CURL_CA_BUNDLE_PATH")) curl_setopt($ch, CURLOPT_CAINFO, CURL_CA_BUNDLE_PATH); - curl_setopt($ch, CURLOPT_URL, $endpoint); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $response = curl_exec($ch); - if (!function_exists('json_encode')) - lib_include('json'); - $j = new Services_JSON(); - $twuser = (array)$j->decode($response); - return $twuser; -} - -function get_my_latest_object() { - global $db; - $Post =& $db->model('Post'); - $where = array( - 'profile_id'=>get_profile_id(), - 'local'=>1 - ); - $Post->find_by($where); - while ($p = $Post->MoveNext()){ - $e = $p->FirstChild('entries'); - if ($e->content_type == 'image/jpeg') - return $p; - } - return false; -} - -function annotate(&$request){ - $commands = array( - 'tag ' - ); - $parts = explode(" ",$request->params['post']['title']); - $c = $parts[0]." "; - $result = false; - if (in_array($c,$commands)){ - $c = trim($c)."_cmdfunc"; - if (function_exists($c)) - $result = $c($parts); - } - return $result; -} - -function tag_cmdfunc($parts){ - // tag tantek.com in url - // create a new post, and annotate it with acivity strea.ms - // do feed discovery on tagged person's homepage url - if (isset($parts[1])){ - - - if (strpos($parts[1], '.') !== false) - $object = array('url'=>'http://'.$parts[1],'screen_name'=>$parts[2]); - else - $object = discover_twitter_person( $parts[1] ); - - global $db,$request; - - $request->set_param( array( 'post', 'title' ), 'tagged '. $parts[1] . ' in a photo' ); - - $Annotation =& $db->model('Annotation'); - if (!$db->table_exists('annotations')) - $Annotation->save(); - - $post = get_my_latest_object(); - - $arr = add_thumbs_if_blob($post->url); - - if ($arr[0]){ - $preview = $arr[0]; - } - - if ($arr[5]){ - $preview = $arr[5]; - } - - $tagverb = 'http://activitystrea.ms/schema/1.0/tag'; - - $ann = '[ - { - "annotations": { - "activity": { - "verb": "'.$tagverb.'", - "target": "'.$post->url.'", - "target-type": "photo", - "target-link-preview": "'.$preview.'", - "target-title": "'.$post->title.'", - "target-id": "'.$post->url.'", - "object": "'.$object['url'].'", - "object-type": "person", - "object-title": "'.$object['screen_name'].'", - "object-id": "'.$object['url'].'" - } - } - } - ]'; - - //object: person - //target: photo - preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $ann); - - if (!function_exists('json_encode')) - lib_include('json'); - $j = new Services_JSON(); - - $a = $Annotation->base(); - $a->set_value('json',$ann); - $a->save(); - - // feed discovery to notify the tagged person - $feeds = discover_feeds( $object['url'] ); - - foreach($feeds as $f){ - - $input = discover_textInput($f); - - if (is_array($input)) { - - if (isset($input['link'])){ - $reply_to = $input['link']; - $parts = split('mailto:',$reply_to); - $recipient = $parts[1]; - - global $request; - - $subject = 'You were tagged in a photo on '.$request->base; - - $email = "Hi, you were tagged in this photo:\n\n".$post->url."\n\n"; - - $html = false; - - send_email( $recipient, $subject, $email, environment('email_from'), environment('email_name'), $html ); - - } - } - } - - if ($a->id > 0) - return $a; - - } - return false; -} - -function follow_cmdfunc($parts){ - if (isset($parts[1])){ - $to = get_twitter_oauth(); - if ($to){ - $content = $to->OAuthRequest('https://twitter.com/friendships/create/'.$parts[1].'.xml', array(), 'POST'); - return true; - } - } - return false; -} - -function unfollow_cmdfunc($parts){ - if (isset($parts[1])){ - $to = get_twitter_oauth(); - if ($to){ - $content = $to->OAuthRequest('https://twitter.com/friendships/destroy/'.$parts[1].'.xml', array(), 'POST'); - return true; - } - } - return false; -} - -function addtolist_cmdfunc($parts){ - if (isset($parts[1])&&isset($parts[2])){ - $to = get_twitter_oauth(); - if ($to){ - $content = $to->OAuthRequest('https://twitter.com/users/show/'.$parts[1].'.json', array(), 'GET'); - if (!(class_exists('Services_JSON'))) - lib_include('json'); - $json = new Services_JSON(); - $data = $json->decode($content); - if ($content && $data && $json) - $content = $to->OAuthRequest('https://api.twitter.com/1/'.get_twitter_screen_name().'/'.$parts[2].'/members.xml', array('id'=>$data->id), 'POST'); - if (isset($parts[3])) - if ($parts[3] == '-u') - $content = $to->OAuthRequest('https://twitter.com/friendships/destroy/'.$parts[1].'.xml', array(), 'POST'); - return true; - } - } - return false; -} - -function post( &$vars ) { - extract( $vars ); - global $request; - - $twittercmd = handle_twitter_cmdline($request); - $annotation = annotate($request); - - if ($twittercmd) - redirect_to($request->base); - - $modelvar = classify($request->resource); - trigger_before( 'insert_from_post', $$modelvar, $request ); - $table = $request->resource; - $content_type = 'text/html'; - $rec = $$modelvar->base(); - if (!($$modelvar->can_create( $table ))) - trigger_error( "Sorry, you do not have permission to " . $request->action . " " . $table, E_USER_ERROR ); - $fields = $$modelvar->fields_from_request($request); - $fieldlist = $fields[$table]; - foreach ( $fieldlist as $field=>$type ) { - if ($$modelvar->has_metadata && is_blob($table.'.'.$field)) { - if (isset($_FILES[strtolower(classify($table))]['name'][$field])) - $content_type = type_of( $_FILES[strtolower(classify($table))]['name'][$field] ); - } - $rec->set_value( $field, $request->params[strtolower(classify($table))][$field] ); - } - $rec->set_value('profile_id',get_profile_id()); - $result = $rec->save_changes(); - if ( !$result ) - trigger_error( "The record could not be saved into the database.", E_USER_ERROR ); - if ($annotation) { - $annotation->set_value('target_id',$rec->id); - $annotation->save_changes(); - } - $atomentry = $$modelvar->set_metadata($rec,$content_type,$table,'id'); - $$modelvar->set_categories($rec,$request,$atomentry); - if ((is_upload($table,'attachment'))) { - - $upload_types = environment('upload_types'); - - if (!$upload_types) - $upload_types = array('jpg','jpeg','png','gif'); - - $ext = extension_for( type_of($_FILES[strtolower(classify($table))]['name']['attachment'])); - - if (!(in_array($ext,$upload_types))) - trigger_error('Sorry, this site only allows the following file types: '.implode(',',$upload_types), E_USER_ERROR); - - $url = $request->url_for(array( - 'resource'=>$table, - 'id'=>$rec->id - )); - $title = substr($rec->title,0,140); - $over = ((strlen($title) + strlen($url) + 1) - 140); - if ($over > 0) - $rec->set_value('title',substr($title,0,-$over)." ".$url); - else - $rec->set_value('title',$title." ".$url); - $rec->save_changes(); - - - $tmp = $_FILES[strtolower(classify($table))]['tmp_name']['attachment']; - - if (is_jpg($tmp)) { - $thumbsize = environment('max_pixels'); - $Thumbnail =& $db->model('Thumbnail'); - $t = $Thumbnail->base(); - $newthumb = tempnam( "/tmp", "new".$rec->id.".jpg" ); - resize_jpeg($tmp,$newthumb,$thumbsize); - $t->set_value('target_id',$atomentry->id); - $t->save_changes(); - update_uploadsfile( 'thumbnails', $t->id, $newthumb ); - $t->set_etag(); - } - - } - - trigger_after( 'insert_from_post', $$modelvar, $rec ); - header_status( '201 Created' ); - redirect_to( $request->base ); - -} - - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - -function _doctype( &$vars ) { - // doctype controller -} - - - -function index( &$vars ) { - extract( $vars ); - - - if ($request->client_wants == 'rss'){ - $request->set_param('action','api_statuses_public_timeline_rss'); - $response->render($request); - exit; - } - - - $theme = environment('theme'); - $blocks = environment('blocks'); - $atomfeed = $request->feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - -function _profile( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Identity =& $db->model('Identity'); - if (!isset($request->byid)) - $request->set_param('byid',get_profile_id()); - $Member = $Identity->find($request->byid); - $Entry = $Member->FirstChild( 'entries' ); - $installed_apps = array(); - $Subscription->set_limit(10); - return vars( - array( &$collection, &$Member, &$Entry, &$profile, &$Identity, &$Subscription, &$installed_apps ), - get_defined_vars() - ); -} - - -function _replies( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - -function _index( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _widget( &$vars ) { - // index controller returns - // a Collection of recent entries - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - - -function _entry( &$vars ) { - // entry controller returns - // a Collection w/ 1 member entry - extract( $vars ); - $Member = $collection->MoveNext(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$collection, &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _upload( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - - $Post->find(); - $p = $Post->MoveFirst(); - if (!$p) $p = 0; - $url = $request->url_for(array( - 'resource'=>'posts', - 'id'=>$p->id - )); - $url_length = strlen($url); - - return vars( - array( &$Member, &$profile, &$url_length ), - get_defined_vars() - ); -} - - - - - -function _new( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - - -function _edit( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - -function _block( &$vars ) { - - extract( $vars ); - return vars( - array( - &$Entry, - &$collection - ), - get_defined_vars() - ); - -} - -function _oembed( &$vars ) { - - extract( $vars ); - - $width = $_GET['maxWidth']; - $height = $_GET['maxHeight']; - - $id = array_pop(split("\/",$_GET['url'])); - - $version = '1.0'; - - $p = $Post->find($id); - $e = $p->FirstChild('entries'); - $title = $p->title; - - $o = owner_of($p); - - if (extension_for($e->content_type) == 'mp3') { - $type = 'rich'; // photo video link rich - $url = $request->url_for(array( - 'resource'=>'posts', - 'id'=>$id, - 'action'=>'attachment.mp3' - )); - } elseif (extension_for($e->content_type) == 'jpg') { - $type = 'photo'; - $url = $request->url_for(array( - 'resource'=>'posts', - 'id'=>$id, - 'action'=>'preview' - )); - } elseif (extension_for($e->content_type) == 'mov') { - $type = 'video'; - $url = $request->url_for(array( - 'resource'=>'posts', - 'id'=>$id, - 'action'=>'attachment.mov' - )); - } elseif (extension_for($e->content_type) == 'avi') { - $type = 'video'; - $url = $request->url_for(array( - 'resource'=>'posts', - 'id'=>$id, - 'action'=>'attachment.avi' - )); - } else { - exit; - } - - - $author_name = $o->nickname; - $author_url = $o->profile; - $cache_age = 3600; - $provider_name = "myphotos"; - $provider_url = $request->base; - - $thumbnail_url = 0; - $thumbnail_width = 0; - $thumbnail_height = 0; - - - - return vars( - array( - &$version, - &$type, - &$title, - &$author_name, - &$author_url, - &$cache_age, - &$provider_name, - &$provider_url, - &$width, - &$height, - &$thumbnail_url, - &$thumbnail_width, - &$thumbnail_height, - &$url - ), - get_defined_vars() - ); - -} - - - -function _apps( &$vars ) { - extract($vars); - $Identity =& $db->model('Identity'); - global $submenu,$current_user; - trigger_before( 'admin_menu', $current_user, $current_user ); - $menuitems = array(); - $apps_list = array(); - global $env; - if (is_array($env['apps'])) - $apps_list = $env['apps']; - $i = $Identity->find(get_profile_id()); - while ($s = $i->NextChild('settings')){ - $s = $Setting->find($s->id); - $e = $s->FirstChild('entries'); - $apps_list[] = $s->value; - } - $menuitems[$request->url_for(array( - 'resource'=>'identities', - 'id'=>get_profile_id(), - 'action'=>'edit' - )).'/partial'] = 'Settings'; - $menuitems[$request->url_for(array( - 'resource'=>'identities', - 'id'=>get_profile_id(), - 'action'=>'subs' - )).'/partial'] = 'Friends'; - //$menuitems[$request->url_for(array( - // 'resource'=>'identities', - // 'id'=>get_profile_id(), - // 'action'=>'apps' - // )).'/partial'] = 'Apps'; - foreach ($submenu as $arr) { - if (in_array($arr[0][0],$apps_list)) - $menuitems[$arr[0][4]] = $arr[0][3]; - } - return vars( - array(&$menuitems), - get_defined_vars() - ); -} - - -function preview( &$vars ) { - extract($vars); - $model =& $db->get_table( $request->resource ); - $Entry =& $db->model('Entry'); - $p = $model->find($request->id); - $e = $Entry->find($p->entry_id); - $t = $Thumbnail->find_by('target_id',$e->id); - if ($t) { - $request->set_param('resource','thumbnails'); - $request->set_param('id',$t->id); - render_blob($t->attachment,extension_for($e->content_type)); - } else { - render_blob($p->attachment,extension_for($e->content_type)); - } -} - - -function _pagelist( &$vars ) { - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} - -function _pagenew( &$vars ) { - extract( $vars ); - $model =& $db->get_table( $request->resource ); - $Member = $model->base(); - return vars( - array( &$Member, &$profile ), - get_defined_vars() - ); -} - -function _pagespan( &$vars ) { - extract( $vars ); - return vars( - array( &$collection, &$profile ), - get_defined_vars() - ); -} diff --git a/app/omb/controllers/settings.php b/app/omb/controllers/settings.php deleted file mode 100755 index ee6498d..0000000 --- a/app/omb/controllers/settings.php +++ /dev/null @@ -1,107 +0,0 @@ -find($request->id); - if (strpos($s->name, 'password') !== false) - $request->set_param(array('setting','value'), - md5_encrypt($request->params['setting']['value'], $db->dbname) - ); - $event = $s->name."_enabled"; - if (('enabled' == $request->params['setting']['value'])&&function_exists($event)) - $event(); - $event = $s->name."_disabled"; - if (('disabled' == $request->params['setting']['value'])&&function_exists($event)) - $event(); - $resource->update_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->resource ); -} - - -function post( &$vars ) { - extract( $vars ); - - if (!(get_profile_id())) - trigger_error( 'Sorry, the setting could not be saved', E_USER_ERROR ); - - $request->set_param( array( 'setting', 'profile_id' ), get_profile_id() ); - - if (strpos($request->params['setting']['name'], 'password') !== false) - $request->set_param(array('setting','value'), - md5_encrypt($request->params['setting']['value'], $db->dbname) - ); - - $settingname = $request->params['setting']['name']; - - $set = split('\.',$settingname); - - if (is_array($set) && $set[0] == 'config') { - if (!member_of('administrators')) - trigger_error( 'Sorry, you must be an administrator to do that', E_USER_ERROR ); - $s = $Setting->find_by( 'name', $settingname ); - if ($s) - $db->delete_record($s); - } - - if ($settingname == 'app') { - - $do_install = false; - - $app = $settingname; - - $sources = environment('remote_sources'); - $remote_list = array(); - - foreach($sources as $name=>$url) { - $p = get_profile(); - $url = "http://".$url."&p=".urlencode($p->profile_url)."&a=".urlencode($app); - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec( $curl ); - if ($result) { - if (trim($result) == 'install') - $do_install = true; - continue; - } - curl_close( $curl ); - } - - if (!$do_install) - trigger_error( 'Sorry, you are not authorized to install '.$app, E_USER_ERROR ); - - } - $event = $settingname."_enabled"; - if (('enabled' == $request->params['setting']['value'])&&function_exists($event)) - $event(); - $event = $settingname."_disabled"; - if (('disabled' == $request->params['setting']['value'])&&function_exists($event)) - $event(); - $resource->insert_from_post( $request ); - header_status( '201 Created' ); - redirect_to( $request->resource ); -} - - - -function delete( &$vars ) { - extract( $vars ); - $s = $collection->MoveFirst(); - if (!$s || $s->profile_id != get_profile_id()) - trigger_error( 'Sorry, the setting could not be deleted', E_USER_ERROR ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - - - - diff --git a/app/omb/controllers/subscriptions.php b/app/omb/controllers/subscriptions.php deleted file mode 100755 index fcab6cf..0000000 --- a/app/omb/controllers/subscriptions.php +++ /dev/null @@ -1,146 +0,0 @@ -feed_url(); - return vars( - array( - &$blocks, - &$profile, - &$collection, - &$atomfeed, - &$theme - ), - get_defined_vars() - ); -} - -function put( &$vars ) { - extract( $vars ); - $resource->update_from_post( $request ); - header_status( '200 OK' ); - redirect_to( $request->resource ); -} - -function delete( &$vars ) { - extract( $vars ); - $resource->delete_from_post( $request ); - header_status( '200 OK' ); - redirect_to($request->url_for(array( - 'resource'=>'identities', - 'id'=>$profile->id, - 'action'=>'edit' ))); -} - - -function _remove( &$vars ) { - extract( $vars ); - $Member = $collection->MoveFirst(); - $Entry = $Member->FirstChild( 'entries' ); - return vars( - array( &$Member, &$Entry, &$profile ), - get_defined_vars() - ); -} - - - -function _followers( &$vars ) { - extract($vars); - global $request; - global $response; - - $pagevar = "followerspage"; - - if (isset($request->params[$pagevar])) - $page = $request->params[$pagevar]; - else - $page = 1; - - $mapper = array( - 'nickname'=>$request->params['nickname'], - ); - - $where = array( - 'subscribed'=>$request->params['byid'] - ); - - $Subscription->set_param( 'find_by', $where ); - - $request->set_param('page',$page); - - $Subscription->set_limit(10); - - $response->collection = new Collection('subscriptions'); - if (count($response->collection->members) >= $response->collection->per_page ) { - $mapper[$pagevar] = ($page + 1); - $older = '< older'; - } - if ($page > 1) { - $mapper[$pagevar] = ($page - 1); - $newer = "   "; - $newer .= 'newer >'; - } - $Identity =& $db->model('Identity'); - return vars( - array( &$newer, &$older, &$collection, &$Identity ), - get_defined_vars() - ); -} - -function _following( &$vars ) { - extract($vars); - global $request; - global $response; - - $pagevar = "followingpage"; - - if (isset($request->params[$pagevar])) - $page = $request->params[$pagevar]; - else - $page = 1; - - $mapper = array( - 'nickname'=>$request->params['nickname'], - ); - - $where = array( - 'subscriber'=>$request->params['byid'] - ); - - $Subscription->set_param( 'find_by', $where ); - - $request->set_param('page',$page); - - $Subscription->set_limit(10); - - $response->collection = new Collection('subscriptions'); - if (count($response->collection->members) >= $response->collection->per_page ) { - $mapper[$pagevar] = ($page + 1); - $older = '< older'; - } - if ($page > 1) { - $mapper[$pagevar] = ($page - 1); - $newer = "   "; - $newer .= 'newer >'; - } - $Identity =& $db->model('Identity'); - return vars( - array( &$newer, &$older, &$collection, &$Identity ), - get_defined_vars() - ); -} - - - - diff --git a/app/omb/models/Aggregate.php b/app/omb/models/Aggregate.php deleted file mode 100755 index ac05d9a..0000000 --- a/app/omb/models/Aggregate.php +++ /dev/null @@ -1,33 +0,0 @@ -char_field( 'name' ); - $this->char_field( 'term' ); - $this->char_field( 'scheme' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_and_belongs_to_many( 'entries' ); - - // permissions - - $this->let_read( 'all:everyone' ); - - $this->let_access( 'all:administrators' ); - - } - - function init() { - - } - -} - - diff --git a/app/omb/models/Blog.php b/app/omb/models/Blog.php deleted file mode 100644 index b1ec4c1..0000000 --- a/app/omb/models/Blog.php +++ /dev/null @@ -1,40 +0,0 @@ -char_field( 'title' ); - $this->char_field( 'prefix', 2 ); - $this->char_field( 'nickname' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - - // permissions - $this->let_read( 'all:everyone' ); - - $this->let_create( 'all:members' ); - $this->let_write( 'all:members' ); - $this->let_delete( 'all:members' ); - - $this->let_access( 'all:administrators' ); - - $this->validates_uniqueness_of( 'prefix' ); - $this->validates_uniqueness_of( 'nickname' ); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Category.php b/app/omb/models/Category.php deleted file mode 100755 index db78fcc..0000000 --- a/app/omb/models/Category.php +++ /dev/null @@ -1,31 +0,0 @@ -set_limit(100); - - $this->char_field( 'name' ); - $this->char_field( 'term' ); - $this->char_field( 'scheme' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_and_belongs_to_many( 'entries' ); - - // permissions - - $this->let_read( 'all:everyone' ); - - $this->let_access( 'all:administrators' ); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Entry.php b/app/omb/models/Entry.php deleted file mode 100755 index 01e82c0..0000000 --- a/app/omb/models/Entry.php +++ /dev/null @@ -1,33 +0,0 @@ -char_field( 'resource' ); - $this->int_field( 'record_id' ); - - $this->char_field( 'etag' ); - $this->char_field( 'content_type' ); - $this->time_field( 'expires' ); - - $this->time_field( 'last_modified' ); - $this->time_field( 'issued' ); - - $this->int_field( 'person_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_and_belongs_to_many( 'categories' ); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Event.php b/app/omb/models/Event.php deleted file mode 100755 index 96b62c9..0000000 --- a/app/omb/models/Event.php +++ /dev/null @@ -1,53 +0,0 @@ -char_field( 'category' ); - $this->char_field( 'class' ); - - $this->text_field( 'description' ); - - $this->time_field( 'dtend' ); - $this->time_field( 'dtstart' ); - - $this->char_field( 'duration' ); - - $this->char_field( 'location' ); - - $this->char_field( 'street_address' ); - $this->char_field( 'locality' ); - $this->char_field( 'region' ); - $this->char_field( 'postal_code' ); - - $this->char_field( 'status' ); - - $this->text_field( 'summary' ); - - $this->char_field( 'uid' ); - - $this->char_field( 'url' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - - // permissions - - $this->let_read( 'all:everyone' ); - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Group.php b/app/omb/models/Group.php deleted file mode 100755 index 3860823..0000000 --- a/app/omb/models/Group.php +++ /dev/null @@ -1,58 +0,0 @@ -char_field( 'name' ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'person_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - $this->has_one( 'person' ); - - $this->has_many( 'memberships' ); - - // permissions - - $this->let_access( 'all:administrators' ); - - #$this->set_hidden(); - - } - - function init() { - - $this->set_limit(100); - $this->find(); - $found = array(); - while ($rec = $this->MoveNext()) - $found[] = $rec->name; - - $Grp = $this->base(); - $Grp->set_value( 'name', 'everyone' ); - if (!(in_array($Grp->attributes['name'],$found))) - $Grp->save_changes(); - - $Grp = $this->base(); - $Grp->set_value( 'name', 'administrators' ); - if (!(in_array($Grp->attributes['name'],$found))) - $Grp->save_changes(); - - $Grp = $this->base(); - $Grp->set_value( 'name', 'members' ); - if (!(in_array($Grp->attributes['name'],$found))) - $Grp->save_changes(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Identity.php b/app/omb/models/Identity.php deleted file mode 100755 index 16f124c..0000000 --- a/app/omb/models/Identity.php +++ /dev/null @@ -1,109 +0,0 @@ -char_field( 'label' ); - - $this->char_field( 'url' ); - - $this->char_field( 'post_notice' ); - $this->char_field( 'update_profile' ); - - $this->char_field( 'license' ); - $this->char_field( 'bio' ); - $this->char_field( 'avatar' ); - $this->char_field( 'profile' ); - $this->char_field( 'profile_url' ); - $this->char_field( 'homepage' ); - - $this->char_field( 'fullname' ); - $this->char_field( 'family_name' ); - $this->char_field( 'given_name' ); - - $this->char_field( 'nickname', 50 ); - $this->char_field( 'password', 100 ); - - $this->file_field( 'photo' ); - - $this->char_field( 'token', 20 ); - $this->char_field( 'email_value' ); - $this->char_field( 'locality', 100 ); - $this->char_field( 'region', 100 ); - $this->char_field( 'postal_code', 20 ); - $this->char_field( 'country_name', 2 ); - $this->char_field( 'latitude', 3 ); - $this->char_field( 'longitude', 3 ); - $this->char_field( 'tz', 3 ); - $this->char_field( 'dob', 8 ); - $this->char_field( 'gender', 1 ); - $this->char_field( 'language', 2 ); - - $this->bool_field( 'is_primary', true ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'person_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - $this->has_one( 'person' ); - $this->has_many( 'settings.profile_id' ); - - // requirements - - $this->validates_presence_of( 'label' ); - - $this->validates_uniqueness_of( 'url' ); - - // permissions - - // templates - - $this->let_read( 'all:entry' ); - $this->let_read( 'all:entry.jpg' ); - $this->let_read( 'all:entry.xrds' ); - - $this->let_read( 'all:installed_apps_json.json' ); - $this->let_read( 'all:app_installer_json.json' ); - - - - $this->let_read( 'all:admin' ); - - // anyone can call up the edit form for any user -- hrm - $this->let_read( 'all:edit' ); - $this->let_read( 'all:apps' ); - $this->let_read( 'all:subs' ); - $this->let_read( 'all:pass' ); - - // groups - - // registered 'members' can modify their own records - $this->let_modify( 'all:members' ); - - // the first user is a member of 'administrators' - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - // not needed if blobcol is named 'attachment' - - $this->set_blob('photo'); - - // number of records in the collection - - $this->set_limit(500); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Like.php b/app/omb/models/Like.php deleted file mode 100644 index 2495110..0000000 --- a/app/omb/models/Like.php +++ /dev/null @@ -1,21 +0,0 @@ -char_field( 'fb_post_id' ); - $this->char_field( 'tw_post_id' ); - $this->char_field( 'bz_post_id' ); - $this->char_field( 'post_id' ); - - $this->int_field( 'entry_id' ); - - - $this->auto_field( 'id' ); - - } - -} - - diff --git a/app/omb/models/Link.php b/app/omb/models/Link.php deleted file mode 100755 index 87d9b94..0000000 --- a/app/omb/models/Link.php +++ /dev/null @@ -1,38 +0,0 @@ -char_field( 'title' ); - - $this->text_field( 'description' ); - - $this->char_field( 'type' ); // feed or page - $this->char_field( 'href' ); // html link - $this->char_field( 'xref' ); // xml link - $this->char_field( 'rel' ); - $this->char_field( 'version' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - - // permissions - - $this->let_access( 'all:administrators' ); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Membership.php b/app/omb/models/Membership.php deleted file mode 100755 index 6f0fe84..0000000 --- a/app/omb/models/Membership.php +++ /dev/null @@ -1,52 +0,0 @@ -int_field( 'group_id' ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'person_id' ); - - $this->bool_field( 'notify_get' ); - $this->bool_field( 'notify_put' ); - $this->bool_field( 'notify_post' ); - $this->bool_field( 'notify_delete' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - $this->has_one( 'person' ); - - // permissions - - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - } - - function init() { - - $this->set_limit(100); - $this->find(); - $found = array(); - while ($rec = $this->MoveNext()) - $found[] = $rec->group_id; - - $M = $this->base(); - $M->set_value( 'group_id', 2 ); - $M->set_value( 'person_id', 1 ); - if (!(in_array($M->attributes['group_id'],$found))) - $M->save_changes(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Method.php b/app/omb/models/Method.php deleted file mode 100644 index e6be454..0000000 --- a/app/omb/models/Method.php +++ /dev/null @@ -1,978 +0,0 @@ -auto_field( 'id' ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'oauth' ); - $this->int_field( 'http' ); - $this->int_field( 'omb' ); - - $this->bool_field( 'enabled' ); - - $this->char_field( 'function' ); - $this->char_field( 'route' ); - $this->char_field( 'resource' ); - $this->char_field( 'permission' ); - - $this->text_field( 'code' ); - - $this->has_one( 'entry' ); - - $this->let_access( 'all:administrators' ); - - } - - function init() { - - $this->set_limit(100); - $this->find(); - $methods = array(); - while ($m = $this->MoveNext()) - $methods[] = $m->function; - - - $m = $this->base(); - $m->set_value( 'code', ' - -// get some variables in scope -extract( $vars ); -$tweets = array(); - -$callback = $_GET[\'callback\']; - -// get the data model for the "posts" table -$Post =& $db->model( \'Post\' ); - -// search for the most recent 10 records -$Post->find(); - -// loop over each record -while ( $p = $Post->MoveNext() ) { - - $profile = owner_of( $p ); - - $tweet = array(); - - $user = array( - \'screen_name\' => $profile->nickname, - \'profile_background_image_url\' => $profile->avatar, - \'url\' => $profile->profile_url - ); - - $tweet[\'text\'] = $p->title; - $tweet[\'truncated\'] = \'false\'; - $tweet[\'created_at\'] = date( "D M d G:i:s O Y", strtotime( $p->created )); - $tweet[\'in_reply_to_status_id\'] = null; - $tweet[\'source\'] = null; - $tweet[\'id\'] = $p->uri; - $tweet[\'favorited\'] =\'false\'; - $tweet[\'user\'] = $user; - - $tweets[] = $tweet; - -} - -echo $callback."("; - -if (!(class_exists(\'Services_JSON\'))) - lib_include(\'json\'); -$json = new Services_JSON(); - -// create the JSON data -echo $json->encode( $tweets ); - -echo ");"; - -'); - - $m->set_value( 'function', 'api_statuses_public_timeline' ); - $m->set_value( 'route', 'api/statuses/public_timeline.json' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - extract( $vars ); - - $request->set_param( array( \'post\', \'title\' ), $request->status ); - - global $db,$request,$response; - - $pid = get_app_id(); - - $i = get_profile($pid); - - $response->set_var(\'profile\',$profile); - - load_apps(); - - $table = \'posts\'; - - $modelvar = classify($table); - - $twittercmd = handle_twitter_cmdline($request); - - if (function_exists(\'handle_tweetiepic\')) - handle_tweetiepic($request); - - $request->set_param(\'resource\',$table); - - $resource->insert_from_post( $request ); - - $Upload =& $db->model(\'Upload\'); - - $Upload->find_by(array( - \'profile_id\'=>get_profile_id(), - \'eq\'=>\'IS\', - \'tmp_name\'=>\'NOT NULL\' - )); - - while ( $u = $Upload->MoveNext() ) - $result = $db->get_result( "UPDATE ".$db->prefix."uploads SET tmp_name = NULL WHERE id = ".$u->id ); - - if ( $request->client_wants == \'xml\' ) - render_home_timeline( true, $request->id ); - - header( \'Status: 200 OK\' ); - -'); - - $m->set_value( 'function', 'api_statuses_update' ); - $m->set_value( 'route', 'api/statuses/update' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'write' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - global $db,$request; - - $Identity =& $db->get_table( \'identities\' ); - $Person =& $db->get_table( \'people\' ); - $i = $Identity->find_by(array( - \'nickname\'=>$db->escape_string($_POST[\'username\']), - \'password\'=>md5($db->escape_string($_POST[\'password\'])) - ),1); - $p = $Person->find( $i->person_id ); - if (!(isset( $p->id ) && $p->id > 0)) - exit; - - if (isset($_FILES[\'media\'])) { - handle_posted_file(\'jpg\',$_FILES[\'media\'][\'tmp_name\'],$i); - - $mediaurl = $request->url_for(array( - \'resource\'=>\'uploads/\'.$request->id."/entry.jpg")); - - global $response; - $response->set_var(\'profile\',$i); - load_apps(); - shortener_init(); - global $wp_ozh_yourls; - if (!$wp_ozh_yourls) - wp_ozh_yourls_admin_init(); - $service = wp_ozh_yourls_service(); - if (empty($service)) { - add_option(\'ozh_yourls\',array( - \'service\'=>\'other\', - \'location\'=>\'\', - \'yourls_path\'=>\'\', - \'yourls_url\'=>\'\', - \'yourls_login\'=>\'\', - \'yourls_password\'=>\'\', - \'rply_login\'=>\'\', - \'rply_password\'=>\'\', - \'other\'=>\'rply\' - )); - global $wp_ozh_yourls; - if (!$wp_ozh_yourls) - wp_ozh_yourls_admin_init(); - $service = wp_ozh_yourls_service(); - } - $mediaurl = wp_ozh_yourls_api_call( wp_ozh_yourls_service(), $mediaurl); - - - header(\'Content-Type: text/xml\'); - echo \' - \'; - - $mediaid = \'_\'.$request->id; - - echo \' - \'.$mediaid.\' - \'.$mediaurl.\' - - \'; - } else { - - header(\'Content-Type: text/xml\'); - echo \' - \'; - - echo \' - - - \'; - } - exit; - - - -'); - - $m->set_value( 'function', 'api_upload' ); - $m->set_value( 'route', 'api/upload' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - - $m = $this->base(); - $m->set_value( 'code', ' - -extract( $vars ); - - -if (isset($request->client_wants)){ -if ($request->client_wants == \'json\') { - - - -$nick = substr( $request->params[\'nickname\'], 0, -5 ); -$Identity =& $db->model( \'Identity\' ); -$Identity->set_param(\'find_by\',array( - \'nickname\' => $nick, - \'eq\'=>\'IS\', - \'post_notice\' => \'NULL\', -)); - -$Post =& $db->model( \'Post\' ); -$Post->set_param( \'find_by\', array( - \'entries.person_id\' => $profile->person_id -)); - -$Post->find(); -$tweets = array(); -while ($p = $Post->MoveNext()) { - $tweet = array(); - $tweet[\'text\'] = $p->title; - $tweet[\'truncated\'] = \'false\'; - $tweet[\'created_at\'] = date( "D M d G:i:s O Y", strtotime( $p->created )); - $tweet[\'in_reply_to_status_id\'] = null; - $tweet[\'source\'] = null; - $tweet[\'id\'] = intval( $p->id ); - $tweet[\'favorited\'] =\'false\'; - $tweet[\'user\'] = $nick; - $tweets[] = $tweet; -} - -echo "twitterCallback2("; - -$json = new Services_JSON(); - -echo $json->encode( $tweets ); - -echo \');\'; - - - - - -exit; -} - - -} - - - -$parts = split(\'\.\',$request->params[\'byid\']); -$id = $parts[0]; -$request->set_param(\'byid\',$id); -$request->set_param(\'order\',\'desc\'); - - $where = array( - \'profile_id\'=>$id, - \'parent_id\'=>0 - ); -$tweets = new Collection( \'posts\', $where ); -$pro = get_profile($id); - -header( \'Content-Type: application/rss+xml\' ); - -render_rss_feed($pro,$tweets); - - -'); - - $m->set_value( 'function', 'api_statuses_user_timeline' ); - $m->set_value( 'route', 'api/statuses/user_timeline/:byid' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - - - $m = $this->base(); - $m->set_value( 'code', ' - - if (!(function_exists(\'rsscloud_schedule_post_notifications\'))) { - function rsscloud_schedule_post_notifications() { - // prevent Joseph Scott\'s plugin from loading its update feature - }} - - global $blogdata; - - $blogdata[\'rss2_url\'] =$_POST[\'url1\']; - - add_include_path(library_path()); - - include_once(\'rsscloud/rsscloud.php\'); - - rsscloud_hub_process_notification_request(); - - '); - - $m->set_value( 'function', 'api_rsscloud_pleaseNotify' ); - $m->set_value( 'route', 'api/rsscloud/pleaseNotify' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - global $db,$request,$response; - - if (isset($_GET[\'challenge\'])) { - - header( \'Status: 200 OK\' ); - echo $_GET[\'challenge\']; - exit; - - } - - extract($vars); - $Feed =& $db->model(\'Feed\'); - $f = $Feed->find_by(\'xref\',$_POST[\'url\']); - if ($f->profile_id) { - $profile_id = $f->profile_id; - $url = $_POST[\'url\']; - } else { - exit; - } - - $items = array(); - $title = \'\'; - $link = \'\'; - $description = \'\'; - - $buf = readURL($url); - $xml = new SimpleXmlElement($buf); - foreach($xml as $k1=>$v1){ - foreach($v1 as $k2=>$v2){ - $link = \'\'; - if ($k2 == \'item\') { - foreach($v2 as $k3=>$v3){ - if ($k3 == \'title\') - $title = (string)$v3; - if ($k3 == \'link\') - $link = (string)$v3; - if ($k3 == \'description\') - $description = (string)$v3; - } - if (!empty($link)) - $items[] =array( - \'title\'=>$title, - \'link\'=>$link, - \'description\'=>$description - ); - } - } - } - - $profile = get_profile($profile_id); - - $response->set_var(\'profile\',$profile); - - load_apps(); - $Post =& $db->model(\'Post\'); - foreach($items as $feeditem){ - $p = $Post->find_by(\'url\',$feeditem[\'link\']); - if ($p) - continue; - $table = \'posts\'; - $Post =& $db->model(\'Post\'); - $modelvar = \'Post\'; - $request->set_param(\'resource\',$table); - trigger_before( \'insert_from_post\', $$modelvar, $request ); - $content_type = \'text/html\'; - $rec = $$modelvar->base(); - $rec->set_value(\'profile_id\',$profile_id); - $rec->set_value( \'parent_id\', 0 ); - $rec->set_value( \'title\', $feeditem[\'title\'] ); - $rec->set_value( \'body\', $feeditem[\'description\'] ); - $rec->set_value( \'uri\', $feeditem[\'link\'] ); - $rec->set_value( \'url\', $feeditem[\'link\'] ); - $rec->save_changes(); - $atomentry = $$modelvar->set_metadata($rec,$content_type,$table,\'id\'); - trigger_after( \'insert_from_post\', $$modelvar, $rec ); - } - header( \'Status: 200 OK\' ); - exit; - - '); - - $m->set_value( 'function', 'api_rsscloud_callback' ); - $m->set_value( 'route', 'api/rsscloud/callback' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - if (!(function_exists(\'rsscloud_schedule_post_notifications\'))) { - function rsscloud_schedule_post_notifications() { - // prevent Joseph Scott\'s plugin from loading its update feature - }} - - global $blogdata; - - $blogdata[\'rss2_url\'] = $_POST[\'url\']; - - add_include_path(library_path()); - - include_once(\'rsscloud/rsscloud.php\'); - - $notify_rss = get_bloginfo( \'rss2_url\' ); - - $listeners = rsscloud_get_hub_notifications(); - - if (!is_array($listeners)) - return; - - foreach ( $listeners[$notify_rss] as $notify_url => $n ) { - if ( $n[\'status\'] == \'active\' ) { - if ( $n[\'protocol\'] == \'http-post\' ) { - $url = parse_url( $notify_url ); - $port = 80; - if ( !empty( $url[\'port\'] ) ) - $port = $url[\'port\']; - $notify_vars="url=" . $notify_rss; - $ch = curl_init(); - curl_setopt ($ch, CURLOPT_URL, $notify_url); - curl_setopt ($ch, CURLOPT_HEADER, 0); /// Header control - curl_setopt ($ch, CURLOPT_PORT, $port); - curl_setopt ($ch, CURLOPT_POST, true); /// tell it to make a POST, not a GET - curl_setopt ($ch, CURLOPT_POSTFIELDS, $notify_vars); - curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); - $xml_response = curl_exec ($ch); - curl_close ($ch); - $need_update = false; - if ( $result[\'response\'][\'code\'] != 200 ) { - $notify[$rss2_url][$notify_url][\'failure_count\']++; - $need_update = true; - } elseif ( $notify[$rss2_url][$notify_url][\'failure_count\'] > RSSCLOUD_MAX_FAILURES ) { - $notify[$rss2_url][$notify_url][\'status\'] = \'suspended\'; - $need_update = true; - } - } - } - } - - if ( $need_update ) - rsscloud_update_hub_notifications( $notify ); - - '); - - $m->set_value( 'function', 'api_rsscloud_ping' ); - $m->set_value( 'route', 'api/rsscloud/ping' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - extract( $vars ); - - if (!function_exists(\'set_default_omb_cloud_options\')) - include(app_path().\'rsscloud/rsscloud.php\'); - - if ( \'\' == get_option( \'cloud_domain\' ) ) - set_default_omb_cloud_options(); - - add_action(\'rss2_head\',\'load_my_cloud_element\'); - - lib_include( \'rsscloud_element\' ); - - - echo \' - - - - \'.htmlspecialchars(environment(\'site_title\')).\' - \'.$request->base.\' - \'.htmlspecialchars(environment(\'site_description\')).\' - en-us - - \'.date( "D, j M Y H:i:s T" ).\' - \'.date( "D, j M Y H:i:s T", strtotime( $collection->updated )).\' - OpenMicroBlogger - \'; - do_action(\'rss2_head\'); - echo \' - \'; - while ($p = $collection->MoveNext()) { - echo \' - \'.htmlspecialchars($p->title).\' - \'.$p->url.\' - \'.$p->url.\' - \'.$p->url.\' - \'.htmlspecialchars($p->body).\' - \'.date( "D, j M Y H:i:s T", strtotime( $p->created )).\' - - \'; - } - echo \' - - \'; - '); - - $m->set_value( 'function', 'api_statuses_public_timeline_rss' ); - $m->set_value( 'route', 'api/statuses/public_timeline' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - // get some variables in scope - extract( $vars ); - - if (isset($request->client_wants)){ - if ($request->client_wants == \'xml\'){ - - render_home_timeline(); - - }} - - - $tweets = array(); - - $callback = $_GET[\'callback\']; - - // get the data model for the "posts" table - $Post =& $db->model( \'Post\' ); - - // search for the most recent 10 records - $Post->find(); - - // loop over each record - while ( $p = $Post->MoveNext() ) { - - $profile = owner_of( $p ); - - $tweet = array(); - - $user = array( - \'screen_name\' => $profile->nickname, - \'profile_background_image_url\' => $profile->avatar, - \'url\' => $profile->profile_url - ); - - $tweet[\'text\'] = $p->title; - $tweet[\'truncated\'] = \'false\'; - $tweet[\'created_at\'] = date( "D M d G:i:s O Y", strtotime( $p->created )); - $tweet[\'in_reply_to_status_id\'] = null; - $tweet[\'source\'] = null; - $tweet[\'id\'] = $p->uri; - $tweet[\'favorited\'] =\'false\'; - $tweet[\'user\'] = $user; - - $tweets[] = $tweet; - - } - - if ($callback) - echo $callback."("; - if (!(class_exists(\'Services_JSON\'))) - lib_include(\'json\'); - $json = new Services_JSON(); - - // create the JSON data - echo $json->encode( $tweets ); - - if ($callback) - echo ");"; - - exit; - - - '); - - $m->set_value( 'function', 'api_statuses_home_timeline' ); - $m->set_value( 'route', 'api/statuses/home_timeline' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - - $m = $this->base(); - $m->set_value( 'code', ' - - extract( $vars ); - - - if (isset($request->client_wants)){ - if ($request->client_wants == \'json\') { - - - - $nick = substr( $request->params[\'nickname\'], 0, -5 ); - $Identity =& $db->model( \'Identity\' ); - $Identity->set_order(\'asc\'); - $Identity->set_limit(1); - $Identity->set_param(\'find_by\',array( - \'nickname\' => $nick, - \'eq\'=>\'IS\', - \'post_notice\' => \'NULL\', - )); - - $Post =& $db->model( \'Post\' ); - $Post->set_param( \'find_by\', array( - \'entries.person_id\' => $profile->person_id - )); - - $Post->find(); - $tweets = array(); - while ($p = $Post->MoveNext()) { - $tweet = array(); - $tweet[\'text\'] = $p->title; - $tweet[\'truncated\'] = \'false\'; - $tweet[\'created_at\'] = date( "D M d G:i:s O Y", strtotime( $p->created )); - $tweet[\'in_reply_to_status_id\'] = null; - $tweet[\'source\'] = null; - $tweet[\'id\'] = intval( $p->id ); - $tweet[\'favorited\'] =\'false\'; - $tweet[\'user\'] = $nick; - $tweets[] = $tweet; - } - - echo "twitterCallback2("; - - $json = new Services_JSON(); - - echo $json->encode( $tweets ); - - echo \');\'; - - - - - - exit; - } - - - } - - - - $parts = split(\'\.\',$request->params[\'byid\']); - $id = $parts[0]; - $request->set_param(\'byid\',$id); - - global $db; - $Post =& $db->model(\'Post\'); - - $Post->has_one(\'like\'); - - $Post->set_order(\'desc\'); - global $prefix; - $Post->set_param(\'query\',\' - SELECT - \'.$prefix.\'posts.title as "\'.$prefix.\'posts.title", - \'.$prefix.\'posts.body as "\'.$prefix.\'posts.body", - \'.$prefix.\'posts.summary as "\'.$prefix.\'posts.summary", - \'.$prefix.\'posts.contributor as "\'.$prefix.\'posts.contributor", - \'.$prefix.\'posts.rights as "\'.$prefix.\'posts.rights", - \'.$prefix.\'posts.source as "\'.$prefix.\'posts.source", - \'.$prefix.\'posts.uri as "\'.$prefix.\'posts.uri", - \'.$prefix.\'posts.url as "\'.$prefix.\'posts.url", - \'.$prefix.\'posts.attachment as "\'.$prefix.\'posts.attachment", - \'.$prefix.\'posts.parent_id as "\'.$prefix.\'posts.parent_id", - \'.$prefix.\'posts.profile_id as "\'.$prefix.\'posts.profile_id", - \'.$prefix.\'posts.recipient_id as "\'.$prefix.\'posts.recipient_id", - \'.$prefix.\'posts.local as "\'.$prefix.\'posts.local", - \'.$prefix.\'posts.created as "\'.$prefix.\'posts.created", - \'.$prefix.\'posts.modified as "\'.$prefix.\'posts.modified", - \'.$prefix.\'posts.entry_id as "\'.$prefix.\'posts.entry_id", - \'.$prefix.\'posts.id as "\'.$prefix.\'posts.id", - \'.$prefix.\'entries.resource as "\'.$prefix.\'entries.resource", - \'.$prefix.\'entries.record_id as "\'.$prefix.\'entries.record_id", - \'.$prefix.\'entries.etag as "\'.$prefix.\'entries.etag", - \'.$prefix.\'entries.content_type as "\'.$prefix.\'entries.content_type", - \'.$prefix.\'entries.expires as "\'.$prefix.\'entries.expires", - \'.$prefix.\'entries.last_modified as "\'.$prefix.\'entries.last_modified", - \'.$prefix.\'entries.issued as "\'.$prefix.\'entries.issued", - \'.$prefix.\'entries.person_id as "\'.$prefix.\'entries.person_id", - \'.$prefix.\'entries.id as "\'.$prefix.\'entries.id", - \'.$prefix.\'likes.fb_post_id as "\'.$prefix.\'likes.fb_post_id", - \'.$prefix.\'likes.tw_post_id as "\'.$prefix.\'likes.tw_post_id", - \'.$prefix.\'likes.bz_post_id as "\'.$prefix.\'likes.bz_post_id", - \'.$prefix.\'likes.post_id as "\'.$prefix.\'likes.post_id", - \'.$prefix.\'likes.entry_id as "\'.$prefix.\'likes.entry_id", - \'.$prefix.\'likes.id as "\'.$prefix.\'likes.id" - FROM ((\'.$prefix.\'posts left join \'.$prefix.\'entries on \'.$prefix.\'posts.entry_id = \'.$prefix.\'entries.id) left join \'.$prefix.\'likes on \'.$prefix.\'posts.id = \'.$prefix.\'likes.post_id) WHERE \'.$prefix.\'posts.parent_id > \\\'0\\\' ORDER BY \'.$prefix.\'posts.id desc LIMIT 0,10\'); - - - - $tweets = new Collection( \'posts\' ); - - $pro = get_profile($id); - - header( \'Content-Type: application/rss+xml\' ); - - render_rss_feed($pro,$tweets); - - exit; - - '); - - $m->set_value( 'function', 'api_statuses_all_likes' ); - $m->set_value( 'route', 'api/statuses/all_likes' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - $m = $this->base(); - $m->set_value( 'code', ' - - extract( $vars ); - - - if (isset($request->client_wants)){ - if ($request->client_wants == \'json\') { - - - - $nick = substr( $request->params[\'nickname\'], 0, -5 ); - $Identity =& $db->model( \'Identity\' ); - $Identity->set_order(\'asc\'); - $Identity->set_limit(1); - $Identity->set_param(\'find_by\',array( - \'nickname\' => $nick, - \'eq\'=>\'IS\', - \'post_notice\' => \'NULL\', - )); - - $Post =& $db->model( \'Post\' ); - $Post->set_param( \'find_by\', array( - \'entries.person_id\' => $profile->person_id - )); - - $Post->find(); - $tweets = array(); - while ($p = $Post->MoveNext()) { - $tweet = array(); - $tweet[\'text\'] = $p->title; - $tweet[\'truncated\'] = \'false\'; - $tweet[\'created_at\'] = date( "D M d G:i:s O Y", strtotime( $p->created )); - $tweet[\'in_reply_to_status_id\'] = null; - $tweet[\'source\'] = null; - $tweet[\'id\'] = intval( $p->id ); - $tweet[\'favorited\'] =\'false\'; - $tweet[\'user\'] = $nick; - $tweets[] = $tweet; - } - - echo "twitterCallback2("; - - $json = new Services_JSON(); - - echo $json->encode( $tweets ); - - echo \');\'; - - - - - - exit; - } - - - } - - - - $parts = split(\'\.\',$request->params[\'byid\']); - $id = $parts[0]; - $request->set_param(\'byid\',$id); - - global $db; - $Post =& $db->model(\'Post\'); - - $Post->has_one(\'like\'); - - $Post->set_order(\'desc\'); - global $prefix; - $Post->set_param(\'query\',\' - SELECT - \'.$prefix.\'posts.title as "\'.$prefix.\'posts.title", - \'.$prefix.\'posts.body as "\'.$prefix.\'posts.body", - \'.$prefix.\'posts.summary as "\'.$prefix.\'posts.summary", - \'.$prefix.\'posts.contributor as "\'.$prefix.\'posts.contributor", - \'.$prefix.\'posts.rights as "\'.$prefix.\'posts.rights", - \'.$prefix.\'posts.source as "\'.$prefix.\'posts.source", - \'.$prefix.\'posts.uri as "\'.$prefix.\'posts.uri", - \'.$prefix.\'posts.url as "\'.$prefix.\'posts.url", - \'.$prefix.\'posts.attachment as "\'.$prefix.\'posts.attachment", - \'.$prefix.\'posts.parent_id as "\'.$prefix.\'posts.parent_id", - \'.$prefix.\'posts.profile_id as "\'.$prefix.\'posts.profile_id", - \'.$prefix.\'posts.recipient_id as "\'.$prefix.\'posts.recipient_id", - \'.$prefix.\'posts.local as "\'.$prefix.\'posts.local", - \'.$prefix.\'posts.created as "\'.$prefix.\'posts.created", - \'.$prefix.\'posts.modified as "\'.$prefix.\'posts.modified", - \'.$prefix.\'posts.entry_id as "\'.$prefix.\'posts.entry_id", - \'.$prefix.\'posts.id as "\'.$prefix.\'posts.id", - \'.$prefix.\'entries.resource as "\'.$prefix.\'entries.resource", - \'.$prefix.\'entries.record_id as "\'.$prefix.\'entries.record_id", - \'.$prefix.\'entries.etag as "\'.$prefix.\'entries.etag", - \'.$prefix.\'entries.content_type as "\'.$prefix.\'entries.content_type", - \'.$prefix.\'entries.expires as "\'.$prefix.\'entries.expires", - \'.$prefix.\'entries.last_modified as "\'.$prefix.\'entries.last_modified", - \'.$prefix.\'entries.issued as "\'.$prefix.\'entries.issued", - \'.$prefix.\'entries.person_id as "\'.$prefix.\'entries.person_id", - \'.$prefix.\'entries.id as "\'.$prefix.\'entries.id", - \'.$prefix.\'likes.fb_post_id as "\'.$prefix.\'likes.fb_post_id", - \'.$prefix.\'likes.tw_post_id as "\'.$prefix.\'likes.tw_post_id", - \'.$prefix.\'likes.bz_post_id as "\'.$prefix.\'likes.bz_post_id", - \'.$prefix.\'likes.post_id as "\'.$prefix.\'likes.post_id", - \'.$prefix.\'likes.entry_id as "\'.$prefix.\'likes.entry_id", - \'.$prefix.\'likes.id as "\'.$prefix.\'likes.id" - FROM ((\'.$prefix.\'posts left join \'.$prefix.\'entries on \'.$prefix.\'posts.entry_id = \'.$prefix.\'entries.id) left join \'.$prefix.\'likes on \'.$prefix.\'posts.id = \'.$prefix.\'likes.post_id) WHERE \'.$prefix.\'posts.profile_id = \\\'\'.$id.\'\\\' AND \'.$prefix.\'posts.parent_id > \\\'0\\\' ORDER BY \'.$prefix.\'posts.id desc LIMIT 0,10\'); - - - - $tweets = new Collection( \'posts\' ); - - $pro = get_profile($id); - - header( \'Content-Type: application/rss+xml\' ); - - render_rss_feed($pro,$tweets); - - exit; - - '); - - $m->set_value( 'function', 'api_statuses_user_likes' ); - $m->set_value( 'route', 'api/statuses/user_likes/:byid' ); - $m->set_value( 'resource', 'posts' ); - $m->set_value( 'permission', 'read' ); - $m->set_value( 'enabled', true ); - $m->set_value( 'omb', 1 ); - $m->set_value( 'oauth', 1 ); - $m->set_value( 'http', 1 ); - - if (!(in_array($m->attributes['function'],$methods))){ - $m->save_changes(); - $m->set_etag(1); - } - - - } - -} - diff --git a/app/omb/models/Page.php b/app/omb/models/Page.php deleted file mode 100755 index 016f3e2..0000000 --- a/app/omb/models/Page.php +++ /dev/null @@ -1,65 +0,0 @@ -char_field( 'title' ); - - $this->text_field( 'body' ); - - $this->text_field( 'summary' ); - - $this->text_field( 'contributor' ); - $this->text_field( 'rights' ); - $this->text_field( 'source' ); - - $this->char_field( 'uri' ); - $this->char_field( 'url' ); - - $this->file_field( 'attachment' ); - - $this->int_field( 'parent_id' ); - $this->int_field( 'profile_id' ); - $this->int_field( 'recipient_id' ); - - $this->bool_field( 'local' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - // each record in posts HAS ONE record in entries - - $this->has_one( 'entry' ); - - //$this->has_many( 'comments' ); - - //$this->has_many( 'reviews' ); - - $this->set_limit(10); - - // permissions - - $this->let_read( 'all:everyone' ); - - $this->let_access( 'all:administrators' ); - - $this->use_templates_from( 'posts' ); - - } - -} - - diff --git a/app/omb/models/Person.php b/app/omb/models/Person.php deleted file mode 100755 index 4571df7..0000000 --- a/app/omb/models/Person.php +++ /dev/null @@ -1,27 +0,0 @@ -time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_many( 'identities' ); - $this->has_many( 'memberships' ); - - // permissions - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Post.php b/app/omb/models/Post.php deleted file mode 100755 index 794ba1f..0000000 --- a/app/omb/models/Post.php +++ /dev/null @@ -1,66 +0,0 @@ -char_field( 'title', array('len'=>TWEET_SIZE) ); - else - $this->char_field( 'title' ); - - $this->text_field( 'body' ); - - $this->text_field( 'summary' ); - - $this->text_field( 'contributor' ); - $this->text_field( 'rights' ); - $this->text_field( 'source' ); - - $this->char_field( 'uri' ); - $this->char_field( 'url' ); - - $this->file_field( 'attachment' ); - - $this->int_field( 'parent_id' ); - $this->int_field( 'profile_id' ); - $this->int_field( 'recipient_id' ); - - $this->bool_field( 'local' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - // each record in posts HAS ONE record in entries - - $this->has_one( 'entry' ); - - //$this->has_many( 'comments' ); - - //$this->has_many( 'reviews' ); - - $this->set_limit(10); - - // permissions - - $this->let_read( 'all:everyone' ); - - $this->let_create( 'all:members' ); - $this->let_write( 'all:members' ); - $this->let_delete( 'all:members' ); - - $this->let_access( 'all:administrators' ); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Review.php b/app/omb/models/Review.php deleted file mode 100755 index 1a2596c..0000000 --- a/app/omb/models/Review.php +++ /dev/null @@ -1,58 +0,0 @@ -char_field( 'version' ); - $this->char_field( 'summary' ); - - $this->char_field( 'item_type' ); - - // item_type valuse -- product/business/event/person/place/website/url - - $this->char_field( 'item_info' ); - - // item_info values -- fn_url/fn_photo/hCard/hCalendar - - $this->int_field( 'profile_id' ); - - $this->char_field( 'reviewer' ); - $this->char_field( 'dtreviewed' ); - - $this->int_field( 'rating' ); - - $this->text_field( 'description' ); - - $this->char_field( 'tags' ); - $this->char_field( 'permalink' ); - $this->char_field( 'license' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'target_id' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - - // permissions - - $this->let_read( 'all:everyone' ); - $this->let_create( 'all:members' ); - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Revision.php b/app/omb/models/Revision.php deleted file mode 100644 index 4214d0f..0000000 --- a/app/omb/models/Revision.php +++ /dev/null @@ -1,28 +0,0 @@ -text_field( 'data' ); - - $this->time_field( 'created' ); - - $this->time_field( 'modified' ); - - $this->int_field( 'target_id' ); - - $this->int_field( 'profile_id' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - $this->has_one( 'entry' ); - - $this->set_limit(10); - - } - -} - diff --git a/app/omb/models/Setting.php b/app/omb/models/Setting.php deleted file mode 100755 index f86d7c7..0000000 --- a/app/omb/models/Setting.php +++ /dev/null @@ -1,35 +0,0 @@ -set_limit(5000); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->char_field( 'name' ); - $this->text_field( 'value' ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'person_id' ); - $this->int_field( 'profile_id' ); - - $this->auto_field( 'id' ); - - $this->has_one( 'entry' ); - - $this->let_create( 'all:members' ); - $this->let_modify( 'all:members' ); - $this->let_delete( 'all:members' ); - - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Subscription.php b/app/omb/models/Subscription.php deleted file mode 100755 index d90f49c..0000000 --- a/app/omb/models/Subscription.php +++ /dev/null @@ -1,41 +0,0 @@ -time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'subscriber' ); - $this->int_field( 'subscribed' ); - - $this->char_field( 'token' ); - $this->char_field( 'secret' ); - - $this->int_field( 'entry_id' ); - $this->int_field( 'person_id' ); - - $this->auto_field( 'id' ); - - $this->bool_field( 'sms' ); - $this->bool_field( 'email' ); - $this->bool_field( 'omb' ); - $this->bool_field( 'twitter' ); - - $this->has_one( 'entry' ); - $this->has_one( 'person' ); - - $this->let_read( 'all:always' ); - $this->let_modify( 'all:members' ); - $this->let_delete( 'all:members' ); - - $this->set_limit(100); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Thumbnail.php b/app/omb/models/Thumbnail.php deleted file mode 100644 index 372e9a3..0000000 --- a/app/omb/models/Thumbnail.php +++ /dev/null @@ -1,35 +0,0 @@ -file_field( 'attachment' ); - - $this->time_field( 'created' ); - $this->time_field( 'modified' ); - - $this->int_field( 'target_id' ); - - $this->int_field( 'entry_id' ); - - $this->auto_field( 'id' ); - - // relationships - - $this->has_one( 'entry' ); - - // permissions - - $this->let_read( 'all:everyone' ); - $this->let_access( 'all:administrators' ); - - $this->set_hidden(); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/models/Upload.php b/app/omb/models/Upload.php deleted file mode 100755 index f0d5af5..0000000 --- a/app/omb/models/Upload.php +++ /dev/null @@ -1,29 +0,0 @@ -char_field( 'name' ); - - $this->char_field( 'tmp_name' ); - - $this->auto_field( 'id' ); - - $this->file_field( 'attachment' ); - - $this->int_field( 'parent_id' ); - - $this->int_field( 'profile_id' ); - - $this->char_field( 'title' ); - - $this->int_field( 'target_id' ); - - $this->int_field( 'entry_id' ); - - } - -} - -?> \ No newline at end of file diff --git a/app/omb/plugins/buzz.php b/app/omb/plugins/buzz.php deleted file mode 100644 index 776fdb7..0000000 --- a/app/omb/plugins/buzz.php +++ /dev/null @@ -1,56 +0,0 @@ -table == 'posts')) - return; - if (!get_profile_id()) - return; - if (!(isset($rec->title)) || !(isset($rec->uri))) - return; - if ($rec->parent_id > 0) - return; -// if ((get_option('buzz_status') != 'enabled') && -// (!isset($_POST['buzz_it']))) -// return; - -global $db,$prefix,$request; -$sql = "SELECT value FROM settings WHERE profile_id = '".get_profile_id()."' AND name = 'google_key'"; -$result = $db->get_result( $sql ); -$gkey = $db->result_value( $result, 0, "value" ); -$sql = "SELECT value FROM settings WHERE profile_id = '".get_profile_id()."' AND name = 'google_secret'"; -$result = $db->get_result( $sql ); -$gsec = $db->result_value( $result, 0, "value" ); - -if (!$result) - return; - db_include('helper'); - db_include('buzz'); - if (!class_exists('TwitterOAuth')); - lib_include('twitteroauth'); - $callback = $request->url_for('authsub'); - $b = new buzz( - environment( 'googleKey' ), - environment( 'googleSecret' ), - $callback - ); -// $b->authorize_from_access( $_SESSION['atoken'], $_SESSION['asecret'] ); - $b->authorize_from_access( $gkey, $gsec ); - $result = $b->update( $rec->title ); - - if (!class_exists('Services_JSON')); - lib_include('json'); - $json = new Services_JSON(); - $data = (array)$json->decode($result); - $bzid = $data['data']->id; - $Like =& $db->model('Like'); - $l = $Like->find_by(array('post_id'=>$rec->id)); - if (!$l->exists){ - $l = $Like->base(); - $l->set_value('post_id',$rec->id); - } - $l->set_value('bz_post_id',$bzid); - $l->save_changes(); -} - diff --git a/app/omb/plugins/email_group.php b/app/omb/plugins/email_group.php deleted file mode 100755 index 6605a1a..0000000 --- a/app/omb/plugins/email_group.php +++ /dev/null @@ -1,139 +0,0 @@ -resource == 'groups')) - return; - - // get data modesl for 3 tables - $Entry =& $db->get_table( 'entries' ); - $Group =& $db->get_table( 'groups' ); - $Person =& $db->get_table( 'people' ); - - // load the first 20 records from the groups table - $Group->find(); - - // keep a list of people we have notified - $sent_to = array(); - - // get the name of the table from the data model reference we received - $notify_table = $model->table; - - // get the primary key value of the record reference we received - $notify_id = $rec->id; - - // if the table that was modified is a metadata table (comments, reviews) - // notify about the "target" table being modified - if (array_key_exists( 'target_id', $model->field_array )) { - $e = $Entry->find($rec->attributes['target_id']); - if ($e) { - $notify_table = $e->resource; - $notify_id = $e->record_id; - } - } - - // get the data model we are notifying about - $datamodel =& $db->get_table($notify_table); - - // get the profile data for the current user - $profile = owner_of($rec); - - // loop over each group - while ($g = $Group->MoveNext()) { - if (in_array($g->name,array('administrators','everyone','members'))) continue; - - // if the GROUP has READ or CREATE then do notify its members - if ($rec->id && (in_array($g->name,$datamodel->access_list['read']['id']) || - in_array($g->name,$datamodel->access_list['create'][$notify_table]))) { - - // loop over each member in the group - while ( $m = $g->NextChild( 'memberships' ) ) { - - // get a person activerecord object for the member's person_id - $p = $Person->find( $m->person_id ); - - if ($p) { - - $action = $request->action; - - $notify = "notify_".$action; - - // get an identities activerecord object for the person's first identity - // this is an example of traversing the result dataset without re-querying - $i = $p->FirstChild( 'identities' ); - - // if we haven't already sent this person a message - if (isset($m->$notify) && ($m->$notify) && is_email($i->email_value) && !(in_array($i->email_value, $sent_to))) { - - // a token may be set to allow the notify-ee to "EXPRESS" register as a new site user - // it fills in some of the "new user" form info such as e-mail address for them - if (isset($i->token) && strlen($i->token) > 0) - $addr = $request->url_for(array('resource'=>$notify_table,'id'=>$notify_id,'ident'=>$i->token)); - else - $addr = $request->url_for(array('resource'=>$notify_table,'id'=>$notify_id)); - - // this is the HTML content of the e-mail - $html = ' - - - -
- Click on this link:
-
- '.$addr.' - - '; - - // oh wait, we are not going to send the HTML it is just wasting space for now - // comment this out to try the HTML yourself - $html = false; - - // this is the body of the e-mail if ($html == false) - $text = 'Content was updated at the following location:'."\r\n\r\n".$addr."\r\n\r\n"; - - // change the e-mail subject line depending on what action took place - if ($action == 'post') - $actionmessage = " created a new "; - elseif ($action == 'put') - $actionmessage = " updated a "; - elseif ($action == 'delete') - $actionmessage = " deleted a "; - - // set the e-mail subject to the current user's first name - // classify() converts a table name "nerds" to "Nerd" - // the converse is tableize() - $subject = $profile->given_name.$actionmessage.classify($request->resource); - - // this sends e-mail using the xpertmailer package - // the environment() function reads a value from the config.yml file - send_email( $i->email_value, $subject, $text, environment('email_from'), environment('email_name'), $html ); - - // add a new entry to the list of successful (more like woeful) recipients - $sent_to[] = $i->email_value; - - } - - } - - } - - } - - } - -} - - - -?> \ No newline at end of file diff --git a/app/omb/plugins/email_notice.php b/app/omb/plugins/email_notice.php deleted file mode 100755 index 8a6b5af..0000000 --- a/app/omb/plugins/email_notice.php +++ /dev/null @@ -1,49 +0,0 @@ -title))) - return; - if (!($rec->table == 'posts')) - return; - global $request, $db; - - $i = owner_of($rec); - - $sent_to = array(); - - $Subscription = $db->model('Subscription'); - - $Subscription->has_one( 'subscriber:identity' ); - - $where = array( - 'subscriptions.subscribed'=>$i->id, - ); - - $Subscription->set_param( 'find_by', $where ); - - $Subscription->find(); - - while ($sub = $Subscription->MoveNext()) { - - $sid = $sub->FirstChild('identities'); - - if (!in_array($sid->id,$sent_to) && $sub->email) { - - $html = false; - // this is the body of the e-mail if ($html == false) - $text = $rec->title; - - $subject = $i->nickname . " posted a notice"; - - send_email( $sid->email_value, $subject, $text, environment('email_from'), environment('email_name'), $html ); - - $sent_to[] = $sid->id; - - } - } -} - -?> \ No newline at end of file diff --git a/app/omb/plugins/omb.php b/app/omb/plugins/omb.php deleted file mode 100755 index 9ddd564..0000000 --- a/app/omb/plugins/omb.php +++ /dev/null @@ -1,1836 +0,0 @@ -connect('pushpress'); - -function pushpress(){ - - require_once 'wp-content/plugins/pushpress/class-pushpress.php'; - - if ( !defined( 'PUSHPRESS_VERSION' ) ) - define( 'PUSHPRESS_VERSION', '0.1.6' ); - - if ( !defined( 'PUSHPRESS_CLASS' ) ) - define( 'PUSHPRESS_CLASS', 'PuSHPress' ); - - $pushpress_class = PUSHPRESS_CLASS; - $pushpress = new $pushpress_class( ); - - - $pushpress->hub_request( ); - -} - - -$omb_routes = array( - 'local_subscribe', - 'local_unsubscribe', - 'oauth_omb_post', - 'oauth_omb_update', - 'oauth_omb_subscribe', - 'oauth_omb_finish_subscribe', - 'access_token', - 'request_token', - 'oauth_authorize', - 'mobile_settings', - 'mobile_event', - 'migrate', - 'smtp_event', - 'flickr_login', - 'login_callback' -); - - -foreach ($omb_routes as $func) - $request->connect( $func ); - -$request->connect( 'status', array( - 'resource'=>'posts', - 'action'=>'index' -)); - - -$request->connect( - 'email/:ident', - array( - 'requirements' => array ( '[A-Za-z0-9]+' ) - ) -); - -$request->connect( 'groups', array( - 'resource'=>'groups' -)); - -$request->connect( 'oembed', array( - 'resource'=>'posts', - 'action'=>'oembed' -)); - -$request->connect( - ':nickname', - array( - 'resource'=>'identities', - 'action'=>'entry', - 'requirements' => array ( '[A-Za-z0-9_.]+' ) - ) -); - -$request->connect( - ':nickname/replies', - array( - 'resource'=>'posts', - 'action'=>'replies', - 'requirements' => array ( '[A-Za-z0-9_.]+' ) - ) -); - -$request->connect( - ':nickname/settings', - array( - 'resource'=>'identities', - 'action'=>'entry', - 'requirements' => array ( '[A-Za-z0-9_.]+' ) - ) -); - -$request->connect( - ':nickname/subscriptions', - array( - 'resource'=>'subscriptions', - 'action'=>'following', - 'requirements' => array ( '[A-Za-z0-9_.]+' ) - ) -); - -$request->connect( - ':nickname/subscribers', - array( - 'resource'=>'subscriptions', - 'action'=>'followers', - 'requirements' => array ( '[A-Za-z0-9_.]+' ) - ) -); - - -$request->connect( - ':nickname/subscriptions/:followingpage', - array( - 'resource'=>'subscriptions', - 'action'=>'following', - 'requirements' => array ( '[A-Za-z0-9_.]+','[0-9]+' ) - ) -); - -$request->connect( - ':nickname/subscribers/:followerspage', - array( - 'resource'=>'subscriptions', - 'action'=>'followers', - 'requirements' => array ( '[A-Za-z0-9_.]+','[0-9]+' ) - ) -); - - -$request->connect( - ':resource/by/:byid/:page', - array( - 'requirements' => array ( '[A-Za-z0-9_.]+', '[0-9]+', '[0-9]+' ) - ) -); - - -$request->connect( - ':resource/for/:forid/:page', - array( - 'requirements' => array ( '[A-Za-z0-9_.]+', '[0-9]+', '[0-9]+' ) - ) -); - - -before_filter( 'omb_filter_posts', 'get_query' ); - -// this sucks this should be in /controllers/posts.php - -function omb_filter_posts( &$model, &$db ) { - global $request; - if (is_array($model->find_by)) - return; - if ($model->table != 'posts') - return; - if (isset($_POST['s']) && !empty($_POST['s'])) { - $model->set_limit(1000); - $_SESSION['searchterm'] = $_POST['s']; - $term = trim($db->escape_string($_POST['s'])); - $term = '%'.$term.'%'; - $where = array( - 'eq'=>'like', - 'title'=>$term, - 'op'=>'OR', - 'body'=>$term - ); - $model->set_param( 'find_by', $where ); - } elseif (isset($request->params['nickname']) && isset($request->params['byid']) && $request->resource == 'posts' && $model->table == 'posts'){ - $where = array( - 'profile_id'=>$request->params['byid'], - 'parent_id'=>0 - ); - if ($request->action == 'replies') - $where = array( - 'eq'=>'like', - 'title'=>'%@'.$request->params['nickname'].'%' - ); - - $model->set_param( 'find_by', $where ); - } elseif (isset($request->params['forid']) && $request->resource == 'posts' && $model->table == 'posts'){ - $model->has_many( 'profile_id:subscriptions.subscribed' ); - $model->set_groupby( 'id' ); - $where = array( - 'op'=>'OR', - 'profile_id'=>$request->params['forid'], - 'subscriptions.subscriber'=>$request->params['forid'] - ); - $model->set_param( 'find_by', $where ); - } elseif (isset($request->params['byid']) && $request->resource == 'posts' && $model->table == 'posts'){ - $where = array( - 'profile_id'=>$request->params['byid'], - 'parent_id'=>0 - ); - $model->set_param( 'find_by', $where ); - } elseif (environment('threaded') && in_array($request->action, array('index','get')) && $model->table == 'posts' && $request->resource == 'posts' && $request->id == 0) { - $where = array( - 'parent_id'=>0 - ); - $model->set_param( 'find_by', $where ); - } elseif ($request->action == 'index' && $model->table == 'posts' && $request->resource == 'posts' && $request->id == 0) { - $where = array( - 'local'=>1 - ); - //$model->set_param( 'find_by', $where ); - } -} - - -// normally a token/invite is for a private resource, -// which get redirected to _email template -// this is a hook to catch tokens in public resource URIs - -before_filter('catch_invite_token','get'); - -function catch_invite_token(&$request,&$route) { - if (isset($request->params['ident'])) { - render( 'action', 'email' ); - exit; - } -} - - -// fix this so it happens AFTER all filters XXX - -// this is a filter to redirect to the post that was replied to - -//after_filter( 'forward_after_reply', 'insert_from_post' ); - -//function forward_after_reply( &$model, &$rec ) { - -// global $request,$db; - -// if (!($model->table == 'posts')) -// return; - -// if (isset($request->params['post']['parent_id'])) -// redirect_to(array('resource'=>'posts','id'=>$request->params['post']['parent_id'])); - -//} - - -// this is a filter to redirect to the reviewed resource - -after_filter( 'forward_after_review', 'insert_from_post' ); - -function forward_after_review( &$model, &$rec ) { - - global $db; - - if (!($model->table == 'reviews')) - return; - - $Entry =& $db->model('Entry'); - - $e = $Entry->find($rec->target_id); - - if ($e) - redirect_to(array('resource'=>$e->resource,'id'=>$e->record_id)); - else - trigger_error('Sorry, I was not able to save the review.', E_USER_ERROR ); - -} - - -// this is a filter to handle posts from the prologue theme - -before_filter( 'wp_set_post_fields', 'insert_from_post' ); - -function wp_set_post_fields( &$model, &$rec ) { - global $db,$request; - - if (isset($_POST['postfile'])) { - $Upload =& $db->model('Upload'); - $u = $Upload->find_by('name',urldecode($_POST['postfile'])); - if ($u) { - $_FILES = array( - 'post' => array( - 'name' => array( 'attachment' => $u->name ), - 'tmp_name' => array( 'attachment' => $u->tmp_name ) - )); - $db->delete_record( $u ); - } - } - - if ( !(isset($_POST['posttext'])) || !(isset($_POST['tags'])) ) - return; - - $tinyurl = ''; - - if (isset( $_POST['link']['href'] )) { - $href = trim($_POST['link']['href']); - - $result = false; - if (!empty($href)) { - - if (strpos($href, 'http') === false) - $href = 'http://'.$href; - - if (strpos($href, 'tinyurl') === false) { - - $tinyapi = 'http://tinyurl.com/api-create.php?url=' . $href; - //$ch = curl_init($tinyapi); - //$result = curl_exec($ch); - //curl_close($ch); - - //$tinyUrl = @file($tinyapi); - //if (isset($tinyUrl[0])) - // $result = $tinyUrl[0]; - - $curl = curl_init( $tinyapi ); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec( $curl ); - curl_close( $curl ); - - if ($result) - $tinyurl = ' '.trim($result); - - //$tinyHook = @fopen('http://tinyurl.com/api-create.php?url=$yourUrl,'r'); - //if ($tinyHook) { - // $tinyurl = fread($tinyHook, 1024); - // fclose($tinyHook); - //} - - } else { - - $tinyurl = $href; - - } - - } - } - - if ( isset( $_POST['posttext'] )) - $request->set_param( array( 'post', 'title' ), $_POST['posttext'].$tinyurl ); - - if ( isset( $_POST['profile_id'] )) - $request->set_param( array( 'post', 'profile_id' ), $_POST['profile_id'] ); - - $request->set_param( array( 'post', 'parent_id' ), 0 ); - - $Category =& $db->model('Category'); - $Category->set_limit(100); - $Category->find(); - - include 'wp-content/language/lang_chooser.php'; //Loads the language-file - - $t1 = html_entity_decode($txt['postform_tagit']); - $t2 = html_entity_decode($_POST['tags']); - - if (ereg_replace("[^A-Za-z0-9]","",$t1) == ereg_replace("[^A-Za-z0-9]","",$t2)) - return; - - if (strstr( $_POST['tags'], "," )) - $tags = split( ',', $_POST['tags'] ); - else - $tags = split( ' ', $_POST['tags'] ); - - $cats = array(); - - while ( $c = $Category->MoveNext() ) - $cats[strtolower($c->name)] = $c->id; - - $newcount = count($cats); - - foreach ( $tags as $t ) { - $t = trim($t); - $tl = strtolower( $t ); - if (array_key_exists( $tl, $cats )) { - $request->set_param( "category".$cats[$tl], $tl ); - } else { - $request->set_param( "category".$newcount, $t ); - $newcount++; - } - } - -} - - -after_filter( 'wp_set_post_fields_after', 'insert_from_post' ); - -function wp_set_post_fields_after( &$model, &$rec ) { - global $request; - if ($request->action == 'oauth_omb_post') - return; - if ($model->table == 'posts') { - $rec->set_value( 'uri', $request->url_for( array( - 'resource'=>'__'.$rec->id, - ))); - $rec->set_value( 'url', $request->url_for(array('resource'=>'posts','id'=>$rec->id))); - if (isset($_POST['parent_id']) && is_numeric($_POST['parent_id']) && is_ajax()) { - $rec->set_value( 'parent_id',$_POST['parent_id']); - $rec->set_value( 'local',1); - } else { - if (!$rec->attributes['parent_id']) - $rec->set_value( 'parent_id',0); - if (!$rec->attributes['local']) - $rec->set_value( 'local',0); - } - $rec->save_changes(); - } -} - - -after_filter('do_ajaxy_fileupload','routematch'); - -function do_ajaxy_fileupload(&$request,&$route) { - - global $db; - - if (!isset($_FILES['Filedata']['name'])) - return; - - if (!is_writable('cache')) - exit; - - $result = $db->get_result("DELETE FROM ".$db->prefix."uploads WHERE name = '".$db->escape_string(urldecode($_FILES['Filedata']['name']))."'"); - $tmp = 'cache'.DIRECTORY_SEPARATOR.make_token(); - $tmp .= ".". extension_for(type_of($_FILES['Filedata']['name'])); - - $Upload =& $db->model('Upload'); - $u = $Upload->base(); - $u->set_value('name', urldecode($_FILES['Filedata']['name'])); - $u->set_value('tmp_name', $tmp); - $u->save_changes(); - - move_uploaded_file($_FILES['Filedata']['tmp_name'], $tmp); - echo "200 OK"; - exit; - -} - - -after_filter('set_identity_from_nick','routematch'); - -function set_identity_from_nick(&$request,&$route) { - -global $db; - - if (!(isset($request->params['nickname']))) - return; - - $nick = $db->escape_string(urldecode($request->params['nickname'])); - $nick = split( '\.', $nick ); - if (is_array($nick)) { - if (isset($nick[1])) - $request->set('client_wants',$nick[1]); - $nick = trim($nick[0]); - } else { - $nick = trim($nick); - } - - if (isset($db->tables[$nick])) { - $request->set_param('resource',$nick); - if (!(isset($_POST['method']))) - $request->set_param('action','index'); - return; - } - - if ($db->has_table($nick)) { - $request->set_param('resource',$nick); - if (!$request->id && $request->action == 'entry') - $request->set_param('action','index'); - return; - } - - if ($request->route_exists($request->params['nickname'])) - return; - - - if (substr($nick,0,2) == '__') { - $request->set_param('id',substr($nick,2)); - $request->set_param('resource','posts'); - $request->set_param('action','entry'); - return; - } - - $Identity =& $db->model('Identity'); - - $id = false; - - if (substr($nick,0,1) == '_') { - $Member = $Identity->find(substr($nick,1)); - $id = $Member->id; - } else { - $sql = "SELECT id FROM ".$db->prefix."identities WHERE nickname LIKE '".$db->escape_string($nick)."' AND (post_notice = '' OR post_notice IS NULL)"; - $result = $db->get_result( $sql ); - if ($db->num_rows($result) == 1) - $id = $db->result_value($result,0,"id"); - } - - if (!$id) { - // check for the nickname in a previous identity - $Revision =& $db->model('Revision'); - $Revision->set_limit(1000); - $Revision->unset_relation('entries'); - $Revision->has_one('target_id:entries.id'); - $where = array( - 'entries.resource'=>'identities' - ); - $Revision->set_param( 'find_by', $where ); - $Revision->find(); - while ($r = $Revision->MoveNext()) { - $i = mb_unserialize($r->data); - if (is_object($i) && $nick == $i->nickname) - $id = $i->id; - } - } - - if (substr($nick,0,1) == '_' && $id) { - $request->set_param('resource','identities'); - $request->set_param('id',$id); - } elseif ($id) { - if (empty($request->client_wants)) { - if (count($request->activeroute->patterns) == 1 ) { - $request->set_param('resource','posts'); - if ($request->action == 'entry') - $request->set_param('action','index'); - $request->set_param('byid',$id); - } elseif ($request->resource == 'identities') { - $request->set_param('id',$id); - } else { - $request->set_param('byid',$id); - } - if (!(isset($request->page))) - $request->set_param('page',1); - } else { - $request->set_param('id',$id); - } - } else { - - // the nickname did not match a local user - - // check for the nickname at twitter.com - $url = "http://twitter.com/".$nick; - require_once(ABSPATH.WPINC.'/class-snoopy.php'); - $snoop = new Snoopy; - $snoop->agent = 'OpenMicroBlogger http://openmicroblogger.org'; - $snoop->submit($url); - if (strpos($snoop->response_code, '200')) { - redirect_to($url); - } else { - trigger_error('sorry the nickname was not found on this site, nor at Twitter.com', E_USER_ERROR ); - } - - } - -} - - -before_filter( 'omb_request_munger', 'routematch' ); - -function omb_request_munger( &$request, &$route ) { - - global $omb_routes; - - // look for a dbscript omb Route in the POST/GET params - $params = array_merge($_GET,$_POST); - foreach($omb_routes as $func) { - if (array_key_exists($func,$params)) { - // if found, lie to the mapper about the URI - if (pretty_urls()) - $request->set('uri',$request->base."".$func); - else - $request->set('uri',$request->base."?".$func); - $request->set('params', array($func)); - } - } -} - - -global $omb_services; - -$omb_services = array( - 'http://oauth.net/discovery/1.0', - OMB_VERSION, - OAUTH_VERSION . '/endpoint/request', - OAUTH_VERSION . '/endpoint/authorize', - OAUTH_VERSION . '/endpoint/access', - OMB_VERSION . '/postNotice', - OMB_VERSION . '/updateProfile' -); - - -function get_remote_xrds($at_url) { - global $request; - $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled"; - $path = plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . 'wp-openid' . DIRECTORY_SEPARATOR; - add_include_path( $path ); - require_once "Auth/Yadis/Yadis.php"; - - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - $yadis = Auth_Yadis_Yadis::discover($at_url, $fetcher); - - if (!$yadis || $yadis->failed) - trigger_error("Sorry but the Yadis doc was not found at the profile URL", E_USER_ERROR); - - $xrds =& Auth_Yadis_XRDS::parseXRDS($yadis->response_text); - - if (!$xrds) - trigger_error("Sorry but the XRDS data was not found in the Yadis doc", E_USER_ERROR); - - $yadis_services = $xrds->services(array('filter_MatchesAnyOMBType')); - - foreach ($yadis_services as $service) { - $type_uris = $service->getTypes(); - $uris = $service->getURIs(); - if ($type_uris && $uris) { - foreach ($uris as $uri) { - $xrd = xrdends($uri,$xrds); - $ends = $xrd->services(array('filter_MatchesAnyOMBType')); - foreach($ends as $serv) { - $typ = $serv->getTypes(); - global $omb_services; - $end = ""; - foreach($typ as $t) { - if (in_array($t,$omb_services)) - $end = $t; - if ($t == OAUTH_VERSION . '/endpoint/request') { - $data = $serv->getElements('xrd:LocalID'); - $localid = $serv->parser->content($data[0]); - } - } - $req = $serv->getURIs(); - $endpoints[$end] = $req[0]; - } - } - } - } - - return array($localid,$endpoints); - -} - - -function filter_MatchesAnyOMBType(&$service) -{ - global $omb_services; - - $uris = $service->getTypes(); - - foreach ($uris as $uri) { - if (in_array($uri, $omb_services)) { - return true; - } - } - - return false; -} - - -// subscribe step 1 (remote service) - -// a form on this site, submitted by a non-authenticated visitor - -function oauth_omb_subscribe( &$vars ) { - - extract($vars); - - if (!(environment('openid_version') > 1) - || (!$db->has_table('oauth_consumers') - || (!$db->has_table('oauth_tokens') - ))) - $db->create_openid_tables(); - - wp_plugin_include(array( - 'wp-oauth' - )); - - $key = $request->base; - $secret = ''; - - $xrds = get_remote_xrds($request->listener_url); - - if (is_array($xrds)) { - $localid = $xrds[0]; - $endpoints = $xrds[1]; - } else { - trigger_error('unable to fetch remote XRDS document', E_USER_ERROR ); - } - - $_SESSION['subscriber_request_token_url'] = $endpoints[OAUTH_VERSION . '/endpoint/request']; - $_SESSION['subscriber_access_token_url'] = $endpoints[OAUTH_VERSION . '/endpoint/access']; - $_SESSION['subscriber_authorize_url'] = $endpoints[OAUTH_VERSION . '/endpoint/authorize']; - $_SESSION['subscriber_notice_url'] = $endpoints[OMB_VERSION . '/postNotice']; - $_SESSION['subscriber_update_url'] = $endpoints[OMB_VERSION . '/updateProfile']; - - if (empty($localid)) - trigger_error('sorry, the localid was not found in the XRDS document', E_USER_ERROR ); - - $listener_url = trim($request->listener_url); - - $listener_uri = trim($localid); - - $_SESSION['listenee_id'] = trim($request->listenee_id); - $_SESSION['listener_url'] = $listener_url; - $_SESSION['listener_uri'] = $listener_uri; - - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $consumer = new OAuthConsumer($key, $secret, NULL); - - $url = $_SESSION['subscriber_request_token_url']; - - $parsed = parse_url($url); - $params = array(); - - parse_str($parsed['query'], $params); - - $req = OAuthRequest::from_consumer_and_token( $consumer, NULL, "POST", $url, $params ); - $req->set_parameter( 'omb_listener', $_SESSION['listener_uri'] ); - $req->set_parameter( 'omb_version', OMB_VERSION ); - $req->sign_request( $sha1_method, $consumer, NULL ); - - $post_to = $req->get_normalized_http_url(); - $post_data = $req->to_postdata(); - - //echo $post_to."
".$post_data."
"; exit; - - $client = Auth_Yadis_Yadis::getHTTPFetcher(); - - //for ($i=0; $i<5; $i++ ) { - $result = $client->post( $post_to, $post_data ); - // if (strpos($result->body, 'oauth_token') === false) { - // sleep(2); - // } else { - // break; - // } - //} - - parse_str( $result->body, $return ); - - if (is_array($return) && count($return) > 0) { - $rtoken_secret = $return['oauth_token_secret']; - $rtoken = $return['oauth_token']; - } else { - echo "sorry, you will have to go back and submit the form again. the server \"".$post_to."\" said \"".$result->body."\" when I posted this data:

".$post_data; exit; - } - $_SESSION['rtoken_secret'] = $rtoken_secret; - $_SESSION['rtoken'] = $rtoken; - - // finish_subscribe saves the profile - $callback_url = $request->url_for( 'oauth_omb_finish_subscribe' ); - - $consumer = new OAuthConsumer($key, $secret, NULL); - $token = new OAuthToken($rtoken, $rtoken_secret); - - $url = $_SESSION['subscriber_authorize_url']; - $parsed = parse_url($url); - $params = array(); - parse_str($parsed['query'], $params); - - $req = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $url, $params); - - $omb_subscribe = array(); - - $Identity =& $db->get_table( 'identities' ); - - $i = $Identity->find( $_SESSION['listenee_id'] ); - - if ($i) { - - if (!(isset($i->nickname))) - trigger_error('the identity does not have a nickname', E_USER_ERROR); - - if (!empty($i->profile_url)) - $profile_url = $i->profile_url; - else - $profile_url = $i->profile; - - $omb_subscribe = array( - 'omb_version' => OMB_VERSION, - 'omb_listener' => $_SESSION['listener_uri'], - 'omb_listenee' => $i->profile, - 'omb_listenee_profile' => $profile_url, - 'omb_listenee_nickname' => $i->nickname, - 'omb_listenee_license' => $i->license, - 'omb_listenee_avatar' => $i->avatar - ); - } else { - trigger_error('Unable to find the listenee, sorry', E_USER_ERROR); - } - - foreach($omb_subscribe as $k=>$v) - $req->set_parameter($k, $v); - - $req->set_parameter('oauth_callback', $callback_url); - - $req->sign_request($sha1_method, $consumer, $token); -//echo $req->to_url(); exit; - header('Location: '.$req->to_url(),true,303); - exit; -} - -// subscribe step 2 (local service) - -// a form was submitted at another site -// and it has bounced a request on behalf of -// an authenticated user of this site - -function oauth_authorize( &$vars ) { - - extract($vars); - - if (!(environment('openid_version') > 1) - || (!$db->has_table('oauth_consumers') - || (!$db->has_table('oauth_tokens') - ))) - $db->create_openid_tables(); - - wp_plugin_include(array( - 'wp-oauth' - )); - - global $wpdb; - global $userdata; - - if(!$_GET['oauth_token'] && !$_POST['authorize']) - - trigger_error('Sorry, the remote service did not send a subscription token. The error has been recorded, you may go back and try the subscription again.', E_USER_ERROR); - - $NO_oauth = true; - //require_once dirname(__FILE__).'/common.inc.php'; - $store = new OAuthWordpressStore(); - - if(!$_POST['authorize']) { - $token = $wpdb->escape($_GET['oauth_token']); - $consumer_key = $store->lookup_token('','request',$token);//verify token - if(!$consumer_key) die('Invalid token passed'); - }//end if ! POST authorize - - get_currentuserinfo(); - - if(!$userdata->ID) { - redirect_to($request->url_for('openid_login')); - }//end if ! userdata->ID - - $xrds = get_remote_xrds(trim(urldecode($_GET['omb_listenee_profile']))); - - if (is_array($xrds)) { - $localid = $xrds[0]; - $endpoints = $xrds[1]; - } else { - trigger_error('unable to fetch remote XRDS document', E_USER_ERROR ); - } - - $postNotice = $endpoints[ OMB_VERSION . '/postNotice' ]; - $updateProfile = $endpoints[ OMB_VERSION . '/updateProfile' ]; - - $listenee_params = array( - 'omb_listenee_fullname' => 'fullname', - 'omb_listenee_profile' => 'profile_url', - 'omb_listenee_nickname' => 'nickname', - 'omb_listenee_license' => 'license', - 'omb_listenee' => 'url', - 'omb_listenee_homepage' => 'homepage', - 'omb_listenee_bio' => 'bio', - 'omb_listenee_location' => 'locality', - 'omb_listenee_avatar' => 'avatar' - ); - - $Identity =& $db->get_table( 'identities' ); - $Person =& $db->get_table( 'people' ); - $Subscription =& $db->model('Subscription'); - - $prof = urldecode($_GET['omb_listenee']); - - $i = $Identity->find_by( 'profile', $prof ); - - if (!$i) { - // need to create the identity (and person?) because it was not found - $p = $Person->base(); - $p->save(); - - // CREATE USER - - $i = $Identity->base(); - $i->set_value( 'profile', $prof ); - $i->set_value( 'label', 'profile 1' ); - $i->set_value( 'person_id', $p->id ); - - foreach($listenee_params as $k=>$v ) { - if (isset($_GET[$k])) { - $i->set_value( $v, urldecode($_GET[$k]) ); - } - } - - if ("/" == substr($i->attributes['url'],-1)) - $i->attributes['url'] = substr($i->attributes['url'],0,-1); - - if (empty($i->attributes['url']) || !($Identity->is_unique_value( $i->attributes['url'], 'url' ))) - $i->set_value( 'url', $i->attributes['profile_url'] ); - - $i->set_value( 'update_profile', $updateProfile ); - $i->set_value( 'post_notice', $postNotice ); - - $i->save_changes(); - $i->set_etag($p->id); - - } - - $_SESSION['listenee_id'] = $i->id; - - if($_POST['authorize']) { - session_start(); - $_GET['oauth_callback'] = $_SESSION['oauth_callback']; unset($_SESSION['oauth_callback']); - $token = $_SESSION['oauth_token']; unset($_SESSION['oauth_token']); - $consumer_key = $_SESSION['oauth_consumer_key']; unset($_SESSION['oauth_consumer_key']); - if($_POST['authorize'] != 'Ok') { - if($_GET['oauth_callback']) { - header('Location: '.urldecode($_GET['oauth_callback']),true,303); - } else { - //get_header(); - echo '

You chose to cancel authorization. You may now close this window.

'; - //get_footer(); - }//end if-else callback - exit; - }//cancel authorize - $consumers = $userdata->oauth_consumers ? $userdata->oauth_consumers : array(); - $services = get_option('oauth_services'); - $yeservices = array(); - foreach($services as $k => $v) - if(in_array($k, array_keys($_GET['services']))) - $yeservices[$k] = $v; - $consumers[$consumer_key] = array_merge(array('authorized' => true), $yeservices);//it's an array so that more granular data about permissions could go in here - $userdata->oauth_consumers = $consumers; - update_usermeta($userdata->ID, 'oauth_consumers', $consumers); - }//end if authorize - - if($userdata->oauth_consumers && in_array($consumer_key,array_keys($userdata->oauth_consumers))) { - $store->authorize_request_token($consumer_key, $token, $userdata->ID); - if($_GET['oauth_callback']) { - - $Subscription =& $db->model('Subscription'); - - $sub = $Subscription->find_by( array( - 'subscribed'=>$_SESSION['listenee_id'], - 'subscriber'=>get_profile_id() - )); - - if (!$sub) { - $s = $Subscription->base(); - $s->set_value( 'subscriber', get_profile_id() ); - $s->set_value( 'subscribed', $_SESSION['listenee_id'] ); - $s->save_changes(); - $s->set_etag(get_person_id()); - } - - // response to omb remote service - - $i = get_profile(); - - if (!empty($i->profile_url)) - $profile_url = $i->profile_url; - else - $profile_url = $i->profile; - - $omb_subscriber = array( - 'omb_version' => OMB_VERSION, - 'omb_listener_profile' => $profile_url, - 'omb_listener_nickname' => $i->nickname, - 'omb_listener_license' => $i->license, - 'omb_listener_fullname' => $i->fullname, - 'omb_listener_homepage' => $i->homepage, - 'omb_listener_bio' => $i->bio, - 'omb_listener_location' => $i->locality, - 'omb_listener_avatar' => $i->avatar - ); - - if ((strpos($_GET['oauth_callback'], '?') === false)) - $profileparams = "?"; - else - $profileparams = "&"; - - foreach($omb_subscriber as $key=>$item) - $profileparams .= $key."=".urlencode($item).'&'; - - $profileparams .= "oauth_token=".$token; - - header('Location: '.urldecode($_GET['oauth_callback']).$profileparams,true,303); - } else { - //get_header(); - echo '

Authorized! You may now close this window.

'; - //get_footer(); - }//end if-else callback - exit; - } else { - session_start();//use a session to prevent the consumer from tricking the user into posting the Yes answer - $_SESSION['oauth_token'] = $token; - $_SESSION['oauth_callback'] = $_GET['oauth_callback']; - $_SESSION['oauth_consumer_key'] = $consumer_key; - //get_header(); - $description = $store->lookup_consumer_description($consumer_key); - if($description) $description = 'Allow '.$description.' to post notices to your account?'; - else $description = 'Click "allow" to authorize messages from the remote site.'; - ?> -
-

-
-
-
    - $v) - // echo '
  • '.$k.'
  • '; - ?> -
-
-      - -
-
-
- get_parameter('oauth_token'); - - if ($token != $_SESSION['rtoken']) - trigger_error('Sorry the subscription failed', E_USER_ERROR); - - $listener_params = array( - 'omb_listener_profile' => 'profile_url', - 'omb_listener_fullname' => 'fullname', - 'omb_listener_license' => 'license', - 'omb_listener_nickname' => 'nickname', - 'omb_listener_homepage' => 'homepage', - 'omb_listener_bio' => 'bio', - 'omb_listener_location' => 'locality', - 'omb_listener_avatar' => 'avatar' - ); - - $Identity =& $db->get_table( 'identities' ); - $Person =& $db->get_table( 'people' ); - - $i = $Identity->find_by( 'profile', $_SESSION['listener_uri'] ); - - if (!$i) { - // need to create the identity (and person?) because it was not found - $p = $Person->base(); - $p->save(); - - // CREATE USER - - $i = $Identity->base(); - $i->set_value( 'url', $_SESSION['listener_uri'] ); - $i->set_value( 'profile', $_SESSION['listener_uri'] ); - $i->set_value( 'label', 'profile 1' ); - $i->set_value( 'person_id', $p->id ); - - foreach($listener_params as $k=>$v ) { - if (isset($_GET[$k])) { - $i->set_value( $v, urldecode($_GET[$k]) ); - } - } - - if ("/" == substr($i->attributes['url'],-1)) - $i->attributes['url'] = substr($i->attributes['url'],0,-1); - - if (empty($i->attributes['url']) || !($Identity->is_unique_value( $i->attributes['url'], 'url' ))) - $i->set_value( 'url', $i->attributes['profile_url'] ); - - $i->save_changes(); - $i->set_etag($p->id); - } - - $i->set_value( 'update_profile', $_SESSION['subscriber_update_url'] ); - $i->set_value( 'post_notice', $_SESSION['subscriber_notice_url'] ); - $i->save_changes(); - - $url = $_SESSION['subscriber_access_token_url']; - $parsed = parse_url($url); - $params = array(); - parse_str($parsed['query'], $params); - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $consumer = new OAuthConsumer($request->base, '', NULL); - $token = new OAuthToken($_SESSION['rtoken'], $_SESSION['rtoken_secret']); - $req = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url, $params); - $req->set_parameter('omb_version', OMB_VERSION); - - $req->sign_request($sha1_method, $consumer, $token); - - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $req->to_postdata()); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $atoken = curl_exec($curl); - curl_close($curl); - - - parse_str($atoken, $result); - - if (!(isset($result['oauth_token']) && isset($result['oauth_token_secret']))) - trigger_error( 'could not find the access token!',E_USER_ERROR); - - $Subscription =& $db->model( 'Subscription' ); - - $sub = $Subscription->find_by( array( - 'subscribed'=>$_SESSION['listenee_id'], - 'subscriber'=>$i->id - )); - - if (!$sub) { - - $sub = $Subscription->base(); - $sub->set_value( 'subscriber', $i->id ); - $sub->set_value( 'subscribed', $_SESSION['listenee_id'] ); - $sub->save_changes(); - $p = $i->FirstChild('people'); - $sub->set_etag($p->id); - - } - - $sub->set_value( 'token', $result['oauth_token'] ); - $sub->set_value( 'secret', $result['oauth_token_secret'] ); - - $sub->save_changes(); - - redirect_to(array( - 'resource' => '_'.$_SESSION['listenee_id'] - )); - -} - - -// subscribe step 4 (local service) - -// a remote site has been authorized to -// connect and it wants its credential - -function access_token( &$vars ) { - - extract($vars); - - wp_plugin_include(array( - 'wp-oauth' - )); - - $store = new OAuthWordpressStore(); - $server = new OAuthServer($store); - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $plaintext_method = new OAuthSignatureMethod_PLAINTEXT(); - $server->add_signature_method($sha1_method); - $server->add_signature_method($plaintext_method); - - $req = OAuthRequest::from_request(); - $token = $server->fetch_access_token($req); - - header( 'Status: 200 OK' ); - print $token->to_string().'&xoauth_token_expires='.urlencode($store->token_expires($token)); - exit; - -} - - -function request_token( &$vars ) { - - extract($vars); - - if (!(environment('openid_version') > 1) - || (!$db->has_table('oauth_consumers') - || (!$db->has_table('oauth_tokens') - ))) - $db->create_openid_tables(); - - wp_plugin_include(array( - 'wp-oauth' - )); - - $consumerkey = $db->escape_string(urldecode($_POST['oauth_consumer_key'])); - - $consumer_result = $db->get_result("SELECT consumer_key FROM oauth_consumers WHERE consumer_key = '$consumerkey'"); - - if (!$db->num_rows($consumer_result)>0) - $result = $db->get_result("INSERT INTO oauth_consumers (consumer_key, secret, description) VALUES ('$consumerkey', '', 'Unidentified Consumer')"); - - $store = new OAuthWordpressStore(); - $server = new OAuthServer($store); - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $plaintext_method = new OAuthSignatureMethod_PLAINTEXT(); - $server->add_signature_method($sha1_method); - $server->add_signature_method($plaintext_method); - $params = array(); - foreach($_POST as $key=>$val) { - if (!($key == 'request_token')) - $params[$key] = $val; - } - $req = OAuthRequest::from_request(); - $token = $server->fetch_request_token($req); - header( 'Status: 200 OK' ); - print $token->to_string().'&xoauth_token_expires='.urlencode($store->token_expires($token)); - exit; -} - - -function oauth_omb_post( &$vars ) { - - extract($vars); - - wp_plugin_include(array( - 'wp-oauth' - )); - - $store = new OAuthWordpressStore(); - $server = new OAuthServer($store); - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $plaintext_method = new OAuthSignatureMethod_PLAINTEXT(); - $server->add_signature_method($sha1_method); - $server->add_signature_method($plaintext_method); - $req = OAuthRequest::from_request(); - //$token = $server->fetch_access_token($req); - list($consumer, $token) = $server->verify_request($req); - - $version = $req->get_parameter('omb_version'); - - if ($version != OMB_VERSION) - trigger_error('invalid omb version', E_USER_ERROR); - - $listenee = $req->get_parameter('omb_listenee'); - - $Identity =& $db->model('Identity'); - - $sender = $Identity->find_by('profile',$listenee); - - if (!($sender)) { - header('HTTP/1.1 403 Forbidden'); - exit; - } - - $Subscription =& $db->model('Subscription'); - - $sub = $Subscription->find_by( array( - 'subscribed'=>$sender->id - )); - - if (!($sub)) { - header('HTTP/1.1 403 Forbidden'); - exit; - } - - $content = $req->get_parameter( 'omb_notice_content' ); - - $notice_uri = $req->get_parameter( 'omb_notice' ); - - $notice_url = $req->get_parameter( 'omb_notice_url' ); - - $Post =& $db->model( 'Post' ); - - $p = $Post->find_by( 'uri', $notice_uri ); - - if (!$p) { - $p = $Post->base(); - $p->set_value( 'profile_id', $sender->id ); - $p->set_value( 'parent_id', 0 ); - $p->set_value( 'uri', $notice_uri ); - $p->set_value( 'url', $notice_url ); - $p->set_value( 'title', $content ); - $p->save_changes(); - $p->set_etag($sender->person_id); - trigger_after( 'insert_from_post', $Post, $p ); - } - - print "omb_version=".OMB_VERSION; - exit; - -} - - -function oauth_post_content_type() { - return "application/x-www-form-urlencoded"; - //application/atom+xml;type=entry -} - - -function local_subscribe( &$vars ) { - - extract($vars); - - $Subscription =& $db->model('Subscription'); - - $sub = $Subscription->find_by( array( - 'subscribed'=>$request->listenee_id, - 'subscriber'=>get_profile_id() - )); - - if (!$sub) { - $sub = $Subscription->base(); - $sub->set_value('subscribed',$request->listenee_id); - $sub->set_value('subscriber',get_profile_id()); - $sub->save_changes(); - - $pro = get_profile($request->listenee_id); - $subber = get_profile(); - - if (is_email($pro->email_value)) - send_email( $pro->email_value, $subber->nickname . " is now following you on ".$request->domain, "\nhere's a link to the profile: \n\n ".$subber->profile."\n\n", environment('email_from'), environment('email_name'), false ); - - } - - redirect_to( array( - 'resource'=>$request->listenee_nick - )); - -} - - -function local_unsubscribe( &$vars ) { - - extract($vars); - - $Subscription =& $db->model('Subscription'); - - $sub = $Subscription->find_by( array( - 'subscribed'=>$request->listenee_id, - 'subscriber'=>get_profile_id() - )); - - if ( $sub ) - $db->delete_record( $sub ); - - redirect_to( array( - 'resource'=>$request->listenee_nick - )); - -} - - -function xrdends( $uri, $xrds ) { - - if (!(substr($uri,0,1)) == '#') - return; - - $xmlid = substr( $uri, 1 ); - - $n = $xrds->allXrdNodes; - - $p = $xrds->parser; - - foreach ( $n as $nd ) { - - $a = $p->attributes( $nd ); - - if ( isset($a['xml:id']) && $a['xml:id'] == $xmlid ) { - $skip = array( $nd ); - return new Auth_Yadis_XRDS( $p, $skip ); - - } - } -} - - -function oauth_omb_update( &$vars ) { - - extract($vars); - - wp_plugin_include(array( - 'wp-oauth' - )); - - $store = new OAuthWordpressStore(); - $server = new OAuthServer($store); - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $plaintext_method = new OAuthSignatureMethod_PLAINTEXT(); - $server->add_signature_method($sha1_method); - $server->add_signature_method($plaintext_method); - $req = OAuthRequest::from_request(); - - list($consumer, $token) = $server->verify_request($req); - - $version = $req->get_parameter('omb_version'); - - if ($version != OMB_VERSION) - trigger_error('invalid omb version', E_USER_ERROR); - - $listenee = $req->get_parameter('omb_listenee'); - - $Identity =& $db->model('Identity'); - - $sender = $Identity->find_by('profile',$listenee); - - if (!($sender)) { - - header('HTTP/1.1 403 Forbidden'); - exit; - } - - $listenee_params = array( - 'omb_listenee_profile' => 'profile_url', - 'omb_listenee_nickname' => 'nickname', - 'omb_listenee_license' => 'license', - 'omb_listenee_fullname' => 'fullname', - 'omb_listenee_homepage' => 'homepage', - 'omb_listenee_bio' => 'bio', - 'omb_listenee_location' => 'locality', - 'omb_listenee_avatar' => 'avatar' - ); - - foreach($listenee_params as $k=>$v ) { - if (isset($_POST[$k])) { - $sender->set_value( $v, $_POST[$k] ); - } - } - - $sender->save_changes(); - - print "omb_version=".OMB_VERSION; - exit; - -} - - -function broadcast_omb_profile_update() { - - global $request, $db; - - wp_plugin_include(array( - 'wp-oauth' - )); - - $i = get_profile(); - - $listenee_uri = $i->profile; - - $license = $i->license; - - $sent_to = array(); - - $Subscription = $db->model('Subscription'); - - $Subscription->has_one( 'subscriber:identity' ); - - $where = array( - 'subscriptions.subscribed'=>$i->id, - ); - - $Subscription->set_param( 'find_by', $where ); - - $Subscription->find(); - - while ($sub = $Subscription->MoveNext()) { - $sub_token = trim($sub->token); - $sub_secret = trim($sub->secret); - $sid = $sub->FirstChild('identities'); - $url = $sid->update_profile; - if (!in_array($url,$sent_to) && !empty($url) && !(strstr( $url, $request->base ))) { - $sent_to[] = $url; - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled"; - $path = plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . 'wp-openid' . DIRECTORY_SEPARATOR; - add_include_path( $path ); - require_once "Auth/Yadis/Yadis.php"; - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - $consumer = new OAuthConsumer($request->base, ''); - $token = new OAuthToken($sub_token, $sub_secret); - $parsed = parse_url($url); - $params = array(); - parse_str($parsed['query'], $params); - $req = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url, $params ); - - $req->set_parameter('omb_version', OMB_VERSION ); - $req->set_parameter('omb_listenee', $listenee_uri ); - - $listenee_params = array( - 'omb_listenee_profile' => $i->profile, - 'omb_listenee_nickname' => $i->nickname, - 'omb_listenee_license' => $i->license, - 'omb_listenee_fullname' => $i->fullname, - 'omb_listenee_homepage' => $i->homepage, - 'omb_listenee_bio' => $i->bio, - 'omb_listenee_location' => $i->locality, - 'omb_listenee_avatar' => $i->avatar - ); - - foreach($listenee_params as $k=>$v ) - $req->set_parameter( $k, $v ); - - $req->sign_request($sha1_method, $consumer, $token); - $result = $fetcher->post($req->get_normalized_http_url(),$req->to_postdata()); - - if ( $result->status == 403 ) { - // not so much - } else { - parse_str( $result->body, $return ); - if ( is_array($return) && $return['omb_version'] == OMB_VERSION ) { - // nice - } else { - // could be better - } - } - - } - - } - -} - - -function oauth_omb_register_services() { - - global $request; - global $db; - $Identity =& $db->model('Identity'); - $i = $Identity->find($request->id); - - //register_xrd_service('main', 'OAuth Dummy Service', array( - // 'Type' => array( array('content' => 'http://oauth.net/discovery/1.0') ), - // 'URI' => array( array('content' => '#oauth' ) ), - //) ); - - //register_xrd_service('main', 'OMB Dummy Service', array( - // 'Type' => array( array('content' => 'http://openmicroblogging.org/protocol/0.1') ), - // 'URI' => array( array('content' => '#omb' ) ), - //) ); - - register_xrd('oauth'); - - register_xrd('omb'); - - if (empty($i->profile)) { - $i->set_value( 'profile', $request->url_for(array('resource'=>"_".$i->id)) ); - $i->set_value( 'profile_url', $request->url_for(array('resource'=>$i->nickname)) ); - $i->save_changes(); - } - - register_xrd_service( 'omb', 'OMB Post Notice', array( - 'Type' => array( - array('content' => OMB_VERSION . '/postNotice') - ), - 'URI' => array( array('content' => $request->url_for( 'oauth_omb_post' ) ) ), - ) ); - - register_xrd_service( 'omb', 'OMB Update Profile', array( - 'Type' => array( - array('content' => OMB_VERSION . '/updateProfile') - ), - 'URI' => array( array('content' => $request->url_for( 'oauth_omb_update' ) ) ), - ) ); - - register_xrd_service('oauth', 'OAuth Request Token', array( - 'Type' => array( - - array('content' => OAUTH_VERSION . '/endpoint/request'), - array('content' => OAUTH_VERSION . '/parameters/auth-header'), - array('content' => OAUTH_VERSION . '/parameters/post-body'), - array('content' => OAUTH_VERSION . '/signature/HMAC-SHA1'), - ), - 'URI' => array( array('content' => $request->url_for( 'request_token' ) ) ), - 'LocalID' => array('content' => $i->profile ) - ) ); - - register_xrd_service('oauth', 'OAuth Authorize Token', array( - 'Type' => array( - array('content' => OAUTH_VERSION . '/endpoint/authorize'), - array('content' => OAUTH_VERSION . '/parameters/auth-header'), - array('content' => OAUTH_VERSION . '/parameters/post-body'), - array('content' => OAUTH_VERSION . '/signature/HMAC-SHA1'), - ), - 'URI' => array( array('content' => $request->url_for( 'oauth_authorize' ) ) ), - ) ); - - register_xrd_service('oauth', 'OAuth Access Token', array( - 'Type' => array( - array('content' => OAUTH_VERSION . '/endpoint/access'), - array('content' => OAUTH_VERSION . '/parameters/auth-header'), - array('content' => OAUTH_VERSION . '/parameters/post-body'), - array('content' => OAUTH_VERSION . '/signature/HMAC-SHA1'), - ), - 'URI' => array( array('content' => $request->url_for( 'access_token' ) ) ), - ) ); - - register_xrd_service('oauth', 'OAuth Resources', array( - 'Type' => array( - array('content' => OAUTH_VERSION . '/endpoint/resource'), - array('content' => OAUTH_VERSION . '/parameters/auth-header'), - array('content' => OAUTH_VERSION . '/parameters/post-body'), - array('content' => OAUTH_VERSION . '/signature/HMAC-SHA1'), - ), - ) ); - - //register_xrd_service('oauth', 'OAuth Static Token', array( - // 'Type' => array( - // array('content' => 'http://oauth.net/discovery/1.0/consumer-identity/static'), - // ), - // 'LocalID' => array( array('content' => $request->url_for(array('resource'=>'identities','id'=>$request->id )))), - //) ); - - - -} - - -function smtp_event( &$vars ) { - - //$path = '/home/smtp2web/spool/'; - //$file = $path.substr( microtime(), 0, 7); - //if (file_exists($file)) - // exit; - //$fd = fopen($file , "a+"); - //$data = $GLOBALS["HTTP_RAW_POST_DATA"]; - //if ($fd) { - // $result = fwrite( $fd, $data ); - // fclose($fd); - //} - //header( 'Status: 200 OK' ); - //exit; - - extract($vars); - $from = $_GET['from']; - $message = $GLOBALS["HTTP_RAW_POST_DATA"]; - - add_include_path(library_path()); - require_once 'Zend/Mime/Decode.php'; - require_once 'Zend/Mime/Message.php'; - - //$message = file_get_contents('/home/smtp2web/spool/0.07605'); - //$from = 'brian@brianhendrickson.com'; - - $Identity =& $db->model('Identity'); - - $i = $Identity->find_by('email_value',$from); - - if (!$i) - exit; - - if (!(get_class($i) == 'Record')) - exit; - - Zend_Mime_Decode::splitMessage($message,$headers,$body); - - $boundary = Zend_Mime_Decode::splitContentType($headers['content-type'], 'boundary'); - - $msg = Zend_Mime_Message::createFromMessage($message,$boundary); - - $parts = $msg->getParts(); - - if (count($parts) > 0) { - - $parts = $msg->getParts(); - - foreach($parts as $num=>$part) { - - if (!('base64' == $part->encoding)) - continue; - - // ask Zend_Mime to ignore encoding - $part->encoding = 'blah'; - - $str = $part->getContent(); - - $phdrs = $part->getHeadersArray(); - - $filename = Zend_Mime_Decode::splitContentType($phdrs[0][1], 'name'); - - if (empty($filename)) - $filename = Zend_Mime_Decode::splitContentType($phdrs[2][1], 'filename'); - - $att = tempnam( "/tmp", microtime() ); - - $im = imagecreatefromstring(base64_decode($str)); - - imagejpeg($im,$att,100); - - $_FILES = array( - 'post' => array( - 'name' => array( 'attachment' => $filename ), - 'tmp_name' => array( 'attachment' => $att ) - )); - } - - foreach($parts as $num=>$part) { - if (in_array($part->encoding,array('7bit','8bit'))) - $body = $part->getContent(); - } - - } - - handle_posted_file('jpg',$_FILES['post']['tmp_name']['attachment'],$i); - - header( 'Status: 200 OK' ); - exit; - - $Post =& $db->model('Post'); - - $field = 'attachment'; - $modelvar = 'Post'; - - $request->set_param('resource',$table); - $request->set_param( array( strtolower(classify($table)), $field ), $_FILES[strtolower(classify($table))]['tmp_name'][$field] ); - trigger_before( 'insert_from_post', $$modelvar, $request ); - $content_type = 'text/html'; - $rec = $$modelvar->base(); - $content_type = type_of( $_FILES[strtolower(classify($table))]['name'][$field] ); - $rec->set_value('profile_id',get_profile_id()); - $rec->set_value( 'parent_id', 0 ); - $rec->set_value( 'title', trim($body) ); - $upload_types = environment('upload_types'); - if (!$upload_types) - $upload_types = array('jpg','jpeg','png','gif'); - $ext = extension_for( type_of($_FILES[strtolower(classify($table))]['name']['attachment'])); - if (!(in_array($ext,$upload_types))) - trigger_error('Sorry, this site only allows the following file types: '.implode(',',$upload_types), E_USER_ERROR); - $rec->set_value( $field, $_FILES[strtolower(classify($table))]['tmp_name'][$field] ); - $rec->save_changes(); - $tmp = $_FILES[strtolower(classify($table))]['tmp_name']['attachment']; - if (is_jpg($tmp)) { - $thumbsize = environment('max_pixels'); - $Thumbnail =& $db->model('Thumbnail'); - $t = $Thumbnail->base(); - $newthumb = tempnam( "/tmp", "new".$rec->id.".jpg" ); - resize_jpeg($tmp,$newthumb,$thumbsize); - $t->set_value('target_id',$atomentry->id); - $t->save_changes(); - update_uploadsfile( 'thumbnails', $t->id, $newthumb ); - $t->set_etag(); - } - $atomentry = $$modelvar->set_metadata($rec,$content_type,$table,'id'); - $$modelvar->set_categories($rec,$request,$atomentry); - $url = $request->url_for(array( - 'resource'=>$table, - 'id'=>$rec->id - )); - $title = substr($rec->title,0,140); - $over = ((strlen($title) + strlen($url) + 1) - 140); - if ($over > 0) - $rec->set_value('title',substr($title,0,-$over)." ".$url); - else - $rec->set_value('title',$title." ".$url); - $rec->save_changes(); - trigger_after( 'insert_from_post', $$modelvar, $rec ); - header( 'Status: 200 OK' ); - exit; -} - -function flickr_login(&$vars){ - - extract($vars); - - $key = environment( 'flickrKey' ); - $secret = environment( 'flickrSecret' ); - - if (empty($key)) - return; - - add_include_path(library_path()."phpFlickr"); - - include('phpFlickr.php'); - - $permissions = "write"; - - ob_start(); - - unset($_SESSION['phpFlickr_auth_token']); - - $f = new phpFlickr( $key, $secret ); - - if (empty($_GET['frob'])) - $f->auth($permissions, false); - else - $f->auth_getToken($_GET['frob']); - - $Setting =& $db->model('Setting'); - - $stat = $Setting->find_by(array('name'=>'flickr_frob','profile_id'=>get_profile_id())); - - if (!$stat && !empty($_SESSION['phpFlickr_auth_token'])) { - $stat = $Setting->base(); - $stat->set_value('profile_id',get_profile_id()); - $stat->set_value('person_id',get_person_id()); - $stat->set_value('name','flickr_frob'); - $stat->set_value('value',$_SESSION['phpFlickr_auth_token']); - $stat->save_changes(); - $stat->set_etag(); - } - - redirect_to($request->base); - -} - - - -function login_callback(){ - extract( $vars ); - $callback = $_GET['callback']; - $_SESSION['requested_url'] = $_SERVER[HTTP_REFERER]; - echo $callback."("; - if (get_profile_id()) - echo "1"; - else - echo "0"; - echo ");"; -} - - - - diff --git a/app/omb/plugins/omb_notice.php b/app/omb/plugins/omb_notice.php deleted file mode 100755 index 85815ba..0000000 --- a/app/omb/plugins/omb_notice.php +++ /dev/null @@ -1,135 +0,0 @@ -table == 'posts')) - return; - - if (!(isset($rec->title)) || !(isset($rec->uri))) - return; - - global $request, $db; - - if (empty($rec->uri)) { - $rec->set_value( 'uri', $request->url_for( array( - 'resource'=>'__'.$rec->id, - ))); - $rec->save_changes(); - } - - if (!$request->resource == 'posts') - return; - - wp_plugin_include(array( - 'wp-oauth' - )); - - $i = owner_of($rec); - - $listenee_uri = $i->profile; - - $notice_uri = $rec->uri; - - $notice_content = substr($rec->title,0,140); - - $notice_url = $notice_uri; - - $license = $i->license; - - $sent_to = array(); - - $Subscription = $db->model('Subscription'); - - $Subscription->has_one( 'subscriber:identity' ); - - $where = array( - 'subscriptions.subscribed'=>$i->id, - ); - - $Subscription->set_param( 'find_by', $where ); - - $Subscription->find(); - - while ($sub = $Subscription->MoveNext()) { - - $sub_token = trim($sub->token); - $sub_secret = trim($sub->secret); - - $sid = $sub->FirstChild('identities'); - $url = $sid->post_notice; - - if (!in_array($url,$sent_to) && !empty($url) && !(strstr( $url, $request->base ))) { - - - - $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); - - - $wp_plugins = "wp-plugins" . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "enabled"; - $path = plugin_path() . $wp_plugins . DIRECTORY_SEPARATOR . 'wp-openid' . DIRECTORY_SEPARATOR; - add_include_path( $path ); - require_once "Auth/Yadis/Yadis.php"; - - - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - - - //for ($i=0;$i<5;$i++) { - - - $consumer = new OAuthConsumer($request->base, ''); - $token = new OAuthToken($sub_token, $sub_secret); - $parsed = parse_url($url); - $params = array(); - parse_str($parsed['query'], $params); - $req = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url, $params ); - $req->set_parameter('omb_version', OMB_VERSION ); - $req->set_parameter('omb_listenee', $listenee_uri ); - $req->set_parameter('omb_notice', $notice_uri ); - $req->set_parameter('omb_notice_content', $notice_content ); - $req->set_parameter('omb_notice_url', $notice_url ); - $req->set_parameter('omb_notice_license', $license ); - - $req->sign_request($sha1_method, $consumer, $token); - - $result = $fetcher->post($req->get_normalized_http_url(), - $req->to_postdata()); - - if ( $result->status == 403 ) { - $db->delete_record($sub); - } else { - parse_str( $result->body, $return ); - if ( is_array($return) && $return['omb_version'] == OMB_VERSION ) { - $sent_to[] = $url; - } else { - admin_alert('failed to post'."\n\n".$url."\n\n".$result->body."\n\n".$notice_content); - } - } - - //} - - - // this is the old CURL version of omb_notice - - //$curl = curl_init($url); - //curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - //curl_setopt($curl, CURLOPT_HEADER, false); - //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); - //curl_setopt($curl, CURLOPT_POST, true); - //curl_setopt($curl, CURLOPT_POSTFIELDS, $req->to_postdata()); - //curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - //$result = curl_exec($curl); - //curl_close($curl); - - - - - - } - - } -} - -?> \ No newline at end of file diff --git a/app/omb/plugins/ping.php b/app/omb/plugins/ping.php deleted file mode 100755 index 50eb473..0000000 --- a/app/omb/plugins/ping.php +++ /dev/null @@ -1,146 +0,0 @@ -get_table('entries'); - - $notify_table = $model->table; - $recid = $rec->id; - - if (!empty($db->prefix)) - $chan = $db->prefix; - else - $chan = "chan"; - - if (defined('REALTIME_HOST') && REALTIME_HOST && $rec->table == 'posts') { - - $o = owner_of($rec); - $payload = array(); - - if (environment('threaded') && isset($rec->parent_id) && $rec->parent_id > 0) { - - // push a P2 comment - - $par = $db->get_record( 'posts',$rec->parent_id ); - $tweet = render_comment($rec,$o,$par); - $payload['html'] = $tweet; - if ($rec->parent_id > 0) - $payload['in_reply_to'] = "#commentcontent-".$rec->parent_id; - else - $payload['in_reply_to'] = "#content-".$rec->parent_id; - - } else { - - // push a P2 tweet - $o = owner_of($rec); - - $tweet = '
'."\n"; - $tweet .= '

'."\n"; - $tweet .= ' Permalink | Reply
'."\n"; - $tweet .= '

'."\n"; - $tweet .= ' '.$o->nickname.' '.laconica_time($rec->created).' | 0
'."\n"; - $tweet .= '

'."\n"; - $tweet .= '
'."\n"; - $tweet .= '

'."\n"; - $tweet .= render_notice($rec->title,$rec,$o); - $tweet .= '

'."\n"; - $tweet .= '
'."\n"; - $tweet .= ''."\n"; - $tweet .= '
'."\n"; - $tweet .= ' '."\n"; - $tweet .= '
'."\n"; - $tweet .= '
'."\n"; - $tweet .= '
'."\n"; - - $oldstyle = false; - - if ($oldstyle) { - $tweet = ''; - $tweet .= '
  • '; - $tweet .= '\'\'avatar.'\' class=\'avatar avatar-48\' height=\'48\' width=\'48\' />'; - $tweet .= '

    '; - $tweet .= ''.$o->nickname.' '.date( "g:i A" , strtotime($rec->created) ).'on '.date( get_settings('date_format'), strtotime($rec->created) ).' |'; - $tweet .= ' '; - $tweet .= ' Permalink'; - $tweet .= ' '; - $tweet .= '
    '; - $tweet .= '
    '; - $tweet .= '

    '; - $tweet .= '

    '.render_notice($rec->title,$rec,$o).'

    '; - $tweet .= '
     
    '; - $tweet .= '