]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.7.x' into 0.8.x
authorSarven Capadisli <csarven@controlyourself.ca>
Fri, 29 May 2009 00:10:23 +0000 (00:10 +0000)
committerSarven Capadisli <csarven@controlyourself.ca>
Fri, 29 May 2009 00:10:23 +0000 (00:10 +0000)
362 files changed:
EVENTS.txt
README
actions/api.php
actions/attachment.php [new file with mode: 0644]
actions/attachment_ajax.php [new file with mode: 0644]
actions/attachment_thumbnail.php [new file with mode: 0644]
actions/conversation.php [new file with mode: 0644]
actions/deletenotice.php
actions/designsettings.php [new file with mode: 0644]
actions/facebookhome.php
actions/facebooksettings.php
actions/logout.php
actions/newnotice.php
actions/register.php
actions/showstream.php
actions/tag.php
actions/twittersettings.php
actions/userrss.php
classes/File.php [new file with mode: 0644]
classes/File_oembed.php [new file with mode: 0644]
classes/File_redirection.php [new file with mode: 0644]
classes/File_thumbnail.php [new file with mode: 0644]
classes/File_to_post.php [new file with mode: 0644]
classes/Foreign_link.php
classes/Group_inbox.php [changed mode: 0755->0644]
classes/Group_member.php [changed mode: 0755->0644]
classes/Notice.php
classes/Profile.php
classes/Related_group.php [changed mode: 0755->0644]
classes/Status_network.php [new file with mode: 0644]
classes/User.php
classes/User_group.php [changed mode: 0755->0644]
classes/laconica.ini [changed mode: 0755->0644]
classes/laconica.links.ini
classes/statusnet.ini [new file with mode: 0755]
config.php.sample
db/foreign_services.sql
db/laconica.sql
db/laconica_pg.sql
db/notice_source.sql
db/site.sql [new file with mode: 0644]
extlib/DB/DataObject.php
extlib/HTTP/Request.php [new file with mode: 0644]
extlib/HTTP/Request/Listener.php [new file with mode: 0644]
extlib/Net/URL2.php [new file with mode: 0644]
extlib/Services/oEmbed.php [new file with mode: 0644]
extlib/Services/oEmbed/Exception.php [new file with mode: 0644]
extlib/Services/oEmbed/Exception/NoSupport.php [new file with mode: 0644]
extlib/Services/oEmbed/Object.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Common.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Exception.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Link.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Photo.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Rich.php [new file with mode: 0644]
extlib/Services/oEmbed/Object/Video.php [new file with mode: 0644]
extlib/Stomp.php [new file with mode: 0644]
extlib/Stomp/Exception.php [new file with mode: 0644]
extlib/Stomp/Frame.php [new file with mode: 0644]
extlib/Stomp/Message.php [new file with mode: 0644]
extlib/Stomp/Message/Bytes.php [new file with mode: 0644]
extlib/Stomp/Message/Map.php [new file with mode: 0644]
extlib/Validate.php
extlib/facebook/facebook.php
extlib/facebook/facebook_desktop.php
extlib/facebook/facebookapi_php5_restlib.php [changed mode: 0644->0755]
index.php
install.php
js/farbtastic/LICENSE.txt [new file with mode: 0644]
js/farbtastic/farbtastic.go.js [new file with mode: 0644]
js/farbtastic/farbtastic.js [new file with mode: 0644]
js/farbtastic/marker.png [new file with mode: 0755]
js/farbtastic/mask.png [new file with mode: 0644]
js/farbtastic/wheel.png [new file with mode: 0644]
js/install.js [new file with mode: 0644]
js/jcrop/jquery.Jcrop.go.js
js/jquery.joverlay.min.js [new file with mode: 0644]
js/util.js
lib/Shorturl_api.php
lib/accountsettingsaction.php
lib/action.php
lib/attachmentlist.php [new file with mode: 0644]
lib/attachmentnoticesection.php [new file with mode: 0644]
lib/attachmenttagcloudsection.php [new file with mode: 0644]
lib/common.php
lib/facebookaction.php
lib/noticelist.php
lib/noticesection.php
lib/popularnoticesection.php
lib/profileaction.php
lib/queuehandler.php
lib/router.php
lib/rssaction.php
lib/snapshot.php [new file with mode: 0644]
lib/tagcloudsection.php
lib/theme.php
lib/twitter.php
lib/util.php
plugins/FBConnect/FBCLoginGroupNav.php [new file with mode: 0644]
plugins/FBConnect/FBCSettingsNav.php [new file with mode: 0644]
plugins/FBConnect/FBConnectAuth.php [new file with mode: 0644]
plugins/FBConnect/FBConnectLogin.php [new file with mode: 0644]
plugins/FBConnect/FBConnectPlugin.css [new file with mode: 0644]
plugins/FBConnect/FBConnectPlugin.php [new file with mode: 0644]
plugins/FBConnect/FBConnectSettings.php [new file with mode: 0644]
plugins/FBConnect/fbfavicon.ico [new file with mode: 0644]
plugins/FBConnect/xd_receiver.htm [new file with mode: 0644]
scripts/getvaliddaemons.php
scripts/reportsnapshot.php [new file with mode: 0644]
scripts/stopdaemons.sh
scripts/twitterstatusfetcher.php [new file with mode: 0755]
theme/base/css/display.css
theme/base/css/facebookapp.css
theme/base/css/farbtastic.css [new file with mode: 0644]
theme/base/default-avatar-mini.png [new file with mode: 0644]
theme/base/default-avatar-profile.png [new file with mode: 0644]
theme/base/default-avatar-stream.png [new file with mode: 0644]
theme/base/images/icons/clip-big.png [new file with mode: 0644]
theme/base/images/icons/clip-inline.png [new file with mode: 0644]
theme/base/images/icons/clip.png [new file with mode: 0644]
theme/base/images/icons/twotone/green/arrow-left.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/arrow-right.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/clip-02.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/disfavourite.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/edit.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/favourite.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/mail.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/news.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/quote.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/reply.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/shield.gif [new file with mode: 0644]
theme/base/images/icons/twotone/green/trash.gif [new file with mode: 0644]
theme/base/logo.png [new file with mode: 0644]
theme/biz/css/base.css [new file with mode: 0644]
theme/biz/css/display.css [new file with mode: 0644]
theme/biz/css/ie.css [new file with mode: 0644]
theme/biz/default-avatar-mini.png [new file with mode: 0644]
theme/biz/default-avatar-profile.png [new file with mode: 0644]
theme/biz/default-avatar-stream.png [new file with mode: 0644]
theme/biz/images/illustrations/illu_pattern-01.png [new file with mode: 0644]
theme/biz/images/illustrations/illu_pattern-02.png [new file with mode: 0644]
theme/biz/logo.png [new file with mode: 0644]
theme/cloudy/css/display.css [new file with mode: 0644]
theme/cloudy/css/ie.css [new file with mode: 0644]
theme/cloudy/default-avatar-mini.png [new file with mode: 0644]
theme/cloudy/default-avatar-profile.png [new file with mode: 0644]
theme/cloudy/default-avatar-stream.png [new file with mode: 0644]
theme/cloudy/images/icons/icon_atom.png [new file with mode: 0644]
theme/cloudy/images/icons/icon_disfavourite.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_favourite.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_foaf.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_processing.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_reply.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_rss.png [new file with mode: 0644]
theme/cloudy/images/icons/icon_trash.gif [new file with mode: 0644]
theme/cloudy/images/icons/icon_vcard.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/arrow-left.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/arrow-right.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/edit.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/mail.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/news.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/quote.gif [new file with mode: 0644]
theme/cloudy/images/icons/twotone/green/shield.gif [new file with mode: 0644]
theme/cloudy/images/illustrations/illu_arrow-up-01.gif [new file with mode: 0644]
theme/cloudy/images/illustrations/illu_clouds-01.gif [new file with mode: 0644]
theme/cloudy/images/illustrations/illu_jcrop.gif [new file with mode: 0644]
theme/cloudy/images/illustrations/illu_progress_loading-01.gif [new file with mode: 0644]
theme/cloudy/images/illustrations/illu_unicorn-01.png [new file with mode: 0644]
theme/cloudy/logo.png [new file with mode: 0644]
theme/default/css/display.css
theme/default/images/icons/icon_atom.jpg [deleted file]
theme/default/images/icons/icon_foaf.gif [deleted file]
theme/default/images/icons/icon_rss.jpg [deleted file]
theme/default/images/icons/icon_vcard.gif [deleted file]
theme/default/images/icons/twotone/green/against.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-down.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-downleft.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-downright.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-left.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-right.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-up.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-upleft.gif [deleted file]
theme/default/images/icons/twotone/green/arrow-upright.gif [deleted file]
theme/default/images/icons/twotone/green/back-forth.gif [deleted file]
theme/default/images/icons/twotone/green/bookmark.gif [deleted file]
theme/default/images/icons/twotone/green/bulb.gif [deleted file]
theme/default/images/icons/twotone/green/calendar.gif [deleted file]
theme/default/images/icons/twotone/green/calendar2.gif [deleted file]
theme/default/images/icons/twotone/green/camera.gif [deleted file]
theme/default/images/icons/twotone/green/cart.gif [deleted file]
theme/default/images/icons/twotone/green/caution.gif [deleted file]
theme/default/images/icons/twotone/green/chart.gif [deleted file]
theme/default/images/icons/twotone/green/checkmark.gif [deleted file]
theme/default/images/icons/twotone/green/clipboard.gif [deleted file]
theme/default/images/icons/twotone/green/clock.gif [deleted file]
theme/default/images/icons/twotone/green/closed-folder.gif [deleted file]
theme/default/images/icons/twotone/green/database.gif [deleted file]
theme/default/images/icons/twotone/green/disfavourite.gif [deleted file]
theme/default/images/icons/twotone/green/diskette.gif [deleted file]
theme/default/images/icons/twotone/green/document.gif [deleted file]
theme/default/images/icons/twotone/green/double-arrow.gif [deleted file]
theme/default/images/icons/twotone/green/edit.gif [deleted file]
theme/default/images/icons/twotone/green/eject.gif [deleted file]
theme/default/images/icons/twotone/green/exclaim.gif [deleted file]
theme/default/images/icons/twotone/green/fastforward.gif [deleted file]
theme/default/images/icons/twotone/green/favourite.gif [deleted file]
theme/default/images/icons/twotone/green/flag.gif [deleted file]
theme/default/images/icons/twotone/green/graph.gif [deleted file]
theme/default/images/icons/twotone/green/grow.gif [deleted file]
theme/default/images/icons/twotone/green/headphones.gif [deleted file]
theme/default/images/icons/twotone/green/home.gif [deleted file]
theme/default/images/icons/twotone/green/hourglass.gif [deleted file]
theme/default/images/icons/twotone/green/info.gif [deleted file]
theme/default/images/icons/twotone/green/key.gif [deleted file]
theme/default/images/icons/twotone/green/lock.gif [deleted file]
theme/default/images/icons/twotone/green/mail.gif [deleted file]
theme/default/images/icons/twotone/green/move.gif [deleted file]
theme/default/images/icons/twotone/green/music.gif [deleted file]
theme/default/images/icons/twotone/green/news.gif [deleted file]
theme/default/images/icons/twotone/green/note.gif [deleted file]
theme/default/images/icons/twotone/green/open-folder.gif [deleted file]
theme/default/images/icons/twotone/green/paper-clip.gif [deleted file]
theme/default/images/icons/twotone/green/paper-clip2.gif [deleted file]
theme/default/images/icons/twotone/green/pause.gif [deleted file]
theme/default/images/icons/twotone/green/phone.gif [deleted file]
theme/default/images/icons/twotone/green/play.gif [deleted file]
theme/default/images/icons/twotone/green/plus.gif [deleted file]
theme/default/images/icons/twotone/green/print.gif [deleted file]
theme/default/images/icons/twotone/green/question-mark.gif [deleted file]
theme/default/images/icons/twotone/green/quote.gif [deleted file]
theme/default/images/icons/twotone/green/refresh.gif [deleted file]
theme/default/images/icons/twotone/green/reply.gif [deleted file]
theme/default/images/icons/twotone/green/rewind.gif [deleted file]
theme/default/images/icons/twotone/green/search.gif [deleted file]
theme/default/images/icons/twotone/green/shield.gif [deleted file]
theme/default/images/icons/twotone/green/skip-back.gif [deleted file]
theme/default/images/icons/twotone/green/skip.gif [deleted file]
theme/default/images/icons/twotone/green/skull.gif [deleted file]
theme/default/images/icons/twotone/green/statusbar.gif [deleted file]
theme/default/images/icons/twotone/green/stop.gif [deleted file]
theme/default/images/icons/twotone/green/template.gif [deleted file]
theme/default/images/icons/twotone/green/text-bigger.gif [deleted file]
theme/default/images/icons/twotone/green/text-smaller.gif [deleted file]
theme/default/images/icons/twotone/green/trash.gif [deleted file]
theme/default/images/icons/twotone/green/two-docs.gif [deleted file]
theme/default/images/icons/twotone/green/twotone.gif [deleted file]
theme/default/images/icons/twotone/green/undo.gif [deleted file]
theme/default/images/icons/twotone/green/user.gif [deleted file]
theme/default/images/icons/twotone/green/vegetable.gif [deleted file]
theme/default/images/icons/twotone/green/x.gif [deleted file]
theme/default/images/icons/twotone/green/zoom-in.gif [deleted file]
theme/default/images/icons/twotone/green/zoom-out.gif [deleted file]
theme/default/logo.png [new file with mode: 0644]
theme/h4ck3r/css/base.css [new file with mode: 0644]
theme/h4ck3r/css/display.css [new file with mode: 0644]
theme/h4ck3r/css/ie.css [new file with mode: 0644]
theme/h4ck3r/default-avatar-mini.png [new file with mode: 0644]
theme/h4ck3r/default-avatar-profile.png [new file with mode: 0644]
theme/h4ck3r/default-avatar-stream.png [new file with mode: 0644]
theme/h4ck3r/images/illustrations/illu_h4x0r1ng.gif [new file with mode: 0644]
theme/h4ck3r/logo.png [new file with mode: 0644]
theme/identica/css/display.css
theme/identica/images/icons/icon_atom.jpg [deleted file]
theme/identica/images/icons/icon_foaf.gif [deleted file]
theme/identica/images/icons/icon_rss.jpg [deleted file]
theme/identica/images/icons/icon_vcard.gif [deleted file]
theme/identica/images/icons/twotone/green/against.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-down.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-downleft.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-downright.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-left.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-right.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-up.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-upleft.gif [deleted file]
theme/identica/images/icons/twotone/green/arrow-upright.gif [deleted file]
theme/identica/images/icons/twotone/green/back-forth.gif [deleted file]
theme/identica/images/icons/twotone/green/bookmark.gif [deleted file]
theme/identica/images/icons/twotone/green/bulb.gif [deleted file]
theme/identica/images/icons/twotone/green/calendar.gif [deleted file]
theme/identica/images/icons/twotone/green/calendar2.gif [deleted file]
theme/identica/images/icons/twotone/green/camera.gif [deleted file]
theme/identica/images/icons/twotone/green/cart.gif [deleted file]
theme/identica/images/icons/twotone/green/caution.gif [deleted file]
theme/identica/images/icons/twotone/green/chart.gif [deleted file]
theme/identica/images/icons/twotone/green/checkmark.gif [deleted file]
theme/identica/images/icons/twotone/green/clipboard.gif [deleted file]
theme/identica/images/icons/twotone/green/clock.gif [deleted file]
theme/identica/images/icons/twotone/green/closed-folder.gif [deleted file]
theme/identica/images/icons/twotone/green/database.gif [deleted file]
theme/identica/images/icons/twotone/green/disfavourite.gif [deleted file]
theme/identica/images/icons/twotone/green/diskette.gif [deleted file]
theme/identica/images/icons/twotone/green/document.gif [deleted file]
theme/identica/images/icons/twotone/green/double-arrow.gif [deleted file]
theme/identica/images/icons/twotone/green/edit.gif [deleted file]
theme/identica/images/icons/twotone/green/eject.gif [deleted file]
theme/identica/images/icons/twotone/green/exclaim.gif [deleted file]
theme/identica/images/icons/twotone/green/fastforward.gif [deleted file]
theme/identica/images/icons/twotone/green/favourite.gif [deleted file]
theme/identica/images/icons/twotone/green/flag.gif [deleted file]
theme/identica/images/icons/twotone/green/graph.gif [deleted file]
theme/identica/images/icons/twotone/green/grow.gif [deleted file]
theme/identica/images/icons/twotone/green/headphones.gif [deleted file]
theme/identica/images/icons/twotone/green/home.gif [deleted file]
theme/identica/images/icons/twotone/green/hourglass.gif [deleted file]
theme/identica/images/icons/twotone/green/info.gif [deleted file]
theme/identica/images/icons/twotone/green/key.gif [deleted file]
theme/identica/images/icons/twotone/green/lock.gif [deleted file]
theme/identica/images/icons/twotone/green/mail.gif [deleted file]
theme/identica/images/icons/twotone/green/move.gif [deleted file]
theme/identica/images/icons/twotone/green/music.gif [deleted file]
theme/identica/images/icons/twotone/green/news.gif [deleted file]
theme/identica/images/icons/twotone/green/note.gif [deleted file]
theme/identica/images/icons/twotone/green/open-folder.gif [deleted file]
theme/identica/images/icons/twotone/green/paper-clip.gif [deleted file]
theme/identica/images/icons/twotone/green/paper-clip2.gif [deleted file]
theme/identica/images/icons/twotone/green/pause.gif [deleted file]
theme/identica/images/icons/twotone/green/phone.gif [deleted file]
theme/identica/images/icons/twotone/green/play.gif [deleted file]
theme/identica/images/icons/twotone/green/plus.gif [deleted file]
theme/identica/images/icons/twotone/green/print.gif [deleted file]
theme/identica/images/icons/twotone/green/question-mark.gif [deleted file]
theme/identica/images/icons/twotone/green/quote.gif [deleted file]
theme/identica/images/icons/twotone/green/refresh.gif [deleted file]
theme/identica/images/icons/twotone/green/reply.gif [deleted file]
theme/identica/images/icons/twotone/green/rewind.gif [deleted file]
theme/identica/images/icons/twotone/green/search.gif [deleted file]
theme/identica/images/icons/twotone/green/shield.gif [deleted file]
theme/identica/images/icons/twotone/green/skip-back.gif [deleted file]
theme/identica/images/icons/twotone/green/skip.gif [deleted file]
theme/identica/images/icons/twotone/green/skull.gif [deleted file]
theme/identica/images/icons/twotone/green/statusbar.gif [deleted file]
theme/identica/images/icons/twotone/green/stop.gif [deleted file]
theme/identica/images/icons/twotone/green/template.gif [deleted file]
theme/identica/images/icons/twotone/green/text-bigger.gif [deleted file]
theme/identica/images/icons/twotone/green/text-smaller.gif [deleted file]
theme/identica/images/icons/twotone/green/trash.gif [deleted file]
theme/identica/images/icons/twotone/green/two-docs.gif [deleted file]
theme/identica/images/icons/twotone/green/twotone.gif [deleted file]
theme/identica/images/icons/twotone/green/undo.gif [deleted file]
theme/identica/images/icons/twotone/green/user.gif [deleted file]
theme/identica/images/icons/twotone/green/vegetable.gif [deleted file]
theme/identica/images/icons/twotone/green/x.gif [deleted file]
theme/identica/images/icons/twotone/green/zoom-in.gif [deleted file]
theme/identica/images/icons/twotone/green/zoom-out.gif [deleted file]
theme/otalk/css/base.css [new file with mode: 0644]
theme/otalk/css/display.css [new file with mode: 0644]
theme/otalk/css/ie.css [new file with mode: 0644]
theme/otalk/default-avatar-mini.png [new file with mode: 0644]
theme/otalk/default-avatar-profile.png [new file with mode: 0644]
theme/otalk/default-avatar-stream.png [new file with mode: 0644]
theme/otalk/images/illustrations/illu_arrow-left-01.gif [new file with mode: 0644]
theme/otalk/images/illustrations/illu_pattern-01.png [new file with mode: 0644]
theme/otalk/logo.png [new file with mode: 0644]
theme/pigeonthoughts/css/base.css [new file with mode: 0644]
theme/pigeonthoughts/css/display.css [new file with mode: 0644]
theme/pigeonthoughts/css/ie.css [new file with mode: 0644]
theme/pigeonthoughts/default-avatar-mini.png [new file with mode: 0644]
theme/pigeonthoughts/default-avatar-profile.png [new file with mode: 0644]
theme/pigeonthoughts/default-avatar-stream.png [new file with mode: 0644]
theme/pigeonthoughts/images/illustrations/illu_pigeons-01.png [new file with mode: 0644]
theme/pigeonthoughts/images/illustrations/illu_pigeons-02.png [new file with mode: 0644]
theme/pigeonthoughts/logo.png [new file with mode: 0644]
theme/readme.txt

index e0ce1166679a90f4e5c6289d9bc7f8dafaa94a13..8e917f11de864605b5e561caf1b797f33a3d0e96 100644 (file)
@@ -109,5 +109,11 @@ EndSubGroupNav: At the end of the subscriptions group nav menu
 RouterInitialized: After the router instance has been initialized
 - $m: the Net_URL_Mapper that has just been set up
 
+StartLogout: Before logging out
+- $action: the logout action
+
+EndLogout: After logging out
+- $action: the logout action
+
 ArgsInitialized: After the argument array has been initialized
 - $args: associative array of arguments, can be modified
diff --git a/README b/README
index 4649eb79ce275b4aa78f9d324af015e846fcee3f..db912f201616bff07dc0807a088111fe48484818 100644 (file)
--- a/README
+++ b/README
@@ -176,6 +176,10 @@ and the URLs are listed here for your convenience.
   version may render your Laconica site unable to send or receive XMPP
   messages.
 - Facebook library. Used for the Facebook application.
+- PEAR Services_oEmbed. Used for some multimedia integration.
+- PEAR HTTP_Request is an oEmbed dependency.
+- PEAR Validat is an oEmbed dependency.e
+- PEAR Net_URL is an oEmbed dependency.2
 
 A design goal of Laconica is that the basic Web functionality should
 work on even the most restrictive commercial hosting services.
@@ -1166,6 +1170,32 @@ welcome: nickname of a user account that sends welcome messages to new
 If either of these special user accounts are specified, the users should
 be created before the configuration is updated.
 
+snapshot
+--------
+
+The software will, by default, send statistical snapshots about the
+local installation to a stats server on the laconi.ca Web site. This
+data is used by the developers to prioritize development decisions. No
+identifying data about users or organizations is collected. The data
+is available to the public for review. Participating in this survey
+helps Laconica developers take your needs into account when updating
+the software.
+
+run: string indicating when to run the statistics. Values can be 'web'
+     (run occasionally at Web time), 'cron' (run from a cron script),
+     or 'never' (don't ever run). If you set it to 'cron', remember to
+     schedule the script to run on a regular basis.
+frequency: if run value is 'web', how often to report statistics.
+           Measured in Web hits; depends on how active your site is.
+           Default is 10000 -- that is, one report every 10000 Web hits,
+           on average.
+reporturl: URL to post statistics to. Defaults to Laconica developers'
+           report system, but if they go evil or disappear you may
+           need to update this to another value. Note: if you
+           don't want to report stats, it's much better to
+           set 'run' to 'never' than to set this value to something
+           nonsensical.
+
 Troubleshooting
 ===============
 
index 8762b4bcd3efc974831252987f72b8bb33bd4041..b25ba99f30cfcf44b56f6a477856b9c1c82e675c 100644 (file)
@@ -67,6 +67,7 @@ class ApiAction extends Action
                     $this->process_command();
                 } else {
                     # basic authentication failed
+                    common_log(LOG_WARNING, "Failed API auth attempt, nickname: $nickname.");
                     $this->show_basic_auth_error();
                 }
             }
diff --git a/actions/attachment.php b/actions/attachment.php
new file mode 100644 (file)
index 0000000..16ee723
--- /dev/null
@@ -0,0 +1,205 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/attachmentlist.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class AttachmentAction extends Action
+{
+    /**
+     * Attachment object to show
+     */
+
+    var $attachment = null;
+
+    /**
+     * Load attributes based on database arguments
+     *
+     * Loads all the DB stuff
+     *
+     * @param array $args $_REQUEST array
+     *
+     * @return success flag
+     */
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+
+        if ($id = $this->trimmed('attachment')) {
+            $this->attachment = File::staticGet($id);
+        }
+
+        if (empty($this->attachment)) {
+            $this->clientError(_('No such attachment.'), 404);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Is this action read-only?
+     *
+     * @return boolean true
+     */
+
+    function isReadOnly($args)
+    {
+        return true;
+    }
+
+    /**
+     * Title of the page
+     *
+     * @return string title of the page
+     */
+    function title()
+    {
+        $a = new Attachment($this->attachment);
+        return $a->title();
+    }
+
+    /**
+     * Last-modified date for page
+     *
+     * When was the content of this page last modified? Based on notice,
+     * profile, avatar.
+     *
+     * @return int last-modified date as unix timestamp
+     */
+/*
+    function lastModified()
+    {
+        return max(strtotime($this->notice->created),
+                   strtotime($this->profile->modified),
+                   ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+    }
+*/
+
+    /**
+     * An entity tag for this page
+     *
+     * Shows the ETag for the page, based on the notice ID and timestamps
+     * for the notice, profile, and avatar. It's weak, since we change
+     * the date text "one hour ago", etc.
+     *
+     * @return string etag
+     */
+/*
+    function etag()
+    {
+        $avtime = ($this->avatar) ?
+          strtotime($this->avatar->modified) : 0;
+
+        return 'W/"' . implode(':', array($this->arg('action'),
+                                          common_language(),
+                                          $this->notice->id,
+                                          strtotime($this->notice->created),
+                                          strtotime($this->profile->modified),
+                                          $avtime)) . '"';
+    }
+*/
+
+
+    /**
+     * Handle input
+     *
+     * Only handles get, so just show the page.
+     *
+     * @param array $args $_REQUEST data (unused)
+     *
+     * @return void
+     */
+
+    function handle($args)
+    {
+        parent::handle($args);
+        $this->showPage();
+    }
+
+    /**
+     * Don't show local navigation
+     *
+     * @return void
+     */
+
+    function showLocalNavBlock()
+    {
+    }
+
+    /**
+     * Fill the content area of the page
+     *
+     * Shows a single notice list item.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $ali = new Attachment($this->attachment, $this);
+        $cnt = $ali->show();
+    }
+
+    /**
+     * Don't show page notice
+     *
+     * @return void
+     */
+
+    function showPageNoticeBlock()
+    {
+    }
+
+    /**
+     * Show aside: this attachments appears in what notices
+     *
+     * @return void
+     */
+    function showSections() {
+        $ns = new AttachmentNoticeSection($this);
+        $ns->show();
+        $atcs = new AttachmentTagCloudSection($this);
+        $atcs->show();
+    }
+}
+
diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php
new file mode 100644 (file)
index 0000000..3d83393
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/actions/attachment.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class Attachment_ajaxAction extends AttachmentAction
+{
+    /**
+     * Show page, a template method.
+     *
+     * @return nothing
+     */
+    function showPage()
+    {
+        if (Event::handle('StartShowBody', array($this))) {
+            $this->showCore();
+            Event::handle('EndShowBody', array($this));
+        }
+    }
+
+    /**
+     * Show core.
+     *
+     * Shows local navigation, content block and aside.
+     *
+     * @return nothing
+     */
+    function showCore()
+    {
+        $this->elementStart('div', array('id' => 'core'));
+        if (Event::handle('StartShowContentBlock', array($this))) {
+            $this->showContentBlock();
+            Event::handle('EndShowContentBlock', array($this));
+        }
+        $this->elementEnd('div');
+    }
+
+    /**
+     * Last-modified date for page
+     *
+     * When was the content of this page last modified? Based on notice,
+     * profile, avatar.
+     *
+     * @return int last-modified date as unix timestamp
+     */
+/*
+    function lastModified()
+    {
+        return max(strtotime($this->notice->created),
+                   strtotime($this->profile->modified),
+                   ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+    }
+*/
+
+    /**
+     * An entity tag for this page
+     *
+     * Shows the ETag for the page, based on the notice ID and timestamps
+     * for the notice, profile, and avatar. It's weak, since we change
+     * the date text "one hour ago", etc.
+     *
+     * @return string etag
+     */
+/*
+    function etag()
+    {
+        $avtime = ($this->avatar) ?
+          strtotime($this->avatar->modified) : 0;
+
+        return 'W/"' . implode(':', array($this->arg('action'),
+                                          common_language(),
+                                          $this->notice->id,
+                                          strtotime($this->notice->created),
+                                          strtotime($this->profile->modified),
+                                          $avtime)) . '"';
+    }
+*/
+}
+
diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php
new file mode 100644 (file)
index 0000000..b4070e7
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/actions/attachment.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class Attachment_thumbnailAction extends AttachmentAction
+{
+    /**
+     * Show page, a template method.
+     *
+     * @return nothing
+     */
+    function showPage()
+    {
+        if (Event::handle('StartShowBody', array($this))) {
+            $this->showCore();
+            Event::handle('EndShowBody', array($this));
+        }
+    }
+
+    /**
+     * Show core.
+     *
+     * Shows local navigation, content block and aside.
+     *
+     * @return nothing
+     */
+    function showCore()
+    {
+        $file_thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
+        if (empty($file_thumbnail->url)) {
+            return;
+        }
+        $this->element('img', array('src' => $file_thumbnail->url, 'alt' => 'Thumbnail'));
+    }
+
+    /**
+     * Last-modified date for page
+     *
+     * When was the content of this page last modified? Based on notice,
+     * profile, avatar.
+     *
+     * @return int last-modified date as unix timestamp
+     */
+/*
+    function lastModified()
+    {
+        return max(strtotime($this->notice->created),
+                   strtotime($this->profile->modified),
+                   ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+    }
+*/
+
+    /**
+     * An entity tag for this page
+     *
+     * Shows the ETag for the page, based on the notice ID and timestamps
+     * for the notice, profile, and avatar. It's weak, since we change
+     * the date text "one hour ago", etc.
+     *
+     * @return string etag
+     */
+/*
+    function etag()
+    {
+        $avtime = ($this->avatar) ?
+          strtotime($this->avatar->modified) : 0;
+
+        return 'W/"' . implode(':', array($this->arg('action'),
+                                          common_language(),
+                                          $this->notice->id,
+                                          strtotime($this->notice->created),
+                                          strtotime($this->profile->modified),
+                                          $avtime)) . '"';
+    }
+*/
+}
+
diff --git a/actions/conversation.php b/actions/conversation.php
new file mode 100644 (file)
index 0000000..ef18901
--- /dev/null
@@ -0,0 +1,298 @@
+<?php
+/**
+ * Display a conversation in the browser
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ *
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2009, Control Yourself, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/noticelist.php';
+
+/**
+ * Conversation tree in the browser
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ */
+
+class ConversationAction extends Action
+{
+    var $id   = null;
+    var $page = null;
+
+    /**
+     * Initialization.
+     *
+     * @param array $args Web and URL arguments
+     *
+     * @return boolean false if id not passed in
+     */
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+        $this->id = $this->trimmed('id');
+        if (empty($this->id)) {
+            return false;
+        }
+        $this->page = $this->trimmed('page');
+        if (empty($this->page)) {
+            $this->page = 1;
+        }
+        return true;
+    }
+
+    /**
+     * Handle the action
+     *
+     * @param array $args Web and URL arguments
+     *
+     * @return void
+     */
+
+    function handle($args)
+    {
+        parent::handle($args);
+        $this->showPage();
+    }
+
+    /**
+     * Returns the page title
+     *
+     * @return string page title
+     */
+
+    function title()
+    {
+        return _("Conversation");
+    }
+
+    /**
+     * Show content.
+     *
+     * Display a hierarchical unordered list in the content area.
+     * Uses ConversationTree to do most of the heavy lifting.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        // FIXME this needs to be a tree, not a list
+
+        $qry = 'SELECT * FROM notice WHERE conversation = %s ';
+
+        $offset = ($this->page-1) * NOTICES_PER_PAGE;
+        $limit  = NOTICES_PER_PAGE + 1;
+
+        $txt = sprintf($qry, $this->id);
+
+        $notices = Notice::getStream($txt,
+                                     'notice:conversation:'.$this->id,
+                                     $offset, $limit);
+
+        $ct = new ConversationTree($notices, $this);
+
+        $cnt = $ct->show();
+
+        $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+                          $this->page, 'conversation', array('id' => $this->id));
+    }
+
+}
+
+/**
+ * Conversation tree
+ *
+ * The widget class for displaying a hierarchical list of notices.
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ */
+
+class ConversationTree extends NoticeList
+{
+    var $tree  = null;
+    var $table = null;
+
+    /**
+     * Show the tree of notices
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $cnt = 0;
+
+        $this->tree  = array();
+        $this->table = array();
+
+        while ($this->notice->fetch()) {
+
+            $cnt++;
+
+            $id     = $this->notice->id;
+            $notice = clone($this->notice);
+
+            $this->table[$id] = $notice;
+
+            if (is_null($notice->reply_to)) {
+                $this->tree['root'] = array($notice->id);
+            } else if (array_key_exists($notice->reply_to, $this->tree)) {
+                $this->tree[$notice->reply_to][] = $notice->id;
+            } else {
+                $this->tree[$notice->reply_to] = array($notice->id);
+            }
+        }
+
+        $this->out->elementStart('div', array('id' =>'notices_primary'));
+        $this->out->element('h2', null, _('Notices'));
+        $this->out->elementStart('ul', array('class' => 'notices'));
+
+        if (array_key_exists('root', $this->tree)) {
+            $rootid = $this->tree['root'][0];
+            $this->showNoticePlus($rootid);
+        }
+
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('div');
+
+        return $cnt;
+    }
+
+    /**
+     * Shows a notice plus its list of children.
+     *
+     * @param integer $id ID of the notice to show
+     *
+     * @return void
+     */
+
+    function showNoticePlus($id)
+    {
+        $notice = $this->table[$id];
+
+        // We take responsibility for doing the li
+
+        $this->out->elementStart('li', array('class' => 'hentry notice',
+                                             'id' => 'notice-' . $this->notice->id));
+
+        $item = $this->newListItem($notice);
+        $item->show();
+
+        if (array_key_exists($id, $this->tree)) {
+            $children = $this->tree[$id];
+
+            $this->out->elementStart('ul', array('class' => 'notices'));
+
+            foreach ($children as $child) {
+                $this->showNoticePlus($child);
+            }
+
+            $this->out->elementEnd('ul');
+        }
+
+        $this->out->elementEnd('li');
+    }
+
+    /**
+     * Override parent class to return our preferred item.
+     *
+     * @param Notice $notice Notice to display
+     *
+     * @return NoticeListItem a list item to show
+     */
+
+    function newListItem($notice)
+    {
+        return new ConversationTreeItem($notice, $this->out);
+    }
+}
+
+/**
+ * Conversation tree list item
+ *
+ * Special class of NoticeListItem for use inside conversation trees.
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ */
+
+class ConversationTreeItem extends NoticeListItem
+{
+    /**
+     * start a single notice.
+     *
+     * The default creates the <li>; we skip, since the ConversationTree
+     * takes care of that.
+     *
+     * @return void
+     */
+
+    function showStart()
+    {
+        return;
+    }
+
+    /**
+     * finish the notice
+     *
+     * The default closes the <li>; we skip, since the ConversationTree
+     * takes care of that.
+     *
+     * @return void
+     */
+
+    function showEnd()
+    {
+        return;
+    }
+
+    /**
+     * show link to notice conversation page
+     *
+     * Since we're only used on the conversation page, we skip this
+     *
+     * @return void
+     */
+
+    function showContext()
+    {
+        return;
+    }
+}
\ No newline at end of file
index 6c350b33ab36e3c45d278f5009f20d1259ef435c..e733f9650ad12eb2e75960f3bdec0df9054a5019 100644 (file)
@@ -112,8 +112,8 @@ class DeletenoticeAction extends DeleteAction
         $this->hidden('token', common_session_token());
         $this->hidden('notice', $this->trimmed('notice'));
         $this->element('p', null, _('Are you sure you want to delete this notice?'));
-        $this->submit('form_action-yes', _('Yes'), 'submit form_action-primary', 'yes');
-        $this->submit('form_action-no', _('No'), 'submit form_action-secondary', 'no');
+        $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not delete this notice"));
+        $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this notice'));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
     }
diff --git a/actions/designsettings.php b/actions/designsettings.php
new file mode 100644 (file)
index 0000000..315e5a1
--- /dev/null
@@ -0,0 +1,264 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Change user password
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
+
+
+
+class DesignsettingsAction extends AccountSettingsAction
+{
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
+    {
+        return _('Profile design');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
+    {
+        return _('Customize the way your profile looks with a background image and a colour palette of your choice.');
+    }
+
+    /**
+     * Content area of the page
+     *
+     * Shows a form for changing the password
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $user = common_current_user();
+        $this->elementStart('form', array('method' => 'POST',
+                                          'id' => 'form_settings_design',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('designsettings')));
+        $this->elementStart('fieldset');
+        $this->hidden('token', common_session_token());
+
+        $this->elementStart('fieldset', array('id' => 'settings_design_background-image'));
+        $this->element('legend', null, _('Change background image'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->element('label', array('for' => 'design_ background-image_file'), 
+                                _('Upload file'));
+        $this->element('input', array('name' => 'design_background-image_file',
+                                      'type' => 'file',
+                                      'id' => 'design_background-image_file'));
+        $this->element('p', 'form_guide', _('You can upload your personal background image. The maximum file size is 2Mb.'));
+        $this->element('input', array('name' => 'MAX_FILE_SIZE',
+                                      'type' => 'hidden',
+                                      'id' => 'MAX_FILE_SIZE',
+                                      'value' => ImageFile::maxFileSizeInt()));
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->elementEnd('fieldset');
+
+        $this->elementStart('fieldset', array('id' => 'settings_design_color'));
+        $this->element('legend', null, _('Change colours'));
+        $this->elementStart('ul', 'form_data');
+
+        //This is a JSON object in the DB field. Here for testing. Remove later.
+        $userSwatch = '{"body":{"background-color":"#F0F2F5"},
+                        "#content":{"background-color":"#FFFFFF"},
+                        "#aside_primary":{"background-color":"#CEE1E9"},
+                        "html body":{"color":"#000000"},
+                        "a":{"color":"#002E6E"}}';
+
+        //Default theme swatch -- Where should this be stored?
+        $defaultSwatch = array('body' => array('background-color' => '#F0F2F5'),
+                               '#content' => array('background-color' => '#FFFFFF'),
+                               '#aside_primary' => array('background-color' => '#CEE1E9'),
+                               'html body' => array('color' => '#000000'),
+                               'a' => array('color' => '#002E6E'));
+
+        $userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
+
+        $s = 0;
+        $labelSwatch = array('Background',
+                             'Content',
+                             'Sidebar',
+                             'Text',
+                             'Links');
+        foreach($userSwatch as $propertyvalue => $value) {
+            $foo = array_values($value);
+            $this->elementStart('li');
+            $this->element('label', array('for' => 'swatch-'.$s), _($labelSwatch[$s]));
+            $this->element('input', array('name' => 'swatch-'.$s, //prefer swatch[$s] ?
+                                          'type' => 'text',
+                                          'id' => 'swatch-'.$s,
+                                          'class' => 'swatch',
+                                          'maxlength' => '7',
+                                          'size' => '7',
+                                          'value' => $foo[0]));
+            $this->elementEnd('li');
+            $s++;
+        }
+
+        $this->elementEnd('ul');
+        $this->elementEnd('fieldset');
+
+        $this->element('input', array('id' => 'settings_design_reset',
+                                      'type' => 'reset',
+                                      'value' => 'Reset',
+                                      'class' => 'submit form_action-primary',
+                                      'title' => _('Reset back to default')));
+        $this->submit('save', _('Save'), 'submit form_action-secondary', 'save', _('Save design'));
+
+/*TODO: Check submitted form values: 
+json_encode(form values)
+if submitted Swatch == DefaultSwatch, don't store in DB.
+else store in BD
+*/
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
+
+    }
+
+    /**
+     * Handle a post
+     *
+     * Validate input and save changes. Reload the form with a success
+     * or error message.
+     *
+     * @return void
+     */
+
+    function handlePost()
+    {
+    /*
+        // CSRF protection
+
+        $token = $this->trimmed('token');
+        if (!$token || $token != common_session_token()) {
+            $this->showForm(_('There was a problem with your session token. '.
+                               'Try again, please.'));
+            return;
+        }
+
+        $user = common_current_user();
+        assert(!is_null($user)); // should already be checked
+
+        // FIXME: scrub input
+
+        $newpassword = $this->arg('newpassword');
+        $confirm     = $this->arg('confirm');
+
+        # Some validation
+
+        if (strlen($newpassword) < 6) {
+            $this->showForm(_('Password must be 6 or more characters.'));
+            return;
+        } else if (0 != strcmp($newpassword, $confirm)) {
+            $this->showForm(_('Passwords don\'t match.'));
+            return;
+        }
+
+        if ($user->password) {
+            $oldpassword = $this->arg('oldpassword');
+
+            if (!common_check_user($user->nickname, $oldpassword)) {
+                $this->showForm(_('Incorrect old password'));
+                return;
+            }
+        }
+
+        $original = clone($user);
+
+        $user->password = common_munge_password($newpassword, $user->id);
+
+        $val = $user->validate();
+        if ($val !== true) {
+            $this->showForm(_('Error saving user; invalid.'));
+            return;
+        }
+
+        if (!$user->update($original)) {
+            $this->serverError(_('Can\'t save new password.'));
+            return;
+        }
+
+        $this->showForm(_('Password saved.'), true);
+        */
+    }
+
+
+    /**
+     * Add the Farbtastic stylesheet
+     *
+     * @return void
+     */
+
+    function showStylesheets()
+    {
+        parent::showStylesheets();
+        $farbtasticStyle =
+          common_path('theme/base/css/farbtastic.css?version='.LACONICA_VERSION);
+
+        $this->element('link', array('rel' => 'stylesheet',
+                                     'type' => 'text/css',
+                                     'href' => $farbtasticStyle,
+                                     'media' => 'screen, projection, tv'));
+    }
+
+    /**
+     * Add the Farbtastic scripts
+     *
+     * @return void
+     */
+
+    function showScripts()
+    {
+        parent::showScripts();
+
+        $farbtasticPack = common_path('js/farbtastic/farbtastic.js');
+        $farbtasticGo   = common_path('js/farbtastic/farbtastic.go.js');
+
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => $farbtasticPack));
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => $farbtasticGo));
+    }
+}
index 4c2b26355ca65a2c469155d270438327dd25fbf3..00b35ef6868aa238c50a8e1b8a9d3a1b13b64cd5 100644 (file)
@@ -115,7 +115,7 @@ class FacebookhomeAction extends FacebookAction
                 $flink->foreign_id = $this->fbuid;
                 $flink->service = FACEBOOK_SERVICE;
                 $flink->created = common_sql_now();
-                $flink->set_flags(true, false, false);
+                $flink->set_flags(true, false, false, false);
 
                 $flink_id = $flink->insert();
 
index 236460c1c9a42f1f15463aa69959fddb802fbf97..227e123160900d22a0b8d4d7563f229de4984e55 100644 (file)
@@ -55,7 +55,7 @@ class FacebooksettingsAction extends FacebookAction
         $prefix = $this->trimmed('prefix');
 
         $original = clone($this->flink);
-        $this->flink->set_flags($noticesync, $replysync, false);
+        $this->flink->set_flags($noticesync, $replysync, false, false);
         $result = $this->flink->update($original);
 
         $this->facebook->api_client->data_setUserPreference(FACEBOOK_NOTICE_PREFIX,
index 9f3bfe2470a2253d0e93acd9ca3ec2bf976c5423..c34b10987a76985e08c15ad8adc8ac8f5a3211bb 100644 (file)
@@ -70,10 +70,20 @@ class LogoutAction extends Action
         if (!common_logged_in()) {
             $this->clientError(_('Not logged in.'));
         } else {
-            common_set_user(null);
-            common_real_login(false); // not logged in
-            common_forgetme(); // don't log back in!
+            if (Event::handle('StartLogout', array($this))) {
+                $this->logout();
+            }
+            Event::handle('EndLogout', array($this));
+
             common_redirect(common_local_url('public'), 303);
         }
     }
+
+    function logout()
+    {
+        common_set_user(null);
+        common_real_login(false); // not logged in
+        common_forgetme(); // don't log back in!
+    }
+
 }
index cbd04c58b226c0a609c44996f7048bcf28f7abcd..ae0ff9636335809f2e9aaca4697d56b567e85332 100644 (file)
@@ -158,7 +158,8 @@ class NewnoticeAction extends Action
             $replyto = 'false';
         }
 
-        $notice = Notice::saveNew($user->id, $content, 'web', 1,
+//        $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
+        $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
                                   ($replyto == 'false') ? null : $replyto);
 
         if (is_string($notice)) {
@@ -166,6 +167,8 @@ class NewnoticeAction extends Action
             return;
         }
 
+        $this->saveUrls($notice);
+
         common_broadcast_notice($notice);
 
         if ($this->boolean('ajax')) {
@@ -191,6 +194,24 @@ class NewnoticeAction extends Action
         }
     }
 
+    /** save all urls in the notice to the db
+     *
+     * follow redirects and save all available file information
+     * (mimetype, date, size, oembed, etc.)
+     *
+     * @param class $notice Notice to pull URLs from
+     *
+     * @return void
+     */
+    function saveUrls($notice) {
+        common_replace_urls_callback($notice->content, array($this, 'saveUrl'), $notice->id);
+    }
+
+    function saveUrl($data) {
+        list($url, $notice_id) = $data;
+        $zzz = File::processNew($url, $notice_id);
+    }
+
     /**
      * Show an Ajax-y error message
      *
index 033cf557f8959d7ded047794425207e82a1b82ca..dcbbbdb6a6de9afb238715b7ff1cac3d78f40b7d 100644 (file)
@@ -382,6 +382,19 @@ class RegisterAction extends Action
 
     function showFormContent()
     {
+        $code = $this->trimmed('code');
+
+        $invite = null;
+
+        if ($code) {
+            $invite = Invitation::staticGet($code);
+        }
+
+        if (common_config('site', 'inviteonly') && !($code && $invite)) {
+            $this->clientError(_('Sorry, only invited people can register.'));
+            return;
+        }
+
         $this->elementStart('form', array('method' => 'post',
                                           'id' => 'form_register',
                                           'class' => 'form_settings',
index 82665e5b8b3841f1c68015ecb0be4359a617128b..678a3174c151800a482b35c41bfdb71f6245a691 100644 (file)
@@ -68,6 +68,9 @@ class ShowstreamAction extends ProfileAction
         } else {
             $base = $this->user->nickname;
         }
+        if (!empty($this->tag)) {
+            $base .= sprintf(_(' tagged %s'), $this->tag);
+        }
 
         if ($this->page == 1) {
             return $base;
@@ -110,6 +113,15 @@ class ShowstreamAction extends ProfileAction
 
     function getFeeds()
     {
+        if (!empty($this->tag)) {
+            return array(new Feed(Feed::RSS1,
+                common_local_url('userrss',
+                    array('nickname' => $this->user->nickname,
+                        'tag' => $this->tag)),
+                sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
+                    $this->user->nickname, $this->tag)));
+        }
+
         return array(new Feed(Feed::RSS1,
                               common_local_url('userrss',
                                                array('nickname' => $this->user->nickname)),
@@ -363,7 +375,9 @@ class ShowstreamAction extends ProfileAction
 
     function showNotices()
     {
-        $notice = $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+        $notice = empty($this->tag)
+            ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
+            : $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag);
 
         $pnl = new ProfileNoticeList($notice, $this);
         $cnt = $pnl->show();
index 02f3e35225cca6976fc7efe5a8b0930b346664eb..e9351d24193a6cc066f5d1ff66bfb584ab780517 100644 (file)
@@ -51,7 +51,6 @@ class TagAction extends Action
         $pop->show();
     }
 
-
     function title()
     {
         if ($this->page == 1) {
index 0b98eef591ba086a3d8346907927eb0ae7c42456..2b742788eee55419112a718d271f6e4285960163 100644 (file)
@@ -138,7 +138,7 @@ class TwittersettingsAction extends ConnectSettingsAction
 
         $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
-        $this->checkbox('noticesync',
+        $this->checkbox('noticesend',
                         _('Automatically send my notices to Twitter.'),
                         ($flink) ?
                         ($flink->noticesync & FOREIGN_NOTICE_SEND) :
@@ -158,6 +158,22 @@ class TwittersettingsAction extends ConnectSettingsAction
                         ($flink->friendsync & FOREIGN_FRIEND_RECV) :
                         false);
         $this->elementEnd('li');
+
+        if (common_config('twitterbridge','enabled')) {
+            $this->elementStart('li');
+            $this->checkbox('noticerecv',
+                            _('Import my Friends Timeline.'),
+                            ($flink) ?
+                            ($flink->noticesync & FOREIGN_NOTICE_RECV) :
+                            false);
+            $this->elementEnd('li');
+        } else {
+            // preserve setting even if bidrection bridge toggled off
+            if ($flink && ($flink->noticesync & FOREIGN_NOTICE_RECV)) {
+                $this->hidden('noticerecv', true, 'noticerecv');
+            }
+        }
+
         $this->elementEnd('ul');
 
         if ($flink) {
@@ -320,7 +336,8 @@ class TwittersettingsAction extends ConnectSettingsAction
     {
         $screen_name = $this->trimmed('twitter_username');
         $password    = $this->trimmed('twitter_password');
-        $noticesync  = $this->boolean('noticesync');
+        $noticesend  = $this->boolean('noticesend');
+        $noticerecv  = $this->boolean('noticerecv');
         $replysync   = $this->boolean('replysync');
         $friendsync  = $this->boolean('friendsync');
 
@@ -363,7 +380,7 @@ class TwittersettingsAction extends ConnectSettingsAction
         $flink->credentials = $password;
         $flink->created     = common_sql_now();
 
-        $flink->set_flags($noticesync, $replysync, $friendsync);
+        $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync);
 
         $flink_id = $flink->insert();
 
@@ -421,7 +438,8 @@ class TwittersettingsAction extends ConnectSettingsAction
 
     function savePreferences()
     {
-        $noticesync = $this->boolean('noticesync');
+        $noticesend = $this->boolean('noticesend');
+        $noticerecv = $this->boolean('noticerecv');
         $friendsync = $this->boolean('friendsync');
         $replysync  = $this->boolean('replysync');
 
@@ -450,7 +468,7 @@ class TwittersettingsAction extends ConnectSettingsAction
 
         $original = clone($flink);
 
-        $flink->set_flags($noticesync, $replysync, $friendsync);
+        $flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync);
 
         $result = $flink->update($original);
 
index 5861d9ee3687bd7a4e79e6088ea30a059c690a2b..2280509b22942c372be42745684cfbbe9b292c4b 100644 (file)
@@ -25,14 +25,15 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
 
 class UserrssAction extends Rss10Action
 {
-
     var $user = null;
+    var $tag  = null;
 
     function prepare($args)
     {
         parent::prepare($args);
-        $nickname = $this->trimmed('nickname');
+        $nickname   = $this->trimmed('nickname');
         $this->user = User::staticGet('nickname', $nickname);
+        $this->tag  = $this->trimmed('tag');
 
         if (!$this->user) {
             $this->clientError(_('No such user.'));
@@ -42,6 +43,25 @@ class UserrssAction extends Rss10Action
         }
     }
 
+    function getTaggedNotices($tag = null, $limit=0)
+    {
+        $user = $this->user;
+
+        if (is_null($user)) {
+            return null;
+        }
+
+        $notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
+
+        $notices = array();
+        while ($notice->fetch()) {
+            $notices[] = clone($notice);
+        }
+
+        return $notices;
+    }
+
+
     function getNotices($limit=0)
     {
 
diff --git a/classes/File.php b/classes/File.php
new file mode 100644 (file)
index 0000000..e591311
--- /dev/null
@@ -0,0 +1,123 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
+require_once INSTALLDIR.'/classes/File_redirection.php';
+require_once INSTALLDIR.'/classes/File_oembed.php';
+require_once INSTALLDIR.'/classes/File_thumbnail.php';
+require_once INSTALLDIR.'/classes/File_to_post.php';
+//require_once INSTALLDIR.'/classes/File_redirection.php';
+
+/**
+ * Table Definition for file
+ */
+
+class File extends Memcached_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'file';                            // table name
+    public $id;                              // int(11)  not_null primary_key group_by
+    public $url;                             // varchar(255)  unique_key
+    public $mimetype;                        // varchar(50)  
+    public $size;                            // int(11)  group_by
+    public $title;                           // varchar(255)  
+    public $date;                            // int(11)  group_by
+    public $protected;                       // int(1)  group_by
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+    function isProtected($url) {
+        return 'http://www.facebook.com/login.php' === $url;
+    }
+
+    function getAttachments($post_id) {
+        $query = "select file.* from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $this->escape($post_id);
+        $this->query($query);
+        $att = array();
+        while ($this->fetch()) {
+            $att[] = clone($this);
+        }
+        $this->free();
+        return $att;
+    }
+
+    function saveNew($redir_data, $given_url) {
+        $x = new File;
+        $x->url = $given_url;
+        if (!empty($redir_data['protected'])) $x->protected = $redir_data['protected'];
+        if (!empty($redir_data['title'])) $x->title = $redir_data['title'];
+        if (!empty($redir_data['type'])) $x->mimetype = $redir_data['type'];
+        if (!empty($redir_data['size'])) $x->size = intval($redir_data['size']);
+        if (isset($redir_data['time']) && $redir_data['time'] > 0) $x->date = intval($redir_data['time']);
+        $file_id = $x->insert();
+
+        if (isset($redir_data['type'])
+            && ('text/html' === substr($redir_data['type'], 0, 9))
+            && ($oembed_data = File_oembed::_getOembed($given_url))
+            && isset($oembed_data['json'])) {
+
+            File_oembed::saveNew($oembed_data['json'], $file_id);
+        }
+        return $x;
+    }
+
+    function processNew($given_url, $notice_id) {
+        if (empty($given_url)) return -1;   // error, no url to process
+        $given_url = File_redirection::_canonUrl($given_url);
+        if (empty($given_url)) return -1;   // error, no url to process
+        $file = File::staticGet('url', $given_url);
+        if (empty($file->id)) {
+            $file_redir = File_redirection::staticGet('url', $given_url);
+            if (empty($file_redir->id)) {
+                $redir_data = File_redirection::where($given_url);
+                $redir_url = $redir_data['url'];
+                if ($redir_url === $given_url) {
+                    $x = File::saveNew($redir_data, $given_url);
+                    $file_id = $x->id;
+
+                } else {
+                    $x = File::processNew($redir_url, $notice_id);
+                    $file_id = $x->id;
+                    File_redirection::saveNew($redir_data, $file_id, $given_url);
+                }
+            } else {
+                $file_id = $file_redir->file_id;
+            }
+        } else {
+            $file_id = $file->id;
+            $x = $file;
+        }
+
+        if (empty($x)) {
+            $x = File::staticGet($file_id);
+            if (empty($x)) die('Impossible!');
+        }
+       
+        File_to_post::processNew($file_id, $notice_id);
+        return $x;
+    }
+}
diff --git a/classes/File_oembed.php b/classes/File_oembed.php
new file mode 100644 (file)
index 0000000..f1b2cb1
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
+
+/**
+ * Table Definition for file_oembed
+ */
+
+class File_oembed extends Memcached_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'file_oembed';                     // table name
+    public $id;                              // int(11)  not_null primary_key group_by
+    public $file_id;                         // int(11)  unique_key group_by
+    public $version;                         // varchar(20)  
+    public $type;                            // varchar(20)  
+    public $provider;                        // varchar(50)  
+    public $provider_url;                    // varchar(255)  
+    public $width;                           // int(11)  group_by
+    public $height;                          // int(11)  group_by
+    public $html;                            // blob(65535)  blob
+    public $title;                           // varchar(255)  
+    public $author_name;                     // varchar(50)  
+    public $author_url;                      // varchar(255)  
+    public $url;                             // varchar(255)  
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_oembed',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+
+    function _getOembed($url, $maxwidth = 500, $maxheight = 400, $format = 'json') {
+        $cmd = 'http://oohembed.com/oohembed/?url=' . urlencode($url);
+        if (is_int($maxwidth)) $cmd .= "&maxwidth=$maxwidth";
+        if (is_int($maxheight)) $cmd .= "&maxheight=$maxheight";
+        if (is_string($format)) $cmd .= "&format=$format";
+        $oe = @file_get_contents($cmd);
+        if (false === $oe) return false;
+        return array($format => (('json' === $format) ? json_decode($oe, true) : $oe));
+    }
+
+    function saveNew($data, $file_id) {
+        $file_oembed = new File_oembed;
+        $file_oembed->file_id = $file_id;
+        $file_oembed->version = $data['version'];
+        $file_oembed->type = $data['type'];
+        if (!empty($data['provider_name'])) $file_oembed->provider = $data['provider_name'];
+        if (!isset($file_oembed->provider) && !empty($data['provide'])) $file_oembed->provider = $data['provider'];
+        if (!empty($data['provide_url'])) $file_oembed->provider_url = $data['provider_url'];
+        if (!empty($data['width'])) $file_oembed->width = intval($data['width']);
+        if (!empty($data['height'])) $file_oembed->height = intval($data['height']);
+        if (!empty($data['html'])) $file_oembed->html = $data['html'];
+        if (!empty($data['title'])) $file_oembed->title = $data['title'];
+        if (!empty($data['author_name'])) $file_oembed->author_name = $data['author_name'];
+        if (!empty($data['author_url'])) $file_oembed->author_url = $data['author_url'];
+        if (!empty($data['url'])) $file_oembed->url = $data['url'];
+        $file_oembed->insert();
+        if (!empty($data['thumbnail_url'])) {
+            File_thumbnail::saveNew($data, $file_id);
+        }
+    }
+}
+
+
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
new file mode 100644 (file)
index 0000000..0eae681
--- /dev/null
@@ -0,0 +1,274 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
+require_once INSTALLDIR.'/classes/File.php';
+require_once INSTALLDIR.'/classes/File_oembed.php';
+
+define('USER_AGENT', 'Laconica user agent / file probe');
+
+
+/**
+ * Table Definition for file_redirection
+ */
+
+class File_redirection extends Memcached_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'file_redirection';                // table name
+    public $id;                              // int(11)  not_null primary_key group_by
+    public $url;                             // varchar(255)  unique_key
+    public $file_id;                         // int(11)  group_by
+    public $redirections;                    // int(11)  group_by
+    public $httpcode;                        // int(11)  group_by
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_redirection',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+
+
+    function _commonCurl($url, $redirs) {
+        $curlh = curl_init();
+        curl_setopt($curlh, CURLOPT_URL, $url);
+        curl_setopt($curlh, CURLOPT_AUTOREFERER, true); // # setup referer header when folowing redirects
+        curl_setopt($curlh, CURLOPT_CONNECTTIMEOUT, 10); // # seconds to wait
+        curl_setopt($curlh, CURLOPT_MAXREDIRS, $redirs); // # max number of http redirections to follow
+        curl_setopt($curlh, CURLOPT_USERAGENT, USER_AGENT);
+        curl_setopt($curlh, CURLOPT_FOLLOWLOCATION, true); // Follow redirects
+        curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($curlh, CURLOPT_FILETIME, true);
+        curl_setopt($curlh, CURLOPT_HEADER, true); // Include header in output
+        return $curlh;
+    }
+
+    function _redirectWhere_imp($short_url, $redirs = 10, $protected = false) {
+        if ($redirs < 0) return false;
+
+        // let's see if we know this...
+        $a = File::staticGet('url', $short_url);
+        if (empty($a->id)) {
+            $b = File_redirection::staticGet('url', $short_url);
+            if (empty($b->id)) {
+                // we'll have to figure it out
+            } else {
+                // this is a redirect to $b->file_id
+                $a = File::staticGet($b->file_id);
+                $url = $a->url;
+            }
+        } else {
+            // this is a direct link to $a->url
+            $url = $a->url;
+        }
+        if (isset($url)) {
+            return $url;
+        }
+
+
+
+        $curlh = File_redirection::_commonCurl($short_url, $redirs);
+        // Don't include body in output
+        curl_setopt($curlh, CURLOPT_NOBODY, true);
+        curl_exec($curlh);
+        $info = curl_getinfo($curlh);
+        curl_close($curlh);
+
+        if (405 == $info['http_code']) {
+            $curlh = File_redirection::_commonCurl($short_url, $redirs);
+            curl_exec($curlh);
+            $info = curl_getinfo($curlh);
+            curl_close($curlh);
+        }
+
+        if (!empty($info['redirect_count']) && File::isProtected($info['url'])) {
+            return File_redirection::_redirectWhere_imp($short_url, $info['redirect_count'] - 1, true);
+        }
+
+        $ret = array('code' => $info['http_code']
+                , 'redirects' => $info['redirect_count']
+                , 'url' => $info['url']);
+
+        if (!empty($info['content_type'])) $ret['type'] = $info['content_type'];
+        if ($protected) $ret['protected'] = true;
+        if (!empty($info['download_content_length'])) $ret['size'] = $info['download_content_length'];
+        if (isset($info['filetime']) && ($info['filetime'] > 0)) $ret['time'] = $info['filetime'];
+        return $ret;
+    }
+
+    function where($in_url) {
+        $ret = File_redirection::_redirectWhere_imp($in_url);
+        return $ret;
+    }
+
+    function makeShort($long_url) {
+        $long_url = File_redirection::_canonUrl($long_url);
+        // do we already know this long_url and have a short redirection for it?
+        $file       = new File;
+        $file_redir = new File_redirection;
+        $file->url  = $long_url;
+        $file->joinAdd($file_redir);
+        $file->selectAdd('length(file_redirection.url) as len');
+        $file->limit(1);
+        $file->orderBy('len');
+        $file->find(true);
+        if (!empty($file->id)) {
+            return $file->url;
+        }
+
+        // if yet unknown, we must find a short url according to user settings
+        $short_url = File_redirection::_userMakeShort($long_url, common_current_user());
+        return $short_url;
+    }
+
+    function _userMakeShort($long_url, $user) {
+        if (empty($user)) {
+            // common current user does not find a user when called from the XMPP daemon
+            // therefore we'll set one here fix, so that XMPP given URLs may be shortened
+            $user->urlshorteningservice = 'ur1.ca';
+        }
+        $curlh = curl_init();
+        curl_setopt($curlh, CURLOPT_CONNECTTIMEOUT, 20); // # seconds to wait
+        curl_setopt($curlh, CURLOPT_USERAGENT, 'Laconica');
+        curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
+
+        switch($user->urlshorteningservice) {
+            case 'ur1.ca':
+                require_once INSTALLDIR.'/lib/Shorturl_api.php';
+                $short_url_service = new LilUrl;
+                $short_url = $short_url_service->shorten($long_url);
+                break;
+
+            case '2tu.us':
+                $short_url_service = new TightUrl;
+                require_once INSTALLDIR.'/lib/Shorturl_api.php';
+                $short_url = $short_url_service->shorten($long_url);
+                break;
+
+            case 'ptiturl.com':
+                require_once INSTALLDIR.'/lib/Shorturl_api.php';
+                $short_url_service = new PtitUrl;
+                $short_url = $short_url_service->shorten($long_url);
+                break;
+
+            case 'bit.ly':
+                curl_setopt($curlh, CURLOPT_URL, 'http://bit.ly/api?method=shorten&long_url='.urlencode($long_url));
+                $short_url = current(json_decode(curl_exec($curlh))->results)->hashUrl;
+                break;
+
+            case 'is.gd':
+                curl_setopt($curlh, CURLOPT_URL, 'http://is.gd/api.php?longurl='.urlencode($long_url));
+                $short_url = curl_exec($curlh);
+                break;
+            case 'snipr.com':
+                curl_setopt($curlh, CURLOPT_URL, 'http://snipr.com/site/snip?r=simple&link='.urlencode($long_url));
+                $short_url = curl_exec($curlh);
+                break;
+            case 'metamark.net':
+                curl_setopt($curlh, CURLOPT_URL, 'http://metamark.net/api/rest/simple?long_url='.urlencode($long_url));
+                $short_url = curl_exec($curlh);
+                break;
+            case 'tinyurl.com':
+                curl_setopt($curlh, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url='.urlencode($long_url));
+                $short_url = curl_exec($curlh);
+                break;
+            default:
+                $short_url = false;
+        }
+
+        curl_close($curlh);
+
+        if ($short_url) {
+            $short_url = (string)$short_url;
+            // store it
+            $file = File::staticGet('url', $long_url);
+            if (empty($file)) {
+                $redir_data = File_redirection::where($long_url);
+                $file = File::saveNew($redir_data, $long_url);
+                $file_id = $file->id;
+                if (!empty($redir_data['oembed']['json'])) {
+                    File_oembed::saveNew($redir_data['oembed']['json'], $file_id);
+                }
+            } else {
+                $file_id = $file->id;
+            }
+            $file_redir = File_redirection::staticGet('url', $short_url);
+            if (empty($file_redir)) {
+                $file_redir = new File_redirection;
+                $file_redir->url = $short_url;
+                $file_redir->file_id = $file_id;
+                $file_redir->insert();
+            }
+            return $short_url;
+        }
+        return $long_url;
+    }
+
+    function _canonUrl($in_url, $default_scheme = 'http://') {
+        if (empty($in_url)) return false;
+        $out_url = $in_url;
+        $p = parse_url($out_url);
+        if (empty($p['host']) || empty($p['scheme'])) {
+            list($scheme) = explode(':', $in_url, 2);
+            switch ($scheme) {
+            case 'fax':
+            case 'tel':
+                $out_url = str_replace('.-()', '', $out_url);
+                break;
+
+            case 'mailto':
+            case 'aim':
+            case 'jabber':
+            case 'xmpp':
+                // don't touch anything
+                break;
+
+            default:
+                $out_url = $default_scheme . ltrim($out_url, '/');
+                $p = parse_url($out_url);
+                if (empty($p['scheme'])) return false;
+                break;
+            }
+        }
+
+        if (('ftp' == $p['scheme']) || ('http' == $p['scheme']) || ('https' == $p['scheme'])) {
+            if (empty($p['host'])) return false;
+            if (empty($p['path'])) {
+                $out_url .= '/';
+            }
+        }
+
+        return $out_url;
+    }
+
+    function saveNew($data, $file_id, $url) {
+        $file_redir = new File_redirection;
+        $file_redir->url = $url;
+        $file_redir->file_id = $file_id;
+        $file_redir->redirections = intval($data['redirects']);
+        $file_redir->httpcode = intval($data['code']);
+        $file_redir->insert();
+    }
+}
+
diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php
new file mode 100644 (file)
index 0000000..1a65b92
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
+
+/**
+ * Table Definition for file_thumbnail
+ */
+
+class File_thumbnail extends Memcached_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'file_thumbnail';                  // table name
+    public $id;                              // int(11)  not_null primary_key group_by
+    public $file_id;                         // int(11)  unique_key group_by
+    public $url;                             // varchar(255)  unique_key
+    public $width;                           // int(11)  group_by
+    public $height;                          // int(11)  group_by
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_thumbnail',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+    function saveNew($data, $file_id) {
+        $tn = new File_thumbnail;
+        $tn->file_id = $file_id;
+        $tn->url = $data['thumbnail_url'];
+        $tn->width = intval($data['thumbnail_width']);
+        $tn->height = intval($data['thumbnail_height']);
+        $tn->insert();
+    }
+}
+
diff --git a/classes/File_to_post.php b/classes/File_to_post.php
new file mode 100644 (file)
index 0000000..00ddebe
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
+
+/**
+ * Table Definition for file_to_post
+ */
+
+class File_to_post extends Memcached_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'file_to_post';                    // table name
+    public $id;                              // int(11)  not_null primary_key group_by
+    public $file_id;                         // int(11)  multiple_key group_by
+    public $post_id;                         // int(11)  group_by
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('File_to_post',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+    function processNew($file_id, $notice_id) {
+        static $seen = array();
+        if (empty($seen[$notice_id]) || !in_array($file_id, $seen[$notice_id])) {
+            $f2p = new File_to_post;
+            $f2p->file_id = $file_id;
+            $f2p->post_id = $notice_id;
+            $f2p->insert();
+            if (empty($seen[$notice_id])) {
+                $seen[$notice_id] = array($file_id);
+            } else {
+                $seen[$notice_id][] = $file_id;
+            }
+        }
+
+    }
+}
+
index af2b3f189da54fb8cf1e0581dd3bfe3e5233b2cc..c0b356ecedd10473e13447d7a14157b8388dc63f 100644 (file)
@@ -11,7 +11,7 @@ class Foreign_link extends Memcached_DataObject
 
     public $__table = 'foreign_link';                    // table name
     public $user_id;                         // int(4)  primary_key not_null
-    public $foreign_id;                      // int(4)  primary_key not_null
+    public $foreign_id;                      // bigint(8)  primary_key not_null unsigned
     public $service;                         // int(4)  primary_key not_null
     public $credentials;                     // varchar(255)
     public $noticesync;                      // tinyint(1)   not_null default_1
@@ -59,13 +59,19 @@ class Foreign_link extends Memcached_DataObject
         return null;
     }
 
-    function set_flags($noticesync, $replysync, $friendsync)
+    function set_flags($noticesend, $noticerecv, $replysync, $friendsync)
     {
-        if ($noticesync) {
+        if ($noticesend) {
             $this->noticesync |= FOREIGN_NOTICE_SEND;
         } else {
             $this->noticesync &= ~FOREIGN_NOTICE_SEND;
         }
+        
+        if ($noticerecv) {
+            $this->noticesync |= FOREIGN_NOTICE_RECV;
+        } else {
+            $this->noticesync &= ~FOREIGN_NOTICE_RECV;
+        }
 
         if ($replysync) {
             $this->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 771a4e715f3d51811240c341defc381dced3fe33..1b5c0ab0a55afdc53592b860ec71ca414fa615a5 100644 (file)
@@ -46,6 +46,7 @@ class Notice extends Memcached_DataObject
     public $reply_to;                        // int(4)
     public $is_local;                        // tinyint(1)
     public $source;                          // varchar(32)
+    public $conversation;                    // int(4)
 
     /* Static get */
     function staticGet($k,$v=NULL) {
@@ -123,8 +124,6 @@ class Notice extends Memcached_DataObject
 
         $profile = Profile::staticGet($profile_id);
 
-        $final =  common_shorten_links($content);
-
         if (!$profile) {
             common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
             return _('Problem saving notice. Unknown user.');
@@ -135,7 +134,7 @@ class Notice extends Memcached_DataObject
             return _('Too many notices too fast; take a breather and post again in a few minutes.');
         }
 
-        if (common_config('site', 'dupelimit') > 0 && !Notice::checkDupes($profile_id, $final)) {
+        if (common_config('site', 'dupelimit') > 0 && !Notice::checkDupes($profile_id, $content)) {
             common_log(LOG_WARNING, 'Dupe posting by profile #' . $profile_id . '; throttled.');
                        return _('Too many duplicate messages too quickly; take a breather and post again in a few minutes.');
         }
@@ -166,11 +165,19 @@ class Notice extends Memcached_DataObject
 
                $notice->reply_to = $reply_to;
                $notice->created = common_sql_now();
-               $notice->content = $final;
-               $notice->rendered = common_render_content($final, $notice);
+               $notice->content = $content;
+               $notice->rendered = common_render_content($content, $notice);
                $notice->source = $source;
                $notice->uri = $uri;
 
+        if (!empty($reply_to)) {
+            $reply_notice = Notice::staticGet('id', $reply_to);
+            if (!empty($reply_notice)) {
+                $notice->reply_to = $reply_to;
+                $notice->conversation = $reply_notice->conversation;
+            }
+        }
+
         if (Event::handle('StartNoticeSave', array(&$notice))) {
 
             $id = $notice->insert();
@@ -270,6 +277,16 @@ class Notice extends Memcached_DataObject
         return true;
     }
 
+    function hasAttachments() {
+        $post = clone $this;
+        $query = "select count(file_id) as n_attachments from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $post->escape($post->id);
+        $post->query($query);
+        $post->fetch();
+        $n_attachments = intval($post->n_attachments);
+        $post->free();
+        return $n_attachments;
+    }
+
     function blowCaches($blowLast=false)
     {
         $this->blowSubsCache($blowLast);
@@ -847,6 +864,7 @@ class Notice extends Memcached_DataObject
                 if ($recipient_notice) {
                     $orig = clone($this);
                     $this->reply_to = $recipient_notice->id;
+                    $this->conversation = $recipient_notice->conversation;
                     $this->update($orig);
                 }
             }
@@ -896,6 +914,14 @@ class Notice extends Memcached_DataObject
             }
         }
 
+        // If it's not a reply, make it the root of a new conversation
+
+        if (empty($this->conversation)) {
+            $orig = clone($this);
+            $this->conversation = $this->id;
+            $this->update($orig);
+        }
+
         foreach (array_keys($replied) as $recipient) {
             $user = User::staticGet('id', $recipient);
             if ($user) {
@@ -998,7 +1024,7 @@ class Notice extends Memcached_DataObject
         }
     }
 
-    function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $since=null)
+    function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $before_id=0, $since=null, $tag=null)
     {
         $cache = common_memcache();
 
@@ -1006,7 +1032,7 @@ class Notice extends Memcached_DataObject
             $since_id != 0 || $before_id != 0 || !is_null($since) ||
             ($offset + $limit) > NOTICE_CACHE_WINDOW) {
             return call_user_func_array($fn, array_merge($args, array($offset, $limit, $since_id,
-                                                                      $before_id, $since)));
+                                                                      $before_id, $since, $tag)));
         }
 
         $idkey = common_cache_key($cachekey);
@@ -1026,7 +1052,7 @@ class Notice extends Memcached_DataObject
             $window = explode(',', $laststr);
             $last_id = $window[0];
             $new_ids = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
-                                                                          $last_id, 0, null)));
+                                                                          $last_id, 0, null, $tag)));
 
             $new_window = array_merge($new_ids, $window);
 
@@ -1041,7 +1067,7 @@ class Notice extends Memcached_DataObject
         }
 
         $window = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
-                                                                     0, 0, null)));
+                                                                     0, 0, null, $tag)));
 
         $windowstr = implode(',', $window);
 
index ae5641d79d69bb2a03d2faa6b1a3b9e43d992cc3..afc0ea4f74557b29824ef266a54be6fd59d81202 100644 (file)
@@ -153,18 +153,66 @@ class Profile extends Memcached_DataObject
         return null;
     }
 
-    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
+    function getTaggedNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null, $tag=null)
+    {
+        // XXX: I'm not sure this is going to be any faster. It probably isn't.
+        $ids = Notice::stream(array($this, '_streamTaggedDirect'),
+                              array(),
+                              'profile:notice_ids:' . $this->id,
+                              $offset, $limit, $since_id, $before_id, $since, $tag);
+        common_debug(print_r($ids, true));
+        return Notice::getStreamByIds($ids);
+    }
+
+    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
         // XXX: I'm not sure this is going to be any faster. It probably isn't.
         $ids = Notice::stream(array($this, '_streamDirect'),
                               array(),
                               'profile:notice_ids:' . $this->id,
-                              $offset, $limit, $since_id, $before_id);
+                              $offset, $limit, $since_id, $before_id, $since);
 
         return Notice::getStreamByIds($ids);
     }
 
-    function _streamDirect($offset, $limit, $since_id, $before_id, $since)
+    function _streamTaggedDirect($offset, $limit, $since_id, $before_id, $since=null, $tag=null)
+    {
+        common_debug('_streamTaggedDirect()');
+        $notice = new Notice();
+        $notice->profile_id = $this->id;
+        $query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($tag) . "' and profile_id=" . $notice->escape($notice->profile_id);
+        if ($since_id != 0) {
+            $query .= " and id > $since_id";
+        }
+
+        if ($before_id != 0) {
+            $query .= " and id < $before_id";
+        }
+
+        if (!is_null($since)) {
+            $query .= " and created > '" . date('Y-m-d H:i:s', $since) . "'";
+        }
+
+        $query .= ' order by id DESC';
+
+        if (!is_null($offset)) {
+            $query .= " limit $offset, $limit";
+        }
+        $notice->query($query);
+        $ids = array();
+
+        while ($notice->fetch()) {
+            common_debug(print_r($notice, true));
+            $ids[] = $notice->id;
+        }
+
+        return $ids;
+    }
+
+
+
+
+    function _streamDirect($offset, $limit, $since_id, $before_id, $since = null)
     {
         $notice = new Notice();
 
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/classes/Status_network.php b/classes/Status_network.php
new file mode 100644 (file)
index 0000000..f7747f7
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Table Definition for status_network
+ */
+
+class Status_network extends DB_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'status_network';                  // table name
+    public $nickname;                        // varchar(64)  primary_key not_null
+    public $hostname;                        // varchar(255)  unique_key
+    public $pathname;                        // varchar(255)  unique_key
+    public $sitename;                        // varchar(255)
+    public $dbhost;                          // varchar(255)
+    public $dbuser;                          // varchar(255)
+    public $dbpass;                          // varchar(255)
+    public $dbname;                          // varchar(255)
+    public $created;                         // datetime()   not_null
+    public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Status_network',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+
+    static function setupDB($dbhost, $dbuser, $dbpass, $dbname)
+    {
+        global $config;
+
+        $config['db']['database_'.$dbname] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
+        $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/statusnet.ini';
+        $config['db']['table_status_network'] = $dbname;
+
+        return true;
+    }
+
+    static function setupSite($servername, $pathname)
+    {
+        global $config;
+
+        $parts = explode('.', $servername);
+
+        $sn = Status_network::staticGet('nickname', $parts[0]);
+
+        if (!empty($sn)) {
+            $dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
+            $dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser;
+            $dbpass = $sn->dbpass;
+            $dbname = (empty($sn->dbname)) ? $sn->nickname : $sn->dbname;
+
+            $config['db']['database'] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
+            $config['site']['name'] = $sn->sitename;
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
index b5ac7b22061d7fbbb37c9fc7d9d019fee1c2224d..ea8ba40817ac74c3901c9f8f519deb677f616339 100644 (file)
@@ -407,13 +407,22 @@ class User extends Memcached_DataObject
         return Notice::getStreamByIds($ids);
     }
 
+    function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+        $profile = $this->getProfile();
+        if (!$profile) {
+            return null;
+        } else {
+            return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id, $since);
+        }
+    }
+
     function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
     {
         $profile = $this->getProfile();
         if (!$profile) {
             return null;
         } else {
-            return $profile->getNotices($offset, $limit, $since_id, $before_id);
+            return $profile->getNotices($offset, $limit, $since_id, $before_id, $since);
         }
     }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index c054195..92bbb35
@@ -1,4 +1,3 @@
-
 [avatar]
 profile_id = 129
 original = 17
@@ -47,6 +46,64 @@ modified = 384
 notice_id = K
 user_id = K
 
+[file]
+id = 129
+url = 2
+mimetype = 2
+size = 1
+title = 2
+date = 1
+protected = 1
+
+[file__keys]
+id = N
+
+[file_oembed]
+id = 129
+file_id = 1
+version = 2
+type = 2
+provider = 2
+provider_url = 2
+width = 1
+height = 1
+html = 34
+title = 2
+author_name = 2
+author_url = 2
+url = 2
+
+[file_oembed__keys]
+id = N
+
+[file_redirection]
+id = 129
+url = 2
+file_id = 1
+redirections = 1
+httpcode = 1
+
+[file_redirection__keys]
+id = N
+
+[file_thumbnail]
+id = 129
+file_id = 1
+url = 2
+width = 1
+height = 1
+
+[file_thumbnail__keys]
+id = N
+
+[file_to_post]
+id = 129
+file_id = 1
+post_id = 1
+
+[file_to_post__keys]
+id = N
+
 [foreign_link]
 user_id = 129
 foreign_id = 129
@@ -170,6 +227,7 @@ modified = 384
 reply_to = 1
 is_local = 17
 source = 2
+conversation = 1
 
 [notice__keys]
 id = N
index 173b187267d433c832eb542f931564bdf95276e5..95c63f3c09cc1f1f3b565dc47f730ea9427d1ecf 100644 (file)
@@ -41,3 +41,17 @@ subscribed = profile:id
 [fave]
 notice_id = notice:id
 user_id = user:id
+
+[file_oembed]
+file_id = file:id
+
+[file_redirection]
+file_id = file:id
+
+[file_thumbnail]
+file_id = file:id
+
+[file_to_post]
+file_id = file:id
+post_id = notice:id
+
diff --git a/classes/statusnet.ini b/classes/statusnet.ini
new file mode 100755 (executable)
index 0000000..a70cd41
--- /dev/null
@@ -0,0 +1,17 @@
+
+[status_network]
+nickname = 130
+hostname = 2
+pathname = 2
+sitename = 2
+dbhost = 2
+dbuser = 2
+dbpass = 2
+dbname = 2
+created = 142
+modified = 384
+
+[status_network__keys]
+nickname = K
+hostname = U
+pathname = U
index e70d9ab46e843bbb6c1a2fa2c98a9ae6133aedfa..282826a7fb075957c32098c8753e0c277d88c911 100644 (file)
 
 if (!defined('LACONICA')) { exit(1); }
 
-#If you have downloaded libraries in random little places, you
-#can add the paths here
+// If you have downloaded libraries in random little places, you
+// can add the paths here
 
-#$extra_path = array("/opt/php-openid-2.0.1", "/usr/local/share/php");
-#set_include_path(implode(PATH_SEPARATOR, $extra_path) . PATH_SEPARATOR . get_include_path());
+// $extra_path = array("/opt/php-openid-2.0.1", "/usr/local/share/php");
+// set_include_path(implode(PATH_SEPARATOR, $extra_path) . PATH_SEPARATOR . get_include_path());
 
-# We get called by common.php, $config is a tree with lots of config
-# options
-# These are for configuring your URLs
+// We get called by common.php, $config is a tree with lots of config
+// options
+// These are for configuring your URLs
 
 $config['site']['name'] = 'Just another Laconica microblog';
 $config['site']['server'] = 'localhost';
 $config['site']['path'] = 'laconica';
-#$config['site']['fancy'] = false;
-#$config['site']['theme'] = 'default';
-#To enable the built-in mobile style sheet, defaults to false.
-#$config['site']['mobile'] = true;
-#For contact email, defaults to $_SERVER["SERVER_ADMIN"]
-#$config['site']['email'] = 'admin@example.net';
-#Brought by...
-#$config['site']['broughtby'] = 'Individual or Company';
-#$config['site']['broughtbyurl'] = 'http://example.net/';
-#If you don't want to let users register (say, for a one-person install)
-#Crude but effective -- register everybody, then lock down
-#$config['site']['closed'] = true;
-#Only allow registration for people invited by another user
-#$config['site']['inviteonly'] = true;
-#Make the site invisible to  non-logged-in users
-#$config['site']['private'] = true;
-
-# If you want logging sent to a file instead of syslog
-#$config['site']['logfile'] = '/tmp/laconica.log';
-
-# Enables extra log information, for example full details of PEAR DB errors
-#$config['site']['logdebug'] = true;
-
-#To set your own logo, overriding the one in the theme
-#$config['site']['logo'] = '/mylogo.png';
-
-# This is a PEAR DB DSN, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php
-# Set it to match your actual database
+// $config['site']['fancy'] = false;
+// $config['site']['theme'] = 'default';
+// To enable the built-in mobile style sheet, defaults to false.
+// $config['site']['mobile'] = true;
+// For contact email, defaults to $_SERVER["SERVER_ADMIN"]
+// $config['site']['email'] = 'admin@example.net';
+// Brought by...
+// $config['site']['broughtby'] = 'Individual or Company';
+// $config['site']['broughtbyurl'] = 'http://example.net/';
+// If you don't want to let users register (say, for a one-person install)
+// Crude but effective -- register everybody, then lock down
+// $config['site']['closed'] = true;
+// Only allow registration for people invited by another user
+// $config['site']['inviteonly'] = true;
+// Make the site invisible to  non-logged-in users
+// $config['site']['private'] = true;
+
+// If you want logging sent to a file instead of syslog
+// $config['site']['logfile'] = '/tmp/laconica.log';
+
+// Enables extra log information, for example full details of PEAR DB errors
+// $config['site']['logdebug'] = true;
+
+// To set your own logo, overriding the one in the theme
+// $config['site']['logo'] = '/mylogo.png';
+
+// This is a PEAR DB DSN, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php
+// Set it to match your actual database
 
 $config['db']['database'] = 'mysql://laconica:microblog@localhost/laconica';
-#$config['db']['ini_your_db_name'] = $config['db']['schema_location'].'/laconica.ini';
-# *** WARNING *** WARNING *** WARNING *** WARNING ***
-# Setting debug to a non-zero value will expose your DATABASE PASSWORD to Web users.
-# !!!!!! DO NOT SET THIS ON PRODUCTION SERVERS !!!!!! DB_DataObject's bug, btw, not
-# ours.
-# *** WARNING *** WARNING *** WARNING *** WARNING ***
-#$config['db']['debug'] = 0;
-#$config['db']['db_driver'] = 'MDB2';
-
-#Database type. For mysql, these defaults are fine. For postgresql, set
-#'quote_identifiers' to true and 'type' to 'pgsql':
-#$config['db']['quote_identifiers'] = false;
-#$config['db']['type'] = 'mysql';
-
-#session_set_cookie_params(0, '/'. $config['site']['path'] .'/');
-
-#Standard fancy-url clashes prevented by not allowing nicknames on a blacklist
-#Add your own here. Note: empty array by default
-#$config['nickname']['blacklist'][] = 'scobleizer';
-
-# sphinx search
+// $config['db']['ini_your_db_name'] = $config['db']['schema_location'].'/laconica.ini';
+// *** WARNING *** WARNING *** WARNING *** WARNING ***
+// Setting debug to a non-zero value will expose your DATABASE PASSWORD to Web users.
+// !!!!!! DO NOT SET THIS ON PRODUCTION SERVERS !!!!!! DB_DataObject's bug, btw, not
+// ours.
+// *** WARNING *** WARNING *** WARNING *** WARNING ***
+// $config['db']['debug'] = 0;
+// $config['db']['db_driver'] = 'MDB2';
+
+// Database type. For mysql, these defaults are fine. For postgresql, set
+// 'quote_identifiers' to true and 'type' to 'pgsql':
+// $config['db']['quote_identifiers'] = false;
+// $config['db']['type'] = 'mysql';
+
+// session_set_cookie_params(0, '/'. $config['site']['path'] .'/');
+
+// Standard fancy-url clashes prevented by not allowing nicknames on a blacklist
+// Add your own here. Note: empty array by default
+// $config['nickname']['blacklist'][] = 'scobleizer';
+
+// sphinx search
 $config['sphinx']['enabled'] = false;
 $config['sphinx']['server'] = 'localhost';
 $config['sphinx']['port'] = 3312;
 
-# Users to populate the 'Featured' tab
-#$config['nickname']['featured'][] = 'scobleizer';
-
-# xmpp
-#$config['xmpp']['enabled'] = false;
-#$config['xmpp']['server'] = 'server.example.net';
-#$config['xmpp']['host'] = NULL;       # Only set if different from server
-#$config['xmpp']['port'] = 5222;
-#$config['xmpp']['user'] = 'update';
-#$config['xmpp']['encryption'] = false;
-#$config['xmpp']['resource'] = 'uniquename';
-#$config['xmpp']['password'] = 'blahblahblah';
-#$config['xmpp']['public'][] = 'someindexer@example.net';
-#$config['xmpp']['debug'] = false;
-
-#Default locale info
-#$config['site']['timezone'] = 'Pacific/Auckland';
-#$config['site']['language'] = 'en_NZ';
-
-#Email info, used for all outbound email
-#$config['mail']['notifyfrom'] = 'microblog@example.net';
-#$config['mail']['domain'] = 'microblog.example.net';
-# See http://pear.php.net/manual/en/package.mail.mail.factory.php for options
-#$config['mail']['backend'] = 'smtp';
-#$config['mail']['params'] = array(
-#                                                      'host' => 'localhost',
-#                                                      'port' => 25,
-#                                                      );
-#For incoming email, if enabled. Defaults to site server name.
-#$config['mail']['domain'] = 'incoming.example.net';
-
-#exponential decay factor for tags, default 10 days
-#raise this if traffic is slow, lower it if it's fast
-#$config['tag']['dropoff'] = 86400.0 * 10;
-
-#exponential decay factor for popular (most favorited notices)
-#default 10 days -- similar to tag dropoff
-#$config['popular']['dropoff'] = 86400.0 * 10;
-
-#optionally show non-local messages in public timeline
-#$config['public']['localonly'] = false;
-
-#hide certain users from public pages, by ID
-#$config['public']['blacklist'][] = 123;
-#$config['public']['blacklist'][] = 2307;
-
-#Mark certain notice sources as automatic and thus not
-#appropriate for public feed
-#$config['public]['autosource'][] = 'twitterfeed';
-#$config['public]['autosource'][] = 'rssdent';
-#$config['public]['autosource'][] = 'Ping.Fm';
-#$config['public]['autosource'][] = 'HelloTxt';
-#$config['public]['autosource'][] = 'Updating.Me';
-
-#Do notice broadcasts offline
-#If you use this, you must run the six offline daemons in the
-#background. See the README for details.
-#$config['queue']['enabled'] = true;
-
-#The following customise the behaviour of the various daemons:
-#$config['daemon']['piddir'] = '/var/run';
-#$config['daemon']['user'] = false;
-#$config['daemon']['group'] = false;
-
-#For installations with high traffic, laconica can use MemCached to cache
-#frequently requested information. Only enable the following if you have
-#MemCached up and running:
-#$config['memcached']['enabled'] = false;
-#$config['memcached']['server'] = 'localhost';
-#$config['memcached']['port'] = 11211;
-
-#Twitter integration source attribute. Note: default is Laconica
-#$config['integration']['source'] = 'Laconica';
-
-# Edit throttling. Off by default. If turned on, you can only post 20 notices
-# every 10 minutes. Admins may want to play with the settings to minimize inconvenience for
-# real users without getting uncontrollable floods from spammers or runaway bots.
-
-#$config['throttle']['enabled'] = true;
-#$config['throttle']['count'] = 100;
-#$config['throttle']['timespan'] = 3600;
-
-# List of users banned from posting (nicknames and/or IDs)
-#$config['profile']['banned'][] = 'hacker';
-#$config['profile']['banned'][] = 12345;
-
-# Config section for the built-in Facebook application
-#$config['facebook']['apikey'] = 'APIKEY';
-#$config['facebook']['secret'] = 'SECRET';
-
-# Add Google Analytics
-# require_once('plugins/GoogleAnalyticsPlugin.php');
-# $ga = new GoogleAnalyticsPlugin('your secret code');
-
-# Use Templating (template: /tpl/index.php)
-# require_once('plugins/TemplatePlugin.php');
-# $tpl = new TemplatePlugin();
-
-#Don't allow saying the same thing more than once per hour
-#$config['site']['dupelimit'] = 3600;
-#Don't enforce the dupe limit
-#$config['site']['dupelimit'] = -1;
-
-#Base string for minting Tag URIs in Atom feeds. Defaults to
-#"yourserver,2009". This needs to be configured properly for your Atom
-#feeds to validate.  See: http://www.faqs.org/rfcs/rfc4151.html and
-#http://taguri.org/ Examples:
-#$config['integration']['taguri'] = 'example.net,2008';
-#$config['integration']['taguri'] = 'admin@example.net,2009-03-09'
-
-#Don't use SSL
-#$config['site']['ssl'] = 'never';
-#Use SSL only for sensitive pages (like login, password change)
-#$config['site']['ssl'] = 'sometimes';
-#Use SSL for all pages
-#$config['site']['ssl'] = 'always';
-
-#Use a different hostname for SSL-encrypted pages
-#$config['site']['sslserver'] = 'secure.example.org';
+// Users to populate the 'Featured' tab
+// $config['nickname']['featured'][] = 'scobleizer';
+
+// xmpp
+// $config['xmpp']['enabled'] = false;
+// $config['xmpp']['server'] = 'server.example.net';
+// $config['xmpp']['host'] = NULL;     // Only set if different from server
+// $config['xmpp']['port'] = 5222;
+// $config['xmpp']['user'] = 'update';
+// $config['xmpp']['encryption'] = false;
+// $config['xmpp']['resource'] = 'uniquename';
+// $config['xmpp']['password'] = 'blahblahblah';
+// $config['xmpp']['public'][] = 'someindexer@example.net';
+// $config['xmpp']['debug'] = false;
+
+// Default locale info
+// $config['site']['timezone'] = 'Pacific/Auckland';
+// $config['site']['language'] = 'en_NZ';
+
+// Email info, used for all outbound email
+// $config['mail']['notifyfrom'] = 'microblog@example.net';
+// $config['mail']['domain'] = 'microblog.example.net';
+// See http://pear.php.net/manual/en/package.mail.mail.factory.php for options
+// $config['mail']['backend'] = 'smtp';
+// $config['mail']['params'] = array(
+//                                                     'host' => 'localhost',
+//                                                     'port' => 25,
+//                                                     );
+// For incoming email, if enabled. Defaults to site server name.
+// $config['mail']['domain'] = 'incoming.example.net';
+
+// exponential decay factor for tags, default 10 days
+// raise this if traffic is slow, lower it if it's fast
+// $config['tag']['dropoff'] = 86400.0 * 10;
+
+// exponential decay factor for popular (most favorited notices)
+// default 10 days -- similar to tag dropoff
+// $config['popular']['dropoff'] = 86400.0 * 10;
+
+// optionally show non-local messages in public timeline
+// $config['public']['localonly'] = false;
+
+// hide certain users from public pages, by ID
+// $config['public']['blacklist'][] = 123;
+// $config['public']['blacklist'][] = 2307;
+
+// Mark certain notice sources as automatic and thus not
+// appropriate for public feed
+// $config['public]['autosource'][] = 'twitterfeed';
+// $config['public]['autosource'][] = 'rssdent';
+// $config['public]['autosource'][] = 'Ping.Fm';
+// $config['public]['autosource'][] = 'HelloTxt';
+// $config['public]['autosource'][] = 'Updating.Me';
+
+// Do notice broadcasts offline
+// If you use this, you must run the six offline daemons in the
+// background. See the README for details.
+// $config['queue']['enabled'] = true;
+
+// Queue subsystem
+// subsystems: internal (default) or stomp
+// using stomp requires an external message queue server
+// $config['queue']['subsystem'] = 'stomp';
+// $config['queue']['stomp_server'] = 'tcp://localhost:61613';
+// use different queue_basename for each laconica instance managed by the server
+// $config['queue']['queue_basename'] = 'laconica';
+
+// The following customise the behaviour of the various daemons:
+// $config['daemon']['piddir'] = '/var/run';
+// $config['daemon']['user'] = false;
+// $config['daemon']['group'] = false;
+
+// For installations with high traffic, laconica can use MemCached to cache
+// frequently requested information. Only enable the following if you have
+// MemCached up and running:
+// $config['memcached']['enabled'] = false;
+// $config['memcached']['server'] = 'localhost';
+// $config['memcached']['port'] = 11211;
+
+// Twitter integration source attribute. Note: default is Laconica
+// $config['integration']['source'] = 'Laconica';
+
+// Edit throttling. Off by default. If turned on, you can only post 20 notices
+// every 10 minutes. Admins may want to play with the settings to minimize inconvenience for
+// real users without getting uncontrollable floods from spammers or runaway bots.
+
+// $config['throttle']['enabled'] = true;
+// $config['throttle']['count'] = 100;
+// $config['throttle']['timespan'] = 3600;
+
+// List of users banned from posting (nicknames and/or IDs)
+// $config['profile']['banned'][] = 'hacker';
+// $config['profile']['banned'][] = 12345;
+
+// Config section for the built-in Facebook application
+// $config['facebook']['apikey'] = 'APIKEY';
+// $config['facebook']['secret'] = 'SECRET';
+
+// Add Google Analytics
+// require_once('plugins/GoogleAnalyticsPlugin.php');
+// $ga = new GoogleAnalyticsPlugin('your secret code');
+
+// Use Templating (template: /tpl/index.php)
+// require_once('plugins/TemplatePlugin.php');
+// $tpl = new TemplatePlugin();
+
+// Don't allow saying the same thing more than once per hour
+// $config['site']['dupelimit'] = 3600;
+// Don't enforce the dupe limit
+// $config['site']['dupelimit'] = -1;
+
+// Base string for minting Tag URIs in Atom feeds. Defaults to
+// "yourserver,2009". This needs to be configured properly for your Atom
+// feeds to validate.  See: http://www.faqs.org/rfcs/rfc4151.html and
+// http://taguri.org/ Examples:
+// $config['integration']['taguri'] = 'example.net,2008';
+// $config['integration']['taguri'] = 'admin@example.net,2009-03-09'
+
+// Don't use SSL
+// $config['site']['ssl'] = 'never';
+// Use SSL only for sensitive pages (like login, password change)
+// $config['site']['ssl'] = 'sometimes';
+// Use SSL for all pages
+// $config['site']['ssl'] = 'always';
+
+// Use a different hostname for SSL-encrypted pages
+// $config['site']['sslserver'] = 'secure.example.org';
+
+// If you have a lot of status networks on the same server, you can
+// store the site data in a database and switch as follows
+// Status_network::setupDB('localhost', 'statusnet', 'statuspass', 'statusnet');
+// if (!Status_network::setupSite($_server, $_path)) {
+//        print "Error\n";
+//        exit(1);
+// }
+
+// How often to send snapshots; in # of web hits. Ideally,
+// try to do this once per month (that is, make this equal to number
+// of hits per month)
+// $config['snapshot']['frequency'] = 10000;
+// If you don't want to report statistics to the central server, uncomment.
+// $config['snapshot']['run'] = 'never';
+// If you want to report statistics in a cron job instead.
+// $config['snapshot']['run'] = 'cron';
index 557ede0246781024e509146d68353c55f5f02796..79c04cee56edc7e5d8b54ac823bb4d28b9ad9f33 100644 (file)
@@ -2,4 +2,5 @@ insert into foreign_service
     (id, name, description, created)
 values
     ('1','Twitter', 'Twitter Micro-blogging service', now()),
-    ('2','Facebook', 'Facebook', now());
+    ('2','Facebook', 'Facebook', now()),
+    ('3','FacebookConnect', 'Facebook Connect', now());
index c9730098e3fd2934d805606f67c90c780acdbf0d..a11e31692548449c4cabfd0629b589961ea577d4 100644 (file)
@@ -114,8 +114,10 @@ create table notice (
     reply_to integer comment 'notice replied to (usually a guess)' references notice (id),
     is_local tinyint default 0 comment 'notice was generated by a user',
     source varchar(32) comment 'source of comment, like "web", "im", or "clientname"',
+    conversation integer comment 'id of root notice in this conversation' references notice (id),
 
     index notice_profile_id_idx (profile_id),
+    index notice_conversation_idx (conversation),
     index notice_created_idx (created),
     index notice_replyto_idx (reply_to),
     FULLTEXT(content)
@@ -283,7 +285,7 @@ create table foreign_user (
 
 create table foreign_link (
      user_id int comment 'link to user on this system, if exists' references user (id),
-     foreign_id int comment 'link ' references foreign_user(id),
+     foreign_id bigint unsigned comment 'link to user on foreign service, if exists' references foreign_user(id),
      service int not null comment 'foreign key to service' references foreign_service(id),
      credentials varchar(255) comment 'authc credentials, typically a password',
      noticesync tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies',
@@ -423,3 +425,60 @@ create table group_inbox (
 
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
 
+create table file (
+    id integer primary key auto_increment,
+    url varchar(255), mimetype varchar(50),
+    size integer,
+    title varchar(255),
+    date integer(11),
+    protected integer(1),
+
+    unique(url)
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+create table file_oembed (
+    id integer primary key auto_increment,
+    file_id integer,
+    version varchar(20),
+    type varchar(20),
+    provider varchar(50),
+    provider_url varchar(255),
+    width integer,
+    height integer,
+    html text,
+    title varchar(255),
+    author_name varchar(50),
+    author_url varchar(255),
+    url varchar(255),
+
+    unique(file_id)
+) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+create table file_redirection (
+    id integer primary key auto_increment,
+    url varchar(255),
+    file_id integer,
+    redirections integer,
+    httpcode integer,
+
+    unique(url)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table file_thumbnail (
+    id integer primary key auto_increment,
+    file_id integer,
+    url varchar(255),
+    width integer,
+    height integer,
+
+    unique(file_id),
+    unique(url)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table file_to_post (
+    id integer primary key auto_increment,
+    file_id integer,
+    post_id integer,
+
+    unique(file_id, post_id)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
index a27a616f2490875bc9a9573b97baaa0668548af4..b213bbd5021f6383822f369586857164a8731a73 100644 (file)
@@ -427,6 +427,64 @@ create table group_inbox (
 );\r
 create index group_inbox_created_idx on group_inbox using btree(created);\r
 \r
+\r
+/*attachments and URLs stuff */\r
+create sequence file_seq;\r
+create table file (\r
+    id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */,\r
+    url varchar(255) unique, \r
+    mimetype varchar(50), \r
+    size integer, \r
+    title varchar(255), \r
+    date integer(11), \r
+    protected integer(1)\r
+);\r
+\r
+create sequence file_oembed_seq;\r
+create table file_oembed (\r
+    id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint unique,\r
+    version varchar(20),\r
+    type varchar(20),\r
+    provider varchar(50),\r
+    provider_url varchar(255),\r
+    width integer,\r
+    height integer,\r
+    html text,\r
+    title varchar(255),\r
+    author_name varchar(50), \r
+    author_url varchar(255), \r
+    url varchar(255), \r
+);\r
+\r
+create sequence file_redirection_seq;\r
+create table file_redirection (\r
+    id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */,\r
+    url varchar(255) unique, \r
+    file_id bigint, \r
+    redirections integer, \r
+    httpcode integer\r
+);\r
+\r
+create sequence file_thumbnail_seq;\r
+create table file_thumbnail (\r
+    id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint unique, \r
+    url varchar(255) unique, \r
+    width integer, \r
+    height integer \r
+);\r
+\r
+create sequence file_to_post_seq;\r
+create table file_to_post (\r
+    id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */,\r
+    file_id bigint, \r
+    post_id bigint, \r
+\r
+    unique(file_id, post_id)\r
+);\r
+\r
+\r
 /* Textsearch stuff */\r
 \r
 create index textsearch_idx on profile using gist(textsearch);\r
index ac73d3d13bdbadc51e58199664615ad7b733fd39..d5a280b82cedd18f9ba0df4107b7277c18a4394c 100644 (file)
@@ -48,6 +48,7 @@ VALUES
     ('twidge','Twidge','http://software.complete.org/twidge', now()),
     ('twidroid','twidroid','http://www.twidroid.com/', now()),
     ('twittelator','Twittelator','http://www.stone.com/iPhone/Twittelator/', now()),
+    ('twitter','Twitter','http://twitter.com/', now()),
     ('twitterfeed','twitterfeed','http://twitterfeed.com/', now()),
     ('twitterphoto','TwitterPhoto','http://richfish.org/twitterphoto/', now()),
     ('twitterpm','Net::Twitter','http://search.cpan.org/dist/Net-Twitter/', now()),
diff --git a/db/site.sql b/db/site.sql
new file mode 100644 (file)
index 0000000..660ba47
--- /dev/null
@@ -0,0 +1,17 @@
+/* For managing multiple sites */
+
+create table status_network (
+
+    nickname varchar(64) primary key comment 'nickname',
+    hostname varchar(255) unique key comment 'alternate hostname if any',
+    pathname varchar(255) unique key comment 'alternate pathname if any',
+    sitename varchar(255) comment 'display name',
+    dbhost varchar(255) comment 'database host',
+    dbuser varchar(255) comment 'database username',
+    dbpass varchar(255) comment 'database password',
+    dbname varchar(255) comment 'database name',
+
+    created datetime not null comment 'date this record was created',
+    modified timestamp comment 'date this record was modified'
+
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
index b1a1a4e2184f77f3bb4d1c0bf22aa45e1b6b9074..0c6a13dc28f7cec5c702d2ad09fb41704bc6b018 100644 (file)
@@ -2357,6 +2357,8 @@ class DB_DataObject extends DB_DataObject_Overload
         $t= explode(' ',microtime());
         $_DB_DATAOBJECT['QUERYENDTIME'] = $time = $t[0]+$t[1];
          
+
+        do {
         
         if ($_DB_driver == 'DB') {
             $result = $DB->query($string);
@@ -2374,8 +2376,19 @@ class DB_DataObject extends DB_DataObject_Overload
                     break;
             }
         }
-        
-       
+
+          // try to reconnect, at most 3 times
+          $again = false;
+          if (is_a($result, 'PEAR_Error')
+          AND $result->getCode() == DB_ERROR_NODBSELECTED
+          AND $cpt++<3) {
+              $DB->disconnect();
+              sleep(1);
+              $DB->connect($DB->dsn);
+              $again = true;
+          }
+          
+        } while ($again);
 
         if (is_a($result,'PEAR_Error')) {
             if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { 
diff --git a/extlib/HTTP/Request.php b/extlib/HTTP/Request.php
new file mode 100644 (file)
index 0000000..42eac3b
--- /dev/null
@@ -0,0 +1,1521 @@
+<?php\r
+/**\r
+ * Class for performing HTTP requests\r
+ *\r
+ * PHP versions 4 and 5\r
+ *\r
+ * LICENSE:\r
+ *\r
+ * Copyright (c) 2002-2007, Richard Heyes\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * o Redistributions of source code must retain the above copyright\r
+ *   notice, this list of conditions and the following disclaimer.\r
+ * o Redistributions in binary form must reproduce the above copyright\r
+ *   notice, this list of conditions and the following disclaimer in the\r
+ *   documentation and/or other materials provided with the distribution.\r
+ * o The names of the authors may not be used to endorse or promote\r
+ *   products derived from this software without specific prior written\r
+ *   permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * @category    HTTP\r
+ * @package     HTTP_Request\r
+ * @author      Richard Heyes <richard@phpguru.org>\r
+ * @author      Alexey Borzov <avb@php.net>\r
+ * @copyright   2002-2007 Richard Heyes\r
+ * @license     http://opensource.org/licenses/bsd-license.php New BSD License\r
+ * @version     CVS: $Id: Request.php,v 1.63 2008/10/11 11:07:10 avb Exp $\r
+ * @link        http://pear.php.net/package/HTTP_Request/\r
+ */\r
+\r
+/**\r
+ * PEAR and PEAR_Error classes (for error handling)\r
+ */\r
+require_once 'PEAR.php';\r
+/**\r
+ * Socket class\r
+ */\r
+require_once 'Net/Socket.php';\r
+/**\r
+ * URL handling class\r
+ */\r
+require_once 'Net/URL.php';\r
+\r
+/**#@+\r
+ * Constants for HTTP request methods\r
+ */\r
+define('HTTP_REQUEST_METHOD_GET',     'GET',     true);\r
+define('HTTP_REQUEST_METHOD_HEAD',    'HEAD',    true);\r
+define('HTTP_REQUEST_METHOD_POST',    'POST',    true);\r
+define('HTTP_REQUEST_METHOD_PUT',     'PUT',     true);\r
+define('HTTP_REQUEST_METHOD_DELETE',  'DELETE',  true);\r
+define('HTTP_REQUEST_METHOD_OPTIONS', 'OPTIONS', true);\r
+define('HTTP_REQUEST_METHOD_TRACE',   'TRACE',   true);\r
+/**#@-*/\r
+\r
+/**#@+\r
+ * Constants for HTTP request error codes\r
+ */\r
+define('HTTP_REQUEST_ERROR_FILE',             1);\r
+define('HTTP_REQUEST_ERROR_URL',              2);\r
+define('HTTP_REQUEST_ERROR_PROXY',            4);\r
+define('HTTP_REQUEST_ERROR_REDIRECTS',        8);\r
+define('HTTP_REQUEST_ERROR_RESPONSE',        16);\r
+define('HTTP_REQUEST_ERROR_GZIP_METHOD',     32);\r
+define('HTTP_REQUEST_ERROR_GZIP_READ',       64);\r
+define('HTTP_REQUEST_ERROR_GZIP_DATA',      128);\r
+define('HTTP_REQUEST_ERROR_GZIP_CRC',       256);\r
+/**#@-*/\r
+\r
+/**#@+\r
+ * Constants for HTTP protocol versions\r
+ */\r
+define('HTTP_REQUEST_HTTP_VER_1_0', '1.0', true);\r
+define('HTTP_REQUEST_HTTP_VER_1_1', '1.1', true);\r
+/**#@-*/\r
+\r
+if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) {\r
+   /**\r
+    * Whether string functions are overloaded by their mbstring equivalents\r
+    */\r
+    define('HTTP_REQUEST_MBSTRING', true);\r
+} else {\r
+   /**\r
+    * @ignore\r
+    */\r
+    define('HTTP_REQUEST_MBSTRING', false);\r
+}\r
+\r
+/**\r
+ * Class for performing HTTP requests\r
+ *\r
+ * Simple example (fetches yahoo.com and displays it):\r
+ * <code>\r
+ * $a = &new HTTP_Request('http://www.yahoo.com/');\r
+ * $a->sendRequest();\r
+ * echo $a->getResponseBody();\r
+ * </code>\r
+ *\r
+ * @category    HTTP\r
+ * @package     HTTP_Request\r
+ * @author      Richard Heyes <richard@phpguru.org>\r
+ * @author      Alexey Borzov <avb@php.net>\r
+ * @version     Release: 1.4.4\r
+ */\r
+class HTTP_Request\r
+{\r
+   /**#@+\r
+    * @access private\r
+    */\r
+    /**\r
+    * Instance of Net_URL\r
+    * @var Net_URL\r
+    */\r
+    var $_url;\r
+\r
+    /**\r
+    * Type of request\r
+    * @var string\r
+    */\r
+    var $_method;\r
+\r
+    /**\r
+    * HTTP Version\r
+    * @var string\r
+    */\r
+    var $_http;\r
+\r
+    /**\r
+    * Request headers\r
+    * @var array\r
+    */\r
+    var $_requestHeaders;\r
+\r
+    /**\r
+    * Basic Auth Username\r
+    * @var string\r
+    */\r
+    var $_user;\r
+\r
+    /**\r
+    * Basic Auth Password\r
+    * @var string\r
+    */\r
+    var $_pass;\r
+\r
+    /**\r
+    * Socket object\r
+    * @var Net_Socket\r
+    */\r
+    var $_sock;\r
+\r
+    /**\r
+    * Proxy server\r
+    * @var string\r
+    */\r
+    var $_proxy_host;\r
+\r
+    /**\r
+    * Proxy port\r
+    * @var integer\r
+    */\r
+    var $_proxy_port;\r
+\r
+    /**\r
+    * Proxy username\r
+    * @var string\r
+    */\r
+    var $_proxy_user;\r
+\r
+    /**\r
+    * Proxy password\r
+    * @var string\r
+    */\r
+    var $_proxy_pass;\r
+\r
+    /**\r
+    * Post data\r
+    * @var array\r
+    */\r
+    var $_postData;\r
+\r
+   /**\r
+    * Request body\r
+    * @var string\r
+    */\r
+    var $_body;\r
+\r
+   /**\r
+    * A list of methods that MUST NOT have a request body, per RFC 2616\r
+    * @var array\r
+    */\r
+    var $_bodyDisallowed = array('TRACE');\r
+\r
+   /**\r
+    * Methods having defined semantics for request body\r
+    *\r
+    * Content-Length header (indicating that the body follows, section 4.3 of\r
+    * RFC 2616) will be sent for these methods even if no body was added\r
+    *\r
+    * @var array\r
+    */\r
+    var $_bodyRequired = array('POST', 'PUT');\r
+\r
+   /**\r
+    * Files to post\r
+    * @var array\r
+    */\r
+    var $_postFiles = array();\r
+\r
+    /**\r
+    * Connection timeout.\r
+    * @var float\r
+    */\r
+    var $_timeout;\r
+\r
+    /**\r
+    * HTTP_Response object\r
+    * @var HTTP_Response\r
+    */\r
+    var $_response;\r
+\r
+    /**\r
+    * Whether to allow redirects\r
+    * @var boolean\r
+    */\r
+    var $_allowRedirects;\r
+\r
+    /**\r
+    * Maximum redirects allowed\r
+    * @var integer\r
+    */\r
+    var $_maxRedirects;\r
+\r
+    /**\r
+    * Current number of redirects\r
+    * @var integer\r
+    */\r
+    var $_redirects;\r
+\r
+   /**\r
+    * Whether to append brackets [] to array variables\r
+    * @var bool\r
+    */\r
+    var $_useBrackets = true;\r
+\r
+   /**\r
+    * Attached listeners\r
+    * @var array\r
+    */\r
+    var $_listeners = array();\r
+\r
+   /**\r
+    * Whether to save response body in response object property\r
+    * @var bool\r
+    */\r
+    var $_saveBody = true;\r
+\r
+   /**\r
+    * Timeout for reading from socket (array(seconds, microseconds))\r
+    * @var array\r
+    */\r
+    var $_readTimeout = null;\r
+\r
+   /**\r
+    * Options to pass to Net_Socket::connect. See stream_context_create\r
+    * @var array\r
+    */\r
+    var $_socketOptions = null;\r
+   /**#@-*/\r
+\r
+    /**\r
+    * Constructor\r
+    *\r
+    * Sets up the object\r
+    * @param    string  The url to fetch/access\r
+    * @param    array   Associative array of parameters which can have the following keys:\r
+    * <ul>\r
+    *   <li>method         - Method to use, GET, POST etc (string)</li>\r
+    *   <li>http           - HTTP Version to use, 1.0 or 1.1 (string)</li>\r
+    *   <li>user           - Basic Auth username (string)</li>\r
+    *   <li>pass           - Basic Auth password (string)</li>\r
+    *   <li>proxy_host     - Proxy server host (string)</li>\r
+    *   <li>proxy_port     - Proxy server port (integer)</li>\r
+    *   <li>proxy_user     - Proxy auth username (string)</li>\r
+    *   <li>proxy_pass     - Proxy auth password (string)</li>\r
+    *   <li>timeout        - Connection timeout in seconds (float)</li>\r
+    *   <li>allowRedirects - Whether to follow redirects or not (bool)</li>\r
+    *   <li>maxRedirects   - Max number of redirects to follow (integer)</li>\r
+    *   <li>useBrackets    - Whether to append [] to array variable names (bool)</li>\r
+    *   <li>saveBody       - Whether to save response body in response object property (bool)</li>\r
+    *   <li>readTimeout    - Timeout for reading / writing data over the socket (array (seconds, microseconds))</li>\r
+    *   <li>socketOptions  - Options to pass to Net_Socket object (array)</li>\r
+    * </ul>\r
+    * @access public\r
+    */\r
+    function HTTP_Request($url = '', $params = array())\r
+    {\r
+        $this->_method         =  HTTP_REQUEST_METHOD_GET;\r
+        $this->_http           =  HTTP_REQUEST_HTTP_VER_1_1;\r
+        $this->_requestHeaders = array();\r
+        $this->_postData       = array();\r
+        $this->_body           = null;\r
+\r
+        $this->_user = null;\r
+        $this->_pass = null;\r
+\r
+        $this->_proxy_host = null;\r
+        $this->_proxy_port = null;\r
+        $this->_proxy_user = null;\r
+        $this->_proxy_pass = null;\r
+\r
+        $this->_allowRedirects = false;\r
+        $this->_maxRedirects   = 3;\r
+        $this->_redirects      = 0;\r
+\r
+        $this->_timeout  = null;\r
+        $this->_response = null;\r
+\r
+        foreach ($params as $key => $value) {\r
+            $this->{'_' . $key} = $value;\r
+        }\r
+\r
+        if (!empty($url)) {\r
+            $this->setURL($url);\r
+        }\r
+\r
+        // Default useragent\r
+        $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )');\r
+\r
+        // We don't do keep-alives by default\r
+        $this->addHeader('Connection', 'close');\r
+\r
+        // Basic authentication\r
+        if (!empty($this->_user)) {\r
+            $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass));\r
+        }\r
+\r
+        // Proxy authentication (see bug #5913)\r
+        if (!empty($this->_proxy_user)) {\r
+            $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass));\r
+        }\r
+\r
+        // Use gzip encoding if possible\r
+        if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) {\r
+            $this->addHeader('Accept-Encoding', 'gzip');\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Generates a Host header for HTTP/1.1 requests\r
+    *\r
+    * @access private\r
+    * @return string\r
+    */\r
+    function _generateHostHeader()\r
+    {\r
+        if ($this->_url->port != 80 AND strcasecmp($this->_url->protocol, 'http') == 0) {\r
+            $host = $this->_url->host . ':' . $this->_url->port;\r
+\r
+        } elseif ($this->_url->port != 443 AND strcasecmp($this->_url->protocol, 'https') == 0) {\r
+            $host = $this->_url->host . ':' . $this->_url->port;\r
+\r
+        } elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {\r
+            $host = $this->_url->host . ':' . $this->_url->port;\r
+\r
+        } else {\r
+            $host = $this->_url->host;\r
+        }\r
+\r
+        return $host;\r
+    }\r
+\r
+    /**\r
+    * Resets the object to its initial state (DEPRECATED).\r
+    * Takes the same parameters as the constructor.\r
+    *\r
+    * @param  string $url    The url to be requested\r
+    * @param  array  $params Associative array of parameters\r
+    *                        (see constructor for details)\r
+    * @access public\r
+    * @deprecated deprecated since 1.2, call the constructor if this is necessary\r
+    */\r
+    function reset($url, $params = array())\r
+    {\r
+        $this->HTTP_Request($url, $params);\r
+    }\r
+\r
+    /**\r
+    * Sets the URL to be requested\r
+    *\r
+    * @param  string The url to be requested\r
+    * @access public\r
+    */\r
+    function setURL($url)\r
+    {\r
+        $this->_url = &new Net_URL($url, $this->_useBrackets);\r
+\r
+        if (!empty($this->_url->user) || !empty($this->_url->pass)) {\r
+            $this->setBasicAuth($this->_url->user, $this->_url->pass);\r
+        }\r
+\r
+        if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) {\r
+            $this->addHeader('Host', $this->_generateHostHeader());\r
+        }\r
+\r
+        // set '/' instead of empty path rather than check later (see bug #8662)\r
+        if (empty($this->_url->path)) {\r
+            $this->_url->path = '/';\r
+        }\r
+    }\r
+\r
+   /**\r
+    * Returns the current request URL\r
+    *\r
+    * @return   string  Current request URL\r
+    * @access   public\r
+    */\r
+    function getUrl()\r
+    {\r
+        return empty($this->_url)? '': $this->_url->getUrl();\r
+    }\r
+\r
+    /**\r
+    * Sets a proxy to be used\r
+    *\r
+    * @param string     Proxy host\r
+    * @param int        Proxy port\r
+    * @param string     Proxy username\r
+    * @param string     Proxy password\r
+    * @access public\r
+    */\r
+    function setProxy($host, $port = 8080, $user = null, $pass = null)\r
+    {\r
+        $this->_proxy_host = $host;\r
+        $this->_proxy_port = $port;\r
+        $this->_proxy_user = $user;\r
+        $this->_proxy_pass = $pass;\r
+\r
+        if (!empty($user)) {\r
+            $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($user . ':' . $pass));\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Sets basic authentication parameters\r
+    *\r
+    * @param string     Username\r
+    * @param string     Password\r
+    */\r
+    function setBasicAuth($user, $pass)\r
+    {\r
+        $this->_user = $user;\r
+        $this->_pass = $pass;\r
+\r
+        $this->addHeader('Authorization', 'Basic ' . base64_encode($user . ':' . $pass));\r
+    }\r
+\r
+    /**\r
+    * Sets the method to be used, GET, POST etc.\r
+    *\r
+    * @param string     Method to use. Use the defined constants for this\r
+    * @access public\r
+    */\r
+    function setMethod($method)\r
+    {\r
+        $this->_method = $method;\r
+    }\r
+\r
+    /**\r
+    * Sets the HTTP version to use, 1.0 or 1.1\r
+    *\r
+    * @param string     Version to use. Use the defined constants for this\r
+    * @access public\r
+    */\r
+    function setHttpVer($http)\r
+    {\r
+        $this->_http = $http;\r
+    }\r
+\r
+    /**\r
+    * Adds a request header\r
+    *\r
+    * @param string     Header name\r
+    * @param string     Header value\r
+    * @access public\r
+    */\r
+    function addHeader($name, $value)\r
+    {\r
+        $this->_requestHeaders[strtolower($name)] = $value;\r
+    }\r
+\r
+    /**\r
+    * Removes a request header\r
+    *\r
+    * @param string     Header name to remove\r
+    * @access public\r
+    */\r
+    function removeHeader($name)\r
+    {\r
+        if (isset($this->_requestHeaders[strtolower($name)])) {\r
+            unset($this->_requestHeaders[strtolower($name)]);\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Adds a querystring parameter\r
+    *\r
+    * @param string     Querystring parameter name\r
+    * @param string     Querystring parameter value\r
+    * @param bool       Whether the value is already urlencoded or not, default = not\r
+    * @access public\r
+    */\r
+    function addQueryString($name, $value, $preencoded = false)\r
+    {\r
+        $this->_url->addQueryString($name, $value, $preencoded);\r
+    }\r
+\r
+    /**\r
+    * Sets the querystring to literally what you supply\r
+    *\r
+    * @param string     The querystring data. Should be of the format foo=bar&x=y etc\r
+    * @param bool       Whether data is already urlencoded or not, default = already encoded\r
+    * @access public\r
+    */\r
+    function addRawQueryString($querystring, $preencoded = true)\r
+    {\r
+        $this->_url->addRawQueryString($querystring, $preencoded);\r
+    }\r
+\r
+    /**\r
+    * Adds postdata items\r
+    *\r
+    * @param string     Post data name\r
+    * @param string     Post data value\r
+    * @param bool       Whether data is already urlencoded or not, default = not\r
+    * @access public\r
+    */\r
+    function addPostData($name, $value, $preencoded = false)\r
+    {\r
+        if ($preencoded) {\r
+            $this->_postData[$name] = $value;\r
+        } else {\r
+            $this->_postData[$name] = $this->_arrayMapRecursive('urlencode', $value);\r
+        }\r
+    }\r
+\r
+   /**\r
+    * Recursively applies the callback function to the value\r
+    *\r
+    * @param    mixed   Callback function\r
+    * @param    mixed   Value to process\r
+    * @access   private\r
+    * @return   mixed   Processed value\r
+    */\r
+    function _arrayMapRecursive($callback, $value)\r
+    {\r
+        if (!is_array($value)) {\r
+            return call_user_func($callback, $value);\r
+        } else {\r
+            $map = array();\r
+            foreach ($value as $k => $v) {\r
+                $map[$k] = $this->_arrayMapRecursive($callback, $v);\r
+            }\r
+            return $map;\r
+        }\r
+    }\r
+\r
+   /**\r
+    * Adds a file to form-based file upload\r
+    *\r
+    * Used to emulate file upload via a HTML form. The method also sets\r
+    * Content-Type of HTTP request to 'multipart/form-data'.\r
+    *\r
+    * If you just want to send the contents of a file as the body of HTTP\r
+    * request you should use setBody() method.\r
+    *\r
+    * @access public\r
+    * @param  string    name of file-upload field\r
+    * @param  mixed     file name(s)\r
+    * @param  mixed     content-type(s) of file(s) being uploaded\r
+    * @return bool      true on success\r
+    * @throws PEAR_Error\r
+    */\r
+    function addFile($inputName, $fileName, $contentType = 'application/octet-stream')\r
+    {\r
+        if (!is_array($fileName) && !is_readable($fileName)) {\r
+            return PEAR::raiseError("File '{$fileName}' is not readable", HTTP_REQUEST_ERROR_FILE);\r
+        } elseif (is_array($fileName)) {\r
+            foreach ($fileName as $name) {\r
+                if (!is_readable($name)) {\r
+                    return PEAR::raiseError("File '{$name}' is not readable", HTTP_REQUEST_ERROR_FILE);\r
+                }\r
+            }\r
+        }\r
+        $this->addHeader('Content-Type', 'multipart/form-data');\r
+        $this->_postFiles[$inputName] = array(\r
+            'name' => $fileName,\r
+            'type' => $contentType\r
+        );\r
+        return true;\r
+    }\r
+\r
+    /**\r
+    * Adds raw postdata (DEPRECATED)\r
+    *\r
+    * @param string     The data\r
+    * @param bool       Whether data is preencoded or not, default = already encoded\r
+    * @access public\r
+    * @deprecated       deprecated since 1.3.0, method setBody() should be used instead\r
+    */\r
+    function addRawPostData($postdata, $preencoded = true)\r
+    {\r
+        $this->_body = $preencoded ? $postdata : urlencode($postdata);\r
+    }\r
+\r
+   /**\r
+    * Sets the request body (for POST, PUT and similar requests)\r
+    *\r
+    * @param    string  Request body\r
+    * @access   public\r
+    */\r
+    function setBody($body)\r
+    {\r
+        $this->_body = $body;\r
+    }\r
+\r
+    /**\r
+    * Clears any postdata that has been added (DEPRECATED).\r
+    *\r
+    * Useful for multiple request scenarios.\r
+    *\r
+    * @access public\r
+    * @deprecated deprecated since 1.2\r
+    */\r
+    function clearPostData()\r
+    {\r
+        $this->_postData = null;\r
+    }\r
+\r
+    /**\r
+    * Appends a cookie to "Cookie:" header\r
+    *\r
+    * @param string $name cookie name\r
+    * @param string $value cookie value\r
+    * @access public\r
+    */\r
+    function addCookie($name, $value)\r
+    {\r
+        $cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';\r
+        $this->addHeader('Cookie', $cookies . $name . '=' . $value);\r
+    }\r
+\r
+    /**\r
+    * Clears any cookies that have been added (DEPRECATED).\r
+    *\r
+    * Useful for multiple request scenarios\r
+    *\r
+    * @access public\r
+    * @deprecated deprecated since 1.2\r
+    */\r
+    function clearCookies()\r
+    {\r
+        $this->removeHeader('Cookie');\r
+    }\r
+\r
+    /**\r
+    * Sends the request\r
+    *\r
+    * @access public\r
+    * @param  bool   Whether to store response body in Response object property,\r
+    *                set this to false if downloading a LARGE file and using a Listener\r
+    * @return mixed  PEAR error on error, true otherwise\r
+    */\r
+    function sendRequest($saveBody = true)\r
+    {\r
+        if (!is_a($this->_url, 'Net_URL')) {\r
+            return PEAR::raiseError('No URL given', HTTP_REQUEST_ERROR_URL);\r
+        }\r
+\r
+        $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;\r
+        $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;\r
+\r
+        if (strcasecmp($this->_url->protocol, 'https') == 0) {\r
+            // Bug #14127, don't try connecting to HTTPS sites without OpenSSL\r
+            if (version_compare(PHP_VERSION, '4.3.0', '<') || !extension_loaded('openssl')) {\r
+                return PEAR::raiseError('Need PHP 4.3.0 or later with OpenSSL support for https:// requests',\r
+                                        HTTP_REQUEST_ERROR_URL);\r
+            } elseif (isset($this->_proxy_host)) {\r
+                return PEAR::raiseError('HTTPS proxies are not supported', HTTP_REQUEST_ERROR_PROXY);\r
+            }\r
+            $host = 'ssl://' . $host;\r
+        }\r
+\r
+        // magic quotes may fuck up file uploads and chunked response processing\r
+        $magicQuotes = ini_get('magic_quotes_runtime');\r
+        ini_set('magic_quotes_runtime', false);\r
+\r
+        // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive\r
+        // connection token to a proxy server...\r
+        if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) &&\r
+            'Keep-Alive' == $this->_requestHeaders['connection'])\r
+        {\r
+            $this->removeHeader('connection');\r
+        }\r
+\r
+        $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) ||\r
+                     (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);\r
+        $sockets   = &PEAR::getStaticProperty('HTTP_Request', 'sockets');\r
+        $sockKey   = $host . ':' . $port;\r
+        unset($this->_sock);\r
+\r
+        // There is a connected socket in the "static" property?\r
+        if ($keepAlive && !empty($sockets[$sockKey]) &&\r
+            !empty($sockets[$sockKey]->fp))\r
+        {\r
+            $this->_sock =& $sockets[$sockKey];\r
+            $err = null;\r
+        } else {\r
+            $this->_notify('connect');\r
+            $this->_sock =& new Net_Socket();\r
+            $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);\r
+        }\r
+        PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());\r
+\r
+        if (!PEAR::isError($err)) {\r
+            if (!empty($this->_readTimeout)) {\r
+                $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);\r
+            }\r
+\r
+            $this->_notify('sentRequest');\r
+\r
+            // Read the response\r
+            $this->_response = &new HTTP_Response($this->_sock, $this->_listeners);\r
+            $err = $this->_response->process(\r
+                $this->_saveBody && $saveBody,\r
+                HTTP_REQUEST_METHOD_HEAD != $this->_method\r
+            );\r
+\r
+            if ($keepAlive) {\r
+                $keepAlive = (isset($this->_response->_headers['content-length'])\r
+                              || (isset($this->_response->_headers['transfer-encoding'])\r
+                                  && strtolower($this->_response->_headers['transfer-encoding']) == 'chunked'));\r
+                if ($keepAlive) {\r
+                    if (isset($this->_response->_headers['connection'])) {\r
+                        $keepAlive = strtolower($this->_response->_headers['connection']) == 'keep-alive';\r
+                    } else {\r
+                        $keepAlive = 'HTTP/'.HTTP_REQUEST_HTTP_VER_1_1 == $this->_response->_protocol;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        ini_set('magic_quotes_runtime', $magicQuotes);\r
+\r
+        if (PEAR::isError($err)) {\r
+            return $err;\r
+        }\r
+\r
+        if (!$keepAlive) {\r
+            $this->disconnect();\r
+        // Store the connected socket in "static" property\r
+        } elseif (empty($sockets[$sockKey]) || empty($sockets[$sockKey]->fp)) {\r
+            $sockets[$sockKey] =& $this->_sock;\r
+        }\r
+\r
+        // Check for redirection\r
+        if (    $this->_allowRedirects\r
+            AND $this->_redirects <= $this->_maxRedirects\r
+            AND $this->getResponseCode() > 300\r
+            AND $this->getResponseCode() < 399\r
+            AND !empty($this->_response->_headers['location'])) {\r
+\r
+\r
+            $redirect = $this->_response->_headers['location'];\r
+\r
+            // Absolute URL\r
+            if (preg_match('/^https?:\/\//i', $redirect)) {\r
+                $this->_url = &new Net_URL($redirect);\r
+                $this->addHeader('Host', $this->_generateHostHeader());\r
+            // Absolute path\r
+            } elseif ($redirect{0} == '/') {\r
+                $this->_url->path = $redirect;\r
+\r
+            // Relative path\r
+            } elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {\r
+                if (substr($this->_url->path, -1) == '/') {\r
+                    $redirect = $this->_url->path . $redirect;\r
+                } else {\r
+                    $redirect = dirname($this->_url->path) . '/' . $redirect;\r
+                }\r
+                $redirect = Net_URL::resolvePath($redirect);\r
+                $this->_url->path = $redirect;\r
+\r
+            // Filename, no path\r
+            } else {\r
+                if (substr($this->_url->path, -1) == '/') {\r
+                    $redirect = $this->_url->path . $redirect;\r
+                } else {\r
+                    $redirect = dirname($this->_url->path) . '/' . $redirect;\r
+                }\r
+                $this->_url->path = $redirect;\r
+            }\r
+\r
+            $this->_redirects++;\r
+            return $this->sendRequest($saveBody);\r
+\r
+        // Too many redirects\r
+        } elseif ($this->_allowRedirects AND $this->_redirects > $this->_maxRedirects) {\r
+            return PEAR::raiseError('Too many redirects', HTTP_REQUEST_ERROR_REDIRECTS);\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    /**\r
+     * Disconnect the socket, if connected. Only useful if using Keep-Alive.\r
+     *\r
+     * @access public\r
+     */\r
+    function disconnect()\r
+    {\r
+        if (!empty($this->_sock) && !empty($this->_sock->fp)) {\r
+            $this->_notify('disconnect');\r
+            $this->_sock->disconnect();\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Returns the response code\r
+    *\r
+    * @access public\r
+    * @return mixed     Response code, false if not set\r
+    */\r
+    function getResponseCode()\r
+    {\r
+        return isset($this->_response->_code) ? $this->_response->_code : false;\r
+    }\r
+\r
+    /**\r
+    * Returns the response reason phrase\r
+    *\r
+    * @access public\r
+    * @return mixed     Response reason phrase, false if not set\r
+    */\r
+    function getResponseReason()\r
+    {\r
+        return isset($this->_response->_reason) ? $this->_response->_reason : false;\r
+    }\r
+\r
+    /**\r
+    * Returns either the named header or all if no name given\r
+    *\r
+    * @access public\r
+    * @param string     The header name to return, do not set to get all headers\r
+    * @return mixed     either the value of $headername (false if header is not present)\r
+    *                   or an array of all headers\r
+    */\r
+    function getResponseHeader($headername = null)\r
+    {\r
+        if (!isset($headername)) {\r
+            return isset($this->_response->_headers)? $this->_response->_headers: array();\r
+        } else {\r
+            $headername = strtolower($headername);\r
+            return isset($this->_response->_headers[$headername]) ? $this->_response->_headers[$headername] : false;\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Returns the body of the response\r
+    *\r
+    * @access public\r
+    * @return mixed     response body, false if not set\r
+    */\r
+    function getResponseBody()\r
+    {\r
+        return isset($this->_response->_body) ? $this->_response->_body : false;\r
+    }\r
+\r
+    /**\r
+    * Returns cookies set in response\r
+    *\r
+    * @access public\r
+    * @return mixed     array of response cookies, false if none are present\r
+    */\r
+    function getResponseCookies()\r
+    {\r
+        return isset($this->_response->_cookies) ? $this->_response->_cookies : false;\r
+    }\r
+\r
+    /**\r
+    * Builds the request string\r
+    *\r
+    * @access private\r
+    * @return string The request string\r
+    */\r
+    function _buildRequest()\r
+    {\r
+        $separator = ini_get('arg_separator.output');\r
+        ini_set('arg_separator.output', '&');\r
+        $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';\r
+        ini_set('arg_separator.output', $separator);\r
+\r
+        $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';\r
+        $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';\r
+        $path = $this->_url->path . $querystring;\r
+        $url  = $host . $port . $path;\r
+\r
+        if (!strlen($url)) {\r
+            $url = '/';\r
+        }\r
+\r
+        $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";\r
+\r
+        if (in_array($this->_method, $this->_bodyDisallowed) ||\r
+            (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||\r
+             (empty($this->_postData) && empty($this->_postFiles)))))\r
+        {\r
+            $this->removeHeader('Content-Type');\r
+        } else {\r
+            if (empty($this->_requestHeaders['content-type'])) {\r
+                // Add default content-type\r
+                $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');\r
+            } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {\r
+                $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());\r
+                $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);\r
+            }\r
+        }\r
+\r
+        // Request Headers\r
+        if (!empty($this->_requestHeaders)) {\r
+            foreach ($this->_requestHeaders as $name => $value) {\r
+                $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));\r
+                $request      .= $canonicalName . ': ' . $value . "\r\n";\r
+            }\r
+        }\r
+\r
+        // Method does not allow a body, simply add a final CRLF\r
+        if (in_array($this->_method, $this->_bodyDisallowed)) {\r
+\r
+            $request .= "\r\n";\r
+\r
+        // Post data if it's an array\r
+        } elseif (HTTP_REQUEST_METHOD_POST == $this->_method &&\r
+                  (!empty($this->_postData) || !empty($this->_postFiles))) {\r
+\r
+            // "normal" POST request\r
+            if (!isset($boundary)) {\r
+                $postdata = implode('&', array_map(\r
+                    create_function('$a', 'return $a[0] . \'=\' . $a[1];'),\r
+                    $this->_flattenArray('', $this->_postData)\r
+                ));\r
+\r
+            // multipart request, probably with file uploads\r
+            } else {\r
+                $postdata = '';\r
+                if (!empty($this->_postData)) {\r
+                    $flatData = $this->_flattenArray('', $this->_postData);\r
+                    foreach ($flatData as $item) {\r
+                        $postdata .= '--' . $boundary . "\r\n";\r
+                        $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';\r
+                        $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";\r
+                    }\r
+                }\r
+                foreach ($this->_postFiles as $name => $value) {\r
+                    if (is_array($value['name'])) {\r
+                        $varname       = $name . ($this->_useBrackets? '[]': '');\r
+                    } else {\r
+                        $varname       = $name;\r
+                        $value['name'] = array($value['name']);\r
+                    }\r
+                    foreach ($value['name'] as $key => $filename) {\r
+                        $fp       = fopen($filename, 'r');\r
+                        $basename = basename($filename);\r
+                        $type     = is_array($value['type'])? @$value['type'][$key]: $value['type'];\r
+\r
+                        $postdata .= '--' . $boundary . "\r\n";\r
+                        $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';\r
+                        $postdata .= "\r\nContent-Type: " . $type;\r
+                        $postdata .= "\r\n\r\n" . fread($fp, filesize($filename)) . "\r\n";\r
+                        fclose($fp);\r
+                    }\r
+                }\r
+                $postdata .= '--' . $boundary . "--\r\n";\r
+            }\r
+            $request .= 'Content-Length: ' .\r
+                        (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .\r
+                        "\r\n\r\n";\r
+            $request .= $postdata;\r
+\r
+        // Explicitly set request body\r
+        } elseif (0 < strlen($this->_body)) {\r
+\r
+            $request .= 'Content-Length: ' .\r
+                        (HTTP_REQUEST_MBSTRING? mb_strlen($this->_body, 'iso-8859-1'): strlen($this->_body)) .\r
+                        "\r\n\r\n";\r
+            $request .= $this->_body;\r
+\r
+        // No body: send a Content-Length header nonetheless (request #12900),\r
+        // but do that only for methods that require a body (bug #14740)\r
+        } else {\r
+\r
+            if (in_array($this->_method, $this->_bodyRequired)) {\r
+                $request .= "Content-Length: 0\r\n";\r
+            }\r
+            $request .= "\r\n";\r
+        }\r
+\r
+        return $request;\r
+    }\r
+\r
+   /**\r
+    * Helper function to change the (probably multidimensional) associative array\r
+    * into the simple one.\r
+    *\r
+    * @param    string  name for item\r
+    * @param    mixed   item's values\r
+    * @return   array   array with the following items: array('item name', 'item value');\r
+    * @access   private\r
+    */\r
+    function _flattenArray($name, $values)\r
+    {\r
+        if (!is_array($values)) {\r
+            return array(array($name, $values));\r
+        } else {\r
+            $ret = array();\r
+            foreach ($values as $k => $v) {\r
+                if (empty($name)) {\r
+                    $newName = $k;\r
+                } elseif ($this->_useBrackets) {\r
+                    $newName = $name . '[' . $k . ']';\r
+                } else {\r
+                    $newName = $name;\r
+                }\r
+                $ret = array_merge($ret, $this->_flattenArray($newName, $v));\r
+            }\r
+            return $ret;\r
+        }\r
+    }\r
+\r
+\r
+   /**\r
+    * Adds a Listener to the list of listeners that are notified of\r
+    * the object's events\r
+    *\r
+    * Events sent by HTTP_Request object\r
+    * - 'connect': on connection to server\r
+    * - 'sentRequest': after the request was sent\r
+    * - 'disconnect': on disconnection from server\r
+    *\r
+    * Events sent by HTTP_Response object\r
+    * - 'gotHeaders': after receiving response headers (headers are passed in $data)\r
+    * - 'tick': on receiving a part of response body (the part is passed in $data)\r
+    * - 'gzTick': on receiving a gzip-encoded part of response body (ditto)\r
+    * - 'gotBody': after receiving the response body (passes the decoded body in $data if it was gzipped)\r
+    *\r
+    * @param    HTTP_Request_Listener   listener to attach\r
+    * @return   boolean                 whether the listener was successfully attached\r
+    * @access   public\r
+    */\r
+    function attach(&$listener)\r
+    {\r
+        if (!is_a($listener, 'HTTP_Request_Listener')) {\r
+            return false;\r
+        }\r
+        $this->_listeners[$listener->getId()] =& $listener;\r
+        return true;\r
+    }\r
+\r
+\r
+   /**\r
+    * Removes a Listener from the list of listeners\r
+    *\r
+    * @param    HTTP_Request_Listener   listener to detach\r
+    * @return   boolean                 whether the listener was successfully detached\r
+    * @access   public\r
+    */\r
+    function detach(&$listener)\r
+    {\r
+        if (!is_a($listener, 'HTTP_Request_Listener') ||\r
+            !isset($this->_listeners[$listener->getId()])) {\r
+            return false;\r
+        }\r
+        unset($this->_listeners[$listener->getId()]);\r
+        return true;\r
+    }\r
+\r
+\r
+   /**\r
+    * Notifies all registered listeners of an event.\r
+    *\r
+    * @param    string  Event name\r
+    * @param    mixed   Additional data\r
+    * @access   private\r
+    * @see      HTTP_Request::attach()\r
+    */\r
+    function _notify($event, $data = null)\r
+    {\r
+        foreach (array_keys($this->_listeners) as $id) {\r
+            $this->_listeners[$id]->update($this, $event, $data);\r
+        }\r
+    }\r
+}\r
+\r
+\r
+/**\r
+ * Response class to complement the Request class\r
+ *\r
+ * @category    HTTP\r
+ * @package     HTTP_Request\r
+ * @author      Richard Heyes <richard@phpguru.org>\r
+ * @author      Alexey Borzov <avb@php.net>\r
+ * @version     Release: 1.4.4\r
+ */\r
+class HTTP_Response\r
+{\r
+    /**\r
+    * Socket object\r
+    * @var Net_Socket\r
+    */\r
+    var $_sock;\r
+\r
+    /**\r
+    * Protocol\r
+    * @var string\r
+    */\r
+    var $_protocol;\r
+\r
+    /**\r
+    * Return code\r
+    * @var string\r
+    */\r
+    var $_code;\r
+\r
+    /**\r
+    * Response reason phrase\r
+    * @var string\r
+    */\r
+    var $_reason;\r
+\r
+    /**\r
+    * Response headers\r
+    * @var array\r
+    */\r
+    var $_headers;\r
+\r
+    /**\r
+    * Cookies set in response\r
+    * @var array\r
+    */\r
+    var $_cookies;\r
+\r
+    /**\r
+    * Response body\r
+    * @var string\r
+    */\r
+    var $_body = '';\r
+\r
+   /**\r
+    * Used by _readChunked(): remaining length of the current chunk\r
+    * @var string\r
+    */\r
+    var $_chunkLength = 0;\r
+\r
+   /**\r
+    * Attached listeners\r
+    * @var array\r
+    */\r
+    var $_listeners = array();\r
+\r
+   /**\r
+    * Bytes left to read from message-body\r
+    * @var null|int\r
+    */\r
+    var $_toRead;\r
+\r
+    /**\r
+    * Constructor\r
+    *\r
+    * @param  Net_Socket    socket to read the response from\r
+    * @param  array         listeners attached to request\r
+    */\r
+    function HTTP_Response(&$sock, &$listeners)\r
+    {\r
+        $this->_sock      =& $sock;\r
+        $this->_listeners =& $listeners;\r
+    }\r
+\r
+\r
+   /**\r
+    * Processes a HTTP response\r
+    *\r
+    * This extracts response code, headers, cookies and decodes body if it\r
+    * was encoded in some way\r
+    *\r
+    * @access public\r
+    * @param  bool      Whether to store response body in object property, set\r
+    *                   this to false if downloading a LARGE file and using a Listener.\r
+    *                   This is assumed to be true if body is gzip-encoded.\r
+    * @param  bool      Whether the response can actually have a message-body.\r
+    *                   Will be set to false for HEAD requests.\r
+    * @throws PEAR_Error\r
+    * @return mixed     true on success, PEAR_Error in case of malformed response\r
+    */\r
+    function process($saveBody = true, $canHaveBody = true)\r
+    {\r
+        do {\r
+            $line = $this->_sock->readLine();\r
+            if (!preg_match('!^(HTTP/\d\.\d) (\d{3})(?: (.+))?!', $line, $s)) {\r
+                return PEAR::raiseError('Malformed response', HTTP_REQUEST_ERROR_RESPONSE);\r
+            } else {\r
+                $this->_protocol = $s[1];\r
+                $this->_code     = intval($s[2]);\r
+                $this->_reason   = empty($s[3])? null: $s[3];\r
+            }\r
+            while ('' !== ($header = $this->_sock->readLine())) {\r
+                $this->_processHeader($header);\r
+            }\r
+        } while (100 == $this->_code);\r
+\r
+        $this->_notify('gotHeaders', $this->_headers);\r
+\r
+        // RFC 2616, section 4.4:\r
+        // 1. Any response message which "MUST NOT" include a message-body ...\r
+        // is always terminated by the first empty line after the header fields\r
+        // 3. ... If a message is received with both a\r
+        // Transfer-Encoding header field and a Content-Length header field,\r
+        // the latter MUST be ignored.\r
+        $canHaveBody = $canHaveBody && $this->_code >= 200 &&\r
+                       $this->_code != 204 && $this->_code != 304;\r
+\r
+        // If response body is present, read it and decode\r
+        $chunked = isset($this->_headers['transfer-encoding']) && ('chunked' == $this->_headers['transfer-encoding']);\r
+        $gzipped = isset($this->_headers['content-encoding']) && ('gzip' == $this->_headers['content-encoding']);\r
+        $hasBody = false;\r
+        if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) ||\r
+                0 != $this->_headers['content-length']))\r
+        {\r
+            if ($chunked || !isset($this->_headers['content-length'])) {\r
+                $this->_toRead = null;\r
+            } else {\r
+                $this->_toRead = $this->_headers['content-length'];\r
+            }\r
+            while (!$this->_sock->eof() && (is_null($this->_toRead) || 0 < $this->_toRead)) {\r
+                if ($chunked) {\r
+                    $data = $this->_readChunked();\r
+                } elseif (is_null($this->_toRead)) {\r
+                    $data = $this->_sock->read(4096);\r
+                } else {\r
+                    $data = $this->_sock->read(min(4096, $this->_toRead));\r
+                    $this->_toRead -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);\r
+                }\r
+                if ('' == $data && (!$this->_chunkLength || $this->_sock->eof())) {\r
+                    break;\r
+                } else {\r
+                    $hasBody = true;\r
+                    if ($saveBody || $gzipped) {\r
+                        $this->_body .= $data;\r
+                    }\r
+                    $this->_notify($gzipped? 'gzTick': 'tick', $data);\r
+                }\r
+            }\r
+        }\r
+\r
+        if ($hasBody) {\r
+            // Uncompress the body if needed\r
+            if ($gzipped) {\r
+                $body = $this->_decodeGzip($this->_body);\r
+                if (PEAR::isError($body)) {\r
+                    return $body;\r
+                }\r
+                $this->_body = $body;\r
+                $this->_notify('gotBody', $this->_body);\r
+            } else {\r
+                $this->_notify('gotBody');\r
+            }\r
+        }\r
+        return true;\r
+    }\r
+\r
+\r
+   /**\r
+    * Processes the response header\r
+    *\r
+    * @access private\r
+    * @param  string    HTTP header\r
+    */\r
+    function _processHeader($header)\r
+    {\r
+        if (false === strpos($header, ':')) {\r
+            return;\r
+        }\r
+        list($headername, $headervalue) = explode(':', $header, 2);\r
+        $headername  = strtolower($headername);\r
+        $headervalue = ltrim($headervalue);\r
+\r
+        if ('set-cookie' != $headername) {\r
+            if (isset($this->_headers[$headername])) {\r
+                $this->_headers[$headername] .= ',' . $headervalue;\r
+            } else {\r
+                $this->_headers[$headername]  = $headervalue;\r
+            }\r
+        } else {\r
+            $this->_parseCookie($headervalue);\r
+        }\r
+    }\r
+\r
+\r
+   /**\r
+    * Parse a Set-Cookie header to fill $_cookies array\r
+    *\r
+    * @access private\r
+    * @param  string    value of Set-Cookie header\r
+    */\r
+    function _parseCookie($headervalue)\r
+    {\r
+        $cookie = array(\r
+            'expires' => null,\r
+            'domain'  => null,\r
+            'path'    => null,\r
+            'secure'  => false\r
+        );\r
+\r
+        // Only a name=value pair\r
+        if (!strpos($headervalue, ';')) {\r
+            $pos = strpos($headervalue, '=');\r
+            $cookie['name']  = trim(substr($headervalue, 0, $pos));\r
+            $cookie['value'] = trim(substr($headervalue, $pos + 1));\r
+\r
+        // Some optional parameters are supplied\r
+        } else {\r
+            $elements = explode(';', $headervalue);\r
+            $pos = strpos($elements[0], '=');\r
+            $cookie['name']  = trim(substr($elements[0], 0, $pos));\r
+            $cookie['value'] = trim(substr($elements[0], $pos + 1));\r
+\r
+            for ($i = 1; $i < count($elements); $i++) {\r
+                if (false === strpos($elements[$i], '=')) {\r
+                    $elName  = trim($elements[$i]);\r
+                    $elValue = null;\r
+                } else {\r
+                    list ($elName, $elValue) = array_map('trim', explode('=', $elements[$i]));\r
+                }\r
+                $elName = strtolower($elName);\r
+                if ('secure' == $elName) {\r
+                    $cookie['secure'] = true;\r
+                } elseif ('expires' == $elName) {\r
+                    $cookie['expires'] = str_replace('"', '', $elValue);\r
+                } elseif ('path' == $elName || 'domain' == $elName) {\r
+                    $cookie[$elName] = urldecode($elValue);\r
+                } else {\r
+                    $cookie[$elName] = $elValue;\r
+                }\r
+            }\r
+        }\r
+        $this->_cookies[] = $cookie;\r
+    }\r
+\r
+\r
+   /**\r
+    * Read a part of response body encoded with chunked Transfer-Encoding\r
+    *\r
+    * @access private\r
+    * @return string\r
+    */\r
+    function _readChunked()\r
+    {\r
+        // at start of the next chunk?\r
+        if (0 == $this->_chunkLength) {\r
+            $line = $this->_sock->readLine();\r
+            if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {\r
+                $this->_chunkLength = hexdec($matches[1]);\r
+                // Chunk with zero length indicates the end\r
+                if (0 == $this->_chunkLength) {\r
+                    $this->_sock->readLine(); // make this an eof()\r
+                    return '';\r
+                }\r
+            } else {\r
+                return '';\r
+            }\r
+        }\r
+        $data = $this->_sock->read($this->_chunkLength);\r
+        $this->_chunkLength -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);\r
+        if (0 == $this->_chunkLength) {\r
+            $this->_sock->readLine(); // Trailing CRLF\r
+        }\r
+        return $data;\r
+    }\r
+\r
+\r
+   /**\r
+    * Notifies all registered listeners of an event.\r
+    *\r
+    * @param    string  Event name\r
+    * @param    mixed   Additional data\r
+    * @access   private\r
+    * @see HTTP_Request::_notify()\r
+    */\r
+    function _notify($event, $data = null)\r
+    {\r
+        foreach (array_keys($this->_listeners) as $id) {\r
+            $this->_listeners[$id]->update($this, $event, $data);\r
+        }\r
+    }\r
+\r
+\r
+   /**\r
+    * Decodes the message-body encoded by gzip\r
+    *\r
+    * The real decoding work is done by gzinflate() built-in function, this\r
+    * method only parses the header and checks data for compliance with\r
+    * RFC 1952\r
+    *\r
+    * @access   private\r
+    * @param    string  gzip-encoded data\r
+    * @return   string  decoded data\r
+    */\r
+    function _decodeGzip($data)\r
+    {\r
+        if (HTTP_REQUEST_MBSTRING) {\r
+            $oldEncoding = mb_internal_encoding();\r
+            mb_internal_encoding('iso-8859-1');\r
+        }\r
+        $length = strlen($data);\r
+        // If it doesn't look like gzip-encoded data, don't bother\r
+        if (18 > $length || strcmp(substr($data, 0, 2), "\x1f\x8b")) {\r
+            return $data;\r
+        }\r
+        $method = ord(substr($data, 2, 1));\r
+        if (8 != $method) {\r
+            return PEAR::raiseError('_decodeGzip(): unknown compression method', HTTP_REQUEST_ERROR_GZIP_METHOD);\r
+        }\r
+        $flags = ord(substr($data, 3, 1));\r
+        if ($flags & 224) {\r
+            return PEAR::raiseError('_decodeGzip(): reserved bits are set', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+        }\r
+\r
+        // header is 10 bytes minimum. may be longer, though.\r
+        $headerLength = 10;\r
+        // extra fields, need to skip 'em\r
+        if ($flags & 4) {\r
+            if ($length - $headerLength - 2 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $extraLength = unpack('v', substr($data, 10, 2));\r
+            if ($length - $headerLength - 2 - $extraLength[1] < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $headerLength += $extraLength[1] + 2;\r
+        }\r
+        // file name, need to skip that\r
+        if ($flags & 8) {\r
+            if ($length - $headerLength - 1 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $filenameLength = strpos(substr($data, $headerLength), chr(0));\r
+            if (false === $filenameLength || $length - $headerLength - $filenameLength - 1 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $headerLength += $filenameLength + 1;\r
+        }\r
+        // comment, need to skip that also\r
+        if ($flags & 16) {\r
+            if ($length - $headerLength - 1 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $commentLength = strpos(substr($data, $headerLength), chr(0));\r
+            if (false === $commentLength || $length - $headerLength - $commentLength - 1 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $headerLength += $commentLength + 1;\r
+        }\r
+        // have a CRC for header. let's check\r
+        if ($flags & 1) {\r
+            if ($length - $headerLength - 2 < 8) {\r
+                return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);\r
+            }\r
+            $crcReal   = 0xffff & crc32(substr($data, 0, $headerLength));\r
+            $crcStored = unpack('v', substr($data, $headerLength, 2));\r
+            if ($crcReal != $crcStored[1]) {\r
+                return PEAR::raiseError('_decodeGzip(): header CRC check failed', HTTP_REQUEST_ERROR_GZIP_CRC);\r
+            }\r
+            $headerLength += 2;\r
+        }\r
+        // unpacked data CRC and size at the end of encoded data\r
+        $tmp = unpack('V2', substr($data, -8));\r
+        $dataCrc  = $tmp[1];\r
+        $dataSize = $tmp[2];\r
+\r
+        // finally, call the gzinflate() function\r
+        // don't pass $dataSize to gzinflate, see bugs #13135, #14370\r
+        $unpacked = gzinflate(substr($data, $headerLength, -8));\r
+        if (false === $unpacked) {\r
+            return PEAR::raiseError('_decodeGzip(): gzinflate() call failed', HTTP_REQUEST_ERROR_GZIP_READ);\r
+        } elseif ($dataSize != strlen($unpacked)) {\r
+            return PEAR::raiseError('_decodeGzip(): data size check failed', HTTP_REQUEST_ERROR_GZIP_READ);\r
+        } elseif ((0xffffffff & $dataCrc) != (0xffffffff & crc32($unpacked))) {\r
+            return PEAR::raiseError('_decodeGzip(): data CRC check failed', HTTP_REQUEST_ERROR_GZIP_CRC);\r
+        }\r
+        if (HTTP_REQUEST_MBSTRING) {\r
+            mb_internal_encoding($oldEncoding);\r
+        }\r
+        return $unpacked;\r
+    }\r
+} // End class HTTP_Response\r
+?>\r
diff --git a/extlib/HTTP/Request/Listener.php b/extlib/HTTP/Request/Listener.php
new file mode 100644 (file)
index 0000000..b4fe444
--- /dev/null
@@ -0,0 +1,106 @@
+<?php\r
+/**\r
+ * Listener for HTTP_Request and HTTP_Response objects\r
+ *\r
+ * PHP versions 4 and 5\r
+ * \r
+ * LICENSE:\r
+ *\r
+ * Copyright (c) 2002-2007, Richard Heyes\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * o Redistributions of source code must retain the above copyright\r
+ *   notice, this list of conditions and the following disclaimer.\r
+ * o Redistributions in binary form must reproduce the above copyright\r
+ *   notice, this list of conditions and the following disclaimer in the\r
+ *   documentation and/or other materials provided with the distribution.\r
+ * o The names of the authors may not be used to endorse or promote\r
+ *   products derived from this software without specific prior written\r
+ *   permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * @category    HTTP\r
+ * @package     HTTP_Request\r
+ * @author      Alexey Borzov <avb@php.net>\r
+ * @copyright   2002-2007 Richard Heyes\r
+ * @license     http://opensource.org/licenses/bsd-license.php New BSD License\r
+ * @version     CVS: $Id: Listener.php,v 1.3 2007/05/18 10:33:31 avb Exp $\r
+ * @link        http://pear.php.net/package/HTTP_Request/ \r
+ */\r
+\r
+/**\r
+ * Listener for HTTP_Request and HTTP_Response objects\r
+ *\r
+ * This class implements the Observer part of a Subject-Observer\r
+ * design pattern.\r
+ *\r
+ * @category    HTTP\r
+ * @package     HTTP_Request\r
+ * @author      Alexey Borzov <avb@php.net>\r
+ * @version     Release: 1.4.4\r
+ */\r
+class HTTP_Request_Listener \r
+{\r
+   /**\r
+    * A listener's identifier\r
+    * @var string\r
+    */\r
+    var $_id;\r
+\r
+   /**\r
+    * Constructor, sets the object's identifier\r
+    *\r
+    * @access public\r
+    */\r
+    function HTTP_Request_Listener()\r
+    {\r
+        $this->_id = md5(uniqid('http_request_', 1));\r
+    }\r
+\r
+\r
+   /**\r
+    * Returns the listener's identifier\r
+    *\r
+    * @access public\r
+    * @return string\r
+    */\r
+    function getId()\r
+    {\r
+        return $this->_id;\r
+    }\r
+\r
+\r
+   /**\r
+    * This method is called when Listener is notified of an event\r
+    *\r
+    * @access   public\r
+    * @param    object  an object the listener is attached to\r
+    * @param    string  Event name\r
+    * @param    mixed   Additional data\r
+    * @abstract\r
+    */\r
+    function update(&$subject, $event, $data = null)\r
+    {\r
+        echo "Notified of event: '$event'\n";\r
+        if (null !== $data) {\r
+            echo "Additional data: ";\r
+            var_dump($data);\r
+        }\r
+    }\r
+}\r
+?>\r
diff --git a/extlib/Net/URL2.php b/extlib/Net/URL2.php
new file mode 100644 (file)
index 0000000..7a654ae
--- /dev/null
@@ -0,0 +1,813 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2007-2008, Christian Schmidt, Peytz & Co. A/S           |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Christian Schmidt <schmidt at php dot net>                    |
+// +-----------------------------------------------------------------------+
+//
+// $Id: URL2.php,v 1.10 2008/04/26 21:57:08 schmidt Exp $
+//
+// Net_URL2 Class (PHP5 Only)
+
+// This code is released under the BSD License - http://www.opensource.org/licenses/bsd-license.php
+/**
+ * @license BSD License
+ */
+class Net_URL2
+{
+    /**
+     * Do strict parsing in resolve() (see RFC 3986, section 5.2.2). Default
+     * is true.
+     */
+    const OPTION_STRICT           = 'strict';
+
+    /**
+     * Represent arrays in query using PHP's [] notation. Default is true.
+     */
+    const OPTION_USE_BRACKETS     = 'use_brackets';
+
+    /**
+     * URL-encode query variable keys. Default is true.
+     */
+    const OPTION_ENCODE_KEYS      = 'encode_keys';
+
+    /**
+     * Query variable separators when parsing the query string. Every character
+     * is considered a separator. Default is specified by the
+     * arg_separator.input php.ini setting (this defaults to "&").
+     */
+    const OPTION_SEPARATOR_INPUT  = 'input_separator';
+
+    /**
+     * Query variable separator used when generating the query string. Default
+     * is specified by the arg_separator.output php.ini setting (this defaults
+     * to "&").
+     */
+    const OPTION_SEPARATOR_OUTPUT = 'output_separator';
+
+    /**
+     * Default options corresponds to how PHP handles $_GET.
+     */
+    private $options = array(
+        self::OPTION_STRICT           => true,
+        self::OPTION_USE_BRACKETS     => true,
+        self::OPTION_ENCODE_KEYS      => true,
+        self::OPTION_SEPARATOR_INPUT  => 'x&',
+        self::OPTION_SEPARATOR_OUTPUT => 'x&',
+        );
+
+    /**
+     * @var  string|bool
+     */
+    private $scheme = false;
+
+    /**
+     * @var  string|bool
+     */
+    private $userinfo = false;
+
+    /**
+     * @var  string|bool
+     */
+    private $host = false;
+
+    /**
+     * @var  int|bool
+     */
+    private $port = false;
+
+    /**
+     * @var  string
+     */
+    private $path = '';
+
+    /**
+     * @var  string|bool
+     */
+    private $query = false;
+
+    /**
+     * @var  string|bool
+     */
+    private $fragment = false;
+
+    /**
+     * @param string $url     an absolute or relative URL
+     * @param array  $options
+     */
+    public function __construct($url, $options = null)
+    {
+        $this->setOption(self::OPTION_SEPARATOR_INPUT,
+                         ini_get('arg_separator.input'));
+        $this->setOption(self::OPTION_SEPARATOR_OUTPUT,
+                         ini_get('arg_separator.output'));
+        if (is_array($options)) {
+            foreach ($options as $optionName => $value) {
+                $this->setOption($optionName);
+            }
+        }
+
+        if (preg_match('@^([a-z][a-z0-9.+-]*):@i', $url, $reg)) {
+            $this->scheme = $reg[1];
+            $url = substr($url, strlen($reg[0]));
+        }
+
+        if (preg_match('@^//([^/#?]+)@', $url, $reg)) {
+            $this->setAuthority($reg[1]);
+            $url = substr($url, strlen($reg[0]));
+        }
+
+        $i = strcspn($url, '?#');
+        $this->path = substr($url, 0, $i);
+        $url = substr($url, $i);
+
+        if (preg_match('@^\?([^#]*)@', $url, $reg)) {
+            $this->query = $reg[1];
+            $url = substr($url, strlen($reg[0]));
+        }
+
+        if ($url) {
+            $this->fragment = substr($url, 1);
+        }
+    }
+
+    /**
+     * Returns the scheme, e.g. "http" or "urn", or false if there is no
+     * scheme specified, i.e. if this is a relative URL.
+     *
+     * @return  string|bool
+     */
+    public function getScheme()
+    {
+        return $this->scheme;
+    }
+
+    /**
+     * @param string|bool $scheme
+     *
+     * @return void
+     * @see    getScheme()
+     */
+    public function setScheme($scheme)
+    {
+        $this->scheme = $scheme;
+    }
+
+    /**
+     * Returns the user part of the userinfo part (the part preceding the first
+     *  ":"), or false if there is no userinfo part.
+     *
+     * @return  string|bool
+     */
+    public function getUser()
+    {
+        return $this->userinfo !== false ? preg_replace('@:.*$@', '', $this->userinfo) : false;
+    }
+
+    /**
+     * Returns the password part of the userinfo part (the part after the first
+     *  ":"), or false if there is no userinfo part (i.e. the URL does not
+     * contain "@" in front of the hostname) or the userinfo part does not
+     * contain ":".
+     *
+     * @return  string|bool
+     */
+    public function getPassword()
+    {
+        return $this->userinfo !== false ? substr(strstr($this->userinfo, ':'), 1) : false;
+    }
+
+    /**
+     * Returns the userinfo part, or false if there is none, i.e. if the
+     * authority part does not contain "@".
+     *
+     * @return  string|bool
+     */
+    public function getUserinfo()
+    {
+        return $this->userinfo;
+    }
+
+    /**
+     * Sets the userinfo part. If two arguments are passed, they are combined
+     * in the userinfo part as username ":" password.
+     *
+     * @param string|bool $userinfo userinfo or username
+     * @param string|bool $password
+     *
+     * @return void
+     */
+    public function setUserinfo($userinfo, $password = false)
+    {
+        $this->userinfo = $userinfo;
+        if ($password !== false) {
+            $this->userinfo .= ':' . $password;
+        }
+    }
+
+    /**
+     * Returns the host part, or false if there is no authority part, e.g.
+     * relative URLs.
+     *
+     * @return  string|bool
+     */
+    public function getHost()
+    {
+        return $this->host;
+    }
+
+    /**
+     * @param string|bool $host
+     *
+     * @return void
+     */
+    public function setHost($host)
+    {
+        $this->host = $host;
+    }
+
+    /**
+     * Returns the port number, or false if there is no port number specified,
+     * i.e. if the default port is to be used.
+     *
+     * @return  int|bool
+     */
+    public function getPort()
+    {
+        return $this->port;
+    }
+
+    /**
+     * @param int|bool $port
+     *
+     * @return void
+     */
+    public function setPort($port)
+    {
+        $this->port = intval($port);
+    }
+
+    /**
+     * Returns the authority part, i.e. [ userinfo "@" ] host [ ":" port ], or
+     * false if there is no authority none.
+     *
+     * @return string|bool
+     */
+    public function getAuthority()
+    {
+        if (!$this->host) {
+            return false;
+        }
+
+        $authority = '';
+
+        if ($this->userinfo !== false) {
+            $authority .= $this->userinfo . '@';
+        }
+
+        $authority .= $this->host;
+
+        if ($this->port !== false) {
+            $authority .= ':' . $this->port;
+        }
+
+        return $authority;
+    }
+
+    /**
+     * @param string|false $authority
+     *
+     * @return void
+     */
+    public function setAuthority($authority)
+    {
+        $this->user = false;
+        $this->pass = false;
+        $this->host = false;
+        $this->port = false;
+        if (preg_match('@^(([^\@]+)\@)?([^:]+)(:(\d*))?$@', $authority, $reg)) {
+            if ($reg[1]) {
+                $this->userinfo = $reg[2];
+            }
+
+            $this->host = $reg[3];
+            if (isset($reg[5])) {
+                $this->port = intval($reg[5]);
+            }
+        }
+    }
+
+    /**
+     * Returns the path part (possibly an empty string).
+     *
+     * @return string
+     */
+    public function getPath()
+    {
+        return $this->path;
+    }
+
+    /**
+     * @param string $path
+     *
+     * @return void
+     */
+    public function setPath($path)
+    {
+        $this->path = $path;
+    }
+
+    /**
+     * Returns the query string (excluding the leading "?"), or false if "?"
+     * isn't present in the URL.
+     *
+     * @return  string|bool
+     * @see     self::getQueryVariables()
+     */
+    public function getQuery()
+    {
+        return $this->query;
+    }
+
+    /**
+     * @param string|bool $query
+     *
+     * @return void
+     * @see   self::setQueryVariables()
+     */
+    public function setQuery($query)
+    {
+        $this->query = $query;
+    }
+
+    /**
+     * Returns the fragment name, or false if "#" isn't present in the URL.
+     *
+     * @return  string|bool
+     */
+    public function getFragment()
+    {
+        return $this->fragment;
+    }
+
+    /**
+     * @param string|bool $fragment
+     *
+     * @return void
+     */
+    public function setFragment($fragment)
+    {
+        $this->fragment = $fragment;
+    }
+
+    /**
+     * Returns the query string like an array as the variables would appear in
+     * $_GET in a PHP script.
+     *
+     * @return  array
+     */
+    public function getQueryVariables()
+    {
+        $pattern = '/[' .
+                   preg_quote($this->getOption(self::OPTION_SEPARATOR_INPUT), '/') .
+                   ']/';
+        $parts   = preg_split($pattern, $this->query, -1, PREG_SPLIT_NO_EMPTY);
+        $return  = array();
+
+        foreach ($parts as $part) {
+            if (strpos($part, '=') !== false) {
+                list($key, $value) = explode('=', $part, 2);
+            } else {
+                $key   = $part;
+                $value = null;
+            }
+
+            if ($this->getOption(self::OPTION_ENCODE_KEYS)) {
+                $key = rawurldecode($key);
+            }
+            $value = rawurldecode($value);
+
+            if ($this->getOption(self::OPTION_USE_BRACKETS) &&
+                preg_match('#^(.*)\[([0-9a-z_-]*)\]#i', $key, $matches)) {
+
+                $key = $matches[1];
+                $idx = $matches[2];
+
+                // Ensure is an array
+                if (empty($return[$key]) || !is_array($return[$key])) {
+                    $return[$key] = array();
+                }
+
+                // Add data
+                if ($idx === '') {
+                    $return[$key][] = $value;
+                } else {
+                    $return[$key][$idx] = $value;
+                }
+            } elseif (!$this->getOption(self::OPTION_USE_BRACKETS)
+                      && !empty($return[$key])
+            ) {
+                $return[$key]   = (array) $return[$key];
+                $return[$key][] = $value;
+            } else {
+                $return[$key] = $value;
+            }
+        }
+
+        return $return;
+    }
+
+    /**
+     * @param array $array (name => value) array
+     *
+     * @return void
+     */
+    public function setQueryVariables(array $array)
+    {
+        if (!$array) {
+            $this->query = false;
+        } else {
+            foreach ($array as $name => $value) {
+                if ($this->getOption(self::OPTION_ENCODE_KEYS)) {
+                    $name = rawurlencode($name);
+                }
+
+                if (is_array($value)) {
+                    foreach ($value as $k => $v) {
+                        $parts[] = $this->getOption(self::OPTION_USE_BRACKETS)
+                            ? sprintf('%s[%s]=%s', $name, $k, $v)
+                            : ($name . '=' . $v);
+                    }
+                } elseif (!is_null($value)) {
+                    $parts[] = $name . '=' . $value;
+                } else {
+                    $parts[] = $name;
+                }
+            }
+            $this->query = implode($this->getOption(self::OPTION_SEPARATOR_OUTPUT),
+                                   $parts);
+        }
+    }
+
+    /**
+     * @param string $name
+     * @param mixed  $value
+     *
+     * @return  array
+     */
+    public function setQueryVariable($name, $value)
+    {
+        $array = $this->getQueryVariables();
+        $array[$name] = $value;
+        $this->setQueryVariables($array);
+    }
+
+    /**
+     * @param string $name
+     *
+     * @return void
+     */
+    public function unsetQueryVariable($name)
+    {
+        $array = $this->getQueryVariables();
+        unset($array[$name]);
+        $this->setQueryVariables($array);
+    }
+
+    /**
+     * Returns a string representation of this URL.
+     *
+     * @return  string
+     */
+    public function getURL()
+    {
+        // See RFC 3986, section 5.3
+        $url = "";
+
+        if ($this->scheme !== false) {
+            $url .= $this->scheme . ':';
+        }
+
+        $authority = $this->getAuthority();
+        if ($authority !== false) {
+            $url .= '//' . $authority;
+        }
+        $url .= $this->path;
+
+        if ($this->query !== false) {
+            $url .= '?' . $this->query;
+        }
+
+        if ($this->fragment !== false) {
+            $url .= '#' . $this->fragment;
+        }
+    
+        return $url;
+    }
+
+    /** 
+     * Returns a normalized string representation of this URL. This is useful
+     * for comparison of URLs.
+     *
+     * @return  string
+     */
+    public function getNormalizedURL()
+    {
+        $url = clone $this;
+        $url->normalize();
+        return $url->getUrl();
+    }
+
+    /** 
+     * Returns a normalized Net_URL2 instance.
+     *
+     * @return  Net_URL2
+     */
+    public function normalize()
+    {
+        // See RFC 3886, section 6
+
+        // Schemes are case-insensitive
+        if ($this->scheme) {
+            $this->scheme = strtolower($this->scheme);
+        }
+
+        // Hostnames are case-insensitive
+        if ($this->host) {
+            $this->host = strtolower($this->host);
+        }
+
+        // Remove default port number for known schemes (RFC 3986, section 6.2.3)
+        if ($this->port &&
+            $this->scheme &&
+            $this->port == getservbyname($this->scheme, 'tcp')) {
+
+            $this->port = false;
+        }
+
+        // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
+        foreach (array('userinfo', 'host', 'path') as $part) {
+            if ($this->$part) {
+                $this->$part  = preg_replace('/%[0-9a-f]{2}/ie', 'strtoupper("\0")', $this->$part);
+            }
+        }
+
+        // Path segment normalization (RFC 3986, section 6.2.2.3)
+        $this->path = self::removeDotSegments($this->path);
+
+        // Scheme based normalization (RFC 3986, section 6.2.3)
+        if ($this->host && !$this->path) {
+            $this->path = '/';
+        }
+    }
+
+    /**
+     * Returns whether this instance represents an absolute URL.
+     *
+     * @return  bool
+     */
+    public function isAbsolute()
+    {
+        return (bool) $this->scheme;
+    }
+
+    /**
+     * Returns an Net_URL2 instance representing an absolute URL relative to
+     * this URL.
+     *
+     * @param Net_URL2|string $reference relative URL
+     *
+     * @return Net_URL2
+     */
+    public function resolve($reference)
+    {
+        if (is_string($reference)) {
+            $reference = new self($reference);
+        }
+        if (!$this->isAbsolute()) {
+            throw new Exception('Base-URL must be absolute');
+        }
+
+        // A non-strict parser may ignore a scheme in the reference if it is
+        // identical to the base URI's scheme.
+        if (!$this->getOption(self::OPTION_STRICT) && $reference->scheme == $this->scheme) {
+            $reference->scheme = false;
+        }
+
+        $target = new self('');
+        if ($reference->scheme !== false) {
+            $target->scheme = $reference->scheme;
+            $target->setAuthority($reference->getAuthority());
+            $target->path  = self::removeDotSegments($reference->path);
+            $target->query = $reference->query;
+        } else {
+            $authority = $reference->getAuthority();
+            if ($authority !== false) {
+                $target->setAuthority($authority);
+                $target->path  = self::removeDotSegments($reference->path);
+                $target->query = $reference->query;
+            } else {
+                if ($reference->path == '') {
+                    $target->path = $this->path;
+                    if ($reference->query !== false) {
+                        $target->query = $reference->query;
+                    } else {
+                        $target->query = $this->query;
+                    }
+                } else {
+                    if (substr($reference->path, 0, 1) == '/') {
+                        $target->path = self::removeDotSegments($reference->path);
+                    } else {
+                        // Merge paths (RFC 3986, section 5.2.3)
+                        if ($this->host !== false && $this->path == '') {
+                            $target->path = '/' . $this->path;
+                        } else {
+                            $i = strrpos($this->path, '/');
+                            if ($i !== false) {
+                                $target->path = substr($this->path, 0, $i + 1);
+                            }
+                            $target->path .= $reference->path;
+                        }
+                        $target->path = self::removeDotSegments($target->path);
+                    }
+                    $target->query = $reference->query;
+                }
+                $target->setAuthority($this->getAuthority());
+            }
+            $target->scheme = $this->scheme;
+        }
+
+        $target->fragment = $reference->fragment;
+
+        return $target;
+    }
+
+    /**
+     * Removes dots as described in RFC 3986, section 5.2.4, e.g.
+     * "/foo/../bar/baz" => "/bar/baz"
+     *
+     * @param string $path a path
+     *
+     * @return string a path
+     */
+    private static function removeDotSegments($path)
+    {
+        $output = '';
+
+        // Make sure not to be trapped in an infinite loop due to a bug in this
+        // method
+        $j = 0; 
+        while ($path && $j++ < 100) {
+            // Step A
+            if (substr($path, 0, 2) == './') {
+                $path = substr($path, 2);
+            } elseif (substr($path, 0, 3) == '../') {
+                $path = substr($path, 3);
+
+            // Step B
+            } elseif (substr($path, 0, 3) == '/./' || $path == '/.') {
+                $path = '/' . substr($path, 3);
+
+            // Step C
+            } elseif (substr($path, 0, 4) == '/../' || $path == '/..') {
+                $path = '/' . substr($path, 4);
+                $i = strrpos($output, '/');
+                $output = $i === false ? '' : substr($output, 0, $i);
+
+            // Step D
+            } elseif ($path == '.' || $path == '..') {
+                $path = '';
+
+            // Step E
+            } else {
+                $i = strpos($path, '/');
+                if ($i === 0) {
+                    $i = strpos($path, '/', 1);
+                }
+                if ($i === false) {
+                    $i = strlen($path);
+                }
+                $output .= substr($path, 0, $i);
+                $path = substr($path, $i);
+            }
+        }
+
+        return $output;
+    }
+
+    /**
+     * Returns a Net_URL2 instance representing the canonical URL of the
+     * currently executing PHP script.
+     * 
+     * @return  string
+     */
+    public static function getCanonical()
+    {
+        if (!isset($_SERVER['REQUEST_METHOD'])) {
+            // ALERT - no current URL
+            throw new Exception('Script was not called through a webserver');
+        }
+
+        // Begin with a relative URL
+        $url = new self($_SERVER['PHP_SELF']);
+        $url->scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http';
+        $url->host = $_SERVER['SERVER_NAME'];
+        $port = intval($_SERVER['SERVER_PORT']);
+        if ($url->scheme == 'http' && $port != 80 ||
+            $url->scheme == 'https' && $port != 443) {
+
+            $url->port = $port;
+        }
+        return $url;
+    }
+
+    /**
+     * Returns the URL used to retrieve the current request.
+     *
+     * @return  string
+     */
+    public static function getRequestedURL()
+    {
+        return self::getRequested()->getUrl();
+    }
+
+    /**
+     * Returns a Net_URL2 instance representing the URL used to retrieve the
+     * current request.
+     *
+     * @return  Net_URL2
+     */
+    public static function getRequested()
+    {
+        if (!isset($_SERVER['REQUEST_METHOD'])) {
+            // ALERT - no current URL
+            throw new Exception('Script was not called through a webserver');
+        }
+
+        // Begin with a relative URL
+        $url = new self($_SERVER['REQUEST_URI']);
+        $url->scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http';
+        // Set host and possibly port
+        $url->setAuthority($_SERVER['HTTP_HOST']);
+        return $url;
+    }
+
+    /**
+     * Sets the specified option.
+     *
+     * @param string $optionName a self::OPTION_ constant
+     * @param mixed  $value      option value  
+     *
+     * @return void
+     * @see  self::OPTION_STRICT
+     * @see  self::OPTION_USE_BRACKETS
+     * @see  self::OPTION_ENCODE_KEYS
+     */
+    function setOption($optionName, $value)
+    {
+        if (!array_key_exists($optionName, $this->options)) {
+            return false;
+        }
+        $this->options[$optionName] = $value;
+    }
+
+    /**
+     * Returns the value of the specified option.
+     *
+     * @param string $optionName The name of the option to retrieve
+     *
+     * @return  mixed
+     */
+    function getOption($optionName)
+    {
+        return isset($this->options[$optionName])
+            ? $this->options[$optionName] : false;
+    }
+}
diff --git a/extlib/Services/oEmbed.php b/extlib/Services/oEmbed.php
new file mode 100644 (file)
index 0000000..5d38ed8
--- /dev/null
@@ -0,0 +1,357 @@
+<?php
+
+/**
+ * An interface for oEmbed consumption
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Validate.php';
+require_once 'Net/URL2.php';
+require_once 'HTTP/Request.php';
+require_once 'Services/oEmbed/Exception.php';
+require_once 'Services/oEmbed/Exception/NoSupport.php';
+require_once 'Services/oEmbed/Object.php';
+
+/**
+ * Base class for consuming oEmbed objects
+ *
+ * <code>
+ * <?php
+ * 
+ * require_once 'Services/oEmbed.php';
+ *
+ * // The URL that we'd like to find out more information about.
+ * $url = 'http://flickr.com/photos/joestump/2848795611/';
+ *
+ * // The oEmbed API URI. Not all providers support discovery yet so we're
+ * // explicitly providing one here. If one is not provided Services_oEmbed
+ * // attempts to discover it. If none is found an exception is thrown.
+ * $oEmbed = new Services_oEmbed($url, array(
+ *     Services_oEmbed::OPTION_API => 'http://www.flickr.com/services/oembed/'
+ * ));
+ * $object = $oEmbed->getObject();
+ *
+ * // All of the objects have somewhat sane __toString() methods that allow
+ * // you to output them directly.
+ * echo (string)$object;
+ * 
+ * ?>
+ * </code> 
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed
+{
+    /**
+     * HTTP timeout in seconds
+     * 
+     * All HTTP requests made by Services_oEmbed will respect this timeout. 
+     * This can be passed to {@link Services_oEmbed::setOption()} or to the
+     * options parameter in {@link Services_oEmbed::__construct()}.
+     * 
+     * @var string OPTION_TIMEOUT Timeout in seconds 
+     */
+    const OPTION_TIMEOUT = 'http_timeout';
+
+    /**
+     * HTTP User-Agent 
+     *
+     * All HTTP requests made by Services_oEmbed will be sent with the 
+     * string set by this option.
+     *
+     * @var string OPTION_USER_AGENT The HTTP User-Agent string
+     */
+    const OPTION_USER_AGENT = 'http_user_agent';
+
+    /**
+     * The API's URI
+     *
+     * If the API is known ahead of time this option can be used to explicitly
+     * set it. If not present then the API is attempted to be discovered 
+     * through the auto-discovery mechanism.
+     *
+     * @var string OPTION_API
+     */
+    const OPTION_API = 'oembed_api';
+
+    /**
+     * Options for oEmbed requests
+     *
+     * @var array $options The options for making requests
+     */
+    protected $options = array(
+        self::OPTION_TIMEOUT    => 3,
+        self::OPTION_API        => null,
+        self::OPTION_USER_AGENT => 'Services_oEmbed 0.1.0'
+    );
+
+    /**
+     * URL of object to get embed information for
+     *
+     * @var object $url {@link Net_URL2} instance of URL of object
+     */
+    protected $url = null;
+
+    /**
+     * Constructor
+     *
+     * @param string $url     The URL to fetch an oEmbed for
+     * @param array  $options A list of options for the oEmbed lookup
+     *
+     * @throws {@link Services_oEmbed_Exception} if the $url is invalid
+     * @throws {@link Services_oEmbed_Exception} when no valid API is found
+     * @return void
+     */
+    public function __construct($url, array $options = array())
+    {
+        if (Validate::uri($url)) {
+            $this->url = new Net_URL2($url);
+        } else {
+            throw new Services_oEmbed_Exception('URL is invalid');
+        }
+
+        if (count($options)) {
+            foreach ($options as $key => $val) {
+                $this->setOption($key, $val);
+            }
+        }
+
+        if ($this->options[self::OPTION_API] === null) {
+            $this->options[self::OPTION_API] = $this->discover();
+        } 
+    }
+
+    /**
+     * Set an option for the oEmbed request
+     * 
+     * @param mixed $option The option name
+     * @param mixed $value  The option value
+     *
+     * @see Services_oEmbed::OPTION_API, Services_oEmbed::OPTION_TIMEOUT
+     * @throws {@link Services_oEmbed_Exception} on invalid option
+     * @access public
+     * @return void
+     */
+    public function setOption($option, $value)
+    {
+        switch ($option) {
+        case self::OPTION_API:
+        case self::OPTION_TIMEOUT:
+            break;
+        default:
+            throw new Services_oEmbed_Exception(
+                'Invalid option "' . $option . '"'
+            );
+        }
+
+        $func = '_set_' . $option;
+        if (method_exists($this, $func)) {
+            $this->options[$option] = $this->$func($value);
+        } else {
+            $this->options[$option] = $value;
+        }
+    }
+
+    /**
+     * Set the API option
+     * 
+     * @param string $value The API's URI
+     *
+     * @throws {@link Services_oEmbed_Exception} on invalid API URI
+     * @see Validate::uri()
+     * @return string
+     */
+    protected function _set_oembed_api($value)
+    {
+        if (!Validate::uri($value)) {
+            throw new Services_oEmbed_Exception(
+                'API URI provided is invalid'
+            );
+        }
+
+        return $value;
+    }
+
+    /**
+     * Get the oEmbed response
+     *
+     * @param array $params Optional parameters for 
+     * 
+     * @throws {@link Services_oEmbed_Exception} on cURL errors
+     * @throws {@link Services_oEmbed_Exception} on HTTP errors
+     * @throws {@link Services_oEmbed_Exception} when result is not parsable 
+     * @return object The oEmbed response as an object
+     */
+    public function getObject(array $params = array())
+    {
+        $params['url'] = $this->url->getURL();
+        if (!isset($params['format'])) {
+            $params['format'] = 'json';
+        }
+
+        $sets = array();
+        foreach ($params as $var => $val) {
+            $sets[] = $var . '=' . urlencode($val);
+        }
+
+        $url = $this->options[self::OPTION_API] . '?' . implode('&', $sets);
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->options[self::OPTION_TIMEOUT]);
+        $result = curl_exec($ch);
+
+        if (curl_errno($ch)) {
+            throw new Services_oEmbed_Exception(
+                curl_error($ch), curl_errno($ch)
+            );
+        }
+
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+        if (substr($code, 0, 1) != '2') {
+            throw new Services_oEmbed_Exception('Non-200 code returned');
+        }
+
+        curl_close($ch);
+
+        switch ($params['format']) {
+        case 'json':
+            $res = json_decode($result);
+            if (!is_object($res)) {
+                throw new Services_oEmbed_Exception(
+                    'Could not parse JSON response'
+                );
+            }
+            break;
+        case 'xml':
+            libxml_use_internal_errors(true);
+            $res = simplexml_load_string($result);
+            if (!$res instanceof SimpleXMLElement) {
+                $errors = libxml_get_errors();
+                $err    = array_shift($errors);
+                libxml_clear_errors();
+                libxml_use_internal_errors(false);
+                throw new Services_oEmbed_Exception(
+                    $err->message, $error->code
+                );
+            }
+            break;
+        }
+
+        return Services_oEmbed_Object::factory($res);
+    }
+
+    /**
+     * Discover an oEmbed API 
+     *
+     * @param string $url The URL to attempt to discover oEmbed for
+     *
+     * @throws {@link Services_oEmbed_Exception} if the $url is invalid
+     * @return string The oEmbed API endpoint discovered
+     */
+    protected function discover($url)
+    {
+        $body = $this->sendRequest($url);
+
+        // Find all <link /> tags that have a valid oembed type set. We then
+        // extract the href attribute for each type.
+        $regexp = '#<link([^>]*)type="' . 
+                  '(application/json|text/xml)\+oembed"([^>]*)>#i';
+
+        $m = $ret = array();
+        if (!preg_match_all($regexp, $body, $m)) {
+            throw new Services_oEmbed_Exception_NoSupport(
+                'No valid oEmbed links found on page'
+            );
+        }
+
+        foreach ($m[0] as $i => $link) {
+            $h = array();
+            if (preg_match('/href="([^"]+)"/i', $link, $h)) {
+                $ret[$m[2][$i]] = $h[1];
+            }
+        } 
+
+        return (isset($ret['json']) ? $ret['json'] : array_pop($ret));
+    }
+
+    /**
+     * Send a GET request to the provider
+     * 
+     * @param mixed $url The URL to send the request to
+     *
+     * @throws {@link Services_oEmbed_Exception} on HTTP errors
+     * @return string The contents of the response
+     */
+    private function sendRequest($url)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->options[self::OPTION_TIMEOUT]);
+        curl_setopt($ch, CURLOPT_USERAGENT, $this->options[self::OPTION_USER_AGENT]);
+        $result = curl_exec($ch);
+        if (curl_errno($ch)) {
+            throw new Services_oEmbed_Exception(
+                curl_error($ch), curl_errno($ch)
+            );
+        }
+
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+        if (substr($code, 0, 1) != '2') {
+            throw new Services_oEmbed_Exception('Non-200 code returned');
+        }
+
+        return $result;
+    }
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Exception.php b/extlib/Services/oEmbed/Exception.php
new file mode 100644 (file)
index 0000000..446ac2a
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * Base exception class for {@link Services_oEmbed}
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'PEAR/Exception.php';
+
+/**
+ * Base exception class for {@link Services_oEmbed}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Exception extends PEAR_Exception
+{
+
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Exception/NoSupport.php b/extlib/Services/oEmbed/Exception/NoSupport.php
new file mode 100644 (file)
index 0000000..384c719
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * Exception class when no oEmbed support is discovered
+ *
+ * PHP version 5.2.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+/**
+ * Exception class when no oEmbed support is discovered
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Exception_NoSupport extends Services_oEmbed_Exception
+{
+    
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object.php b/extlib/Services/oEmbed/Object.php
new file mode 100644 (file)
index 0000000..9eedd7e
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+
+/**
+ * An interface for oEmbed consumption
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Object/Exception.php';
+
+/**
+ * Base class for consuming oEmbed objects
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+abstract class Services_oEmbed_Object 
+{
+    
+    /**
+     * Valid oEmbed object types
+     *
+     * @var array $types Array of valid object types
+     * @see Services_oEmbed_Object::factory()
+     */
+    static protected $types = array(
+        'photo' => 'Photo',
+        'video' => 'Video',
+        'link'  => 'Link',
+        'rich'  => 'Rich'
+    );
+
+    /**
+     * Create an oEmbed object from result
+     *
+     * @param object $object Raw object returned from API
+     *
+     * @throws {@link Services_oEmbed_Object_Exception} on object error
+     * @return object Instance of object driver
+     * @see Services_oEmbed_Object_Link, Services_oEmbed_Object_Photo
+     * @see Services_oEmbed_Object_Rich, Services_oEmbed_Object_Video
+     */
+    static public function factory($object)
+    {
+        if (!isset($object->type)) {
+            throw new Services_oEmbed_Object_Exception(
+                'Object has no type'
+            );
+        }
+
+        $type = (string)$object->type;
+        if (!isset(self::$types[$type])) {
+            throw new Services_oEmbed_Object_Exception(
+                'Object type is unknown or invalid: ' . $type
+            );
+        }
+
+        $file = 'Services/oEmbed/Object/' . self::$types[$type] . '.php';
+        include_once $file;
+
+        $class = 'Services_oEmbed_Object_' . self::$types[$type];
+        if (!class_exists($class)) {
+            throw new Services_oEmbed_Object_Exception(
+                'Object class is invalid or not present'
+            );
+        }
+
+        $instance = new $class($object);
+        return $instance;
+    }
+
+    /**
+     * Instantiation is not allowed
+     *
+     * @return void
+     */
+    private function __construct()
+    {
+    
+    }
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Common.php b/extlib/Services/oEmbed/Object/Common.php
new file mode 100644 (file)
index 0000000..f568ec8
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+
+/**
+ * Base class for oEmbed objects
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+/**
+ * Base class for oEmbed objects
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+abstract class Services_oEmbed_Object_Common
+{
+    /**
+     * Raw object returned from API
+     *
+     * @var object $object The raw object from the API
+     */
+    protected $object = null;
+
+    /**
+     * Required fields per the specification
+     *
+     * @var array $required Array of required fields
+     * @link http://oembed.com
+     */
+    protected $required = array();
+
+    /**
+     * Constructor
+     *
+     * @param object $object Raw object returned from the API
+     *
+     * @throws {@link Services_oEmbed_Object_Exception} on missing fields
+     * @return void
+     */
+    public function __construct($object)
+    {
+        $this->object = $object;
+
+        $this->required[] = 'version';
+        foreach ($this->required as $field) {
+            if (!isset($this->$field)) {
+                throw new Services_oEmbed_Object_Exception(
+                    'Object is missing required ' . $field . ' attribute'
+                );
+            }
+        }
+    }
+
+    /**
+     * Get object variable
+     *
+     * @param string $var Variable to get
+     *
+     * @see Services_oEmbed_Object_Common::$object
+     * @return mixed Attribute's value or null if it's not set/exists
+     */
+    public function __get($var)
+    {
+        if (property_exists($this->object, $var)) {
+            return $this->object->$var;
+        }
+
+        return null;
+    }
+
+    /**
+     * Is variable set?
+     *
+     * @param string $var Variable name to check
+     * 
+     * @return boolean True if set, false if not
+     * @see Services_oEmbed_Object_Common::$object
+     */
+    public function __isset($var)
+    {
+        if (property_exists($this->object, $var)) {
+            return (isset($this->object->$var));
+        }
+
+        return false;
+    }
+
+    /**
+     * Require a sane __toString for all objects
+     *
+     * @return string
+     */
+    abstract public function __toString();
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Exception.php b/extlib/Services/oEmbed/Object/Exception.php
new file mode 100644 (file)
index 0000000..6025ffd
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * Exception for {@link Services_oEmbed_Object}
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Exception.php';
+
+/**
+ * Exception for {@link Services_oEmbed_Object}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Object_Exception extends Services_oEmbed_Exception
+{
+
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Link.php b/extlib/Services/oEmbed/Object/Link.php
new file mode 100644 (file)
index 0000000..9b627a8
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * Link object for {@link Services_oEmbed}
+ *
+ * PHP version 5.2.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Object/Common.php';
+
+/**
+ * Link object for {@link Services_oEmbed}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Object_Link extends Services_oEmbed_Object_Common
+{
+    /**
+     * Output a sane link
+     *
+     * @return string An HTML link of the object
+     */
+    public function __toString()
+    {
+        return '<a href="' . $this->url . '">' . $this->title . '</a>';
+    }
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Photo.php b/extlib/Services/oEmbed/Object/Photo.php
new file mode 100644 (file)
index 0000000..5fbf429
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ *
+ * PHP version 5.2.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Object/Common.php';
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Object_Photo extends Services_oEmbed_Object_Common
+{
+    /**
+     * Required fields for photo objects
+     *
+     * @var array $required Required fields
+     */
+    protected $required = array(
+        'url', 'width', 'height'
+    );
+    /**
+     * Output a valid HTML tag for image
+     *
+     * @return string HTML <img /> tag for Photo
+     */
+    public function __toString()
+    {
+        $img = '<img src="' . $this->url . '" width="' . $this->width . '" ' .
+               'height="' . $this->height . '"';
+
+        if (isset($this->title)) {
+            $img .= ' alt="' . $this->title . '"';
+        }
+
+        return $img . ' />';
+    }
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Rich.php b/extlib/Services/oEmbed/Object/Rich.php
new file mode 100644 (file)
index 0000000..dbf6933
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ *
+ * PHP version 5.2.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Object/Common.php';
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Object_Rich extends Services_oEmbed_Object_Common
+{
+    /**
+     * Required fields for rich objects
+     *
+     * @var array $required Required fields
+     */
+    protected $required = array(
+        'html', 'width', 'height'
+    );
+    /**
+     * Output a the HTML tag for rich object
+     *
+     * @return string HTML for rich object
+     */
+    public function __toString()
+    {
+        return $this->html;        
+    }
+}
+
+?>
diff --git a/extlib/Services/oEmbed/Object/Video.php b/extlib/Services/oEmbed/Object/Video.php
new file mode 100644 (file)
index 0000000..7461081
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ *
+ * PHP version 5.2.0+
+ *
+ * Copyright (c) 2008, Digg.com, Inc.
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of Digg.com, Inc. nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   SVN: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+
+require_once 'Services/oEmbed/Object/Common.php';
+
+/**
+ * Photo object for {@link Services_oEmbed}
+ * 
+ * @category  Services
+ * @package   Services_oEmbed
+ * @author    Joe Stump <joe@joestump.net> 
+ * @copyright 2008 Digg.com, Inc.
+ * @license   http://tinyurl.com/42zef New BSD License
+ * @version   Release: @version@
+ * @link      http://code.google.com/p/digg
+ * @link      http://oembed.com
+ */
+class Services_oEmbed_Object_Video extends Services_oEmbed_Object_Common
+{
+    /**
+     * Required fields for video objects
+     *
+     * @var array $required Required fields
+     */
+    protected $required = array(
+        'html', 'width', 'height'
+    );
+    /**
+     * Output a valid embed tag for video
+     *
+     * @return string HTML for video
+     */
+    public function __toString()
+    {
+        return $this->html;        
+    }
+}
+
+?>
diff --git a/extlib/Stomp.php b/extlib/Stomp.php
new file mode 100644 (file)
index 0000000..9e1c97b
--- /dev/null
@@ -0,0 +1,594 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+
+require_once 'Stomp/Frame.php';
+
+/**
+ * A Stomp Connection
+ *
+ *
+ * @package Stomp
+ * @author Hiram Chirino <hiram@hiramchirino.com>
+ * @author Dejan Bosanac <dejan@nighttale.net> 
+ * @author Michael Caplan <mcaplan@labnet.net>
+ * @version $Revision: 43 $
+ */
+class Stomp
+{
+    /**
+     * Perform request synchronously
+     *
+     * @var boolean
+     */
+    public $sync = false;
+
+    /**
+     * Default prefetch size
+     *
+     * @var int
+     */
+       public $prefetchSize = 1;
+    
+       /**
+     * Client id used for durable subscriptions
+     *
+     * @var string
+     */
+       public $clientId = null;
+    
+    protected $_brokerUri = null;
+    protected $_socket = null;
+    protected $_hosts = array();
+    protected $_params = array();
+    protected $_subscriptions = array();
+    protected $_defaultPort = 61613;
+    protected $_currentHost = - 1;
+    protected $_attempts = 10;
+    protected $_username = '';
+    protected $_password = '';
+    protected $_sessionId;
+    protected $_read_timeout_seconds = 60;
+    protected $_read_timeout_milliseconds = 0;
+    
+    /**
+     * Constructor
+     *
+     * @param string $brokerUri Broker URL
+     * @throws Stomp_Exception
+     */
+    public function __construct ($brokerUri)
+    {
+        $this->_brokerUri = $brokerUri;
+        $this->_init();
+    }
+    /**
+     * Initialize connection
+     *
+     * @throws Stomp_Exception
+     */
+    protected function _init ()
+    {
+        $pattern = "|^(([a-zA-Z]+)://)+\(*([a-zA-Z0-9\.:/i,-]+)\)*\??([a-zA-Z0-9=]*)$|i";
+        if (preg_match($pattern, $this->_brokerUri, $regs)) {
+            $scheme = $regs[2];
+            $hosts = $regs[3];
+            $params = $regs[4];
+            if ($scheme != "failover") {
+                $this->_processUrl($this->_brokerUri);
+            } else {
+                $urls = explode(",", $hosts);
+                foreach ($urls as $url) {
+                    $this->_processUrl($url);
+                }
+            }
+            if ($params != null) {
+                parse_str($params, $this->_params);
+            }
+        } else {
+            require_once 'Stomp/Exception.php';
+            throw new Stomp_Exception("Bad Broker URL {$this->_brokerUri}");
+        }
+    }
+    /**
+     * Process broker URL
+     *
+     * @param string $url Broker URL
+     * @throws Stomp_Exception
+     * @return boolean
+     */
+    protected function _processUrl ($url)
+    {
+        $parsed = parse_url($url);
+        if ($parsed) {
+            array_push($this->_hosts, array($parsed['host'] , $parsed['port'] , $parsed['scheme']));
+        } else {
+            require_once 'Stomp/Exception.php';
+            throw new Stomp_Exception("Bad Broker URL $url");
+        }
+    }
+    /**
+     * Make socket connection to the server
+     *
+     * @throws Stomp_Exception
+     */
+    protected function _makeConnection ()
+    {
+        if (count($this->_hosts) == 0) {
+            require_once 'Stomp/Exception.php';
+            throw new Stomp_Exception("No broker defined");
+        }
+        
+        // force disconnect, if previous established connection exists
+        $this->disconnect();
+        
+        $i = $this->_currentHost;
+        $att = 0;
+        $connected = false;
+        while (! $connected && $att ++ < $this->_attempts) {
+            if (isset($this->_params['randomize']) && $this->_params['randomize'] == 'true') {
+                $i = rand(0, count($this->_hosts) - 1);
+            } else {
+                $i = ($i + 1) % count($this->_hosts);
+            }
+            $broker = $this->_hosts[$i];
+            $host = $broker[0];
+            $port = $broker[1];
+            $scheme = $broker[2];
+            if ($port == null) {
+                $port = $this->_defaultPort;
+            }
+            if ($this->_socket != null) {
+                fclose($this->_socket);
+                $this->_socket = null;
+            }
+            $this->_socket = @fsockopen($scheme . '://' . $host, $port);
+            if (!is_resource($this->_socket) && $att >= $this->_attempts && !array_key_exists($i + 1, $this->_hosts)) {
+                require_once 'Stomp/Exception.php';
+                throw new Stomp_Exception("Could not connect to $host:$port ($att/{$this->_attempts})");
+            } else if (is_resource($this->_socket)) {
+                $connected = true;
+                $this->_currentHost = $i;
+                break;
+            }
+        }
+        if (! $connected) {
+            require_once 'Stomp/Exception.php';
+            throw new Stomp_Exception("Could not connect to a broker");
+        }
+    }
+    /**
+     * Connect to server
+     *
+     * @param string $username
+     * @param string $password
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function connect ($username = '', $password = '')
+    {
+        $this->_makeConnection();
+        if ($username != '') {
+            $this->_username = $username;
+        }
+        if ($password != '') {
+            $this->_password = $password;
+        }
+               $headers = array('login' => $this->_username , 'passcode' => $this->_password);
+               if ($this->clientId != null) {
+                       $headers["client-id"] = $this->clientId;
+               }
+               $frame = new Stomp_Frame("CONNECT", $headers);
+        $this->_writeFrame($frame);
+        $frame = $this->readFrame();
+        if ($frame instanceof Stomp_Frame && $frame->command == 'CONNECTED') {
+            $this->_sessionId = $frame->headers["session"];
+            return true;
+        } else {
+            require_once 'Stomp/Exception.php';
+            if ($frame instanceof Stomp_Frame) {
+                throw new Stomp_Exception("Unexpected command: {$frame->command}", 0, $frame->body);
+            } else {
+                throw new Stomp_Exception("Connection not acknowledged");
+            }
+        }
+    }
+    
+    /**
+     * Check if client session has ben established
+     *
+     * @return boolean
+     */
+    public function isConnected ()
+    {
+        return !empty($this->_sessionId) && is_resource($this->_socket);
+    }
+    /**
+     * Current stomp session ID
+     *
+     * @return string
+     */
+    public function getSessionId()
+    {
+        return $this->_sessionId;
+    }
+    /**
+     * Send a message to a destination in the messaging system 
+     *
+     * @param string $destination Destination queue
+     * @param string|Stomp_Frame $msg Message
+     * @param array $properties
+     * @param boolean $sync Perform request synchronously
+     * @return boolean
+     */
+    public function send ($destination, $msg, $properties = null, $sync = null)
+    {
+        if ($msg instanceof Stomp_Frame) {
+            $msg->headers['destination'] = $destination;
+            $msg->headers = array_merge($msg->headers, $properties);
+            $frame = $msg;
+        } else {
+            $headers = $properties;
+            $headers['destination'] = $destination;
+            $frame = new Stomp_Frame('SEND', $headers, $msg);
+        }
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        return $this->_waitForReceipt($frame, $sync);
+    }
+    /**
+     * Prepair frame receipt
+     *
+     * @param Stomp_Frame $frame
+     * @param boolean $sync
+     */
+    protected function _prepareReceipt (Stomp_Frame $frame, $sync)
+    {
+        $receive = $this->sync;
+        if ($sync !== null) {
+            $receive = $sync;
+        }
+        if ($receive == true) {
+            $frame->headers['receipt'] = md5(microtime());
+        }
+    }
+    /**
+     * Wait for receipt
+     *
+     * @param Stomp_Frame $frame
+     * @param boolean $sync
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    protected function _waitForReceipt (Stomp_Frame $frame, $sync)
+    {
+
+        $receive = $this->sync;
+        if ($sync !== null) {
+            $receive = $sync;
+        }
+        if ($receive == true) {
+            $id = (isset($frame->headers['receipt'])) ? $frame->headers['receipt'] : null;
+            if ($id == null) {
+                return true;
+            }
+            $frame = $this->readFrame();
+            if ($frame instanceof Stomp_Frame && $frame->command == 'RECEIPT') {
+                if ($frame->headers['receipt-id'] == $id) {
+                    return true;
+                } else {
+                    require_once 'Stomp/Exception.php';
+                    throw new Stomp_Exception("Unexpected receipt id {$frame->headers['receipt-id']}", 0, $frame->body);
+                }
+            } else {
+                require_once 'Stomp/Exception.php';
+                if ($frame instanceof Stomp_Frame) {
+                    throw new Stomp_Exception("Unexpected command {$frame->command}", 0, $frame->body);
+                } else {
+                    throw new Stomp_Exception("Receipt not received");
+                }
+            }
+        }
+        return true;
+    }
+    /**
+     * Register to listen to a given destination
+     *
+     * @param string $destination Destination queue
+     * @param array $properties
+     * @param boolean $sync Perform request synchronously
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function subscribe ($destination, $properties = null, $sync = null)
+    {
+        $headers = array('ack' => 'client');
+               $headers['activemq.prefetchSize'] = $this->prefetchSize;
+               if ($this->clientId != null) {
+                       $headers["activemq.subcriptionName"] = $this->clientId;
+               }
+        if (isset($properties)) {
+            foreach ($properties as $name => $value) {
+                $headers[$name] = $value;
+            }
+        }
+        $headers['destination'] = $destination;
+        $frame = new Stomp_Frame('SUBSCRIBE', $headers);
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        if ($this->_waitForReceipt($frame, $sync) == true) {
+            $this->_subscriptions[$destination] = $properties;
+            return true;
+        } else {
+            return false;
+        }
+    }
+    /**
+     * Remove an existing subscription
+     *
+     * @param string $destination
+     * @param array $properties
+     * @param boolean $sync Perform request synchronously
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function unsubscribe ($destination, $properties = null, $sync = null)
+    {
+        $headers = array();
+        if (isset($properties)) {
+            foreach ($properties as $name => $value) {
+                $headers[$name] = $value;
+            }
+        }
+        $headers['destination'] = $destination;
+        $frame = new Stomp_Frame('UNSUBSCRIBE', $headers);
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        if ($this->_waitForReceipt($frame, $sync) == true) {
+            unset($this->_subscriptions[$destination]);
+            return true;
+        } else {
+            return false;
+        }
+    }
+    /**
+     * Start a transaction
+     *
+     * @param string $transactionId
+     * @param boolean $sync Perform request synchronously
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function begin ($transactionId = null, $sync = null)
+    {
+        $headers = array();
+        if (isset($transactionId)) {
+            $headers['transaction'] = $transactionId;
+        }
+        $frame = new Stomp_Frame('BEGIN', $headers);
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        return $this->_waitForReceipt($frame, $sync);
+    }
+    /**
+     * Commit a transaction in progress
+     *
+     * @param string $transactionId
+     * @param boolean $sync Perform request synchronously
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function commit ($transactionId = null, $sync = null)
+    {
+        $headers = array();
+        if (isset($transactionId)) {
+            $headers['transaction'] = $transactionId;
+        }
+        $frame = new Stomp_Frame('COMMIT', $headers);
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        return $this->_waitForReceipt($frame, $sync);
+    }
+    /**
+     * Roll back a transaction in progress
+     *
+     * @param string $transactionId
+     * @param boolean $sync Perform request synchronously
+     */
+    public function abort ($transactionId = null, $sync = null)
+    {
+        $headers = array();
+        if (isset($transactionId)) {
+            $headers['transaction'] = $transactionId;
+        }
+        $frame = new Stomp_Frame('ABORT', $headers);
+        $this->_prepareReceipt($frame, $sync);
+        $this->_writeFrame($frame);
+        return $this->_waitForReceipt($frame, $sync);
+    }
+    /**
+     * Acknowledge consumption of a message from a subscription
+        * Note: This operation is always asynchronous
+     *
+     * @param string|Stomp_Frame $messageMessage ID
+     * @param string $transactionId
+     * @return boolean
+     * @throws Stomp_Exception
+     */
+    public function ack ($message, $transactionId = null)
+    {
+        if ($message instanceof Stomp_Frame) {
+            $frame = new Stomp_Frame('ACK', $message->headers);
+            $this->_writeFrame($frame);
+            return true;
+        } else {
+            $headers = array();
+            if (isset($transactionId)) {
+                $headers['transaction'] = $transactionId;
+            }
+            $headers['message-id'] = $message;
+            $frame = new Stomp_Frame('ACK', $headers);
+            $this->_writeFrame($frame);
+            return true;
+        }
+    }
+    /**
+     * Graceful disconnect from the server
+     *
+     */
+    public function disconnect ()
+    {
+               $header = array();
+
+               if ($this->clientId != null) {
+                       $headers["client-id"] = $this->clientId;
+               }
+
+        if (is_resource($this->_socket)) {
+            $this->_writeFrame(new Stomp_Frame('DISCONNECT', $headers));
+            fclose($this->_socket);
+        }
+        $this->_socket = null;
+        $this->_sessionId = null;
+        $this->_currentHost = -1;
+        $this->_subscriptions = array();
+        $this->_username = '';
+        $this->_password = '';
+    }
+    /**
+     * Write frame to server
+     *
+     * @param Stomp_Frame $stompFrame
+     */
+    protected function _writeFrame (Stomp_Frame $stompFrame)
+    {
+        if (!is_resource($this->_socket)) {
+            require_once 'Stomp/Exception.php';
+            throw new Stomp_Exception('Socket connection hasn\'t been established');
+        }
+
+        $data = $stompFrame->__toString();
+        $r = fwrite($this->_socket, $data, strlen($data));
+        if ($r === false || $r == 0) {
+            $this->_reconnect();
+            $this->_writeFrame($stompFrame);
+        }
+    }
+    
+    /**
+     * Set timeout to wait for content to read
+     *
+     * @param int $seconds_to_wait  Seconds to wait for a frame
+     * @param int $milliseconds Milliseconds to wait for a frame
+     */
+    public function setReadTimeout($seconds, $milliseconds = 0) 
+    {
+        $this->_read_timeout_seconds = $seconds;
+        $this->_read_timeout_milliseconds = $milliseconds;
+    }
+    
+    /**
+     * Read responce frame from server
+     *
+     * @return Stomp_Frame|Stomp_Message_Map|boolean False when no frame to read
+     */
+    public function readFrame ()
+    {
+        if (!$this->hasFrameToRead()) {
+            return false;
+        }
+        
+        $rb = 1024;
+        $data = '';
+        do {
+            $read = fgets($this->_socket, $rb);
+            if ($read === false) {
+                $this->_reconnect();
+                return $this->readFrame();
+            }
+            $data .= $read;
+            $len = strlen($data);
+        } while (($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n")));
+        
+        list ($header, $body) = explode("\n\n", $data, 2);
+        $header = explode("\n", $header);
+        $headers = array();
+        $command = null;
+        foreach ($header as $v) {
+            if (isset($command)) {
+                list ($name, $value) = explode(':', $v, 2);
+                $headers[$name] = $value;
+            } else {
+                $command = $v;
+            }
+        }
+        $frame = new Stomp_Frame($command, $headers, trim($body));
+        if (isset($frame->headers['amq-msg-type']) && $frame->headers['amq-msg-type'] == 'MapMessage') {
+            require_once 'Stomp/Message/Map.php';
+            return new Stomp_Message_Map($frame);
+        } else {
+            return $frame;
+        }
+    }
+    
+    /**
+     * Check if there is a frame to read
+     *
+     * @return boolean
+     */
+    public function hasFrameToRead()
+    {
+        $read = array($this->_socket);
+        $write = null;
+        $except = null;
+        
+        $has_frame_to_read = stream_select($read, $write, $except, $this->_read_timeout_seconds, $this->_read_timeout_milliseconds);
+
+        if ($has_frame_to_read === false) {
+            throw new Stomp_Exception('Check failed to determin if the socket is readable');
+        } else if ($has_frame_to_read > 0) {
+            return true;
+        } else {
+            return false; 
+        }
+    }
+    
+    /**
+     * Reconnects and renews subscriptions (if there were any)
+     * Call this method when you detect connection problems     
+     */
+    protected function _reconnect ()
+    {
+        $subscriptions = $this->_subscriptions;
+        
+        $this->connect($this->_username, $this->_password);
+        foreach ($subscriptions as $dest => $properties) {
+            $this->subscribe($dest, $properties);
+        }
+    }
+    /**
+     * Graceful object desruction
+     *
+     */
+    public function __destruct()
+    {
+        $this->disconnect();
+    }
+}
+?>
diff --git a/extlib/Stomp/Exception.php b/extlib/Stomp/Exception.php
new file mode 100644 (file)
index 0000000..e6870bc
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+
+/**
+ * A Stomp Connection
+ *
+ *
+ * @package Stomp
+ * @author Michael Caplan <mcaplan@labnet.net>
+ * @version $Revision: 23 $
+ */\r
+class Stomp_Exception extends Exception\r
+{
+    protected $_details;
+    
+    /**
+     * Constructor
+     *
+     * @param string $message Error message
+     * @param int $code Error code
+     * @param string $details Stomp server error details
+     */
+    public function __construct($message = null, $code = 0, $details = '')
+    {
+        $this->_details = $details;
+        
+        parent::__construct($message, $code);
+    }
+    
+    /**
+     * Stomp server error details
+     *
+     * @return string
+     */
+    public function getDetails()
+    {
+        return $this->_details;
+    }
+}\r
+?>
\ No newline at end of file
diff --git a/extlib/Stomp/Frame.php b/extlib/Stomp/Frame.php
new file mode 100644 (file)
index 0000000..dc59c1c
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+\r
+/**\r
+ * Stomp Frames are messages that are sent and received on a StompConnection.\r
+ *\r
+ * @package Stomp\r
+ * @author Hiram Chirino <hiram@hiramchirino.com>\r
+ * @author Dejan Bosanac <dejan@nighttale.net>\r
+ * @author Michael Caplan <mcaplan@labnet.net>\r
+ * @version $Revision: 36 $\r
+ */\r
+class Stomp_Frame\r
+{\r
+    public $command;\r
+    public $headers = array();\r
+    public $body;\r
+    \r
+    /**\r
+     * Constructor\r
+     *\r
+     * @param string $command\r
+     * @param array $headers\r
+     * @param string $body\r
+     */\r
+    public function __construct ($command = null, $headers = null, $body = null)\r
+    {\r
+        $this->_init($command, $headers, $body);\r
+    }\r
+    \r
+    protected function _init ($command = null, $headers = null, $body = null)\r
+    {\r
+        $this->command = $command;\r
+        if ($headers != null) {\r
+            $this->headers = $headers;\r
+        }\r
+        $this->body = $body;\r
+        \r
+        if ($this->command == 'ERROR') {\r
+            require_once 'Stomp/Exception.php';\r
+            throw new Stomp_Exception($this->headers['message'], 0, $this->body);\r
+        }\r
+    }
+    
+    /**
+     * Convert frame to transportable string
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        $data = $this->command . "\n";
+        
+        foreach ($this->headers as $name => $value) {
+            $data .= $name . ": " . $value . "\n";
+        }
+        
+        $data .= "\n";
+        $data .= $this->body;
+        return $data .= "\x00\n";
+    }\r
+}\r
+?>
\ No newline at end of file
diff --git a/extlib/Stomp/Message.php b/extlib/Stomp/Message.php
new file mode 100644 (file)
index 0000000..6bcad3e
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+
+require_once 'Stomp/Frame.php';
+
+/**
+ * Basic text stomp message
+ *
+ * @package Stomp
+ * @author Dejan Bosanac <dejan@nighttale.net>
+ * @version $Revision: 23 $
+ */
+class Stomp_Message extends Stomp_Frame
+{
+    public function __construct ($body, $headers = null)
+    {
+        $this->_init("SEND", $headers, $body);
+    }
+}
+?>
\ No newline at end of file
diff --git a/extlib/Stomp/Message/Bytes.php b/extlib/Stomp/Message/Bytes.php
new file mode 100644 (file)
index 0000000..c75f23e
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+
+require_once 'Stomp/Message.php';
+
+/**
+ * Message that contains a stream of uninterpreted bytes
+ *
+ * @package Stomp
+ * @author Dejan Bosanac <dejan@nighttale.net>
+ * @version $Revision: 23 $
+ */
+class Stomp_Message_Bytes extends Stomp_Message
+{
+    /**
+     * Constructor
+     *
+     * @param string $body
+     * @param array $headers
+     */
+    function __construct ($body, $headers = null)
+    {
+        $this->_init("SEND", $headers, $body);
+        if ($this->headers == null) {
+            $this->headers = array();
+        }
+        $this->headers['content-length'] = count($body);
+    }
+}
+?>
\ No newline at end of file
diff --git a/extlib/Stomp/Message/Map.php b/extlib/Stomp/Message/Map.php
new file mode 100644 (file)
index 0000000..288456a
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* vim: set expandtab tabstop=3 shiftwidth=3: */
+
+require_once 'Stomp/Message.php';
+
+/**
+ * Message that contains a set of name-value pairs
+ *
+ * @package Stomp
+ * @author Dejan Bosanac <dejan@nighttale.net>
+ * @version $Revision: 23 $
+ */
+class Stomp_Message_Map extends Stomp_Message
+{
+    public $map;
+    
+    /**
+     * Constructor
+     *
+     * @param Stomp_Frame|string $msg
+     * @param array $headers
+     */
+    function __construct ($msg, $headers = null)
+    {
+        if ($msg instanceof Stomp_Frame) {
+            $this->_init($msg->command, $msg->headers, $msg->body);
+            $this->map = json_decode($msg->body);
+        } else {
+            $this->_init("SEND", $headers, $msg);
+            if ($this->headers == null) {
+                $this->headers = array();
+            }
+            $this->headers['amq-msg-type'] = 'MapMessage';
+            $this->body = json_encode($msg);
+        }
+    }
+}
+?>
\ No newline at end of file
index 4c05506b3d896a7961d0cac1ff2e914bf3fcbcda..3d8bc23f216c5867b0b1107be3a637ae33b344a8 100644 (file)
-<?php\r
-/* vim: set expandtab tabstop=4 shiftwidth=4: */\r
-// +----------------------------------------------------------------------+\r
-// | Copyright (c) 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox, Amir Saied  |\r
-// +----------------------------------------------------------------------+\r
-// | This source file is subject to the New BSD license, That is bundled  |\r
-// | with this package in the file LICENSE, and is available through      |\r
-// | the world-wide-web at                                                |\r
-// | http://www.opensource.org/licenses/bsd-license.php                   |\r
-// | If you did not receive a copy of the new BSDlicense and are unable   |\r
-// | to obtain it through the world-wide-web, please send a note to       |\r
-// | pajoye@php.net so we can mail you a copy immediately.                |\r
-// +----------------------------------------------------------------------+\r
-// | Author: Tomas V.V.Cox  <cox@idecnet.com>                             |\r
-// |         Pierre-Alain Joye <pajoye@php.net>                           |\r
-// |         Amir Mohammad Saied <amir@php.net>                           |\r
-// +----------------------------------------------------------------------+\r
-//\r
-/**\r
- * Validation class\r
- *\r
- * Package to validate various datas. It includes :\r
- *   - numbers (min/max, decimal or not)\r
- *   - email (syntax, domain check)\r
- *   - string (predifined type alpha upper and/or lowercase, numeric,...)\r
- *   - date (min, max, rfc822 compliant)\r
- *   - uri (RFC2396)\r
- *   - possibility valid multiple data with a single method call (::multiple)\r
- *\r
- * @category   Validate\r
- * @package    Validate\r
- * @author     Tomas V.V.Cox <cox@idecnet.com>\r
- * @author     Pierre-Alain Joye <pajoye@php.net>\r
- * @author     Amir Mohammad Saied <amir@php.net>\r
- * @copyright  1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied\r
- * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License\r
- * @version    CVS: $Id: Validate.php,v 1.123 2007/12/12 16:45:51 davidc Exp $\r
- * @link       http://pear.php.net/package/Validate\r
- */\r
-\r
-/**\r
- * Methods for common data validations\r
- */\r
-define('VALIDATE_NUM',          '0-9');\r
-define('VALIDATE_SPACE',        '\s');\r
-define('VALIDATE_ALPHA_LOWER',  'a-z');\r
-define('VALIDATE_ALPHA_UPPER',  'A-Z');\r
-define('VALIDATE_ALPHA',        VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);\r
-define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');\r
-define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');\r
-define('VALIDATE_EALPHA',       VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);\r
-define('VALIDATE_PUNCTUATION',  VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');\r
-define('VALIDATE_NAME',         VALIDATE_EALPHA . VALIDATE_SPACE . "'" . "-");\r
-define('VALIDATE_STREET',       VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");\r
-\r
-define('VALIDATE_ITLD_EMAILS',  1);\r
-define('VALIDATE_GTLD_EMAILS',  2);\r
-define('VALIDATE_CCTLD_EMAILS', 4);\r
-define('VALIDATE_ALL_EMAILS',   8);\r
-\r
-/**\r
- * Validation class\r
- *\r
- * Package to validate various datas. It includes :\r
- *   - numbers (min/max, decimal or not)\r
- *   - email (syntax, domain check)\r
- *   - string (predifined type alpha upper and/or lowercase, numeric,...)\r
- *   - date (min, max)\r
- *   - uri (RFC2396)\r
- *   - possibility valid multiple data with a single method call (::multiple)\r
- *\r
- * @category   Validate\r
- * @package    Validate\r
- * @author     Tomas V.V.Cox <cox@idecnet.com>\r
- * @author     Pierre-Alain Joye <pajoye@php.net>\r
- * @author     Amir Mohammad Saied <amir@php.net>\r
- * @copyright  1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied\r
- * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License\r
- * @version    Release: @package_version@\r
- * @link       http://pear.php.net/package/Validate\r
- */\r
-class Validate\r
-{\r
-    /**\r
-     * International Top-Level Domain\r
-     *\r
-     * This is an array of the known international\r
-     * top-level domain names.\r
-     *\r
-     * @access protected\r
-     * @var    array     $_iTld (International top-level domains)\r
-     */\r
-    var $_itld = array(\r
-        'arpa',\r
-        'root',\r
-    );\r
-\r
-    /**\r
-     * Generic top-level domain\r
-     *\r
-     * This is an array of the official\r
-     * generic top-level domains.\r
-     *\r
-     * @access protected\r
-     * @var    array     $_gTld (Generic top-level domains)\r
-     */\r
-    var $_gtld = array(\r
-        'aero',\r
-        'biz',\r
-        'cat',\r
-        'com',\r
-        'coop',\r
-        'edu',\r
-        'gov',\r
-        'info',\r
-        'int',\r
-        'jobs',\r
-        'mil',\r
-        'mobi',\r
-        'museum',\r
-        'name',\r
-        'net',\r
-        'org',\r
-        'pro',\r
-        'travel',\r
-        'asia',\r
-        'post',\r
-        'tel',\r
-        'geo',\r
-    );\r
-\r
-    /**\r
-     * Country code top-level domains\r
-     *\r
-     * This is an array of the official country\r
-     * codes top-level domains\r
-     *\r
-     * @access protected\r
-     * @var    array     $_ccTld (Country Code Top-Level Domain)\r
-     */\r
-    var $_cctld = array(\r
-        'ac',\r
-        'ad','ae','af','ag',\r
-        'ai','al','am','an',\r
-        'ao','aq','ar','as',\r
-        'at','au','aw','ax',\r
-        'az','ba','bb','bd',\r
-        'be','bf','bg','bh',\r
-        'bi','bj','bm','bn',\r
-        'bo','br','bs','bt',\r
-        'bu','bv','bw','by',\r
-        'bz','ca','cc','cd',\r
-        'cf','cg','ch','ci',\r
-        'ck','cl','cm','cn',\r
-        'co','cr','cs','cu',\r
-        'cv','cx','cy','cz',\r
-        'de','dj','dk','dm',\r
-        'do','dz','ec','ee',\r
-        'eg','eh','er','es',\r
-        'et','eu','fi','fj',\r
-        'fk','fm','fo','fr',\r
-        'ga','gb','gd','ge',\r
-        'gf','gg','gh','gi',\r
-        'gl','gm','gn','gp',\r
-        'gq','gr','gs','gt',\r
-        'gu','gw','gy','hk',\r
-        'hm','hn','hr','ht',\r
-        'hu','id','ie','il',\r
-        'im','in','io','iq',\r
-        'ir','is','it','je',\r
-        'jm','jo','jp','ke',\r
-        'kg','kh','ki','km',\r
-        'kn','kp','kr','kw',\r
-        'ky','kz','la','lb',\r
-        'lc','li','lk','lr',\r
-        'ls','lt','lu','lv',\r
-        'ly','ma','mc','md',\r
-        'me','mg','mh','mk',\r
-        'ml','mm','mn','mo',\r
-        'mp','mq','mr','ms',\r
-        'mt','mu','mv','mw',\r
-        'mx','my','mz','na',\r
-        'nc','ne','nf','ng',\r
-        'ni','nl','no','np',\r
-        'nr','nu','nz','om',\r
-        'pa','pe','pf','pg',\r
-        'ph','pk','pl','pm',\r
-        'pn','pr','ps','pt',\r
-        'pw','py','qa','re',\r
-        'ro','rs','ru','rw',\r
-        'sa','sb','sc','sd',\r
-        'se','sg','sh','si',\r
-        'sj','sk','sl','sm',\r
-        'sn','so','sr','st',\r
-        'su','sv','sy','sz',\r
-        'tc','td','tf','tg',\r
-        'th','tj','tk','tl',\r
-        'tm','tn','to','tp',\r
-        'tr','tt','tv','tw',\r
-        'tz','ua','ug','uk',\r
-        'us','uy','uz','va',\r
-        'vc','ve','vg','vi',\r
-        'vn','vu','wf','ws',\r
-        'ye','yt','yu','za',\r
-        'zm','zw',\r
-    );\r
-\r
-\r
-    /**\r
-     * Validate a number\r
-     *\r
-     * @param string    $number     Number to validate\r
-     * @param array     $options    array where:\r
-     *                              'decimal'   is the decimal char or false when decimal not allowed\r
-     *                                          i.e. ',.' to allow both ',' and '.'\r
-     *                              'dec_prec'  Number of allowed decimals\r
-     *                              'min'       minimum value\r
-     *                              'max'       maximum value\r
-     *\r
-     * @return boolean true if valid number, false if not\r
-     *\r
-     * @access public\r
-     */\r
-    function number($number, $options = array())\r
-    {\r
-        $decimal = $dec_prec = $min = $max = null;\r
-        if (is_array($options)) {\r
-            extract($options);\r
-        }\r
-\r
-        $dec_prec   = $dec_prec ? "{1,$dec_prec}" : '+';\r
-        $dec_regex  = $decimal  ? "[$decimal][0-9]$dec_prec" : '';\r
-\r
-        if (!preg_match("|^[-+]?\s*[0-9]+($dec_regex)?\$|", $number)) {\r
-            return false;\r
-        }\r
-\r
-        if ($decimal != '.') {\r
-            $number = strtr($number, $decimal, '.');\r
-        }\r
-\r
-        $number = (float)str_replace(' ', '', $number);\r
-        if ($min !== null && $min > $number) {\r
-            return false;\r
-        }\r
-\r
-        if ($max !== null && $max < $number) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    /**\r
-     * Converting a string to UTF-7 (RFC 2152)\r
-     *\r
-     * @param   $string     string to be converted\r
-     *\r
-     * @return  string  converted string\r
-     *\r
-     * @access  private\r
-     */\r
-    function __stringToUtf7($string) {\r
-        $return = '';\r
-        $utf7 = array(\r
-                        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',\r
-                        'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',\r
-                        'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',\r
-                        'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',\r
-                        's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',\r
-                        '3', '4', '5', '6', '7', '8', '9', '+', ','\r
-                    );\r
-\r
-        $state = 0;\r
-        if (!empty($string)) {\r
-            $i = 0;\r
-            while ($i <= strlen($string)) {\r
-                $char = substr($string, $i, 1);\r
-                if ($state == 0) {\r
-                    if ((ord($char) >= 0x7F) || (ord($char) <= 0x1F)) {\r
-                        if ($char) {\r
-                            $return .= '&';\r
-                        }\r
-                        $state = 1;\r
-                    } elseif ($char == '&') {\r
-                        $return .= '&-';\r
-                    } else {\r
-                        $return .= $char;\r
-                    }\r
-                } elseif (($i == strlen($string) ||\r
-                            !((ord($char) >= 0x7F)) || (ord($char) <= 0x1F))) {\r
-                    if ($state != 1) {\r
-                        if (ord($char) > 64) {\r
-                            $return .= '';\r
-                        } else {\r
-                            $return .= $utf7[ord($char)];\r
-                        }\r
-                    }\r
-                    $return .= '-';\r
-                    $state = 0;\r
-                } else {\r
-                    switch($state) {\r
-                        case 1:\r
-                            $return .= $utf7[ord($char) >> 2];\r
-                            $residue = (ord($char) & 0x03) << 4;\r
-                            $state = 2;\r
-                            break;\r
-                        case 2:\r
-                            $return .= $utf7[$residue | (ord($char) >> 4)];\r
-                            $residue = (ord($char) & 0x0F) << 2;\r
-                            $state = 3;\r
-                            break;\r
-                        case 3:\r
-                            $return .= $utf7[$residue | (ord($char) >> 6)];\r
-                            $return .= $utf7[ord($char) & 0x3F];\r
-                            $state = 1;\r
-                            break;\r
-                    }\r
-                }\r
-                $i++;\r
-            }\r
-            return $return;\r
-        }\r
-        return '';\r
-    }\r
-\r
-    /**\r
-     * Validate an email according to full RFC822 (inclusive human readable part)\r
-     *\r
-     * @param string $email email to validate,\r
-     *                      will return the address for optional dns validation\r
-     * @param array $options email() options\r
-     *\r
-     * @return boolean true if valid email, false if not\r
-     *\r
-     * @access private\r
-     */\r
-    function __emailRFC822(&$email, &$options)\r
-    {\r
-        if (Validate::__stringToUtf7($email) != $email) {\r
-            return false;\r
-        }\r
-        static $address = null;\r
-        static $uncomment = null;\r
-        if (!$address) {\r
-            // atom        =  1*<any CHAR except specials, SPACE and CTLs>\r
-            $atom = '[^][()<>@,;:\\".\s\000-\037\177-\377]+\s*';\r
-            // qtext       =  <any CHAR excepting <">,     ; => may be folded\r
-            //         "\" & CR, and including linear-white-space>\r
-            $qtext = '[^"\\\\\r]';\r
-            // quoted-pair =  "\" CHAR                     ; may quote any char\r
-            $quoted_pair = '\\\\.';\r
-            // quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or\r
-            //                                             ;   quoted chars.\r
-            $quoted_string = '"(?:' . $qtext . '|' . $quoted_pair . ')*"\s*';\r
-            // word        =  atom / quoted-string\r
-            $word = '(?:' . $atom . '|' . $quoted_string . ')';\r
-            // local-part  =  word *("." word)             ; uninterpreted\r
-            //                                             ; case-preserved\r
-            $local_part = $word . '(?:\.\s*' . $word . ')*';\r
-            // dtext       =  <any CHAR excluding "[",     ; => may be folded\r
-            //         "]", "\" & CR, & including linear-white-space>\r
-            $dtext = '[^][\\\\\r]';\r
-            // domain-literal =  "[" *(dtext / quoted-pair) "]"\r
-            $domain_literal = '\[(?:' . $dtext . '|' . $quoted_pair . ')*\]\s*';\r
-            // sub-domain  =  domain-ref / domain-literal\r
-            // domain-ref  =  atom                         ; symbolic reference\r
-            $sub_domain = '(?:' . $atom . '|' . $domain_literal . ')';\r
-            // domain      =  sub-domain *("." sub-domain)\r
-            $domain = $sub_domain . '(?:\.\s*' . $sub_domain . ')*';\r
-            // addr-spec   =  local-part "@" domain        ; global address\r
-            $addr_spec = $local_part . '@\s*' . $domain;\r
-            // route       =  1#("@" domain) ":"           ; path-relative\r
-            $route = '@' . $domain . '(?:,@\s*' . $domain . ')*:\s*';\r
-            // route-addr  =  "<" [route] addr-spec ">"\r
-            $route_addr = '<\s*(?:' . $route . ')?' . $addr_spec . '>\s*';\r
-            // phrase      =  1*word                       ; Sequence of words\r
-            $phrase = $word  . '+';\r
-            // mailbox     =  addr-spec                    ; simple address\r
-            //             /  phrase route-addr            ; name & addr-spec\r
-            $mailbox = '(?:' . $addr_spec . '|' . $phrase . $route_addr . ')';\r
-            // group       =  phrase ":" [#mailbox] ";"\r
-            $group = $phrase . ':\s*(?:' . $mailbox . '(?:,\s*' . $mailbox . ')*)?;\s*';\r
-            //     address     =  mailbox                      ; one addressee\r
-            //                 /  group                        ; named list\r
-            $address = '/^\s*(?:' . $mailbox . '|' . $group . ')$/';\r
-            $uncomment =\r
-            '/((?:(?:\\\\"|[^("])*(?:' . $quoted_string .\r
-                                             ')?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/';\r
-        }\r
-        // strip comments\r
-        $email = preg_replace($uncomment, '$1 ', $email);\r
-        return preg_match($address, $email);\r
-    }\r
-\r
-    /**\r
-     * Full TLD Validation function\r
-     *\r
-     * This function is used to make a much more proficient validation\r
-     * against all types of official domain names.\r
-     *\r
-     * @access protected\r
-     * @param  string    $email    The email address to check.\r
-     * @param  array     $options  The options for validation\r
-     * @return bool      True if validating succeeds\r
-     */\r
-    function _fullTLDValidation($email, $options)\r
-    {\r
-        $validate = array();\r
-\r
-        switch ($options) {\r
-            /** 1 */\r
-            case VALIDATE_ITLD_EMAILS:\r
-                array_push($validate, 'itld');\r
-                break;\r
-\r
-            /** 2 */\r
-            case VALIDATE_GTLD_EMAILS:\r
-                array_push($validate, 'gtld');\r
-                break;\r
-\r
-            /** 3 */\r
-            case VALIDATE_ITLD_EMAILS | VALIDATE_GTLD_EMAILS:\r
-                array_push($validate, 'itld');\r
-                array_push($validate, 'gtld');\r
-                break;\r
-\r
-            /** 4 */\r
-            case VALIDATE_CCTLD_EMAILS:\r
-                array_push($validate, 'cctld');\r
-                break;\r
-\r
-            /** 5 */\r
-            case VALIDATE_CCTLD_EMAILS | VALIDATE_ITLD_EMAILS:\r
-                array_push($validate, 'cctld');\r
-                array_push($validate, 'itld');\r
-                break;\r
-\r
-            /** 6 */\r
-            case VALIDATE_CCTLD_EMAILS ^ VALIDATE_ITLD_EMAILS:\r
-                array_push($validate, 'cctld');\r
-                array_push($validate, 'itld');\r
-                break;\r
-\r
-            /** 7 - 8 */\r
-            case VALIDATE_CCTLD_EMAILS | VALIDATE_ITLD_EMAILS | VALIDATE_GTLD_EMAILS:\r
-            case VALIDATE_ALL_EMAILS:\r
-                array_push($validate, 'cctld');\r
-                array_push($validate, 'itld');\r
-                array_push($validate, 'gtld');\r
-                break;\r
-        }\r
-\r
-        /**\r
-         * Debugging still, not implemented but code is somewhat here.\r
-         */\r
-\r
-        $self = new Validate;\r
-\r
-        $toValidate = array();\r
-\r
-        foreach ($validate as $valid) {\r
-            $tmpVar = '_' . (string)$valid;\r
-            $toValidate[$valid] = $self->{$tmpVar};\r
-        }\r
-\r
-        $e = $self->executeFullEmailValidation($email, $toValidate);\r
-\r
-        return $e;\r
-    }\r
-    // {{{ protected function executeFullEmailValidation\r
-    /**\r
-     * Execute the validation\r
-     *\r
-     * This function will execute the full email vs tld\r
-     * validation using an array of tlds passed to it.\r
-     *\r
-     * @access public\r
-     * @param  string $email       The email to validate.\r
-     * @param  array  $arrayOfTLDs The array of the TLDs to validate\r
-     * @return true or false (Depending on if it validates or if it does not)\r
-     */\r
-    function executeFullEmailValidation($email, $arrayOfTLDs)\r
-    {\r
-        $emailEnding = explode('.', $email);\r
-        $emailEnding = $emailEnding[count($emailEnding)-1];\r
-        \r
-        foreach ($arrayOfTLDs as $validator => $keys) {\r
-            if (in_array($emailEnding, $keys)) {\r
-                return true;\r
-            }\r
-        }\r
-        return false;\r
-    }\r
-    // }}}\r
-\r
-    /**\r
-     * Validate an email\r
-     *\r
-     * @param string $email email to validate\r
-     * @param mixed boolean (BC) $check_domain   Check or not if the domain exists\r
-     *              array $options associative array of options\r
-     *              'check_domain' boolean Check or not if the domain exists\r
-     *              'use_rfc822' boolean Apply the full RFC822 grammar\r
-     *\r
-     * @return boolean true if valid email, false if not\r
-     *\r
-     * @access public\r
-     */\r
-    function email($email, $options = null)\r
-    {\r
-        $check_domain = false;\r
-        $use_rfc822 = false;\r
-        if (is_bool($options)) {\r
-            $check_domain = $options;\r
-        } elseif (is_array($options)) {\r
-            extract($options);\r
-        }\r
-\r
-        /**\r
-         * @todo Fix bug here.. even if it passes this, it won't be passing\r
-         *       The regular expression below\r
-         */\r
-        if (isset($fullTLDValidation)) {\r
-            $valid = Validate::_fullTLDValidation($email, $fullTLDValidation);\r
-\r
-            if (!$valid) {\r
-                return false;\r
-            }\r
-        }\r
-\r
-        // the base regexp for address\r
-        $regex = '&^(?:                                               # recipient:\r
-         ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")|                          #1 quoted name\r
-         ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*)) #2 OR dot-atom\r
-         @(((\[)?                     #3 domain, 4 as IPv4, 5 optionally bracketed\r
-         (?:(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3}\r
-               (?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)\])|\r
-         ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?)  #6 domain as hostname\r
-         \.((?:([^- ])[-a-z]*[-a-z]))) #7 TLD \r
-         $&xi';\r
-        \r
-        if ($use_rfc822? Validate::__emailRFC822($email, $options) :\r
-            preg_match($regex, $email)) {\r
-            if ($check_domain && function_exists('checkdnsrr')) {\r
-                list (, $domain)  = explode('@', $email);\r
-                if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {\r
-                    return true;\r
-                }\r
-                return false;\r
-            }\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-   /**\r
-     * Validate a string using the given format 'format'\r
-     *\r
-     * @param string    $string     String to validate\r
-     * @param array     $options    Options array where:\r
-     *                              'format' is the format of the string\r
-     *                                  Ex: VALIDATE_NUM . VALIDATE_ALPHA (see constants)\r
-     *                              'min_length' minimum length\r
-     *                              'max_length' maximum length\r
-     *\r
-     * @return boolean true if valid string, false if not\r
-     *\r
-     * @access public\r
-     */\r
-    function string($string, $options)\r
-    {\r
-        $format = null;\r
-        $min_length = $max_length = 0;\r
-        if (is_array($options)) {\r
-            extract($options);\r
-        }\r
-        if ($format && !preg_match("|^[$format]*\$|s", $string)) {\r
-            return false;\r
-        }\r
-        if ($min_length && strlen($string) < $min_length) {\r
-            return false;\r
-        }\r
-        if ($max_length && strlen($string) > $max_length) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    /**\r
-     * Validate an URI (RFC2396)\r
-     * This function will validate 'foobarstring' by default, to get it to validate\r
-     * only http, https, ftp and such you have to pass it in the allowed_schemes\r
-     * option, like this:\r
-     * <code>\r
-     * $options = array('allowed_schemes' => array('http', 'https', 'ftp'))\r
-     * var_dump(Validate::uri('http://www.example.org', $options));\r
-     * </code>\r
-     *\r
-     * NOTE 1: The rfc2396 normally allows middle '-' in the top domain\r
-     *         e.g. http://example.co-m should be valid\r
-     *         However, as '-' is not used in any known TLD, it is invalid\r
-     * NOTE 2: As double shlashes // are allowed in the path part, only full URIs\r
-     *         including an authority can be valid, no relative URIs\r
-     *         the // are mandatory (optionally preceeded by the 'sheme:' )\r
-     * NOTE 3: the full complience to rfc2396 is not achieved by default\r
-     *         the characters ';/?:@$,' will not be accepted in the query part\r
-     *         if not urlencoded, refer to the option "strict'"\r
-     *\r
-     * @param string    $url        URI to validate\r
-     * @param array     $options    Options used by the validation method.\r
-     *                              key => type\r
-     *                              'domain_check' => boolean\r
-     *                                  Whether to check the DNS entry or not\r
-     *                              'allowed_schemes' => array, list of protocols\r
-     *                                  List of allowed schemes ('http',\r
-     *                                  'ssh+svn', 'mms')\r
-     *                              'strict' => string the refused chars\r
-     *                                   in query and fragment parts\r
-     *                                   default: ';/?:@$,'\r
-     *                                   empty: accept all rfc2396 foreseen chars\r
-     *\r
-     * @return boolean true if valid uri, false if not\r
-     *\r
-     * @access public\r
-     */\r
-    function uri($url, $options = null)\r
-    {\r
-        $strict = ';/?:@$,';\r
-        $domain_check = false;\r
-        $allowed_schemes = null;\r
-        if (is_array($options)) {\r
-            extract($options);\r
-        }\r
-        if (preg_match(\r
-             '&^(?:([a-z][-+.a-z0-9]*):)?                             # 1. scheme\r
-              (?://                                                   # authority start\r
-              (?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)?    # 2. authority-userinfo\r
-              (?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)  # 3. authority-hostname OR\r
-              |([0-9]{1,3}(?:\.[0-9]{1,3}){3}))                       # 4. authority-ipv4\r
-              (?::([0-9]*))?)                                        # 5. authority-port\r
-              ((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*/?)? # 6. path\r
-              (?:\?([^#]*))?                                          # 7. query\r
-              (?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@\&=+$,])*))? # 8. fragment\r
-              $&xi', $url, $matches)) {\r
-            $scheme = isset($matches[1]) ? $matches[1] : '';\r
-            $authority = isset($matches[3]) ? $matches[3] : '' ;\r
-            if (is_array($allowed_schemes) &&\r
-                !in_array($scheme,$allowed_schemes)\r
-            ) {\r
-                return false;\r
-            }\r
-            if (!empty($matches[4])) {\r
-                $parts = explode('.', $matches[4]);\r
-                foreach ($parts as $part) {\r
-                    if ($part > 255) {\r
-                        return false;\r
-                    }\r
-                }\r
-            } elseif ($domain_check && function_exists('checkdnsrr')) {\r
-                if (!checkdnsrr($authority, 'A')) {\r
-                    return false;\r
-                }\r
-            }\r
-            if ($strict) {\r
-                $strict = '#[' . preg_quote($strict, '#') . ']#';\r
-                if ((!empty($matches[7]) && preg_match($strict, $matches[7]))\r
-                 || (!empty($matches[8]) && preg_match($strict, $matches[8]))) {\r
-                    return false;\r
-                }\r
-            }\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    /**\r
-     * Validate date and times. Note that this method need the Date_Calc class\r
-     *\r
-     * @param string    $date   Date to validate\r
-     * @param array     $options array options where :\r
-     *                          'format' The format of the date (%d-%m-%Y)\r
-     *                                   or rfc822_compliant\r
-     *                          'min' The date has to be greater\r
-     *                                than this array($day, $month, $year)\r
-     *                                or PEAR::Date object\r
-     *                          'max' The date has to be smaller than\r
-     *                                this array($day, $month, $year)\r
-     *                                or PEAR::Date object\r
-     *\r
-     * @return boolean true if valid date/time, false if not\r
-     *\r
-     * @access public\r
-     */\r
-    function date($date, $options)\r
-    {\r
-        $max = $min = false;\r
-        $format = '';\r
-        if (is_array($options)) {\r
-            extract($options);\r
-        }\r
-\r
-        if (strtolower($format) == 'rfc822_compliant') {\r
-            $preg = '&^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),) \s+\r
-                    (?:(\d{2})?) \s+\r
-                    (?:(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)?) \s+\r
-                    (?:(\d{2}(\d{2})?)?) \s+\r
-                    (?:(\d{2}?)):(?:(\d{2}?))(:(?:(\d{2}?)))? \s+\r
-                    (?:[+-]\d{4}|UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Za-ik-z])$&xi';\r
-\r
-            if (!preg_match($preg, $date, $matches)) {\r
-                return false;\r
-            }\r
-\r
-            $year   = (int)$matches[4];\r
-            $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\r
-                            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');\r
-            $month  = array_keys($months, $matches[3]);\r
-            $month  = (int)$month[0]+1;\r
-            $day    = (int)$matches[2];\r
-            $weekday= $matches[1];\r
-            $hour   = (int)$matches[6];\r
-            $minute = (int)$matches[7];\r
-            isset($matches[9]) ? $second = (int)$matches[9] : $second = 0;\r
-\r
-            if ((strlen($year) != 4)        ||\r
-                ($day    > 31   || $day < 1)||\r
-                ($hour   > 23)  ||\r
-                ($minute > 59)  ||\r
-                ($second > 59)) {\r
-                    return false;\r
-            }\r
-        } else {\r
-            $date_len = strlen($format);\r
-            for ($i = 0; $i < $date_len; $i++) {\r
-                $c = $format{$i};\r
-                if ($c == '%') {\r
-                    $next = $format{$i + 1};\r
-                    switch ($next) {\r
-                        case 'j':\r
-                        case 'd':\r
-                            if ($next == 'j') {\r
-                                $day = (int)Validate::_substr($date, 1, 2);\r
-                            } else {\r
-                                $day = (int)Validate::_substr($date, 0, 2);\r
-                            }\r
-                            if ($day < 1 || $day > 31) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        case 'm':\r
-                        case 'n':\r
-                            if ($next == 'm') {\r
-                                $month = (int)Validate::_substr($date, 0, 2);\r
-                            } else {\r
-                                $month = (int)Validate::_substr($date, 1, 2);\r
-                            }\r
-                            if ($month < 1 || $month > 12) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        case 'Y':\r
-                        case 'y':\r
-                            if ($next == 'Y') {\r
-                                $year = Validate::_substr($date, 4);\r
-                                $year = (int)$year?$year:'';\r
-                            } else {\r
-                                $year = (int)(substr(date('Y'), 0, 2) .\r
-                                              Validate::_substr($date, 2));\r
-                            }\r
-                            if (strlen($year) != 4 || $year < 0 || $year > 9999) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        case 'g':\r
-                        case 'h':\r
-                            if ($next == 'g') {\r
-                                $hour = Validate::_substr($date, 1, 2);\r
-                            } else {\r
-                                $hour = Validate::_substr($date, 2);\r
-                            }\r
-                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        case 'G':\r
-                        case 'H':\r
-                            if ($next == 'G') {\r
-                                $hour = Validate::_substr($date, 1, 2);\r
-                            } else {\r
-                                $hour = Validate::_substr($date, 2);\r
-                            }\r
-                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        case 's':\r
-                        case 'i':\r
-                            $t = Validate::_substr($date, 2);\r
-                            if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {\r
-                                return false;\r
-                            }\r
-                            break;\r
-                        default:\r
-                            trigger_error("Not supported char `$next' after % in offset " . ($i+2), E_USER_WARNING);\r
-                    }\r
-                    $i++;\r
-                } else {\r
-                    //literal\r
-                    if (Validate::_substr($date, 1) != $c) {\r
-                        return false;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        // there is remaing data, we don't want it\r
-        if (strlen($date) && (strtolower($format) != 'rfc822_compliant')) {\r
-            return false;\r
-        }\r
-\r
-        if (isset($day) && isset($month) && isset($year)) {\r
-            if (!checkdate($month, $day, $year)) {\r
-                return false;\r
-            }\r
-\r
-            if (strtolower($format) == 'rfc822_compliant') {\r
-                if ($weekday != date("D", mktime(0, 0, 0, $month, $day, $year))) {\r
-                    return false;\r
-                }\r
-            }\r
-\r
-            if ($min) {\r
-                include_once 'Date/Calc.php';\r
-                if (is_a($min, 'Date') &&\r
-                    (Date_Calc::compareDates($day, $month, $year,\r
-                                             $min->getDay(), $min->getMonth(), $min->getYear()) < 0))\r
-                {\r
-                    return false;\r
-                } elseif (is_array($min) &&\r
-                        (Date_Calc::compareDates($day, $month, $year,\r
-                                             $min[0], $min[1], $min[2]) < 0))\r
-                {\r
-                    return false;\r
-                }\r
-            }\r
-\r
-            if ($max) {\r
-                include_once 'Date/Calc.php';\r
-                if (is_a($max, 'Date') &&\r
-                    (Date_Calc::compareDates($day, $month, $year,\r
-                                             $max->getDay(), $max->getMonth(), $max->getYear()) > 0))\r
-                {\r
-                    return false;\r
-                } elseif (is_array($max) &&\r
-                        (Date_Calc::compareDates($day, $month, $year,\r
-                                                 $max[0], $max[1], $max[2]) > 0))\r
-                {\r
-                    return false;\r
-                }\r
-            }\r
-        }\r
-\r
-        return true;\r
-    }\r
-\r
-    function _substr(&$date, $num, $opt = false)\r
-    {\r
-        if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {\r
-            $ret = $m[0];\r
-        } else {\r
-            $ret = substr($date, 0, $num);\r
-        }\r
-        $date = substr($date, strlen($ret));\r
-        return $ret;\r
-    }\r
-\r
-    function _modf($val, $div) {\r
-        if (function_exists('bcmod')) {\r
-            return bcmod($val, $div);\r
-        } elseif (function_exists('fmod')) {\r
-            return fmod($val, $div);\r
-        }\r
-        $r = $val / $div;\r
-        $i = intval($r);\r
-        return intval($val - $i * $div + .1);\r
-    }\r
-\r
-    /**\r
-     * Calculates sum of product of number digits with weights\r
-     *\r
-     * @param string $number number string\r
-     * @param array $weights reference to array of weights\r
-     *\r
-     * @returns int returns product of number digits with weights\r
-     *\r
-     * @access protected\r
-     */\r
-    function _multWeights($number, &$weights) {\r
-        if (!is_array($weights)) {\r
-            return -1;\r
-        }\r
-        $sum = 0;\r
-\r
-        $count = min(count($weights), strlen($number));\r
-        if ($count == 0)  { // empty string or weights array\r
-            return -1;\r
-        }\r
-        for ($i = 0; $i < $count; ++$i) {\r
-            $sum += intval(substr($number, $i, 1)) * $weights[$i];\r
-        }\r
-\r
-        return $sum;\r
-    }\r
-\r
-    /**\r
-     * Calculates control digit for a given number\r
-     *\r
-     * @param string $number number string\r
-     * @param array $weights reference to array of weights\r
-     * @param int $modulo (optionsl) number\r
-     * @param int $subtract (optional) number\r
-     * @param bool $allow_high (optional) true if function can return number higher than 10\r
-     *\r
-     * @returns int -1 calculated control number is returned\r
-     *\r
-     * @access protected\r
-     */\r
-    function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false) {\r
-        // calc sum\r
-        $sum = Validate::_multWeights($number, $weights);\r
-        if ($sum == -1) {\r
-            return -1;\r
-        }\r
-        $mod = Validate::_modf($sum, $modulo);  // calculate control digit\r
-\r
-        if ($subtract > $mod && $mod > 0) {\r
-            $mod = $subtract - $mod;\r
-        }\r
-        if ($allow_high === false) {\r
-            $mod %= 10;           // change 10 to zero\r
-        }\r
-        return $mod;\r
-    }\r
-\r
-    /**\r
-     * Validates a number\r
-     *\r
-     * @param string $number number to validate\r
-     * @param array $weights reference to array of weights\r
-     * @param int $modulo (optionsl) number\r
-     * @param int $subtract (optional) numbier\r
-     *\r
-     * @returns bool true if valid, false if not\r
-     *\r
-     * @access protected\r
-     */\r
-    function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0) {\r
-        if (strlen($number) < count($weights)) {\r
-            return false;\r
-        }\r
-        $target_digit  = substr($number, count($weights), 1);\r
-        $control_digit = Validate::_getControlNumber($number, $weights, $modulo, $subtract, $modulo > 10);\r
-\r
-        if ($control_digit == -1) {\r
-            return false;\r
-        }\r
-        if ($target_digit === 'X' && $control_digit == 10) {\r
-            return true;\r
-        }\r
-        if ($control_digit != $target_digit) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    /**\r
-     * Bulk data validation for data introduced in the form of an\r
-     * assoc array in the form $var_name => $value.\r
-     * Can be used on any of Validate subpackages\r
-     *\r
-     * @param  array   $data     Ex: array('name' => 'toto', 'email' => 'toto@thing.info');\r
-     * @param  array   $val_type Contains the validation type and all parameters used in.\r
-     *                           'val_type' is not optional\r
-     *                           others validations properties must have the same name as the function\r
-     *                           parameters.\r
-     *                           Ex: array('toto'=>array('type'=>'string','format'='toto@thing.info','min_length'=>5));\r
-     * @param  boolean $remove if set, the elements not listed in data will be removed\r
-     *\r
-     * @return array   value name => true|false    the value name comes from the data key\r
-     *\r
-     * @access public\r
-     */\r
-    function multiple(&$data, &$val_type, $remove = false)\r
-    {\r
-        $keys = array_keys($data);\r
-        $valid = array();\r
-        foreach ($keys as $var_name) {\r
-            if (!isset($val_type[$var_name])) {\r
-                if ($remove) {\r
-                    unset($data[$var_name]);\r
-                }\r
-                continue;\r
-            }\r
-            $opt = $val_type[$var_name];\r
-            $methods = get_class_methods('Validate');\r
-            $val2check = $data[$var_name];\r
-            // core validation method\r
-            if (in_array(strtolower($opt['type']), $methods)) {\r
-                //$opt[$opt['type']] = $data[$var_name];\r
-                $method = $opt['type'];\r
-                unset($opt['type']);\r
-\r
-                if (sizeof($opt) == 1 && is_array(reset($opt))) {\r
-                    $opt = array_pop($opt);\r
-                }\r
-                $valid[$var_name] = call_user_func(array('Validate', $method), $val2check, $opt);\r
-\r
-            /**\r
-             * external validation method in the form:\r
-             * "<class name><underscore><method name>"\r
-             * Ex: us_ssn will include class Validate/US.php and call method ssn()\r
-             */\r
-            } elseif (strpos($opt['type'], '_') !== false) {\r
-                $validateType = explode('_', $opt['type']);\r
-                $method       = array_pop($validateType);\r
-                $class        = implode('_', $validateType);\r
-                $classPath    = str_replace('_', DIRECTORY_SEPARATOR, $class);\r
-                $class        = 'Validate_' . $class;\r
-                if (!@include_once "Validate/$classPath.php") {\r
-                    trigger_error("$class isn't installed or you may have some permissoin issues", E_USER_ERROR);\r
-                }\r
-\r
-                $ce = substr(phpversion(), 0, 1) > 4 ? class_exists($class, false) : class_exists($class);\r
-                if (!$ce ||\r
-                    !in_array($method, get_class_methods($class)))\r
-                {\r
-                    trigger_error("Invalid validation type $class::$method", E_USER_WARNING);\r
-                    continue;\r
-                }\r
-                unset($opt['type']);\r
-                if (sizeof($opt) == 1) {\r
-                    $opt = array_pop($opt);\r
-                }\r
-                $valid[$var_name] = call_user_func(array($class, $method), $data[$var_name], $opt);\r
-            } else {\r
-                trigger_error("Invalid validation type {$opt['type']}", E_USER_WARNING);\r
-            }\r
-        }\r
-        return $valid;\r
-    }\r
-}\r
-\r
+<?php
+/**
+ * Validation class
+ *
+ * Copyright (c) 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox, Amir Saied  
+ *
+ * This source file is subject to the New BSD license, That is bundled  
+ * with this package in the file LICENSE, and is available through      
+ * the world-wide-web at                                                
+ * http://www.opensource.org/licenses/bsd-license.php                   
+ * If you did not receive a copy of the new BSDlicense and are unable   
+ * to obtain it through the world-wide-web, please send a note to       
+ * pajoye@php.net so we can mail you a copy immediately.                
+ *
+ * Author: Tomas V.V.Cox  <cox@idecnet.com>                             
+ *         Pierre-Alain Joye <pajoye@php.net>                           
+ *         Amir Mohammad Saied <amir@php.net>                           
+ *
+ *
+ * Package to validate various datas. It includes :
+ *   - numbers (min/max, decimal or not)
+ *   - email (syntax, domain check)
+ *   - string (predifined type alpha upper and/or lowercase, numeric,...)
+ *   - date (min, max, rfc822 compliant)
+ *   - uri (RFC2396)
+ *   - possibility valid multiple data with a single method call (::multiple)
+ *
+ * @category   Validate
+ * @package    Validate
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Pierre-Alain Joye <pajoye@php.net>
+ * @author     Amir Mohammad Saied <amir@php.net>
+ * @copyright  1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
+ * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
+ * @version    CVS: $Id: Validate.php,v 1.134 2009/01/28 12:27:33 davidc Exp $
+ * @link       http://pear.php.net/package/Validate
+ */
+
+/**
+ * Methods for common data validations
+ */
+define('VALIDATE_NUM',          '0-9');
+define('VALIDATE_SPACE',        '\s');
+define('VALIDATE_ALPHA_LOWER',  'a-z');
+define('VALIDATE_ALPHA_UPPER',  'A-Z');
+define('VALIDATE_ALPHA',        VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
+define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');
+define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');
+define('VALIDATE_EALPHA',       VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
+define('VALIDATE_PUNCTUATION',  VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
+define('VALIDATE_NAME',         VALIDATE_EALPHA . VALIDATE_SPACE . "'" . "-");
+define('VALIDATE_STREET',       VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
+
+define('VALIDATE_ITLD_EMAILS',  1);
+define('VALIDATE_GTLD_EMAILS',  2);
+define('VALIDATE_CCTLD_EMAILS', 4);
+define('VALIDATE_ALL_EMAILS',   8);
+
+/**
+ * Validation class
+ *
+ * Package to validate various datas. It includes :
+ *   - numbers (min/max, decimal or not)
+ *   - email (syntax, domain check)
+ *   - string (predifined type alpha upper and/or lowercase, numeric,...)
+ *   - date (min, max)
+ *   - uri (RFC2396)
+ *   - possibility valid multiple data with a single method call (::multiple)
+ *
+ * @category  Validate
+ * @package   Validate
+ * @author    Tomas V.V.Cox <cox@idecnet.com>
+ * @author    Pierre-Alain Joye <pajoye@php.net>
+ * @author    Amir Mohammad Saied <amir@php.net>
+ * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
+ * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
+ * @version   Release: @package_version@
+ * @link      http://pear.php.net/package/Validate
+ */
+class Validate
+{
+    /**
+     * International Top-Level Domain
+     *
+     * This is an array of the known international
+     * top-level domain names.
+     *
+     * @access protected
+     * @var    array     $_iTld (International top-level domains)
+     */
+    var $_itld = array(
+        'arpa',
+        'root',
+    );
+
+    /**
+     * Generic top-level domain
+     *
+     * This is an array of the official
+     * generic top-level domains.
+     *
+     * @access protected
+     * @var    array     $_gTld (Generic top-level domains)
+     */
+    var $_gtld = array(
+        'aero',
+        'biz',
+        'cat',
+        'com',
+        'coop',
+        'edu',
+        'gov',
+        'info',
+        'int',
+        'jobs',
+        'mil',
+        'mobi',
+        'museum',
+        'name',
+        'net',
+        'org',
+        'pro',
+        'travel',
+        'asia',
+        'post',
+        'tel',
+        'geo',
+    );
+
+    /**
+     * Country code top-level domains
+     *
+     * This is an array of the official country
+     * codes top-level domains
+     *
+     * @access protected
+     * @var    array     $_ccTld (Country Code Top-Level Domain)
+     */
+    var $_cctld = array(
+        'ac',
+        'ad','ae','af','ag',
+        'ai','al','am','an',
+        'ao','aq','ar','as',
+        'at','au','aw','ax',
+        'az','ba','bb','bd',
+        'be','bf','bg','bh',
+        'bi','bj','bm','bn',
+        'bo','br','bs','bt',
+        'bu','bv','bw','by',
+        'bz','ca','cc','cd',
+        'cf','cg','ch','ci',
+        'ck','cl','cm','cn',
+        'co','cr','cs','cu',
+        'cv','cx','cy','cz',
+        'de','dj','dk','dm',
+        'do','dz','ec','ee',
+        'eg','eh','er','es',
+        'et','eu','fi','fj',
+        'fk','fm','fo','fr',
+        'ga','gb','gd','ge',
+        'gf','gg','gh','gi',
+        'gl','gm','gn','gp',
+        'gq','gr','gs','gt',
+        'gu','gw','gy','hk',
+        'hm','hn','hr','ht',
+        'hu','id','ie','il',
+        'im','in','io','iq',
+        'ir','is','it','je',
+        'jm','jo','jp','ke',
+        'kg','kh','ki','km',
+        'kn','kp','kr','kw',
+        'ky','kz','la','lb',
+        'lc','li','lk','lr',
+        'ls','lt','lu','lv',
+        'ly','ma','mc','md',
+        'me','mg','mh','mk',
+        'ml','mm','mn','mo',
+        'mp','mq','mr','ms',
+        'mt','mu','mv','mw',
+        'mx','my','mz','na',
+        'nc','ne','nf','ng',
+        'ni','nl','no','np',
+        'nr','nu','nz','om',
+        'pa','pe','pf','pg',
+        'ph','pk','pl','pm',
+        'pn','pr','ps','pt',
+        'pw','py','qa','re',
+        'ro','rs','ru','rw',
+        'sa','sb','sc','sd',
+        'se','sg','sh','si',
+        'sj','sk','sl','sm',
+        'sn','so','sr','st',
+        'su','sv','sy','sz',
+        'tc','td','tf','tg',
+        'th','tj','tk','tl',
+        'tm','tn','to','tp',
+        'tr','tt','tv','tw',
+        'tz','ua','ug','uk',
+        'us','uy','uz','va',
+        'vc','ve','vg','vi',
+        'vn','vu','wf','ws',
+        'ye','yt','yu','za',
+        'zm','zw',
+    );
+
+    /**
+     * Validate a tag URI (RFC4151)
+     *
+     * @param string $uri tag URI to validate
+     *
+     * @return boolean true if valid tag URI, false if not
+     *
+     * @access private
+     */
+    function __uriRFC4151($uri)
+    {
+        $datevalid = false;
+        if (preg_match(
+            '/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $uri, $matches)) {
+            $date  = $matches['date'];
+            $date6 = strtotime($date);
+            if ((strlen($date) == 4) && $date <= date('Y')) {
+                $datevalid = true;
+            } elseif ((strlen($date) == 7) && ($date6 < strtotime("now"))) {
+                $datevalid = true;
+            } elseif ((strlen($date) == 10) && ($date6 < strtotime("now"))) {
+                $datevalid = true;
+            }
+            if (self::email($matches['name'])) {
+                $namevalid = true;
+            } else {
+                $namevalid = self::email('info@' . $matches['name']);
+            }
+            return $datevalid && $namevalid;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Validate a number
+     *
+     * @param string $number  Number to validate
+     * @param array  $options array where:
+     *                          'decimal'  is the decimal char or false when decimal
+     *                                     not allowed.
+     *                                     i.e. ',.' to allow both ',' and '.'
+     *                          'dec_prec' Number of allowed decimals
+     *                          'min'      minimum value
+     *                          'max'      maximum value
+     *
+     * @return boolean true if valid number, false if not
+     *
+     * @access public
+     */
+    function number($number, $options = array())
+    {
+        $decimal = $dec_prec = $min = $max = null;
+        if (is_array($options)) {
+            extract($options);
+        }
+
+        $dec_prec  = $dec_prec ? "{1,$dec_prec}" : '+';
+        $dec_regex = $decimal  ? "[$decimal][0-9]$dec_prec" : '';
+
+        if (!preg_match("|^[-+]?\s*[0-9]+($dec_regex)?\$|", $number)) {
+            return false;
+        }
+
+        if ($decimal != '.') {
+            $number = strtr($number, $decimal, '.');
+        }
+
+        $number = (float)str_replace(' ', '', $number);
+        if ($min !== null && $min > $number) {
+            return false;
+        }
+
+        if ($max !== null && $max < $number) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Converting a string to UTF-7 (RFC 2152)
+     *
+     * @param string $string string to be converted
+     *
+     * @return  string  converted string
+     *
+     * @access  private
+     */
+    function __stringToUtf7($string)
+    {
+        $return = '';
+        $utf7   = array(
+                        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
+                        'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
+                        'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+                        'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
+                        's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+                        '3', '4', '5', '6', '7', '8', '9', '+', ','
+                    );
+
+
+        $state = 0;
+
+        if (!empty($string)) {
+            $i = 0;
+            while ($i <= strlen($string)) {
+                $char = substr($string, $i, 1);
+                if ($state == 0) {
+                    if ((ord($char) >= 0x7F) || (ord($char) <= 0x1F)) {
+                        if ($char) {
+                            $return .= '&';
+                        }
+                        $state = 1;
+                    } elseif ($char == '&') {
+                        $return .= '&-';
+                    } else {
+                        $return .= $char;
+                    }
+                } elseif (($i == strlen($string) ||
+                            !((ord($char) >= 0x7F)) || (ord($char) <= 0x1F))) {
+                    if ($state != 1) {
+                        if (ord($char) > 64) {
+                            $return .= '';
+                        } else {
+                            $return .= $utf7[ord($char)];
+                        }
+                    }
+                    $return .= '-';
+                    $state   = 0;
+                } else {
+                    switch($state) {
+                    case 1:
+                        $return .= $utf7[ord($char) >> 2];
+                        $residue = (ord($char) & 0x03) << 4;
+                        $state   = 2;
+                        break;
+                    case 2:
+                        $return .= $utf7[$residue | (ord($char) >> 4)];
+                        $residue = (ord($char) & 0x0F) << 2;
+                        $state   = 3;
+                        break;
+                    case 3:
+                        $return .= $utf7[$residue | (ord($char) >> 6)];
+                        $return .= $utf7[ord($char) & 0x3F];
+                        $state   = 1;
+                        break;
+                    }
+                }
+                $i++;
+            }
+            return $return;
+        }
+        return '';
+    }
+
+    /**
+     * Validate an email according to full RFC822 (inclusive human readable part)
+     *
+     * @param string $email   email to validate,
+     *                        will return the address for optional dns validation
+     * @param array  $options email() options
+     *
+     * @return boolean true if valid email, false if not
+     *
+     * @access private
+     */
+    function __emailRFC822(&$email, &$options)
+    {
+        static $address   = null;
+        static $uncomment = null;
+        if (!$address) {
+            // atom        =  1*<any CHAR except specials, SPACE and CTLs>
+            $atom = '[^][()<>@,;:\\".\s\000-\037\177-\377]+\s*';
+            // qtext       =  <any CHAR excepting <">,     ; => may be folded
+            //         "\" & CR, and including linear-white-space>
+            $qtext = '[^"\\\\\r]';
+            // quoted-pair =  "\" CHAR                     ; may quote any char
+            $quoted_pair = '\\\\.';
+            // quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or
+            //                                             ;   quoted chars.
+            $quoted_string = '"(?:' . $qtext . '|' . $quoted_pair . ')*"\s*';
+            // word        =  atom / quoted-string
+            $word = '(?:' . $atom . '|' . $quoted_string . ')';
+            // local-part  =  word *("." word)             ; uninterpreted
+            //                                             ; case-preserved
+            $local_part = $word . '(?:\.\s*' . $word . ')*';
+            // dtext       =  <any CHAR excluding "[",     ; => may be folded
+            //         "]", "\" & CR, & including linear-white-space>
+            $dtext = '[^][\\\\\r]';
+            // domain-literal =  "[" *(dtext / quoted-pair) "]"
+            $domain_literal = '\[(?:' . $dtext . '|' . $quoted_pair . ')*\]\s*';
+            // sub-domain  =  domain-ref / domain-literal
+            // domain-ref  =  atom                         ; symbolic reference
+            $sub_domain = '(?:' . $atom . '|' . $domain_literal . ')';
+            // domain      =  sub-domain *("." sub-domain)
+            $domain = $sub_domain . '(?:\.\s*' . $sub_domain . ')*';
+            // addr-spec   =  local-part "@" domain        ; global address
+            $addr_spec = $local_part . '@\s*' . $domain;
+            // route       =  1#("@" domain) ":"           ; path-relative
+            $route = '@' . $domain . '(?:,@\s*' . $domain . ')*:\s*';
+            // route-addr  =  "<" [route] addr-spec ">"
+            $route_addr = '<\s*(?:' . $route . ')?' . $addr_spec . '>\s*';
+            // phrase      =  1*word                       ; Sequence of words
+            $phrase = $word  . '+';
+            // mailbox     =  addr-spec                    ; simple address
+            //             /  phrase route-addr            ; name & addr-spec
+            $mailbox = '(?:' . $addr_spec . '|' . $phrase . $route_addr . ')';
+            // group       =  phrase ":" [#mailbox] ";"
+            $group = $phrase . ':\s*(?:' . $mailbox . '(?:,\s*' . $mailbox . ')*)?;\s*';
+            //     address     =  mailbox                      ; one addressee
+            //                 /  group                        ; named list
+            $address = '/^\s*(?:' . $mailbox . '|' . $group . ')$/';
+
+            $uncomment =
+            '/((?:(?:\\\\"|[^("])*(?:' . $quoted_string .
+                                             ')?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/';
+        }
+        // strip comments
+        $email = preg_replace($uncomment, '$1 ', $email);
+        return preg_match($address, $email);
+    }
+
+    /**
+     * Full TLD Validation function
+     *
+     * This function is used to make a much more proficient validation
+     * against all types of official domain names.
+     *
+     * @param string $email   The email address to check.
+     * @param array  $options The options for validation
+     *
+     * @access protected
+     *
+     * @return bool True if validating succeeds
+     */
+    function _fullTLDValidation($email, $options)
+    {
+        $validate = array();
+        if(!empty($options["VALIDATE_ITLD_EMAILS"])) array_push($validate, 'itld');
+        if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
+        if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');
+
+        $self = new Validate;
+
+        $toValidate = array();
+
+        foreach ($validate as $valid) {
+            $tmpVar = '_' . (string)$valid;
+
+            $toValidate[$valid] = $self->{$tmpVar};
+        }
+
+        $e = $self->executeFullEmailValidation($email, $toValidate);
+
+        return $e;
+    }
+    
+    /**
+     * Execute the validation
+     *
+     * This function will execute the full email vs tld
+     * validation using an array of tlds passed to it.
+     *
+     * @param string $email       The email to validate.
+     * @param array  $arrayOfTLDs The array of the TLDs to validate
+     *
+     * @access public
+     *
+     * @return true or false (Depending on if it validates or if it does not)
+     */
+    function executeFullEmailValidation($email, $arrayOfTLDs)
+    {
+        $emailEnding = explode('.', $email);
+        $emailEnding = $emailEnding[count($emailEnding)-1];
+        foreach ($arrayOfTLDs as $validator => $keys) {
+            if (in_array($emailEnding, $keys)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Validate an email
+     *
+     * @param string $email  email to validate
+     * @param mixed  boolean (BC) $check_domain Check or not if the domain exists
+     *              array $options associative array of options
+     *              'check_domain' boolean Check or not if the domain exists
+     *              'use_rfc822' boolean Apply the full RFC822 grammar
+     *
+     * Ex.
+     *  $options = array(
+     *      'check_domain' => 'true',
+     *      'fullTLDValidation' => 'true',
+     *      'use_rfc822' => 'true',
+     *      'VALIDATE_GTLD_EMAILS' => 'true',
+     *      'VALIDATE_CCTLD_EMAILS' => 'true',
+     *      'VALIDATE_ITLD_EMAILS' => 'true',           
+     *      );
+     *
+     * @return boolean true if valid email, false if not
+     *
+     * @access public
+     */
+    function email($email, $options = null)
+    {
+        $check_domain = false;
+        $use_rfc822   = false;
+        if (is_bool($options)) {
+            $check_domain = $options;
+        } elseif (is_array($options)) {
+            extract($options);
+        }
+
+        /**
+         * Check for IDN usage so we can encode the domain as Punycode
+         * before continuing.
+         */
+        $hasIDNA = false;
+
+        if (@include_once('Net/IDNA.php')) {
+            $hasIDNA = true;
+        }
+
+        if ($hasIDNA === true) {
+            if (strpos($email, '@') !== false) {
+                list($name, $domain) = explode('@', $email, 2);
+
+                // Check if the domain contains characters > 127 which means 
+                // it's an idn domain name.
+                $chars = count_chars($domain, 1);
+                if (!empty($chars) && max(array_keys($chars)) > 127) {
+                    $idna   =& Net_IDNA::singleton();
+                    $domain = $idna->encode($domain);
+                }
+
+                $email = "$name@$domain";
+            }
+        }
+        
+        /**
+         * @todo Fix bug here.. even if it passes this, it won't be passing
+         *       The regular expression below
+         */
+        if (isset($fullTLDValidation)) {
+            //$valid = Validate::_fullTLDValidation($email, $fullTLDValidation);
+            $valid = Validate::_fullTLDValidation($email, $options);
+
+            if (!$valid) {
+                return false;
+            }
+        }
+
+        // the base regexp for address
+        $regex = '&^(?:                                               # recipient:
+         ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")|                          #1 quoted name
+         ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*)) #2 OR dot-atom
+         @(((\[)?                     #3 domain, 4 as IPv4, 5 optionally bracketed
+         (?:(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3}
+               (?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)\])|
+         ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?)  #6 domain as hostname
+         \.((?:([^- ])[-a-z]*[-a-z]))) #7 TLD 
+         $&xi';
+
+        //checks if exists the domain (MX or A)
+        if ($use_rfc822? Validate::__emailRFC822($email, $options) :
+                preg_match($regex, $email)) {
+            if ($check_domain && function_exists('checkdnsrr')) {
+                list ($account, $domain) = explode('@', $email);
+                if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
+                    return true;
+                }
+                return false;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Validate a string using the given format 'format'
+     *
+     * @param string $string  String to validate
+     * @param array  $options Options array where:
+     *                          'format' is the format of the string
+     *                              Ex:VALIDATE_NUM . VALIDATE_ALPHA (see constants)
+     *                          'min_length' minimum length
+     *                          'max_length' maximum length
+     *
+     * @return boolean true if valid string, false if not
+     *
+     * @access public
+     */
+    function string($string, $options)
+    {
+        $format     = null;
+        $min_length = 0;
+        $max_length = 0;
+
+        if (is_array($options)) {
+            extract($options);
+        }
+
+        if ($format && !preg_match("|^[$format]*\$|s", $string)) {
+            return false;
+        }
+
+        if ($min_length && strlen($string) < $min_length) {
+            return false;
+        }
+
+        if ($max_length && strlen($string) > $max_length) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Validate an URI (RFC2396)
+     * This function will validate 'foobarstring' by default, to get it to validate
+     * only http, https, ftp and such you have to pass it in the allowed_schemes
+     * option, like this:
+     * <code>
+     * $options = array('allowed_schemes' => array('http', 'https', 'ftp'))
+     * var_dump(Validate::uri('http://www.example.org', $options));
+     * </code>
+     *
+     * NOTE 1: The rfc2396 normally allows middle '-' in the top domain
+     *         e.g. http://example.co-m should be valid
+     *         However, as '-' is not used in any known TLD, it is invalid
+     * NOTE 2: As double shlashes // are allowed in the path part, only full URIs
+     *         including an authority can be valid, no relative URIs
+     *         the // are mandatory (optionally preceeded by the 'sheme:' )
+     * NOTE 3: the full complience to rfc2396 is not achieved by default
+     *         the characters ';/?:@$,' will not be accepted in the query part
+     *         if not urlencoded, refer to the option "strict'"
+     *
+     * @param string $url     URI to validate
+     * @param array  $options Options used by the validation method.
+     *                          key => type
+     *                          'domain_check' => boolean
+     *                              Whether to check the DNS entry or not
+     *                          'allowed_schemes' => array, list of protocols
+     *                              List of allowed schemes ('http',
+     *                              'ssh+svn', 'mms')
+     *                          'strict' => string the refused chars
+     *                              in query and fragment parts
+     *                              default: ';/?:@$,'
+     *                              empty: accept all rfc2396 foreseen chars
+     *
+     * @return boolean true if valid uri, false if not
+     *
+     * @access public
+     */
+    function uri($url, $options = null)
+    {
+        $strict = ';/?:@$,';
+        $domain_check = false;
+        $allowed_schemes = null;
+        if (is_array($options)) {
+            extract($options);
+        }
+        if (is_array($allowed_schemes) &&
+            in_array("tag", $allowed_schemes)
+        ) {
+            if (strpos($url, "tag:") === 0) {
+                return self::__uriRFC4151($url);
+            }
+        }
+
+        if (preg_match(
+             '&^(?:([a-z][-+.a-z0-9]*):)?                             # 1. scheme
+              (?://                                                   # authority start
+              (?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)?    # 2. authority-userinfo
+              (?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)  # 3. authority-hostname OR
+              |([0-9]{1,3}(?:\.[0-9]{1,3}){3}))                       # 4. authority-ipv4
+              (?::([0-9]*))?)                                        # 5. authority-port
+              ((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*/?)? # 6. path
+              (?:\?([^#]*))?                                          # 7. query
+              (?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@\&=+$,])*))? # 8. fragment
+              $&xi', $url, $matches)) {
+            $scheme = isset($matches[1]) ? $matches[1] : '';
+            $authority = isset($matches[3]) ? $matches[3] : '' ;
+            if (is_array($allowed_schemes) &&
+                !in_array($scheme, $allowed_schemes)
+            ) {
+                return false;
+            }
+            if (!empty($matches[4])) {
+                $parts = explode('.', $matches[4]);
+                foreach ($parts as $part) {
+                    if ($part > 255) {
+                        return false;
+                    }
+                }
+            } elseif ($domain_check && function_exists('checkdnsrr')) {
+                if (!checkdnsrr($authority, 'A')) {
+                    return false;
+                }
+            }
+            if ($strict) {
+                $strict = '#[' . preg_quote($strict, '#') . ']#';
+                if ((!empty($matches[7]) && preg_match($strict, $matches[7]))
+                 || (!empty($matches[8]) && preg_match($strict, $matches[8]))) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Validate date and times. Note that this method need the Date_Calc class
+     *
+     * @param string $date    Date to validate
+     * @param array  $options array options where :
+     *                          'format' The format of the date (%d-%m-%Y)
+     *                                   or rfc822_compliant
+     *                          'min'    The date has to be greater
+     *                                   than this array($day, $month, $year)
+     *                                   or PEAR::Date object
+     *                          'max'    The date has to be smaller than
+     *                                   this array($day, $month, $year)
+     *                                   or PEAR::Date object
+     *
+     * @return boolean true if valid date/time, false if not
+     *
+     * @access public
+     */
+    function date($date, $options)
+    {
+        $max    = false;
+        $min    = false;
+        $format = '';
+
+        if (is_array($options)) {
+            extract($options);
+        }
+
+        if (strtolower($format) == 'rfc822_compliant') {
+            $preg = '&^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),) \s+
+                    (?:(\d{2})?) \s+
+                    (?:(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)?) \s+
+                    (?:(\d{2}(\d{2})?)?) \s+
+                    (?:(\d{2}?)):(?:(\d{2}?))(:(?:(\d{2}?)))? \s+
+                    (?:[+-]\d{4}|UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Za-ik-z])$&xi';
+
+            if (!preg_match($preg, $date, $matches)) {
+                return false;
+            }
+
+            $year    = (int)$matches[4];
+            $months  = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+                             'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
+            $month   = array_keys($months, $matches[3]);
+            $month   = (int)$month[0]+1;
+            $day     = (int)$matches[2];
+            $weekday = $matches[1];
+            $hour    = (int)$matches[6];
+            $minute  = (int)$matches[7];
+            isset($matches[9]) ? $second = (int)$matches[9] : $second = 0;
+
+            if ((strlen($year) != 4)        ||
+                ($day    > 31   || $day < 1)||
+                ($hour   > 23)  ||
+                ($minute > 59)  ||
+                ($second > 59)) {
+                    return false;
+            }
+        } else {
+            $date_len = strlen($format);
+            for ($i = 0; $i < $date_len; $i++) {
+                $c = $format{$i};
+                if ($c == '%') {
+                    $next = $format{$i + 1};
+                    switch ($next) {
+                    case 'j':
+                    case 'd':
+                        if ($next == 'j') {
+                            $day = (int)Validate::_substr($date, 1, 2);
+                        } else {
+                            $day = (int)Validate::_substr($date, 0, 2);
+                        }
+                        if ($day < 1 || $day > 31) {
+                            return false;
+                        }
+                        break;
+                    case 'm':
+                    case 'n':
+                        if ($next == 'm') {
+                            $month = (int)Validate::_substr($date, 0, 2);
+                        } else {
+                            $month = (int)Validate::_substr($date, 1, 2);
+                        }
+                        if ($month < 1 || $month > 12) {
+                            return false;
+                        }
+                        break;
+                    case 'Y':
+                    case 'y':
+                        if ($next == 'Y') {
+                            $year = Validate::_substr($date, 4);
+                            $year = (int)$year?$year:'';
+                        } else {
+                            $year = (int)(substr(date('Y'), 0, 2) .
+                                              Validate::_substr($date, 2));
+                        }
+                        if (strlen($year) != 4 || $year < 0 || $year > 9999) {
+                            return false;
+                        }
+                        break;
+                    case 'g':
+                    case 'h':
+                        if ($next == 'g') {
+                            $hour = Validate::_substr($date, 1, 2);
+                        } else {
+                            $hour = Validate::_substr($date, 2);
+                        }
+                        if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {
+                            return false;
+                        }
+                        break;
+                    case 'G':
+                    case 'H':
+                        if ($next == 'G') {
+                            $hour = Validate::_substr($date, 1, 2);
+                        } else {
+                            $hour = Validate::_substr($date, 2);
+                        }
+                        if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {
+                            return false;
+                        }
+                        break;
+                    case 's':
+                    case 'i':
+                        $t = Validate::_substr($date, 2);
+                        if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {
+                            return false;
+                        }
+                        break;
+                    default:
+                        trigger_error("Not supported char `$next' after % in offset " . ($i+2), E_USER_WARNING);
+                    }
+                    $i++;
+                } else {
+                    //literal
+                    if (Validate::_substr($date, 1) != $c) {
+                        return false;
+                    }
+                }
+            }
+        }
+        // there is remaing data, we don't want it
+        if (strlen($date) && (strtolower($format) != 'rfc822_compliant')) {
+            return false;
+        }
+
+        if (isset($day) && isset($month) && isset($year)) {
+            if (!checkdate($month, $day, $year)) {
+                return false;
+            }
+
+            if (strtolower($format) == 'rfc822_compliant') {
+                if ($weekday != date("D", mktime(0, 0, 0, $month, $day, $year))) {
+                    return false;
+                }
+            }
+
+            if ($min) {
+                include_once 'Date/Calc.php';
+                if (is_a($min, 'Date') &&
+                    (Date_Calc::compareDates($day, $month, $year,
+                        $min->getDay(), $min->getMonth(), $min->getYear()) < 0)
+                ) {
+                    return false;
+                } elseif (is_array($min) &&
+                        (Date_Calc::compareDates($day, $month, $year,
+                            $min[0], $min[1], $min[2]) < 0)
+                ) {
+                    return false;
+                }
+            }
+
+            if ($max) {
+                include_once 'Date/Calc.php';
+                if (is_a($max, 'Date') &&
+                    (Date_Calc::compareDates($day, $month, $year,
+                        $max->getDay(), $max->getMonth(), $max->getYear()) > 0)
+                ) {
+                    return false;
+                } elseif (is_array($max) &&
+                        (Date_Calc::compareDates($day, $month, $year,
+                            $max[0], $max[1], $max[2]) > 0)
+                ) {
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Substr
+     *
+     * @param string &$date Date
+     * @param string $num   Length
+     * @param string $opt   Unknown   
+     *
+     * @access private
+     * @return string
+     */
+    function _substr(&$date, $num, $opt = false)
+    {
+        if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {
+            $ret = $m[0];
+        } else {
+            $ret = substr($date, 0, $num);
+        }
+        $date = substr($date, strlen($ret));
+        return $ret;
+    }
+
+    function _modf($val, $div)
+    {
+        if (function_exists('bcmod')) {
+            return bcmod($val, $div);
+        } elseif (function_exists('fmod')) {
+            return fmod($val, $div);
+        }
+        $r = $val / $div;
+        $i = intval($r);
+        return intval($val - $i * $div + .1);
+    }
+
+    /**
+     * Calculates sum of product of number digits with weights
+     *
+     * @param string $number  number string
+     * @param array  $weights reference to array of weights
+     *
+     * @access protected
+     *
+     * @return int returns product of number digits with weights
+     */
+    function _multWeights($number, &$weights)
+    {
+        if (!is_array($weights)) {
+            return -1;
+        }
+        $sum = 0;
+
+        $count = min(count($weights), strlen($number));
+        if ($count == 0) { // empty string or weights array
+            return -1;
+        }
+        for ($i = 0; $i < $count; ++$i) {
+            $sum += intval(substr($number, $i, 1)) * $weights[$i];
+        }
+
+        return $sum;
+    }
+
+    /**
+     * Calculates control digit for a given number
+     *
+     * @param string $number     number string
+     * @param array  $weights    reference to array of weights
+     * @param int    $modulo     (optionsl) number
+     * @param int    $subtract   (optional) number
+     * @param bool   $allow_high (optional) true if function can return number higher than 10
+     *
+     * @access protected
+     *
+     * @return  int -1 calculated control number is returned
+     */
+    function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false)
+    {
+        // calc sum
+        $sum = Validate::_multWeights($number, $weights);
+        if ($sum == -1) {
+            return -1;
+        }
+        $mod = Validate::_modf($sum, $modulo);  // calculate control digit
+
+        if ($subtract > $mod && $mod > 0) {
+            $mod = $subtract - $mod;
+        }
+        if ($allow_high === false) {
+            $mod %= 10;           // change 10 to zero
+        }
+        return $mod;
+    }
+
+    /**
+     * Validates a number
+     *
+     * @param string $number   number to validate
+     * @param array  $weights  reference to array of weights
+     * @param int    $modulo   (optional) number
+     * @param int    $subtract (optional) number
+     *
+     * @access protected
+     *
+     * @return  bool true if valid, false if not
+     */
+    function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0)
+    {
+        if (strlen($number) < count($weights)) {
+            return false;
+        }
+        $target_digit  = substr($number, count($weights), 1);
+        $control_digit = Validate::_getControlNumber($number, $weights, $modulo, $subtract, $modulo > 10);
+
+        if ($control_digit == -1) {
+            return false;
+        }
+        if ($target_digit === 'X' && $control_digit == 10) {
+            return true;
+        }
+        if ($control_digit != $target_digit) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Bulk data validation for data introduced in the form of an
+     * assoc array in the form $var_name => $value.
+     * Can be used on any of Validate subpackages
+     *
+     * @param array   $data     Ex: array('name' => 'toto', 'email' => 'toto@thing.info');
+     * @param array   $val_type Contains the validation type and all parameters used in.
+     *                          'val_type' is not optional
+     *                          others validations properties must have the same name as the function
+     *                          parameters.
+     *                          Ex: array('toto'=>array('type'=>'string','format'='toto@thing.info','min_length'=>5));
+     * @param boolean $remove   if set, the elements not listed in data will be removed
+     *
+     * @return array   value name => true|false    the value name comes from the data key
+     *
+     * @access public
+     */
+    function multiple(&$data, &$val_type, $remove = false)
+    {
+        $keys  = array_keys($data);
+        $valid = array();
+
+        foreach ($keys as $var_name) {
+            if (!isset($val_type[$var_name])) {
+                if ($remove) {
+                    unset($data[$var_name]);
+                }
+                continue;
+            }
+            $opt       = $val_type[$var_name];
+            $methods   = get_class_methods('Validate');
+            $val2check = $data[$var_name];
+            // core validation method
+            if (in_array(strtolower($opt['type']), $methods)) {
+                //$opt[$opt['type']] = $data[$var_name];
+                $method = $opt['type'];
+                unset($opt['type']);
+
+                if (sizeof($opt) == 1 && is_array(reset($opt))) {
+                    $opt = array_pop($opt);
+                }
+                $valid[$var_name] = call_user_func(array('Validate', $method), $val2check, $opt);
+
+                /**
+                 * external validation method in the form:
+                 * "<class name><underscore><method name>"
+                 * Ex: us_ssn will include class Validate/US.php and call method ssn()
+                 */
+            } elseif (strpos($opt['type'], '_') !== false) {
+                $validateType = explode('_', $opt['type']);
+                $method       = array_pop($validateType);
+                $class        = implode('_', $validateType);
+                $classPath    = str_replace('_', DIRECTORY_SEPARATOR, $class);
+                $class        = 'Validate_' . $class;
+                if (!@include_once "Validate/$classPath.php") {
+                    trigger_error("$class isn't installed or you may have some permissoin issues", E_USER_ERROR);
+                }
+
+                $ce = substr(phpversion(), 0, 1) > 4 ?
+                    class_exists($class, false) : class_exists($class);
+                if (!$ce ||
+                    !in_array($method, get_class_methods($class))
+                ) {
+                    trigger_error("Invalid validation type $class::$method",
+                        E_USER_WARNING);
+                    continue;
+                }
+                unset($opt['type']);
+                if (sizeof($opt) == 1) {
+                    $opt = array_pop($opt);
+                }
+                $valid[$var_name] = call_user_func(array($class, $method),
+                    $data[$var_name], $opt);
+            } else {
+                trigger_error("Invalid validation type {$opt['type']}",
+                    E_USER_WARNING);
+            }
+        }
+        return $valid;
+    }
+}
+
index 35de6be5090bba96a4038d0fbd01273cab77a1d6..fee1dd086a9600875d0b8d9e9d8cffea46c579cc 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// Copyright 2004-2008 Facebook. All Rights Reserved.
+// Copyright 2004-2009 Facebook. All Rights Reserved.
 //
 // +---------------------------------------------------------------------------+
 // | Facebook Platform PHP5 client                                             |
 // +---------------------------------------------------------------------------+
 // | For help with this library, contact developers-help@facebook.com          |
 // +---------------------------------------------------------------------------+
-//
+
 include_once 'facebookapi_php5_restlib.php';
 
 define('FACEBOOK_API_VALIDATION_ERROR', 1);
 class Facebook {
   public $api_client;
-
   public $api_key;
   public $secret;
   public $generate_session_secret;
@@ -213,28 +212,55 @@ class Facebook {
     }
   }
 
-  // Invalidate the session currently being used, and clear any state associated with it
+  // Invalidate the session currently being used, and clear any state associated
+  // with it. Note that the user will still remain logged into Facebook.
   public function expire_session() {
     if ($this->api_client->auth_expireSession()) {
-      if (!$this->in_fb_canvas() && isset($_COOKIE[$this->api_key . '_user'])) {
-        $cookies = array('user', 'session_key', 'expires', 'ss');
-        foreach ($cookies as $name) {
-          setcookie($this->api_key . '_' . $name, false, time() - 3600);
-          unset($_COOKIE[$this->api_key . '_' . $name]);
-        }
-        setcookie($this->api_key, false, time() - 3600);
-        unset($_COOKIE[$this->api_key]);
-      }
-
-      // now, clear the rest of the stored state
-      $this->user = 0;
-      $this->api_client->session_key = 0;
+      $this->clear_cookie_state();
       return true;
     } else {
       return false;
     }
   }
 
+  /** Logs the user out of all temporary application sessions as well as their
+   * Facebook session.  Note this will only work if the user has a valid current
+   * session with the application.
+   *
+   * @param string  $next  URL to redirect to upon logging out
+   *
+   */
+   public function logout($next) {
+    $logout_url = $this->get_logout_url($next);
+
+    // Clear any stored state
+    $this->clear_cookie_state();
+
+    $this->redirect($logout_url);
+  }
+
+  /**
+   *  Clears any persistent state stored about the user, including
+   *  cookies and information related to the current session in the
+   *  client.
+   *
+   */
+  public function clear_cookie_state() {
+    if (!$this->in_fb_canvas() && isset($_COOKIE[$this->api_key . '_user'])) {
+       $cookies = array('user', 'session_key', 'expires', 'ss');
+       foreach ($cookies as $name) {
+         setcookie($this->api_key . '_' . $name, false, time() - 3600);
+         unset($_COOKIE[$this->api_key . '_' . $name]);
+       }
+       setcookie($this->api_key, false, time() - 3600);
+       unset($_COOKIE[$this->api_key]);
+     }
+
+     // now, clear the rest of the stored state
+     $this->user = 0;
+     $this->api_client->session_key = 0;
+  }
+
   public function redirect($url) {
     if ($this->in_fb_canvas()) {
       echo '<fb:redirect url="' . $url . '"/>';
@@ -249,7 +275,8 @@ class Facebook {
   }
 
   public function in_frame() {
-    return isset($this->fb_params['in_canvas']) || isset($this->fb_params['in_iframe']);
+    return isset($this->fb_params['in_canvas'])
+        || isset($this->fb_params['in_iframe']);
   }
   public function in_fb_canvas() {
     return isset($this->fb_params['in_canvas']);
@@ -296,14 +323,42 @@ class Facebook {
   }
 
   public function get_add_url($next=null) {
-    return self::get_facebook_url().'/add.php?api_key='.$this->api_key .
-      ($next ? '&next=' . urlencode($next) : '');
+    $page = self::get_facebook_url().'/add.php';
+    $params = array('api_key' => $this->api_key);
+
+    if ($next) {
+      $params['next'] = $next;
+    }
+
+    return $page . '?' . http_build_query($params);
   }
 
   public function get_login_url($next, $canvas) {
-    return self::get_facebook_url().'/login.php?v=1.0&api_key=' . $this->api_key .
-      ($next ? '&next=' . urlencode($next)  : '') .
-      ($canvas ? '&canvas' : '');
+    $page = self::get_facebook_url().'/login.php';
+    $params = array('api_key' => $this->api_key,
+                    'v'       => '1.0');
+
+    if ($next) {
+      $params['next'] = $next;
+    }
+    if ($canvas) {
+      $params['canvas'] = '1';
+    }
+
+    return $page . '?' . http_build_query($params);
+  }
+
+  public function get_logout_url($next) {
+    $page = self::get_facebook_url().'/logout.php';
+    $params = array('app_key'     => $this->api_key,
+                    'session_key' => $this->api_client->session_key);
+
+    if ($next) {
+      $params['connect_next'] = 1;
+      $params['next'] = $next;
+    }
+
+    return $page . '?' . http_build_query($params);
   }
 
   public function set_user($user, $session_key, $expires=null, $session_secret=null) {
@@ -410,7 +465,20 @@ class Facebook {
     return $fb_params;
   }
 
-  /*
+  /**
+   *  Validates the account that a user was trying to set up an
+   *  independent account through Facebook Connect.
+   *
+   *  @param  user The user attempting to set up an independent account.
+   *  @param  hash The hash passed to the reclamation URL used.
+   *  @return bool True if the user is the one that selected the
+   *               reclamation link.
+   */
+  public function verify_account_reclamation($user, $hash) {
+    return $hash == md5($user . $this->secret);
+  }
+
+  /**
    * Validates that a given set of parameters match their signature.
    * Parameters all match a given input prefix, such as "fb_sig".
    *
@@ -422,6 +490,37 @@ class Facebook {
     return self::generate_sig($fb_params, $this->secret) == $expected_sig;
   }
 
+  /**
+   * Validate the given signed public session data structure with
+   * public key of the app that
+   * the session proof belongs to.
+   *
+   * @param $signed_data the session info that is passed by another app
+   * @param string $public_key Optional public key of the app. If this
+   *               is not passed, function will make an API call to get it.
+   * return true if the session proof passed verification.
+   */
+  public function verify_signed_public_session_data($signed_data,
+                                                    $public_key = null) {
+
+    // If public key is not already provided, we need to get it through API
+    if (!$public_key) {
+      $public_key = $this->api_client->auth_getAppPublicKey(
+        $signed_data['api_key']);
+    }
+
+    // Create data to verify
+    $data_to_serialize = $signed_data;
+    unset($data_to_serialize['sig']);
+    $serialized_data = implode('_', $data_to_serialize);
+
+    // Decode signature
+    $signature = base64_decode($signed_data['sig']);
+    $result = openssl_verify($serialized_data, $signature, $public_key,
+                             OPENSSL_ALGO_SHA1);
+    return $result == 1;
+  }
+
   /*
    * Generate a signature using the application secret key.
    *
index 90cdf66bd0777822e2acce3b9315eada561a60a7..e79a2ca3433819126fef76d29ea6251dbdaceb76 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// Copyright 2004-2008 Facebook. All Rights Reserved.
+// Copyright 2004-2009 Facebook. All Rights Reserved.
 //
 // +---------------------------------------------------------------------------+
 // | Facebook Platform PHP5 client                                             |
old mode 100644 (file)
new mode 100755 (executable)
index 389f40a..3fec06e
@@ -1,9 +1,10 @@
 <?php
+// Copyright 2004-2009 Facebook. All Rights Reserved.
 //
 // +---------------------------------------------------------------------------+
 // | Facebook Platform PHP5 client                                             |
 // +---------------------------------------------------------------------------+
-// | Copyright (c) 2007-2008 Facebook, Inc.                                    |
+// | Copyright (c) 2007-2009 Facebook, Inc.                                    |
 // | All rights reserved.                                                      |
 // |                                                                           |
 // | Redistribution and use in source and binary forms, with or without        |
@@ -32,6 +33,7 @@
 //
 
 include_once 'jsonwrapper/jsonwrapper.php';
+
 class FacebookRestClient {
   public $secret;
   public $session_key;
@@ -50,7 +52,9 @@ class FacebookRestClient {
   public $canvas_user;
   public $batch_mode;
   private $batch_queue;
+  private $pending_batch;
   private $call_as_apikey;
+  private $use_curl_if_available;
 
   const BATCH_MODE_DEFAULT = 0;
   const BATCH_MODE_SERVER_PARALLEL = 0;
@@ -70,7 +74,8 @@ class FacebookRestClient {
     $this->batch_mode = FacebookRestClient::BATCH_MODE_DEFAULT;
     $this->last_call_id = 0;
     $this->call_as_apikey = '';
-      $this->server_addr  = Facebook::get_facebook_url('api') . '/restserver.php';
+    $this->use_curl_if_available = true;
+    $this->server_addr  = Facebook::get_facebook_url('api') . '/restserver.php';
 
     if (!empty($GLOBALS['facebook_config']['debug'])) {
       $this->cur_id = 0;
@@ -122,40 +127,62 @@ function toggleDisplay(id, type) {
     $this->user = $uid;
   }
 
+  /**
+   * Normally, if the cURL library/PHP extension is available, it is used for
+   * HTTP transactions.  This allows that behavior to be overridden, falling
+   * back to a vanilla-PHP implementation even if cURL is installed.
+   *
+   * @param $use_curl_if_available bool whether or not to use cURL if available
+   */
+  public function set_use_curl_if_available($use_curl_if_available) {
+    $this->use_curl_if_available = $use_curl_if_available;
+  }
+
   /**
    * Start a batch operation.
    */
   public function begin_batch() {
-    if($this->batch_queue !== null) {
+    if ($this->pending_batch()) {
       $code = FacebookAPIErrorCodes::API_EC_BATCH_ALREADY_STARTED;
-      throw new FacebookRestClientException($code,
-        FacebookAPIErrorCodes::$api_error_descriptions[$code]);
+      $description = FacebookAPIErrorCodes::$api_error_descriptions[$code];
+      throw new FacebookRestClientException($description, $code);
     }
 
     $this->batch_queue = array();
+    $this->pending_batch = true;
   }
 
   /*
    * End current batch operation
    */
   public function end_batch() {
-    if($this->batch_queue === null) {
+    if (!$this->pending_batch()) {
       $code = FacebookAPIErrorCodes::API_EC_BATCH_NOT_STARTED;
-      throw new FacebookRestClientException($code,
-      FacebookAPIErrorCodes::$api_error_descriptions[$code]);
+      $description = FacebookAPIErrorCodes::$api_error_descriptions[$code];
+      throw new FacebookRestClientException($description, $code);
     }
 
-    $this->execute_server_side_batch();
+    $this->pending_batch = false;
 
+    $this->execute_server_side_batch();
     $this->batch_queue = null;
   }
 
+  /**
+   * are we currently queueing up calls for a batch?
+   */
+  public function pending_batch() {
+    return $this->pending_batch;
+  }
+
   private function execute_server_side_batch() {
     $item_count = count($this->batch_queue);
     $method_feed = array();
     foreach($this->batch_queue as $batch_item) {
-      $method_feed[] = $this->create_post_string($batch_item['m'],
-                                                 $batch_item['p']);
+      $method = $batch_item['m'];
+      $params = $batch_item['p'];
+      $this->finalize_params($method, $params);
+      $method_feed[] = $this->create_post_string($method, $params);
     }
 
     $method_feed_json = json_encode($method_feed);
@@ -202,6 +229,18 @@ function toggleDisplay(id, type) {
     $this->call_as_apikey = '';
   }
 
+
+  /*
+   * If a page is loaded via HTTPS, then all images and static
+   * resources need to be printed with HTTPS urls to avoid
+   * mixed content warnings. If your page loads with an HTTPS
+   * url, then call set_use_ssl_resources to retrieve the correct
+   * urls.
+   */
+  public function set_use_ssl_resources($is_ssl = true) {
+    $this->use_ssl_resources = $is_ssl;
+  }
+
   /**
    * Returns public information for an application (as shown in the application
    * directory) by either application ID, API key, or canvas page name.
@@ -231,7 +270,7 @@ function toggleDisplay(id, type) {
    * @return string  An authentication token.
    */
   public function auth_createToken() {
-    return $this->call_method('facebook.auth.createToken', array());
+    return $this->call_method('facebook.auth.createToken');
   }
 
   /**
@@ -246,8 +285,7 @@ function toggleDisplay(id, type) {
    * @return array  An assoc array containing session_key, uid
    */
   public function auth_getSession($auth_token, $generate_session_secret=false) {
-    //Check if we are in batch mode
-    if($this->batch_queue === null) {
+    if (!$this->pending_batch()) {
       $result = $this->call_method('facebook.auth.getSession',
           array('auth_token' => $auth_token,
                 'generate_session_secret' => $generate_session_secret));
@@ -271,7 +309,7 @@ function toggleDisplay(id, type) {
    *        API_EC_PARAM_UNKNOWN
    */
   public function auth_promoteSession() {
-      return $this->call_method('facebook.auth.promoteSession', array());
+      return $this->call_method('facebook.auth.promoteSession');
   }
 
   /**
@@ -282,7 +320,20 @@ function toggleDisplay(id, type) {
    * @return bool  true if session expiration was successful, false otherwise
    */
   public function auth_expireSession() {
-      return $this->call_method('facebook.auth.expireSession', array());
+      return $this->call_method('facebook.auth.expireSession');
+  }
+
+  /**
+   *  Revokes the given extended permission that the user granted at some
+   *  prior time (for instance, offline_access or email).  If no user is
+   *  provided, it will be revoked for the user of the current session.
+   *
+   *  @param  string  $perm  The permission to revoke
+   *  @param  int     $uid   The user for whom to revoke the permission.
+   */
+  public function auth_revokeExtendedPermission($perm, $uid=null) {
+    return $this->call_method('facebook.auth.revokeExtendedPermission',
+        array('perm' => $perm, 'uid' => $uid));
   }
 
   /**
@@ -302,6 +353,30 @@ function toggleDisplay(id, type) {
           array('uid' => $uid));
   }
 
+  /**
+   * Get public key that is needed to verify digital signature
+   * an app may pass to other apps. The public key is only used by
+   * other apps for verification purposes.
+   * @param  string  API key of an app
+   * @return string  The public key for the app.
+   */
+  public function auth_getAppPublicKey($target_app_key) {
+    return $this->call_method('facebook.auth.getAppPublicKey',
+          array('target_app_key' => $target_app_key));
+  }
+
+  /**
+   * Get a structure that can be passed to another app
+   * as proof of session. The other app can verify it using public
+   * key of this app.
+   *
+   * @return signed public session data structure.
+   */
+  public function auth_getSignedPublicSessionData() {
+    return $this->call_method('facebook.auth.getSignedPublicSessionData',
+                              array());
+  }
+
   /**
    * Returns the number of unconnected friends that exist in this application.
    * This number is determined based on the accounts registered through
@@ -363,8 +438,9 @@ function toggleDisplay(id, type) {
    *
    * @param int $uid            (Optional) User associated with events. A null
    *                            parameter will default to the session user.
-   * @param array $eids         (Optional) Filter by these event ids. A null
-   *                            parameter will get all events for the user.
+   * @param array/string $eids  (Optional) Filter by these event
+   *                            ids. A null parameter will get all events for
+   *                            the user. (A csv list will work but is deprecated)
    * @param int $start_time     (Optional) Filter with this unix time as lower
    *                            bound.  A null or zero parameter indicates no
    *                            lower bound.
@@ -718,12 +794,15 @@ function toggleDisplay(id, type) {
    * @param string $body_general     (Optional) Additional markup that extends
    *                                 the body of a short story.
    * @param int $story_size          (Optional) A story size (see above)
+   * @param string $user_message     (Optional) A user message for a short
+   *                                 story.
    *
    * @return bool  true on success
    */
   public function &feed_publishUserAction(
       $template_bundle_id, $template_data, $target_ids='', $body_general='',
-      $story_size=FacebookRestClient::STORY_SIZE_ONE_LINE) {
+      $story_size=FacebookRestClient::STORY_SIZE_ONE_LINE,
+      $user_message='') {
 
     if (is_array($template_data)) {
       $template_data = json_encode($template_data);
@@ -739,7 +818,107 @@ function toggleDisplay(id, type) {
               'template_data' => $template_data,
               'target_ids' => $target_ids,
               'body_general' => $body_general,
-              'story_size' => $story_size));
+              'story_size' => $story_size,
+              'user_message' => $user_message));
+  }
+
+
+  /**
+   * Publish a post to the user's stream.
+   *
+   * @param $message        the user's message
+   * @param $attachment     the post's attachment (optional)
+   * @param $action links   the post's action links (optional)
+   * @param $target_id      the user on whose wall the post will be posted
+   *                        (optional)
+   * @param $uid            the actor (defaults to session user)
+   * @return string the post id
+   */
+  public function stream_publish(
+    $message, $attachment = null, $action_links = null, $target_id = null,
+    $uid = null) {
+
+    return $this->call_method(
+      'facebook.stream.publish',
+      array('message' => $message,
+            'attachment' => $attachment,
+            'action_links' => $action_links,
+            'target_id' => $target_id,
+            'uid' => $this->get_uid($uid)));
+  }
+
+  /**
+   * Remove a post from the user's stream.
+   * Currently, you may only remove stories you application created.
+   *
+   * @param $post_id  the post id
+   * @param $uid      the actor (defaults to session user)
+   * @return bool
+   */
+  public function stream_remove($post_id, $uid = null) {
+    return $this->call_method(
+      'facebook.stream.remove',
+      array('post_id' => $post_id,
+            'uid' => $this->get_uid($uid)));
+  }
+
+  /**
+   * Add a comment to a stream post
+   *
+   * @param $post_id  the post id
+   * @param $comment  the comment text
+   * @param $uid      the actor (defaults to session user)
+   * @return string the id of the created comment
+   */
+  public function stream_addComment($post_id, $comment, $uid = null) {
+    return $this->call_method(
+      'facebook.stream.addComment',
+      array('post_id' => $post_id,
+            'comment' => $comment,
+            'uid' => $this->get_uid($uid)));
+  }
+
+
+  /**
+   * Remove a comment from a stream post
+   *
+   * @param $comment_id  the comment id
+   * @param $uid      the actor (defaults to session user)
+   * @return bool
+   */
+  public function stream_removeComment($comment_id, $uid = null) {
+    return $this->call_method(
+      'facebook.stream.removeComment',
+      array('comment_id' => $comment_id,
+            'uid' => $this->get_uid($uid)));
+  }
+
+  /**
+   * Add a like to a stream post
+   *
+   * @param $post_id  the post id
+   * @param $uid      the actor (defaults to session user)
+   * @return bool
+   */
+  public function stream_addLike($post_id, $uid = null) {
+    return $this->call_method(
+      'facebook.stream.addLike',
+      array('post_id' => $post_id,
+            'uid' => $this->get_uid($uid)));
+  }
+
+  /**
+   * Remove a like from a stream post
+   *
+   * @param $post_id  the post id
+   * @param $uid      the actor (defaults to session user)
+   * @return bool
+   */
+  public function stream_removeLike($post_id, $uid = null) {
+    return $this->call_method(
+      'facebook.stream.removeLike',
+      array('post_id' => $post_id,
+            'uid' => $this->get_uid($uid)));
   }
 
   /**
@@ -750,7 +929,7 @@ function toggleDisplay(id, type) {
    * @return array  An array of feed story objects.
    */
   public function &feed_getAppFriendStories() {
-    return $this->call_method('facebook.feed.getAppFriendStories', array());
+    return $this->call_method('facebook.feed.getAppFriendStories');
   }
 
   /**
@@ -771,33 +950,42 @@ function toggleDisplay(id, type) {
    * Returns whether or not pairs of users are friends.
    * Note that the Facebook friend relationship is symmetric.
    *
-   * @param array $uids1  array of ids (id_1, id_2,...) of some length X
-   * @param array $uids2  array of ids (id_A, id_B,...) of SAME length X
+   * @param array/string $uids1  list of ids (id_1, id_2,...)
+   *                       of some length X (csv is deprecated)
+   * @param array/string $uids2  list of ids (id_A, id_B,...)
+   *                       of SAME length X (csv is deprecated)
    *
    * @return array  An array with uid1, uid2, and bool if friends, e.g.:
    *   array(0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1),
    *         1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
    *         ...)
+   * @error
+   *    API_EC_PARAM_USER_ID_LIST
    */
   public function &friends_areFriends($uids1, $uids2) {
     return $this->call_method('facebook.friends.areFriends',
-        array('uids1' => $uids1, 'uids2' => $uids2));
+                 array('uids1' => $uids1,
+                       'uids2' => $uids2));
   }
 
   /**
    * Returns the friends of the current session user.
    *
    * @param int $flid  (Optional) Only return friends on this friend list.
+   * @param int $uid   (Optional) Return friends for this user.
    *
    * @return array  An array of friends
    */
-  public function &friends_get($flid=null) {
+  public function &friends_get($flid=null, $uid = null) {
     if (isset($this->friends_list)) {
       return $this->friends_list;
     }
     $params = array();
-    if (isset($this->canvas_user)) {
-      $params['uid'] = $this->canvas_user;
+    if (!$uid && isset($this->canvas_user)) {
+      $uid = $this->canvas_user;
+    }
+    if ($uid) {
+      $params['uid'] = $uid;
     }
     if ($flid) {
       $params['flid'] = $flid;
@@ -812,7 +1000,7 @@ function toggleDisplay(id, type) {
    * @return array  An array of friend list objects
    */
   public function &friends_getLists() {
-    return $this->call_method('facebook.friends.getLists', array());
+    return $this->call_method('facebook.friends.getLists');
   }
 
   /**
@@ -822,7 +1010,7 @@ function toggleDisplay(id, type) {
    * @return array  An array of friends also using the app
    */
   public function &friends_getAppUsers() {
-    return $this->call_method('facebook.friends.getAppUsers', array());
+    return $this->call_method('facebook.friends.getAppUsers');
   }
 
   /**
@@ -830,8 +1018,9 @@ function toggleDisplay(id, type) {
    *
    * @param int $uid     (Optional) User associated with groups.  A null
    *                     parameter will default to the session user.
-   * @param array $gids  (Optional) Group ids to query. A null parameter will
-   *                     get all groups for the user.
+   * @param array/string $gids (Optional) Array of group ids to query. A null
+   *                     parameter will get all groups for the user.
+   *                     (csv is deprecated)
    *
    * @return array  An array of group objects
    */
@@ -889,6 +1078,40 @@ function toggleDisplay(id, type) {
               'path' => $path));
   }
 
+  /**
+   * Retrieves links posted by the given user.
+   *
+   * @param int    $uid      The user whose links you wish to retrieve
+   * @param int    $limit    The maximimum number of links to retrieve
+   * @param array $link_ids (Optional) Array of specific link
+   *                          IDs to retrieve by this user
+   *
+   * @return array  An array of links.
+   */
+  public function &links_get($uid, $limit, $link_ids = null) {
+    return $this->call_method('links.get',
+        array('uid' => $uid,
+              'limit' => $limit,
+              'link_ids' => $link_ids));
+  }
+
+  /**
+   * Posts a link on Facebook.
+   *
+   * @param string $url     URL/link you wish to post
+   * @param string $comment (Optional) A comment about this link
+   * @param int    $uid     (Optional) User ID that is posting this link;
+   *                        defaults to current session user
+   *
+   * @return bool
+   */
+  public function &links_post($url, $comment='', $uid = null) {
+    return $this->call_method('links.post',
+        array('uid' => $uid,
+              'url' => $url,
+              'comment' => $comment));
+  }
+
   /**
    * Permissions API
    */
@@ -945,6 +1168,78 @@ function toggleDisplay(id, type) {
         array('permissions_apikey' => $permissions_apikey));
   }
 
+  /**
+   * Creates a note with the specified title and content.
+   *
+   * @param string $title   Title of the note.
+   * @param string $content Content of the note.
+   * @param int    $uid     (Optional) The user for whom you are creating a
+   *                        note; defaults to current session user
+   *
+   * @return int   The ID of the note that was just created.
+   */
+  public function &notes_create($title, $content, $uid = null) {
+    return $this->call_method('notes.create',
+        array('uid' => $uid,
+              'title' => $title,
+              'content' => $content));
+  }
+
+  /**
+   * Deletes the specified note.
+   *
+   * @param int $note_id  ID of the note you wish to delete
+   * @param int $uid      (Optional) Owner of the note you wish to delete;
+   *                      defaults to current session user
+   *
+   * @return bool
+   */
+  public function &notes_delete($note_id, $uid = null) {
+    return $this->call_method('notes.delete',
+        array('uid' => $uid,
+              'note_id' => $note_id));
+  }
+
+  /**
+   * Edits a note, replacing its title and contents with the title
+   * and contents specified.
+   *
+   * @param int    $note_id  ID of the note you wish to edit
+   * @param string $title    Replacement title for the note
+   * @param string $content  Replacement content for the note
+   * @param int    $uid      (Optional) Owner of the note you wish to edit;
+   *                         defaults to current session user
+   *
+   * @return bool
+   */
+  public function &notes_edit($note_id, $title, $content, $uid = null) {
+    return $this->call_method('notes.edit',
+        array('uid' => $uid,
+              'note_id' => $note_id,
+              'title' => $title,
+              'content' => $content));
+  }
+
+  /**
+   * Retrieves all notes by a user. If note_ids are specified,
+   * retrieves only those specific notes by that user.
+   *
+   * @param int    $uid      User whose notes you wish to retrieve
+   * @param array  $note_ids (Optional) List of specific note
+   *                         IDs by this user to retrieve
+   *
+   * @return array A list of all of the given user's notes, or an empty list
+   *               if the viewer lacks permissions or if there are no visible
+   *               notes.
+   */
+  public function &notes_get($uid, $note_ids = null) {
+
+    return $this->call_method('notes.get',
+        array('uid' => $uid,
+              'note_ids' => $note_ids));
+  }
+
+
   /**
    * Returns the outstanding notifications for the session user.
    *
@@ -954,13 +1249,15 @@ function toggleDisplay(id, type) {
    *               and an eid list of 'event_invites'
    */
   public function &notifications_get() {
-    return $this->call_method('facebook.notifications.get', array());
+    return $this->call_method('facebook.notifications.get');
   }
 
   /**
    * Sends a notification to the specified users.
    *
    * @return A comma separated list of successful recipients
+   * @error
+   *    API_EC_PARAM_USER_ID_LIST
    */
   public function &notifications_send($to_ids, $notification, $type) {
     return $this->call_method('facebook.notifications.send',
@@ -972,12 +1269,14 @@ function toggleDisplay(id, type) {
   /**
    * Sends an email to the specified user of the application.
    *
-   * @param array $recipients  id of the recipients
+   * @param array/string $recipients array of ids of the recipients (csv is deprecated)
    * @param string $subject    subject of the email
    * @param string $text       (plain text) body of the email
    * @param string $fbml       fbml markup for an html version of the email
    *
    * @return string  A comma separated list of successful recipients
+   * @error
+   *    API_EC_PARAM_USER_ID_LIST
    */
   public function &notifications_sendEmail($recipients,
                                            $subject,
@@ -993,9 +1292,9 @@ function toggleDisplay(id, type) {
   /**
    * Returns the requested info fields for the requested set of pages.
    *
-   * @param array  $page_ids  an array of page ids
-   * @param array  $fields    an array of strings describing the info fields
-   *                          desired
+   * @param array/string $page_ids  an array of page ids (csv is deprecated)
+   * @param array/string  $fields    an array of strings describing the
+   *                           info fields desired (csv is deprecated)
    * @param int    $uid       (Optional) limit results to pages of which this
    *                          user is a fan.
    * @param string type       limits results to a particular type of page.
@@ -1090,7 +1389,7 @@ function toggleDisplay(id, type) {
               'tag_text' => $tag_text,
               'x' => $x,
               'y' => $y,
-              'tags' => json_encode($tags),
+              'tags' => (is_array($tags)) ? json_encode($tags) : null,
               'owner_uid' => $this->get_uid($owner_uid)));
   }
 
@@ -1128,7 +1427,8 @@ function toggleDisplay(id, type) {
    * @param int $subj_id  (Optional) Filter by uid of user tagged in the photos.
    * @param int $aid      (Optional) Filter by an album, as returned by
    *                      photos_getAlbums.
-   * @param array $pids   (Optional) Restrict to a list of pids
+   * @param array/string $pids   (Optional) Restrict to an array of pids
+   *                             (csv is deprecated)
    *
    * Note that at least one of these parameters needs to be specified, or an
    * error is returned.
@@ -1143,9 +1443,10 @@ function toggleDisplay(id, type) {
   /**
    * Returns the albums created by the given user.
    *
-   * @param int $uid     (Optional) The uid of the user whose albums you want.
-   *                     A null will return the albums of the session user.
-   * @param array $aids  (Optional) A list of aids to restrict the query.
+   * @param int $uid      (Optional) The uid of the user whose albums you want.
+   *                       A null will return the albums of the session user.
+   * @param string $aids  (Optional) An array of aids to restrict
+   *                       the query. (csv is deprecated)
    *
    * Note that at least one of the (uid, aids) parameters must be specified.
    *
@@ -1171,17 +1472,67 @@ function toggleDisplay(id, type) {
       array('pids' => $pids));
   }
 
+  /**
+   * Uploads a photo.
+   *
+   * @param string $file     The location of the photo on the local filesystem.
+   * @param int $aid         (Optional) The album into which to upload the
+   *                         photo.
+   * @param string $caption  (Optional) A caption for the photo.
+   * @param int uid          (Optional) The user ID of the user whose photo you
+   *                         are uploading
+   *
+   * @return array  An array of user objects
+   */
+  public function photos_upload($file, $aid=null, $caption=null, $uid=null) {
+    return $this->call_upload_method('facebook.photos.upload',
+                                     array('aid' => $aid,
+                                           'caption' => $caption,
+                                           'uid' => $uid),
+                                     $file);
+  }
+
+
+  /**
+   * Uploads a video.
+   *
+   * @param  string $file        The location of the video on the local filesystem.
+   * @param  string $title       (Optional) A title for the video. Titles over 65 characters in length will be truncated.
+   * @param  string $description (Optional) A description for the video.
+   *
+   * @return array  An array with the video's ID, title, description, and a link to view it on Facebook.
+   */
+  public function video_upload($file, $title=null, $description=null) {
+    return $this->call_upload_method('facebook.video.upload',
+                                     array('title' => $title,
+                                           'description' => $description),
+                                     $file,
+                                     Facebook::get_facebook_url('api-video') . '/restserver.php');
+  }
+
+  /**
+   * Returns an array with the video limitations imposed on the current session's
+   * associated user. Maximum length is measured in seconds; maximum size is
+   * measured in bytes.
+   *
+   * @return array  Array with "length" and "size" keys
+   */
+  public function &video_getUploadLimits() {
+    return $this->call_method('facebook.video.getUploadLimits');
+  }
+
   /**
    * Returns the requested info fields for the requested set of users.
    *
-   * @param array $uids    An array of user ids
-   * @param array $fields  An array of info field names desired
+   * @param array/string $uids    An array of user ids (csv is deprecated)
+   * @param array/string $fields  An array of info field names desired (csv is deprecated)
    *
    * @return array  An array of user objects
    */
   public function &users_getInfo($uids, $fields) {
     return $this->call_method('facebook.users.getInfo',
-        array('uids' => $uids, 'fields' => $fields));
+                  array('uids' => $uids,
+                        'fields' => $fields));
   }
 
   /**
@@ -1194,14 +1545,15 @@ function toggleDisplay(id, type) {
    * users, use users.getInfo instead, so that proper privacy rules will be
    * applied.
    *
-   * @param array $uids    An array of user ids
-   * @param array $fields  An array of info field names desired
+   * @param array/string $uids    An array of user ids (csv is deprecated)
+   * @param array/string $fields  An array of info field names desired (csv is deprecated)
    *
    * @return array  An array of user objects
    */
   public function &users_getStandardInfo($uids, $fields) {
     return $this->call_method('facebook.users.getStandardInfo',
-        array('uids' => $uids, 'fields' => $fields));
+                              array('uids' => $uids,
+                                    'fields' => $fields));
   }
 
   /**
@@ -1210,7 +1562,7 @@ function toggleDisplay(id, type) {
    * @return integer  User id
    */
   public function &users_getLoggedInUser() {
-    return $this->call_method('facebook.users.getLoggedInUser', array());
+    return $this->call_method('facebook.users.getLoggedInUser');
   }
 
   /**
@@ -1238,6 +1590,17 @@ function toggleDisplay(id, type) {
     return $this->call_method('facebook.users.isAppUser', array('uid' => $uid));
   }
 
+  /**
+   * Returns whether or not the user corresponding to the current
+   * session object is verified by Facebook. See the documentation
+   * for Users.isVerified for details.
+   *
+   * @return boolean  true if the user is verified
+   */
+  public function &users_isVerified() {
+    return $this->call_method('facebook.users.isVerified');
+  }
+
   /**
    * Sets the users' current status message. Message does NOT contain the
    * word "is" , so make sure to include a verb.
@@ -1268,6 +1631,69 @@ function toggleDisplay(id, type) {
     return $this->call_method('facebook.users.setStatus', $args);
   }
 
+  /**
+   * Gets the stream on behalf of a user using a set of users. This
+   * call will return the latest $limit queries between $start_time
+   * and $end_time.
+   *
+   * @param int    $viewer_id  user making the call (def: session)
+   * @param array  $source_ids users/pages to look at (def: all connections)
+   * @param int    $start_time start time to look for stories (def: 1 day ago)
+   * @param int    $end_time   end time to look for stories (def: now)
+   * @param int    $limit      number of stories to attempt to fetch (def: 30)
+   * @param string $filter_key key returned by stream.getFilters to fetch
+   *
+   * @return array(
+   *           'posts'    => array of posts,
+   *           'profiles' => array of profile metadata of users/pages in posts
+   *           'albums'   => array of album metadata in posts
+   *         )
+   */
+  public function &stream_get($viewer_id = null,
+                              $source_ids = null,
+                              $start_time = 0,
+                              $end_time = 0,
+                              $limit = 30,
+                              $filter_key = '') {
+    $args = array(
+      'viewer_id'  => $viewer_id,
+      'source_ids' => $source_ids,
+      'start_time' => $start_time,
+      'end_time'   => $end_time,
+      'limit'      => $limit,
+      'filter_key' => $filter_key);
+    return $this->call_method('facebook.stream.get', $args);
+  }
+
+  /**
+   * Gets the filters (with relevant filter keys for stream.get) for a
+   * particular user. These filters are typical things like news feed,
+   * friend lists, networks. They can be used to filter the stream
+   * without complex queries to determine which ids belong in which groups.
+   *
+   * @param int $uid user to get filters for
+   *
+   * @return array of stream filter objects
+   */
+  public function &stream_getFilters($uid = null) {
+    $args = array('uid' => $uid);
+    return $this->call_method('facebook.stream.getFilters', $args);
+  }
+
+  /**
+   * Gets the full comments given a post_id from stream.get or the
+   * stream FQL table. Initially, only a set of preview comments are
+   * returned because some posts can have many comments.
+   *
+   * @param string $post_id id of the post to get comments for
+   *
+   * @return array of comment objects
+   */
+  public function &stream_getComments($post_id) {
+    $args = array('post_id' => $post_id);
+    return $this->call_method('facebook.stream.getComments', $args);
+  }
+
   /**
    * Sets the FBML for the profile of the user attached to this session.
    *
@@ -1690,7 +2116,7 @@ function toggleDisplay(id, type) {
    *    API_EC_DATA_UNKNOWN_ERROR
    */
   public function &data_getObjectTypes() {
-    return $this->call_method('facebook.data.getObjectTypes', array());
+    return $this->call_method('facebook.data.getObjectTypes');
   }
 
   /**
@@ -2315,12 +2741,14 @@ function toggleDisplay(id, type) {
    *
    * @param string $integration_point_name  Name of an integration point
    *                                        (see developer wiki for list).
+   * @param int    $uid                     Specific user to check the limit.
    *
    * @return int  Integration point allocation value
    */
-  public function &admin_getAllocation($integration_point_name) {
+  public function &admin_getAllocation($integration_point_name, $uid=null) {
     return $this->call_method('facebook.admin.getAllocation',
-        array('integration_point_name' => $integration_point_name));
+        array('integration_point_name' => $integration_point_name,
+              'uid' => $uid));
   }
 
   /**
@@ -2376,28 +2804,75 @@ function toggleDisplay(id, type) {
    */
   public function admin_getRestrictionInfo() {
     return json_decode(
-        $this->call_method('admin.getRestrictionInfo', array()),
+        $this->call_method('admin.getRestrictionInfo'),
         true);
   }
 
+
+  /**
+   * Bans a list of users from the app. Banned users can't
+   * access the app's canvas page and forums.
+   *
+   * @param array $uids an array of user ids
+   * @return bool true on success
+   */
+  public function admin_banUsers($uids) {
+    return $this->call_method(
+      'admin.banUsers', array('uids' => json_encode($uids)));
+  }
+
+  /**
+   * Unban users that have been previously banned with
+   * admin_banUsers().
+   *
+   * @param array $uids an array of user ids
+   * @return bool true on success
+   */
+  public function admin_unbanUsers($uids) {
+    return $this->call_method(
+      'admin.unbanUsers', array('uids' => json_encode($uids)));
+  }
+
+  /**
+   * Gets the list of users that have been banned from the application.
+   * $uids is an optional parameter that filters the result with the list
+   * of provided user ids. If $uids is provided,
+   * only banned user ids that are contained in $uids are returned.
+   *
+   * @param array $uids an array of user ids to filter by
+   * @return bool true on success
+   */
+
+  public function admin_getBannedUsers($uids = null) {
+    return $this->call_method(
+      'admin.getBannedUsers',
+      array('uids' => $uids ? json_encode($uids) : null));
+  }
+
   /* UTILITY FUNCTIONS */
 
   /**
-   * Calls the specified method with the specified parameters.
+   * Calls the specified normal POST method with the specified parameters.
    *
    * @param string $method  Name of the Facebook method to invoke
    * @param array $params   A map of param names => param values
    *
-   * @return mixed  Result of method call
+   * @return mixed  Result of method call; this returns a reference to support
+   *                'delayed returns' when in a batch context.
+   *     See: http://wiki.developers.facebook.com/index.php/Using_batching_API
    */
-  public function & call_method($method, $params) {
-    //Check if we are in batch mode
-    if($this->batch_queue === null) {
+  public function &call_method($method, $params = array()) {
+    if (!$this->pending_batch()) {
       if ($this->call_as_apikey) {
         $params['call_as_apikey'] = $this->call_as_apikey;
       }
-      $xml = $this->post_request($method, $params);
-      $result = $this->convert_xml_to_result($xml, $method, $params);
+      $data = $this->post_request($method, $params);
+      if (empty($params['format']) || strtolower($params['format']) != 'json') {
+        $result = $this->convert_xml_to_result($data, $method, $params);
+      }
+      else {
+        $result = json_decode($data, true);
+      }
 
       if (is_array($result) && isset($result['error_code'])) {
         throw new FacebookRestClientException($result['error_msg'],
@@ -2413,11 +2888,46 @@ function toggleDisplay(id, type) {
     return $result;
   }
 
-  private function convert_xml_to_result($xml, $method, $params) {
+  /**
+   * Calls the specified file-upload POST method with the specified parameters
+   *
+   * @param string $method Name of the Facebook method to invoke
+   * @param array  $params A map of param names => param values
+   * @param string $file   A path to the file to upload (required)
+   *
+   * @return array A dictionary representing the response.
+   */
+  public function call_upload_method($method, $params, $file, $server_addr = null) {
+    if (!$this->pending_batch()) {
+      if (!file_exists($file)) {
+        $code =
+          FacebookAPIErrorCodes::API_EC_PARAM;
+        $description = FacebookAPIErrorCodes::$api_error_descriptions[$code];
+        throw new FacebookRestClientException($description, $code);
+      }
+
+      $xml = $this->post_upload_request($method, $params, $file, $server_addr);
+      $result = $this->convert_xml_to_result($xml, $method, $params);
+
+      if (is_array($result) && isset($result['error_code'])) {
+        throw new FacebookRestClientException($result['error_msg'],
+                                              $result['error_code']);
+      }
+    }
+    else {
+      $code =
+        FacebookAPIErrorCodes::API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE;
+      $description = FacebookAPIErrorCodes::$api_error_descriptions[$code];
+      throw new FacebookRestClientException($description, $code);
+    }
+
+    return $result;
+  }
+
+  protected function convert_xml_to_result($xml, $method, $params) {
     $sxml = simplexml_load_string($xml);
     $result = self::convert_simplexml_to_array($sxml);
 
-
     if (!empty($GLOBALS['facebook_config']['debug'])) {
       // output the raw xml and its corresponding php object, for debugging:
       print '<div style="margin: 10px 30px; padding: 5px; border: 2px solid black; background: gray; color: white; font-size: 12px; font-weight: bold;">';
@@ -2436,7 +2946,25 @@ function toggleDisplay(id, type) {
     return $result;
   }
 
-  private function create_post_string($method, $params) {
+  private function finalize_params($method, &$params) {
+    $this->add_standard_params($method, $params);
+    // we need to do this before signing the params
+    $this->convert_array_values_to_json($params);
+    $params['sig'] = Facebook::generate_sig($params, $this->secret);
+  }
+
+  private function convert_array_values_to_json(&$params) {
+    foreach ($params as $key => &$val) {
+      if (is_array($val)) {
+        $val = json_encode($val);
+      }
+    }
+  }
+
+  private function add_standard_params($method, &$params) {
+    if ($this->call_as_apikey) {
+      $params['call_as_apikey'] = $this->call_as_apikey;
+    }
     $params['method'] = $method;
     $params['session_key'] = $this->session_key;
     $params['api_key'] = $this->api_key;
@@ -2448,50 +2976,118 @@ function toggleDisplay(id, type) {
     if (!isset($params['v'])) {
       $params['v'] = '1.0';
     }
+    if (isset($this->use_ssl_resources) &&
+        $this->use_ssl_resources) {
+      $params['return_ssl_resources'] = true;
+    }
+  }
+
+  private function create_post_string($method, $params) {
     $post_params = array();
     foreach ($params as $key => &$val) {
-      if (is_array($val)) $val = implode(',', $val);
       $post_params[] = $key.'='.urlencode($val);
     }
-    $secret = $this->secret;
-    $post_params[] = 'sig='.Facebook::generate_sig($params, $secret);
     return implode('&', $post_params);
   }
 
-  public function post_request($method, $params) {
+  private function run_multipart_http_transaction($method, $params, $file, $server_addr) {
 
-    $post_string = $this->create_post_string($method, $params);
+    // the format of this message is specified in RFC1867/RFC1341.
+    // we add twenty pseudo-random digits to the end of the boundary string.
+    $boundary = '--------------------------FbMuLtIpArT' .
+                sprintf("%010d", mt_rand()) .
+                sprintf("%010d", mt_rand());
+    $content_type = 'multipart/form-data; boundary=' . $boundary;
+    // within the message, we prepend two extra hyphens.
+    $delimiter = '--' . $boundary;
+    $close_delimiter = $delimiter . '--';
+    $content_lines = array();
+    foreach ($params as $key => &$val) {
+      $content_lines[] = $delimiter;
+      $content_lines[] = 'Content-Disposition: form-data; name="' . $key . '"';
+      $content_lines[] = '';
+      $content_lines[] = $val;
+    }
+    // now add the file data
+    $content_lines[] = $delimiter;
+    $content_lines[] =
+      'Content-Disposition: form-data; filename="' . $file . '"';
+    $content_lines[] = 'Content-Type: application/octet-stream';
+    $content_lines[] = '';
+    $content_lines[] = file_get_contents($file);
+    $content_lines[] = $close_delimiter;
+    $content_lines[] = '';
+    $content = implode("\r\n", $content_lines);
+    return $this->run_http_post_transaction($content_type, $content, $server_addr);
+  }
 
-    if (function_exists('curl_init')) {
-      // Use CURL if installed...
+  public function post_request($method, $params) {
+    $this->finalize_params($method, $params);
+    $post_string = $this->create_post_string($method, $params);
+    if ($this->use_curl_if_available && function_exists('curl_init')) {
       $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $this->server_addr);
       curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
+      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+      curl_setopt($ch, CURLOPT_TIMEOUT, 30);
       $result = curl_exec($ch);
       curl_close($ch);
     } else {
-      // Non-CURL based version...
       $content_type = 'application/x-www-form-urlencoded';
-      $user_agent = 'Facebook API PHP5 Client 1.1 (non-curl) '.phpversion();
-      $context =
-        array('http' =>
+      $content = $post_string;
+      $result = $this->run_http_post_transaction($content_type,
+                                                 $content,
+                                                 $this->server_addr);
+    }
+    return $result;
+  }
+
+  private function post_upload_request($method, $params, $file, $server_addr = null) {
+    $server_addr = $server_addr ? $server_addr : $this->server_addr;
+    $this->finalize_params($method, $params);
+    if ($this->use_curl_if_available && function_exists('curl_init')) {
+      // prepending '@' causes cURL to upload the file; the key is ignored.
+      $params['_file'] = '@' . $file;
+      $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
+      $ch = curl_init();
+      curl_setopt($ch, CURLOPT_URL, $server_addr);
+      // this has to come before the POSTFIELDS set!
+      curl_setopt($ch, CURLOPT_POST, 1 );
+      // passing an array gets curl to use the multipart/form-data content type
+      curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
+      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+      curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
+      $result = curl_exec($ch);
+      curl_close($ch);
+    } else {
+      $result = $this->run_multipart_http_transaction($method, $params, $file, $server_addr);
+    }
+    return $result;
+  }
+
+  private function run_http_post_transaction($content_type, $content, $server_addr) {
+
+    $user_agent = 'Facebook API PHP5 Client 1.1 (non-curl) ' . phpversion();
+    $content_length = strlen($content);
+    $context =
+      array('http' =>
               array('method' => 'POST',
-                    'header' => 'Content-type: '.$content_type."\r\n".
-                                'User-Agent: '.$user_agent."\r\n".
-                                'Content-length: ' . strlen($post_string),
-                    'content' => $post_string));
-      $contextid=stream_context_create($context);
-      $sock=fopen($this->server_addr, 'r', false, $contextid);
-      if ($sock) {
-        $result='';
-        while (!feof($sock))
-          $result.=fgets($sock, 4096);
-
-        fclose($sock);
+                    'user_agent' => $user_agent,
+                    'header' => 'Content-Type: ' . $content_type . "\r\n" .
+                                'Content-Length: ' . $content_length,
+                    'content' => $content));
+    $context_id = stream_context_create($context);
+    $sock = fopen($server_addr, 'r', false, $context_id);
+
+    $result = '';
+    if ($sock) {
+      while (!feof($sock)) {
+        $result .= fgets($sock, 4096);
       }
+      fclose($sock);
     }
     return $result;
   }
@@ -2541,6 +3137,14 @@ class FacebookAPIErrorCodes {
   const API_EC_METHOD = 3;
   const API_EC_TOO_MANY_CALLS = 4;
   const API_EC_BAD_IP = 5;
+  const API_EC_HOST_API = 6;
+  const API_EC_HOST_UP = 7;
+  const API_EC_SECURE = 8;
+  const API_EC_RATE = 9;
+  const API_EC_PERMISSION_DENIED = 10;
+  const API_EC_DEPRECATED = 11;
+  const API_EC_VERSION = 12;
+  const API_EC_INTERNAL_FQL_ERROR = 13;
 
   /*
    * PARAMETER ERRORS
@@ -2550,27 +3154,121 @@ class FacebookAPIErrorCodes {
   const API_EC_PARAM_SESSION_KEY = 102;
   const API_EC_PARAM_CALL_ID = 103;
   const API_EC_PARAM_SIGNATURE = 104;
+  const API_EC_PARAM_TOO_MANY = 105;
   const API_EC_PARAM_USER_ID = 110;
   const API_EC_PARAM_USER_FIELD = 111;
   const API_EC_PARAM_SOCIAL_FIELD = 112;
+  const API_EC_PARAM_EMAIL = 113;
+  const API_EC_PARAM_USER_ID_LIST = 114;
+  const API_EC_PARAM_FIELD_LIST = 115;
   const API_EC_PARAM_ALBUM_ID = 120;
+  const API_EC_PARAM_PHOTO_ID = 121;
+  const API_EC_PARAM_FEED_PRIORITY = 130;
+  const API_EC_PARAM_CATEGORY = 140;
+  const API_EC_PARAM_SUBCATEGORY = 141;
+  const API_EC_PARAM_TITLE = 142;
+  const API_EC_PARAM_DESCRIPTION = 143;
+  const API_EC_PARAM_BAD_JSON = 144;
   const API_EC_PARAM_BAD_EID = 150;
   const API_EC_PARAM_UNKNOWN_CITY = 151;
+  const API_EC_PARAM_BAD_PAGE_TYPE = 152;
 
   /*
    * USER PERMISSIONS ERRORS
    */
   const API_EC_PERMISSION = 200;
   const API_EC_PERMISSION_USER = 210;
+  const API_EC_PERMISSION_NO_DEVELOPERS = 211;
   const API_EC_PERMISSION_ALBUM = 220;
   const API_EC_PERMISSION_PHOTO = 221;
+  const API_EC_PERMISSION_MESSAGE = 230;
+  const API_EC_PERMISSION_OTHER_USER = 240;
+  const API_EC_PERMISSION_STATUS_UPDATE = 250;
+  const API_EC_PERMISSION_PHOTO_UPLOAD = 260;
+  const API_EC_PERMISSION_VIDEO_UPLOAD = 261;
+  const API_EC_PERMISSION_SMS = 270;
+  const API_EC_PERMISSION_CREATE_LISTING = 280;
+  const API_EC_PERMISSION_CREATE_NOTE = 281;
+  const API_EC_PERMISSION_SHARE_ITEM = 282;
   const API_EC_PERMISSION_EVENT = 290;
+  const API_EC_PERMISSION_LARGE_FBML_TEMPLATE = 291;
+  const API_EC_PERMISSION_LIVEMESSAGE = 292;
   const API_EC_PERMISSION_RSVP_EVENT = 299;
 
-  const FQL_EC_PARSER = 601;
+  /*
+   * DATA EDIT ERRORS
+   */
+  const API_EC_EDIT = 300;
+  const API_EC_EDIT_USER_DATA = 310;
+  const API_EC_EDIT_PHOTO = 320;
+  const API_EC_EDIT_ALBUM_SIZE = 321;
+  const API_EC_EDIT_PHOTO_TAG_SUBJECT = 322;
+  const API_EC_EDIT_PHOTO_TAG_PHOTO = 323;
+  const API_EC_EDIT_PHOTO_FILE = 324;
+  const API_EC_EDIT_PHOTO_PENDING_LIMIT = 325;
+  const API_EC_EDIT_PHOTO_TAG_LIMIT = 326;
+  const API_EC_EDIT_ALBUM_REORDER_PHOTO_NOT_IN_ALBUM = 327;
+  const API_EC_EDIT_ALBUM_REORDER_TOO_FEW_PHOTOS = 328;
+
+  const API_EC_MALFORMED_MARKUP = 329;
+  const API_EC_EDIT_MARKUP = 330;
+
+  const API_EC_EDIT_FEED_TOO_MANY_USER_CALLS = 340;
+  const API_EC_EDIT_FEED_TOO_MANY_USER_ACTION_CALLS = 341;
+  const API_EC_EDIT_FEED_TITLE_LINK = 342;
+  const API_EC_EDIT_FEED_TITLE_LENGTH = 343;
+  const API_EC_EDIT_FEED_TITLE_NAME = 344;
+  const API_EC_EDIT_FEED_TITLE_BLANK = 345;
+  const API_EC_EDIT_FEED_BODY_LENGTH = 346;
+  const API_EC_EDIT_FEED_PHOTO_SRC = 347;
+  const API_EC_EDIT_FEED_PHOTO_LINK = 348;
+
+  const API_EC_EDIT_VIDEO_SIZE = 350;
+  const API_EC_EDIT_VIDEO_INVALID_FILE = 351;
+  const API_EC_EDIT_VIDEO_INVALID_TYPE = 352;
+  const API_EC_EDIT_VIDEO_FILE = 353;
+
+  const API_EC_EDIT_FEED_TITLE_ARRAY = 360;
+  const API_EC_EDIT_FEED_TITLE_PARAMS = 361;
+  const API_EC_EDIT_FEED_BODY_ARRAY = 362;
+  const API_EC_EDIT_FEED_BODY_PARAMS = 363;
+  const API_EC_EDIT_FEED_PHOTO = 364;
+  const API_EC_EDIT_FEED_TEMPLATE = 365;
+  const API_EC_EDIT_FEED_TARGET = 366;
+  const API_EC_EDIT_FEED_MARKUP = 367;
+
+  /**
+   * SESSION ERRORS
+   */
+  const API_EC_SESSION_TIMED_OUT = 450;
+  const API_EC_SESSION_METHOD = 451;
+  const API_EC_SESSION_INVALID = 452;
+  const API_EC_SESSION_REQUIRED = 453;
+  const API_EC_SESSION_REQUIRED_FOR_SECRET = 454;
+  const API_EC_SESSION_CANNOT_USE_SESSION_SECRET = 455;
+
+
+  /**
+   * FQL ERRORS
+   */
+  const FQL_EC_UNKNOWN_ERROR = 600;
+  const FQL_EC_PARSER = 601; // backwards compatibility
+  const FQL_EC_PARSER_ERROR = 601;
   const FQL_EC_UNKNOWN_FIELD = 602;
   const FQL_EC_UNKNOWN_TABLE = 603;
-  const FQL_EC_NOT_INDEXABLE = 604;
+  const FQL_EC_NOT_INDEXABLE = 604; // backwards compatibility
+  const FQL_EC_NO_INDEX = 604;
+  const FQL_EC_UNKNOWN_FUNCTION = 605;
+  const FQL_EC_INVALID_PARAM = 606;
+  const FQL_EC_INVALID_FIELD = 607;
+  const FQL_EC_INVALID_SESSION = 608;
+  const FQL_EC_UNSUPPORTED_APP_TYPE = 609;
+  const FQL_EC_SESSION_SECRET_NOT_ALLOWED = 610;
+  const FQL_EC_DEPRECATED_TABLE = 611;
+  const FQL_EC_EXTENDED_PERMISSION = 612;
+  const FQL_EC_RATE_LIMIT_EXCEEDED = 613;
+
+  const API_EC_REF_SET_FAILED = 700;
 
   /**
    * DATA STORE API ERRORS
@@ -2581,52 +3279,122 @@ class FacebookAPIErrorCodes {
   const API_EC_DATA_OBJECT_NOT_FOUND = 803;
   const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804;
   const API_EC_DATA_DATABASE_ERROR = 805;
+  const API_EC_DATA_CREATE_TEMPLATE_ERROR = 806;
+  const API_EC_DATA_TEMPLATE_EXISTS_ERROR = 807;
+  const API_EC_DATA_TEMPLATE_HANDLE_TOO_LONG = 808;
+  const API_EC_DATA_TEMPLATE_HANDLE_ALREADY_IN_USE = 809;
+  const API_EC_DATA_TOO_MANY_TEMPLATE_BUNDLES = 810;
+  const API_EC_DATA_MALFORMED_ACTION_LINK = 811;
+  const API_EC_DATA_TEMPLATE_USES_RESERVED_TOKEN = 812;
 
   /*
-   * Batch ERROR
+   * APPLICATION INFO ERRORS
    */
-  const API_EC_BATCH_ALREADY_STARTED = 900;
-  const API_EC_BATCH_NOT_STARTED = 901;
-  const API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE = 902;
+  const API_EC_NO_SUCH_APP = 900;
 
+  /*
+   * BATCH ERRORS
+   */
+  const API_EC_BATCH_TOO_MANY_ITEMS = 950;
+  const API_EC_BATCH_ALREADY_STARTED = 951;
+  const API_EC_BATCH_NOT_STARTED = 952;
+  const API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE = 953;
+
+  /*
+   * EVENT API ERRORS
+   */
+  const API_EC_EVENT_INVALID_TIME = 1000;
+
+  /*
+   * INFO BOX ERRORS
+   */
+  const API_EC_INFO_NO_INFORMATION = 1050;
+  const API_EC_INFO_SET_FAILED = 1051;
+
+  /*
+   * LIVEMESSAGE API ERRORS
+   */
+  const API_EC_LIVEMESSAGE_SEND_FAILED = 1100;
+  const API_EC_LIVEMESSAGE_EVENT_NAME_TOO_LONG = 1101;
+  const API_EC_LIVEMESSAGE_MESSAGE_TOO_LONG = 1102;
+
+  /*
+   * CONNECT SESSION ERRORS
+   */
+  const API_EC_CONNECT_FEED_DISABLED = 1300;
+
+  /*
+   * Platform tag bundles errors
+   */
+  const API_EC_TAG_BUNDLE_QUOTA = 1400;
+
+  /*
+   * SHARE
+   */
+  const API_EC_SHARE_BAD_URL = 1500;
+
+  /*
+   * NOTES
+   */
+  const API_EC_NOTE_CANNOT_MODIFY = 1600;
+
+  /*
+   * COMMENTS
+   */
+  const API_EC_COMMENTS_UNKNOWN = 1700;
+  const API_EC_COMMENTS_POST_TOO_LONG = 1701;
+  const API_EC_COMMENTS_DB_DOWN = 1702;
+  const API_EC_COMMENTS_INVALID_XID = 1703;
+  const API_EC_COMMENTS_INVALID_UID = 1704;
+  const API_EC_COMMENTS_INVALID_POST = 1705;
+
+  /**
+   * This array is no longer maintained; to view the description of an error
+   * code, please look at the message element of the API response or visit
+   * the developer wiki at http://wiki.developers.facebook.com/.
+   */
   public static $api_error_descriptions = array(
-      API_EC_SUCCESS           => 'Success',
-      API_EC_UNKNOWN           => 'An unknown error occurred',
-      API_EC_SERVICE           => 'Service temporarily unavailable',
-      API_EC_METHOD            => 'Unknown method',
-      API_EC_TOO_MANY_CALLS    => 'Application request limit reached',
-      API_EC_BAD_IP            => 'Unauthorized source IP address',
-      API_EC_PARAM             => 'Invalid parameter',
-      API_EC_PARAM_API_KEY     => 'Invalid API key',
-      API_EC_PARAM_SESSION_KEY => 'Session key invalid or no longer valid',
-      API_EC_PARAM_CALL_ID     => 'Call_id must be greater than previous',
-      API_EC_PARAM_SIGNATURE   => 'Incorrect signature',
-      API_EC_PARAM_USER_ID     => 'Invalid user id',
-      API_EC_PARAM_USER_FIELD  => 'Invalid user info field',
-      API_EC_PARAM_SOCIAL_FIELD => 'Invalid user field',
-      API_EC_PARAM_ALBUM_ID    => 'Invalid album id',
-      API_EC_PARAM_BAD_EID     => 'Invalid eid',
-      API_EC_PARAM_UNKNOWN_CITY => 'Unknown city',
-      API_EC_PERMISSION        => 'Permissions error',
-      API_EC_PERMISSION_USER   => 'User not visible',
-      API_EC_PERMISSION_ALBUM  => 'Album not visible',
-      API_EC_PERMISSION_PHOTO  => 'Photo not visible',
-      API_EC_PERMISSION_EVENT  => 'Creating and modifying events required the extended permission create_event',
-      API_EC_PERMISSION_RSVP_EVENT => 'RSVPing to events required the extended permission rsvp_event',
-      FQL_EC_PARSER            => 'FQL: Parser Error',
-      FQL_EC_UNKNOWN_FIELD     => 'FQL: Unknown Field',
-      FQL_EC_UNKNOWN_TABLE     => 'FQL: Unknown Table',
-      FQL_EC_NOT_INDEXABLE     => 'FQL: Statement not indexable',
-      FQL_EC_UNKNOWN_FUNCTION  => 'FQL: Attempted to call unknown function',
-      FQL_EC_INVALID_PARAM     => 'FQL: Invalid parameter passed in',
-      API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error',
-      API_EC_DATA_INVALID_OPERATION => 'Invalid operation',
-      API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded',
-      API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
-      API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
-      API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
-      API_EC_BATCH_ALREADY_STARTED => 'begin_batch already called, please make sure to call end_batch first',
-      API_EC_BATCH_NOT_STARTED => 'end_batch called before start_batch',
-      API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE => 'This method is not allowed in batch mode',
+      self::API_EC_SUCCESS           => 'Success',
+      self::API_EC_UNKNOWN           => 'An unknown error occurred',
+      self::API_EC_SERVICE           => 'Service temporarily unavailable',
+      self::API_EC_METHOD            => 'Unknown method',
+      self::API_EC_TOO_MANY_CALLS    => 'Application request limit reached',
+      self::API_EC_BAD_IP            => 'Unauthorized source IP address',
+      self::API_EC_PARAM             => 'Invalid parameter',
+      self::API_EC_PARAM_API_KEY     => 'Invalid API key',
+      self::API_EC_PARAM_SESSION_KEY => 'Session key invalid or no longer valid',
+      self::API_EC_PARAM_CALL_ID     => 'Call_id must be greater than previous',
+      self::API_EC_PARAM_SIGNATURE   => 'Incorrect signature',
+      self::API_EC_PARAM_USER_ID     => 'Invalid user id',
+      self::API_EC_PARAM_USER_FIELD  => 'Invalid user info field',
+      self::API_EC_PARAM_SOCIAL_FIELD => 'Invalid user field',
+      self::API_EC_PARAM_USER_ID_LIST => 'Invalid user id list',
+      self::API_EC_PARAM_FIELD_LIST => 'Invalid field list',
+      self::API_EC_PARAM_ALBUM_ID    => 'Invalid album id',
+      self::API_EC_PARAM_BAD_EID     => 'Invalid eid',
+      self::API_EC_PARAM_UNKNOWN_CITY => 'Unknown city',
+      self::API_EC_PERMISSION        => 'Permissions error',
+      self::API_EC_PERMISSION_USER   => 'User not visible',
+      self::API_EC_PERMISSION_NO_DEVELOPERS  => 'Application has no developers',
+      self::API_EC_PERMISSION_ALBUM  => 'Album not visible',
+      self::API_EC_PERMISSION_PHOTO  => 'Photo not visible',
+      self::API_EC_PERMISSION_EVENT  => 'Creating and modifying events required the extended permission create_event',
+      self::API_EC_PERMISSION_RSVP_EVENT => 'RSVPing to events required the extended permission rsvp_event',
+      self::API_EC_EDIT_ALBUM_SIZE   => 'Album is full',
+      self::FQL_EC_PARSER            => 'FQL: Parser Error',
+      self::FQL_EC_UNKNOWN_FIELD     => 'FQL: Unknown Field',
+      self::FQL_EC_UNKNOWN_TABLE     => 'FQL: Unknown Table',
+      self::FQL_EC_NOT_INDEXABLE     => 'FQL: Statement not indexable',
+      self::FQL_EC_UNKNOWN_FUNCTION  => 'FQL: Attempted to call unknown function',
+      self::FQL_EC_INVALID_PARAM     => 'FQL: Invalid parameter passed in',
+      self::API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error',
+      self::API_EC_DATA_INVALID_OPERATION => 'Invalid operation',
+      self::API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded',
+      self::API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
+      self::API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
+      self::API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
+      self::API_EC_BATCH_ALREADY_STARTED => 'begin_batch already called, please make sure to call end_batch first',
+      self::API_EC_BATCH_NOT_STARTED => 'end_batch called before begin_batch',
+      self::API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE => 'This method is not allowed in batch mode'
   );
 }
index 0c69e226f759845d159d68f271c37f9c38c93b4a..4eff99dff5b67ec8607c8315816fce069f9a32ee 100644 (file)
--- a/index.php
+++ b/index.php
@@ -63,8 +63,14 @@ function handleError($error)
 
 function main()
 {
+    // quick check for fancy URL auto-detection support in installer.
+    if (isset($_SERVER['REDIRECT_URL']) && ((dirname($_SERVER['REQUEST_URI']) . '/check-fancy') === $_SERVER['REDIRECT_URL'])) {
+        die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs.");
+    }
     global $user, $action, $config;
 
+    Snapshot::check();
+    
     if (!_have_config()) {
         $msg = sprintf(_("No configuration file found. Try running ".
                          "the installation program first."));
index 87a99a650895b3774adc3b2e0c84cf401cb370fe..133f2b30f68843220461fb7fcefd52c01cf738f9 100644 (file)
@@ -35,15 +35,17 @@ function main()
 
 function checkPrereqs()
 {
+       $pass = true;
+       
     if (file_exists(INSTALLDIR.'/config.php')) {
          ?><p class="error">Config file &quot;config.php&quot; already exists.</p>
          <?php
-        return false;
+        $pass = false;
     }
 
     if (version_compare(PHP_VERSION, '5.0.0', '<')) {
             ?><p class="error">Require PHP version 5 or greater.</p><?php
-                   return false;
+                   $pass = false;
     }
 
     $reqs = array('gd', 'mysql', 'curl',
@@ -52,28 +54,26 @@ function checkPrereqs()
 
     foreach ($reqs as $req) {
         if (!checkExtension($req)) {
-            ?><p class="error">Cannot load required extension &quot;<?php echo $req; ?>&quot;.</p><?php
-                   return false;
+            ?><p class="error">Cannot load required extension: <code><?php echo $req; ?></code></p><?php
+                   $pass = false;
         }
     }
 
        if (!is_writable(INSTALLDIR)) {
-         ?><p class="error">Cannot write config file to &quot;<?php echo INSTALLDIR; ?>&quot;.</p>
-              <p>On your server, try this command:</p>
-              <blockquote>chmod a+w <?php echo INSTALLDIR; ?></blockquote>
+         ?><p class="error">Cannot write config file to: <code><?php echo INSTALLDIR; ?></code></p>
+              <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?></code>
          <?php
-            return false;
+            $pass = false;
        }
 
        if (!is_writable(INSTALLDIR.'/avatar/')) {
-         ?><p class="error">Cannot write avatar directory &quot;<?php echo INSTALLDIR; ?>/avatar/&quot;.</p>
-              <p>On your server, try this command:</p>
-              <blockquote>chmod a+w <?php echo INSTALLDIR; ?>/avatar/</blockquote>
+         ?><p class="error">Cannot write avatar directory: <code><?php echo INSTALLDIR; ?>/avatar/</code></p>
+              <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/avatar/</code></p>
          <?
-            return false;
+            $pass = false;
        }
 
-       return true;
+       return $pass;
 }
 
 function checkExtension($name)
@@ -88,96 +88,125 @@ function checkExtension($name)
 
 function showForm()
 {
-?>
-<p>Enter your database connection information below to initialize the database.</p>
-<form method='post' action='install.php'>
-       <fieldset>
-       <ul class='form_data'>
-       <li>
-       <label for='sitename'>Site name</label>
-       <input type='text' id='sitename' name='sitename' />
-       <p>The name of your site</p>
-       </li>
-       <li>
-       <li>
-       <label for='host'>Hostname</label>
-       <input type='text' id='host' name='host' />
-       <p>Database hostname</p>
-       </li>
-       <li>
-       <label for='host'>Database</label>
-       <input type='text' id='database' name='database' />
-       <p>Database name</p>
-       </li>
-       <li>
-       <label for='username'>Username</label>
-       <input type='text' id='username' name='username' />
-       <p>Database username</p>
-       </li>
-       <li>
-       <label for='password'>Password</label>
-       <input type='password' id='password' name='password' />
-       <p>Database password</p>
-       </li>
-       </ul>
-       <input type='submit' name='submit' value='Submit'>
-       </fieldset>
+    $config_path = htmlentities(trim(dirname($_SERVER['REQUEST_URI']), '/'));
+    echo<<<E_O_T
+        </ul>
+    </dd>
+</dl>
+<dl id="page_notice" class="system_notice">
+    <dt>Page notice</dt>
+    <dd>
+        <div class="instructions">
+            <p>Enter your database connection information below to initialize the database.</p>
+        </div>
+    </dd>
+</dl>
+<form method="post" action="install.php" class="form_settings" id="form_install">
+    <fieldset>
+        <legend>Connection settings</legend>
+        <ul class="form_data">
+            <li>
+                <label for="sitename">Site name</label>
+                <input type="text" id="sitename" name="sitename" />
+                <p class="form_guide">The name of your site</p>
+            </li>
+            <li>
+                <label for="fancy-enable">Fancy URLs</label>
+                <input type="radio" name="fancy" id="fancy-enable" value="enable" checked='checked' /> enable<br />
+                <input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
+                <p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
+            </li>
+            <li>
+                <label for="host">Site path</label>
+                <input type="text" id="path" name="path" value="$config_path" />
+                <p class="form_guide">Site path, following the "/" after the domain name in the URL. Empty is fine. Field should be filled automatically.</p>
+            </li>
+            <li>
+                <label for="host">Hostname</label>
+                <input type="text" id="host" name="host" />
+                <p class="form_guide">Database hostname</p>
+            </li>
+            <li>
+                <label for="host">Database</label>
+                <input type="text" id="database" name="database" />
+                <p class="form_guide">Database name</p>
+            </li>
+            <li>
+                <label for="username">Username</label>
+                <input type="text" id="username" name="username" />
+                <p class="form_guide">Database username</p>
+            </li>
+            <li>
+                <label for="password">Password</label>
+                <input type="password" id="password" name="password" />
+                <p class="form_guide">Database password</p>
+            </li>
+        </ul>
+        <input type="submit" name="submit" class="submit" value="Submit" />
+    </fieldset>
 </form>
-<?
+
+E_O_T;
 }
 
 function updateStatus($status, $error=false)
 {
 ?>
-       <li>
-<?
-    print $status;
-?>
-       </li>
-<?
+                <li <?php echo ($error) ? 'class="error"': ''; ?>><?print $status;?></li>
+
+<?php
 }
 
 function handlePost()
 {
 ?>
-       <ul>
-<?
-    $host = $_POST['host'];
+
+<?php
+    $host     = $_POST['host'];
     $database = $_POST['database'];
     $username = $_POST['username'];
     $password = $_POST['password'];
     $sitename = $_POST['sitename'];
-
+    $path     = $_POST['path'];
+    $fancy    = !empty($_POST['fancy']);
+?>
+    <dl class="system_notice">
+        <dt>Page notice</dt>
+        <dd>
+            <ul>
+<?php
+       $fail = false;
+       
     if (empty($host)) {
         updateStatus("No hostname specified.", true);
-        showForm();
-        return;
+               $fail = true;
     }
 
     if (empty($database)) {
         updateStatus("No database specified.", true);
-        showForm();
-        return;
+               $fail = true;
     }
 
     if (empty($username)) {
         updateStatus("No username specified.", true);
-        showForm();
-        return;
+               $fail = true;
     }
 
     if (empty($password)) {
         updateStatus("No password specified.", true);
-        showForm();
-        return;
+               $fail = true;
     }
 
     if (empty($sitename)) {
         updateStatus("No sitename specified.", true);
-        showForm();
-        return;
+               $fail = true;
     }
 
+       if($fail){
+               showForm();
+           return;
+       }
+
     updateStatus("Starting installation...");
     updateStatus("Checking database...");
     $conn = mysql_connect($host, $username, $password);
@@ -214,24 +243,30 @@ function handlePost()
     }
     updateStatus("Writing config file...");
     $sqlUrl = "mysqli://$username:$password@$host/$database";
-    $res = writeConf($sitename, $sqlUrl);
+    $res = writeConf($sitename, $sqlUrl, $fancy, $path);
     if (!$res) {
         updateStatus("Can't write config file.", true);
         showForm();
         return;
     }
     updateStatus("Done!");
+    if ($path) $path .= '/';
+    updateStatus("You can visit your <a href='/$path'>new Laconica site</a>.");
 ?>
-       </ul>
-<?
+
+<?php
 }
 
-function writeConf($sitename, $sqlUrl)
+function writeConf($sitename, $sqlUrl, $fancy, $path)
 {
     $res = file_put_contents(INSTALLDIR.'/config.php',
                              "<?php\n".
+                             "if (!defined('LACONICA')) { exit(1); }\n\n".
                              "\$config['site']['name'] = \"$sitename\";\n\n".
-                             "\$config['db']['database'] = \"$sqlUrl\";\n\n");
+                             ($fancy ? "\$config['site']['fancy'] = true;\n\n":'').
+                             "\$config['site']['path'] = \"$path\";\n\n".
+                             "\$config['db']['database'] = \"$sqlUrl\";\n\n".
+                             "?>");
     return $res;
 }
 
@@ -253,21 +288,37 @@ function runDbScript($filename, $conn)
 }
 
 ?>
-<html>
-<head>
-       <title>Install Laconica</title>
-       <link rel="stylesheet" type="text/css" href="theme/base/css/display.css?version=0.7.1" media="screen, projection, tv"/>
-       <link rel="stylesheet" type="text/css" href="theme/base/css/modal.css?version=0.7.1" media="screen, projection, tv"/>
-       <link rel="stylesheet" type="text/css" href="theme/default/css/display.css?version=0.7.1" media="screen, projection, tv"/>
-</head>
-<body>
-       <div id="wrap">
-       <div id="core">
-       <div id="content">
-       <h1>Install Laconica</h1>
+<?php echo"<?"; ?> xml version="1.0" encoding="UTF-8" <?php echo "?>"; ?>
+<!DOCTYPE html
+PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
+    <head>
+        <title>Install Laconica</title>
+       <link rel="shortcut icon" href="favicon.ico"/>
+        <link rel="stylesheet" type="text/css" href="theme/default/css/display.css?version=0.8" media="screen, projection, tv"/>
+        <!--[if IE]><link rel="stylesheet" type="text/css" href="theme/base/css/ie.css?version=0.8" /><![endif]-->
+        <!--[if lte IE 6]><link rel="stylesheet" type="text/css" theme/base/css/ie6.css?version=0.8" /><![endif]-->
+        <!--[if IE]><link rel="stylesheet" type="text/css" href="theme/default/css/ie.css?version=0.8" /><![endif]-->
+        <script src="js/jquery.min.js"></script>
+        <script src="js/install.js"></script>
+    </head>
+    <body id="install">
+        <div id="wrap">
+            <div id="header">
+                <address id="site_contact" class="vcard">
+                    <a class="url home bookmark" href=".">
+                        <img class="logo photo" src="theme/default/logo.png" alt="Laconica"/>
+                        <span class="fn org">Laconica</span>
+                    </a>
+                </address>
+            </div>
+            <div id="core">
+                <div id="content">
+                    <h1>Install Laconica</h1>
 <?php main(); ?>
-       </div>
-       </div>
-       </div>
-</body>
+                </div>
+            </div>
+        </div>
+    </body>
 </html>
diff --git a/js/farbtastic/LICENSE.txt b/js/farbtastic/LICENSE.txt
new file mode 100644 (file)
index 0000000..5a3cc20
--- /dev/null
@@ -0,0 +1,341 @@
+
+        GNU GENERAL PUBLIC LICENSE
+           Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+          Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+        GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+          NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+         END OF TERMS AND CONDITIONS
+
+      How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program 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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/js/farbtastic/farbtastic.go.js b/js/farbtastic/farbtastic.go.js
new file mode 100644 (file)
index 0000000..0149eca
--- /dev/null
@@ -0,0 +1,85 @@
+/** Init for Farbtastic library and page setup
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+$(document).ready(function() {
+    function UpdateColors(S) {
+        C = $(S).val();
+        switch (parseInt(S.id.slice(-1))) {
+            case 0: default:
+                $('body').css({'background-color':C});
+                break;
+            case 1:
+                $('#content').css({'background-color':C});
+                break;
+            case 2:
+                $('#aside_primary').css({'background-color':C});
+                break;
+            case 3:
+                $('body').css({'color':C});
+                break;
+            case 4:
+                $('a').css({'color':C});
+                break;
+        }
+    }
+
+    function UpdateFarbtastic(e) {
+        f.linked = e;
+        f.setColor(e.value);
+    }
+
+    function UpdateSwatch(e) {
+        $(e).css({"background-color": e.value,
+                  "color": f.hsl[2] > 0.5 ? "#000": "#fff"});
+    }
+
+    function SynchColors(e) {
+        var S = f.linked;
+        var C = f.color;
+
+        if (S && S.value && S.value != C) {
+            S.value = C;
+            UpdateSwatch(S);
+            UpdateColors(S);
+        }
+    }
+
+    function Init() {
+        $('#settings_design_color').append('<div id="color-picker"></div>');
+        $('#color-picker').hide();
+
+        f = $.farbtastic('#color-picker', SynchColors);
+        swatches = $('#settings_design_color .swatch');
+
+        swatches
+            .each(SynchColors)
+            .blur(function() {
+                $(this).val($(this).val().toUpperCase());
+             })
+            .focus(function() {
+                $('#color-picker').show();
+                UpdateFarbtastic(this);
+            })
+            .change(function() {
+                UpdateFarbtastic(this);
+                UpdateSwatch(this);
+                UpdateColors(this);
+            }).change();
+    }
+
+    var f, swatches;
+    Init();
+    $('#form_settings_design').bind('reset', function(){
+        setTimeout(function(){
+            swatches.each(function(){UpdateColors(this);});
+            $('#color-picker').remove();
+            swatches.unbind();
+            Init();
+        },10);
+    });
+});
diff --git a/js/farbtastic/farbtastic.js b/js/farbtastic/farbtastic.js
new file mode 100644 (file)
index 0000000..24a3778
--- /dev/null
@@ -0,0 +1,329 @@
+// $Id: farbtastic.js,v 1.2 2007/01/08 22:53:01 unconed Exp $
+// Farbtastic 1.2
+
+jQuery.fn.farbtastic = function (callback) {
+  $.farbtastic(this, callback);
+  return this;
+};
+
+jQuery.farbtastic = function (container, callback) {
+  var container = $(container).get(0);
+  return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
+}
+
+jQuery._farbtastic = function (container, callback) {
+  // Store farbtastic object
+  var fb = this;
+
+  // Insert markup
+  $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
+  var e = $('.farbtastic', container);
+  fb.wheel = $('.wheel', container).get(0);
+  // Dimensions
+  fb.radius = 84;
+  fb.square = 100;
+  fb.width = 194;
+
+  // Fix background PNGs in IE6
+  if (navigator.appVersion.match(/MSIE [0-6]\./)) {
+    $('*', e).each(function () {
+      if (this.currentStyle.backgroundImage != 'none') {
+        var image = this.currentStyle.backgroundImage;
+        image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
+        $(this).css({
+          'backgroundImage': 'none',
+          'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
+        });
+      }
+    });
+  }
+
+  /**
+   * Link to the given element(s) or callback.
+   */
+  fb.linkTo = function (callback) {
+    // Unbind previous nodes
+    if (typeof fb.callback == 'object') {
+      $(fb.callback).unbind('keyup', fb.updateValue);
+    }
+
+    // Reset color
+    fb.color = null;
+
+    // Bind callback or elements
+    if (typeof callback == 'function') {
+      fb.callback = callback;
+    }
+    else if (typeof callback == 'object' || typeof callback == 'string') {
+      fb.callback = $(callback);
+      fb.callback.bind('keyup', fb.updateValue);
+      if (fb.callback.get(0).value) {
+        fb.setColor(fb.callback.get(0).value);
+      }
+    }
+    return this;
+  }
+  fb.updateValue = function (event) {
+    if (this.value && this.value != fb.color) {
+      fb.setColor(this.value);
+    }
+  }
+
+  /**
+   * Change color with HTML syntax #123456
+   */
+  fb.setColor = function (color) {
+    var unpack = fb.unpack(color);
+    if (fb.color != color && unpack) {
+      fb.color = color;
+      fb.rgb = unpack;
+      fb.hsl = fb.RGBToHSL(fb.rgb);
+      fb.updateDisplay();
+    }
+    return this;
+  }
+
+  /**
+   * Change color with HSL triplet [0..1, 0..1, 0..1]
+   */
+  fb.setHSL = function (hsl) {
+    fb.hsl = hsl;
+    fb.rgb = fb.HSLToRGB(hsl);
+    fb.color = fb.pack(fb.rgb);
+    fb.updateDisplay();
+    return this;
+  }
+
+  /////////////////////////////////////////////////////
+
+  /**
+   * Retrieve the coordinates of the given event relative to the center
+   * of the widget.
+   */
+  fb.widgetCoords = function (event) {
+    var x, y;
+    var el = event.target || event.srcElement;
+    var reference = fb.wheel;
+
+    if (typeof event.offsetX != 'undefined') {
+      // Use offset coordinates and find common offsetParent
+      var pos = { x: event.offsetX, y: event.offsetY };
+
+      // Send the coordinates upwards through the offsetParent chain.
+      var e = el;
+      while (e) {
+        e.mouseX = pos.x;
+        e.mouseY = pos.y;
+        pos.x += e.offsetLeft;
+        pos.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Look for the coordinates starting from the wheel widget.
+      var e = reference;
+      var offset = { x: 0, y: 0 }
+      while (e) {
+        if (typeof e.mouseX != 'undefined') {
+          x = e.mouseX - offset.x;
+          y = e.mouseY - offset.y;
+          break;
+        }
+        offset.x += e.offsetLeft;
+        offset.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Reset stored coordinates
+      e = el;
+      while (e) {
+        e.mouseX = undefined;
+        e.mouseY = undefined;
+        e = e.offsetParent;
+      }
+    }
+    else {
+      // Use absolute coordinates
+      var pos = fb.absolutePosition(reference);
+      x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x;
+      y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y;
+    }
+    // Subtract distance to middle
+    return { x: x - fb.width / 2, y: y - fb.width / 2 };
+  }
+
+  /**
+   * Mousedown handler
+   */
+  fb.mousedown = function (event) {
+    // Capture mouse
+    if (!document.dragging) {
+      $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
+      document.dragging = true;
+    }
+
+    // Check which area is being dragged
+    var pos = fb.widgetCoords(event);
+    fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
+
+    // Process
+    fb.mousemove(event);
+    return false;
+  }
+
+  /**
+   * Mousemove handler
+   */
+  fb.mousemove = function (event) {
+    // Get coordinates relative to color picker center
+    var pos = fb.widgetCoords(event);
+
+    // Set new HSL parameters
+    if (fb.circleDrag) {
+      var hue = Math.atan2(pos.x, -pos.y) / 6.28;
+      if (hue < 0) hue += 1;
+      fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
+    }
+    else {
+      var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
+      var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
+      fb.setHSL([fb.hsl[0], sat, lum]);
+    }
+    return false;
+  }
+
+  /**
+   * Mouseup handler
+   */
+  fb.mouseup = function () {
+    // Uncapture mouse
+    $(document).unbind('mousemove', fb.mousemove);
+    $(document).unbind('mouseup', fb.mouseup);
+    document.dragging = false;
+  }
+
+  /**
+   * Update the markers and styles
+   */
+  fb.updateDisplay = function () {
+    // Markers
+    var angle = fb.hsl[0] * 6.28;
+    $('.h-marker', e).css({
+      left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
+      top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
+    });
+
+    $('.sl-marker', e).css({
+      left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
+      top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
+    });
+
+    // Saturation/Luminance gradient
+    $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
+
+    // Linked elements or callback
+    if (typeof fb.callback == 'object') {
+      // Set background/foreground color
+      $(fb.callback).css({
+        backgroundColor: fb.color,
+        color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
+      });
+
+      // Change linked value
+      $(fb.callback).each(function() {
+        if (this.value && this.value != fb.color) {
+          this.value = fb.color;
+        }
+      });
+    }
+    else if (typeof fb.callback == 'function') {
+      fb.callback.call(fb, fb.color);
+    }
+  }
+
+  /**
+   * Get absolute position of element
+   */
+  fb.absolutePosition = function (el) {
+    var r = { x: el.offsetLeft, y: el.offsetTop };
+    // Resolve relative to offsetParent
+    if (el.offsetParent) {
+      var tmp = fb.absolutePosition(el.offsetParent);
+      r.x += tmp.x;
+      r.y += tmp.y;
+    }
+    return r;
+  };
+
+  /* Various color utility functions */
+  fb.pack = function (rgb) {
+    var r = Math.round(rgb[0] * 255);
+    var g = Math.round(rgb[1] * 255);
+    var b = Math.round(rgb[2] * 255);
+    return '#' + (r < 16 ? '0' : '') + r.toString(16) +
+           (g < 16 ? '0' : '') + g.toString(16) +
+           (b < 16 ? '0' : '') + b.toString(16);
+  }
+
+  fb.unpack = function (color) {
+    if (color.length == 7) {
+      return [parseInt('0x' + color.substring(1, 3)) / 255,
+        parseInt('0x' + color.substring(3, 5)) / 255,
+        parseInt('0x' + color.substring(5, 7)) / 255];
+    }
+    else if (color.length == 4) {
+      return [parseInt('0x' + color.substring(1, 2)) / 15,
+        parseInt('0x' + color.substring(2, 3)) / 15,
+        parseInt('0x' + color.substring(3, 4)) / 15];
+    }
+  }
+
+  fb.HSLToRGB = function (hsl) {
+    var m1, m2, r, g, b;
+    var h = hsl[0], s = hsl[1], l = hsl[2];
+    m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
+    m1 = l * 2 - m2;
+    return [this.hueToRGB(m1, m2, h+0.33333),
+        this.hueToRGB(m1, m2, h),
+        this.hueToRGB(m1, m2, h-0.33333)];
+  }
+
+  fb.hueToRGB = function (m1, m2, h) {
+    h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
+    if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
+    if (h * 2 < 1) return m2;
+    if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
+    return m1;
+  }
+
+  fb.RGBToHSL = function (rgb) {
+    var min, max, delta, h, s, l;
+    var r = rgb[0], g = rgb[1], b = rgb[2];
+    min = Math.min(r, Math.min(g, b));
+    max = Math.max(r, Math.max(g, b));
+    delta = max - min;
+    l = (min + max) / 2;
+    s = 0;
+    if (l > 0 && l < 1) {
+      s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
+    }
+    h = 0;
+    if (delta > 0) {
+      if (max == r && max != g) h += (g - b) / delta;
+      if (max == g && max != b) h += (2 + (b - r) / delta);
+      if (max == b && max != r) h += (4 + (r - g) / delta);
+      h /= 6;
+    }
+    return [h, s, l];
+  }
+
+  // Install mousedown handler (the others are set on the document on-demand)
+  $('*', e).mousedown(fb.mousedown);
+
+    // Init color
+  fb.setColor('#000000');
+
+  // Set linked elements/callback
+  if (callback) {
+    fb.linkTo(callback);
+  }
+}
\ No newline at end of file
diff --git a/js/farbtastic/marker.png b/js/farbtastic/marker.png
new file mode 100755 (executable)
index 0000000..3929bbb
Binary files /dev/null and b/js/farbtastic/marker.png differ
diff --git a/js/farbtastic/mask.png b/js/farbtastic/mask.png
new file mode 100644 (file)
index 0000000..b0a4d40
Binary files /dev/null and b/js/farbtastic/mask.png differ
diff --git a/js/farbtastic/wheel.png b/js/farbtastic/wheel.png
new file mode 100644 (file)
index 0000000..97b343d
Binary files /dev/null and b/js/farbtastic/wheel.png differ
diff --git a/js/install.js b/js/install.js
new file mode 100644 (file)
index 0000000..32a5411
--- /dev/null
@@ -0,0 +1,18 @@
+$(document).ready(function(){
+    $.ajax({url:'check-fancy',
+        type:'GET',
+        success:function(data, textStatus) {
+            $('#fancy-enable').attr('checked', true);
+            $('#fancy-disable').attr('checked', false);
+            $('#fancy-form_guide').text(data);
+        },
+        error:function(XMLHttpRequest, textStatus, errorThrown) {
+            $('#fancy-enable').attr('checked', false);
+            $('#fancy-disable').attr('checked', true);
+            $('#fancy-enable').attr('disabled', true);
+            $('#fancy-disable').attr('disabled', true);
+            $('#fancy-form_guide').text("Fancy URL support detection failed, disabling this option. Make sure you renamed htaccess.sample to .htaccess.");
+        }
+    });
+});
+
index a0399d540510db1638a9f233dbeb5ef18bcc6bc1..4e1cbfd1e705810938e2a5ee07a9cf304d80c688 100644 (file)
@@ -1,39 +1,48 @@
-               $(function(){
-                       var x = ($('#avatar_crop_x').val()) ? $('#avatar_crop_x').val() : 0;
-                       var y = ($('#avatar_crop_y').val()) ? $('#avatar_crop_y').val() : 0;
-                       var w = ($('#avatar_crop_w').val()) ? $('#avatar_crop_w').val() : $("#avatar_original img").attr("width");
-                       var h = ($('#avatar_crop_h').val()) ? $('#avatar_crop_h').val() : $("#avatar_original img").attr("height");
+/** Init for Jcrop library and page setup
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
 
-                       jQuery("#avatar_original img").Jcrop({
-                               onChange: showPreview,
-                       setSelect: [ x, y, w, h ],
-                               onSelect: updateCoords,
-                               aspectRatio: 1,
-                               boxWidth: 480,
-                               boxHeight: 480,
-                               bgColor: '#000',
-                               bgOpacity: .4
-                       });
-               });
+$(function(){
+    var x = ($('#avatar_crop_x').val()) ? $('#avatar_crop_x').val() : 0;
+    var y = ($('#avatar_crop_y').val()) ? $('#avatar_crop_y').val() : 0;
+    var w = ($('#avatar_crop_w').val()) ? $('#avatar_crop_w').val() : $("#avatar_original img").attr("width");
+    var h = ($('#avatar_crop_h').val()) ? $('#avatar_crop_h').val() : $("#avatar_original img").attr("height");
 
-               function showPreview(coords) {
-                       var rx = 96 / coords.w;
-                       var ry = 96 / coords.h;
+    jQuery("#avatar_original img").Jcrop({
+        onChange: showPreview,
+        setSelect: [ x, y, w, h ],
+        onSelect: updateCoords,
+        aspectRatio: 1,
+        boxWidth: 480,
+        boxHeight: 480,
+        bgColor: '#000',
+        bgOpacity: .4
+    });
+});
 
-                       var img_width = $("#avatar_original img").attr("width");
-                       var img_height = $("#avatar_original img").attr("height");
+function showPreview(coords) {
+    var rx = 96 / coords.w;
+    var ry = 96 / coords.h;
 
-                       $('#avatar_preview img').css({
-                               width: Math.round(rx *img_width) + 'px',
-                               height: Math.round(ry * img_height) + 'px',
-                               marginLeft: '-' + Math.round(rx * coords.x) + 'px',
-                               marginTop: '-' + Math.round(ry * coords.y) + 'px'
-                       });
-               };
+    var img_width = $("#avatar_original img").attr("width");
+    var img_height = $("#avatar_original img").attr("height");
 
-               function updateCoords(c) {
-                       $('#avatar_crop_x').val(c.x);
-                       $('#avatar_crop_y').val(c.y);
-                       $('#avatar_crop_w').val(c.w);
-                       $('#avatar_crop_h').val(c.h);
-               };
+    $('#avatar_preview img').css({
+        width: Math.round(rx *img_width) + 'px',
+        height: Math.round(ry * img_height) + 'px',
+        marginLeft: '-' + Math.round(rx * coords.x) + 'px',
+        marginTop: '-' + Math.round(ry * coords.y) + 'px'
+    });
+};
+
+function updateCoords(c) {
+    $('#avatar_crop_x').val(c.x);
+    $('#avatar_crop_y').val(c.y);
+    $('#avatar_crop_w').val(c.w);
+    $('#avatar_crop_h').val(c.h);
+};
diff --git a/js/jquery.joverlay.min.js b/js/jquery.joverlay.min.js
new file mode 100644 (file)
index 0000000..c916850
--- /dev/null
@@ -0,0 +1,6 @@
+/* Copyright (c) 2009 Alvaro A. Lima Jr http://alvarojunior.com/jquery/joverlay.html
+ * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * Version: 0.6 (Abr 23, 2009)
+ * Requires: jQuery 1.3+
+ */
+(function($){var f=$.browser.msie&&$.browser.version==6.0;var g=null;$.fn.jOverlay=function(b){var b=$.extend({},$.fn.jOverlay.options,b);if(g!=null){clearTimeout(g)}var c=this.is('*')?this:'#jOverlayContent';var d=f?'absolute':'fixed';var e=b.imgLoading?"<img id='jOverlayLoading' src='"+b.imgLoading+"' style='position:"+d+"; z-index:"+(b.zIndex+9)+";'/>":'';$('body').prepend(e+"<div id='jOverlay' />"+"<div id='jOverlayContent' style='position:"+d+"; z-index:"+(b.zIndex+5)+"; display:none;'/>");$('#jOverlayLoading').load(function(){if(b.center){$.center(this)}});if(f){$("select").hide();$("#jOverlayContent select").show()}$('#jOverlay').css({backgroundColor:b.color,position:d,top:'0px',left:'0px',filter:'alpha(opacity='+(b.opacity*100)+')',opacity:b.opacity,zIndex:b.zIndex,width:!f?'100%':$(window).width()+'px',height:!f?'100%':$(document).height()+'px'}).show();if(this.is('*')){$('#jOverlayContent').html(this.addClass('jOverlayChildren').show()).show();if(b.center){$.center('#jOverlayContent')}if(!b.url&&$.isFunction(b.success)){b.success(this.html())}}if(b.url){$.ajax({type:b.method,data:b.data,url:b.url,success:function(a){$('#jOverlayLoading').fadeOut(600);$(c).html(a).show();if(b.center){$.center('#jOverlayContent')}if($.isFunction(b.success)){b.success(a)}}})}if(f){$(window).scroll(function(){if(b.center){$.center('#jOverlayContent')}});$(window).resize(function(){$('#jOverlay').css({width:$(window).width()+'px',height:$(document).height()+'px'});if(b.center){$.center('#jOverlayContent')}})}$(document).keydown(function(a){if(a.keyCode==27){$.closeOverlay()}});if(b.bgClickToClose){$('#jOverlay').click($.closeOverlay)}if(Number(b.timeout)>0){g=setTimeout($.closeOverlay,Number(b.timeout))}};$.center=function(a){var a=$(a);var b=a.height();var c=a.width();a.css({width:c+'px',marginLeft:'-'+(c/2)+'px',marginTop:'-'+b/2+'px',height:'auto',top:!f?'50%':$(window).scrollTop()+($(window).height()/2)+"px",left:'50%'})};$.fn.jOverlay.options={method:'GET',data:'',url:'',color:'#000',opacity:'0.6',zIndex:9999,center:true,imgLoading:'',bgClickToClose:true,success:null,timeout:0};$.closeOverlay=function(){if(f){$("select").show()}$('#jOverlayContent .jOverlayChildren').hide().prependTo($('body'));$('#jOverlayLoading, #jOverlayContent, #jOverlay').remove()}})(jQuery);
\ No newline at end of file
index 3f14bc61c6d831d35a822c704a637f702b4beda9..d5697e880da3b4ff768cccf342e6b85a3c1bad64 100644 (file)
@@ -199,7 +199,6 @@ $(document).ready(function(){
                                                               $("#notices_primary .notices").prepend(document._importNode(li, true));
                                                               $("#notices_primary .notice:first").css({display:"none"});
                                                               $("#notices_primary .notice:first").fadeIn(2500);
-                                                              NoticeHover();
                                                               NoticeReply();
                                                          }
                                                                                                        }
@@ -215,26 +214,26 @@ $(document).ready(function(){
        $("#form_notice").each(addAjaxHidden);
     NoticeHover();
     NoticeReply();
+    NoticeAttachments();
 });
 
+
 function NoticeHover() {
-    $("#content .notice").hover(
-        function () {
-            $(this).addClass('hover');
-        },
-        function () {
-            $(this).removeClass('hover');
-        }
-    );
+    function mouseHandler(e) {
+        $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover');
+    };
+    $('#content .notices').mouseover(mouseHandler);
+    $('#content .notices').mouseout(mouseHandler);
 }
 
+
 function NoticeReply() {
     if ($('#notice_data-text').length > 0) {
         $('#content .notice').each(function() {
-            var notice = $(this);
-            $('.notice_reply', $(this)).click(function() {
-                var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname');
-                NoticeReplySet(nickname.text(), $('.notice_id', notice).text());
+            var notice = $(this)[0];
+            $($('.notice_reply', notice)[0]).click(function() {
+                var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname');
+                NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
                 return false;
             });
         });
@@ -254,3 +253,53 @@ function NoticeReplySet(nick,id) {
        }
        return true;
 }
+
+function NoticeAttachments() {
+    $.fn.jOverlay.options = {
+        method : 'GET',
+        data : '',
+        url : '',
+        color : '#000',
+        opacity : '0.6',
+        zIndex : '9999',
+        center : true,
+        imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
+        bgClickToClose : true,
+        success : function() {
+            $('#jOverlayContent').append('<button>&#215;</button>');
+            $('#jOverlayContent button').click($.closeOverlay);
+        },
+        timeout : 0
+    };
+
+    $('a.attachment').click(function() {
+        $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'});
+        return false;
+    });
+    
+    var t;
+    $("body:not(#shownotice) a.thumbnail").hover(
+        function() {
+            var anchor = $(this);
+            $("a.thumbnail").children('img').hide();
+            anchor.closest(".entry-title").addClass('ov');
+
+            if (anchor.children('img').length == 0) {
+                t = setTimeout(function() {
+                    $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
+                        anchor.append(data);
+                    });
+                }, 500);
+            }
+            else {
+                anchor.children('img').show();
+            }
+        },
+        function() {
+            clearTimeout(t);
+            $("a.thumbnail").children('img').hide();
+            $(this).closest(".entry-title").removeClass('ov');
+        }
+    );
+}
+
index fe106cb8376a06b69ac5ba142329917b808a4427..924aa93a8953ab7b0239660989cc1db849d43e97 100644 (file)
@@ -22,6 +22,7 @@ if (!defined('LACONICA')) { exit(1); }
 class ShortUrlApi
 {
     protected $service_url;
+    protected $long_limit = 27;
 
     function __construct($service_url)
     {
@@ -39,7 +40,7 @@ class ShortUrlApi
     }
 
     private function is_long($url) {
-        return strlen($url) >= 30;
+        return strlen($url) >= $this->long_limit;
     }
 
     protected function http_post($data) {
index 46090b8c1976573e8255a38c64132f89ce8cc87e..86800d2a36b1e3630d61cb399dda7523be7f2d4e 100644 (file)
@@ -115,6 +115,9 @@ class AccountSettingsNav extends Widget
                 'openidsettings' =>
                 array(_('OpenID'),
                       _('Add or remove OpenIDs')),
+                'designsettings' =>
+                array(_('Design'),
+                      _('Design your profile')),
                 'othersettings' =>
                 array(_('Other'),
                       _('Other options')));
index 6b130b6d553484e0be8d7e790e9706303b8bfac8..6a69d26518170eed18f04a7a76ebdb15b4bbd9ce 100644 (file)
@@ -243,6 +243,12 @@ class Action extends HTMLOutputter // lawsuit
                 $this->element('script', array('type' => 'text/javascript',
                                                'src' => common_path('js/jquery.form.js')),
                                ' ');
+
+                $this->element('script', array('type' => 'text/javascript',
+                                               'src' => common_path('js/jquery.joverlay.min.js')),
+                               ' ');
+
+
                 Event::handle('EndShowJQueryScripts', array($this));
             }
             if (Event::handle('StartShowLaconicaScripts', array($this))) {
@@ -861,10 +867,12 @@ class Action extends HTMLOutputter // lawsuit
         }
         if ($lm) {
             header('Last-Modified: ' . date(DATE_RFC1123, $lm));
-            if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
-                $ims = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
+            if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
+                $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
+                $ims = strtotime($if_modified_since);
                 if ($lm <= $ims) {
-                    $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
+                    $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
+                      $_SERVER['HTTP_IF_NONE_MATCH'] : null;
                     if (!$if_none_match ||
                         !$etag ||
                         $this->_hasEtag($etag, $if_none_match)) {
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
new file mode 100644 (file)
index 0000000..559962a
--- /dev/null
@@ -0,0 +1,292 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * widget for displaying a list of notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  UI
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * widget for displaying a list of notice attachments
+ *
+ * There are a number of actions that display a list of notices, in
+ * reverse chronological order. This widget abstracts out most of the
+ * code for UI for notice lists. It's overridden to hide some
+ * data for e.g. the profile page.
+ *
+ * @category UI
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ * @see      Notice
+ * @see      StreamAction
+ * @see      NoticeListItem
+ * @see      ProfileNoticeList
+ */
+
+class AttachmentList extends Widget
+{
+    /** the current stream of notices being displayed. */
+
+    var $notice = null;
+
+    /**
+     * constructor
+     *
+     * @param Notice $notice stream of notices from DB_DataObject
+     */
+
+    function __construct($notice, $out=null)
+    {
+        parent::__construct($out);
+        $this->notice = $notice;
+    }
+
+    /**
+     * show the list of notices
+     *
+     * "Uses up" the stream by looping through it. So, probably can't
+     * be called twice on the same list.
+     *
+     * @return int count of notices listed.
+     */
+
+    function show()
+    {
+        $this->out->elementStart('dl', array('id' =>'attachments'));
+        $this->out->element('dt', null, _('Attachments'));
+        $this->out->elementStart('dd');
+        $this->out->elementStart('ol', array('class' => 'attachments'));
+
+        $atts = new File;
+        $att = $atts->getAttachments($this->notice->id);
+        foreach ($att as $n=>$attachment) {
+            $item = $this->newListItem($attachment);
+            $item->show();
+        }
+
+        $this->out->elementEnd('dd');
+        $this->out->elementEnd('ol');
+        $this->out->elementEnd('dl');
+
+        return count($att);
+    }
+
+    /**
+     * returns a new list item for the current notice
+     *
+     * Recipe (factory?) method; overridden by sub-classes to give
+     * a different list item class.
+     *
+     * @param Notice $notice the current notice
+     *
+     * @return NoticeListItem a list item for displaying the notice
+     */
+
+    function newListItem($attachment)
+    {
+        return new AttachmentListItem($attachment, $this->out);
+    }
+}
+
+/**
+ * widget for displaying a single notice
+ *
+ * This widget has the core smarts for showing a single notice: what to display,
+ * where, and under which circumstances. Its key method is show(); this is a recipe
+ * that calls all the other show*() methods to build up a single notice. The
+ * ProfileNoticeListItem subclass, for example, overrides showAuthor() to skip
+ * author info (since that's implicit by the data in the page).
+ *
+ * @category UI
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ * @see      NoticeList
+ * @see      ProfileNoticeListItem
+ */
+
+class AttachmentListItem extends Widget
+{
+    /** The attachment this item will show. */
+
+    var $attachment = null;
+
+    var $oembed = null;
+
+    /**
+     * constructor
+     *
+     * Also initializes the profile attribute.
+     *
+     * @param Notice $notice The notice we'll display
+     */
+
+    function __construct($attachment, $out=null)
+    {
+        parent::__construct($out);
+        $this->attachment  = $attachment;
+        $this->oembed = File_oembed::staticGet('file_id', $this->attachment->id);
+    }
+
+    function title() {
+        if (empty($this->attachment->title)) {
+            if (empty($this->oembed->title)) {
+                $title = $this->attachment->url;
+            } else {
+                $title = $this->oembed->title;
+            }
+        } else {
+            $title = $this->attachment->title;
+        }
+
+        return $title;
+    }
+
+    function linkTitle() {
+        return $this->title();
+    }
+
+    /**
+     * recipe function for displaying a single notice.
+     *
+     * This uses all the other methods to correctly display a notice. Override
+     * it or one of the others to fine-tune the output.
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $this->showStart();
+        $this->showNoticeAttachment();
+        $this->showEnd();
+    }
+
+    function linkAttr() {
+        return array('class' => 'attachment', 'href' => $this->attachment->url, 'id' => 'attachment-' . $this->attachment->id);
+    }
+
+    function showLink() {
+        $this->out->elementStart('a', $this->linkAttr());
+        $this->out->element('span', null, $this->linkTitle());
+        $this->showRepresentation();
+        $this->out->elementEnd('a');
+    }
+
+    function showNoticeAttachment()
+    {
+        $this->showLink();
+    }
+
+    function showRepresentation() {
+        $thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
+        if (!empty($thumbnail)) {
+            $this->out->element('img', array('alt' => 'nothing to say', 'src' => $thumbnail->url, 'width' => $thumbnail->width, 'height' => $thumbnail->height));
+        }
+    }
+
+    /**
+     * start a single notice.
+     *
+     * @return void
+     */
+
+    function showStart()
+    {
+        // XXX: RDFa
+        // TODO: add notice_type class e.g., notice_video, notice_image
+        $this->out->elementStart('li');
+    }
+
+    /**
+     * finish the notice
+     *
+     * Close the last elements in the notice list item
+     *
+     * @return void
+     */
+
+    function showEnd()
+    {
+        $this->out->elementEnd('li');
+    }
+}
+
+class Attachment extends AttachmentListItem
+{
+    function show() {
+        $this->showNoticeAttachment();
+    }
+
+    function linkAttr() {
+        return array('class' => 'external', 'href' => $this->attachment->url);
+    }
+
+    function linkTitle() {
+        return $this->attachment->url;
+    }
+
+    function showRepresentation() {
+        if (empty($this->oembed->type)) {
+            if (empty($this->attachment->mimetype)) {
+                $this->out->element('pre', null, 'oh well... not sure how to handle the following: ' . print_r($this->attachment, true));
+            } else {
+                switch ($this->attachment->mimetype) {
+                case 'image/gif':
+                case 'image/png':
+                case 'image/jpg':
+                case 'image/jpeg':
+                    $this->out->element('img', array('src' => $this->attachment->url, 'alt' => 'alt'));
+                    break;
+                }
+            }
+        } else {
+            switch ($this->oembed->type) {
+            case 'rich':
+            case 'video':
+            case 'link':
+                if (!empty($this->oembed->html)) {
+                    $this->out->raw($this->oembed->html);
+                }
+                break;
+
+            case 'photo':
+                $this->out->element('img', array('src' => $this->oembed->url, 'width' => $this->oembed->width, 'height' => $this->oembed->height, 'alt' => 'alt'));
+                break;
+
+            default:
+                $this->out->element('pre', null, 'oh well... not sure how to handle the following oembed: ' . print_r($this->oembed, true));
+            }
+        }
+    }
+}
+
diff --git a/lib/attachmentnoticesection.php b/lib/attachmentnoticesection.php
new file mode 100644 (file)
index 0000000..eb31763
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * FIXME
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Widget
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * FIXME
+ *
+ * These are the widgets that show interesting data about a person * group, or site.
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class AttachmentNoticeSection extends NoticeSection
+{
+    function showContent() {
+        parent::showContent();
+        return false;
+    }
+
+    function getNotices()
+    {
+        $notice = new Notice;
+        $f2p = new File_to_post;
+        $f2p->file_id = $this->out->attachment->id;
+        $notice->joinAdd($f2p);
+        $notice->orderBy('created desc');
+        $notice->selectAdd('post_id as id');
+        $notice->find();
+        return $notice; 
+    }
+
+    function title()
+    {
+        return _('Notices where this attachment appears');
+    }
+
+    function divId()
+    {
+        return 'popular_notices';
+    }
+}
+
diff --git a/lib/attachmenttagcloudsection.php b/lib/attachmenttagcloudsection.php
new file mode 100644 (file)
index 0000000..50bfcec
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Attachment tag cloud section
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Widget
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Attachment tag cloud section
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class AttachmentTagCloudSection extends TagCloudSection
+{
+    function title()
+    {
+        return _('Tags for this attachment');
+    }
+
+    function showTag($tag, $weight, $relative)
+    {
+        if ($relative > 0.5) {
+            $rel =  'tag-cloud-7';
+        } else if ($relative > 0.4) {
+            $rel = 'tag-cloud-6';
+        } else if ($relative > 0.3) {
+            $rel = 'tag-cloud-5';
+        } else if ($relative > 0.2) {
+            $rel = 'tag-cloud-4';
+        } else if ($relative > 0.1) {
+            $rel = 'tag-cloud-3';
+        } else if ($relative > 0.05) {
+            $rel = 'tag-cloud-2';
+        } else {
+            $rel = 'tag-cloud-1';
+        }
+
+        $this->out->elementStart('li', $rel);
+        $this->out->element('a', array('href' => $this->tagUrl($tag)),
+                       $tag);
+        $this->out->elementEnd('li');
+    }
+
+    function getTags()
+    {
+        $notice_tag = new Notice_tag;
+        $query = 'select tag,count(tag) as weight from notice_tag join file_to_post on (notice_tag.notice_id=post_id) join notice on notice_id = notice.id where file_id=' . $notice_tag->escape($this->out->attachment->id) . ' group by tag order by weight desc';
+        $notice_tag->query($query);
+        return $notice_tag;
+    }
+}
+
index 8f95c236158c7e1e9305ea7d8339e8406dbf51c8..4a98741e8e773e8377453a46ffa55eb7c2311b49 100644 (file)
@@ -19,7 +19,7 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-define('LACONICA_VERSION', '0.7.3');
+define('LACONICA_VERSION', '0.8.0dev');
 
 define('AVATAR_PROFILE_SIZE', 96);
 define('AVATAR_STREAM_SIZE', 48);
@@ -71,6 +71,7 @@ $config =
         array('name' => 'Just another Laconica microblog',
               'server' => $_server,
               'theme' => 'default',
+              'skin' => 'default',
               'path' => $_path,
               'logfile' => null,
               'logo' => null,
@@ -142,6 +143,8 @@ $config =
         array('piddir' => '/var/run',
               'user' => false,
               'group' => false),
+        'twitterbridge' =>
+        array('enabled' => false),
         'integration' =>
         array('source' => 'Laconica', # source attribute for Twitter
               'taguri' => $_server.',2009'), # base for tag URIs
@@ -156,6 +159,10 @@ $config =
         'newuser' =>
         array('subscribe' => null,
               'welcome' => null),
+        'snapshot' =>
+        array('run' => 'web',
+              'frequency' => 10000,
+              'reporturl' => 'http://laconi.ca/stats/report'),
         );
 
 $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
index 043a078cd5bbd2fa8b0849fa7dc3c5238927cc3f..a445750f7e00eee711f054a200c7ebc0dbd0f75e 100644 (file)
@@ -38,14 +38,14 @@ require_once INSTALLDIR.'/lib/noticeform.php';
 
 class FacebookAction extends Action
 {
-    
+
     var $facebook = null;
     var $fbuid    = null;
     var $flink    = null;
     var $action   = null;
     var $app_uri  = null;
     var $app_name = null;
-  
+
     /**
      * Constructor
      *
@@ -60,71 +60,71 @@ class FacebookAction extends Action
     function __construct($output='php://output', $indent=true, $facebook=null, $flink=null)
     {
         parent::__construct($output, $indent);
-        
+
         $this->facebook = $facebook;
         $this->flink = $flink;
-        
+
         if ($this->flink) {
-            $this->fbuid = $flink->foreign_id; 
+            $this->fbuid = $flink->foreign_id;
             $this->user = $flink->getUser();
         }
-        
+
         $this->args = array();
     }
-  
+
     function prepare($argarray)
-    {        
+    {
         parent::prepare($argarray);
-          
+
         $this->facebook = getFacebook();
         $this->fbuid = $this->facebook->require_login();
-        
+
         $this->action = $this->trimmed('action');
-        
+
         $app_props = $this->facebook->api_client->Admin_getAppProperties(
                 array('canvas_name', 'application_name'));
-        
+
         $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name'];
         $this->app_name = $app_props['application_name'];
 
         $this->flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_SERVICE);
-        
+
         return true;
-        
+
     }
-  
+
     function showStylesheets()
     {
         // Add a timestamp to the file so Facebook cache wont ignore our changes
         $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css');
-        
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts));
-                                     
+
+    $this->element('link', array('rel' => 'stylesheet',
+               'type' => 'text/css',
+               'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts));
+
         $theme = common_config('site', 'theme');
-        
+
         $ts = filemtime(INSTALLDIR. '/theme/' . $theme .'/css/display.css');
-                                     
+
         $this->element('link', array('rel' => 'stylesheet',
                                      'type' => 'text/css',
                                      'href' => theme_path('css/display.css', null) . '?ts=' . $ts));
-                                     
+
         $ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.css');
-        
+
         $this->element('link', array('rel' => 'stylesheet',
                                      'type' => 'text/css',
                                      'href' => theme_path('css/facebookapp.css', 'base') . '?ts=' . $ts));
     }
-  
+
     function showScripts()
     {
         // Add a timestamp to the file so Facebook cache wont ignore our changes
         $ts = filemtime(INSTALLDIR.'/js/facebookapp.js');
-        
+
         $this->element('script', array('src' => common_path('js/facebookapp.js') . '?ts=' . $ts));
     }
-    
+
     /**
      * Start an Facebook ready HTML document
      *
@@ -138,11 +138,11 @@ class FacebookAction extends Action
      * @return void
      */
 
-    function startHTML($type=null) 
-    {          
+    function startHTML($type=null)
+    {
         $this->showStylesheets();
         $this->showScripts();
-        
+
         $this->elementStart('div', array('class' => 'facebook-page'));
     }
 
@@ -177,18 +177,18 @@ class FacebookAction extends Action
         $this->showFooter();
         $this->elementEnd('div');
     }
-      
+
     function showAside()
     {
     }
 
     function showHead($error, $success)
     {
-        
+
         if ($error) {
             $this->element("h1", null, $error);
         }
-        
+
         if ($success) {
             $this->element("h1", null, $success);
         }
@@ -198,10 +198,10 @@ class FacebookAction extends Action
         $this->element('fb:add-section-button', array('section' => 'profile'));
         $this->elementEnd('span');
         $this->elementEnd('fb:if-section-not-added');
-        
+
     }
 
-    
+
     // Make this into a widget later
     function showLocalNav()
     {
@@ -229,8 +229,8 @@ class FacebookAction extends Action
         $this->elementEnd('li');
 
         $this->elementEnd('ul');
-    }     
-    
+    }
+
     /**
      * Show header of the page.
      *
@@ -245,7 +245,7 @@ class FacebookAction extends Action
         $this->showNoticeForm();
         $this->elementEnd('div');
     }
-    
+
     /**
      * Show page, a template method.
      *
@@ -258,7 +258,7 @@ class FacebookAction extends Action
         $this->showBody();
         $this->endHTML();
     }
-    
+
 
     function showInstructions()
     {
@@ -278,7 +278,7 @@ class FacebookAction extends Action
         $this->element('a',
             array('href' => common_local_url('register')), _('Register'));
         $this->text($loginmsg_part2);
-       $this->elementEnd('p');
+    $this->elementEnd('p');
         $this->elementEnd('dd');
 
         $this->elementEnd('dl');
@@ -317,7 +317,7 @@ class FacebookAction extends Action
         $this->elementEnd('ul');
 
         $this->submit('submit', _('Login'));
-       $this->elementEnd('fieldset');
+    $this->elementEnd('fieldset');
         $this->elementEnd('form');
 
         $this->elementStart('p');
@@ -329,73 +329,73 @@ class FacebookAction extends Action
         $this->elementEnd('div');
 
     }
-    
-    
+
+
     function updateProfileBox($notice)
     {
 
         // Need to include inline CSS for styling the Profile box
 
-       $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
-       $icon_url = $app_props['icon_url'];
+    $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
+    $icon_url = $app_props['icon_url'];
 
         $style = '<style>
-        .entry-title *,
-        .entry-content * {
-        font-size:14px;
-        font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
-        }
-        .entry-title a,
-        .entry-content a {
-        color:#002E6E;
-        }
+     .entry-title *,
+     .entry-content * {
+     font-size:14px;
+     font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
+     }
+     .entry-title a,
+     .entry-content a {
+     color:#002E6E;
+     }
 
          .entry-title .vcard .photo {
          float:left;
          display:inline;
-        margin-right:11px;
-        margin-bottom:11px
+     margin-right:11px;
+     margin-bottom:11px
          }
-        .entry-title {
-        margin-bottom:11px;
-        }
+     .entry-title {
+     margin-bottom:11px;
+     }
          .entry-title p.entry-content {
          display:inline;
-        margin-left:5px;
+     margin-left:5px;
          }
 
-        div.entry-content {
-        clear:both;
-        }
+     div.entry-content {
+     clear:both;
+     }
          div.entry-content dl,
          div.entry-content dt,
          div.entry-content dd {
          display:inline;
-        text-transform:lowercase;
+     text-transform:lowercase;
          }
 
          div.entry-content dd,
-        div.entry-content .device dt {
-        margin-left:0;
-        margin-right:5px;
+     div.entry-content .device dt {
+     margin-left:0;
+     margin-right:5px;
          }
          div.entry-content dl.timestamp dt,
-        div.entry-content dl.response dt {
+     div.entry-content dl.response dt {
          display:none;
          }
          div.entry-content dd a {
          display:inline-block;
          }
 
-        #facebook_laconica_app {
-        text-indent:-9999px;
-        height:16px;
-        width:16px;
-        display:block;
-        background:url('.$icon_url.') no-repeat 0 0;
-        float:right;
-        }
-         </style>';        
+     #facebook_laconica_app {
+     text-indent:-9999px;
+     height:16px;
+     width:16px;
+     display:block;
+     background:url('.$icon_url.') no-repeat 0 0;
+     float:right;
+     }
+         </style>';
 
         $this->xw->openMemory();
 
@@ -407,12 +407,12 @@ class FacebookAction extends Action
 
         $fbml_main = "<fb:narrow>$style " . $this->xw->outputMemory(false) . "</fb:narrow>";
 
-        $this->facebook->api_client->profile_setFBML(null, $this->fbuid, $fbml, null, null, $fbml_main);  
+        $this->facebook->api_client->profile_setFBML(null, $this->fbuid, $fbml, null, null, $fbml_main);
 
         $this->xw->openURI('php://output');
     }
-    
-    
+
+
     /**
      * Generate pagination links
      *
@@ -457,24 +457,24 @@ class FacebookAction extends Action
             $this->elementEnd('div');
         }
     }
-    
-    function updateFacebookStatus($notice) 
+
+    function updateFacebookStatus($notice)
     {
         $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, $this->fbuid);
         $content = "$prefix $notice->content";
-        
+
         if ($this->facebook->api_client->users_hasAppPermission('status_update', $this->fbuid)) {
             $this->facebook->api_client->users_setStatus($content, $this->fbuid, false, true);
         }
     }
-    
+
     function saveNewNotice()
     {
 
         $user = $this->flink->getUser();
 
         $content = $this->trimmed('status_textarea');
-        
+
         if (!$content) {
             $this->showPage(_('No notice content!'));
             return;
@@ -492,9 +492,9 @@ class FacebookAction extends Action
         $cmd = $inter->handle_command($user, $content_shortened);
 
         if ($cmd) {
-            
+
             // XXX fix this
-            
+
             $cmd->execute(new WebChannel());
             return;
         }
@@ -510,20 +510,20 @@ class FacebookAction extends Action
         }
 
         common_broadcast_notice($notice);
-        
+
         // Also update the user's Facebook status
         $this->updateFacebookStatus($notice);
         $this->updateProfileBox($notice);
-        
+
     }
 
 }
 
-class FacebookNoticeForm extends NoticeForm 
+class FacebookNoticeForm extends NoticeForm
 {
-    
+
     var $post_action = null;
-    
+
     /**
      * Constructor
      *
@@ -532,13 +532,13 @@ class FacebookNoticeForm extends NoticeForm
      * @param string        $content content to pre-fill
      */
 
-    function __construct($out=null, $action=null, $content=null, 
+    function __construct($out=null, $action=null, $content=null,
         $post_action=null, $user=null)
     {
         parent::__construct($out, $action, $content, $user);
         $this->post_action = $post_action;
     }
-    
+
     /**
      * Action of the form
      *
@@ -554,7 +554,7 @@ class FacebookNoticeForm extends NoticeForm
 
 class FacebookNoticeList extends NoticeList
 {
-    
+
     /**
      * constructor
      *
@@ -565,7 +565,7 @@ class FacebookNoticeList extends NoticeList
     {
         parent::__construct($notice, $out);
     }
-    
+
     /**
      * show the list of notices
      *
@@ -619,7 +619,7 @@ class FacebookNoticeList extends NoticeList
 }
 
 class FacebookNoticeListItem extends NoticeListItem
-{    
+{
 
     /**
      * constructor
@@ -646,51 +646,19 @@ class FacebookNoticeListItem extends NoticeListItem
     function show()
     {
         $this->showStart();
+        $this->showNotice();
+        $this->showNoticeInfo();
 
-        $this->out->elementStart('div', 'entry-title');
-        $this->showAuthor();
-        $this->showContent();
-        $this->out->elementEnd('div');
-
-        $this->out->elementStart('div', 'entry-content');
-        $this->showNoticeLink();
-        $this->showNoticeSource();
-        $this->showReplyTo();
-        $this->out->elementEnd('div');
+        // XXX: Need to update to show attachements and controls
 
         $this->showEnd();
     }
 
-    function showNoticeLink()
-    {
-        $noticeurl = common_local_url('shownotice',
-                                      array('notice' => $this->notice->id));
-        // XXX: we need to figure this out better. Is this right?
-        if (strcmp($this->notice->uri, $noticeurl) != 0 &&
-            preg_match('/^http/', $this->notice->uri)) {
-            $noticeurl = $this->notice->uri;
-        }
-
-        $this->out->elementStart('dl', 'timestamp');
-        $this->out->element('dt', null, _('Published'));
-        $this->out->elementStart('dd', null);
-        $this->out->elementStart('a', array('rel' => 'bookmark',
-                                        'href' => $noticeurl));
-        $dt = common_date_iso8601($this->notice->created);
-        $this->out->element('abbr', array('class' => 'published',
-                                     'title' => $dt),
-        common_date_string($this->notice->created));
-        $this->out->elementEnd('a');
-        $this->out->elementEnd('dd');
-        $this->out->elementEnd('dl');
-    }
-
 }
 
-
 class FacebookProfileBoxNotice extends FacebookNoticeListItem
-{    
-    
+{
+
     /**
      * constructor
      *
@@ -703,36 +671,24 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
     {
         parent::__construct($notice, $out);
     }
-    
+
     /**
-     * Recipe function for displaying a single notice in the 
-     * Facebook App's Profile
+     * Recipe function for displaying a single notice in the
+     * Facebook App profile notice box
      *
      * @return void
      */
 
     function show()
     {
-
-        $this->out->elementStart('div', 'entry-title');
-        $this->showAuthor();
-        $this->showContent();
-        $this->out->elementEnd('div');
-
-        $this->out->elementStart('div', 'entry-content');
-
-        $this->showNoticeLink();
-        $this->showNoticeSource();
-        $this->showReplyTo();
-        $this->out->elementEnd('div');
-        
+        $this->showNotice();
+        $this->showNoticeInfo();
         $this->showAppLink();
-
     }
 
-    function showAppLink() 
+    function showAppLink()
     {
-        
+
         $this->facebook = getFacebook();
 
         $app_props = $this->facebook->api_client->Admin_getAppProperties(
@@ -740,7 +696,7 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem
 
         $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name'];
         $this->app_name = $app_props['application_name'];
-        
+
         $this->out->elementStart('a', array('id' => 'facebook_laconica_app',
                                             'href' => $this->app_uri));
         $this->out->text($this->app_name);
index 4182d8808f7046520a9453e8ab1c90b6562083dd..50a95cfcbb2a96e2a707a350119f518f0513859f 100644 (file)
@@ -34,6 +34,7 @@ if (!defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/favorform.php';
 require_once INSTALLDIR.'/lib/disfavorform.php';
+require_once INSTALLDIR.'/lib/attachmentlist.php';
 
 /**
  * widget for displaying a list of notices
@@ -179,6 +180,7 @@ class NoticeListItem extends Widget
     {
         $this->showStart();
         $this->showNotice();
+        $this->showNoticeAttachments();
         $this->showNoticeInfo();
         $this->showNoticeOptions();
         $this->showEnd();
@@ -192,12 +194,32 @@ class NoticeListItem extends Widget
         $this->out->elementEnd('div');
     }
 
+    function showNoticeAttachments() {
+        if ($this->isUsedInList()) {
+            return;
+        }
+        $al = new AttachmentList($this->notice, $this->out);
+        $al->show();
+    }
+
+    function isUsedInList() {
+        return 'shownotice' !== $this->out->args['action'];
+    }
+
+    function attachmentCount($discriminant = true) {
+        $file_oembed = new File_oembed;
+        $query = "select count(*) as c from file_oembed join file_to_post on file_oembed.file_id = file_to_post.file_id where post_id=" . $this->notice->id;
+        $file_oembed->query($query);
+        $file_oembed->fetch();
+        return intval($file_oembed->c);
+    }
+
     function showNoticeInfo()
     {
         $this->out->elementStart('div', 'entry-content');
         $this->showNoticeLink();
         $this->showNoticeSource();
-        $this->showReplyTo();
+        $this->showContext();
         $this->out->elementEnd('div');
     }
 
@@ -421,17 +443,18 @@ class NoticeListItem extends Widget
      * @return void
      */
 
-    function showReplyTo()
+    function showContext()
     {
-        if ($this->notice->reply_to) {
-            $replyurl = common_local_url('shownotice',
-                                         array('notice' => $this->notice->reply_to));
+        // XXX: also show context if there are replies to this notice
+        if (!empty($this->notice->conversation)
+            && $this->notice->conversation != $this->notice->id) {
+            $convurl = common_local_url('conversation',
+                                         array('id' => $this->notice->conversation));
             $this->out->elementStart('dl', 'response');
             $this->out->element('dt', null, _('To'));
             $this->out->elementStart('dd');
-            $this->out->element('a', array('href' => $replyurl,
-                                           'rel' => 'in-reply-to'),
-                                _('in reply to'));
+            $this->out->element('a', array('href' => $convurl),
+                                _('in context'));
             $this->out->elementEnd('dd');
             $this->out->elementEnd('dl');
         }
index 94c2738efdabc3c5b1c60e5da6b3a774c8cd8c63..37aafdaf6cb2c4753d522d0d94f1dea7edb2d08f 100644 (file)
@@ -51,17 +51,13 @@ class NoticeSection extends Section
     function showContent()
     {
         $notices = $this->getNotices();
-
         $cnt = 0;
-
         $this->out->elementStart('ul', 'notices');
-
         while ($notices->fetch() && ++$cnt <= NOTICES_PER_SECTION) {
             $this->showNotice($notices);
         }
 
         $this->out->elementEnd('ul');
-
         return ($cnt > NOTICES_PER_SECTION);
     }
 
@@ -100,6 +96,37 @@ class NoticeSection extends Section
 
         $this->out->elementStart('p', 'entry-content');
         $this->out->raw($notice->rendered);
+
+        $notice_link_cfg = common_config('site', 'notice_link');
+        if ('direct' === $notice_link_cfg) {
+            $this->out->text(' (');
+            $this->out->element('a', array('href' => $notice->uri), 'see');
+            $this->out->text(')');
+        } elseif ('attachment' === $notice_link_cfg) {
+            if ($count = $notice->hasAttachments()) {
+            // link to attachment(s) pages
+                if (1 === $count) {
+                    $f2p = File_to_post::staticGet('post_id', $notice->id);
+                    $href = common_local_url('attachment', array('attachment' => $f2p->file_id));
+                    $att_class = 'attachment';
+                } else {
+                    $href = common_local_url('attachments', array('notice' => $notice->id));
+                    $att_class = 'attachments';
+                }
+
+                $clip = theme_path('images/icons/clip.png', 'base');
+                $this->out->elementStart('a', array('class' => $att_class, 'style' => "font-style: italic;", 'href' => $href, 'title' => "# of attachments: $count"));
+                $this->out->raw(" ($count&nbsp");
+                $this->out->element('img', array('style' => 'display: inline', 'align' => 'top', 'width' => 20, 'height' => 20, 'src' => $clip, 'alt' => 'alt'));
+                $this->out->text(')');
+                $this->out->elementEnd('a');
+            } else {
+                $this->out->text(' (');
+                $this->out->element('a', array('href' => $notice->uri), 'see');
+                $this->out->text(')');
+            }
+        }
+
         $this->out->elementEnd('p');
         if (!empty($notice->value)) {
             $this->out->elementStart('p');
index a8d47ef542b5a0ea9e2c7c344de0f928c4af9035..375d5538be72ebfa2aa02922a3164f81101f29f8 100644 (file)
@@ -51,7 +51,7 @@ class PopularNoticeSection extends NoticeSection
         if (common_config('db', 'type') == 'pgsql') {
             $weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
             if (!empty($this->out->tag)) {
-                $tag = pg_escape_string($this->tag);
+                $tag = pg_escape_string($this->out->tag);
             }
         } else {
             $weightexpr='sum(exp(-(now() - fave.modified) / %s))';
index 1f2e309945c2ca3af30ba054c277b95445c7a25c..a3437ff4ddbec567d630c3f25e4985aa8b3f73a8 100644 (file)
@@ -49,16 +49,17 @@ require_once INSTALLDIR.'/lib/groupminilist.php';
 
 class ProfileAction extends Action
 {
-    var $user = null;
-    var $page = null;
+    var $user    = null;
+    var $page    = null;
     var $profile = null;
+    var $tag     = null;
 
     function prepare($args)
     {
         parent::prepare($args);
 
         $nickname_arg = $this->arg('nickname');
-        $nickname = common_canonical_nickname($nickname_arg);
+        $nickname     = common_canonical_nickname($nickname_arg);
 
         // Permanent redirect on non-canonical nickname
 
@@ -85,10 +86,9 @@ class ProfileAction extends Action
             return false;
         }
 
+        $this->tag = $this->trimmed('tag');
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
-
         common_set_returnto($this->selfUrl());
-
         return true;
     }
 
@@ -244,4 +244,5 @@ class ProfileAction extends Action
 
         $this->elementEnd('div');
     }
-}
\ No newline at end of file
+}
+
index fde650d9ed782fd676b7ded4217ca9d4d8788b8d..f76f16e0732f8c2dadb5b5a08e3c9b2519e483ac 100644 (file)
@@ -75,15 +75,9 @@ class QueueHandler extends Daemon
         return true;
     }
 
-    function run()
-    {
-        if (!$this->start()) {
-            return false;
-        }
-        $transport = $this->transport();
-        $this->log(LOG_INFO, 'checking for queued notices for "' . $transport . '"');
+    function db_dispatch() {
         do {
-            $qi = Queue_item::top($transport);
+            $qi = Queue_item::top($this->transport());
             if ($qi) {
                 $this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($qi->created));
                 $notice = Notice::staticGet($qi->notice_id);
@@ -115,6 +109,67 @@ class QueueHandler extends Daemon
                 $this->idle(5);
             }
         } while (true);
+    }
+
+    function stomp_dispatch() {
+        require("Stomp.php");
+        $con = new Stomp(common_config('queue','stomp_server'));
+        if (!$con->connect()) {
+            $this->log(LOG_ERR, 'Failed to connect to queue server');
+            return false;
+        }
+        $queue_basename = common_config('queue','queue_basename');
+        // subscribe to the relevant queue (format: basename-transport)
+        $con->subscribe('/queue/'.$queue_basename.'-'.$this->transport());
+
+        do {
+            $frame = $con->readFrame();
+            if ($frame) {
+                $this->log(LOG_INFO, 'Got item enqueued '.common_exact_date($frame->headers['created']));
+
+                // XXX: Now the queue handler receives only the ID of the
+                // notice, and it has to get it from the DB
+                // A massive improvement would be avoid DB query by transmitting
+                // all the notice details via queue server...
+                $notice = Notice::staticGet($frame->body);
+
+                if ($notice) {
+                    $this->log(LOG_INFO, 'broadcasting notice ID = ' . $notice->id);
+                    $result = $this->handle_notice($notice);
+                    if ($result) {
+                        // if the msg has been handled positively, ack it
+                        // and the queue server will remove it from the queue
+                        $con->ack($frame);
+                        $this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
+                    }
+                    else {
+                        // no ack
+                        $this->log(LOG_WARNING, 'Failed broadcast for notice ID = ' . $notice->id);
+                    }
+                    $notice->free();
+                    unset($notice);
+                    $notice = null;
+                } else {
+                    $this->log(LOG_WARNING, 'queue item for notice that does not exist');
+                }
+            }
+        } while (true);
+
+        $con->disconnect();
+    }
+
+    function run()
+    {
+        if (!$this->start()) {
+            return false;
+        }
+        $this->log(LOG_INFO, 'checking for queued notices');
+        if (common_config('queue','subsystem') == 'stomp') {
+            $this->stomp_dispatch();
+        }
+        else {
+            $this->db_dispatch();
+        }
         if (!$this->finish()) {
             return false;
         }
@@ -143,3 +198,4 @@ class QueueHandler extends Daemon
         common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
     }
 }
+
index 12590b790d0806e36970984bd36fc2286e876d18..fc119821b9260a30cc4ccdc64c04c6d9369383f3 100644 (file)
@@ -131,7 +131,7 @@ class Router
         // settings
 
         foreach (array('profile', 'avatar', 'password', 'openid', 'im',
-                       'email', 'sms', 'twitter', 'other') as $s) {
+                       'email', 'sms', 'twitter', 'design', 'other') as $s) {
             $m->connect('settings/'.$s, array('action' => $s.'settings'));
         }
 
@@ -151,12 +151,19 @@ class Router
         $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
                     array('q' => '.+'));
 
-        // notice
+        $m->connect('attachment/:attachment/ajax',
+                    array('action' => 'attachment_ajax'),
+                    array('attachment' => '[0-9]+'));
+
+        $m->connect('attachment/:attachment/thumbnail',
+                    array('action' => 'attachment_thumbnail'),
+                    array('attachment' => '[0-9]+'));
 
         $m->connect('notice/new', array('action' => 'newnotice'));
         $m->connect('notice/new?replyto=:replyto',
                     array('action' => 'newnotice'),
                     array('replyto' => '[A-Za-z0-9_-]+'));
+
         $m->connect('notice/:notice',
                     array('action' => 'shownotice'),
                     array('notice' => '[0-9]+'));
@@ -165,6 +172,12 @@ class Router
                     array('action' => 'deletenotice'),
                     array('notice' => '[0-9]+'));
 
+        // conversation
+
+        $m->connect('conversation/:id',
+                    array('action' => 'conversation'),
+                    array('id' => '[0-9]+'));
+
         $m->connect('message/new', array('action' => 'newmessage'));
         $m->connect('message/new?to=:to', array('action' => 'newmessage'), array('to' => '[A-Za-z0-9_-]+'));
         $m->connect('message/:message',
@@ -406,6 +419,16 @@ class Router
                     array('size' => '(original|96|48|24)',
                           'nickname' => '[a-zA-Z0-9]{1,64}'));
 
+        $m->connect(':nickname/tag/:tag/rss',
+            array('action' => 'userrss'),
+            array('nickname' => '[a-zA-Z0-9]{1,64}'),
+            array('tag' => '[a-zA-Z0-9]+'));
+
+        $m->connect(':nickname/tag/:tag',
+                    array('action' => 'showstream'),
+                    array('nickname' => '[a-zA-Z0-9]{1,64}'),
+                    array('tag' => '[a-zA-Z0-9]+'));
+
         $m->connect(':nickname',
                     array('action' => 'showstream'),
                     array('nickname' => '[a-zA-Z0-9]{1,64}'));
index ddba862dcf9b22113d74787215f3a15f094e6b5a..2f25ed7e47d14150094efaa57b5322d1c56b862b 100644 (file)
@@ -97,7 +97,11 @@ class Rss10Action extends Action
         // Parent handling, including cache check
         parent::handle($args);
         // Get the list of notices
-        $this->notices = $this->getNotices($this->limit);
+        if (empty($this->tag)) {
+            $this->notices = $this->getNotices($this->limit);
+        } else {
+            $this->notices = $this->getTaggedNotices($this->tag, $this->limit);
+        }
         $this->showRss();
     }
 
diff --git a/lib/snapshot.php b/lib/snapshot.php
new file mode 100644 (file)
index 0000000..4b05b50
--- /dev/null
@@ -0,0 +1,227 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * A snapshot of site stats that can report itself to headquarters
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Stats
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * A snapshot of site stats that can report itself to headquarters
+ *
+ * This class will collect statistics on the site and report them to
+ * a statistics server of the admin's choice. (Default is the big one
+ * at laconi.ca.)
+ *
+ * It can either be called from a cron job, or run occasionally by the
+ * Web site.
+ *
+ * @category Stats
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ */
+
+class Snapshot
+{
+    var $stats = null;
+
+    /**
+     * Constructor for a snapshot
+     */
+
+    function __construct()
+    {
+    }
+
+    /**
+     * Static function for reporting statistics
+     *
+     * This function checks whether it should report statistics, based on
+     * the current configuation settings. If it should, it creates a new
+     * Snapshot object, takes a snapshot, and reports it to headquarters.
+     *
+     * @return void
+     */
+
+    static function check()
+    {
+        switch (common_config('snapshot', 'run')) {
+        case 'web':
+            // skip if we're not running on the Web.
+            if (!isset($_SERVER) || !array_key_exists('REQUEST_METHOD', $_SERVER)) {
+                break;
+            }
+            // Run once every frequency hits
+            // XXX: do frequency by time (once a week, etc.) rather than
+            // hits
+            if (rand() % common_config('snapshot', 'frequency') == 0) {
+                $snapshot = new Snapshot();
+                $snapshot->take();
+                $snapshot->report();
+            }
+            break;
+        case 'cron':
+            // skip if we're running on the Web
+            if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+                break;
+            }
+            common_log(LOG_INFO, 'Running snapshot from cron job');
+            // We're running from the command line; assume
+
+            $snapshot = new Snapshot();
+            $snapshot->take();
+            common_log(LOG_INFO, count($snapshot->stats) . " statistics being uploaded.");
+            $snapshot->report();
+
+            break;
+        case 'never':
+            break;
+        default:
+            common_log(LOG_WARNING, "Unrecognized value for snapshot run config.");
+        }
+    }
+
+    /**
+     * Take a snapshot of the server
+     *
+     * Builds an array of statistical and configuration data based
+     * on the local database and config files. We avoid grabbing any
+     * information that could be personal or private.
+     *
+     * @return void
+     */
+
+    function take()
+    {
+        $this->stats = array();
+
+        // Some basic identification stuff
+
+        $this->stats['version']    = LACONICA_VERSION;
+        $this->stats['phpversion'] = phpversion();
+        $this->stats['name']       = common_config('site', 'name');
+        $this->stats['root']       = common_root_url();
+
+        // non-identifying stats on various tables. Primary
+        // interest is size and rate of activity of service.
+
+        $tables = array('user',
+                        'notice',
+                        'subscription',
+                        'remote_profile',
+                        'user_group');
+
+        foreach ($tables as $table) {
+            $this->tableStats($table);
+        }
+
+        // stats on some important config options
+
+        $this->stats['theme']     = common_config('site', 'theme');
+        $this->stats['dbtype']    = common_config('db', 'type');
+        $this->stats['xmpp']      = common_config('xmpp', 'enabled');
+        $this->stats['inboxes']   = common_config('inboxes', 'enabled');
+        $this->stats['queue']     = common_config('queue', 'enabled');
+        $this->stats['license']   = common_config('license', 'url');
+        $this->stats['fancy']     = common_config('site', 'fancy');
+        $this->stats['private']   = common_config('site', 'private');
+        $this->stats['closed']    = common_config('site', 'closed');
+        $this->stats['memcached'] = common_config('memcached', 'enabled');
+        $this->stats['language']  = common_config('site', 'language');
+        $this->stats['timezone']  = common_config('site', 'timezone');
+
+    }
+
+    /**
+     * Reports statistics to headquarters
+     *
+     * Posts statistics to a reporting server.
+     *
+     * @return void
+     */
+
+    function report()
+    {
+        // XXX: Use OICU2 and OAuth to make authorized requests
+
+        $postdata = http_build_query($this->stats);
+
+        $opts =
+          array('http' =>
+                array(
+                      'method'  => 'POST',
+                      'header'  => 'Content-type: '.
+                                   'application/x-www-form-urlencoded',
+                      'content' => $postdata,
+                      'user_agent' => 'Laconica/'.LACONICA_VERSION
+                      )
+                );
+
+        $context = stream_context_create($opts);
+
+        $reporturl = common_config('snapshot', 'reporturl');
+
+        $result = @file_get_contents($reporturl, false, $context);
+
+        return $result;
+    }
+
+    /**
+     * Updates statistics for a single table
+     *
+     * Determines the size of a table and its oldest and newest rows.
+     * Goal here is to see how active a site is. Note that it
+     * fills up the instance stats variable.
+     *
+     * @param string $table name of table to check
+     *
+     * @return void
+     */
+
+    function tableStats($table)
+    {
+        $inst = DB_DataObject::factory($table);
+
+        $inst->selectAdd();
+        $inst->selectAdd('count(*) as cnt, '.
+                         'min(created) as first, '.
+                         'max(created) as last');
+
+        if ($inst->find(true)) {
+            $this->stats[$table.'count'] = $inst->cnt;
+            $this->stats[$table.'first'] = $inst->first;
+            $this->stats[$table.'last']  = $inst->last;
+        }
+
+        $inst->free();
+        unset($inst);
+    }
+}
index ff2aca6d6ec06eae34895ac3691fdb240aebcd80..62f7d8961282659f7c12a4b0db2b57840cfc74da 100644 (file)
@@ -114,7 +114,11 @@ class TagCloudSection extends Section
 
     function tagUrl($tag)
     {
-        return common_local_url('tag', array('tag' => $tag));
+        if ('showstream' === $this->out->trimmed('action')) {
+            return common_local_url('showstream', array('nickname' => $this->out->profile->nickname, 'tag' => $tag));
+        } else {
+            return common_local_url('tag', array('tag' => $tag));
+        }
     }
 
     function divId()
index 95030affed66a424de6f529c4bcdcf92990f3cfd..bef660cbf538183dc6ac14e8ad0b77eee9415f07 100644 (file)
@@ -69,4 +69,31 @@ function theme_path($relative, $theme=null)
     } else {
         return common_path('theme/'.$theme.'/'.$relative);
     }
-}
\ No newline at end of file
+}
+
+/**
+ * Gets the full URL of a file in a skin dir based on its relative name
+ *
+ * @param string $relative relative path within the theme, skin directory
+ * @param string $theme    name of the theme; defaults to current theme
+ * @param string $skin    name of the skin; defaults to current theme
+ *
+ * @return string URL of the file
+ */
+
+function skin_path($relative, $theme=null, $skin=null)
+{
+    if (!$theme) {
+        $theme = common_config('site', 'theme');
+    }
+    if (!$skin) {
+        $skin = common_config('site', 'skin');
+    }
+    $server = common_config('theme', 'server');
+    if ($server) {
+        return 'http://'.$server.'/'.$theme.'/skin/'.$skin.'/'.$relative;
+    } else {
+        return common_path('theme/'.$theme.'/skin/'.$skin.'/'.$relative);
+    }
+}
+
index ccc6c93cae00730100cdd984b918ba571891be10..c1d0dc254d8c99dc7ff8bc6a730644ee44e53097 100644 (file)
@@ -346,7 +346,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password)
 function is_twitter_bound($notice, $flink) {
 
     // Check to see if notice should go to Twitter
-    if ($flink->noticesync & FOREIGN_NOTICE_SEND) {
+    if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) {
 
         // If it's not a Twitter-style reply, or if the user WANTS to send replies.
         if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
index f862d7fcc261fc3c40260f11215edd8310211ec1..d56f44f7b45c39a948f8cd4ed488eb081ff783a1 100644 (file)
@@ -395,7 +395,7 @@ function common_render_text($text)
     return $r;
 }
 
-function common_replace_urls_callback($text, $callback) {
+function common_replace_urls_callback($text, $callback, $notice_id = null) {
     // Start off with a regex
     $regex = '#'.
     '(?:'.
@@ -466,7 +466,11 @@ function common_replace_urls_callback($text, $callback) {
         $url = (mb_strpos($orig_url, htmlspecialchars($url)) === FALSE) ? $url:htmlspecialchars($url);
 
         // Call user specified func
-        $modified_url = call_user_func($callback, $url);
+        if (empty($notice_id)) {
+            $modified_url = call_user_func($callback, $url);
+        } else {
+            $modified_url = call_user_func($callback, array($url, $notice_id));
+        }
 
         // Replace it!
         $start = mb_strpos($text, $url, $offset);
@@ -481,107 +485,45 @@ function common_linkify($url) {
     // It comes in special'd, so we unspecial it before passing to the stringifying
     // functions
     $url = htmlspecialchars_decode($url);
-    $display = $url;
-    $url = (!preg_match('#^([a-z]+://|(mailto|aim|tel):)#i', $url)) ? 'http://'.$url : $url;
-
-    $attrs = array('href' => $url, 'rel' => 'external');
-
-    if ($longurl = common_longurl($url)) {
-        $attrs['title'] = $longurl;
+    $display = File_redirection::_canonUrl($url);
+    $longurl_data = File_redirection::where($url);
+    if (is_array($longurl_data)) {
+        $longurl = $longurl_data['url'];
+    } elseif (is_string($longurl_data)) {
+        $longurl = $longurl_data;
+    } else {
+        die('impossible to linkify');
     }
 
-    return XMLStringer::estring('a', $attrs, $display);
-}
+    $attrs = array('href' => $longurl, 'rel' => 'external');
 
-function common_longurl($short_url)
-{
-    $long_url = common_shorten_link($short_url, true);
-    if ($long_url === $short_url) return false;
-    return $long_url;
-}
+// if this URL is an attachment, then we set class='attachment' and id='attahcment-ID'
+// where ID is the id of the attachment for the given URL.
+    $query = "select file_oembed.file_id as file_id from file join file_oembed on file.id = file_oembed.file_id where file.url='$longurl'";
+    $file = new File;
+    $file->query($query);
+    $file->fetch();
 
-function common_longurl2($uri)
-{
-    $uri_e = urlencode($uri);
-    $longurl = unserialize(file_get_contents("http://api.longurl.org/v1/expand?format=php&url=$uri_e"));
-    if (empty($longurl['long_url']) || $uri === $longurl['long_url']) return false;
-    return stripslashes($longurl['long_url']);
+    if (!empty($file->file_id)) {
+        $query = "select file_thumbnail.file_id as file_id from file join file_thumbnail on file.id = file_thumbnail.file_id where file.url='$longurl'";
+        $file2 = new File;
+        $file2->query($query);
+        $file2->fetch();
+
+        if (empty($file2->file_id)) {
+            $attrs['class'] = 'attachment';
+        } else {
+            $attrs['class'] = 'attachment thumbnail';
+        }
+        $attrs['id'] = "attachment-{$file->file_id}";
+    }
+    return XMLStringer::estring('a', $attrs, $display);
 }
 
 function common_shorten_links($text)
 {
     if (mb_strlen($text) <= 140) return $text;
-    static $cache = array();
-    if (isset($cache[$text])) return $cache[$text];
-    // \s = not a horizontal whitespace character (since PHP 5.2.4)
-    return $cache[$text] = common_replace_urls_callback($text, 'common_shorten_link');;
-}
-
-function common_shorten_link($url, $reverse = false)
-{
-
-    static $url_cache = array();
-    if ($reverse) return isset($url_cache[$url]) ? $url_cache[$url] : $url;
-
-    $user = common_current_user();
-    if (!isset($user)) {
-      // common current user does not find a user when called from the XMPP daemon
-      // therefore we'll set one here fix, so that XMPP given URLs may be shortened
-      $user->urlshorteningservice = 'ur1.ca';
-    }
-    $curlh = curl_init();
-    curl_setopt($curlh, CURLOPT_CONNECTTIMEOUT, 20); // # seconds to wait
-    curl_setopt($curlh, CURLOPT_USERAGENT, 'Laconica');
-    curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
-
-    switch($user->urlshorteningservice) {
-     case 'ur1.ca':
-        $short_url_service = new LilUrl;
-        $short_url = $short_url_service->shorten($url);
-        break;
-
-     case '2tu.us':
-        $short_url_service = new TightUrl;
-        $short_url = $short_url_service->shorten($url);
-        break;
-
-     case 'ptiturl.com':
-        $short_url_service = new PtitUrl;
-        $short_url = $short_url_service->shorten($url);
-        break;
-
-     case 'bit.ly':
-        curl_setopt($curlh, CURLOPT_URL, 'http://bit.ly/api?method=shorten&long_url='.urlencode($url));
-        $short_url = current(json_decode(curl_exec($curlh))->results)->hashUrl;
-        break;
-
-     case 'is.gd':
-        curl_setopt($curlh, CURLOPT_URL, 'http://is.gd/api.php?longurl='.urlencode($url));
-        $short_url = curl_exec($curlh);
-        break;
-     case 'snipr.com':
-        curl_setopt($curlh, CURLOPT_URL, 'http://snipr.com/site/snip?r=simple&link='.urlencode($url));
-        $short_url = curl_exec($curlh);
-        break;
-     case 'metamark.net':
-        curl_setopt($curlh, CURLOPT_URL, 'http://metamark.net/api/rest/simple?long_url='.urlencode($url));
-        $short_url = curl_exec($curlh);
-        break;
-     case 'tinyurl.com':
-        curl_setopt($curlh, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url='.urlencode($url));
-        $short_url = curl_exec($curlh);
-        break;
-     default:
-        $short_url = false;
-    }
-
-    curl_close($curlh);
-
-    if ($short_url) {
-        $url_cache[(string)$short_url] = $url;
-        return (string)$short_url;
-    }
-    return $url;
+    return common_replace_urls_callback($text, array('File_redirection', 'makeShort'));
 }
 
 function common_xml_safe_str($str)
@@ -879,34 +821,76 @@ function common_broadcast_notice($notice, $remote=false)
 
 function common_enqueue_notice($notice)
 {
-    $transports = array('omb', 'sms', 'twitter', 'facebook', 'ping');
-
-    if (common_config('xmpp', 'enabled')) {
-        $transports = array_merge($transports, array('jabber', 'public'));
-    }
-
-    if (common_config('memcached', 'enabled')) {
-        // Note: limited to 8 chars
-        $transports[] = 'memcache';
-    }
-
-    if (common_config('inboxes', 'enabled') === true ||
-        common_config('inboxes', 'enabled') === 'transitional') {
-        $transports[] = 'inbox';
-    }
-
-    foreach ($transports as $transport) {
-        $qi = new Queue_item();
-        $qi->notice_id = $notice->id;
-        $qi->transport = $transport;
-        $qi->created = $notice->created;
-        $result = $qi->insert();
-        if (!$result) {
-            $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
-            common_log(LOG_ERR, 'DB error inserting queue item: ' . $last_error->message);
-            return false;
+    if (common_config('queue','subsystem') == 'stomp') {
+       // use an external message queue system via STOMP
+       require_once("Stomp.php");
+       $con = new Stomp(common_config('queue','stomp_server'));
+       if (!$con->connect()) {
+               common_log(LOG_ERR, 'Failed to connect to queue server');
+               return false;
+       }
+       $queue_basename = common_config('queue','queue_basename');
+       foreach (array('jabber', 'omb', 'sms', 'public', 'twitter', 'facebook', 'ping') as $transport) {
+               if (!$con->send(
+                       '/queue/'.$queue_basename.'-'.$transport, // QUEUE
+                       $notice->id,            // BODY of the message
+                       array (                 // HEADERS of the msg
+                       'created' => $notice->created
+                       ))) {
+                       common_log(LOG_ERR, 'Error sending to '.$transport.' queue');
+                       return false;
+               }
+        common_log(LOG_DEBUG, 'complete remote queueing notice ID = ' . $notice->id . ' for ' . $transport);
+       }
+
+       //send tags as headers, so they can be used as JMS selectors
+        common_log(LOG_DEBUG, 'searching for tags ' . $notice->id);
+        $tags = array();
+       $tag = new Notice_tag();
+        $tag->notice_id = $notice->id;
+        if ($tag->find()) {
+            while ($tag->fetch()) {
+               common_log(LOG_DEBUG, 'tag found = ' . $tag->tag);
+               array_push($tags,$tag->tag);
+            }
+        }
+        $tag->free();
+
+       $con->send('/topic/laconica.'.$notice->profile_id,
+                       $notice->content,
+                       array(
+                               'profile_id' => $notice->profile_id,
+                               'created' => $notice->created,
+                               'tags' => implode($tags,' - ')
+                               )
+                       );
+        common_log(LOG_DEBUG, 'sent to personal topic ' . $notice->id);
+       $con->send('/topic/laconica.allusers',
+                       $notice->content,
+                       array(
+                               'profile_id' => $notice->profile_id,
+                               'created' => $notice->created,
+                               'tags' => implode($tags,' - ')
+                               )
+                       );
+        common_log(LOG_DEBUG, 'sent to catch-all topic ' . $notice->id);
+       $result = true;
+    }
+    else {
+       // in any other case, 'internal'
+       foreach (array('jabber', 'omb', 'sms', 'public', 'twitter', 'facebook', 'ping') as $transport) {
+               $qi = new Queue_item();
+               $qi->notice_id = $notice->id;
+               $qi->transport = $transport;
+               $qi->created = $notice->created;
+               $result = $qi->insert();
+               if (!$result) {
+                   $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
+                   common_log(LOG_ERR, 'DB error inserting queue item: ' . $last_error->message);
+                   return false;
+               }
+               common_log(LOG_DEBUG, 'complete queueing notice ID = ' . $notice->id . ' for ' . $transport);
         }
-        common_log(LOG_DEBUG, 'complete queueing notice ID = ' . $notice->id . ' for ' . $transport);
     }
     return $result;
 }
@@ -1115,7 +1099,7 @@ function common_accept_to_prefs($accept, $def = '*/*')
 
     foreach($parts as $part) {
         // FIXME: doesn't deal with params like 'text/html; level=1'
-        @list($value, $qpart) = explode(';', $part);
+        @list($value, $qpart) = explode(';', trim($part));
         $match = array();
         if(!isset($qpart)) {
             $prefs[$value] = 1;
diff --git a/plugins/FBConnect/FBCLoginGroupNav.php b/plugins/FBConnect/FBCLoginGroupNav.php
new file mode 100644 (file)
index 0000000..6eb09c3
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Menu for login group of actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Menu
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR . '/lib/widget.php';
+
+/**
+ * Menu for login group of actions
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class FBCLoginGroupNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $this->action->elementStart('dl', array('id' => 'site_nav_local_views'));
+        $this->action->element('dt', null, _('Local views'));
+        $this->action->elementStart('dd');
+
+        // action => array('prompt', 'title')
+        $menu = array();
+
+        $menu['login'] = array(_('Login'),
+                         _('Login with a username and password'));
+
+        if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+            $menu['register'] = array(_('Register'),
+                                _('Sign up for a new account'));
+        }
+
+        $menu['openidlogin'] = array(_('OpenID'),
+                               _('Login or register with OpenID'));
+
+        $menu['FBConnectLogin'] = array(_('Facebook'),
+                               _('Login or register using Facebook'));
+
+        $action_name = $this->action->trimmed('action');
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        foreach ($menu as $menuaction => $menudesc) {
+            $this->action->menuItem(common_local_url($menuaction),
+                                    $menudesc[0],
+                                    $menudesc[1],
+                                    $action_name === $menuaction);
+        }
+
+        $this->action->elementEnd('ul');
+
+        $this->action->elementEnd('dd');
+        $this->action->elementEnd('dl');
+    }
+}
diff --git a/plugins/FBConnect/FBCSettingsNav.php b/plugins/FBConnect/FBCSettingsNav.php
new file mode 100644 (file)
index 0000000..8b84118
--- /dev/null
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Menu for login group of actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Menu
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR . '/lib/widget.php';
+
+/**
+ * A widget for showing the connect group local nav menu
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class FBCSettingsNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+
+        $this->action->elementStart('dl', array('id' => 'site_nav_local_views'));
+        $this->action->element('dt', null, _('Local views'));
+        $this->action->elementStart('dd');
+
+        # action => array('prompt', 'title')
+        $menu =
+          array('imsettings' =>
+                array(_('IM'),
+                      _('Updates by instant messenger (IM)')),
+                'smssettings' =>
+                array(_('SMS'),
+                      _('Updates by SMS')),
+                'twittersettings' =>
+                array(_('Twitter'),
+                      _('Twitter integration options')),
+                'FBConnectSettings' =>
+                array(_('Facebook'),
+                      _('Facebook Connect settings')));
+
+        $action_name = $this->action->trimmed('action');
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        foreach ($menu as $menuaction => $menudesc) {
+            if ($menuaction == 'imsettings' &&
+                !common_config('xmpp', 'enabled')) {
+                continue;
+            }
+            $this->action->menuItem(common_local_url($menuaction),
+                                   $menudesc[0],
+                                   $menudesc[1],
+                                   $action_name === $menuaction);
+        }
+
+        $this->action->elementEnd('ul');
+
+        $this->action->elementEnd('dd');
+        $this->action->elementEnd('dl');
+    }
+}
diff --git a/plugins/FBConnect/FBConnectAuth.php b/plugins/FBConnect/FBConnectAuth.php
new file mode 100644 (file)
index 0000000..4699ce6
--- /dev/null
@@ -0,0 +1,454 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Plugin to enable Facebook Connect
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Plugin
+ * @package   Laconica
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php';
+
+class FBConnectauthAction extends Action
+{
+
+    var $fbuid      = null;
+    var $fb_fields  = null;
+
+    function prepare($args) {
+        parent::prepare($args);
+
+        try {
+
+            $this->fbuid = getFacebook()->get_loggedin_user();
+
+            if ($this->fbuid > 0) {
+                $this->fb_fields = $this->getFacebookFields($this->fbuid,
+                    array('first_name', 'last_name', 'name'));
+            } else {
+                common_debug("No Facebook User found.");
+            }
+
+        } catch (Exception $e) {
+            common_log(LOG_WARNING, 'Problem getting Facebook uid: ' .
+                $e->getMessage());
+        }
+
+        return true;
+    }
+
+    function handle($args)
+    {
+        parent::handle($args);
+
+        if (common_is_real_login()) {
+
+            // User is already logged in.  Does she already have a linked Facebook acct?
+            $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
+
+            if ($flink) {
+
+                // User already has a linked Facebook account and shouldn't be here
+                common_debug('There is already a local user (' . $flink->user_id .
+                    ') linked with this Facebook (' . $this->fbuid . ').');
+
+                // We don't want these cookies
+                getFacebook()->clear_cookie_state();
+
+                $this->clientError(_('There is already a local user linked with this Facebook.'));
+
+            } else {
+
+                // User came from the Facebook connect settings tab, and
+                // probably just wants to link/relink their Facebook account
+                $this->connectUser();
+            }
+
+        } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+
+            $token = $this->trimmed('token');
+            if (!$token || $token != common_session_token()) {
+                $this->showForm(_('There was a problem with your session token. Try again, please.'));
+                return;
+            }
+            if ($this->arg('create')) {
+                if (!$this->boolean('license')) {
+                    $this->showForm(_('You can\'t register if you don\'t agree to the license.'),
+                                    $this->trimmed('newname'));
+                    return;
+                }
+                $this->createNewUser();
+            } else if ($this->arg('connect')) {
+                $this->connectNewUser();
+            } else {
+                common_debug(print_r($this->args, true), __FILE__);
+                $this->showForm(_('Something weird happened.'),
+                                $this->trimmed('newname'));
+            }
+        } else {
+            $this->tryLogin();
+        }
+    }
+
+    function showPageNotice()
+    {
+        if ($this->error) {
+            $this->element('div', array('class' => 'error'), $this->error);
+        } else {
+            $this->element('div', 'instructions',
+                           sprintf(_('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
+        }
+    }
+
+    function title()
+    {
+        return _('Facebook Account Setup');
+    }
+
+    function showForm($error=null, $username=null)
+    {
+        $this->error = $error;
+        $this->username = $username;
+
+        $this->showPage();
+    }
+
+    function showPage()
+    {
+        parent::showPage();
+    }
+
+    function showContent()
+    {
+        if (!empty($this->message_text)) {
+            $this->element('p', null, $this->message);
+            return;
+        }
+
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_facebook_connect',
+                                          'class' => 'form_settings',
+                                          'action' => common_local_url('FBConnectAuth')));
+        $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
+        $this->element('legend', null, _('Connection options'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->element('input', array('type' => 'checkbox',
+                                      'id' => 'license',
+                                      'class' => 'checkbox',
+                                      'name' => 'license',
+                                      'value' => 'true'));
+        $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
+        $this->text(_('My text and files are available under '));
+        $this->element('a', array('href' => common_config('license', 'url')),
+                       common_config('license', 'title'));
+        $this->text(_(' except this private data: password, email address, IM address, phone number.'));
+        $this->elementEnd('label');
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+
+        $this->elementStart('fieldset');
+        $this->hidden('token', common_session_token());
+        $this->element('legend', null,
+                       _('Create new account'));
+        $this->element('p', null,
+                       _('Create a new user with this nickname.'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->input('newname', _('New nickname'),
+                     ($this->username) ? $this->username : '',
+                     _('1-64 lowercase letters or numbers, no punctuation or spaces'));
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('create', _('Create'));
+        $this->elementEnd('fieldset');
+
+        $this->elementStart('fieldset');
+        $this->element('legend', null,
+                       _('Connect existing account'));
+        $this->element('p', null,
+                       _('If you already have an account, login with your username and password to connect it to your Facebook.'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->input('nickname', _('Existing nickname'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->password('password', _('Password'));
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('connect', _('Connect'));
+        $this->elementEnd('fieldset');
+
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
+    }
+
+    function message($msg)
+    {
+        $this->message_text = $msg;
+        $this->showPage();
+    }
+
+    function createNewUser()
+    {
+
+        if (common_config('site', 'closed')) {
+            $this->clientError(_('Registration not allowed.'));
+            return;
+        }
+
+        $invite = null;
+
+        if (common_config('site', 'inviteonly')) {
+            $code = $_SESSION['invitecode'];
+            if (empty($code)) {
+                $this->clientError(_('Registration not allowed.'));
+                return;
+            }
+
+            $invite = Invitation::staticGet($code);
+
+            if (empty($invite)) {
+                $this->clientError(_('Not a valid invitation code.'));
+                return;
+            }
+        }
+
+        $nickname = $this->trimmed('newname');
+
+        if (!Validate::string($nickname, array('min_length' => 1,
+                                               'max_length' => 64,
+                                               'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
+            $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.'));
+            return;
+        }
+
+        if (!User::allowed_nickname($nickname)) {
+            $this->showForm(_('Nickname not allowed.'));
+            return;
+        }
+
+        if (User::staticGet('nickname', $nickname)) {
+            $this->showForm(_('Nickname already in use. Try another one.'));
+            return;
+        }
+
+        $fullname = trim($this->fb_fields['firstname'] .
+            ' ' . $this->fb_fields['lastname']);
+
+        $args = array('nickname' => $nickname, 'fullname' => $fullname);
+
+        if (!empty($invite)) {
+            $args['code'] = $invite->code;
+        }
+
+        $user = User::register($args);
+
+        $result = $this->flinkUser($user->id, $this->fbuid);
+
+        if (!$result) {
+            $this->serverError(_('Error connecting user to Facebook.'));
+            return;
+        }
+
+        common_set_user($user);
+        common_real_login(true);
+
+        common_debug("Registered new user $user->id from Facebook user $this->fbuid");
+
+        common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
+                        303);
+    }
+
+    function connectNewUser()
+    {
+        $nickname = $this->trimmed('nickname');
+        $password = $this->trimmed('password');
+
+        if (!common_check_user($nickname, $password)) {
+            $this->showForm(_('Invalid username or password.'));
+            return;
+        }
+
+        $user = User::staticGet('nickname', $nickname);
+
+        if ($user) {
+            common_debug("Legit user to connect to Facebook: $nickname");
+        }
+
+        $result = $this->flinkUser($user->id, $this->fbuid);
+
+        if (!$result) {
+            $this->serverError(_('Error connecting user to Facebook.'));
+            return;
+        }
+
+        common_debug("Connected Facebook user $this->fbuid to local user $user->id");
+
+        common_set_user($user);
+        common_real_login(true);
+
+        $this->goHome($user->nickname);
+    }
+
+    function connectUser()
+    {
+        $user = common_current_user();
+
+        $result = $this->flinkUser($user->id, $this->fbuid);
+
+        if (!$result) {
+            $this->serverError(_('Error connecting user to Facebook.'));
+            return;
+        }
+
+        common_debug("Connected Facebook user $this->fbuid to local user $user->id");
+
+        // Return to Facebook connection settings tab
+        common_redirect(common_local_url('FBConnectSettings'), 303);
+    }
+
+    function tryLogin()
+    {
+        common_debug("Trying Facebook Login...");
+
+        $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
+
+        if ($flink) {
+            $user = $flink->getUser();
+
+            if ($user) {
+
+                common_debug("Logged in Facebook user $flink->foreign_id as user $user->id ($user->nickname)");
+
+                common_set_user($user);
+                common_real_login(true);
+                $this->goHome($user->nickname);
+            }
+
+        } else {
+
+            common_debug("No flink found for fbuid: $this->fbuid");
+
+            $this->showForm(null, $this->bestNewNickname());
+        }
+    }
+
+    function goHome($nickname)
+    {
+        $url = common_get_returnto();
+        if ($url) {
+            // We don't have to return to it again
+            common_set_returnto(null);
+        } else {
+            $url = common_local_url('all',
+                                    array('nickname' =>
+                                          $nickname));
+        }
+
+        common_redirect($url, 303);
+    }
+
+    function flinkUser($user_id, $fbuid)
+    {
+        $flink = new Foreign_link();
+        $flink->user_id = $user_id;
+        $flink->foreign_id = $fbuid;
+        $flink->service = FACEBOOK_CONNECT_SERVICE;
+        $flink->created = common_sql_now();
+
+        $flink_id = $flink->insert();
+
+        return $flink_id;
+    }
+
+    function bestNewNickname()
+    {
+        if (!empty($this->fb_fields['name'])) {
+            $nickname = $this->nicknamize($this->fb_fields['name']);
+            if ($this->isNewNickname($nickname)) {
+                return $nickname;
+            }
+        }
+
+        // Try the full name
+
+        $fullname = trim($this->fb_fields['firstname'] .
+            ' ' . $this->fb_fields['lastname']);
+
+        if (!empty($fullname)) {
+            $fullname = $this->nicknamize($fullname);
+            if ($this->isNewNickname($fullname)) {
+                return $fullname;
+            }
+        }
+
+        return null;
+    }
+
+     // Given a string, try to make it work as a nickname
+
+     function nicknamize($str)
+     {
+         $str = preg_replace('/\W/', '', $str);
+         return strtolower($str);
+     }
+
+    function isNewNickname($str)
+    {
+        if (!Validate::string($str, array('min_length' => 1,
+                                          'max_length' => 64,
+                                          'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
+            return false;
+        }
+        if (!User::allowed_nickname($str)) {
+            return false;
+        }
+        if (User::staticGet('nickname', $str)) {
+            return false;
+        }
+        return true;
+    }
+
+    // XXX: Consider moving this to lib/facebookutil.php
+    function getFacebookFields($fb_uid, $fields) {
+        try {
+
+            $facebook = getFacebook();
+
+            $infos = $facebook->api_client->users_getInfo($fb_uid, $fields);
+
+            if (empty($infos)) {
+                return null;
+            }
+            return reset($infos);
+
+        } catch (Exception $e) {
+            common_log(LOG_WARNING, "Facebook client failure when requesting " .
+                join(",", $fields) . " on uid " . $fb_uid .
+                    " : ". $e->getMessage());
+            return null;
+        }
+    }
+
+}
diff --git a/plugins/FBConnect/FBConnectLogin.php b/plugins/FBConnect/FBConnectLogin.php
new file mode 100644 (file)
index 0000000..7989dc8
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php';
+
+class FBConnectLoginAction extends Action
+{
+    function handle($args)
+    {
+        parent::handle($args);
+
+        if (common_is_real_login()) {
+            $this->clientError(_('Already logged in.'));
+        }
+
+        $this->showPage();
+    }
+
+    function getInstructions()
+    {
+        return _('Login with your Facebook Account');
+    }
+
+    function showPageNotice()
+    {
+        $instr = $this->getInstructions();
+        $output = common_markup_to_html($instr);
+        $this->elementStart('div', 'instructions');
+        $this->raw($output);
+        $this->elementEnd('div');
+    }
+
+    function title()
+    {
+        return _('Facebook Login');
+    }
+
+    function showContent() {
+
+        $this->elementStart('fieldset');
+
+
+        $this->element('fb:login-button', array('onlogin' => 'goto_login()',
+            'length' => 'long'));
+
+        $this->elementEnd('fieldset');
+    }
+
+}
diff --git a/plugins/FBConnect/FBConnectPlugin.css b/plugins/FBConnect/FBConnectPlugin.css
new file mode 100644 (file)
index 0000000..564fdae
--- /dev/null
@@ -0,0 +1,37 @@
+/** Styles for Facebook logo and Facebook user profile avatar.
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+#site_nav_global_primary #nav_fb {
+position:relative;
+margin-left:18px;
+margin-right:-7px;
+}
+
+#nav_fb .fb_profile_pic_rendered img {
+position:relative;
+top:3px;
+left:0;
+display:inline;
+border:1px solid #3B5998;
+padding:1px;
+}
+
+#nav_fb img {
+position:absolute;
+top:-13px;
+left:-11px;
+display:inline;
+}
+
+#settings_facebook_connect_options legend {
+display:none;
+}
+#form_settings_facebook_connect fieldset fieldset legend {
+display:block;
+}
diff --git a/plugins/FBConnect/FBConnectPlugin.php b/plugins/FBConnect/FBConnectPlugin.php
new file mode 100644 (file)
index 0000000..c85ef43
--- /dev/null
@@ -0,0 +1,288 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Plugin to enable Facebook Connect
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Plugin
+ * @package   Laconica
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+define("FACEBOOK_CONNECT_SERVICE", 3);
+
+require_once INSTALLDIR . '/lib/facebookutil.php';
+require_once INSTALLDIR . '/plugins/FBConnect/FBConnectAuth.php';
+require_once INSTALLDIR . '/plugins/FBConnect/FBConnectLogin.php';
+require_once INSTALLDIR . '/plugins/FBConnect/FBConnectSettings.php';
+require_once INSTALLDIR . '/plugins/FBConnect/FBCLoginGroupNav.php';
+require_once INSTALLDIR . '/plugins/FBConnect/FBCSettingsNav.php';
+
+/**
+ * Plugin to enable Facebook Connect
+ *
+ * @category Plugin
+ * @package  Laconica
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class FBConnectPlugin extends Plugin
+{
+    function __construct()
+    {
+        parent::__construct();
+    }
+
+    // Hook in new actions
+    function onRouterInitialized(&$m) {
+        $m->connect('main/facebookconnect', array('action' => 'FBConnectAuth'));
+        $m->connect('main/facebooklogin', array('action' => 'FBConnectLogin'));
+        $m->connect('settings/facebook', array('action' => 'FBConnectSettings'));
+     }
+
+    // Add in xmlns:fb
+    function onStartShowHTML($action)
+    {
+        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ?
+        $_SERVER['HTTP_ACCEPT'] : null;
+
+        // XXX: allow content negotiation for RDF, RSS, or XRDS
+
+        $cp = common_accept_to_prefs($httpaccept);
+        $sp = common_accept_to_prefs(PAGE_TYPE_PREFS);
+
+        $type = common_negotiate_type($cp, $sp);
+
+        if (!$type) {
+            throw new ClientException(_('This page is not available in a '.
+                                         'media type you accept'), 406);
+        }
+
+        header('Content-Type: '.$type);
+
+        $action->extraHeaders();
+
+        $action->startXML('html',
+            '-//W3C//DTD XHTML 1.0 Strict//EN',
+            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+
+        $language = $action->getLanguage();
+
+        $action->elementStart('html',
+            array('xmlns'  => 'http://www.w3.org/1999/xhtml',
+                  'xmlns:fb' => 'http://www.facebook.com/2008/fbml',
+                  'xml:lang' => $language,
+                  'lang'     => $language));
+
+        return false;
+    }
+
+    function onEndShowLaconicaScripts($action)
+    {
+        $action->element('script',
+            array('type' => 'text/javascript',
+                  'src'  => 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php'),
+                  ' ');
+
+        $apikey = common_config('facebook', 'apikey');
+        $plugin_path = common_path('plugins/FBConnect');
+
+        $login_url = common_local_url('FBConnectAuth');
+        $logout_url = common_local_url('logout');
+
+        $html = sprintf('<script type="text/javascript">FB.init("%s", "%s/xd_receiver.htm");
+
+                            function goto_login() {
+                                window.location = "%s";
+                            }
+
+                            function goto_logout() {
+                                window.location = "%s";
+                            }
+
+                         </script>', $apikey, $plugin_path, $login_url, $logout_url);
+
+
+        $action->raw($html);
+    }
+
+    function onEndShowLaconicaStyles($action)
+    {
+        $action->element('link', array('rel' => 'stylesheet',
+            'type' => 'text/css',
+            'href' => common_path('plugins/FBConnect/FBConnectPlugin.css')));
+    }
+
+    function onStartPrimaryNav($action)
+    {
+        $user = common_current_user();
+
+        if ($user) {
+
+            $flink = Foreign_link::getByUserId($user->id, FACEBOOK_CONNECT_SERVICE);
+            $fbuid = 0;
+
+            if ($flink) {
+
+                try {
+
+                    $facebook = getFacebook();
+                    $fbuid = getFacebook()->get_loggedin_user();
+
+                } catch (Exception $e) {
+                    common_log(LOG_WARNING,
+                        'Problem getting Facebook client: ' .
+                            $e->getMessage());
+                }
+
+                // Display Facebook Logged in indicator w/Facebook favicon
+
+                if ($fbuid > 0) {
+
+                    $action->elementStart('li', array('id' => 'nav_fb'));
+                    $action->elementStart('fb:profile-pic', array('uid' => $flink->foreign_id,
+                        'linked' => 'false',
+                        'width' => 16,
+                        'height' => 16));
+                    $action->elementEnd('fb:profile-pic');
+
+                    $iconurl =  common_path('/plugins/FBConnect/fbfavicon.ico');
+                    $action->element('img', array('src' => $iconurl));
+
+                    $action->elementEnd('li');
+
+                }
+            }
+
+            $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
+                _('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
+            $action->menuItem(common_local_url('profilesettings'),
+                _('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
+            if (common_config('xmpp', 'enabled')) {
+                $action->menuItem(common_local_url('imsettings'),
+                    _('Connect'), _('Connect to IM, SMS, Twitter'), false, 'nav_connect');
+            } else {
+             $action->menuItem(common_local_url('smssettings'),
+                 _('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
+            }
+            $action->menuItem(common_local_url('invite'),
+                _('Invite'),
+                sprintf(_('Invite friends and colleagues to join you on %s'),
+                common_config('site', 'name')),
+                false, 'nav_invitecontact');
+
+            // Need to override the Logout link to make it do FB stuff
+            if ($flink && $fbuid > 0) {
+
+                $logout_url = common_local_url('logout');
+                $title =  _('Logout from the site');
+                $text = _('Logout');
+
+                $html = sprintf('<li id="nav_logout"><a href="%s" title="%s" ' .
+                    'onclick="FB.Connect.logout(function() { goto_logout() })">%s</a></li>',
+                    $logout_url, $title, $text);
+
+                $action->raw($html);
+
+             } else {
+                 $action->menuItem(common_local_url('logout'),
+                     _('Logout'), _('Logout from the site'), false, 'nav_logout');
+             }
+         }
+         else {
+             if (!common_config('site', 'closed')) {
+                 $action->menuItem(common_local_url('register'),
+                     _('Register'), _('Create an account'), false, 'nav_register');
+             }
+             $action->menuItem(common_local_url('openidlogin'),
+                 _('OpenID'), _('Login with OpenID'), false, 'nav_openid');
+             $action->menuItem(common_local_url('login'),
+                 _('Login'), _('Login to the site'), false, 'nav_login');
+         }
+
+         $action->menuItem(common_local_url('doc', array('title' => 'help')),
+             _('Help'), _('Help me!'), false, 'nav_help');
+         $action->menuItem(common_local_url('peoplesearch'),
+             _('Search'), _('Search for people or text'), false, 'nav_search');
+
+        return false;
+    }
+
+    function onStartShowLocalNavBlock($action)
+    {
+        $action_name = get_class($action);
+
+        $login_actions = array('LoginAction', 'RegisterAction',
+            'OpenidloginAction', 'FBConnectLoginAction');
+
+        if (in_array($action_name, $login_actions)) {
+            $nav = new FBCLoginGroupNav($action);
+            $nav->show();
+            return false;
+        }
+
+        $connect_actions = array('SmssettingsAction',
+            'TwittersettingsAction', 'FBConnectSettingsAction');
+
+        if (in_array($action_name, $connect_actions)) {
+            $nav = new FBCSettingsNav($action);
+            $nav->show();
+            return false;
+        }
+
+        return true;
+    }
+
+    function onStartLogout($action)
+    {
+        $user = common_current_user();
+
+        $flink = Foreign_link::getByUserId($user->id, FACEBOOK_CONNECT_SERVICE);
+
+        $action->logout();
+
+        if ($flink) {
+
+            $facebook = getFacebook();
+
+            try {
+                $fbuid = $facebook->get_loggedin_user();
+
+                if ($fbuid > 0) {
+                    $facebook->logout(common_local_url('public'));
+                }
+
+            } catch (Exception $e) {
+                common_log(LOG_WARNING, 'Could\'t logout of Facebook: ' .
+                    $e->getMessage());
+            }
+        }
+
+        return true;
+    }
+
+}
diff --git a/plugins/FBConnect/FBConnectSettings.php b/plugins/FBConnect/FBConnectSettings.php
new file mode 100644 (file)
index 0000000..034eceb
--- /dev/null
@@ -0,0 +1,203 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Facebook Connect settings
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/connectsettingsaction.php';
+
+/**
+ * Facebook Connect settings action
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class FBConnectSettingsAction extends ConnectSettingsAction
+{
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
+    {
+        return _('Facebook Connect Settings');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
+    {
+        return _('Manage how your account connects to Facebook');
+    }
+
+    /**
+     * Content area of the page
+     *
+     * Shows a form for uploading an avatar.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $user = common_current_user();
+        $flink = Foreign_link::getByUserID($user->id, FACEBOOK_CONNECT_SERVICE);
+
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_facebook',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('FBConnectSettings')));
+
+        if (!$flink) {
+
+            $this->element('p', 'instructions',
+                _('There is no Facebook user connected to this account.'));
+
+            $this->element('fb:login-button', array('onlogin' => 'goto_login()',
+                'length' => 'long'));
+
+        } else {
+
+            $this->element('p', 'form_note',
+                           _('Connected Facebook user'));
+
+            $this->elementStart('p', array('class' => 'facebook-user-display'));
+            $this->elementStart('fb:profile-pic',
+                array('uid' => $flink->foreign_id,
+                      'size' => 'small',
+                      'linked' => 'true',
+                      'facebook-logo' => 'true'));
+            $this->elementEnd('fb:profile-pic');
+
+            $this->elementStart('fb:name', array('uid' => $flink->foreign_id,
+                                                 'useyou' => 'false'));
+            $this->elementEnd('fb:name');
+            $this->elementEnd('p');
+
+            $this->hidden('token', common_session_token());
+
+            $this->elementStart('fieldset');
+
+            $this->element('legend', null, _('Disconnect my account from Facebook'));
+
+            if (!$user->password) {
+
+                $this->elementStart('p', array('class' => 'form_guide'));
+                $this->text(_('Disconnecting your Faceboook ' .
+                              'would make it impossible to log in! Please '));
+                $this->element('a',
+                    array('href' => common_local_url('passwordsettings')),
+                        _('set a password'));
+
+                $this->text(_(' first.'));
+                $this->elementEnd('p');
+            } else {
+
+                $note = 'Keep your %s account but disconnect from Facebook. ' .
+                    'You\'ll use your %s password to log in.';
+
+                $site = common_config('site', 'name');
+
+                $this->element('p', 'instructions',
+                    sprintf($note, $site, $site));
+
+                $this->submit('disconnect', _('Disconnect'));
+            }
+
+            $this->elementEnd('fieldset');
+        }
+
+        $this->elementEnd('form');
+    }
+
+    /**
+     * Handle post
+     *
+     * Disconnects the current Facebook user from the current user's account
+     *
+     * @return void
+     */
+
+    function handlePost()
+    {
+        // CSRF protection
+        $token = $this->trimmed('token');
+        if (!$token || $token != common_session_token()) {
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
+            return;
+        }
+
+        if ($this->arg('disconnect')) {
+
+            $user = common_current_user();
+
+            $flink = Foreign_link::getByUserID($user->id, FACEBOOK_CONNECT_SERVICE);
+            $result = $flink->delete();
+
+            if ($result === false) {
+                common_log_db_error($user, 'DELETE', __FILE__);
+                $this->serverError(_('Couldn\'t delete link to Facebook.'));
+                return;
+            }
+
+            try {
+
+                // Clear FB Connect cookies out
+                $facebook = getFacebook();
+                $facebook->clear_cookie_state();
+
+            } catch (Exception $e) {
+                common_log(LOG_WARNING,
+                    'Couldn\'t clear Facebook cookies: ' .
+                        $e->getMessage());
+            }
+
+            $this->showForm(_('You have disconnected from Facebook.'), true);
+
+        } else {
+            $this->showForm(_('Not sure what you\'re trying to do.'));
+            return;
+        }
+
+    }
+
+}
diff --git a/plugins/FBConnect/fbfavicon.ico b/plugins/FBConnect/fbfavicon.ico
new file mode 100644 (file)
index 0000000..c57c034
Binary files /dev/null and b/plugins/FBConnect/fbfavicon.ico differ
diff --git a/plugins/FBConnect/xd_receiver.htm b/plugins/FBConnect/xd_receiver.htm
new file mode 100644 (file)
index 0000000..43fb2c4
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+    <title>cross domain receiver page</title>
+</head>
+<body>
+    <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.debug.js" type="text/javascript"></script>
+</body>
+</html>
index 482e63af70b712873b67e850c64356c97f95a979..a10233e69fcc2ce453a969118eccd867c37c63f7 100755 (executable)
@@ -44,6 +44,9 @@ if(common_config('xmpp','enabled')) {
 if(common_config('memcached','enabled')) {
     echo "memcachedqueuehandler.php ";
 }
+if(common_config('twitterbridge','enabled')) {
+    echo "twitterstatusfetcher.php ";
+}
 echo "ombqueuehandler.php ";
 echo "twitterqueuehandler.php ";
 echo "facebookqueuehandler.php ";
diff --git a/scripts/reportsnapshot.php b/scripts/reportsnapshot.php
new file mode 100644 (file)
index 0000000..e332d85
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env php
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2009, Control Yourself, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+# Abort if called from a web server
+if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+    print "This script must be run from the command line\n";
+    exit(1);
+}
+
+ini_set("max_execution_time", "0");
+ini_set("max_input_time", "0");
+set_time_limit(0);
+mb_internal_encoding('UTF-8');
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('LACONICA', true);
+
+require_once(INSTALLDIR . '/lib/common.php');
+
+Snapshot::check();
index f6d71eddfb466370bf6d0fd91850ff3667951f84..764037e8ff0bb4f06d7d6041d0f06437ab22d748 100755 (executable)
@@ -25,7 +25,7 @@ DIR=`php $SDIR/getpiddir.php`
 
 for f in jabberhandler ombhandler publichandler smshandler pinghandler \
         xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \
-         memcachehandler inboxhandler; do
+         memcachehandler inboxhandler twitterstatusfetcher; do
 
        FILES="$DIR/$f.*.pid"
        for ff in "$FILES" ; do
diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php
new file mode 100755 (executable)
index 0000000..a61ce1b
--- /dev/null
@@ -0,0 +1,577 @@
+#!/usr/bin/env php
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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.     See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Abort if called from a web server
+if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+    print "This script must be run from the command line\n";
+    exit();
+}
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('LACONICA', true);
+
+// Tune number of processes and how often to poll Twitter
+// XXX: Should these things be in config.php?
+define('MAXCHILDREN', 2);
+define('POLL_INTERVAL', 60); // in seconds
+
+// Uncomment this to get useful logging
+define('SCRIPT_DEBUG', true);
+
+require_once(INSTALLDIR . '/lib/common.php');
+require_once(INSTALLDIR . '/lib/daemon.php');
+
+class TwitterStatusFetcher extends Daemon
+{
+
+    private $children = array();
+
+    function name()
+    {
+        return ('twitterstatusfetcher.generic');
+    }
+
+    function run()
+    {
+        do {
+
+            $flinks = $this->refreshFlinks();
+
+            foreach ($flinks as $f){
+
+                // We have to disconnect from the DB before forking so
+                // each sub-process will open its own connection and
+                // avoid stomping on the others
+
+                $conn = &$f->getDatabaseConnection();
+                $conn->disconnect();
+
+                $pid = pcntl_fork();
+
+                if ($pid == -1) {
+                    die ("Couldn't fork!");
+                }
+
+                if ($pid) {
+
+                    // Parent
+                    if (defined('SCRIPT_DEBUG')) {
+                        common_debug("Parent: forked new status fetcher process " . $pid);
+                    }
+
+                    $this->children[] = $pid;
+
+                } else {
+
+                    // Child
+                    $this->getTimeline($f);
+                    exit();
+                }
+
+                // Remove child from ps list as it finishes
+                while(($c = pcntl_wait($status, WNOHANG OR WUNTRACED)) > 0) {
+
+                    if (defined('SCRIPT_DEBUG')) {
+                        common_debug("Child $c finished.");
+                    }
+
+                    $this->remove_ps($this->children, $c);
+                }
+
+                // Wait! We have too many damn kids.
+                if (sizeof($this->children) > MAXCHILDREN) {
+
+                    if (defined('SCRIPT_DEBUG')) {
+                        common_debug('Too many children. Waiting...');
+                    }
+
+                    if (($c = pcntl_wait($status, WUNTRACED)) > 0){
+
+                        if (defined('SCRIPT_DEBUG')) {
+                            common_debug("Finished waiting for $c");
+                        }
+
+                        $this->remove_ps($this->children, $c);
+                    }
+                }
+            }
+
+            // Remove all children from the process list before restarting
+            while(($c = pcntl_wait($status, WUNTRACED)) > 0) {
+
+                if (defined('SCRIPT_DEBUG')) {
+                    common_debug("Child $c finished.");
+                }
+
+                $this->remove_ps($this->children, $c);
+            }
+
+            // Rest for a bit before we fetch more statuses
+
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug('Waiting ' . POLL_INTERVAL .
+                    ' secs before hitting Twitter again.');
+            }
+
+            if (POLL_INTERVAL > 0) {
+                sleep(POLL_INTERVAL);
+            }
+
+        } while (true);
+    }
+
+    function refreshFlinks() {
+
+        $flink = new Foreign_link();
+        $flink->service = 1; // Twitter
+        $flink->orderBy('last_noticesync');
+
+        $cnt = $flink->find();
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug('Updating Twitter friends subscriptions' .
+                " for $cnt users.");
+        }
+
+        $flinks = array();
+
+        while ($flink->fetch()) {
+
+            if (($flink->noticesync & FOREIGN_NOTICE_RECV) ==
+                FOREIGN_NOTICE_RECV) {
+                $flinks[] = clone($flink);
+            }
+        }
+
+        $flink->free();
+        unset($flink);
+
+        return $flinks;
+    }
+
+    function remove_ps(&$plist, $ps){
+        for ($i = 0; $i < sizeof($plist); $i++) {
+            if ($plist[$i] == $ps) {
+                unset($plist[$i]);
+                $plist = array_values($plist);
+                break;
+            }
+        }
+    }
+
+    function getTimeline($flink)
+    {
+
+        if (empty($flink)) {
+            common_log(LOG_WARNING,
+                "Can't retrieve Foreign_link for foreign ID $fid");
+            return;
+        }
+
+        $fuser = $flink->getForeignUser();
+
+        if (empty($fuser)) {
+            common_log(LOG_WARNING, "Unmatched user for ID " .
+                $flink->user_id);
+            return;
+        }
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug('Trying to get timeline for Twitter user ' .
+                "$fuser->nickname ($flink->foreign_id).");
+        }
+
+        // XXX: Biggest remaining issue - How do we know at which status
+        // to start importing?  How many statuses?  Right now I'm going
+        // with the default last 20.
+
+        $url = 'http://twitter.com/statuses/friends_timeline.json';
+
+        $timeline_json = get_twitter_data($url, $fuser->nickname,
+            $flink->credentials);
+
+        $timeline = json_decode($timeline_json);
+
+        if (empty($timeline)) {
+            common_log(LOG_WARNING, "Empty timeline.");
+            return;
+        }
+
+        // Reverse to preserve order
+        foreach (array_reverse($timeline) as $status) {
+
+            // Hacktastic: filter out stuff coming from this Laconica
+            $source = mb_strtolower(common_config('integration', 'source'));
+
+            if (preg_match("/$source/", mb_strtolower($status->source))) {
+                if (defined('SCRIPT_DEBUG')) {
+                    common_debug('Skipping import of status ' . $status->id .
+                        ' with source ' . $source);
+                }
+                continue;
+            }
+
+            $this->saveStatus($status, $flink);
+        }
+
+        // Okay, record the time we synced with Twitter for posterity
+        $flink->last_noticesync = common_sql_now();
+        $flink->update();
+    }
+
+    function saveStatus($status, $flink)
+    {
+        $id = $this->ensureProfile($status->user);
+        $profile = Profile::staticGet($id);
+
+        if (!$profile) {
+            common_log(LOG_ERR,
+                'Problem saving notice. No associated Profile.');
+            return null;
+        }
+
+        $uri = 'http://twitter.com/' . $status->user->screen_name .
+            '/status/' . $status->id;
+
+        $notice = Notice::staticGet('uri', $uri);
+
+        // check to see if we've already imported the status
+        if (!$notice) {
+
+            $notice = new Notice();
+            $notice->profile_id = $id;
+
+            $notice->query('BEGIN');
+
+            // XXX: figure out reply_to
+            $notice->reply_to = null;
+
+            // XXX: Should this be common_sql_now() instead of status create date?
+
+            $notice->created = strftime('%Y-%m-%d %H:%M:%S',
+                strtotime($status->created_at));
+            $notice->content = $status->text;
+            $notice->rendered = common_render_content($status->text, $notice);
+            $notice->source = 'twitter';
+            $notice->is_local = 0;
+            $notice->uri = $uri;
+
+            $notice_id = $notice->insert();
+
+            if (!$notice_id) {
+                common_log_db_error($notice, 'INSERT', __FILE__);
+                if (defined('SCRIPT_DEBUG')) {
+                    common_debug('Could not save notice!');
+                }
+            }
+
+            // XXX: Figure out a better way to link Twitter replies?
+            $notice->saveReplies();
+
+            // XXX: Do we want to pollute our tag cloud with
+            // hashtags from Twitter?
+            $notice->saveTags();
+            $notice->saveGroups();
+
+            $notice->query('COMMIT');
+
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug("Saved status $status->id" .
+                    " as notice $notice->id.");
+            }
+        }
+
+        if (!Notice_inbox::staticGet('notice_id', $notice->id)) {
+
+            // Add to inbox
+            $inbox = new Notice_inbox();
+            $inbox->user_id = $flink->user_id;
+            $inbox->notice_id = $notice->id;
+            $inbox->created = common_sql_now();
+
+            $inbox->insert();
+        }
+    }
+
+    function ensureProfile($user)
+    {
+        // check to see if there's already a profile for this user
+        $profileurl = 'http://twitter.com/' . $user->screen_name;
+        $profile = Profile::staticGet('profileurl', $profileurl);
+
+        if ($profile) {
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug("Profile for $profile->nickname found.");
+            }
+
+            // Check to see if the user's Avatar has changed
+            $this->checkAvatar($user, $profile);
+
+            return $profile->id;
+
+        } else {
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug('Adding profile and remote profile ' .
+                    "for Twitter user: $profileurl");
+            }
+
+            $profile = new Profile();
+            $profile->query("BEGIN");
+
+            $profile->nickname = $user->screen_name;
+            $profile->fullname = $user->name;
+            $profile->homepage = $user->url;
+            $profile->bio = $user->description;
+            $profile->location = $user->location;
+            $profile->profileurl = $profileurl;
+            $profile->created = common_sql_now();
+
+            $id = $profile->insert();
+
+            if (empty($id)) {
+                common_log_db_error($profile, 'INSERT', __FILE__);
+                $profile->query("ROLLBACK");
+                return false;
+            }
+
+            // check for remote profile
+            $remote_pro = Remote_profile::staticGet('uri', $profileurl);
+
+            if (!$remote_pro) {
+
+                $remote_pro = new Remote_profile();
+
+                $remote_pro->id = $id;
+                $remote_pro->uri = $profileurl;
+                $remote_pro->created = common_sql_now();
+
+                $rid = $remote_pro->insert();
+
+                if (empty($rid)) {
+                    common_log_db_error($profile, 'INSERT', __FILE__);
+                    $profile->query("ROLLBACK");
+                    return false;
+                }
+            }
+
+            $profile->query("COMMIT");
+
+            $this->saveAvatars($user, $id);
+
+            return $id;
+        }
+    }
+
+    function checkAvatar($user, $profile)
+    {
+        global $config;
+
+        $path_parts = pathinfo($user->profile_image_url);
+        $newname = 'Twitter_' . $user->id . '_' .
+            $path_parts['basename'];
+
+        $oldname = $profile->getAvatar(48)->filename;
+
+        if ($newname != $oldname) {
+
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug('Avatar for Twitter user ' .
+                    "$profile->nickname has changed.");
+                common_debug("old: $oldname new: $newname");
+            }
+
+            $img_root = substr($path_parts['basename'], 0, -11);
+            $ext = $path_parts['extension'];
+            $mediatype = $this->getMediatype($ext);
+
+            foreach (array('mini', 'normal', 'bigger') as $size) {
+                $url = $path_parts['dirname'] . '/' .
+                    $img_root . '_' . $size . ".$ext";
+                $filename = 'Twitter_' . $user->id . '_' .
+                    $img_root . "_$size.$ext";
+
+                if ($this->fetchAvatar($url, $filename)) {
+                    $this->updateAvatar($profile->id, $size, $mediatype, $filename);
+                }
+            }
+        }
+    }
+
+    function getMediatype($ext)
+    {
+        $mediatype = null;
+
+        switch (strtolower($ext)) {
+        case 'jpg':
+            $mediatype = 'image/jpg';
+            break;
+        case 'gif':
+            $mediatype = 'image/gif';
+            break;
+        default:
+            $mediatype = 'image/png';
+        }
+
+        return $mediatype;
+    }
+
+    function saveAvatars($user, $id)
+    {
+        global $config;
+
+        $path_parts = pathinfo($user->profile_image_url);
+        $ext = $path_parts['extension'];
+        $end = strlen('_normal' . $ext);
+        $img_root = substr($path_parts['basename'], 0, -($end+1));
+        $mediatype = $this->getMediatype($ext);
+
+        foreach (array('mini', 'normal', 'bigger') as $size) {
+            $url = $path_parts['dirname'] . '/' .
+                $img_root . '_' . $size . ".$ext";
+            $filename = 'Twitter_' . $user->id . '_' .
+                $img_root . "_$size.$ext";
+
+            if ($this->fetchAvatar($url, $filename)) {
+                $this->newAvatar($id, $size, $mediatype, $filename);
+            } else {
+                common_log(LOG_WARNING, "Problem fetching Avatar: $url", __FILE__);
+            }
+        }
+    }
+
+    function updateAvatar($profile_id, $size, $mediatype, $filename) {
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug("Updating avatar: $size");
+        }
+
+        $profile = Profile::staticGet($profile_id);
+
+        if (!$profile) {
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug("Couldn't get profile: $profile_id!");
+            }
+            return;
+        }
+
+        $sizes = array('mini' => 24, 'normal' => 48, 'bigger' => 73);
+        $avatar = $profile->getAvatar($sizes[$size]);
+
+        if ($avatar) {
+            if (defined('SCRIPT_DEBUG')) {
+                common_debug("Deleting $size avatar for $profile->nickname.");
+            }
+            @unlink(INSTALLDIR . '/avatar/' . $avatar->filename);
+            $avatar->delete();
+        }
+
+        $this->newAvatar($profile->id, $size, $mediatype, $filename);
+    }
+
+    function newAvatar($profile_id, $size, $mediatype, $filename)
+    {
+        global $config;
+
+        $avatar = new Avatar();
+        $avatar->profile_id = $profile_id;
+
+        switch($size) {
+        case 'mini':
+            $avatar->width  = 24;
+            $avatar->height = 24;
+            break;
+        case 'normal':
+            $avatar->width  = 48;
+            $avatar->height = 48;
+            break;
+        default:
+
+            // Note: Twitter's big avatars are a different size than
+            // Laconica's (Laconica's = 96)
+
+            $avatar->width  = 73;
+            $avatar->height = 73;
+        }
+
+        $avatar->original = 0; // we don't have the original
+        $avatar->mediatype = $mediatype;
+        $avatar->filename = $filename;
+        $avatar->url = Avatar::url($filename);
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug("new filename: $avatar->url");
+        }
+
+        $avatar->created = common_sql_now();
+
+        $id = $avatar->insert();
+
+        if (!$id) {
+            common_log_db_error($avatar, 'INSERT', __FILE__);
+            return null;
+        }
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug("Saved new $size avatar for $profile_id.");
+        }
+
+        return $id;
+    }
+
+    function fetchAvatar($url, $filename)
+    {
+        $avatar_dir = INSTALLDIR . '/avatar/';
+
+        $avatarfile = $avatar_dir . $filename;
+
+        $out = fopen($avatarfile, 'wb');
+        if (!$out) {
+            common_log(LOG_WARNING, "Couldn't open file $filename", __FILE__);
+            return false;
+        }
+
+        if (defined('SCRIPT_DEBUG')) {
+            common_debug("Fetching avatar: $url");
+        }
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_FILE, $out);
+        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
+        $result = curl_exec($ch);
+        curl_close($ch);
+
+        fclose($out);
+
+        return $result;
+    }
+}
+
+ini_set("max_execution_time", "0");
+ini_set("max_input_time", "0");
+set_time_limit(0);
+mb_internal_encoding('UTF-8');
+declare(ticks = 1);
+
+$fetcher = new TwitterStatusFetcher();
+$fetcher->runOnce();
+
index 8029a5eee17266e4a0cdd2ff0443ce03db8b56ca..e3c499a5ed12bfb6ceac0b20bc86551228f116b0 100644 (file)
@@ -198,9 +198,11 @@ padding:0 7px;
 }
 
 
+.form_settings input.form_action-primary {
+padding:0;
+}
 .form_settings input.form_action-secondary {
 margin-left:29px;
-padding:0;
 }
 
 #form_search .submit {
@@ -248,10 +250,10 @@ display:none;
 }
 
 #site_notice {
-position:absolute;
-top:65px;
-right:18px;
-width:250px;
+float:right;
+clear:right;
+margin-top:7px;
+margin-right:18px;
 width:24%;
 }
 #page_notice {
@@ -397,6 +399,9 @@ border-radius:7px;
 border-style:solid;
 border-width:1px;
 }
+#shownotice #content {
+min-height:0;
+}
 
 #content_inner {
 position:relative;
@@ -636,6 +641,7 @@ margin-bottom:29px;
 clear:both;
 float:left;
 width:100%;
+list-style-position:inside;
 }
 .aside .section h2 {
 text-transform:uppercase;
@@ -659,6 +665,7 @@ list-style-type:none;
 float:left;
 margin-right:7px;
 margin-bottom:7px;
+display:inline;
 }
 .section .entities li .photo {
 margin-right:0;
@@ -730,17 +737,19 @@ clear:both;
 float:left;
 width:100%;
 border-top-width:1px;
-border-top-style:dashed;
+border-top-style:dotted;
 }
 .notices li {
 list-style-type:none;
 }
-.notices li.hover {
-border-radius:4px;
--moz-border-radius:4px;
--webkit-border-radius:4px;
+.notices .notices {
+margin-top:7px;
+margin-left:5%;
+width:95%;
+float:left;
 }
 
+
 /* NOTICES */
 #notices_primary {
 float:left;
@@ -769,16 +778,14 @@ overflow:hidden;
 font-weight:bold;
 }
 
-.notice .author .photo {
-margin-bottom:0;
-}
-
 .vcard .photo {
 display:inline;
 margin-right:11px;
-margin-bottom:11px;
 float:left;
 }
+#shownotice .vcard .photo {
+margin-bottom:4px;
+}
 .vcard .url {
 text-decoration:none;
 }
@@ -791,6 +798,9 @@ float:left;
 width:100%;
 overflow:hidden;
 }
+.notice .entry-title.ov {
+overflow:visible;
+}
 #shownotice .notice .entry-title {
 font-size:2.2em;
 }
@@ -815,9 +825,10 @@ clear:left;
 float:left;
 font-size:0.95em;
 margin-left:59px;
-width:70%;
+width:60%;
 }
-#showstream .notice div.entry-content {
+#showstream .notice div.entry-content,
+#shownotice .notice div.entry-content {
 margin-left:0;
 }
 
@@ -844,15 +855,12 @@ display:inline-block;
 text-transform:lowercase;
 }
 
-
 .notice-options {
-padding-left:2%;
-float:left;
-width:50%;
 position:relative;
 font-size:0.95em;
-width:12.5%;
+width:90px;
 float:right;
+margin-right:11px;
 }
 
 .notice-options a {
@@ -914,6 +922,67 @@ padding:0;
 }
 
 
+.notice .attachment {
+position:relative;
+padding-left:16px;
+}
+#attachments .attachment {
+padding-left:0;
+}
+.notice .attachment img {
+position:absolute;
+top:18px;
+left:0;
+z-index:99;
+}
+#shownotice .notice .attachment img {
+position:static;
+}
+
+#attachments {
+clear:both;
+float:left;
+width:100%;
+margin-top:18px;
+}
+#attachments dt {
+font-weight:bold;
+font-size:1.3em;
+margin-bottom:4px;
+}
+
+#attachments li {
+margin-bottom:18px;
+list-style-type:decimal;
+float:left;
+clear:both;
+}
+
+#jOverlayContent,
+#jOverlayContent #content,
+#jOverlayContent #content_inner {
+width: auto !important;
+}
+#jOverlayContent .external span {
+display:block;
+margin-bottom:11px;
+}
+#jOverlayContent button {
+position:absolute;
+top:0;
+right:0;
+padding:3px 4px;
+font-weight:bold;
+}
+#jOverlayContent h1 {
+max-width:475px;
+}
+#jOverlayContent #content {
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+
 #usergroups #new_group {
 float: left;
 margin-right: 2em;
@@ -1036,11 +1105,9 @@ margin-left:18px;
 }
 
 
-
-
 /* TOP_POSTERS */
 .section tbody td {
-padding-right:11px;
+padding-right:18px;
 padding-bottom:11px;
 }
 .section .vcard .photo {
@@ -1148,6 +1215,29 @@ clear:both;
 margin-bottom:0;
 }
 
+#form_settings_design #settings_design_color .form_data,
+#form_settings_design #color-picker {
+float:left;
+}
+#form_settings_design #settings_design_color .form_data {
+width:400px;
+margin-right:28px;
+}
+
+#settings_design_color .form_data li {
+width:33%;
+}
+#settings_design_color .form_data label {
+float:none;
+}
+#settings_design_color .form_data .swatch {
+padding:11px;
+margin-left:0;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
 .instructions p,
 .instructions ul {
 margin-bottom:18px;
index 163b41fb4caa1e96ee857d0371db10dabb003436..e6b1c9ee536ada46cdf3ce77c08b64245271813b 100644 (file)
@@ -1,6 +1,3 @@
-@import url("display.css");
-@import url("../../identica/css/display.css");
-
 * {
 font-size:14px;
 font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
diff --git a/theme/base/css/farbtastic.css b/theme/base/css/farbtastic.css
new file mode 100644 (file)
index 0000000..7efcc73
--- /dev/null
@@ -0,0 +1,32 @@
+.farbtastic {
+  position: relative;
+}
+.farbtastic * {
+  position: absolute;
+  cursor: crosshair;
+}
+.farbtastic, .farbtastic .wheel {
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .color, .farbtastic .overlay {
+  top: 47px;
+  left: 47px;
+  width: 101px;
+  height: 101px;
+}
+.farbtastic .wheel {
+  background: url(../../../js/farbtastic/wheel.png) no-repeat;
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .overlay {
+  background: url(../../../js/farbtastic/mask.png) no-repeat;
+}
+.farbtastic .marker {
+  width: 17px;
+  height: 17px;
+  margin: -8px 0 0 -8px;
+  overflow: hidden; 
+  background: url(../../../js/farbtastic/marker.png) no-repeat;
+}
diff --git a/theme/base/default-avatar-mini.png b/theme/base/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..38b8692
Binary files /dev/null and b/theme/base/default-avatar-mini.png differ
diff --git a/theme/base/default-avatar-profile.png b/theme/base/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..f8357d4
Binary files /dev/null and b/theme/base/default-avatar-profile.png differ
diff --git a/theme/base/default-avatar-stream.png b/theme/base/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..6b63baa
Binary files /dev/null and b/theme/base/default-avatar-stream.png differ
diff --git a/theme/base/images/icons/clip-big.png b/theme/base/images/icons/clip-big.png
new file mode 100644 (file)
index 0000000..3945f56
Binary files /dev/null and b/theme/base/images/icons/clip-big.png differ
diff --git a/theme/base/images/icons/clip-inline.png b/theme/base/images/icons/clip-inline.png
new file mode 100644 (file)
index 0000000..870f8b2
Binary files /dev/null and b/theme/base/images/icons/clip-inline.png differ
diff --git a/theme/base/images/icons/clip.png b/theme/base/images/icons/clip.png
new file mode 100644 (file)
index 0000000..3c5a17d
Binary files /dev/null and b/theme/base/images/icons/clip.png differ
diff --git a/theme/base/images/icons/twotone/green/arrow-left.gif b/theme/base/images/icons/twotone/green/arrow-left.gif
new file mode 100644 (file)
index 0000000..afed190
Binary files /dev/null and b/theme/base/images/icons/twotone/green/arrow-left.gif differ
diff --git a/theme/base/images/icons/twotone/green/arrow-right.gif b/theme/base/images/icons/twotone/green/arrow-right.gif
new file mode 100644 (file)
index 0000000..ee1707e
Binary files /dev/null and b/theme/base/images/icons/twotone/green/arrow-right.gif differ
diff --git a/theme/base/images/icons/twotone/green/clip-02.gif b/theme/base/images/icons/twotone/green/clip-02.gif
new file mode 100644 (file)
index 0000000..77a7297
Binary files /dev/null and b/theme/base/images/icons/twotone/green/clip-02.gif differ
diff --git a/theme/base/images/icons/twotone/green/disfavourite.gif b/theme/base/images/icons/twotone/green/disfavourite.gif
new file mode 100644 (file)
index 0000000..3946869
Binary files /dev/null and b/theme/base/images/icons/twotone/green/disfavourite.gif differ
diff --git a/theme/base/images/icons/twotone/green/edit.gif b/theme/base/images/icons/twotone/green/edit.gif
new file mode 100644 (file)
index 0000000..c746aca
Binary files /dev/null and b/theme/base/images/icons/twotone/green/edit.gif differ
diff --git a/theme/base/images/icons/twotone/green/favourite.gif b/theme/base/images/icons/twotone/green/favourite.gif
new file mode 100644 (file)
index 0000000..d93515e
Binary files /dev/null and b/theme/base/images/icons/twotone/green/favourite.gif differ
diff --git a/theme/base/images/icons/twotone/green/mail.gif b/theme/base/images/icons/twotone/green/mail.gif
new file mode 100644 (file)
index 0000000..1084c86
Binary files /dev/null and b/theme/base/images/icons/twotone/green/mail.gif differ
diff --git a/theme/base/images/icons/twotone/green/news.gif b/theme/base/images/icons/twotone/green/news.gif
new file mode 100644 (file)
index 0000000..712c685
Binary files /dev/null and b/theme/base/images/icons/twotone/green/news.gif differ
diff --git a/theme/base/images/icons/twotone/green/quote.gif b/theme/base/images/icons/twotone/green/quote.gif
new file mode 100644 (file)
index 0000000..4ba1f0c
Binary files /dev/null and b/theme/base/images/icons/twotone/green/quote.gif differ
diff --git a/theme/base/images/icons/twotone/green/reply.gif b/theme/base/images/icons/twotone/green/reply.gif
new file mode 100644 (file)
index 0000000..6ff01bb
Binary files /dev/null and b/theme/base/images/icons/twotone/green/reply.gif differ
diff --git a/theme/base/images/icons/twotone/green/shield.gif b/theme/base/images/icons/twotone/green/shield.gif
new file mode 100644 (file)
index 0000000..419d5ee
Binary files /dev/null and b/theme/base/images/icons/twotone/green/shield.gif differ
diff --git a/theme/base/images/icons/twotone/green/trash.gif b/theme/base/images/icons/twotone/green/trash.gif
new file mode 100644 (file)
index 0000000..78dd64a
Binary files /dev/null and b/theme/base/images/icons/twotone/green/trash.gif differ
diff --git a/theme/base/logo.png b/theme/base/logo.png
new file mode 100644 (file)
index 0000000..7c68b34
Binary files /dev/null and b/theme/base/logo.png differ
diff --git a/theme/biz/css/base.css b/theme/biz/css/base.css
new file mode 100644 (file)
index 0000000..0e37a6e
--- /dev/null
@@ -0,0 +1,1173 @@
+/** theme: biz base
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 87.5%; background-color:#fff; height:100%; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:1em;
+line-height:1.65;
+position:relative;
+}
+h1,h2,h3,h4,h5,h6 {
+margin-bottom:7px;
+overflow:hidden;
+}
+h1 {
+font-size:1.4em;
+margin-bottom:18px;
+}
+#showstream h1 { display:none; }
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+legend {
+font-weight:bold;
+font-size:1.3em;
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+input.submit {
+font-weight:bold;
+cursor:pointer;
+}
+textarea {
+overflow:auto;
+}
+option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+}
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+.error,
+.success {
+padding:4px 1.55%;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+margin-bottom:18px;
+}
+form label.submit {
+display:none;
+}
+
+.form_settings {
+clear:both;
+}
+
+.form_settings fieldset {
+margin-bottom:29px;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+.form_settings .form_data input.submit {
+margin-left:0;
+}
+
+.form_settings label {
+margin-top:2px;
+width:113px;
+}
+
+.form_actions label {
+display:none;
+}
+.form_guide {
+font-style:italic;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend,
+#form_password legend,
+#form_settings_avatar legend,
+#newgroup legend,
+#editgroup legend,
+#form_tag_user legend,
+#form_remote_subscribe legend,
+#form_openid_login legend,
+#form_search legend,
+#form_invite legend,
+#form_notice_delete legend,
+#form_password_recover legend,
+#form_password_change legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:124px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:3px;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide,
+#form_openid_login #settings_rememberme p.form_guide,
+#settings_twitter_remove p.form_guide,
+#form_search ul.form_data #q {
+margin-left:0;
+}
+
+.form_settings .form_note {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+padding:0 7px;
+}
+
+
+.form_settings input.form_action-primary {
+padding:0;
+}
+.form_settings input.form_action-secondary {
+margin-left:29px;
+}
+
+
+#form_search .submit {
+margin-left:11px;
+}
+
+address {
+float:left;
+margin-bottom:18px;
+margin-left:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+address .fn {
+font-weight:bold;
+}
+address img + .fn {
+display:none;
+}
+
+#header {
+width:100%;
+position:relative;
+float:left;
+padding-top:18px;
+margin-bottom:18px;
+}
+
+#site_nav_global_primary {
+float:left;
+margin-right:18px;
+margin-bottom:11px;
+width:50%;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-right:11px;
+}
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+float:right;
+clear:right;
+margin-top:7px;
+margin-right:18px;
+width:24%;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+#anon_notice {
+float:left;
+width:45.4%;
+/*
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-width:2px;
+border-style:solid;
+*/
+line-height:1.5;
+font-size:1.1em;
+font-weight:bold;
+}
+
+
+#footer {
+float:left;
+width:64%;
+padding:18px;
+}
+
+#site_nav_local_views {
+width:14.5%;
+float:left;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+list-style-type:none;
+}
+#site_nav_local_views a {
+display:block;
+text-decoration:none;
+padding:4px 11px;
+-moz-border-radius-topleft:4px;
+-moz-border-radius-bottomleft:4px;
+-webkit-border-top-left-radius:4px;
+-webkit-border-bottom-left-radius:4px;
+border-width:1px;
+border-style:solid;
+border-right:0;
+text-shadow: 2px 2px 2px #ddd;
+font-weight:bold;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+}
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin-left:11px;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+#wrap {
+margin:0 auto;
+width:100%;
+min-width:760px;
+max-width:1003px;
+overflow:hidden;
+}
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+}
+
+#content {
+width:51.009%;
+min-height:259px;
+padding:1.795%;
+float:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-moz-border-radius-topleft:0;
+-webkit-border-radius:7px;
+-webkit-border-top-left-radius:0;
+border-style:solid;
+border-width:1px;
+}
+#shownotice #content {
+min-height:0;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:29.917%;
+min-height:259px;
+float:left;
+margin-left:0.385%;
+}
+
+#form_notice {
+width:45.664%;
+float:left;
+position:relative;
+line-height:1;
+}
+#form_notice fieldset {
+border:0;
+padding:0;
+position:relative;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+float:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+width:80.789%;
+height:67px;
+line-height:1.5;
+padding:7px 7px 16px 7px;
+}
+#form_notice label {
+display:block;
+float:left;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice #notice_submit label {
+display:none;
+}
+#form_notice .form_note {
+position:absolute;
+top:99px;
+right:98px;
+z-index:9;
+}
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+padding:1px 2px;
+}
+#form_notice #notice_action-submit {
+width:14%;
+height:47px;
+padding:0;
+position:absolute;
+bottom:0;
+right:0;
+}
+#form_notice label[for=to] {
+margin-top:7px;
+}
+#form_notice select[id=to] {
+margin-bottom:7px;
+margin-left:18px;
+float:left;
+}
+#form_notice .error {
+float:left;
+clear:both;
+width:96.9%;
+margin-bottom:0;
+line-height:1.618;
+}
+
+/* entity_profile */
+.entity_profile {
+position:relative;
+width:67.702%;
+min-height:123px;
+float:left;
+margin-bottom:18px;
+margin-left:0;
+overflow:hidden;
+}
+.entity_profile dt,
+#entity_statistics dt {
+font-weight:bold;
+}
+.entity_profile dd {
+display:inline;
+}
+
+.entity_profile .entity_depiction {
+float:left;
+width:96px;
+margin-right:18px;
+margin-bottom:18px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname,
+.entity_profile .entity_location,
+.entity_profile .entity_url,
+.entity_profile .entity_note,
+.entity_profile .entity_tags {
+margin-left:113px;
+margin-bottom:4px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname {
+margin-left:11px;
+display:inline;
+font-weight:bold;
+}
+.entity_profile .entity_nickname {
+margin-left:0;
+}
+
+.entity_profile .entity_fn dd:before {
+content: "(";
+font-weight:normal;
+}
+.entity_profile .entity_fn dd:after {
+content: ")";
+font-weight:normal;
+}
+
+.entity_profile dt {
+display:none;
+}
+.entity_profile h2 {
+display:none;
+}
+/* entity_profile */
+
+
+/*entity_actions*/
+.entity_actions {
+float:right;
+margin-left:4.35%;
+max-width:25%;
+}
+.entity_actions h2 {
+display:none;
+}
+.entity_actions ul {
+list-style-type:none;
+}
+.entity_actions li {
+margin-bottom:4px;
+}
+.entity_actions li:first-child {
+border-top:0;
+}
+.entity_actions fieldset {
+border:0;
+padding:0;
+}
+.entity_actions legend {
+display:none;
+}
+
+.entity_actions input.submit {
+display:block;
+text-align:left;
+width:100%;
+}
+.entity_actions a,
+.entity_nudge p,
+.entity_remote_subscribe {
+text-decoration:none;
+font-weight:bold;
+display:block;
+}
+
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.entity_edit a,
+.form_user_nudge input.submit,
+.entity_nudge p {
+border:0;
+padding-left:20px;
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.entity_nudge p {
+padding:4px 4px 4px 23px;
+}
+
+.entity_remote_subscribe {
+padding:4px;
+border-width:2px;
+border-style:solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.entity_actions .accept {
+margin-bottom:18px;
+}
+
+.entity_tags ul {
+list-style-type:none;
+display:inline;
+}
+.entity_tags li {
+display:inline;
+margin-right:4px;
+}
+
+.aside .section {
+margin-bottom:18px;
+clear:both;
+float:left;
+width:87.985%;
+padding:6%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-width:1px;
+border-style:solid;
+}
+.aside .section h2 {
+text-transform:uppercase;
+font-size:1em;
+}
+
+#entity_statistics dt,
+#entity_statistics dd {
+display:inline;
+}
+#entity_statistics dt:after {
+content: ":";
+}
+
+.section ul.entities {
+float:left;
+width:100%;
+}
+.section .entities li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+.section .entities li .photo {
+margin-right:0;
+margin-bottom:0;
+}
+.section .entities li .fn {
+display:none;
+}
+
+.aside .section p,
+.aside .section .more {
+clear:both;
+}
+
+.profile .entity_profile {
+margin-bottom:0;
+min-height:60px;
+}
+
+
+.profile .form_group_join legend,
+.profile .form_group_leave legend,
+.profile .form_user_subscribe legend,
+.profile .form_user_unsubscribe legend {
+display:none;
+}
+
+.profiles {
+list-style-type:none;
+}
+.profile .entity_profile .entity_location {
+width:auto;
+clear:none;
+margin-left:11px;
+}
+.profile .entity_profile dl,
+.profile .entity_profile dd {
+display:inline;
+float:none;
+}
+.profile .entity_profile .entity_note,
+.profile .entity_profile .entity_url,
+.profile .entity_profile .entity_tags,
+.profile .entity_profile .form_subscription_edit {
+margin-left:59px;
+clear:none;
+display:block;
+width:auto;
+}
+.profile .entity_profile .entity_tags dt {
+display:inline;
+margin-right:11px;
+}
+
+
+.profile .entity_profile .form_subscription_edit label {
+font-weight:normal;
+margin-right:11px;
+}
+
+
+/* NOTICE */
+.notice,
+.profile {
+position:relative;
+padding-top:11px;
+padding-bottom:11px;
+clear:both;
+float:left;
+width:100%;
+border-top-width:1px;
+border-top-style:dotted;
+}
+.notices li {
+list-style-type:none;
+}
+.notices li.hover {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:100%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+.notice .author {
+margin-right:11px;
+}
+
+.fn {
+overflow:hidden;
+}
+
+.notice .author .fn {
+font-weight:bold;
+}
+
+.vcard .photo {
+display:inline;
+margin-right:11px;
+float:left;
+}
+#shownotice .vcard .photo {
+margin-bottom:4px;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+
+.notice .entry-title {
+float:left;
+width:100%;
+overflow:hidden;
+}
+#shownotice .notice .entry-title {
+font-size:2.2em;
+}
+
+.notice p.entry-content {
+display:inline;
+}
+
+#content .notice p.entry-content a:visited {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+clear:left;
+float:left;
+font-size:0.95em;
+margin-left:59px;
+width:65%;
+}
+#showstream .notice div.entry-content,
+#shownotice .notice div.entry-content {
+margin-left:0;
+}
+
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+
+
+.notice-options {
+padding-left:2%;
+float:left;
+width:50%;
+position:relative;
+font-size:0.95em;
+width:12.5%;
+float:right;
+}
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+top:0;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+left:0;
+}
+.notice-options .notice_reply {
+left:29px;
+}
+.notice-options .notice_delete {
+right:0;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options form input.submit {
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+
+#usergroups #new_group {
+float: left;
+margin-right: 2em;
+}
+#new_group, #group_search {
+margin-bottom:18px;
+}
+#new_group a {
+padding-left:20px;
+}
+
+
+#filter_tags {
+margin-bottom:11px;
+float:left;
+}
+#filter_tags dt {
+display:none;
+}
+#filter_tags ul {
+list-style-type:none;
+}
+#filter_tags ul li {
+float:left;
+margin-left:7px;
+padding-left:7px;
+border-left-width:1px;
+border-left-style:solid;
+}
+#filter_tags ul li.child_1 {
+margin-left:0;
+border-left:0;
+padding-left:0;
+}
+#filter_tags ul li#filter_tags_all a {
+font-weight:bold;
+margin-top:7px;
+float:left;
+}
+
+#filter_tags ul li#filter_tags_item label {
+margin-right:7px;
+}
+#filter_tags ul li#filter_tags_item label,
+#filter_tags ul li#filter_tags_item select {
+display:inline;
+}
+#filter_tags ul li#filter_tags_item p {
+float:left;
+margin-left:38px;
+}
+#filter_tags ul li#filter_tags_item input {
+position:relative;
+top:3px;
+left:3px;
+}
+
+
+
+.pagination {
+float:left;
+clear:both;
+width:100%;
+margin-top:18px;
+}
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border-width:1px;
+border-style:solid;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-radius:7px;
+}
+
+.pagination .nav_prev a {
+padding-left:30px;
+}
+.pagination .nav_next a {
+padding-right:30px;
+}
+/* END: NOTICE */
+
+
+.hentry .entry-content p {
+margin-bottom:18px;
+}
+.system_notice ul,
+.instructions ul,
+.hentry entry-content ol,
+.hentry .entry-content ul {
+list-style-position:inside;
+}
+.hentry .entry-content li {
+margin-bottom:18px;
+}
+.hentry .entry-content li li {
+margin-left:18px;
+}
+
+
+
+
+/* TOP_POSTERS */
+.section tbody td {
+padding-right:11px;
+padding-bottom:11px;
+}
+.section .vcard .photo {
+margin-right:7px;
+margin-bottom:0;
+}
+
+.section .notice {
+padding-top:7px;
+padding-bottom:7px;
+border-top:0;
+}
+
+.section .notice:first-child {
+padding-top:0;
+}
+
+.section .notice .author {
+margin-right:0;
+}
+.section .notice .author .fn {
+display:none;
+}
+
+
+/* tagcloud */
+.tag-cloud {
+list-style-type:none;
+text-align:center;
+}
+.aside .tag-cloud {
+font-size:0.8em;
+}
+.tag-cloud li {
+display:inline;
+margin-right:7px;
+line-height:1.25;
+}
+.aside .tag-cloud li {
+line-height:1.5;
+}
+.tag-cloud li a {
+text-decoration:none;
+}
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+.tag-cloud-1 {
+font-size:1em;
+}
+.tag-cloud-2 {
+font-size:1.25em;
+}
+.tag-cloud-3 {
+font-size:1.75em;
+}
+.tag-cloud-4 {
+font-size:2em;
+}
+.tag-cloud-5 {
+font-size:2.25em;
+}
+.tag-cloud-6 {
+font-size:2.75em;
+}
+.tag-cloud-7 {
+font-size:3.25em;
+}
+
+#publictagcloud #tagcloud.section dt {
+display:none;
+}
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+#form_settings_avatar li {
+width:auto;
+}
+#form_settings_avatar input {
+margin-left:0;
+}
+#avatar_original,
+#avatar_preview {
+float:left;
+}
+#avatar_preview {
+margin-left:29px;
+}
+#avatar_preview_view {
+height:96px;
+width:96px;
+margin-bottom:18px;
+overflow:hidden;
+}
+
+#settings_attach,
+#form_settings_avatar .form_actions {
+clear:both;
+}
+
+#form_settings_avatar .form_actions {
+margin-bottom:0;
+}
+
+#form_settings_design #settings_design_color .form_data,
+#form_settings_design #color-picker {
+float:left;
+}
+#form_settings_design #settings_design_color .form_data {
+width:400px;
+margin-right:28px;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
+.instructions p,
+.instructions ul {
+margin-bottom:18px;
+}
+.help dt {
+display:none;
+}
+.guide {
+clear:both;
+}
diff --git a/theme/biz/css/display.css b/theme/biz/css/display.css
new file mode 100644 (file)
index 0000000..14092d9
--- /dev/null
@@ -0,0 +1,252 @@
+/** theme: biz
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+@import url(base.css);
+
+html {
+background-color:#144A6E;
+}
+a:active {
+background-color:#F4F7E7;
+}
+body {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+font-size:1em;
+background:#144A6E url(../images/illustrations/illu_pattern-01.png) repeat-x;
+}
+
+address {
+margin-right:7.18%;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-primary {
+background:none;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+.form_settings .form_note,
+.entity_remote_subscribe {
+background-color:#9BB43E;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#9BB43E;
+}
+input.submit,
+.entity_remote_subscribe,
+#site_nav_local_views a {
+color:#fff;
+}
+
+a,
+#site_nav_local_views .current a,
+div.notice-options input,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.entity_nudge p,
+.form_settings input.form_action-primary {
+color:#002E6E;
+}
+
+#header a,
+#footer a {
+color:#87B4C8;
+}
+
+.notice,
+.profile {
+border-top-color:#CEE1E9;
+}
+.section .profile {
+border-top-color:#87B4C8;
+}
+
+#content .notice p.entry-content a:visited {
+background-color:#fcfcfc;
+}
+#content .notice p.entry-content .vcard a {
+background-color:#fcfffc;
+}
+
+.aside .section {
+background-color:#F1F5F8;
+background-position:100% 0;
+background-image:url(../images/illustrations/illu_pattern-02.png);
+background-repeat:no-repeat;
+}
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+cursor:wait;
+text-indent:-9999px;
+}
+
+#content,
+#site_nav_local_views a,
+.aside .section {
+border-color:#fff;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:rgba(135, 180, 200, 0.3);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.7);
+}
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+#anon_notice {
+color:#fff;
+}
+
+#showstream #anon_notice {
+}
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.png);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.png);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_nudge p {
+background-position: 0 40%;
+background-repeat: no-repeat;
+background-color:transparent;
+}
+.form_group_join input.submit,
+.form_group_leave input.submit
+.form_user_subscribe input.submit,
+.form_user_unsubscribe input.submit {
+background-color:#9BB43E;
+color:#fff;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit,
+.form_user_authorization input.reject {
+background-color:#87B4C8;
+}
+
+.entity_edit a {
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
+}
+.entity_send-a-message a {
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
+}
+.entity_nudge p,
+.form_user_nudge input.submit {
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
+}
+.form_user_block input.submit,
+.form_user_unblock input.submit {
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
+}
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:0.4;
+}
+.notices li.hover div.entry-content,
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+.notices li.hover {
+background-color:#fcfcfc;
+}
+/*END: NOTICES */
+
+#new_group a {
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
+}
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+border-color:#CEE1E9;
+}
+.pagination .nav_prev a {
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
+background-position:10% 45%;
+}
+.pagination .nav_next a {
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
+background-position:90% 45%;
+}
diff --git a/theme/biz/css/ie.css b/theme/biz/css/ie.css
new file mode 100644 (file)
index 0000000..2f463bb
--- /dev/null
@@ -0,0 +1,9 @@
+/* IE specific styles */
+
+.notice-options input.submit {
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:#D0DFE7;
+}
diff --git a/theme/biz/default-avatar-mini.png b/theme/biz/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..38b8692
Binary files /dev/null and b/theme/biz/default-avatar-mini.png differ
diff --git a/theme/biz/default-avatar-profile.png b/theme/biz/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..f8357d4
Binary files /dev/null and b/theme/biz/default-avatar-profile.png differ
diff --git a/theme/biz/default-avatar-stream.png b/theme/biz/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..6b63baa
Binary files /dev/null and b/theme/biz/default-avatar-stream.png differ
diff --git a/theme/biz/images/illustrations/illu_pattern-01.png b/theme/biz/images/illustrations/illu_pattern-01.png
new file mode 100644 (file)
index 0000000..79bb46b
Binary files /dev/null and b/theme/biz/images/illustrations/illu_pattern-01.png differ
diff --git a/theme/biz/images/illustrations/illu_pattern-02.png b/theme/biz/images/illustrations/illu_pattern-02.png
new file mode 100644 (file)
index 0000000..4438b75
Binary files /dev/null and b/theme/biz/images/illustrations/illu_pattern-02.png differ
diff --git a/theme/biz/logo.png b/theme/biz/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/biz/logo.png differ
diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css
new file mode 100644 (file)
index 0000000..12f186a
--- /dev/null
@@ -0,0 +1,1552 @@
+/** theme: cloudy
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 100%; background-color:#fff; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:0.75em;
+line-height:normal;
+position:relative;
+height:100%;
+}
+h1,h2,h3,h4,h5,h6 {
+margin-bottom:7px;
+overflow:hidden;
+}
+h1 {
+font-size:1.4em;
+margin-bottom:18px;
+}
+#showstream h1 { display:none; }
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+legend {
+font-weight:bold;
+font-size:1.3em;
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+input.submit {
+font-weight:bold;
+cursor:pointer;
+}
+textarea {
+overflow:auto;
+}
+option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+}
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+.error,
+.success {
+padding:4px 7px;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+margin-bottom:18px;
+}
+form label.submit {
+display:none;
+}
+
+.form_settings {
+clear:both;
+}
+
+.form_settings fieldset {
+margin-bottom:29px;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+.form_settings .form_data input.submit {
+margin-left:0;
+}
+
+.form_settings label {
+margin-top:2px;
+width:143px;
+}
+
+.form_actions label {
+display:none;
+}
+.form_guide {
+font-style:italic;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend,
+#form_password legend,
+#form_settings_avatar legend,
+#newgroup legend,
+#editgroup legend,
+#form_tag_user legend,
+#form_remote_subscribe legend,
+#form_openid_login legend,
+#form_search legend,
+#form_invite legend,
+#form_notice_delete legend,
+#form_password_recover legend,
+#form_password_change legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:155px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:0;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide,
+#form_openid_login #settings_rememberme p.form_guide,
+#settings_twitter_remove p.form_guide,
+#form_search ul.form_data #q {
+margin-left:0;
+}
+
+.form_settings .form_note {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+padding:0 7px;
+}
+
+
+.form_settings input.form_action-primary {
+padding:0;
+}
+.form_settings input.form_action-secondary {
+margin-left:29px;
+}
+
+#form_search .submit {
+margin-left:11px;
+}
+
+address {
+float:left;
+margin-bottom:18px;
+margin-left:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+address .fn {
+font-weight:bold;
+}
+address img + .fn {
+display:none;
+}
+
+#header {
+width:100%;
+position:relative;
+float:left;
+padding-top:18px;
+margin-bottom:11px;
+z-index:1;
+}
+
+#site_nav_global_primary {
+float:right;
+margin-right:0;
+margin-bottom:11px;
+margin-left:18px;
+padding-top:7px;
+padding-bottom:7px;
+padding-right:11px;
+-moz-border-radius:4px;
+border-radius:4px;
+-webkit-border-radius:4px;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-left:11px;
+}
+#site_nav_global_primary a {
+text-decoration:none;
+}
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+position:absolute;
+top:65px;
+right:18px;
+width:250px;
+width:24%;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+#anon_notice {
+clear:both;
+width:99.8%;
+padding-top:36px;
+line-height:1.5;
+font-size:1.3em;
+font-weight:bold;
+}
+#anon_notice p {
+border-style:solid;
+border-width:1px;
+width:96%;
+padding:2%;
+}
+
+#footer {
+float:left;
+margin-bottom:1em;
+padding:7px;
+-moz-border-radius:4px;
+border-radius:4px;
+-webkit-border-radius:4px;
+}
+#footer a {
+text-decoration:none;
+}
+
+#site_nav_local_views {
+width:203px;
+float:right;
+margin-right:0;
+-moz-border-radius-topright:4px;
+border-radius-topright:4px;
+-webkit-border-top-right-radius:4px;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+list-style-type:none;
+padding:0;
+border-width:1px;
+border-style:solid;
+border-top:0;
+border-right:0;
+}
+#site_nav_local_views a {
+text-decoration:none;
+padding:13px;
+border-width:1px;
+border-style:solid;
+border-bottom:0;
+text-shadow: 2px 2px 2px #ddd;
+font-weight:bold;
+font-size:1em;
+display:block;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+}
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin:0 18px 7px 0;
+float:left;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+#wrap {
+margin:0 auto;
+width: 763px;
+min-width:760px;
+max-width:1003px;
+overflow:hidden;
+}
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+padding-top:10px;
+}
+
+#content {
+width:518px;
+min-height:322px;
+padding:20px;
+float:left;
+border-radius-topleft:4px;
+-moz-border-radius-topleft:4px;
+-webkit-border-top-left-radius:4px;
+border-style:solid;
+border-width:1px;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:182px;
+min-height:259px;
+float:left;
+margin-left:0;
+padding:10px;
+border-width:1px;
+border-style:solid;
+border-right:0;
+border-top:0;
+}
+
+#form_notice {
+width:505px;
+line-height:1;
+position:absolute;
+top:200px;
+left:20px;
+z-index:9;
+}
+#form_notice fieldset {
+border:0;
+padding:0 0 50px 0;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+float:left;
+width:505px;
+height:45px;
+line-height:1.5;
+padding:5px;
+border-width:1px;
+}
+#form_notice label {
+display:block;
+float:left;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice #notice_submit label {
+display:none;
+}
+#form_notice .form_note {
+position:absolute;
+top:-10px;
+right:-10px;
+z-index:9;
+font-family:Georgia, serif;
+font-size:1.7em;
+}
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+padding:1px 2px;
+}
+#form_notice #notice_action-submit {
+width:14%;
+height:35px;
+padding-top:0;
+padding-bottom:0;
+position:absolute;
+bottom:10px;
+right:-10px;
+}
+#form_notice label[for=to] {
+margin-top:7px;
+}
+#form_notice select[id=to] {
+margin-bottom:7px;
+margin-left:18px;
+float:left;
+}
+
+
+/* entity_profile */
+.entity_profile {
+position:relative;
+width:67.702%;
+min-height:123px;
+float:left;
+margin-bottom:18px;
+margin-left:0;
+overflow:hidden;
+}
+.entity_profile dt,
+#entity_statistics dt {
+font-weight:bold;
+}
+.entity_profile dd {
+display:inline;
+}
+
+.entity_profile .entity_depiction {
+float:left;
+width:96px;
+margin-right:18px;
+margin-bottom:18px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname,
+.entity_profile .entity_location,
+.entity_profile .entity_url,
+.entity_profile .entity_note,
+.entity_profile .entity_tags {
+margin-left:113px;
+margin-bottom:4px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname {
+margin-left:11px;
+display:inline;
+font-weight:bold;
+}
+.entity_profile .entity_nickname {
+margin-left:0;
+}
+
+.entity_profile .entity_fn dd:before {
+content: "(";
+font-weight:normal;
+}
+.entity_profile .entity_fn dd:after {
+content: ")";
+font-weight:normal;
+}
+
+.entity_profile dt {
+display:none;
+}
+.entity_profile h2 {
+display:none;
+}
+/* entity_profile */
+
+
+/*entity_actions*/
+.entity_actions {
+float:right;
+margin-left:4.35%;
+max-width:25%;
+}
+.entity_actions h2 {
+display:none;
+}
+.entity_actions ul {
+list-style-type:none;
+}
+.entity_actions li {
+margin-bottom:4px;
+}
+.entity_actions li:first-child {
+border-top:0;
+}
+.entity_actions fieldset {
+border:0;
+padding:0;
+}
+.entity_actions legend {
+display:none;
+}
+
+.entity_actions input.submit {
+display:block;
+text-align:left;
+width:100%;
+}
+.entity_actions a,
+.entity_nudge p,
+.entity_remote_subscribe {
+text-decoration:none;
+font-weight:bold;
+display:block;
+}
+
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.entity_edit a,
+.form_user_nudge input.submit,
+.entity_nudge p {
+border:0;
+padding-left:20px;
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.entity_nudge p {
+padding:4px 4px 4px 23px;
+}
+
+.entity_remote_subscribe {
+padding:4px;
+border-width:2px;
+border-style:solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.entity_actions .accept {
+margin-bottom:18px;
+}
+
+.entity_tags ul {
+list-style-type:none;
+display:inline;
+}
+.entity_tags li {
+display:inline;
+margin-right:4px;
+}
+
+.aside .section {
+margin-bottom:18px;
+clear:both;
+float:left;
+width:100%;
+}
+.aside .section h2 {
+font-size:110%;
+text-transform:none;
+}
+
+#entity_statistics dt,
+#entity_statistics dd {
+display:inline;
+}
+#entity_statistics dt:after {
+content: ":";
+}
+
+.section ul.entities {
+float:left;
+width:100%;
+}
+.section .entities li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+.section .entities li .photo {
+margin-right:0;
+margin-bottom:0;
+}
+.section .entities li .fn {
+display:none;
+}
+
+.aside .section p,
+.aside .section .more {
+clear:both;
+}
+
+.profile .entity_profile {
+margin-bottom:0;
+min-height:60px;
+}
+
+
+.profile .form_group_join legend,
+.profile .form_group_leave legend,
+.profile .form_user_subscribe legend,
+.profile .form_user_unsubscribe legend {
+display:none;
+}
+
+.profiles {
+list-style-type:none;
+}
+.profile .entity_profile .entity_location {
+width:auto;
+clear:none;
+margin-left:11px;
+}
+.profile .entity_profile dl,
+.profile .entity_profile dd {
+display:inline;
+float:none;
+}
+.profile .entity_profile .entity_note,
+.profile .entity_profile .entity_url,
+.profile .entity_profile .entity_tags,
+.profile .entity_profile .form_subscription_edit {
+margin-left:59px;
+clear:none;
+display:block;
+width:auto;
+}
+.profile .entity_profile .entity_tags dt {
+display:inline;
+margin-right:11px;
+}
+
+
+.profile .entity_profile .form_subscription_edit label {
+font-weight:normal;
+margin-right:11px;
+}
+
+
+/* NOTICE */
+.notice,
+.profile {
+position:relative;
+padding-top:11px;
+padding-bottom:11px;
+clear:both;
+float:left;
+width:100%;
+border-top-width:1px;
+border-top-style:dotted;
+font-size:1.2em;
+}
+.notices li {
+list-style-type:none;
+line-height:1.1;
+width:94%;
+padding-right:5%;
+padding-left:1%;
+min-height:47px;
+}
+
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:100%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+.notice .author {
+margin-right:11px;
+}
+
+.fn {
+overflow:hidden;
+}
+
+.notice .author .fn {
+font-weight:bold;
+}
+
+.notice .author .photo {
+margin-bottom:0;
+}
+
+.vcard .photo {
+display:inline;
+margin-right:11px;
+margin-bottom:11px;
+float:left;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+
+.notice .entry-title {
+float:none;
+display:inline;
+width:100%;
+overflow:hidden;
+}
+#shownotice .notice .entry-title {
+font-size:2.2em;
+}
+
+.notice p.entry-content {
+display:inline;
+}
+
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+font-size:0.95em;
+margin-left:59px;
+margin-top:3px;
+width:70%;
+font-family:Georgia, serif;
+font-style:italic;
+font-size:0.8em;
+display:block;
+}
+.notice div.entry-content a {
+text-decoration:none;
+}
+.notice div.entry-content a:hover {
+text-decoration:underline;
+}
+#showstream .notice div.entry-content {
+margin-left:0;
+}
+
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+
+
+
+.notice-data {
+position:absolute;
+top:18px;
+right:0;
+min-height:50px;
+margin-bottom:4px;
+}
+.notice .entry-content .notice-data dt {
+display:none;
+}
+
+.notice-data a {
+display:block;
+outline:none;
+}
+
+.notice-options {
+padding-left:2%;
+float:left;
+width:50%;
+font-size:0.95em;
+width:12.5%;
+float:right;
+display:none;
+}
+.notices li.hover div.notice-options {
+display:block;
+}
+
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+top:7px;
+right:7px;
+}
+.notice-options .notice_reply {
+top:30px;
+right:7px;
+}
+.notice-options .notice_delete {
+bottom:7px;
+right:7px;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options form input.submit {
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+
+#usergroups #new_group {
+float: left;
+margin-right: 2em;
+}
+#new_group, #group_search {
+margin-bottom:18px;
+}
+#new_group a {
+padding-left:20px;
+}
+
+
+#filter_tags {
+margin-bottom:11px;
+float:left;
+}
+#filter_tags dt {
+display:none;
+}
+#filter_tags ul {
+list-style-type:none;
+}
+#filter_tags ul li {
+float:left;
+margin-left:7px;
+padding-left:7px;
+border-left-width:1px;
+border-left-style:solid;
+}
+#filter_tags ul li.child_1 {
+margin-left:0;
+border-left:0;
+padding-left:0;
+}
+#filter_tags ul li#filter_tags_all a {
+font-weight:bold;
+margin-top:7px;
+float:left;
+}
+
+#filter_tags ul li#filter_tags_item label {
+margin-right:7px;
+}
+#filter_tags ul li#filter_tags_item label,
+#filter_tags ul li#filter_tags_item select {
+display:inline;
+}
+#filter_tags ul li#filter_tags_item p {
+float:left;
+margin-left:38px;
+}
+#filter_tags ul li#filter_tags_item input {
+position:relative;
+top:3px;
+left:3px;
+}
+
+
+
+.pagination {
+float:left;
+clear:both;
+width:100%;
+margin-top:18px;
+}
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border-width:1px;
+border-style:solid;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-radius:7px;
+}
+
+.pagination .nav_prev a {
+padding-left:30px;
+}
+.pagination .nav_next a {
+padding-right:30px;
+}
+/* END: NOTICE */
+
+
+.hentry .entry-content p {
+margin-bottom:18px;
+}
+.hentry entry-content ol,
+.hentry .entry-content ul {
+list-style-position:inside;
+}
+.hentry .entry-content li {
+margin-bottom:18px;
+}
+.hentry .entry-content li li {
+margin-left:18px;
+}
+
+
+
+
+/* TOP_POSTERS */
+.section tbody td {
+padding-right:11px;
+padding-bottom:11px;
+}
+.section .vcard .photo {
+margin-right:7px;
+margin-bottom:0;
+}
+
+.section .notice {
+padding-top:7px;
+padding-bottom:7px;
+border-top:0;
+}
+
+.section .notice:first-child {
+padding-top:0;
+}
+
+.section .notice .author {
+margin-right:0;
+}
+.section .notice .author .fn {
+display:none;
+}
+
+
+/* tagcloud */
+.tag-cloud {
+list-style-type:none;
+text-align:center;
+}
+.aside .tag-cloud {
+font-size:0.8em;
+}
+.tag-cloud li {
+display:inline;
+margin-right:7px;
+line-height:1.25;
+}
+.aside .tag-cloud li {
+line-height:1.5;
+}
+.tag-cloud li a {
+text-decoration:none;
+}
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+.tag-cloud-1 {
+font-size:1em;
+}
+.tag-cloud-2 {
+font-size:1.25em;
+}
+.tag-cloud-3 {
+font-size:1.75em;
+}
+.tag-cloud-4 {
+font-size:2em;
+}
+.tag-cloud-5 {
+font-size:2.25em;
+}
+.tag-cloud-6 {
+font-size:2.75em;
+}
+.tag-cloud-7 {
+font-size:3.25em;
+}
+
+#publictagcloud #tagcloud.section dt {
+display:none;
+}
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+#form_settings_avatar li {
+width:auto;
+}
+#form_settings_avatar input {
+margin-left:0;
+}
+#avatar_original,
+#avatar_preview {
+float:left;
+}
+#avatar_preview {
+margin-left:29px;
+}
+#avatar_preview_view {
+height:96px;
+width:96px;
+margin-bottom:18px;
+overflow:hidden;
+}
+
+#settings_attach,
+#form_settings_avatar .form_actions {
+clear:both;
+}
+
+#form_settings_avatar .form_actions {
+margin-bottom:0;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
+.instructions p,
+.instructions ul {
+margin-bottom:18px;
+}
+.help dt {
+display:none;
+}
+.guide {
+clear:both;
+}
+
+#public.user_in #content,
+#groups.user_in #content,
+#publictagcloud.user_in #content,
+#featured.user_in #content,
+#favorited.user_in #content,
+#all.user_in #content,
+#replies.user_in #content,
+#showstream.user_in #content,
+#showfavorites.user_in #content,
+#inbox.user_in #content,
+#outbox.user_in #content,
+#subscriptions.user_in #content,
+#subscribers.user_in #content,
+#showgroup.user_in #content {
+padding-top:160px;
+}
+
+#profilesettings #form_notice,
+#avatarsettings #form_notice,
+#passwordsettings #form_notice,
+#emailsettings #form_notice,
+#openidsettings #form_notice,
+#othersettings #form_notice,
+#smssettings #form_notice,
+#twittersettings #form_notice,
+#imsettings #form_notice,
+#doc #form_notice,
+#usergroups #form_notice,
+#invite #form_notice,
+#deletenotice #form_notice,
+#newgroup #form_notice,
+#register #form_notice,
+#shownotice #form_notice,
+#confirmaddress #form_notice,
+#tag #form_notice {
+display:none;
+}
+
+
+html,
+body,
+a:active {
+background-color:#9AE4E8;
+}
+body {
+font-family:'Lucida Grande',sans-serif;
+background:#9AE4E8  url(../images/illustrations/illu_clouds-01.gif) 0 0 no-repeat;
+color:#333333;
+}
+#core {
+background:url(../images/illustrations/illu_arrow-up-01.gif) no-repeat 25px 0;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-primary {
+background:none;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+#nav_register a,
+.form_settings .form_note,
+.entity_remote_subscribe {
+background-color:#9BB43E;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#9BB43E;
+}
+input.submit,
+#nav_register a,
+.entity_remote_subscribe {
+color:#fff;
+}
+
+a,
+div.notice-options input,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.entity_nudge p,
+.form_settings input.form_action-primary {
+color:#0084B4;
+}
+
+.notice,
+.profile {
+border-top-color:#DDFFCC;
+}
+.section .profile {
+border-top-color:#87B4C8;
+}
+
+
+#content .notice p.entry-content a:visited {
+background-color:#fcfcfc;
+}
+#content .notice p.entry-content .vcard a {
+background-color:#fcfffc;
+}
+
+#aside_primary {
+background-color:#DDFFCC;
+}
+
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+cursor:wait;
+text-indent:-9999px;
+}
+
+#content,
+#site_nav_local_views a,
+#aside_primary {
+border-color:#fff;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:rgba(135, 180, 200, 0.3);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.7);
+}
+
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+
+#anon_notice {
+background-color:#FEFFDF;
+color:#333;
+border-color:#fff;
+}
+
+#showstream #anon_notice {
+background-color:#FEFFDF;
+}
+
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.png);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.png);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_nudge p {
+background-position: 0 40%;
+background-repeat: no-repeat;
+background-color:transparent;
+}
+.form_group_join input.submit,
+.form_group_leave input.submit
+.form_user_subscribe input.submit,
+.form_user_unsubscribe input.submit {
+background-color:#9BB43E;
+color:#fff;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit {
+background-color:#87B4C8;
+}
+
+.entity_edit a {
+background-image:url(../images/icons/twotone/green/edit.gif);
+}
+.entity_send-a-message a {
+background-image:url(../images/icons/twotone/green/quote.gif);
+}
+.entity_nudge p,
+.form_user_nudge input.submit {
+background-image:url(../images/icons/twotone/green/mail.gif);
+}
+.form_user_block input.submit,
+.form_user_unblock input.submit {
+background-image:url(../images/icons/twotone/green/shield.gif);
+}
+
+
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../images/icons/icon_reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../images/icons/icon_favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../images/icons/icon_disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../images/icons/icon_trash.gif) no-repeat 0 45%;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:0.4;
+}
+.notices li.hover div.entry-content,
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+.notices li.hover {
+background-color:#fcfcfc;
+}
+/*END: NOTICES */
+
+
+#new_group a {
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
+}
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+border-color:#DDFFCC;
+}
+.pagination .nav_prev a {
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
+background-position:10% 45%;
+}
+.pagination .nav_next a {
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
+background-position:90% 45%;
+}
+
+
+/*--------------------------------------*/
+
+#anon_notice {
+background:url(../images/illustrations/illu_unicorn-01.png) no-repeat 0 0;
+}
+#showstream #anon_notice,
+#content .notice p.entry-content a:visited,
+content .notice p.entry-content .vcard a {
+background-color:transparent;
+}
+
+#anon_notice p {
+background-color:#FEFFDF;
+border-color:#FFFF00;
+}
+
+
+#form_notice .form_note {
+color:#CCC;
+}
+input.submit {
+background-color:#eee;
+color:#666;
+}
+
+.notices li.hover {
+background-color:#F7F7F7;
+}
+
+
+.notice div.entry-content,
+.notice div.entry-content a {
+color:#999;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:1;
+}
+
+#site_nav_local_views {
+background-color:#DDFFCC;
+}
+#site_nav_local_views li,
+#aside_primary {
+border-color:#BDDCAD;
+}
+#site_nav_local_views a,
+.aside .section h2 {
+background-color:transparent;
+border-color:transparent;
+color:#4C4C4C;
+}
+#site_nav_local_views .current {
+border-left-color:#fff;
+}
+
+#site_nav_local_views .current a,
+#site_nav_global_primary,
+#footer {
+background-color:#fff;
+}
+
diff --git a/theme/cloudy/css/ie.css b/theme/cloudy/css/ie.css
new file mode 100644 (file)
index 0000000..0951221
--- /dev/null
@@ -0,0 +1,34 @@
+/* IE specific styles */
+
+.notice-options input.submit {
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:#ddffcc;
+}
+
+#aside_primary {
+width:181px;
+}
+
+#form_notice,
+#anon_notice {
+top:158px;
+}
+
+#public #content,
+#groups #content,
+#publictagcloud #content,
+#featured #content,
+#favorited #content,
+#all #content,
+#replies #content,
+#showstream #content,
+#showfavorites #content,
+#inbox #content,
+#outbox #content,
+#subscriptions #content,
+#subscribers #content {
+padding-top:138px;
+}
diff --git a/theme/cloudy/default-avatar-mini.png b/theme/cloudy/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..4fd8bd9
Binary files /dev/null and b/theme/cloudy/default-avatar-mini.png differ
diff --git a/theme/cloudy/default-avatar-profile.png b/theme/cloudy/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..eb08571
Binary files /dev/null and b/theme/cloudy/default-avatar-profile.png differ
diff --git a/theme/cloudy/default-avatar-stream.png b/theme/cloudy/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..926b8a9
Binary files /dev/null and b/theme/cloudy/default-avatar-stream.png differ
diff --git a/theme/cloudy/images/icons/icon_atom.png b/theme/cloudy/images/icons/icon_atom.png
new file mode 100644 (file)
index 0000000..6a001f1
Binary files /dev/null and b/theme/cloudy/images/icons/icon_atom.png differ
diff --git a/theme/cloudy/images/icons/icon_disfavourite.gif b/theme/cloudy/images/icons/icon_disfavourite.gif
new file mode 100644 (file)
index 0000000..2b02ac8
Binary files /dev/null and b/theme/cloudy/images/icons/icon_disfavourite.gif differ
diff --git a/theme/cloudy/images/icons/icon_favourite.gif b/theme/cloudy/images/icons/icon_favourite.gif
new file mode 100644 (file)
index 0000000..716ce35
Binary files /dev/null and b/theme/cloudy/images/icons/icon_favourite.gif differ
diff --git a/theme/cloudy/images/icons/icon_foaf.gif b/theme/cloudy/images/icons/icon_foaf.gif
new file mode 100644 (file)
index 0000000..f8f7844
Binary files /dev/null and b/theme/cloudy/images/icons/icon_foaf.gif differ
diff --git a/theme/cloudy/images/icons/icon_processing.gif b/theme/cloudy/images/icons/icon_processing.gif
new file mode 100644 (file)
index 0000000..d0bce15
Binary files /dev/null and b/theme/cloudy/images/icons/icon_processing.gif differ
diff --git a/theme/cloudy/images/icons/icon_reply.gif b/theme/cloudy/images/icons/icon_reply.gif
new file mode 100644 (file)
index 0000000..a4379a7
Binary files /dev/null and b/theme/cloudy/images/icons/icon_reply.gif differ
diff --git a/theme/cloudy/images/icons/icon_rss.png b/theme/cloudy/images/icons/icon_rss.png
new file mode 100644 (file)
index 0000000..0ccd1ce
Binary files /dev/null and b/theme/cloudy/images/icons/icon_rss.png differ
diff --git a/theme/cloudy/images/icons/icon_trash.gif b/theme/cloudy/images/icons/icon_trash.gif
new file mode 100644 (file)
index 0000000..916a332
Binary files /dev/null and b/theme/cloudy/images/icons/icon_trash.gif differ
diff --git a/theme/cloudy/images/icons/icon_vcard.gif b/theme/cloudy/images/icons/icon_vcard.gif
new file mode 100644 (file)
index 0000000..6d52947
Binary files /dev/null and b/theme/cloudy/images/icons/icon_vcard.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/arrow-left.gif b/theme/cloudy/images/icons/twotone/green/arrow-left.gif
new file mode 100644 (file)
index 0000000..afed190
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/arrow-left.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/arrow-right.gif b/theme/cloudy/images/icons/twotone/green/arrow-right.gif
new file mode 100644 (file)
index 0000000..ee1707e
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/arrow-right.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/edit.gif b/theme/cloudy/images/icons/twotone/green/edit.gif
new file mode 100644 (file)
index 0000000..c746aca
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/edit.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/mail.gif b/theme/cloudy/images/icons/twotone/green/mail.gif
new file mode 100644 (file)
index 0000000..1084c86
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/mail.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/news.gif b/theme/cloudy/images/icons/twotone/green/news.gif
new file mode 100644 (file)
index 0000000..712c685
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/news.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/quote.gif b/theme/cloudy/images/icons/twotone/green/quote.gif
new file mode 100644 (file)
index 0000000..4ba1f0c
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/quote.gif differ
diff --git a/theme/cloudy/images/icons/twotone/green/shield.gif b/theme/cloudy/images/icons/twotone/green/shield.gif
new file mode 100644 (file)
index 0000000..419d5ee
Binary files /dev/null and b/theme/cloudy/images/icons/twotone/green/shield.gif differ
diff --git a/theme/cloudy/images/illustrations/illu_arrow-up-01.gif b/theme/cloudy/images/illustrations/illu_arrow-up-01.gif
new file mode 100644 (file)
index 0000000..577be18
Binary files /dev/null and b/theme/cloudy/images/illustrations/illu_arrow-up-01.gif differ
diff --git a/theme/cloudy/images/illustrations/illu_clouds-01.gif b/theme/cloudy/images/illustrations/illu_clouds-01.gif
new file mode 100644 (file)
index 0000000..41cd622
Binary files /dev/null and b/theme/cloudy/images/illustrations/illu_clouds-01.gif differ
diff --git a/theme/cloudy/images/illustrations/illu_jcrop.gif b/theme/cloudy/images/illustrations/illu_jcrop.gif
new file mode 100644 (file)
index 0000000..72ea7cc
Binary files /dev/null and b/theme/cloudy/images/illustrations/illu_jcrop.gif differ
diff --git a/theme/cloudy/images/illustrations/illu_progress_loading-01.gif b/theme/cloudy/images/illustrations/illu_progress_loading-01.gif
new file mode 100644 (file)
index 0000000..82290f4
Binary files /dev/null and b/theme/cloudy/images/illustrations/illu_progress_loading-01.gif differ
diff --git a/theme/cloudy/images/illustrations/illu_unicorn-01.png b/theme/cloudy/images/illustrations/illu_unicorn-01.png
new file mode 100644 (file)
index 0000000..6cb51b2
Binary files /dev/null and b/theme/cloudy/images/illustrations/illu_unicorn-01.png differ
diff --git a/theme/cloudy/logo.png b/theme/cloudy/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/cloudy/logo.png differ
index 69a600cc286303440516d5038f8c59c6df5dd0ee..e08a4783bd6ba8882fe5246aa50db084c80c6796 100644 (file)
@@ -12,7 +12,7 @@
 html,
 body,
 a:active {
-background-color:#97BFD1;
+background-color:#C3D6DF;
 }
 body {
 font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
@@ -30,10 +30,10 @@ input, textarea, select,
 border-color:#aaa;
 }
 #filter_tags ul li {
-border-color:#97BFD1;
+border-color:#C3D6DF;
 }
 
-.form_settings input.form_action-secondary {
+.form_settings input.form_action-primary {
 background:none;
 }
 
@@ -60,7 +60,7 @@ div.notice-options input,
 .entity_send-a-message a,
 .form_user_nudge input.submit,
 .entity_nudge p,
-.form_settings input.form_action-secondary {
+.form_settings input.form_action-primary {
 color:#002E6E;
 }
 
@@ -69,14 +69,7 @@ color:#002E6E;
 border-top-color:#D1D9E4;
 }
 .section .profile {
-border-top-color:#97BFD1;
-}
-
-#content .notice p.entry-content a:visited {
-background-color:#fcfcfc;
-}
-#content .notice p.entry-content .vcard a {
-background-color:#fcfffc;
+border-top-color:#C3D6DF;
 }
 
 #aside_primary {
@@ -120,7 +113,7 @@ background-color:#EFF3DC;
 }
 
 #anon_notice {
-background-color:#97BFD1;
+background-color:#C3D6DF;
 color:#fff;
 border-color:#fff;
 }
@@ -163,48 +156,52 @@ color:#fff;
 .form_user_unsubscribe input.submit,
 .form_group_leave input.submit,
 .form_user_authorization input.reject {
-background-color:#97BFD1;
+background-color:#C3D6DF;
 }
 
 .entity_edit a {
-background-image:url(../images/icons/twotone/green/edit.gif);
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
 }
 .entity_send-a-message a {
-background-image:url(../images/icons/twotone/green/quote.gif);
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
 }
 .entity_nudge p,
 .form_user_nudge input.submit {
-background-image:url(../images/icons/twotone/green/mail.gif);
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
 }
 .form_user_block input.submit,
 .form_user_unblock input.submit {
-background-image:url(../images/icons/twotone/green/shield.gif);
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
 }
 
 /* NOTICES */
-.notices li.over {
-background-color:#fcfcfc;
+.notice .attachment {
+background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%;
+}
+#attachments .attachment {
+background:none;
 }
-
 .notice-options .notice_reply a,
 .notice-options form input.submit {
 background-color:transparent;
 }
 .notice-options .notice_reply a {
-background:transparent url(../images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
 }
 .notice-options form.form_favor input.submit {
-background:transparent url(../images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
 }
 .notice-options form.form_disfavor input.submit {
-background:transparent url(../images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
 }
 .notice-options .notice_delete a {
-background:transparent url(../images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
 }
 
 .notices div.entry-content,
-.notices div.notice-options {
+.notices div.notice-options,
+.notices li.hover .notices div.entry-content,
+.notices li.hover .notices div.notice-options  {
 opacity:0.4;
 }
 .notices li.hover div.entry-content,
@@ -221,10 +218,23 @@ font-family:sans-serif;
 .notices li.hover {
 background-color:#fcfcfc;
 }
+
+.notices .notices {
+background-color:rgba(200, 200, 200, 0.050);
+}
+.notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.100);
+}
+.notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.150);
+}
+.notices .notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.300);
+}
 /*END: NOTICES */
 
 #new_group a {
-background:transparent url(../images/icons/twotone/green/news.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
 }
 
 .pagination .nav_prev a,
@@ -233,10 +243,10 @@ background-repeat:no-repeat;
 border-color:#D1D9E4;
 }
 .pagination .nav_prev a {
-background-image:url(../images/icons/twotone/green/arrow-left.gif);
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
 background-position:10% 45%;
 }
 .pagination .nav_next a {
-background-image:url(../images/icons/twotone/green/arrow-right.gif);
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
 background-position:90% 45%;
 }
diff --git a/theme/default/images/icons/icon_atom.jpg b/theme/default/images/icons/icon_atom.jpg
deleted file mode 100644 (file)
index 22853ed..0000000
Binary files a/theme/default/images/icons/icon_atom.jpg and /dev/null differ
diff --git a/theme/default/images/icons/icon_foaf.gif b/theme/default/images/icons/icon_foaf.gif
deleted file mode 100644 (file)
index f8f7844..0000000
Binary files a/theme/default/images/icons/icon_foaf.gif and /dev/null differ
diff --git a/theme/default/images/icons/icon_rss.jpg b/theme/default/images/icons/icon_rss.jpg
deleted file mode 100644 (file)
index da23422..0000000
Binary files a/theme/default/images/icons/icon_rss.jpg and /dev/null differ
diff --git a/theme/default/images/icons/icon_vcard.gif b/theme/default/images/icons/icon_vcard.gif
deleted file mode 100644 (file)
index 6d52947..0000000
Binary files a/theme/default/images/icons/icon_vcard.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/against.gif b/theme/default/images/icons/twotone/green/against.gif
deleted file mode 100644 (file)
index ca796c8..0000000
Binary files a/theme/default/images/icons/twotone/green/against.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-down.gif b/theme/default/images/icons/twotone/green/arrow-down.gif
deleted file mode 100644 (file)
index c709e58..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-down.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-downleft.gif b/theme/default/images/icons/twotone/green/arrow-downleft.gif
deleted file mode 100644 (file)
index a4a9803..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-downleft.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-downright.gif b/theme/default/images/icons/twotone/green/arrow-downright.gif
deleted file mode 100644 (file)
index 3e6001a..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-downright.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-left.gif b/theme/default/images/icons/twotone/green/arrow-left.gif
deleted file mode 100644 (file)
index afed190..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-left.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-right.gif b/theme/default/images/icons/twotone/green/arrow-right.gif
deleted file mode 100644 (file)
index ee1707e..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-right.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-up.gif b/theme/default/images/icons/twotone/green/arrow-up.gif
deleted file mode 100644 (file)
index d0f5fbe..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-up.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-upleft.gif b/theme/default/images/icons/twotone/green/arrow-upleft.gif
deleted file mode 100644 (file)
index 1e9e693..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-upleft.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/arrow-upright.gif b/theme/default/images/icons/twotone/green/arrow-upright.gif
deleted file mode 100644 (file)
index c7fecc8..0000000
Binary files a/theme/default/images/icons/twotone/green/arrow-upright.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/back-forth.gif b/theme/default/images/icons/twotone/green/back-forth.gif
deleted file mode 100644 (file)
index 33a9540..0000000
Binary files a/theme/default/images/icons/twotone/green/back-forth.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/bookmark.gif b/theme/default/images/icons/twotone/green/bookmark.gif
deleted file mode 100644 (file)
index 23f318e..0000000
Binary files a/theme/default/images/icons/twotone/green/bookmark.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/bulb.gif b/theme/default/images/icons/twotone/green/bulb.gif
deleted file mode 100644 (file)
index f70652c..0000000
Binary files a/theme/default/images/icons/twotone/green/bulb.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/calendar.gif b/theme/default/images/icons/twotone/green/calendar.gif
deleted file mode 100644 (file)
index a09b65a..0000000
Binary files a/theme/default/images/icons/twotone/green/calendar.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/calendar2.gif b/theme/default/images/icons/twotone/green/calendar2.gif
deleted file mode 100644 (file)
index 7884b02..0000000
Binary files a/theme/default/images/icons/twotone/green/calendar2.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/camera.gif b/theme/default/images/icons/twotone/green/camera.gif
deleted file mode 100644 (file)
index 1a85fba..0000000
Binary files a/theme/default/images/icons/twotone/green/camera.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/cart.gif b/theme/default/images/icons/twotone/green/cart.gif
deleted file mode 100644 (file)
index 47eaa0a..0000000
Binary files a/theme/default/images/icons/twotone/green/cart.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/caution.gif b/theme/default/images/icons/twotone/green/caution.gif
deleted file mode 100644 (file)
index 3ad2c32..0000000
Binary files a/theme/default/images/icons/twotone/green/caution.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/chart.gif b/theme/default/images/icons/twotone/green/chart.gif
deleted file mode 100644 (file)
index 136d745..0000000
Binary files a/theme/default/images/icons/twotone/green/chart.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/checkmark.gif b/theme/default/images/icons/twotone/green/checkmark.gif
deleted file mode 100644 (file)
index 892429d..0000000
Binary files a/theme/default/images/icons/twotone/green/checkmark.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/clipboard.gif b/theme/default/images/icons/twotone/green/clipboard.gif
deleted file mode 100644 (file)
index 9317bdc..0000000
Binary files a/theme/default/images/icons/twotone/green/clipboard.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/clock.gif b/theme/default/images/icons/twotone/green/clock.gif
deleted file mode 100644 (file)
index d1410f9..0000000
Binary files a/theme/default/images/icons/twotone/green/clock.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/closed-folder.gif b/theme/default/images/icons/twotone/green/closed-folder.gif
deleted file mode 100644 (file)
index 0410fc6..0000000
Binary files a/theme/default/images/icons/twotone/green/closed-folder.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/database.gif b/theme/default/images/icons/twotone/green/database.gif
deleted file mode 100644 (file)
index 29ce024..0000000
Binary files a/theme/default/images/icons/twotone/green/database.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/disfavourite.gif b/theme/default/images/icons/twotone/green/disfavourite.gif
deleted file mode 100644 (file)
index 3946869..0000000
Binary files a/theme/default/images/icons/twotone/green/disfavourite.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/diskette.gif b/theme/default/images/icons/twotone/green/diskette.gif
deleted file mode 100644 (file)
index e970b0a..0000000
Binary files a/theme/default/images/icons/twotone/green/diskette.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/document.gif b/theme/default/images/icons/twotone/green/document.gif
deleted file mode 100644 (file)
index 9c08f4a..0000000
Binary files a/theme/default/images/icons/twotone/green/document.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/double-arrow.gif b/theme/default/images/icons/twotone/green/double-arrow.gif
deleted file mode 100644 (file)
index 2e86482..0000000
Binary files a/theme/default/images/icons/twotone/green/double-arrow.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/edit.gif b/theme/default/images/icons/twotone/green/edit.gif
deleted file mode 100644 (file)
index c746aca..0000000
Binary files a/theme/default/images/icons/twotone/green/edit.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/eject.gif b/theme/default/images/icons/twotone/green/eject.gif
deleted file mode 100644 (file)
index 7e0906c..0000000
Binary files a/theme/default/images/icons/twotone/green/eject.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/exclaim.gif b/theme/default/images/icons/twotone/green/exclaim.gif
deleted file mode 100644 (file)
index 588e28c..0000000
Binary files a/theme/default/images/icons/twotone/green/exclaim.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/fastforward.gif b/theme/default/images/icons/twotone/green/fastforward.gif
deleted file mode 100644 (file)
index 28e4951..0000000
Binary files a/theme/default/images/icons/twotone/green/fastforward.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/favourite.gif b/theme/default/images/icons/twotone/green/favourite.gif
deleted file mode 100644 (file)
index d93515e..0000000
Binary files a/theme/default/images/icons/twotone/green/favourite.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/flag.gif b/theme/default/images/icons/twotone/green/flag.gif
deleted file mode 100644 (file)
index 68c8aee..0000000
Binary files a/theme/default/images/icons/twotone/green/flag.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/graph.gif b/theme/default/images/icons/twotone/green/graph.gif
deleted file mode 100644 (file)
index 0c1794b..0000000
Binary files a/theme/default/images/icons/twotone/green/graph.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/grow.gif b/theme/default/images/icons/twotone/green/grow.gif
deleted file mode 100644 (file)
index c4118d5..0000000
Binary files a/theme/default/images/icons/twotone/green/grow.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/headphones.gif b/theme/default/images/icons/twotone/green/headphones.gif
deleted file mode 100644 (file)
index 5be6c67..0000000
Binary files a/theme/default/images/icons/twotone/green/headphones.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/home.gif b/theme/default/images/icons/twotone/green/home.gif
deleted file mode 100644 (file)
index d2a3421..0000000
Binary files a/theme/default/images/icons/twotone/green/home.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/hourglass.gif b/theme/default/images/icons/twotone/green/hourglass.gif
deleted file mode 100644 (file)
index b62b948..0000000
Binary files a/theme/default/images/icons/twotone/green/hourglass.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/info.gif b/theme/default/images/icons/twotone/green/info.gif
deleted file mode 100644 (file)
index 86ef1f8..0000000
Binary files a/theme/default/images/icons/twotone/green/info.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/key.gif b/theme/default/images/icons/twotone/green/key.gif
deleted file mode 100644 (file)
index ccf357a..0000000
Binary files a/theme/default/images/icons/twotone/green/key.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/lock.gif b/theme/default/images/icons/twotone/green/lock.gif
deleted file mode 100644 (file)
index db00706..0000000
Binary files a/theme/default/images/icons/twotone/green/lock.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/mail.gif b/theme/default/images/icons/twotone/green/mail.gif
deleted file mode 100644 (file)
index 1084c86..0000000
Binary files a/theme/default/images/icons/twotone/green/mail.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/move.gif b/theme/default/images/icons/twotone/green/move.gif
deleted file mode 100644 (file)
index d2c30b1..0000000
Binary files a/theme/default/images/icons/twotone/green/move.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/music.gif b/theme/default/images/icons/twotone/green/music.gif
deleted file mode 100644 (file)
index 64b51d4..0000000
Binary files a/theme/default/images/icons/twotone/green/music.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/news.gif b/theme/default/images/icons/twotone/green/news.gif
deleted file mode 100644 (file)
index 712c685..0000000
Binary files a/theme/default/images/icons/twotone/green/news.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/note.gif b/theme/default/images/icons/twotone/green/note.gif
deleted file mode 100644 (file)
index bcc0b14..0000000
Binary files a/theme/default/images/icons/twotone/green/note.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/open-folder.gif b/theme/default/images/icons/twotone/green/open-folder.gif
deleted file mode 100644 (file)
index d41300a..0000000
Binary files a/theme/default/images/icons/twotone/green/open-folder.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/paper-clip.gif b/theme/default/images/icons/twotone/green/paper-clip.gif
deleted file mode 100644 (file)
index 1d45f1d..0000000
Binary files a/theme/default/images/icons/twotone/green/paper-clip.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/paper-clip2.gif b/theme/default/images/icons/twotone/green/paper-clip2.gif
deleted file mode 100644 (file)
index a8c7805..0000000
Binary files a/theme/default/images/icons/twotone/green/paper-clip2.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/pause.gif b/theme/default/images/icons/twotone/green/pause.gif
deleted file mode 100644 (file)
index ced0b64..0000000
Binary files a/theme/default/images/icons/twotone/green/pause.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/phone.gif b/theme/default/images/icons/twotone/green/phone.gif
deleted file mode 100644 (file)
index 69359f7..0000000
Binary files a/theme/default/images/icons/twotone/green/phone.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/play.gif b/theme/default/images/icons/twotone/green/play.gif
deleted file mode 100644 (file)
index 794ec85..0000000
Binary files a/theme/default/images/icons/twotone/green/play.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/plus.gif b/theme/default/images/icons/twotone/green/plus.gif
deleted file mode 100644 (file)
index 4407d0b..0000000
Binary files a/theme/default/images/icons/twotone/green/plus.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/print.gif b/theme/default/images/icons/twotone/green/print.gif
deleted file mode 100644 (file)
index 17727d5..0000000
Binary files a/theme/default/images/icons/twotone/green/print.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/question-mark.gif b/theme/default/images/icons/twotone/green/question-mark.gif
deleted file mode 100644 (file)
index 1689efc..0000000
Binary files a/theme/default/images/icons/twotone/green/question-mark.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/quote.gif b/theme/default/images/icons/twotone/green/quote.gif
deleted file mode 100644 (file)
index 4ba1f0c..0000000
Binary files a/theme/default/images/icons/twotone/green/quote.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/refresh.gif b/theme/default/images/icons/twotone/green/refresh.gif
deleted file mode 100644 (file)
index 8a8b814..0000000
Binary files a/theme/default/images/icons/twotone/green/refresh.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/reply.gif b/theme/default/images/icons/twotone/green/reply.gif
deleted file mode 100644 (file)
index 6ff01bb..0000000
Binary files a/theme/default/images/icons/twotone/green/reply.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/rewind.gif b/theme/default/images/icons/twotone/green/rewind.gif
deleted file mode 100644 (file)
index aca3ee3..0000000
Binary files a/theme/default/images/icons/twotone/green/rewind.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/search.gif b/theme/default/images/icons/twotone/green/search.gif
deleted file mode 100644 (file)
index c36463d..0000000
Binary files a/theme/default/images/icons/twotone/green/search.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/shield.gif b/theme/default/images/icons/twotone/green/shield.gif
deleted file mode 100644 (file)
index 419d5ee..0000000
Binary files a/theme/default/images/icons/twotone/green/shield.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/skip-back.gif b/theme/default/images/icons/twotone/green/skip-back.gif
deleted file mode 100644 (file)
index adca7aa..0000000
Binary files a/theme/default/images/icons/twotone/green/skip-back.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/skip.gif b/theme/default/images/icons/twotone/green/skip.gif
deleted file mode 100644 (file)
index ae5417f..0000000
Binary files a/theme/default/images/icons/twotone/green/skip.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/skull.gif b/theme/default/images/icons/twotone/green/skull.gif
deleted file mode 100644 (file)
index 0335067..0000000
Binary files a/theme/default/images/icons/twotone/green/skull.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/statusbar.gif b/theme/default/images/icons/twotone/green/statusbar.gif
deleted file mode 100644 (file)
index 47d61b1..0000000
Binary files a/theme/default/images/icons/twotone/green/statusbar.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/stop.gif b/theme/default/images/icons/twotone/green/stop.gif
deleted file mode 100644 (file)
index e0b108d..0000000
Binary files a/theme/default/images/icons/twotone/green/stop.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/template.gif b/theme/default/images/icons/twotone/green/template.gif
deleted file mode 100644 (file)
index 65c0c4a..0000000
Binary files a/theme/default/images/icons/twotone/green/template.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/text-bigger.gif b/theme/default/images/icons/twotone/green/text-bigger.gif
deleted file mode 100644 (file)
index 45e143b..0000000
Binary files a/theme/default/images/icons/twotone/green/text-bigger.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/text-smaller.gif b/theme/default/images/icons/twotone/green/text-smaller.gif
deleted file mode 100644 (file)
index a54d0c1..0000000
Binary files a/theme/default/images/icons/twotone/green/text-smaller.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/trash.gif b/theme/default/images/icons/twotone/green/trash.gif
deleted file mode 100644 (file)
index 78dd64a..0000000
Binary files a/theme/default/images/icons/twotone/green/trash.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/two-docs.gif b/theme/default/images/icons/twotone/green/two-docs.gif
deleted file mode 100644 (file)
index 97e54b9..0000000
Binary files a/theme/default/images/icons/twotone/green/two-docs.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/twotone.gif b/theme/default/images/icons/twotone/green/twotone.gif
deleted file mode 100644 (file)
index 45aad25..0000000
Binary files a/theme/default/images/icons/twotone/green/twotone.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/undo.gif b/theme/default/images/icons/twotone/green/undo.gif
deleted file mode 100644 (file)
index 6869b30..0000000
Binary files a/theme/default/images/icons/twotone/green/undo.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/user.gif b/theme/default/images/icons/twotone/green/user.gif
deleted file mode 100644 (file)
index c85460f..0000000
Binary files a/theme/default/images/icons/twotone/green/user.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/vegetable.gif b/theme/default/images/icons/twotone/green/vegetable.gif
deleted file mode 100644 (file)
index 4d421c1..0000000
Binary files a/theme/default/images/icons/twotone/green/vegetable.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/x.gif b/theme/default/images/icons/twotone/green/x.gif
deleted file mode 100644 (file)
index ffb2efe..0000000
Binary files a/theme/default/images/icons/twotone/green/x.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/zoom-in.gif b/theme/default/images/icons/twotone/green/zoom-in.gif
deleted file mode 100644 (file)
index a59a5bb..0000000
Binary files a/theme/default/images/icons/twotone/green/zoom-in.gif and /dev/null differ
diff --git a/theme/default/images/icons/twotone/green/zoom-out.gif b/theme/default/images/icons/twotone/green/zoom-out.gif
deleted file mode 100644 (file)
index c61f999..0000000
Binary files a/theme/default/images/icons/twotone/green/zoom-out.gif and /dev/null differ
diff --git a/theme/default/logo.png b/theme/default/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/default/logo.png differ
diff --git a/theme/h4ck3r/css/base.css b/theme/h4ck3r/css/base.css
new file mode 100644 (file)
index 0000000..41b3a77
--- /dev/null
@@ -0,0 +1,1139 @@
+/** theme: h4ck3r base
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 100%; background-color:#fff; height:100%; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:1em;
+line-height:1.65;
+position:relative;
+}
+h1,h2,h3,h4,h5,h6 {
+margin-bottom:7px;
+overflow:hidden;
+}
+h1 {
+font-size:1.4em;
+margin-bottom:18px;
+}
+#showstream h1 { display:none; }
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+legend {
+font-weight:bold;
+font-size:1.3em;
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+}
+
+input.submit {
+font-weight:bold;
+cursor:pointer;
+}
+textarea {
+overflow:auto;
+}
+option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+}
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+.error,
+.success {
+padding:4px 1.55%;
+margin-bottom:18px;
+}
+form label.submit {
+display:none;
+}
+
+.form_settings {
+clear:both;
+}
+
+.form_settings fieldset {
+margin-bottom:29px;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+.form_settings .form_data input.submit {
+margin-left:0;
+}
+
+.form_settings label {
+margin-top:2px;
+width:152px;
+}
+
+.form_actions label {
+display:none;
+}
+.form_guide {
+font-style:italic;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend,
+#form_password legend,
+#form_settings_avatar legend,
+#newgroup legend,
+#editgroup legend,
+#form_tag_user legend,
+#form_remote_subscribe legend,
+#form_openid_login legend,
+#form_search legend,
+#form_invite legend,
+#form_notice_delete legend,
+#form_password_recover legend,
+#form_password_change legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:163px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:3px;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide,
+#form_openid_login #settings_rememberme p.form_guide,
+#settings_twitter_remove p.form_guide,
+#form_search ul.form_data #q {
+margin-left:0;
+}
+
+.form_settings .form_note {
+padding:0 7px;
+}
+
+
+.form_settings input.form_action-primary {
+padding:0;
+}
+.form_settings input.form_action-secondary {
+margin-left:29px;
+}
+
+#form_search .submit {
+margin-left:11px;
+}
+
+address {
+float:left;
+margin-bottom:18px;
+margin-left:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+address .fn {
+font-weight:bold;
+}
+address img + .fn {
+display:none;
+}
+
+#header {
+width:100%;
+position:relative;
+float:left;
+padding-top:18px;
+margin-bottom:29px;
+}
+
+#site_nav_global_primary {
+float:right;
+margin-right:18px;
+margin-bottom:11px;
+margin-left:18px;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-left:11px;
+}
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+float:left;
+clear:right;
+margin-top:7px;
+margin-right:18px;
+width:31%;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+#anon_notice {
+float:right;
+clear:right;
+width:41.2%;
+padding:1.1%;
+border-width:2px;
+border-style:dashed;
+line-height:1.5;
+font-size:1.1em;
+font-weight:bold;
+-moz-transform:skewX(-30deg) scale(0.85);
+-webkit-transform:skewX(-30deg) scale(0.85);
+}
+
+
+#footer {
+float:left;
+width:64%;
+padding:18px;
+}
+
+#site_nav_local_views {
+width:100%;
+float:right;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+float:right;
+margin-left:11px;
+list-style-type:none;
+}
+#site_nav_local_views a {
+float:left;
+text-decoration:none;
+padding:4px 11px;
+border-width:1px;
+border-style:dashed;
+border-bottom:0;
+text-shadow: 2px 2px 2px #ddd;
+font-weight:bold;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+}
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin-left:11px;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+#wrap {
+margin:0 auto;
+width:100%;
+min-width:760px;
+max-width:1003px;
+overflow:hidden;
+}
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+}
+
+#content {
+width:60.009%;
+min-height:259px;
+padding:1.795%;
+float:right;
+border-style:dashed;
+border-width:1px;
+}
+#shownotice #content {
+min-height:0;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:27.917%;
+min-height:259px;
+float:right;
+margin-right:4.385%;
+padding:1.795%;
+border-width:1px;
+border-style:dashed;
+}
+
+#form_notice {
+width:43.664%;
+float:right;
+position:relative;
+line-height:1;
+}
+#form_notice fieldset {
+border:0;
+padding:0;
+position:relative;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+float:left;
+width:80.789%;
+height:67px;
+line-height:1.5;
+padding:7px 7px 16px 7px;
+}
+#form_notice label {
+display:block;
+float:left;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice #notice_submit label {
+display:none;
+}
+#form_notice .form_note {
+position:absolute;
+top:99px;
+right:98px;
+z-index:9;
+}
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+padding:1px 2px;
+}
+#form_notice #notice_action-submit {
+width:14%;
+height:47px;
+padding:0;
+position:absolute;
+bottom:0;
+right:0;
+}
+#form_notice label[for=to] {
+margin-top:7px;
+}
+#form_notice select[id=to] {
+margin-bottom:7px;
+margin-left:18px;
+float:left;
+}
+#form_notice .error {
+float:left;
+clear:both;
+width:96.9%;
+margin-bottom:0;
+line-height:1.618;
+}
+
+/* entity_profile */
+.entity_profile {
+position:relative;
+width:67.702%;
+min-height:123px;
+float:left;
+margin-bottom:18px;
+margin-left:0;
+overflow:hidden;
+}
+.entity_profile dt,
+#entity_statistics dt {
+font-weight:bold;
+}
+.entity_profile dd {
+display:inline;
+}
+
+.entity_profile .entity_depiction {
+float:left;
+width:96px;
+margin-right:18px;
+margin-bottom:18px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname,
+.entity_profile .entity_location,
+.entity_profile .entity_url,
+.entity_profile .entity_note,
+.entity_profile .entity_tags {
+margin-left:113px;
+margin-bottom:4px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname {
+margin-left:11px;
+display:inline;
+font-weight:bold;
+}
+.entity_profile .entity_nickname {
+margin-left:0;
+}
+
+.entity_profile .entity_fn dd:before {
+content: "(";
+font-weight:normal;
+}
+.entity_profile .entity_fn dd:after {
+content: ")";
+font-weight:normal;
+}
+
+.entity_profile dt {
+display:none;
+}
+.entity_profile h2 {
+display:none;
+}
+/* entity_profile */
+
+
+/*entity_actions*/
+.entity_actions {
+float:right;
+margin-left:4.35%;
+max-width:25%;
+}
+.entity_actions h2 {
+display:none;
+}
+.entity_actions ul {
+list-style-type:none;
+}
+.entity_actions li {
+margin-bottom:4px;
+}
+.entity_actions li:first-child {
+border-top:0;
+}
+.entity_actions fieldset {
+border:0;
+padding:0;
+}
+.entity_actions legend {
+display:none;
+}
+
+.entity_actions input.submit {
+display:block;
+text-align:left;
+width:100%;
+}
+.entity_actions a,
+.entity_nudge p,
+.entity_remote_subscribe {
+text-decoration:none;
+font-weight:bold;
+display:block;
+}
+
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.entity_edit a,
+.form_user_nudge input.submit,
+.entity_nudge p {
+border:0;
+padding-left:20px;
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.entity_nudge p {
+padding:4px 4px 4px 23px;
+}
+
+.entity_remote_subscribe {
+padding:4px;
+border-width:2px;
+border-style:solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.entity_actions .accept {
+margin-bottom:18px;
+}
+
+.entity_tags ul {
+list-style-type:none;
+display:inline;
+}
+.entity_tags li {
+display:inline;
+margin-right:4px;
+}
+
+.aside .section {
+margin-bottom:29px;
+clear:both;
+float:left;
+width:100%;
+}
+.aside .section h2 {
+text-transform:uppercase;
+font-size:1em;
+}
+
+#entity_statistics dt,
+#entity_statistics dd {
+display:inline;
+}
+#entity_statistics dt:after {
+content: ":";
+}
+
+.section ul.entities {
+float:left;
+width:100%;
+}
+.section .entities li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+.section .entities li .photo {
+margin-right:0;
+margin-bottom:0;
+}
+.section .entities li .fn {
+display:none;
+}
+
+.aside .section p,
+.aside .section .more {
+clear:both;
+}
+
+.profile .entity_profile {
+margin-bottom:0;
+min-height:60px;
+}
+
+
+.profile .form_group_join legend,
+.profile .form_group_leave legend,
+.profile .form_user_subscribe legend,
+.profile .form_user_unsubscribe legend {
+display:none;
+}
+
+.profiles {
+list-style-type:none;
+}
+.profile .entity_profile .entity_location {
+width:auto;
+clear:none;
+margin-left:11px;
+}
+.profile .entity_profile dl,
+.profile .entity_profile dd {
+display:inline;
+float:none;
+}
+.profile .entity_profile .entity_note,
+.profile .entity_profile .entity_url,
+.profile .entity_profile .entity_tags,
+.profile .entity_profile .form_subscription_edit {
+margin-left:59px;
+clear:none;
+display:block;
+width:auto;
+}
+.profile .entity_profile .entity_tags dt {
+display:inline;
+margin-right:11px;
+}
+
+
+.profile .entity_profile .form_subscription_edit label {
+font-weight:normal;
+margin-right:11px;
+}
+
+
+/* NOTICE */
+.notice,
+.profile {
+position:relative;
+padding-top:11px;
+padding-bottom:11px;
+clear:both;
+float:left;
+width:100%;
+border-top-width:1px;
+border-top-style:dashed;
+}
+.notices li {
+list-style-type:none;
+}
+
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:100%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+.notice .author {
+margin-right:11px;
+}
+
+.fn {
+overflow:hidden;
+}
+
+.notice .author .fn {
+font-weight:bold;
+}
+
+.vcard .photo {
+display:inline;
+margin-right:11px;
+float:left;
+}
+#shownotice .vcard .photo {
+margin-bottom:4px;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+
+.notice .entry-title {
+display:inline;
+width:100%;
+overflow:hidden;
+}
+#shownotice .notice .entry-title {
+font-size:2.2em;
+}
+
+.notice p.entry-content {
+display:inline;
+}
+
+#content .notice p.entry-content a:visited {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+float:left;
+font-size:0.95em;
+width:65%;
+}
+
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+
+
+.notice-options {
+padding-left:2%;
+float:left;
+width:50%;
+position:relative;
+font-size:0.95em;
+width:12.5%;
+float:right;
+}
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+top:0;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+left:0;
+}
+.notice-options .notice_reply {
+left:29px;
+}
+.notice-options .notice_delete {
+right:0;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options form input.submit {
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+
+#usergroups #new_group {
+float: left;
+margin-right: 2em;
+}
+#new_group, #group_search {
+margin-bottom:18px;
+}
+#new_group a {
+padding-left:20px;
+}
+
+
+#filter_tags {
+margin-bottom:11px;
+float:left;
+}
+#filter_tags dt {
+display:none;
+}
+#filter_tags ul {
+list-style-type:none;
+}
+#filter_tags ul li {
+float:left;
+margin-left:7px;
+padding-left:7px;
+border-left-width:1px;
+border-left-style:solid;
+}
+#filter_tags ul li.child_1 {
+margin-left:0;
+border-left:0;
+padding-left:0;
+}
+#filter_tags ul li#filter_tags_all a {
+font-weight:bold;
+margin-top:7px;
+float:left;
+}
+
+#filter_tags ul li#filter_tags_item label {
+margin-right:7px;
+}
+#filter_tags ul li#filter_tags_item label,
+#filter_tags ul li#filter_tags_item select {
+display:inline;
+}
+#filter_tags ul li#filter_tags_item p {
+float:left;
+margin-left:38px;
+}
+#filter_tags ul li#filter_tags_item input {
+position:relative;
+top:3px;
+left:3px;
+}
+
+
+
+.pagination {
+float:left;
+clear:both;
+width:100%;
+margin-top:18px;
+}
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border-width:1px;
+border-style:solid;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-radius:7px;
+}
+
+.pagination .nav_prev a {
+padding-left:30px;
+}
+.pagination .nav_next a {
+padding-right:30px;
+}
+/* END: NOTICE */
+
+
+.hentry .entry-content p {
+margin-bottom:18px;
+}
+.system_notice ul,
+.instructions ul,
+.hentry entry-content ol,
+.hentry .entry-content ul {
+list-style-position:inside;
+}
+.hentry .entry-content li {
+margin-bottom:18px;
+}
+.hentry .entry-content li li {
+margin-left:18px;
+}
+
+
+
+
+/* TOP_POSTERS */
+.section tbody td {
+padding-right:11px;
+padding-bottom:11px;
+}
+.section .vcard .photo {
+margin-right:7px;
+margin-bottom:0;
+}
+
+.section .notice {
+padding-top:7px;
+padding-bottom:7px;
+border-top:0;
+}
+
+.section .notice:first-child {
+padding-top:0;
+}
+
+.section .notice .author {
+margin-right:0;
+}
+.section .notice .author .fn {
+display:none;
+}
+
+
+/* tagcloud */
+.tag-cloud {
+list-style-type:none;
+text-align:center;
+}
+.aside .tag-cloud {
+font-size:0.8em;
+}
+.tag-cloud li {
+display:inline;
+margin-right:7px;
+line-height:1.25;
+}
+.aside .tag-cloud li {
+line-height:1.5;
+}
+.tag-cloud li a {
+text-decoration:none;
+}
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+.tag-cloud-1 {
+font-size:1em;
+}
+.tag-cloud-2 {
+font-size:1.25em;
+}
+.tag-cloud-3 {
+font-size:1.75em;
+}
+.tag-cloud-4 {
+font-size:2em;
+}
+.tag-cloud-5 {
+font-size:2.25em;
+}
+.tag-cloud-6 {
+font-size:2.75em;
+}
+.tag-cloud-7 {
+font-size:3.25em;
+}
+
+#publictagcloud #tagcloud.section dt {
+display:none;
+}
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+#form_settings_avatar li {
+width:auto;
+}
+#form_settings_avatar input {
+margin-left:0;
+}
+#avatar_original,
+#avatar_preview {
+float:left;
+}
+#avatar_preview {
+margin-left:29px;
+}
+#avatar_preview_view {
+height:96px;
+width:96px;
+margin-bottom:18px;
+overflow:hidden;
+}
+
+#settings_attach,
+#form_settings_avatar .form_actions {
+clear:both;
+}
+
+#form_settings_avatar .form_actions {
+margin-bottom:0;
+}
+
+#form_settings_design #settings_design_color .form_data,
+#form_settings_design #color-picker {
+float:left;
+}
+#form_settings_design #settings_design_color .form_data {
+width:400px;
+margin-right:28px;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
+.instructions p,
+.instructions ul {
+margin-bottom:18px;
+}
+.help dt {
+display:none;
+}
+.guide {
+clear:both;
+}
diff --git a/theme/h4ck3r/css/display.css b/theme/h4ck3r/css/display.css
new file mode 100644 (file)
index 0000000..31d49a5
--- /dev/null
@@ -0,0 +1,236 @@
+/** theme: h4ck3r
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+@import url(base.css);
+
+html,
+body,
+a:active {
+background-color:#000;
+}
+
+body {
+background-image:url(../images/illustrations/illu_h4x0r1ng.gif);
+font-family: monospace;
+font-size:1em;
+color:#647819;
+}
+address {
+margin-right:7.18%;
+}
+
+input, textarea, select, option {
+font-family:  monospace;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+background-color:#000;
+color:#ccc;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-primary {
+background:none;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+.form_settings .form_note,
+.entity_remote_subscribe {
+background-color:rgba(0, 255, 0, 0.5);
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#9BB43E;
+}
+input.submit,
+.entity_remote_subscribe {
+color:#fff;
+}
+
+a,
+div.notice-options input,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.entity_nudge p,
+.form_settings input.form_action-primary {
+color:#0f0;
+}
+
+.notice,
+.profile {
+border-top-color:#333;
+}
+.section .profile {
+border-top-color:#87B4C8;
+}
+
+#aside_primary {
+background-color:rgba(0,128,0,0.3);
+}
+
+#notice_text-count {
+color:#0f0;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#ccc url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+cursor:wait;
+text-indent:-9999px;
+}
+
+#content,
+#site_nav_local_views a,
+#aside_primary {
+border-color:#50964D;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:rgba(0, 0, 0, 0.698);
+}
+
+#site_nav_local_views a {
+background-color:rgba(0, 200, 0, 0.3);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.4);
+}
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+#anon_notice {
+color:#ccc;
+border-color:#50964D;
+}
+
+#showstream #anon_notice {
+}
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.png);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.png);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_nudge p {
+background-position: 0 40%;
+background-repeat: no-repeat;
+background-color:transparent;
+}
+.form_group_join input.submit,
+.form_group_leave input.submit
+.form_user_subscribe input.submit,
+.form_user_unsubscribe input.submit {
+background-color:#9BB43E;
+color:#ccc;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit,
+.form_user_authorization input.reject {
+background-color:#87B4C8;
+}
+
+.entity_edit a {
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
+}
+.entity_send-a-message a {
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
+}
+.entity_nudge p,
+.form_user_nudge input.submit {
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
+}
+.form_user_block input.submit,
+.form_user_unblock input.submit {
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
+}
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:0.4;
+}
+.notices li.hover div.entry-content,
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#ccc;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+
+/*END: NOTICES */
+
+#new_group a {
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
+}
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+border-color:#000;
+}
+.pagination .nav_prev a {
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
+background-position:10% 45%;
+}
+.pagination .nav_next a {
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
+background-position:90% 45%;
+}
diff --git a/theme/h4ck3r/css/ie.css b/theme/h4ck3r/css/ie.css
new file mode 100644 (file)
index 0000000..2f463bb
--- /dev/null
@@ -0,0 +1,9 @@
+/* IE specific styles */
+
+.notice-options input.submit {
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:#D0DFE7;
+}
diff --git a/theme/h4ck3r/default-avatar-mini.png b/theme/h4ck3r/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..38b8692
Binary files /dev/null and b/theme/h4ck3r/default-avatar-mini.png differ
diff --git a/theme/h4ck3r/default-avatar-profile.png b/theme/h4ck3r/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..f8357d4
Binary files /dev/null and b/theme/h4ck3r/default-avatar-profile.png differ
diff --git a/theme/h4ck3r/default-avatar-stream.png b/theme/h4ck3r/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..6b63baa
Binary files /dev/null and b/theme/h4ck3r/default-avatar-stream.png differ
diff --git a/theme/h4ck3r/images/illustrations/illu_h4x0r1ng.gif b/theme/h4ck3r/images/illustrations/illu_h4x0r1ng.gif
new file mode 100644 (file)
index 0000000..c233af3
Binary files /dev/null and b/theme/h4ck3r/images/illustrations/illu_h4x0r1ng.gif differ
diff --git a/theme/h4ck3r/logo.png b/theme/h4ck3r/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/h4ck3r/logo.png differ
index d05578d4395c1794affa3030d44c07f3ffbe8e54..1f1298737cd19430cc3393db22e8accfde5be3a6 100644 (file)
@@ -33,7 +33,7 @@ border-color:#aaa;
 border-color:#ddd;
 }
 
-.form_settings input.form_action-secondary {
+.form_settings input.form_action-primary {
 background:none;
 }
 
@@ -60,7 +60,7 @@ div.notice-options input,
 .entity_send-a-message a,
 .form_user_nudge input.submit,
 .entity_nudge p,
-.form_settings input.form_action-secondary {
+.form_settings input.form_action-primary {
 color:#002E6E;
 }
 
@@ -72,13 +72,6 @@ border-top-color:#CEE1E9;
 border-top-color:#87B4C8;
 }
 
-#content .notice p.entry-content a:visited {
-background-color:#fcfcfc;
-}
-#content .notice p.entry-content .vcard a {
-background-color:#fcfffc;
-}
-
 #aside_primary {
 background-color:#CEE1E9;
 }
@@ -167,44 +160,48 @@ background-color:#87B4C8;
 }
 
 .entity_edit a {
-background-image:url(../images/icons/twotone/green/edit.gif);
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
 }
 .entity_send-a-message a {
-background-image:url(../images/icons/twotone/green/quote.gif);
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
 }
 .entity_nudge p,
 .form_user_nudge input.submit {
-background-image:url(../images/icons/twotone/green/mail.gif);
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
 }
 .form_user_block input.submit,
 .form_user_unblock input.submit {
-background-image:url(../images/icons/twotone/green/shield.gif);
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
 }
 
 /* NOTICES */
-.notices li.over {
-background-color:#fcfcfc;
+.notice .attachment {
+background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%;
+}
+#attachments .attachment {
+background:none;
 }
-
 .notice-options .notice_reply a,
 .notice-options form input.submit {
 background-color:transparent;
 }
 .notice-options .notice_reply a {
-background:transparent url(../images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
 }
 .notice-options form.form_favor input.submit {
-background:transparent url(../images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
 }
 .notice-options form.form_disfavor input.submit {
-background:transparent url(../images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
 }
 .notice-options .notice_delete a {
-background:transparent url(../images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
 }
 
 .notices div.entry-content,
-.notices div.notice-options {
+.notices div.notice-options,
+.notices li.hover .notices div.entry-content,
+.notices li.hover .notices div.notice-options {
 opacity:0.4;
 }
 .notices li.hover div.entry-content,
@@ -221,10 +218,23 @@ font-family:sans-serif;
 .notices li.hover {
 background-color:#fcfcfc;
 }
+
+.notices .notices {
+background-color:rgba(200, 200, 200, 0.050);
+}
+.notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.100);
+}
+.notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.150);
+}
+.notices .notices .notices .notices .notices {
+background-color:rgba(200, 200, 200, 0.300);
+}
 /*END: NOTICES */
 
 #new_group a {
-background:transparent url(../images/icons/twotone/green/news.gif) no-repeat 0 45%;
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
 }
 
 .pagination .nav_prev a,
@@ -233,10 +243,10 @@ background-repeat:no-repeat;
 border-color:#CEE1E9;
 }
 .pagination .nav_prev a {
-background-image:url(../images/icons/twotone/green/arrow-left.gif);
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
 background-position:10% 45%;
 }
 .pagination .nav_next a {
-background-image:url(../images/icons/twotone/green/arrow-right.gif);
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
 background-position:90% 45%;
 }
diff --git a/theme/identica/images/icons/icon_atom.jpg b/theme/identica/images/icons/icon_atom.jpg
deleted file mode 100644 (file)
index 22853ed..0000000
Binary files a/theme/identica/images/icons/icon_atom.jpg and /dev/null differ
diff --git a/theme/identica/images/icons/icon_foaf.gif b/theme/identica/images/icons/icon_foaf.gif
deleted file mode 100644 (file)
index f8f7844..0000000
Binary files a/theme/identica/images/icons/icon_foaf.gif and /dev/null differ
diff --git a/theme/identica/images/icons/icon_rss.jpg b/theme/identica/images/icons/icon_rss.jpg
deleted file mode 100644 (file)
index da23422..0000000
Binary files a/theme/identica/images/icons/icon_rss.jpg and /dev/null differ
diff --git a/theme/identica/images/icons/icon_vcard.gif b/theme/identica/images/icons/icon_vcard.gif
deleted file mode 100644 (file)
index 6d52947..0000000
Binary files a/theme/identica/images/icons/icon_vcard.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/against.gif b/theme/identica/images/icons/twotone/green/against.gif
deleted file mode 100644 (file)
index ca796c8..0000000
Binary files a/theme/identica/images/icons/twotone/green/against.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-down.gif b/theme/identica/images/icons/twotone/green/arrow-down.gif
deleted file mode 100644 (file)
index c709e58..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-down.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-downleft.gif b/theme/identica/images/icons/twotone/green/arrow-downleft.gif
deleted file mode 100644 (file)
index a4a9803..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-downleft.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-downright.gif b/theme/identica/images/icons/twotone/green/arrow-downright.gif
deleted file mode 100644 (file)
index 3e6001a..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-downright.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-left.gif b/theme/identica/images/icons/twotone/green/arrow-left.gif
deleted file mode 100644 (file)
index afed190..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-left.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-right.gif b/theme/identica/images/icons/twotone/green/arrow-right.gif
deleted file mode 100644 (file)
index ee1707e..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-right.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-up.gif b/theme/identica/images/icons/twotone/green/arrow-up.gif
deleted file mode 100644 (file)
index d0f5fbe..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-up.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-upleft.gif b/theme/identica/images/icons/twotone/green/arrow-upleft.gif
deleted file mode 100644 (file)
index 1e9e693..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-upleft.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-upright.gif b/theme/identica/images/icons/twotone/green/arrow-upright.gif
deleted file mode 100644 (file)
index c7fecc8..0000000
Binary files a/theme/identica/images/icons/twotone/green/arrow-upright.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/back-forth.gif b/theme/identica/images/icons/twotone/green/back-forth.gif
deleted file mode 100644 (file)
index 33a9540..0000000
Binary files a/theme/identica/images/icons/twotone/green/back-forth.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/bookmark.gif b/theme/identica/images/icons/twotone/green/bookmark.gif
deleted file mode 100644 (file)
index 23f318e..0000000
Binary files a/theme/identica/images/icons/twotone/green/bookmark.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/bulb.gif b/theme/identica/images/icons/twotone/green/bulb.gif
deleted file mode 100644 (file)
index f70652c..0000000
Binary files a/theme/identica/images/icons/twotone/green/bulb.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/calendar.gif b/theme/identica/images/icons/twotone/green/calendar.gif
deleted file mode 100644 (file)
index a09b65a..0000000
Binary files a/theme/identica/images/icons/twotone/green/calendar.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/calendar2.gif b/theme/identica/images/icons/twotone/green/calendar2.gif
deleted file mode 100644 (file)
index 7884b02..0000000
Binary files a/theme/identica/images/icons/twotone/green/calendar2.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/camera.gif b/theme/identica/images/icons/twotone/green/camera.gif
deleted file mode 100644 (file)
index 1a85fba..0000000
Binary files a/theme/identica/images/icons/twotone/green/camera.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/cart.gif b/theme/identica/images/icons/twotone/green/cart.gif
deleted file mode 100644 (file)
index 47eaa0a..0000000
Binary files a/theme/identica/images/icons/twotone/green/cart.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/caution.gif b/theme/identica/images/icons/twotone/green/caution.gif
deleted file mode 100644 (file)
index 3ad2c32..0000000
Binary files a/theme/identica/images/icons/twotone/green/caution.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/chart.gif b/theme/identica/images/icons/twotone/green/chart.gif
deleted file mode 100644 (file)
index 136d745..0000000
Binary files a/theme/identica/images/icons/twotone/green/chart.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/checkmark.gif b/theme/identica/images/icons/twotone/green/checkmark.gif
deleted file mode 100644 (file)
index 892429d..0000000
Binary files a/theme/identica/images/icons/twotone/green/checkmark.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/clipboard.gif b/theme/identica/images/icons/twotone/green/clipboard.gif
deleted file mode 100644 (file)
index 9317bdc..0000000
Binary files a/theme/identica/images/icons/twotone/green/clipboard.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/clock.gif b/theme/identica/images/icons/twotone/green/clock.gif
deleted file mode 100644 (file)
index d1410f9..0000000
Binary files a/theme/identica/images/icons/twotone/green/clock.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/closed-folder.gif b/theme/identica/images/icons/twotone/green/closed-folder.gif
deleted file mode 100644 (file)
index 0410fc6..0000000
Binary files a/theme/identica/images/icons/twotone/green/closed-folder.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/database.gif b/theme/identica/images/icons/twotone/green/database.gif
deleted file mode 100644 (file)
index 29ce024..0000000
Binary files a/theme/identica/images/icons/twotone/green/database.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/disfavourite.gif b/theme/identica/images/icons/twotone/green/disfavourite.gif
deleted file mode 100644 (file)
index 3946869..0000000
Binary files a/theme/identica/images/icons/twotone/green/disfavourite.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/diskette.gif b/theme/identica/images/icons/twotone/green/diskette.gif
deleted file mode 100644 (file)
index e970b0a..0000000
Binary files a/theme/identica/images/icons/twotone/green/diskette.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/document.gif b/theme/identica/images/icons/twotone/green/document.gif
deleted file mode 100644 (file)
index 9c08f4a..0000000
Binary files a/theme/identica/images/icons/twotone/green/document.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/double-arrow.gif b/theme/identica/images/icons/twotone/green/double-arrow.gif
deleted file mode 100644 (file)
index 2e86482..0000000
Binary files a/theme/identica/images/icons/twotone/green/double-arrow.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/edit.gif b/theme/identica/images/icons/twotone/green/edit.gif
deleted file mode 100644 (file)
index c746aca..0000000
Binary files a/theme/identica/images/icons/twotone/green/edit.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/eject.gif b/theme/identica/images/icons/twotone/green/eject.gif
deleted file mode 100644 (file)
index 7e0906c..0000000
Binary files a/theme/identica/images/icons/twotone/green/eject.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/exclaim.gif b/theme/identica/images/icons/twotone/green/exclaim.gif
deleted file mode 100644 (file)
index 588e28c..0000000
Binary files a/theme/identica/images/icons/twotone/green/exclaim.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/fastforward.gif b/theme/identica/images/icons/twotone/green/fastforward.gif
deleted file mode 100644 (file)
index 28e4951..0000000
Binary files a/theme/identica/images/icons/twotone/green/fastforward.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/favourite.gif b/theme/identica/images/icons/twotone/green/favourite.gif
deleted file mode 100644 (file)
index d93515e..0000000
Binary files a/theme/identica/images/icons/twotone/green/favourite.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/flag.gif b/theme/identica/images/icons/twotone/green/flag.gif
deleted file mode 100644 (file)
index 68c8aee..0000000
Binary files a/theme/identica/images/icons/twotone/green/flag.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/graph.gif b/theme/identica/images/icons/twotone/green/graph.gif
deleted file mode 100644 (file)
index 0c1794b..0000000
Binary files a/theme/identica/images/icons/twotone/green/graph.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/grow.gif b/theme/identica/images/icons/twotone/green/grow.gif
deleted file mode 100644 (file)
index c4118d5..0000000
Binary files a/theme/identica/images/icons/twotone/green/grow.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/headphones.gif b/theme/identica/images/icons/twotone/green/headphones.gif
deleted file mode 100644 (file)
index 5be6c67..0000000
Binary files a/theme/identica/images/icons/twotone/green/headphones.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/home.gif b/theme/identica/images/icons/twotone/green/home.gif
deleted file mode 100644 (file)
index d2a3421..0000000
Binary files a/theme/identica/images/icons/twotone/green/home.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/hourglass.gif b/theme/identica/images/icons/twotone/green/hourglass.gif
deleted file mode 100644 (file)
index b62b948..0000000
Binary files a/theme/identica/images/icons/twotone/green/hourglass.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/info.gif b/theme/identica/images/icons/twotone/green/info.gif
deleted file mode 100644 (file)
index 86ef1f8..0000000
Binary files a/theme/identica/images/icons/twotone/green/info.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/key.gif b/theme/identica/images/icons/twotone/green/key.gif
deleted file mode 100644 (file)
index ccf357a..0000000
Binary files a/theme/identica/images/icons/twotone/green/key.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/lock.gif b/theme/identica/images/icons/twotone/green/lock.gif
deleted file mode 100644 (file)
index db00706..0000000
Binary files a/theme/identica/images/icons/twotone/green/lock.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/mail.gif b/theme/identica/images/icons/twotone/green/mail.gif
deleted file mode 100644 (file)
index 1084c86..0000000
Binary files a/theme/identica/images/icons/twotone/green/mail.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/move.gif b/theme/identica/images/icons/twotone/green/move.gif
deleted file mode 100644 (file)
index d2c30b1..0000000
Binary files a/theme/identica/images/icons/twotone/green/move.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/music.gif b/theme/identica/images/icons/twotone/green/music.gif
deleted file mode 100644 (file)
index 64b51d4..0000000
Binary files a/theme/identica/images/icons/twotone/green/music.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/news.gif b/theme/identica/images/icons/twotone/green/news.gif
deleted file mode 100644 (file)
index 712c685..0000000
Binary files a/theme/identica/images/icons/twotone/green/news.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/note.gif b/theme/identica/images/icons/twotone/green/note.gif
deleted file mode 100644 (file)
index bcc0b14..0000000
Binary files a/theme/identica/images/icons/twotone/green/note.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/open-folder.gif b/theme/identica/images/icons/twotone/green/open-folder.gif
deleted file mode 100644 (file)
index d41300a..0000000
Binary files a/theme/identica/images/icons/twotone/green/open-folder.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/paper-clip.gif b/theme/identica/images/icons/twotone/green/paper-clip.gif
deleted file mode 100644 (file)
index 1d45f1d..0000000
Binary files a/theme/identica/images/icons/twotone/green/paper-clip.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/paper-clip2.gif b/theme/identica/images/icons/twotone/green/paper-clip2.gif
deleted file mode 100644 (file)
index a8c7805..0000000
Binary files a/theme/identica/images/icons/twotone/green/paper-clip2.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/pause.gif b/theme/identica/images/icons/twotone/green/pause.gif
deleted file mode 100644 (file)
index ced0b64..0000000
Binary files a/theme/identica/images/icons/twotone/green/pause.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/phone.gif b/theme/identica/images/icons/twotone/green/phone.gif
deleted file mode 100644 (file)
index 69359f7..0000000
Binary files a/theme/identica/images/icons/twotone/green/phone.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/play.gif b/theme/identica/images/icons/twotone/green/play.gif
deleted file mode 100644 (file)
index 794ec85..0000000
Binary files a/theme/identica/images/icons/twotone/green/play.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/plus.gif b/theme/identica/images/icons/twotone/green/plus.gif
deleted file mode 100644 (file)
index 4407d0b..0000000
Binary files a/theme/identica/images/icons/twotone/green/plus.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/print.gif b/theme/identica/images/icons/twotone/green/print.gif
deleted file mode 100644 (file)
index 17727d5..0000000
Binary files a/theme/identica/images/icons/twotone/green/print.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/question-mark.gif b/theme/identica/images/icons/twotone/green/question-mark.gif
deleted file mode 100644 (file)
index 1689efc..0000000
Binary files a/theme/identica/images/icons/twotone/green/question-mark.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/quote.gif b/theme/identica/images/icons/twotone/green/quote.gif
deleted file mode 100644 (file)
index 4ba1f0c..0000000
Binary files a/theme/identica/images/icons/twotone/green/quote.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/refresh.gif b/theme/identica/images/icons/twotone/green/refresh.gif
deleted file mode 100644 (file)
index 8a8b814..0000000
Binary files a/theme/identica/images/icons/twotone/green/refresh.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/reply.gif b/theme/identica/images/icons/twotone/green/reply.gif
deleted file mode 100644 (file)
index 6ff01bb..0000000
Binary files a/theme/identica/images/icons/twotone/green/reply.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/rewind.gif b/theme/identica/images/icons/twotone/green/rewind.gif
deleted file mode 100644 (file)
index aca3ee3..0000000
Binary files a/theme/identica/images/icons/twotone/green/rewind.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/search.gif b/theme/identica/images/icons/twotone/green/search.gif
deleted file mode 100644 (file)
index c36463d..0000000
Binary files a/theme/identica/images/icons/twotone/green/search.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/shield.gif b/theme/identica/images/icons/twotone/green/shield.gif
deleted file mode 100644 (file)
index 419d5ee..0000000
Binary files a/theme/identica/images/icons/twotone/green/shield.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/skip-back.gif b/theme/identica/images/icons/twotone/green/skip-back.gif
deleted file mode 100644 (file)
index adca7aa..0000000
Binary files a/theme/identica/images/icons/twotone/green/skip-back.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/skip.gif b/theme/identica/images/icons/twotone/green/skip.gif
deleted file mode 100644 (file)
index ae5417f..0000000
Binary files a/theme/identica/images/icons/twotone/green/skip.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/skull.gif b/theme/identica/images/icons/twotone/green/skull.gif
deleted file mode 100644 (file)
index 0335067..0000000
Binary files a/theme/identica/images/icons/twotone/green/skull.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/statusbar.gif b/theme/identica/images/icons/twotone/green/statusbar.gif
deleted file mode 100644 (file)
index 47d61b1..0000000
Binary files a/theme/identica/images/icons/twotone/green/statusbar.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/stop.gif b/theme/identica/images/icons/twotone/green/stop.gif
deleted file mode 100644 (file)
index e0b108d..0000000
Binary files a/theme/identica/images/icons/twotone/green/stop.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/template.gif b/theme/identica/images/icons/twotone/green/template.gif
deleted file mode 100644 (file)
index 65c0c4a..0000000
Binary files a/theme/identica/images/icons/twotone/green/template.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/text-bigger.gif b/theme/identica/images/icons/twotone/green/text-bigger.gif
deleted file mode 100644 (file)
index 45e143b..0000000
Binary files a/theme/identica/images/icons/twotone/green/text-bigger.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/text-smaller.gif b/theme/identica/images/icons/twotone/green/text-smaller.gif
deleted file mode 100644 (file)
index a54d0c1..0000000
Binary files a/theme/identica/images/icons/twotone/green/text-smaller.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/trash.gif b/theme/identica/images/icons/twotone/green/trash.gif
deleted file mode 100644 (file)
index 78dd64a..0000000
Binary files a/theme/identica/images/icons/twotone/green/trash.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/two-docs.gif b/theme/identica/images/icons/twotone/green/two-docs.gif
deleted file mode 100644 (file)
index 97e54b9..0000000
Binary files a/theme/identica/images/icons/twotone/green/two-docs.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/twotone.gif b/theme/identica/images/icons/twotone/green/twotone.gif
deleted file mode 100644 (file)
index 45aad25..0000000
Binary files a/theme/identica/images/icons/twotone/green/twotone.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/undo.gif b/theme/identica/images/icons/twotone/green/undo.gif
deleted file mode 100644 (file)
index 6869b30..0000000
Binary files a/theme/identica/images/icons/twotone/green/undo.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/user.gif b/theme/identica/images/icons/twotone/green/user.gif
deleted file mode 100644 (file)
index c85460f..0000000
Binary files a/theme/identica/images/icons/twotone/green/user.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/vegetable.gif b/theme/identica/images/icons/twotone/green/vegetable.gif
deleted file mode 100644 (file)
index 4d421c1..0000000
Binary files a/theme/identica/images/icons/twotone/green/vegetable.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/x.gif b/theme/identica/images/icons/twotone/green/x.gif
deleted file mode 100644 (file)
index ffb2efe..0000000
Binary files a/theme/identica/images/icons/twotone/green/x.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/zoom-in.gif b/theme/identica/images/icons/twotone/green/zoom-in.gif
deleted file mode 100644 (file)
index a59a5bb..0000000
Binary files a/theme/identica/images/icons/twotone/green/zoom-in.gif and /dev/null differ
diff --git a/theme/identica/images/icons/twotone/green/zoom-out.gif b/theme/identica/images/icons/twotone/green/zoom-out.gif
deleted file mode 100644 (file)
index c61f999..0000000
Binary files a/theme/identica/images/icons/twotone/green/zoom-out.gif and /dev/null differ
diff --git a/theme/otalk/css/base.css b/theme/otalk/css/base.css
new file mode 100644 (file)
index 0000000..b399925
--- /dev/null
@@ -0,0 +1,1211 @@
+/** theme: otalk base
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 87.5%; background-color:#fff; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:1em;
+line-height:1.65;
+position:relative;
+}
+h1,h2,h3,h4,h5,h6 {
+margin-bottom:7px;
+overflow:hidden;
+}
+h1 {
+font-size:1.4em;
+margin-bottom:18px;
+}
+#showstream h1 { display:none; }
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+legend {
+font-weight:bold;
+font-size:1.3em;
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+input.submit {
+font-weight:bold;
+cursor:pointer;
+}
+textarea {
+overflow:auto;
+}
+option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+}
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+.error,
+.success {
+padding:4px 7px;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+margin-bottom:18px;
+}
+form label.submit {
+display:none;
+}
+
+.form_settings {
+clear:both;
+}
+
+.form_settings fieldset {
+margin-bottom:29px;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+.form_settings .form_data input.submit {
+margin-left:0;
+}
+
+.form_settings label {
+margin-top:2px;
+width:152px;
+}
+
+.form_actions label {
+display:none;
+}
+.form_guide {
+font-style:italic;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend,
+#form_password legend,
+#form_settings_avatar legend,
+#newgroup legend,
+#editgroup legend,
+#form_tag_user legend,
+#form_remote_subscribe legend,
+#form_openid_login legend,
+#form_search legend,
+#form_invite legend,
+#form_notice_delete legend,
+#form_password_recover legend,
+#form_password_change legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:163px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:3px;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide,
+#form_openid_login #settings_rememberme p.form_guide,
+#settings_twitter_remove p.form_guide,
+#form_search ul.form_data #q {
+margin-left:0;
+}
+
+.form_settings .form_note {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+padding:0 7px;
+}
+
+
+.form_settings input.form_action-primary {
+padding:0;
+}
+.form_settings input.form_action-secondary {
+margin-left:29px;
+}
+
+#form_search .submit {
+margin-left:11px;
+}
+
+address {
+float:left;
+margin-bottom:18px;
+margin-left:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+address .fn {
+font-weight:bold;
+}
+address img + .fn {
+display:none;
+}
+
+#header {
+width:100%;
+position:relative;
+float:left;
+padding-top:18px;
+margin-bottom:29px;
+}
+
+#site_nav_global_primary {
+float:right;
+margin-right:18px;
+margin-bottom:11px;
+margin-left:18px;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-left:11px;
+}
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+position:absolute;
+top:65px;
+right:18px;
+width:250px;
+width:24%;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+#anon_notice {
+float:left;
+width:43.2%;
+padding:1.1%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-width:2px;
+border-style:solid;
+line-height:1.5;
+font-size:1.1em;
+font-weight:bold;
+}
+
+
+#footer {
+float:left;
+width:64%;
+padding:18px;
+}
+
+#site_nav_local_views {
+float:left;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+float:left;
+margin-right:18px;
+list-style-type:none;
+}
+#site_nav_local_views a {
+float:left;
+text-decoration:none;
+padding:4px 11px;
+-moz-border-radius-topleft:4px;
+-moz-border-radius-topright:4px;
+-webkit-border-top-left-radius:4px;
+-webkit-border-top-right-radius:4px;
+border-width:0;
+border-style:solid;
+border-bottom:0;
+text-shadow: 2px 2px 2px #ddd;
+font-weight:bold;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+border-bottom-width:1px;
+border-bottom-style:solid;
+}
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin-left:11px;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+#wrap {
+margin:0 auto;
+width:100%;
+min-width:760px;
+max-width:1003px;
+overflow:hidden;
+}
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+}
+
+#content {
+width:67.9%;
+min-height:259px;
+padding-top:1.795%;
+padding-bottom:1.795%;
+float:left;
+clear:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-moz-border-radius-topleft:0;
+-webkit-border-radius:7px;
+-webkit-border-top-left-radius:0;
+border-style:solid;
+border-width:0;
+margin-bottom:18px;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:27.917%;
+min-height:259px;
+float:left;
+padding:1.795%;
+margin-left:0.385%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-width:1px;
+border-style:solid;
+}
+
+#form_notice {
+width:45.664%;
+float:left;
+position:relative;
+line-height:1;
+}
+#form_notice fieldset {
+border:0;
+padding:0;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+float:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+width:80.789%;
+height:67px;
+line-height:1.5;
+padding:7px 7px 16px 7px;
+}
+#form_notice label {
+display:block;
+float:left;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice #notice_submit label {
+display:none;
+}
+#form_notice .form_note {
+position:absolute;
+top:99px;
+right:98px;
+z-index:9;
+}
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+padding:1px 2px;
+}
+#form_notice #notice_action-submit {
+width:14%;
+height:47px;
+padding:0;
+position:absolute;
+bottom:0;
+right:0;
+}
+#form_notice label[for=to] {
+margin-top:7px;
+}
+#form_notice select[id=to] {
+margin-bottom:7px;
+margin-left:18px;
+float:left;
+}
+
+
+/* entity_profile */
+.entity_profile {
+position:relative;
+width:521px;
+min-height:123px;
+float:left;
+margin-bottom:18px;
+margin-left:0;
+overflow:hidden;
+}
+.entity_profile dt,
+#entity_statistics dt {
+font-weight:bold;
+}
+.entity_profile dd {
+display:inline;
+}
+
+.entity_profile .entity_depiction {
+float:left;
+width:96px;
+margin-right:18px;
+margin-bottom:18px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname,
+.entity_profile .entity_location,
+.entity_profile .entity_url,
+.entity_profile .entity_note,
+.entity_profile .entity_tags {
+margin-left:113px;
+margin-bottom:4px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname {
+margin-left:11px;
+display:inline;
+font-weight:bold;
+}
+.entity_profile .entity_nickname {
+margin-left:0;
+}
+
+.entity_profile .entity_fn dd:before {
+content: "(";
+font-weight:normal;
+}
+.entity_profile .entity_fn dd:after {
+content: ")";
+font-weight:normal;
+}
+
+.entity_profile dt {
+display:none;
+}
+.entity_profile h2 {
+display:none;
+}
+/* entity_profile */
+
+
+/*entity_actions*/
+.entity_actions {
+float:left;
+margin-left:4.35%;
+max-width:25%;
+}
+.entity_actions h2 {
+display:none;
+}
+.entity_actions ul {
+list-style-type:none;
+}
+.entity_actions li {
+margin-bottom:4px;
+}
+.entity_actions li:first-child {
+border-top:0;
+}
+.entity_actions fieldset {
+border:0;
+padding:0;
+}
+.entity_actions legend {
+display:none;
+}
+
+.entity_actions input.submit {
+display:block;
+text-align:left;
+width:100%;
+}
+.entity_actions a,
+.entity_nudge p,
+.entity_remote_subscribe {
+text-decoration:none;
+font-weight:bold;
+display:block;
+}
+
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.entity_edit a,
+.form_user_nudge input.submit,
+.entity_nudge p {
+border:0;
+padding-left:20px;
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.entity_nudge p {
+padding:4px 4px 4px 23px;
+}
+
+.entity_remote_subscribe {
+padding:4px;
+border-width:2px;
+border-style:solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.entity_actions .accept {
+margin-bottom:18px;
+}
+
+.entity_tags ul {
+list-style-type:none;
+display:inline;
+}
+.entity_tags li {
+display:inline;
+margin-right:4px;
+}
+
+.aside .section {
+margin-bottom:29px;
+clear:both;
+float:left;
+width:100%;
+}
+.aside .section h2 {
+text-transform:uppercase;
+font-size:1em;
+}
+
+#entity_statistics dt,
+#entity_statistics dd {
+display:inline;
+}
+#entity_statistics dt:after {
+content: ":";
+}
+
+.section ul.entities {
+float:left;
+width:100%;
+}
+.section .entities li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+.section .entities li .photo {
+margin-right:0;
+margin-bottom:0;
+}
+.section .entities li .fn {
+display:none;
+}
+
+.aside .section p,
+.aside .section .more {
+clear:both;
+}
+
+.profile .entity_profile {
+margin-bottom:0;
+min-height:60px;
+}
+
+
+.profile .form_group_join legend,
+.profile .form_group_leave legend,
+.profile .form_user_subscribe legend,
+.profile .form_user_unsubscribe legend {
+display:none;
+}
+
+.profiles {
+list-style-type:none;
+}
+.profile .entity_profile .entity_location {
+width:auto;
+clear:none;
+margin-left:11px;
+}
+.profile .entity_profile dl,
+.profile .entity_profile dd {
+display:inline;
+float:none;
+}
+.profile .entity_profile .entity_note,
+.profile .entity_profile .entity_url,
+.profile .entity_profile .entity_tags,
+.profile .entity_profile .form_subscription_edit {
+margin-left:59px;
+clear:none;
+display:block;
+width:auto;
+}
+.profile .entity_profile .entity_tags dt {
+display:inline;
+margin-right:11px;
+}
+
+
+.profile .entity_profile .form_subscription_edit label {
+font-weight:normal;
+margin-right:11px;
+}
+
+
+/* NOTICE */
+.notice,
+.profile {
+position:relative;
+clear:both;
+float:left;
+width:100%;
+border-width:0;
+border-style:solid;
+margin-bottom:29px;
+}
+.notices li {
+list-style-type:none;
+}
+
+#content .notice {
+width:37%;
+margin-left:17px;
+margin-bottom:47px;
+clear:none;
+overflow:hidden;
+padding: 0 0 0 65px;
+min-height:235px;
+}
+
+#aside_primary .notice {
+margin-bottom:18px;
+}
+
+#shownotice #content .notice {
+width:96%;
+}
+
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:100%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+.notice .author {
+margin-right:11px;
+}
+
+#content .notice .author {
+/*overflow:hidden;*/
+}
+
+.fn {
+overflow:hidden;
+}
+
+.notice .author .fn {
+font-weight:bold;
+}
+
+.notice .author .photo {
+margin-bottom:0;
+}
+
+#content .notice .author .photo {
+margin-left:-83px;
+padding-right:17px;
+}
+
+
+.vcard .photo {
+display:inline;
+margin-right:11px;
+margin-bottom:11px;
+float:left;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+
+.notice .entry-title {
+float:left;
+width:100%;
+overflow:hidden;
+}
+#content .notice .entry-title {
+overflow:visible;
+margin-bottom:11px;
+padding:18px;
+width:85%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+min-height:161px;
+}
+
+#shownotice .notice .entry-title {
+font-size:2.2em;
+}
+
+.notice p.entry-content {
+display:inline;
+}
+
+#content .notice p.entry-content
+overflow:hidden;
+}
+
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+clear:left;
+float:left;
+font-size:0.95em;
+}
+#showstream .notice div.entry-content {
+margin-left:0;
+}
+
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+
+
+
+.notice-data {
+position:absolute;
+top:18px;
+right:0;
+min-height:50px;
+margin-bottom:4px;
+}
+.notice .entry-content .notice-data dt {
+display:none;
+}
+
+.notice-data a {
+display:block;
+outline:none;
+}
+
+.notice-options {
+position:absolute;
+top:120px;
+left:30px;
+font-size:0.95em;
+}
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+left:0;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+top:0;
+}
+.notice-options .notice_reply {
+top:29px;
+}
+.notice-options .notice_delete {
+top:58px;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options form input.submit {
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+
+#usergroups #new_group {
+float: left;
+margin-right: 2em;
+}
+#new_group, #group_search {
+margin-bottom:18px;
+}
+#new_group a {
+padding-left:20px;
+}
+
+
+#filter_tags {
+margin-bottom:11px;
+float:left;
+}
+#filter_tags dt {
+display:none;
+}
+#filter_tags ul {
+list-style-type:none;
+}
+#filter_tags ul li {
+float:left;
+margin-left:7px;
+padding-left:7px;
+border-left-width:1px;
+border-left-style:solid;
+}
+#filter_tags ul li.child_1 {
+margin-left:0;
+border-left:0;
+padding-left:0;
+}
+#filter_tags ul li#filter_tags_all a {
+font-weight:bold;
+margin-top:7px;
+float:left;
+}
+
+#filter_tags ul li#filter_tags_item label {
+margin-right:7px;
+}
+#filter_tags ul li#filter_tags_item label,
+#filter_tags ul li#filter_tags_item select {
+display:inline;
+}
+#filter_tags ul li#filter_tags_item p {
+float:left;
+margin-left:38px;
+}
+#filter_tags ul li#filter_tags_item input {
+position:relative;
+top:3px;
+left:3px;
+}
+
+
+
+.pagination {
+float:left;
+clear:both;
+width:100%;
+margin-top:18px;
+}
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border-width:1px;
+border-style:solid;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-radius:7px;
+}
+
+.pagination .nav_prev a {
+padding-left:30px;
+}
+.pagination .nav_next a {
+padding-right:30px;
+}
+/* END: NOTICE */
+
+
+.hentry .entry-content p {
+margin-bottom:18px;
+}
+.hentry entry-content ol,
+.hentry .entry-content ul {
+list-style-position:inside;
+}
+.hentry .entry-content li {
+margin-bottom:18px;
+}
+.hentry .entry-content li li {
+margin-left:18px;
+}
+
+
+
+
+/* TOP_POSTERS */
+.section tbody td {
+padding-right:11px;
+padding-bottom:11px;
+}
+.section .vcard .photo {
+margin-right:7px;
+margin-bottom:0;
+}
+
+.section .notice {
+padding-top:7px;
+padding-bottom:7px;
+border-top:0;
+}
+
+.section .notice:first-child {
+padding-top:0;
+}
+
+.section .notice .author {
+margin-right:0;
+}
+.section .notice .author .fn {
+display:none;
+}
+
+
+/* tagcloud */
+.tag-cloud {
+list-style-type:none;
+text-align:center;
+}
+.aside .tag-cloud {
+font-size:0.8em;
+}
+.tag-cloud li {
+display:inline;
+margin-right:7px;
+line-height:1.25;
+}
+.aside .tag-cloud li {
+line-height:1.5;
+}
+.tag-cloud li a {
+text-decoration:none;
+}
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+.tag-cloud-1 {
+font-size:1em;
+}
+.tag-cloud-2 {
+font-size:1.25em;
+}
+.tag-cloud-3 {
+font-size:1.75em;
+}
+.tag-cloud-4 {
+font-size:2em;
+}
+.tag-cloud-5 {
+font-size:2.25em;
+}
+.tag-cloud-6 {
+font-size:2.75em;
+}
+.tag-cloud-7 {
+font-size:3.25em;
+}
+
+#publictagcloud #tagcloud.section dt {
+display:none;
+}
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+#form_settings_avatar li {
+width:auto;
+}
+#form_settings_avatar input {
+margin-left:0;
+}
+#avatar_original,
+#avatar_preview {
+float:left;
+}
+#avatar_preview {
+margin-left:29px;
+}
+#avatar_preview_view {
+height:96px;
+width:96px;
+margin-bottom:18px;
+overflow:hidden;
+}
+
+#settings_attach,
+#form_settings_avatar .form_actions {
+clear:both;
+}
+
+#form_settings_avatar .form_actions {
+margin-bottom:0;
+}
+
+#form_settings_design #settings_design_color .form_data,
+#form_settings_design #color-picker {
+float:left;
+}
+#form_settings_design #settings_design_color .form_data {
+width:400px;
+margin-right:28px;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
+.instructions p,
+.instructions ul {
+margin-bottom:18px;
+}
+.help dt {
+display:none;
+}
+.guide {
+clear:both;
+}
diff --git a/theme/otalk/css/display.css b/theme/otalk/css/display.css
new file mode 100644 (file)
index 0000000..d2a4719
--- /dev/null
@@ -0,0 +1,292 @@
+/** theme: otalk
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+@import url(base.css);
+
+html {
+}
+
+html,
+body,
+a:active {
+}
+body {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+font-size:1em;
+background:#ddd url(../images/illustrations/illu_pattern-01.png) repeat 0 0;
+background-color:rgba(127, 127, 127, 0.1);
+}
+address {
+margin-right:7.18%;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-primary {
+background:none;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+.form_settings .form_note,
+.entity_remote_subscribe {
+background-color:#9BB43E;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#9BB43E;
+}
+input.submit,
+.entity_remote_subscribe {
+color:#fff;
+}
+
+a,
+div.notice-options input,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.entity_nudge p,
+.form_settings input.form_action-primary {
+color:#8F0000;
+}
+
+.notice,
+.profile {
+border-color:#CEE1E9;
+}
+#content .notice .entry-title,
+input, textarea, select, option,
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-color:rgba(255,255,255,0.8);
+}
+
+#content .notices li.hover .entry-title {
+background-color:rgba(255,255,255,0.9);
+}
+
+#content .notice:nth-child(1) .entry-title {
+background-color:rgba(255,255,255,0.95);
+}
+#content .notice:nth-child(2) .entry-title {
+background-color:rgba(255,255,255,0.9);
+}
+#content .notice:nth-child(3) .entry-title {
+background-color:rgba(255,255,255,0.8);
+}
+#content .notice:nth-child(4) .entry-title {
+background-color:rgba(255,255,255,0.7);
+}
+#content .notice:nth-child(5) .entry-title {
+background-color:rgba(255,255,255,0.6);
+}
+#content .notice:nth-child(6) .entry-title {
+background-color:rgba(255,255,255,0.5);
+}
+#content .notice:nth-child(7) .entry-title {
+background-color:rgba(255,255,255,0.4);
+}
+#content .notice:nth-child(8) .entry-title {
+background-color:rgba(255,255,255,0.3);
+}
+#content .notice:nth-child(9) .entry-title {
+background-color:rgba(255,255,255,0.2);
+}
+#content .notice:nth-child(10) {
+background-color:rgba(255,255,255,0.1);
+}
+
+
+#content .notice .author .photo {
+background:url(../images/illustrations/illu_arrow-left-01.gif) no-repeat 100% 0;
+}
+
+.section .profile {
+border-top-color:#87B4C8;
+}
+
+#aside_primary {
+background-color:rgba(206, 225, 233,0.5);
+}
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+cursor:wait;
+text-indent:-9999px;
+}
+
+#content,
+#site_nav_local_views .nav,
+#site_nav_local_views a,
+#aside_primary {
+border-color:#fff;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:transparent;
+/*background-color:red;*/
+}
+
+#site_nav_local_views .current a {
+background-color:transparent;
+}
+
+#site_nav_local_views a {
+background-color:rgba(127, 127, 127, 0.2);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.8);
+}
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+#anon_notice {
+background-color:rgba(206, 225, 233, 0.7);
+color:#fff;
+border-color:#fff;
+}
+
+#showstream #anon_notice {
+background-color:rgba(155, 180, 62, 0.7);
+}
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.png);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.png);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_nudge p {
+background-position: 0 40%;
+background-repeat: no-repeat;
+background-color:transparent;
+}
+.form_group_join input.submit,
+.form_group_leave input.submit
+.form_user_subscribe input.submit,
+.form_user_unsubscribe input.submit {
+background-color:#9BB43E;
+color:#fff;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit,
+.form_user_authorization input.reject {
+background-color:#87B4C8;
+}
+
+.entity_edit a {
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
+}
+.entity_send-a-message a {
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
+}
+.entity_nudge p,
+.form_user_nudge input.submit {
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
+}
+.form_user_block input.submit,
+.form_user_unblock input.submit {
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
+}
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:0.4;
+}
+.notices li.hover div.entry-content,
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+.notices li.hover {
+/*background-color:#fcfcfc;*/
+}
+/*END: NOTICES */
+
+#new_group a {
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
+}
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+border-color:#CEE1E9;
+}
+.pagination .nav_prev a {
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
+background-position:10% 45%;
+}
+.pagination .nav_next a {
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
+background-position:90% 45%;
+}
diff --git a/theme/otalk/css/ie.css b/theme/otalk/css/ie.css
new file mode 100644 (file)
index 0000000..2f463bb
--- /dev/null
@@ -0,0 +1,9 @@
+/* IE specific styles */
+
+.notice-options input.submit {
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:#D0DFE7;
+}
diff --git a/theme/otalk/default-avatar-mini.png b/theme/otalk/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..38b8692
Binary files /dev/null and b/theme/otalk/default-avatar-mini.png differ
diff --git a/theme/otalk/default-avatar-profile.png b/theme/otalk/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..f8357d4
Binary files /dev/null and b/theme/otalk/default-avatar-profile.png differ
diff --git a/theme/otalk/default-avatar-stream.png b/theme/otalk/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..6b63baa
Binary files /dev/null and b/theme/otalk/default-avatar-stream.png differ
diff --git a/theme/otalk/images/illustrations/illu_arrow-left-01.gif b/theme/otalk/images/illustrations/illu_arrow-left-01.gif
new file mode 100644 (file)
index 0000000..1977759
Binary files /dev/null and b/theme/otalk/images/illustrations/illu_arrow-left-01.gif differ
diff --git a/theme/otalk/images/illustrations/illu_pattern-01.png b/theme/otalk/images/illustrations/illu_pattern-01.png
new file mode 100644 (file)
index 0000000..5a72eaf
Binary files /dev/null and b/theme/otalk/images/illustrations/illu_pattern-01.png differ
diff --git a/theme/otalk/logo.png b/theme/otalk/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/otalk/logo.png differ
diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css
new file mode 100644 (file)
index 0000000..08427d3
--- /dev/null
@@ -0,0 +1,1155 @@
+/** theme: pigeonthoughts base
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 87.5%; background-color:#fff; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:1em;
+line-height:1.65;
+position:relative;
+margin-left:183px;
+}
+h1,h2,h3,h4,h5,h6 {
+margin-bottom:7px;
+overflow:hidden;
+}
+h1 {
+font-size:1.4em;
+margin-bottom:18px;
+}
+#showstream h1 { display:none; }
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+legend {
+font-weight:bold;
+font-size:1.3em;
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+input.submit {
+font-weight:bold;
+cursor:pointer;
+}
+textarea {
+overflow:auto;
+}
+option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+}
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+.error,
+.success {
+padding:4px 1.55%;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+margin-bottom:18px;
+}
+form label.submit {
+display:none;
+}
+
+.form_settings {
+clear:both;
+}
+
+.form_settings fieldset {
+margin-bottom:29px;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+.form_settings .form_data input.submit {
+margin-left:0;
+}
+
+.form_settings label {
+margin-top:2px;
+width:152px;
+}
+
+.form_actions label {
+display:none;
+}
+.form_guide {
+font-style:italic;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend,
+#form_password legend,
+#form_settings_avatar legend,
+#newgroup legend,
+#editgroup legend,
+#form_tag_user legend,
+#form_remote_subscribe legend,
+#form_openid_login legend,
+#form_search legend,
+#form_invite legend,
+#form_notice_delete legend,
+#form_password_recover legend,
+#form_password_change legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:163px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:3px;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide,
+#form_openid_login #settings_rememberme p.form_guide,
+#settings_twitter_remove p.form_guide,
+#form_search ul.form_data #q {
+margin-left:0;
+}
+
+.form_settings .form_note {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+padding:0 7px;
+}
+
+
+.form_settings input.form_action-primary {
+padding:0;
+}
+.form_settings input.form_action-secondary {
+margin-left:29px;
+}
+
+#form_search .submit {
+margin-left:11px;
+}
+
+address {
+float:right;
+margin-bottom:18px;
+margin-right:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+address .fn {
+font-weight:bold;
+}
+address img + .fn {
+display:none;
+}
+
+#header {
+width:98.5%;
+position:relative;
+float:left;
+padding-top:18px;
+padding-left:18px;
+margin-bottom:29px;
+}
+
+#site_nav_global_primary {
+float:left;
+margin-right:18px;
+margin-bottom:11px;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-right:11px;
+}
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+float:right;
+margin-top:7px;
+margin-right:18px;
+width:26%;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+#anon_notice {
+float:left;
+width:50.2%;
+line-height:1.5;
+font-size:1.1em;
+font-weight:bold;
+}
+
+
+#footer {
+float:left;
+width:64%;
+padding:18px;
+}
+
+#site_nav_local_views {
+width:183px;
+float:left;
+margin-bottom:29px;
+position:fixed;
+top:179px;
+left:0;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+list-style-type:none;
+}
+#site_nav_local_views a {
+text-decoration:none;
+padding:4px 11px;
+text-shadow: 1px 1px 1px #ddd;
+font-weight:bold;
+display:block;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+}
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin-left:11px;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+#wrap {
+width:100%;
+min-width:760px;
+max-width:1003px;
+overflow:hidden;
+}
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+}
+
+#content {
+width:50.009%;
+min-height:259px;
+float:left;
+margin-left:18px;
+}
+#shownotice #content {
+min-height:0;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:45.917%;
+min-height:259px;
+float:left;
+margin-left:1.385%;
+padding-bottom:47px;
+}
+
+#form_notice {
+width:45.664%;
+float:left;
+position:relative;
+line-height:1;
+}
+#form_notice fieldset {
+border:0;
+padding:0;
+position:relative;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+float:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+width:80.789%;
+height:46px;
+line-height:1.5;
+padding:7px 7px 16px 7px;
+}
+#form_notice label {
+display:block;
+float:left;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice #notice_submit label {
+display:none;
+}
+#form_notice .form_note {
+position:absolute;
+top:76px;
+right:98px;
+z-index:9;
+}
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+padding:1px 2px;
+}
+#form_notice #notice_action-submit {
+width:14%;
+height:47px;
+padding:0;
+position:absolute;
+bottom:0;
+right:0;
+}
+#form_notice label[for=to] {
+margin-top:7px;
+}
+#form_notice select[id=to] {
+margin-bottom:7px;
+margin-left:18px;
+float:left;
+}
+#form_notice .error {
+float:left;
+clear:both;
+width:96.9%;
+margin-bottom:0;
+line-height:1.618;
+}
+
+/* entity_profile */
+.entity_profile {
+position:relative;
+width:67.702%;
+min-height:123px;
+float:left;
+margin-bottom:18px;
+margin-left:0;
+overflow:hidden;
+}
+.entity_profile dt,
+#entity_statistics dt {
+font-weight:bold;
+}
+.entity_profile dd {
+display:inline;
+}
+
+.entity_profile .entity_depiction {
+float:left;
+width:96px;
+margin-right:18px;
+margin-bottom:18px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname,
+.entity_profile .entity_location,
+.entity_profile .entity_url,
+.entity_profile .entity_note,
+.entity_profile .entity_tags {
+margin-left:113px;
+margin-bottom:4px;
+}
+
+.entity_profile .entity_fn,
+.entity_profile .entity_nickname {
+margin-left:11px;
+display:inline;
+font-weight:bold;
+}
+.entity_profile .entity_nickname {
+margin-left:0;
+}
+
+.entity_profile .entity_fn dd:before {
+content: "(";
+font-weight:normal;
+}
+.entity_profile .entity_fn dd:after {
+content: ")";
+font-weight:normal;
+}
+
+.entity_profile dt {
+display:none;
+}
+.entity_profile h2 {
+display:none;
+}
+/* entity_profile */
+
+
+/*entity_actions*/
+.entity_actions {
+float:right;
+margin-left:4.35%;
+max-width:25%;
+}
+.entity_actions h2 {
+display:none;
+}
+.entity_actions ul {
+list-style-type:none;
+}
+.entity_actions li {
+margin-bottom:4px;
+}
+.entity_actions li:first-child {
+border-top:0;
+}
+.entity_actions fieldset {
+border:0;
+padding:0;
+}
+.entity_actions legend {
+display:none;
+}
+
+.entity_actions input.submit {
+display:block;
+text-align:left;
+width:100%;
+}
+.entity_actions a,
+.entity_nudge p,
+.entity_remote_subscribe {
+text-decoration:none;
+font-weight:bold;
+display:block;
+}
+
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.entity_edit a,
+.form_user_nudge input.submit,
+.entity_nudge p {
+border:0;
+padding-left:20px;
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.entity_nudge p {
+padding:4px 4px 4px 23px;
+}
+
+.entity_remote_subscribe {
+padding:4px;
+border-width:2px;
+border-style:solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.entity_actions .accept {
+margin-bottom:18px;
+}
+
+.entity_tags ul {
+list-style-type:none;
+display:inline;
+}
+.entity_tags li {
+display:inline;
+margin-right:4px;
+}
+
+.aside .section {
+margin-bottom:29px;
+float:right;
+width:44%;
+padding:1%;
+border-width:1px;
+border-style:solid;
+margin-left:2.5%;
+}
+.aside .section h2 {
+text-transform:uppercase;
+font-size:1em;
+}
+
+#entity_statistics dt,
+#entity_statistics dd {
+display:inline;
+}
+#entity_statistics dt:after {
+content: ":";
+}
+
+.section ul.entities {
+float:left;
+width:100%;
+}
+.section .entities li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+.section .entities li .photo {
+margin-right:0;
+margin-bottom:0;
+}
+.section .entities li .fn {
+display:none;
+}
+
+.aside .section p,
+.aside .section .more {
+clear:both;
+}
+
+.profile .entity_profile {
+margin-bottom:0;
+min-height:60px;
+}
+
+
+.profile .form_group_join legend,
+.profile .form_group_leave legend,
+.profile .form_user_subscribe legend,
+.profile .form_user_unsubscribe legend {
+display:none;
+}
+
+.profiles {
+list-style-type:none;
+}
+.profile .entity_profile .entity_location {
+width:auto;
+clear:none;
+margin-left:11px;
+}
+.profile .entity_profile dl,
+.profile .entity_profile dd {
+display:inline;
+float:none;
+}
+.profile .entity_profile .entity_note,
+.profile .entity_profile .entity_url,
+.profile .entity_profile .entity_tags,
+.profile .entity_profile .form_subscription_edit {
+margin-left:59px;
+clear:none;
+display:block;
+width:auto;
+}
+.profile .entity_profile .entity_tags dt {
+display:inline;
+margin-right:11px;
+}
+
+
+.profile .entity_profile .form_subscription_edit label {
+font-weight:normal;
+margin-right:11px;
+}
+
+
+/* NOTICE */
+.notice,
+.profile {
+position:relative;
+padding-top:11px;
+padding-bottom:11px;
+clear:both;
+float:left;
+width:96.41%;
+border-width:1px;
+border-style:solid;
+padding:1.795%;
+margin-bottom:11px;
+}
+.notices li {
+list-style-type:none;
+}
+
+#aside_primary .notice,
+#aside_primary .profile {
+border:0;
+margin-bottom:11px;
+}
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:100%;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+.notice .author {
+margin-right:11px;
+}
+
+.fn {
+overflow:hidden;
+}
+
+.notice .author .fn {
+font-weight:bold;
+}
+
+.vcard .photo {
+display:inline;
+margin-right:11px;
+float:left;
+}
+#shownotice .vcard .photo {
+margin-bottom:4px;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+
+.notice .entry-title {
+float:left;
+width:100%;
+overflow:hidden;
+}
+#shownotice .notice .entry-title {
+font-size:2.2em;
+}
+
+.notice p.entry-content {
+display:inline;
+}
+
+#content .notice p.entry-content a:visited {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+clear:left;
+float:left;
+font-size:0.95em;
+margin-left:59px;
+width:65%;
+}
+#showstream .notice div.entry-content,
+#shownotice .notice div.entry-content {
+margin-left:0;
+}
+
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+
+
+.notice-options {
+padding-left:2%;
+float:left;
+width:50%;
+position:relative;
+font-size:0.95em;
+width:12.5%;
+float:right;
+}
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+top:0;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+left:0;
+}
+.notice-options .notice_reply {
+left:29px;
+}
+.notice-options .notice_delete {
+right:0;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options form input.submit {
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+
+#usergroups #new_group {
+float: left;
+margin-right: 2em;
+}
+#new_group, #group_search {
+margin-bottom:18px;
+}
+#new_group a {
+padding-left:20px;
+}
+
+
+#filter_tags {
+margin-bottom:11px;
+float:left;
+}
+#filter_tags dt {
+display:none;
+}
+#filter_tags ul {
+list-style-type:none;
+}
+#filter_tags ul li {
+float:left;
+margin-left:7px;
+padding-left:7px;
+border-left-width:1px;
+border-left-style:solid;
+}
+#filter_tags ul li.child_1 {
+margin-left:0;
+border-left:0;
+padding-left:0;
+}
+#filter_tags ul li#filter_tags_all a {
+font-weight:bold;
+margin-top:7px;
+float:left;
+}
+
+#filter_tags ul li#filter_tags_item label {
+margin-right:7px;
+}
+#filter_tags ul li#filter_tags_item label,
+#filter_tags ul li#filter_tags_item select {
+display:inline;
+}
+#filter_tags ul li#filter_tags_item p {
+float:left;
+margin-left:38px;
+}
+#filter_tags ul li#filter_tags_item input {
+position:relative;
+top:3px;
+left:3px;
+}
+
+
+
+.pagination {
+float:left;
+clear:both;
+width:100%;
+margin-top:18px;
+}
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border-width:1px;
+border-style:solid;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+border-radius:7px;
+}
+
+.pagination .nav_prev a {
+padding-left:30px;
+}
+.pagination .nav_next a {
+padding-right:30px;
+}
+/* END: NOTICE */
+
+
+.hentry .entry-content p {
+margin-bottom:18px;
+}
+.system_notice ul,
+.instructions ul,
+.hentry entry-content ol,
+.hentry .entry-content ul {
+list-style-position:inside;
+}
+.hentry .entry-content li {
+margin-bottom:18px;
+}
+.hentry .entry-content li li {
+margin-left:18px;
+}
+
+
+
+
+/* TOP_POSTERS */
+.section tbody td {
+padding-right:11px;
+padding-bottom:11px;
+}
+.section .vcard .photo {
+margin-right:7px;
+margin-bottom:0;
+}
+
+.section .notice {
+padding-top:7px;
+padding-bottom:7px;
+border-top:0;
+}
+
+.section .notice:first-child {
+padding-top:0;
+}
+
+.section .notice .author {
+margin-right:0;
+}
+.section .notice .author .fn {
+display:none;
+}
+
+
+/* tagcloud */
+.tag-cloud {
+list-style-type:none;
+text-align:center;
+}
+.aside .tag-cloud {
+font-size:0.8em;
+}
+.tag-cloud li {
+display:inline;
+margin-right:7px;
+line-height:1.25;
+}
+.aside .tag-cloud li {
+line-height:1.5;
+}
+.tag-cloud li a {
+text-decoration:none;
+}
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+.tag-cloud-1 {
+font-size:1em;
+}
+.tag-cloud-2 {
+font-size:1.25em;
+}
+.tag-cloud-3 {
+font-size:1.75em;
+}
+.tag-cloud-4 {
+font-size:2em;
+}
+.tag-cloud-5 {
+font-size:2.25em;
+}
+.tag-cloud-6 {
+font-size:2.75em;
+}
+.tag-cloud-7 {
+font-size:3.25em;
+}
+
+#publictagcloud #tagcloud.section dt {
+display:none;
+}
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+#form_settings_avatar li {
+width:auto;
+}
+#form_settings_avatar input {
+margin-left:0;
+}
+#avatar_original,
+#avatar_preview {
+float:left;
+}
+#avatar_preview {
+margin-left:29px;
+}
+#avatar_preview_view {
+height:96px;
+width:96px;
+margin-bottom:18px;
+overflow:hidden;
+}
+
+#settings_attach,
+#form_settings_avatar .form_actions {
+clear:both;
+}
+
+#form_settings_avatar .form_actions {
+margin-bottom:0;
+}
+
+#form_settings_design #settings_design_color .form_data,
+#form_settings_design #color-picker {
+float:left;
+}
+#form_settings_design #settings_design_color .form_data {
+width:400px;
+margin-right:28px;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
+.instructions p,
+.instructions ul {
+margin-bottom:18px;
+}
+.help dt {
+display:none;
+}
+.guide {
+clear:both;
+}
diff --git a/theme/pigeonthoughts/css/display.css b/theme/pigeonthoughts/css/display.css
new file mode 100644 (file)
index 0000000..af31cf7
--- /dev/null
@@ -0,0 +1,295 @@
+/** theme: pigeonthoughts
+ *
+ * @package   Laconica
+ * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+@import url(base.css);
+
+html {
+background:#fff url(../images/illustrations/illu_pigeons-01.png) no-repeat 0 100%;
+}
+
+body,
+a:active {
+background-color:#AEA187;
+}
+body {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+font-size:1em;
+}
+address {
+margin-left:2%;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-primary {
+background:none;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+.form_settings .form_note,
+.entity_remote_subscribe {
+background-color:#8F0000;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#8F0000;
+}
+input.submit,
+.entity_remote_subscribe {
+color:#fff;
+}
+
+a,
+div.notice-options input,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.entity_nudge p,
+.form_settings input.form_action-primary {
+color:#000;
+}
+
+.notice,
+.profile {
+border-color:#000;
+}
+.notice a,
+.profile a {
+color:#fff;
+}
+
+.notice:nth-child(3n-1),
+.profile:nth-child(3n-1) {
+border-color:#fff;
+}
+.notice:nth-child(3n-1) a,
+.profile:nth-child(3n-1) a {
+color:#7F1114;
+}
+.notice:nth-child(3n),
+.profile:nth-child(3n) {
+border-color:#7F1114;
+}
+.notice:nth-child(3n) a,
+.profile:nth-child(3n) a {
+color:#000;
+}
+
+.aside .section .notice,
+.aside .section .profile,
+.aside .section .notice:nth-child(3n-1),
+.aside .section .profile:nth-child(3n-1),
+.aside .section .notice:nth-child(3n),
+.aside .section .profile:nth-child(3n) {
+background-color:transparent;
+color:#000;
+}
+
+
+.aside .section {
+border-color:#fff;
+background-color:#fff;
+color:#000;
+}
+
+.aside .section:nth-child(n) {
+border-color:#000;
+background-color:#000;
+color:#fff;
+}
+.aside .section:nth-child(3n-1) {
+border-color:#fff;
+background-color:#fff;
+color:#000;
+}
+.aside .section:nth-child(3n) {
+background-color:#7F1114;
+border-color:#7F1114;
+color:#000;
+}
+.aside .section a {
+color:#7F1114;
+}
+.aside .section:nth-child(3n-1) a {
+color:#7F1114;
+}
+.aside .section:nth-child(3n) a {
+color:#fff;
+}
+
+
+.section .profile {
+border-top-color:#87B4C8;
+}
+
+#aside_primary {
+background:url(../images/illustrations/illu_pigeons-02.png) no-repeat 10% 100%;
+}
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
+cursor:wait;
+text-indent:-9999px;
+}
+
+#content,
+#site_nav_local_views a {
+border-color:#fff;
+}
+#site_nav_local_views .current a {
+background-color:rgba(143, 0, 0, 0.8);
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:rgba(255, 255, 255, 0.3);
+}
+#site_nav_local_views a:hover {
+background-color:#fff;
+color:#8F0000;
+}
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+#anon_notice {
+color:#000;
+}
+
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.png);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.png);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+
+.entity_edit a,
+.entity_send-a-message a,
+.form_user_nudge input.submit,
+.form_user_block input.submit,
+.form_user_unblock input.submit,
+.entity_nudge p {
+background-position: 0 40%;
+background-repeat: no-repeat;
+background-color:transparent;
+}
+.form_group_join input.submit,
+.form_group_leave input.submit
+.form_user_subscribe input.submit,
+.form_user_unsubscribe input.submit {
+background-color:#8F0000;
+color:#fff;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit,
+.form_user_authorization input.reject {
+background-color:#87B4C8;
+}
+
+.entity_edit a {
+background-image:url(../../base/images/icons/twotone/green/edit.gif);
+}
+.entity_send-a-message a {
+background-image:url(../../base/images/icons/twotone/green/quote.gif);
+}
+.entity_nudge p,
+.form_user_nudge input.submit {
+background-image:url(../../base/images/icons/twotone/green/mail.gif);
+}
+.form_user_block input.submit,
+.form_user_unblock input.submit {
+background-image:url(../../base/images/icons/twotone/green/shield.gif);
+}
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+.notices div.entry-content,
+.notices div.notice-options {
+opacity:0.4;
+}
+.notices li.hover div.entry-content,
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+/*END: NOTICES */
+
+#new_group a {
+background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
+}
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+border-color:#000;
+}
+.pagination .nav_prev a {
+background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
+background-position:10% 45%;
+}
+.pagination .nav_next a {
+background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
+background-position:90% 45%;
+}
diff --git a/theme/pigeonthoughts/css/ie.css b/theme/pigeonthoughts/css/ie.css
new file mode 100644 (file)
index 0000000..2f463bb
--- /dev/null
@@ -0,0 +1,9 @@
+/* IE specific styles */
+
+.notice-options input.submit {
+color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:#D0DFE7;
+}
diff --git a/theme/pigeonthoughts/default-avatar-mini.png b/theme/pigeonthoughts/default-avatar-mini.png
new file mode 100644 (file)
index 0000000..38b8692
Binary files /dev/null and b/theme/pigeonthoughts/default-avatar-mini.png differ
diff --git a/theme/pigeonthoughts/default-avatar-profile.png b/theme/pigeonthoughts/default-avatar-profile.png
new file mode 100644 (file)
index 0000000..f8357d4
Binary files /dev/null and b/theme/pigeonthoughts/default-avatar-profile.png differ
diff --git a/theme/pigeonthoughts/default-avatar-stream.png b/theme/pigeonthoughts/default-avatar-stream.png
new file mode 100644 (file)
index 0000000..6b63baa
Binary files /dev/null and b/theme/pigeonthoughts/default-avatar-stream.png differ
diff --git a/theme/pigeonthoughts/images/illustrations/illu_pigeons-01.png b/theme/pigeonthoughts/images/illustrations/illu_pigeons-01.png
new file mode 100644 (file)
index 0000000..4fdaaeb
Binary files /dev/null and b/theme/pigeonthoughts/images/illustrations/illu_pigeons-01.png differ
diff --git a/theme/pigeonthoughts/images/illustrations/illu_pigeons-02.png b/theme/pigeonthoughts/images/illustrations/illu_pigeons-02.png
new file mode 100644 (file)
index 0000000..187c6c8
Binary files /dev/null and b/theme/pigeonthoughts/images/illustrations/illu_pigeons-02.png differ
diff --git a/theme/pigeonthoughts/logo.png b/theme/pigeonthoughts/logo.png
new file mode 100644 (file)
index 0000000..fdead6c
Binary files /dev/null and b/theme/pigeonthoughts/logo.png differ
index 4998b3c988b48b553c1fe4de0df8425f5a5ca5ba..83b5a61d0d6d9627518ad735516d30a863bd7cfa 100644 (file)
@@ -23,14 +23,16 @@ Only alter this file if you want to change the layout of the site. Please note t
 ./default/css/display.css contains only the background images and colour rules:
 This file is a good basis for creating your own theme.
 
+Let's create a theme:
 
-1. Copy over the default theme to start off (replace 'mytheme'):
-cp -r ./default ./mytheme
+1. To start off, copy over the default theme:
+cp -r default mytheme
 
 2. Edit your mytheme stylesheet:
-nano ./mytheme/css/display.css
+nano mytheme/css/display.css
 
-3. Search and replace a colour or a path to the background image of your choice.
+a) Search and replace your colours and background images, or
+b) Create your own layout either importing a separate stylesheet (e.g., change to @import url(base.css);) or simply place it before the rest of the rules.
 
 4. Set /config.php to load 'mytheme':
 $config['site']['theme'] = 'mytheme';