summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--actions/conversation.php107
-rw-r--r--actions/designsettings.php227
-rw-r--r--actions/register.php13
-rw-r--r--actions/twittersettings.php21
-rw-r--r--classes/Foreign_link.php12
-rw-r--r--classes/Notice.php18
-rwxr-xr-xclasses/Status_network.php61
-rwxr-xr-xclasses/laconica.ini3
-rwxr-xr-xclasses/statusnet.ini17
-rw-r--r--config.php.sample16
-rw-r--r--db/laconica.sql4
-rw-r--r--db/site.sql17
-rw-r--r--extlib/HTTP/Request.php1521
-rw-r--r--extlib/HTTP/Request/Listener.php106
-rw-r--r--extlib/Net/URL2.php813
-rw-r--r--extlib/Services/oEmbed.php357
-rw-r--r--extlib/Services/oEmbed/Exception.php65
-rw-r--r--extlib/Services/oEmbed/Exception/NoSupport.php63
-rw-r--r--extlib/Services/oEmbed/Object.php126
-rw-r--r--extlib/Services/oEmbed/Object/Common.php139
-rw-r--r--extlib/Services/oEmbed/Object/Exception.php65
-rw-r--r--extlib/Services/oEmbed/Object/Link.php73
-rw-r--r--extlib/Services/oEmbed/Object/Photo.php89
-rw-r--r--extlib/Services/oEmbed/Object/Rich.php82
-rw-r--r--extlib/Services/oEmbed/Object/Video.php82
-rw-r--r--extlib/Stomp.php594
-rw-r--r--extlib/Stomp/Exception.php57
-rw-r--r--extlib/Stomp/Frame.php80
-rw-r--r--extlib/Stomp/Message.php37
-rw-r--r--extlib/Stomp/Message/Bytes.php47
-rw-r--r--extlib/Stomp/Message/Map.php55
-rw-r--r--extlib/Validate.php2167
-rw-r--r--install.php161
-rw-r--r--js/farbtastic/LICENSE.txt341
-rw-r--r--js/farbtastic/farbtastic.go.js10
-rw-r--r--js/farbtastic/farbtastic.js329
-rwxr-xr-xjs/farbtastic/marker.pngbin0 -> 652 bytes
-rw-r--r--js/farbtastic/mask.pngbin0 -> 2020 bytes
-rw-r--r--js/farbtastic/wheel.pngbin0 -> 11733 bytes
-rw-r--r--lib/accountsettingsaction.php3
-rw-r--r--lib/action.php8
-rw-r--r--lib/common.php1
-rw-r--r--lib/noticelist.php17
-rw-r--r--lib/queuehandler.php72
-rw-r--r--lib/router.php8
-rw-r--r--lib/theme.php29
-rw-r--r--lib/twitter.php2
-rw-r--r--lib/util.php98
-rw-r--r--scripts/statusfetcher.php525
-rw-r--r--theme/base/css/display.css14
-rw-r--r--theme/base/css/farbtastic.css32
-rw-r--r--theme/base/default-avatar-mini.pngbin0 -> 646 bytes
-rw-r--r--theme/base/default-avatar-profile.pngbin0 -> 2853 bytes
-rw-r--r--theme/base/default-avatar-stream.pngbin0 -> 1487 bytes
-rw-r--r--theme/base/images/icons/twotone/green/arrow-left.gif (renamed from theme/default/images/icons/twotone/green/arrow-left.gif)bin73 -> 73 bytes
-rw-r--r--theme/base/images/icons/twotone/green/arrow-right.gif (renamed from theme/default/images/icons/twotone/green/arrow-right.gif)bin74 -> 74 bytes
-rw-r--r--theme/base/images/icons/twotone/green/disfavourite.gif (renamed from theme/default/images/icons/twotone/green/disfavourite.gif)bin88 -> 88 bytes
-rw-r--r--theme/base/images/icons/twotone/green/edit.gif (renamed from theme/default/images/icons/twotone/green/edit.gif)bin75 -> 75 bytes
-rw-r--r--theme/base/images/icons/twotone/green/favourite.gif (renamed from theme/default/images/icons/twotone/green/favourite.gif)bin73 -> 73 bytes
-rw-r--r--theme/base/images/icons/twotone/green/mail.gif (renamed from theme/default/images/icons/twotone/green/mail.gif)bin82 -> 82 bytes
-rw-r--r--theme/base/images/icons/twotone/green/news.gif (renamed from theme/default/images/icons/twotone/green/news.gif)bin76 -> 76 bytes
-rw-r--r--theme/base/images/icons/twotone/green/quote.gif (renamed from theme/default/images/icons/twotone/green/quote.gif)bin79 -> 79 bytes
-rw-r--r--theme/base/images/icons/twotone/green/reply.gif (renamed from theme/default/images/icons/twotone/green/reply.gif)bin79 -> 79 bytes
-rw-r--r--theme/base/images/icons/twotone/green/shield.gif (renamed from theme/default/images/icons/twotone/green/shield.gif)bin85 -> 85 bytes
-rw-r--r--theme/base/images/icons/twotone/green/trash.gif (renamed from theme/default/images/icons/twotone/green/trash.gif)bin77 -> 77 bytes
-rw-r--r--theme/base/logo.pngbin0 -> 4988 bytes
-rw-r--r--theme/cloudy/css/display.css1550
-rw-r--r--theme/cloudy/css/ie.css34
-rw-r--r--theme/cloudy/default-avatar-mini.pngbin0 -> 1006 bytes
-rw-r--r--theme/cloudy/default-avatar-profile.pngbin0 -> 9026 bytes
-rw-r--r--theme/cloudy/default-avatar-stream.pngbin0 -> 2963 bytes
-rw-r--r--theme/cloudy/images/icons/icon_atom.pngbin0 -> 820 bytes
-rw-r--r--theme/cloudy/images/icons/icon_disfavourite.gifbin0 -> 701 bytes
-rw-r--r--theme/cloudy/images/icons/icon_favourite.gifbin0 -> 397 bytes
-rw-r--r--theme/cloudy/images/icons/icon_foaf.gif (renamed from theme/default/images/icons/icon_foaf.gif)bin1144 -> 1144 bytes
-rw-r--r--theme/cloudy/images/icons/icon_processing.gifbin0 -> 673 bytes
-rw-r--r--theme/cloudy/images/icons/icon_reply.gifbin0 -> 336 bytes
-rw-r--r--theme/cloudy/images/icons/icon_rss.pngbin0 -> 777 bytes
-rw-r--r--theme/cloudy/images/icons/icon_trash.gifbin0 -> 148 bytes
-rw-r--r--theme/cloudy/images/icons/icon_vcard.gif (renamed from theme/default/images/icons/icon_vcard.gif)bin331 -> 331 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/arrow-left.gif (renamed from theme/identica/images/icons/twotone/green/arrow-left.gif)bin73 -> 73 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/arrow-right.gif (renamed from theme/identica/images/icons/twotone/green/arrow-right.gif)bin74 -> 74 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/edit.gif (renamed from theme/identica/images/icons/twotone/green/edit.gif)bin75 -> 75 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/mail.gif (renamed from theme/identica/images/icons/twotone/green/mail.gif)bin82 -> 82 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/news.gif (renamed from theme/identica/images/icons/twotone/green/news.gif)bin76 -> 76 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/quote.gif (renamed from theme/identica/images/icons/twotone/green/quote.gif)bin79 -> 79 bytes
-rw-r--r--theme/cloudy/images/icons/twotone/green/shield.gif (renamed from theme/identica/images/icons/twotone/green/shield.gif)bin85 -> 85 bytes
-rw-r--r--theme/cloudy/images/illustrations/illu_arrow-up-01.gifbin0 -> 68 bytes
-rw-r--r--theme/cloudy/images/illustrations/illu_clouds-01.gifbin0 -> 14251 bytes
-rw-r--r--theme/cloudy/images/illustrations/illu_jcrop.gifbin0 -> 329 bytes
-rw-r--r--theme/cloudy/images/illustrations/illu_progress_loading-01.gifbin0 -> 5886 bytes
-rw-r--r--theme/cloudy/images/illustrations/illu_unicorn-01.pngbin0 -> 5695 bytes
-rw-r--r--theme/cloudy/logo.pngbin0 -> 4988 bytes
-rw-r--r--theme/default/css/display.css32
-rw-r--r--theme/default/images/icons/icon_atom.jpgbin1117 -> 0 bytes
-rw-r--r--theme/default/images/icons/icon_rss.jpgbin1166 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/against.gifbin85 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-down.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-downleft.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-downright.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-up.gifbin74 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-upleft.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/arrow-upright.gifbin73 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/back-forth.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/bookmark.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/bulb.gifbin83 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/calendar.gifbin83 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/calendar2.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/camera.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/cart.gifbin86 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/caution.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/chart.gifbin81 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/checkmark.gifbin76 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/clipboard.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/clock.gifbin81 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/closed-folder.gifbin78 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/database.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/diskette.gifbin85 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/document.gifbin81 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/double-arrow.gifbin78 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/eject.gifbin73 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/exclaim.gifbin74 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/fastforward.gifbin77 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/flag.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/graph.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/grow.gifbin90 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/headphones.gifbin78 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/home.gifbin81 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/hourglass.gifbin85 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/info.gifbin73 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/key.gifbin76 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/lock.gifbin83 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/move.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/music.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/note.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/open-folder.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/paper-clip.gifbin78 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/paper-clip2.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/pause.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/phone.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/play.gifbin75 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/plus.gifbin74 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/print.gifbin85 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/question-mark.gifbin74 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/refresh.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/rewind.gifbin77 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/search.gifbin76 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/skip-back.gifbin76 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/skip.gifbin78 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/skull.gifbin85 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/statusbar.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/stop.gifbin72 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/template.gifbin81 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/text-bigger.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/text-smaller.gifbin80 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/two-docs.gifbin83 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/twotone.gifbin2461 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/undo.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/user.gifbin77 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/vegetable.gifbin82 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/x.gifbin79 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/zoom-in.gifbin86 -> 0 bytes
-rw-r--r--theme/default/images/icons/twotone/green/zoom-out.gifbin85 -> 0 bytes
-rw-r--r--theme/default/logo.pngbin0 -> 2228 bytes
-rw-r--r--theme/earthy/css/base.css1188
-rw-r--r--theme/earthy/css/display.css251
-rw-r--r--theme/earthy/css/ie.css9
-rw-r--r--theme/earthy/default-avatar-mini.pngbin0 -> 646 bytes
-rw-r--r--theme/earthy/default-avatar-profile.pngbin0 -> 2853 bytes
-rw-r--r--theme/earthy/default-avatar-stream.pngbin0 -> 1487 bytes
-rw-r--r--theme/earthy/logo.pngbin0 -> 4988 bytes
-rw-r--r--theme/identica/css/display.css22
-rw-r--r--theme/identica/images/icons/icon_atom.jpgbin1117 -> 0 bytes
-rw-r--r--theme/identica/images/icons/icon_foaf.gifbin1144 -> 0 bytes
-rw-r--r--theme/identica/images/icons/icon_rss.jpgbin1166 -> 0 bytes
-rw-r--r--theme/identica/images/icons/icon_vcard.gifbin331 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/against.gifbin85 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-down.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-downleft.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-downright.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-up.gifbin74 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-upleft.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/arrow-upright.gifbin73 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/back-forth.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/bookmark.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/bulb.gifbin83 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/calendar.gifbin83 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/calendar2.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/camera.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/cart.gifbin86 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/caution.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/chart.gifbin81 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/checkmark.gifbin76 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/clipboard.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/clock.gifbin81 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/closed-folder.gifbin78 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/database.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/disfavourite.gifbin88 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/diskette.gifbin85 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/document.gifbin81 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/double-arrow.gifbin78 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/eject.gifbin73 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/exclaim.gifbin74 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/fastforward.gifbin77 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/favourite.gifbin73 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/flag.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/graph.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/grow.gifbin90 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/headphones.gifbin78 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/home.gifbin81 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/hourglass.gifbin85 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/info.gifbin73 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/key.gifbin76 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/lock.gifbin83 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/move.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/music.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/note.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/open-folder.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/paper-clip.gifbin78 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/paper-clip2.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/pause.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/phone.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/play.gifbin75 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/plus.gifbin74 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/print.gifbin85 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/question-mark.gifbin74 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/refresh.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/reply.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/rewind.gifbin77 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/search.gifbin76 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/skip-back.gifbin76 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/skip.gifbin78 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/skull.gifbin85 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/statusbar.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/stop.gifbin72 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/template.gifbin81 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/text-bigger.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/text-smaller.gifbin80 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/trash.gifbin77 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/two-docs.gifbin83 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/twotone.gifbin2461 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/undo.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/user.gifbin77 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/vegetable.gifbin82 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/x.gifbin79 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/zoom-in.gifbin86 -> 0 bytes
-rw-r--r--theme/identica/images/icons/twotone/green/zoom-out.gifbin85 -> 0 bytes
-rw-r--r--theme/otalk/css/base.css1205
-rw-r--r--theme/otalk/css/display.css293
-rw-r--r--theme/otalk/css/ie.css9
-rw-r--r--theme/otalk/default-avatar-mini.pngbin0 -> 646 bytes
-rw-r--r--theme/otalk/default-avatar-profile.pngbin0 -> 2853 bytes
-rw-r--r--theme/otalk/default-avatar-stream.pngbin0 -> 1487 bytes
-rw-r--r--theme/otalk/images/illustrations/illu_arrow-left-01.gifbin0 -> 75 bytes
-rw-r--r--theme/otalk/images/illustrations/illu_pattern-01.pngbin0 -> 3218 bytes
-rw-r--r--theme/otalk/logo.pngbin0 -> 4988 bytes
257 files changed, 12176 insertions, 1205 deletions
diff --git a/README b/README
index 7b2dcacc5..4f9382960 100644
--- 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.
diff --git a/actions/conversation.php b/actions/conversation.php
new file mode 100644
index 000000000..05cfb76e3
--- /dev/null
+++ b/actions/conversation.php
@@ -0,0 +1,107 @@
+<?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) 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.'/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;
+ }
+
+ function handle($args)
+ {
+ parent::handle($args);
+ $this->showPage();
+ }
+
+ function title()
+ {
+ return _("Conversation");
+ }
+
+ 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);
+
+ $nl = new NoticeList($notices, $this);
+
+ $cnt = $nl->show();
+
+ $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+ $this->page, 'conversation', array('id' => $this->id));
+ }
+
+}
+
diff --git a/actions/designsettings.php b/actions/designsettings.php
new file mode 100644
index 000000000..cdd950e78
--- /dev/null
+++ b/actions/designsettings.php
@@ -0,0 +1,227 @@
+<?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->element('legend', null, _('Design settings'));
+ $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('p', null, _('Upload background image'));
+ $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->elementStart('li');
+ $this->input('color-1', _('Background color'), '#F0F2F5', null);
+ $this->elementEnd('li');
+ $this->elementStart('li');
+ $this->input('color-2', _('Content background color'), '#FFFFFF', null);
+ $this->elementEnd('li');
+ $this->elementStart('li');
+ $this->input('color-3', _('Sidebar background color'), '#CEE1E9', null);
+ $this->elementEnd('li');
+ $this->elementStart('li');
+ $this->input('color-4', _('Text color'), '#000000', null);
+ $this->elementEnd('li');
+ $this->elementStart('li');
+ $this->input('color-5', _('Link color'), '#002E6E', null);
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+ $this->element('div', array('id' => 'color-picker'));
+ $this->elementEnd('fieldset');
+
+
+ $this->submit('save', _('Save'));
+
+ $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 jCrop 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 jCrop scripts
+ *
+ * @return void
+ */
+
+ function showScripts()
+ {
+ parent::showScripts();
+
+// if ($this->mode == 'crop') {
+ $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));
+// }
+ }
+}
diff --git a/actions/register.php b/actions/register.php
index 033cf557f..dcbbbdb6a 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -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',
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 45725d3ff..580d9ecf7 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -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,13 @@ class TwittersettingsAction extends ConnectSettingsAction
($flink->friendsync & FOREIGN_FRIEND_RECV) :
false);
$this->elementEnd('li');
+ $this->elementStart('li');
+ $this->checkbox('noticerecv',
+ _('Import my Friends Timeline.'),
+ ($flink) ?
+ ($flink->noticesync & FOREIGN_NOTICE_RECV) :
+ false);
+ $this->elementEnd('li');
$this->elementEnd('ul');
if ($flink) {
@@ -261,7 +268,7 @@ class TwittersettingsAction extends ConnectSettingsAction
'alt' => ($other->fullname) ?
$other->fullname :
$other->nickname));
-
+
$this->element('span', 'fn nickname', $other->nickname);
$this->elementEnd('a');
$this->elementEnd('li');
@@ -320,7 +327,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 +371,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();
@@ -419,7 +427,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');
@@ -448,7 +457,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);
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php
index afc0e2180..606560951 100644
--- a/classes/Foreign_link.php
+++ b/classes/Foreign_link.php
@@ -17,6 +17,8 @@ class Foreign_link extends Memcached_DataObject
public $noticesync; // tinyint(1) not_null default_1
public $friendsync; // tinyint(1) not_null default_2
public $profilesync; // tinyint(1) not_null default_1
+ public $last_noticesync; // datetime()
+ public $last_friendsync; // datetime()
public $created; // datetime() not_null
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
@@ -57,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;
diff --git a/classes/Notice.php b/classes/Notice.php
index 6a7522bd3..19ae8313c 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -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) {
@@ -171,6 +172,14 @@ class Notice extends Memcached_DataObject
$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();
@@ -850,6 +859,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);
}
}
@@ -899,6 +909,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) {
diff --git a/classes/Status_network.php b/classes/Status_network.php
new file mode 100755
index 000000000..f7747f71d
--- /dev/null
+++ b/classes/Status_network.php
@@ -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;
+ }
+ }
+}
diff --git a/classes/laconica.ini b/classes/laconica.ini
index 529454d99..5a905a4bb 100755
--- a/classes/laconica.ini
+++ b/classes/laconica.ini
@@ -55,6 +55,8 @@ credentials = 2
noticesync = 145
friendsync = 145
profilesync = 145
+last_noticesync = 14
+last_friendsync = 14
created = 142
modified = 384
@@ -168,6 +170,7 @@ modified = 384
reply_to = 1
is_local = 17
source = 2
+conversation = 1
[notice__keys]
id = N
diff --git a/classes/statusnet.ini b/classes/statusnet.ini
new file mode 100755
index 000000000..a70cd4122
--- /dev/null
+++ b/classes/statusnet.ini
@@ -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
diff --git a/config.php.sample b/config.php.sample
index e70d9ab46..b8ed45fa8 100644
--- a/config.php.sample
+++ b/config.php.sample
@@ -130,6 +130,14 @@ $config['sphinx']['port'] = 3312;
#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;
@@ -190,3 +198,11 @@ $config['sphinx']['port'] = 3312;
#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);
+#}
diff --git a/db/laconica.sql b/db/laconica.sql
index 5b57494d9..d9e21a7b5 100644
--- a/db/laconica.sql
+++ b/db/laconica.sql
@@ -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)
@@ -289,6 +291,8 @@ create table foreign_link (
noticesync tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies',
friendsync tinyint not null default 2 comment 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
profilesync tinyint not null default 1 comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming',
+ last_noticesync datetime default null comment 'last time notices were imported',
+ last_friendsync datetime default null comment 'last time friends were imported',
created datetime not null comment 'date this record was created',
modified timestamp comment 'date this record was modified',
diff --git a/db/site.sql b/db/site.sql
new file mode 100644
index 000000000..660ba475b
--- /dev/null
+++ b/db/site.sql
@@ -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;
diff --git a/extlib/HTTP/Request.php b/extlib/HTTP/Request.php
new file mode 100644
index 000000000..42eac3b14
--- /dev/null
+++ b/extlib/HTTP/Request.php
@@ -0,0 +1,1521 @@
+<?php
+/**
+ * Class for performing HTTP requests
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2002-2007, Richard Heyes
+ * 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.
+ *
+ * @category HTTP
+ * @package HTTP_Request
+ * @author Richard Heyes <richard@phpguru.org>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2002-2007 Richard Heyes
+ * @license http://opensource.org/licenses/bsd-license.php New BSD License
+ * @version CVS: $Id: Request.php,v 1.63 2008/10/11 11:07:10 avb Exp $
+ * @link http://pear.php.net/package/HTTP_Request/
+ */
+
+/**
+ * PEAR and PEAR_Error classes (for error handling)
+ */
+require_once 'PEAR.php';
+/**
+ * Socket class
+ */
+require_once 'Net/Socket.php';
+/**
+ * URL handling class
+ */
+require_once 'Net/URL.php';
+
+/**#@+
+ * Constants for HTTP request methods
+ */
+define('HTTP_REQUEST_METHOD_GET', 'GET', true);
+define('HTTP_REQUEST_METHOD_HEAD', 'HEAD', true);
+define('HTTP_REQUEST_METHOD_POST', 'POST', true);
+define('HTTP_REQUEST_METHOD_PUT', 'PUT', true);
+define('HTTP_REQUEST_METHOD_DELETE', 'DELETE', true);
+define('HTTP_REQUEST_METHOD_OPTIONS', 'OPTIONS', true);
+define('HTTP_REQUEST_METHOD_TRACE', 'TRACE', true);
+/**#@-*/
+
+/**#@+
+ * Constants for HTTP request error codes
+ */
+define('HTTP_REQUEST_ERROR_FILE', 1);
+define('HTTP_REQUEST_ERROR_URL', 2);
+define('HTTP_REQUEST_ERROR_PROXY', 4);
+define('HTTP_REQUEST_ERROR_REDIRECTS', 8);
+define('HTTP_REQUEST_ERROR_RESPONSE', 16);
+define('HTTP_REQUEST_ERROR_GZIP_METHOD', 32);
+define('HTTP_REQUEST_ERROR_GZIP_READ', 64);
+define('HTTP_REQUEST_ERROR_GZIP_DATA', 128);
+define('HTTP_REQUEST_ERROR_GZIP_CRC', 256);
+/**#@-*/
+
+/**#@+
+ * Constants for HTTP protocol versions
+ */
+define('HTTP_REQUEST_HTTP_VER_1_0', '1.0', true);
+define('HTTP_REQUEST_HTTP_VER_1_1', '1.1', true);
+/**#@-*/
+
+if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) {
+ /**
+ * Whether string functions are overloaded by their mbstring equivalents
+ */
+ define('HTTP_REQUEST_MBSTRING', true);
+} else {
+ /**
+ * @ignore
+ */
+ define('HTTP_REQUEST_MBSTRING', false);
+}
+
+/**
+ * Class for performing HTTP requests
+ *
+ * Simple example (fetches yahoo.com and displays it):
+ * <code>
+ * $a = &new HTTP_Request('http://www.yahoo.com/');
+ * $a->sendRequest();
+ * echo $a->getResponseBody();
+ * </code>
+ *
+ * @category HTTP
+ * @package HTTP_Request
+ * @author Richard Heyes <richard@phpguru.org>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 1.4.4
+ */
+class HTTP_Request
+{
+ /**#@+
+ * @access private
+ */
+ /**
+ * Instance of Net_URL
+ * @var Net_URL
+ */
+ var $_url;
+
+ /**
+ * Type of request
+ * @var string
+ */
+ var $_method;
+
+ /**
+ * HTTP Version
+ * @var string
+ */
+ var $_http;
+
+ /**
+ * Request headers
+ * @var array
+ */
+ var $_requestHeaders;
+
+ /**
+ * Basic Auth Username
+ * @var string
+ */
+ var $_user;
+
+ /**
+ * Basic Auth Password
+ * @var string
+ */
+ var $_pass;
+
+ /**
+ * Socket object
+ * @var Net_Socket
+ */
+ var $_sock;
+
+ /**
+ * Proxy server
+ * @var string
+ */
+ var $_proxy_host;
+
+ /**
+ * Proxy port
+ * @var integer
+ */
+ var $_proxy_port;
+
+ /**
+ * Proxy username
+ * @var string
+ */
+ var $_proxy_user;
+
+ /**
+ * Proxy password
+ * @var string
+ */
+ var $_proxy_pass;
+
+ /**
+ * Post data
+ * @var array
+ */
+ var $_postData;
+
+ /**
+ * Request body
+ * @var string
+ */
+ var $_body;
+
+ /**
+ * A list of methods that MUST NOT have a request body, per RFC 2616
+ * @var array
+ */
+ var $_bodyDisallowed = array('TRACE');
+
+ /**
+ * Methods having defined semantics for request body
+ *
+ * Content-Length header (indicating that the body follows, section 4.3 of
+ * RFC 2616) will be sent for these methods even if no body was added
+ *
+ * @var array
+ */
+ var $_bodyRequired = array('POST', 'PUT');
+
+ /**
+ * Files to post
+ * @var array
+ */
+ var $_postFiles = array();
+
+ /**
+ * Connection timeout.
+ * @var float
+ */
+ var $_timeout;
+
+ /**
+ * HTTP_Response object
+ * @var HTTP_Response
+ */
+ var $_response;
+
+ /**
+ * Whether to allow redirects
+ * @var boolean
+ */
+ var $_allowRedirects;
+
+ /**
+ * Maximum redirects allowed
+ * @var integer
+ */
+ var $_maxRedirects;
+
+ /**
+ * Current number of redirects
+ * @var integer
+ */
+ var $_redirects;
+
+ /**
+ * Whether to append brackets [] to array variables
+ * @var bool
+ */
+ var $_useBrackets = true;
+
+ /**
+ * Attached listeners
+ * @var array
+ */
+ var $_listeners = array();
+
+ /**
+ * Whether to save response body in response object property
+ * @var bool
+ */
+ var $_saveBody = true;
+
+ /**
+ * Timeout for reading from socket (array(seconds, microseconds))
+ * @var array
+ */
+ var $_readTimeout = null;
+
+ /**
+ * Options to pass to Net_Socket::connect. See stream_context_create
+ * @var array
+ */
+ var $_socketOptions = null;
+ /**#@-*/
+
+ /**
+ * Constructor
+ *
+ * Sets up the object
+ * @param string The url to fetch/access
+ * @param array Associative array of parameters which can have the following keys:
+ * <ul>
+ * <li>method - Method to use, GET, POST etc (string)</li>
+ * <li>http - HTTP Version to use, 1.0 or 1.1 (string)</li>
+ * <li>user - Basic Auth username (string)</li>
+ * <li>pass - Basic Auth password (string)</li>
+ * <li>proxy_host - Proxy server host (string)</li>
+ * <li>proxy_port - Proxy server port (integer)</li>
+ * <li>proxy_user - Proxy auth username (string)</li>
+ * <li>proxy_pass - Proxy auth password (string)</li>
+ * <li>timeout - Connection timeout in seconds (float)</li>
+ * <li>allowRedirects - Whether to follow redirects or not (bool)</li>
+ * <li>maxRedirects - Max number of redirects to follow (integer)</li>
+ * <li>useBrackets - Whether to append [] to array variable names (bool)</li>
+ * <li>saveBody - Whether to save response body in response object property (bool)</li>
+ * <li>readTimeout - Timeout for reading / writing data over the socket (array (seconds, microseconds))</li>
+ * <li>socketOptions - Options to pass to Net_Socket object (array)</li>
+ * </ul>
+ * @access public
+ */
+ function HTTP_Request($url = '', $params = array())
+ {
+ $this->_method = HTTP_REQUEST_METHOD_GET;
+ $this->_http = HTTP_REQUEST_HTTP_VER_1_1;
+ $this->_requestHeaders = array();
+ $this->_postData = array();
+ $this->_body = null;
+
+ $this->_user = null;
+ $this->_pass = null;
+
+ $this->_proxy_host = null;
+ $this->_proxy_port = null;
+ $this->_proxy_user = null;
+ $this->_proxy_pass = null;
+
+ $this->_allowRedirects = false;
+ $this->_maxRedirects = 3;
+ $this->_redirects = 0;
+
+ $this->_timeout = null;
+ $this->_response = null;
+
+ foreach ($params as $key => $value) {
+ $this->{'_' . $key} = $value;
+ }
+
+ if (!empty($url)) {
+ $this->setURL($url);
+ }
+
+ // Default useragent
+ $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )');
+
+ // We don't do keep-alives by default
+ $this->addHeader('Connection', 'close');
+
+ // Basic authentication
+ if (!empty($this->_user)) {
+ $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass));
+ }
+
+ // Proxy authentication (see bug #5913)
+ if (!empty($this->_proxy_user)) {
+ $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass));
+ }
+
+ // Use gzip encoding if possible
+ if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) {
+ $this->addHeader('Accept-Encoding', 'gzip');
+ }
+ }
+
+ /**
+ * Generates a Host header for HTTP/1.1 requests
+ *
+ * @access private
+ * @return string
+ */
+ function _generateHostHeader()
+ {
+ if ($this->_url->port != 80 AND strcasecmp($this->_url->protocol, 'http') == 0) {
+ $host = $this->_url->host . ':' . $this->_url->port;
+
+ } elseif ($this->_url->port != 443 AND strcasecmp($this->_url->protocol, 'https') == 0) {
+ $host = $this->_url->host . ':' . $this->_url->port;
+
+ } elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
+ $host = $this->_url->host . ':' . $this->_url->port;
+
+ } else {
+ $host = $this->_url->host;
+ }
+
+ return $host;
+ }
+
+ /**
+ * Resets the object to its initial state (DEPRECATED).
+ * Takes the same parameters as the constructor.
+ *
+ * @param string $url The url to be requested
+ * @param array $params Associative array of parameters
+ * (see constructor for details)
+ * @access public
+ * @deprecated deprecated since 1.2, call the constructor if this is necessary
+ */
+ function reset($url, $params = array())
+ {
+ $this->HTTP_Request($url, $params);
+ }
+
+ /**
+ * Sets the URL to be requested
+ *
+ * @param string The url to be requested
+ * @access public
+ */
+ function setURL($url)
+ {
+ $this->_url = &new Net_URL($url, $this->_useBrackets);
+
+ if (!empty($this->_url->user) || !empty($this->_url->pass)) {
+ $this->setBasicAuth($this->_url->user, $this->_url->pass);
+ }
+
+ if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) {
+ $this->addHeader('Host', $this->_generateHostHeader());
+ }
+
+ // set '/' instead of empty path rather than check later (see bug #8662)
+ if (empty($this->_url->path)) {
+ $this->_url->path = '/';
+ }
+ }
+
+ /**
+ * Returns the current request URL
+ *
+ * @return string Current request URL
+ * @access public
+ */
+ function getUrl()
+ {
+ return empty($this->_url)? '': $this->_url->getUrl();
+ }
+
+ /**
+ * Sets a proxy to be used
+ *
+ * @param string Proxy host
+ * @param int Proxy port
+ * @param string Proxy username
+ * @param string Proxy password
+ * @access public
+ */
+ function setProxy($host, $port = 8080, $user = null, $pass = null)
+ {
+ $this->_proxy_host = $host;
+ $this->_proxy_port = $port;
+ $this->_proxy_user = $user;
+ $this->_proxy_pass = $pass;
+
+ if (!empty($user)) {
+ $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
+ }
+ }
+
+ /**
+ * Sets basic authentication parameters
+ *
+ * @param string Username
+ * @param string Password
+ */
+ function setBasicAuth($user, $pass)
+ {
+ $this->_user = $user;
+ $this->_pass = $pass;
+
+ $this->addHeader('Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
+ }
+
+ /**
+ * Sets the method to be used, GET, POST etc.
+ *
+ * @param string Method to use. Use the defined constants for this
+ * @access public
+ */
+ function setMethod($method)
+ {
+ $this->_method = $method;
+ }
+
+ /**
+ * Sets the HTTP version to use, 1.0 or 1.1
+ *
+ * @param string Version to use. Use the defined constants for this
+ * @access public
+ */
+ function setHttpVer($http)
+ {
+ $this->_http = $http;
+ }
+
+ /**
+ * Adds a request header
+ *
+ * @param string Header name
+ * @param string Header value
+ * @access public
+ */
+ function addHeader($name, $value)
+ {
+ $this->_requestHeaders[strtolower($name)] = $value;
+ }
+
+ /**
+ * Removes a request header
+ *
+ * @param string Header name to remove
+ * @access public
+ */
+ function removeHeader($name)
+ {
+ if (isset($this->_requestHeaders[strtolower($name)])) {
+ unset($this->_requestHeaders[strtolower($name)]);
+ }
+ }
+
+ /**
+ * Adds a querystring parameter
+ *
+ * @param string Querystring parameter name
+ * @param string Querystring parameter value
+ * @param bool Whether the value is already urlencoded or not, default = not
+ * @access public
+ */
+ function addQueryString($name, $value, $preencoded = false)
+ {
+ $this->_url->addQueryString($name, $value, $preencoded);
+ }
+
+ /**
+ * Sets the querystring to literally what you supply
+ *
+ * @param string The querystring data. Should be of the format foo=bar&x=y etc
+ * @param bool Whether data is already urlencoded or not, default = already encoded
+ * @access public
+ */
+ function addRawQueryString($querystring, $preencoded = true)
+ {
+ $this->_url->addRawQueryString($querystring, $preencoded);
+ }
+
+ /**
+ * Adds postdata items
+ *
+ * @param string Post data name
+ * @param string Post data value
+ * @param bool Whether data is already urlencoded or not, default = not
+ * @access public
+ */
+ function addPostData($name, $value, $preencoded = false)
+ {
+ if ($preencoded) {
+ $this->_postData[$name] = $value;
+ } else {
+ $this->_postData[$name] = $this->_arrayMapRecursive('urlencode', $value);
+ }
+ }
+
+ /**
+ * Recursively applies the callback function to the value
+ *
+ * @param mixed Callback function
+ * @param mixed Value to process
+ * @access private
+ * @return mixed Processed value
+ */
+ function _arrayMapRecursive($callback, $value)
+ {
+ if (!is_array($value)) {
+ return call_user_func($callback, $value);
+ } else {
+ $map = array();
+ foreach ($value as $k => $v) {
+ $map[$k] = $this->_arrayMapRecursive($callback, $v);
+ }
+ return $map;
+ }
+ }
+
+ /**
+ * Adds a file to form-based file upload
+ *
+ * Used to emulate file upload via a HTML form. The method also sets
+ * Content-Type of HTTP request to 'multipart/form-data'.
+ *
+ * If you just want to send the contents of a file as the body of HTTP
+ * request you should use setBody() method.
+ *
+ * @access public
+ * @param string name of file-upload field
+ * @param mixed file name(s)
+ * @param mixed content-type(s) of file(s) being uploaded
+ * @return bool true on success
+ * @throws PEAR_Error
+ */
+ function addFile($inputName, $fileName, $contentType = 'application/octet-stream')
+ {
+ if (!is_array($fileName) && !is_readable($fileName)) {
+ return PEAR::raiseError("File '{$fileName}' is not readable", HTTP_REQUEST_ERROR_FILE);
+ } elseif (is_array($fileName)) {
+ foreach ($fileName as $name) {
+ if (!is_readable($name)) {
+ return PEAR::raiseError("File '{$name}' is not readable", HTTP_REQUEST_ERROR_FILE);
+ }
+ }
+ }
+ $this->addHeader('Content-Type', 'multipart/form-data');
+ $this->_postFiles[$inputName] = array(
+ 'name' => $fileName,
+ 'type' => $contentType
+ );
+ return true;
+ }
+
+ /**
+ * Adds raw postdata (DEPRECATED)
+ *
+ * @param string The data
+ * @param bool Whether data is preencoded or not, default = already encoded
+ * @access public
+ * @deprecated deprecated since 1.3.0, method setBody() should be used instead
+ */
+ function addRawPostData($postdata, $preencoded = true)
+ {
+ $this->_body = $preencoded ? $postdata : urlencode($postdata);
+ }
+
+ /**
+ * Sets the request body (for POST, PUT and similar requests)
+ *
+ * @param string Request body
+ * @access public
+ */
+ function setBody($body)
+ {
+ $this->_body = $body;
+ }
+
+ /**
+ * Clears any postdata that has been added (DEPRECATED).
+ *
+ * Useful for multiple request scenarios.
+ *
+ * @access public
+ * @deprecated deprecated since 1.2
+ */
+ function clearPostData()
+ {
+ $this->_postData = null;
+ }
+
+ /**
+ * Appends a cookie to "Cookie:" header
+ *
+ * @param string $name cookie name
+ * @param string $value cookie value
+ * @access public
+ */
+ function addCookie($name, $value)
+ {
+ $cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
+ $this->addHeader('Cookie', $cookies . $name . '=' . $value);
+ }
+
+ /**
+ * Clears any cookies that have been added (DEPRECATED).
+ *
+ * Useful for multiple request scenarios
+ *
+ * @access public
+ * @deprecated deprecated since 1.2
+ */
+ function clearCookies()
+ {
+ $this->removeHeader('Cookie');
+ }
+
+ /**
+ * Sends the request
+ *
+ * @access public
+ * @param bool Whether to store response body in Response object property,
+ * set this to false if downloading a LARGE file and using a Listener
+ * @return mixed PEAR error on error, true otherwise
+ */
+ function sendRequest($saveBody = true)
+ {
+ if (!is_a($this->_url, 'Net_URL')) {
+ return PEAR::raiseError('No URL given', HTTP_REQUEST_ERROR_URL);
+ }
+
+ $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;
+ $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;
+
+ if (strcasecmp($this->_url->protocol, 'https') == 0) {
+ // Bug #14127, don't try connecting to HTTPS sites without OpenSSL
+ if (version_compare(PHP_VERSION, '4.3.0', '<') || !extension_loaded('openssl')) {
+ return PEAR::raiseError('Need PHP 4.3.0 or later with OpenSSL support for https:// requests',
+ HTTP_REQUEST_ERROR_URL);
+ } elseif (isset($this->_proxy_host)) {
+ return PEAR::raiseError('HTTPS proxies are not supported', HTTP_REQUEST_ERROR_PROXY);
+ }
+ $host = 'ssl://' . $host;
+ }
+
+ // magic quotes may fuck up file uploads and chunked response processing
+ $magicQuotes = ini_get('magic_quotes_runtime');
+ ini_set('magic_quotes_runtime', false);
+
+ // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive
+ // connection token to a proxy server...
+ if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) &&
+ 'Keep-Alive' == $this->_requestHeaders['connection'])
+ {
+ $this->removeHeader('connection');
+ }
+
+ $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) ||
+ (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);
+ $sockets = &PEAR::getStaticProperty('HTTP_Request', 'sockets');
+ $sockKey = $host . ':' . $port;
+ unset($this->_sock);
+
+ // There is a connected socket in the "static" property?
+ if ($keepAlive && !empty($sockets[$sockKey]) &&
+ !empty($sockets[$sockKey]->fp))
+ {
+ $this->_sock =& $sockets[$sockKey];
+ $err = null;
+ } else {
+ $this->_notify('connect');
+ $this->_sock =& new Net_Socket();
+ $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
+ }
+ PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
+
+ if (!PEAR::isError($err)) {
+ if (!empty($this->_readTimeout)) {
+ $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);
+ }
+
+ $this->_notify('sentRequest');
+
+ // Read the response
+ $this->_response = &new HTTP_Response($this->_sock, $this->_listeners);
+ $err = $this->_response->process(
+ $this->_saveBody && $saveBody,
+ HTTP_REQUEST_METHOD_HEAD != $this->_method
+ );
+
+ if ($keepAlive) {
+ $keepAlive = (isset($this->_response->_headers['content-length'])
+ || (isset($this->_response->_headers['transfer-encoding'])
+ && strtolower($this->_response->_headers['transfer-encoding']) == 'chunked'));
+ if ($keepAlive) {
+ if (isset($this->_response->_headers['connection'])) {
+ $keepAlive = strtolower($this->_response->_headers['connection']) == 'keep-alive';
+ } else {
+ $keepAlive = 'HTTP/'.HTTP_REQUEST_HTTP_VER_1_1 == $this->_response->_protocol;
+ }
+ }
+ }
+ }
+
+ ini_set('magic_quotes_runtime', $magicQuotes);
+
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+
+ if (!$keepAlive) {
+ $this->disconnect();
+ // Store the connected socket in "static" property
+ } elseif (empty($sockets[$sockKey]) || empty($sockets[$sockKey]->fp)) {
+ $sockets[$sockKey] =& $this->_sock;
+ }
+
+ // Check for redirection
+ if ( $this->_allowRedirects
+ AND $this->_redirects <= $this->_maxRedirects
+ AND $this->getResponseCode() > 300
+ AND $this->getResponseCode() < 399
+ AND !empty($this->_response->_headers['location'])) {
+
+
+ $redirect = $this->_response->_headers['location'];
+
+ // Absolute URL
+ if (preg_match('/^https?:\/\//i', $redirect)) {
+ $this->_url = &new Net_URL($redirect);
+ $this->addHeader('Host', $this->_generateHostHeader());
+ // Absolute path
+ } elseif ($redirect{0} == '/') {
+ $this->_url->path = $redirect;
+
+ // Relative path
+ } elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
+ if (substr($this->_url->path, -1) == '/') {
+ $redirect = $this->_url->path . $redirect;
+ } else {
+ $redirect = dirname($this->_url->path) . '/' . $redirect;
+ }
+ $redirect = Net_URL::resolvePath($redirect);
+ $this->_url->path = $redirect;
+
+ // Filename, no path
+ } else {
+ if (substr($this->_url->path, -1) == '/') {
+ $redirect = $this->_url->path . $redirect;
+ } else {
+ $redirect = dirname($this->_url->path) . '/' . $redirect;
+ }
+ $this->_url->path = $redirect;
+ }
+
+ $this->_redirects++;
+ return $this->sendRequest($saveBody);
+
+ // Too many redirects
+ } elseif ($this->_allowRedirects AND $this->_redirects > $this->_maxRedirects) {
+ return PEAR::raiseError('Too many redirects', HTTP_REQUEST_ERROR_REDIRECTS);
+ }
+
+ return true;
+ }
+
+ /**
+ * Disconnect the socket, if connected. Only useful if using Keep-Alive.
+ *
+ * @access public
+ */
+ function disconnect()
+ {
+ if (!empty($this->_sock) && !empty($this->_sock->fp)) {
+ $this->_notify('disconnect');
+ $this->_sock->disconnect();
+ }
+ }
+
+ /**
+ * Returns the response code
+ *
+ * @access public
+ * @return mixed Response code, false if not set
+ */
+ function getResponseCode()
+ {
+ return isset($this->_response->_code) ? $this->_response->_code : false;
+ }
+
+ /**
+ * Returns the response reason phrase
+ *
+ * @access public
+ * @return mixed Response reason phrase, false if not set
+ */
+ function getResponseReason()
+ {
+ return isset($this->_response->_reason) ? $this->_response->_reason : false;
+ }
+
+ /**
+ * Returns either the named header or all if no name given
+ *
+ * @access public
+ * @param string The header name to return, do not set to get all headers
+ * @return mixed either the value of $headername (false if header is not present)
+ * or an array of all headers
+ */
+ function getResponseHeader($headername = null)
+ {
+ if (!isset($headername)) {
+ return isset($this->_response->_headers)? $this->_response->_headers: array();
+ } else {
+ $headername = strtolower($headername);
+ return isset($this->_response->_headers[$headername]) ? $this->_response->_headers[$headername] : false;
+ }
+ }
+
+ /**
+ * Returns the body of the response
+ *
+ * @access public
+ * @return mixed response body, false if not set
+ */
+ function getResponseBody()
+ {
+ return isset($this->_response->_body) ? $this->_response->_body : false;
+ }
+
+ /**
+ * Returns cookies set in response
+ *
+ * @access public
+ * @return mixed array of response cookies, false if none are present
+ */
+ function getResponseCookies()
+ {
+ return isset($this->_response->_cookies) ? $this->_response->_cookies : false;
+ }
+
+ /**
+ * Builds the request string
+ *
+ * @access private
+ * @return string The request string
+ */
+ function _buildRequest()
+ {
+ $separator = ini_get('arg_separator.output');
+ ini_set('arg_separator.output', '&');
+ $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';
+ ini_set('arg_separator.output', $separator);
+
+ $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';
+ $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';
+ $path = $this->_url->path . $querystring;
+ $url = $host . $port . $path;
+
+ if (!strlen($url)) {
+ $url = '/';
+ }
+
+ $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";
+
+ if (in_array($this->_method, $this->_bodyDisallowed) ||
+ (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
+ (empty($this->_postData) && empty($this->_postFiles)))))
+ {
+ $this->removeHeader('Content-Type');
+ } else {
+ if (empty($this->_requestHeaders['content-type'])) {
+ // Add default content-type
+ $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+ } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {
+ $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());
+ $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);
+ }
+ }
+
+ // Request Headers
+ if (!empty($this->_requestHeaders)) {
+ foreach ($this->_requestHeaders as $name => $value) {
+ $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
+ $request .= $canonicalName . ': ' . $value . "\r\n";
+ }
+ }
+
+ // Method does not allow a body, simply add a final CRLF
+ if (in_array($this->_method, $this->_bodyDisallowed)) {
+
+ $request .= "\r\n";
+
+ // Post data if it's an array
+ } elseif (HTTP_REQUEST_METHOD_POST == $this->_method &&
+ (!empty($this->_postData) || !empty($this->_postFiles))) {
+
+ // "normal" POST request
+ if (!isset($boundary)) {
+ $postdata = implode('&', array_map(
+ create_function('$a', 'return $a[0] . \'=\' . $a[1];'),
+ $this->_flattenArray('', $this->_postData)
+ ));
+
+ // multipart request, probably with file uploads
+ } else {
+ $postdata = '';
+ if (!empty($this->_postData)) {
+ $flatData = $this->_flattenArray('', $this->_postData);
+ foreach ($flatData as $item) {
+ $postdata .= '--' . $boundary . "\r\n";
+ $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';
+ $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";
+ }
+ }
+ foreach ($this->_postFiles as $name => $value) {
+ if (is_array($value['name'])) {
+ $varname = $name . ($this->_useBrackets? '[]': '');
+ } else {
+ $varname = $name;
+ $value['name'] = array($value['name']);
+ }
+ foreach ($value['name'] as $key => $filename) {
+ $fp = fopen($filename, 'r');
+ $basename = basename($filename);
+ $type = is_array($value['type'])? @$value['type'][$key]: $value['type'];
+
+ $postdata .= '--' . $boundary . "\r\n";
+ $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';
+ $postdata .= "\r\nContent-Type: " . $type;
+ $postdata .= "\r\n\r\n" . fread($fp, filesize($filename)) . "\r\n";
+ fclose($fp);
+ }
+ }
+ $postdata .= '--' . $boundary . "--\r\n";
+ }
+ $request .= 'Content-Length: ' .
+ (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .
+ "\r\n\r\n";
+ $request .= $postdata;
+
+ // Explicitly set request body
+ } elseif (0 < strlen($this->_body)) {
+
+ $request .= 'Content-Length: ' .
+ (HTTP_REQUEST_MBSTRING? mb_strlen($this->_body, 'iso-8859-1'): strlen($this->_body)) .
+ "\r\n\r\n";
+ $request .= $this->_body;
+
+ // No body: send a Content-Length header nonetheless (request #12900),
+ // but do that only for methods that require a body (bug #14740)
+ } else {
+
+ if (in_array($this->_method, $this->_bodyRequired)) {
+ $request .= "Content-Length: 0\r\n";
+ }
+ $request .= "\r\n";
+ }
+
+ return $request;
+ }
+
+ /**
+ * Helper function to change the (probably multidimensional) associative array
+ * into the simple one.
+ *
+ * @param string name for item
+ * @param mixed item's values
+ * @return array array with the following items: array('item name', 'item value');
+ * @access private
+ */
+ function _flattenArray($name, $values)
+ {
+ if (!is_array($values)) {
+ return array(array($name, $values));
+ } else {
+ $ret = array();
+ foreach ($values as $k => $v) {
+ if (empty($name)) {
+ $newName = $k;
+ } elseif ($this->_useBrackets) {
+ $newName = $name . '[' . $k . ']';
+ } else {
+ $newName = $name;
+ }
+ $ret = array_merge($ret, $this->_flattenArray($newName, $v));
+ }
+ return $ret;
+ }
+ }
+
+
+ /**
+ * Adds a Listener to the list of listeners that are notified of
+ * the object's events
+ *
+ * Events sent by HTTP_Request object
+ * - 'connect': on connection to server
+ * - 'sentRequest': after the request was sent
+ * - 'disconnect': on disconnection from server
+ *
+ * Events sent by HTTP_Response object
+ * - 'gotHeaders': after receiving response headers (headers are passed in $data)
+ * - 'tick': on receiving a part of response body (the part is passed in $data)
+ * - 'gzTick': on receiving a gzip-encoded part of response body (ditto)
+ * - 'gotBody': after receiving the response body (passes the decoded body in $data if it was gzipped)
+ *
+ * @param HTTP_Request_Listener listener to attach
+ * @return boolean whether the listener was successfully attached
+ * @access public
+ */
+ function attach(&$listener)
+ {
+ if (!is_a($listener, 'HTTP_Request_Listener')) {
+ return false;
+ }
+ $this->_listeners[$listener->getId()] =& $listener;
+ return true;
+ }
+
+
+ /**
+ * Removes a Listener from the list of listeners
+ *
+ * @param HTTP_Request_Listener listener to detach
+ * @return boolean whether the listener was successfully detached
+ * @access public
+ */
+ function detach(&$listener)
+ {
+ if (!is_a($listener, 'HTTP_Request_Listener') ||
+ !isset($this->_listeners[$listener->getId()])) {
+ return false;
+ }
+ unset($this->_listeners[$listener->getId()]);
+ return true;
+ }
+
+
+ /**
+ * Notifies all registered listeners of an event.
+ *
+ * @param string Event name
+ * @param mixed Additional data
+ * @access private
+ * @see HTTP_Request::attach()
+ */
+ function _notify($event, $data = null)
+ {
+ foreach (array_keys($this->_listeners) as $id) {
+ $this->_listeners[$id]->update($this, $event, $data);
+ }
+ }
+}
+
+
+/**
+ * Response class to complement the Request class
+ *
+ * @category HTTP
+ * @package HTTP_Request
+ * @author Richard Heyes <richard@phpguru.org>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 1.4.4
+ */
+class HTTP_Response
+{
+ /**
+ * Socket object
+ * @var Net_Socket
+ */
+ var $_sock;
+
+ /**
+ * Protocol
+ * @var string
+ */
+ var $_protocol;
+
+ /**
+ * Return code
+ * @var string
+ */
+ var $_code;
+
+ /**
+ * Response reason phrase
+ * @var string
+ */
+ var $_reason;
+
+ /**
+ * Response headers
+ * @var array
+ */
+ var $_headers;
+
+ /**
+ * Cookies set in response
+ * @var array
+ */
+ var $_cookies;
+
+ /**
+ * Response body
+ * @var string
+ */
+ var $_body = '';
+
+ /**
+ * Used by _readChunked(): remaining length of the current chunk
+ * @var string
+ */
+ var $_chunkLength = 0;
+
+ /**
+ * Attached listeners
+ * @var array
+ */
+ var $_listeners = array();
+
+ /**
+ * Bytes left to read from message-body
+ * @var null|int
+ */
+ var $_toRead;
+
+ /**
+ * Constructor
+ *
+ * @param Net_Socket socket to read the response from
+ * @param array listeners attached to request
+ */
+ function HTTP_Response(&$sock, &$listeners)
+ {
+ $this->_sock =& $sock;
+ $this->_listeners =& $listeners;
+ }
+
+
+ /**
+ * Processes a HTTP response
+ *
+ * This extracts response code, headers, cookies and decodes body if it
+ * was encoded in some way
+ *
+ * @access public
+ * @param bool Whether to store response body in object property, set
+ * this to false if downloading a LARGE file and using a Listener.
+ * This is assumed to be true if body is gzip-encoded.
+ * @param bool Whether the response can actually have a message-body.
+ * Will be set to false for HEAD requests.
+ * @throws PEAR_Error
+ * @return mixed true on success, PEAR_Error in case of malformed response
+ */
+ function process($saveBody = true, $canHaveBody = true)
+ {
+ do {
+ $line = $this->_sock->readLine();
+ if (!preg_match('!^(HTTP/\d\.\d) (\d{3})(?: (.+))?!', $line, $s)) {
+ return PEAR::raiseError('Malformed response', HTTP_REQUEST_ERROR_RESPONSE);
+ } else {
+ $this->_protocol = $s[1];
+ $this->_code = intval($s[2]);
+ $this->_reason = empty($s[3])? null: $s[3];
+ }
+ while ('' !== ($header = $this->_sock->readLine())) {
+ $this->_processHeader($header);
+ }
+ } while (100 == $this->_code);
+
+ $this->_notify('gotHeaders', $this->_headers);
+
+ // RFC 2616, section 4.4:
+ // 1. Any response message which "MUST NOT" include a message-body ...
+ // is always terminated by the first empty line after the header fields
+ // 3. ... If a message is received with both a
+ // Transfer-Encoding header field and a Content-Length header field,
+ // the latter MUST be ignored.
+ $canHaveBody = $canHaveBody && $this->_code >= 200 &&
+ $this->_code != 204 && $this->_code != 304;
+
+ // If response body is present, read it and decode
+ $chunked = isset($this->_headers['transfer-encoding']) && ('chunked' == $this->_headers['transfer-encoding']);
+ $gzipped = isset($this->_headers['content-encoding']) && ('gzip' == $this->_headers['content-encoding']);
+ $hasBody = false;
+ if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) ||
+ 0 != $this->_headers['content-length']))
+ {
+ if ($chunked || !isset($this->_headers['content-length'])) {
+ $this->_toRead = null;
+ } else {
+ $this->_toRead = $this->_headers['content-length'];
+ }
+ while (!$this->_sock->eof() && (is_null($this->_toRead) || 0 < $this->_toRead)) {
+ if ($chunked) {
+ $data = $this->_readChunked();
+ } elseif (is_null($this->_toRead)) {
+ $data = $this->_sock->read(4096);
+ } else {
+ $data = $this->_sock->read(min(4096, $this->_toRead));
+ $this->_toRead -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);
+ }
+ if ('' == $data && (!$this->_chunkLength || $this->_sock->eof())) {
+ break;
+ } else {
+ $hasBody = true;
+ if ($saveBody || $gzipped) {
+ $this->_body .= $data;
+ }
+ $this->_notify($gzipped? 'gzTick': 'tick', $data);
+ }
+ }
+ }
+
+ if ($hasBody) {
+ // Uncompress the body if needed
+ if ($gzipped) {
+ $body = $this->_decodeGzip($this->_body);
+ if (PEAR::isError($body)) {
+ return $body;
+ }
+ $this->_body = $body;
+ $this->_notify('gotBody', $this->_body);
+ } else {
+ $this->_notify('gotBody');
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Processes the response header
+ *
+ * @access private
+ * @param string HTTP header
+ */
+ function _processHeader($header)
+ {
+ if (false === strpos($header, ':')) {
+ return;
+ }
+ list($headername, $headervalue) = explode(':', $header, 2);
+ $headername = strtolower($headername);
+ $headervalue = ltrim($headervalue);
+
+ if ('set-cookie' != $headername) {
+ if (isset($this->_headers[$headername])) {
+ $this->_headers[$headername] .= ',' . $headervalue;
+ } else {
+ $this->_headers[$headername] = $headervalue;
+ }
+ } else {
+ $this->_parseCookie($headervalue);
+ }
+ }
+
+
+ /**
+ * Parse a Set-Cookie header to fill $_cookies array
+ *
+ * @access private
+ * @param string value of Set-Cookie header
+ */
+ function _parseCookie($headervalue)
+ {
+ $cookie = array(
+ 'expires' => null,
+ 'domain' => null,
+ 'path' => null,
+ 'secure' => false
+ );
+
+ // Only a name=value pair
+ if (!strpos($headervalue, ';')) {
+ $pos = strpos($headervalue, '=');
+ $cookie['name'] = trim(substr($headervalue, 0, $pos));
+ $cookie['value'] = trim(substr($headervalue, $pos + 1));
+
+ // Some optional parameters are supplied
+ } else {
+ $elements = explode(';', $headervalue);
+ $pos = strpos($elements[0], '=');
+ $cookie['name'] = trim(substr($elements[0], 0, $pos));
+ $cookie['value'] = trim(substr($elements[0], $pos + 1));
+
+ for ($i = 1; $i < count($elements); $i++) {
+ if (false === strpos($elements[$i], '=')) {
+ $elName = trim($elements[$i]);
+ $elValue = null;
+ } else {
+ list ($elName, $elValue) = array_map('trim', explode('=', $elements[$i]));
+ }
+ $elName = strtolower($elName);
+ if ('secure' == $elName) {
+ $cookie['secure'] = true;
+ } elseif ('expires' == $elName) {
+ $cookie['expires'] = str_replace('"', '', $elValue);
+ } elseif ('path' == $elName || 'domain' == $elName) {
+ $cookie[$elName] = urldecode($elValue);
+ } else {
+ $cookie[$elName] = $elValue;
+ }
+ }
+ }
+ $this->_cookies[] = $cookie;
+ }
+
+
+ /**
+ * Read a part of response body encoded with chunked Transfer-Encoding
+ *
+ * @access private
+ * @return string
+ */
+ function _readChunked()
+ {
+ // at start of the next chunk?
+ if (0 == $this->_chunkLength) {
+ $line = $this->_sock->readLine();
+ if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
+ $this->_chunkLength = hexdec($matches[1]);
+ // Chunk with zero length indicates the end
+ if (0 == $this->_chunkLength) {
+ $this->_sock->readLine(); // make this an eof()
+ return '';
+ }
+ } else {
+ return '';
+ }
+ }
+ $data = $this->_sock->read($this->_chunkLength);
+ $this->_chunkLength -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);
+ if (0 == $this->_chunkLength) {
+ $this->_sock->readLine(); // Trailing CRLF
+ }
+ return $data;
+ }
+
+
+ /**
+ * Notifies all registered listeners of an event.
+ *
+ * @param string Event name
+ * @param mixed Additional data
+ * @access private
+ * @see HTTP_Request::_notify()
+ */
+ function _notify($event, $data = null)
+ {
+ foreach (array_keys($this->_listeners) as $id) {
+ $this->_listeners[$id]->update($this, $event, $data);
+ }
+ }
+
+
+ /**
+ * Decodes the message-body encoded by gzip
+ *
+ * The real decoding work is done by gzinflate() built-in function, this
+ * method only parses the header and checks data for compliance with
+ * RFC 1952
+ *
+ * @access private
+ * @param string gzip-encoded data
+ * @return string decoded data
+ */
+ function _decodeGzip($data)
+ {
+ if (HTTP_REQUEST_MBSTRING) {
+ $oldEncoding = mb_internal_encoding();
+ mb_internal_encoding('iso-8859-1');
+ }
+ $length = strlen($data);
+ // If it doesn't look like gzip-encoded data, don't bother
+ if (18 > $length || strcmp(substr($data, 0, 2), "\x1f\x8b")) {
+ return $data;
+ }
+ $method = ord(substr($data, 2, 1));
+ if (8 != $method) {
+ return PEAR::raiseError('_decodeGzip(): unknown compression method', HTTP_REQUEST_ERROR_GZIP_METHOD);
+ }
+ $flags = ord(substr($data, 3, 1));
+ if ($flags & 224) {
+ return PEAR::raiseError('_decodeGzip(): reserved bits are set', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+
+ // header is 10 bytes minimum. may be longer, though.
+ $headerLength = 10;
+ // extra fields, need to skip 'em
+ if ($flags & 4) {
+ if ($length - $headerLength - 2 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $extraLength = unpack('v', substr($data, 10, 2));
+ if ($length - $headerLength - 2 - $extraLength[1] < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $headerLength += $extraLength[1] + 2;
+ }
+ // file name, need to skip that
+ if ($flags & 8) {
+ if ($length - $headerLength - 1 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $filenameLength = strpos(substr($data, $headerLength), chr(0));
+ if (false === $filenameLength || $length - $headerLength - $filenameLength - 1 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $headerLength += $filenameLength + 1;
+ }
+ // comment, need to skip that also
+ if ($flags & 16) {
+ if ($length - $headerLength - 1 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $commentLength = strpos(substr($data, $headerLength), chr(0));
+ if (false === $commentLength || $length - $headerLength - $commentLength - 1 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $headerLength += $commentLength + 1;
+ }
+ // have a CRC for header. let's check
+ if ($flags & 1) {
+ if ($length - $headerLength - 2 < 8) {
+ return PEAR::raiseError('_decodeGzip(): data too short', HTTP_REQUEST_ERROR_GZIP_DATA);
+ }
+ $crcReal = 0xffff & crc32(substr($data, 0, $headerLength));
+ $crcStored = unpack('v', substr($data, $headerLength, 2));
+ if ($crcReal != $crcStored[1]) {
+ return PEAR::raiseError('_decodeGzip(): header CRC check failed', HTTP_REQUEST_ERROR_GZIP_CRC);
+ }
+ $headerLength += 2;
+ }
+ // unpacked data CRC and size at the end of encoded data
+ $tmp = unpack('V2', substr($data, -8));
+ $dataCrc = $tmp[1];
+ $dataSize = $tmp[2];
+
+ // finally, call the gzinflate() function
+ // don't pass $dataSize to gzinflate, see bugs #13135, #14370
+ $unpacked = gzinflate(substr($data, $headerLength, -8));
+ if (false === $unpacked) {
+ return PEAR::raiseError('_decodeGzip(): gzinflate() call failed', HTTP_REQUEST_ERROR_GZIP_READ);
+ } elseif ($dataSize != strlen($unpacked)) {
+ return PEAR::raiseError('_decodeGzip(): data size check failed', HTTP_REQUEST_ERROR_GZIP_READ);
+ } elseif ((0xffffffff & $dataCrc) != (0xffffffff & crc32($unpacked))) {
+ return PEAR::raiseError('_decodeGzip(): data CRC check failed', HTTP_REQUEST_ERROR_GZIP_CRC);
+ }
+ if (HTTP_REQUEST_MBSTRING) {
+ mb_internal_encoding($oldEncoding);
+ }
+ return $unpacked;
+ }
+} // End class HTTP_Response
+?>
diff --git a/extlib/HTTP/Request/Listener.php b/extlib/HTTP/Request/Listener.php
new file mode 100644
index 000000000..b4fe444b3
--- /dev/null
+++ b/extlib/HTTP/Request/Listener.php
@@ -0,0 +1,106 @@
+<?php
+/**
+ * Listener for HTTP_Request and HTTP_Response objects
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2002-2007, Richard Heyes
+ * 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.
+ *
+ * @category HTTP
+ * @package HTTP_Request
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2002-2007 Richard Heyes
+ * @license http://opensource.org/licenses/bsd-license.php New BSD License
+ * @version CVS: $Id: Listener.php,v 1.3 2007/05/18 10:33:31 avb Exp $
+ * @link http://pear.php.net/package/HTTP_Request/
+ */
+
+/**
+ * Listener for HTTP_Request and HTTP_Response objects
+ *
+ * This class implements the Observer part of a Subject-Observer
+ * design pattern.
+ *
+ * @category HTTP
+ * @package HTTP_Request
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 1.4.4
+ */
+class HTTP_Request_Listener
+{
+ /**
+ * A listener's identifier
+ * @var string
+ */
+ var $_id;
+
+ /**
+ * Constructor, sets the object's identifier
+ *
+ * @access public
+ */
+ function HTTP_Request_Listener()
+ {
+ $this->_id = md5(uniqid('http_request_', 1));
+ }
+
+
+ /**
+ * Returns the listener's identifier
+ *
+ * @access public
+ * @return string
+ */
+ function getId()
+ {
+ return $this->_id;
+ }
+
+
+ /**
+ * This method is called when Listener is notified of an event
+ *
+ * @access public
+ * @param object an object the listener is attached to
+ * @param string Event name
+ * @param mixed Additional data
+ * @abstract
+ */
+ function update(&$subject, $event, $data = null)
+ {
+ echo "Notified of event: '$event'\n";
+ if (null !== $data) {
+ echo "Additional data: ";
+ var_dump($data);
+ }
+ }
+}
+?>
diff --git a/extlib/Net/URL2.php b/extlib/Net/URL2.php
new file mode 100644
index 000000000..7a654aed8
--- /dev/null
+++ b/extlib/Net/URL2.php
@@ -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
index 000000000..5d38ed883
--- /dev/null
+++ b/extlib/Services/oEmbed.php
@@ -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
index 000000000..446ac2a70
--- /dev/null
+++ b/extlib/Services/oEmbed/Exception.php
@@ -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
index 000000000..384c7191f
--- /dev/null
+++ b/extlib/Services/oEmbed/Exception/NoSupport.php
@@ -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
index 000000000..9eedd7efb
--- /dev/null
+++ b/extlib/Services/oEmbed/Object.php
@@ -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
index 000000000..f568ec89f
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Common.php
@@ -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
index 000000000..6025ffd49
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Exception.php
@@ -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
index 000000000..9b627a89a
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Link.php
@@ -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
index 000000000..5fbf4292f
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Photo.php
@@ -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
index 000000000..dbf6933ac
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Rich.php
@@ -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
index 000000000..746108115
--- /dev/null
+++ b/extlib/Services/oEmbed/Object/Video.php
@@ -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
index 000000000..9e1c97b3b
--- /dev/null
+++ b/extlib/Stomp.php
@@ -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
index 000000000..e6870bc15
--- /dev/null
+++ b/extlib/Stomp/Exception.php
@@ -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 $
+ */
+class Stomp_Exception extends Exception
+{
+ 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;
+ }
+}
+?> \ No newline at end of file
diff --git a/extlib/Stomp/Frame.php b/extlib/Stomp/Frame.php
new file mode 100644
index 000000000..dc59c1cb7
--- /dev/null
+++ b/extlib/Stomp/Frame.php
@@ -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: */
+
+/**
+ * Stomp Frames are messages that are sent and received on a StompConnection.
+ *
+ * @package Stomp
+ * @author Hiram Chirino <hiram@hiramchirino.com>
+ * @author Dejan Bosanac <dejan@nighttale.net>
+ * @author Michael Caplan <mcaplan@labnet.net>
+ * @version $Revision: 36 $
+ */
+class Stomp_Frame
+{
+ public $command;
+ public $headers = array();
+ public $body;
+
+ /**
+ * Constructor
+ *
+ * @param string $command
+ * @param array $headers
+ * @param string $body
+ */
+ public function __construct ($command = null, $headers = null, $body = null)
+ {
+ $this->_init($command, $headers, $body);
+ }
+
+ protected function _init ($command = null, $headers = null, $body = null)
+ {
+ $this->command = $command;
+ if ($headers != null) {
+ $this->headers = $headers;
+ }
+ $this->body = $body;
+
+ if ($this->command == 'ERROR') {
+ require_once 'Stomp/Exception.php';
+ throw new Stomp_Exception($this->headers['message'], 0, $this->body);
+ }
+ }
+
+ /**
+ * 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";
+ }
+}
+?> \ No newline at end of file
diff --git a/extlib/Stomp/Message.php b/extlib/Stomp/Message.php
new file mode 100644
index 000000000..6bcad3efd
--- /dev/null
+++ b/extlib/Stomp/Message.php
@@ -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
index 000000000..c75f23e43
--- /dev/null
+++ b/extlib/Stomp/Message/Bytes.php
@@ -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
index 000000000..288456a84
--- /dev/null
+++ b/extlib/Stomp/Message/Map.php
@@ -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
diff --git a/extlib/Validate.php b/extlib/Validate.php
index 4c05506b3..3d8bc23f2 100644
--- a/extlib/Validate.php
+++ b/extlib/Validate.php
@@ -1,1051 +1,1116 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | 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> |
-// +----------------------------------------------------------------------+
-//
-/**
- * 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, 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.123 2007/12/12 16:45:51 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 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 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)
- {
- if (Validate::__stringToUtf7($email) != $email) {
- return false;
- }
- 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.
- *
- * @access protected
- * @param string $email The email address to check.
- * @param array $options The options for validation
- * @return bool True if validating succeeds
- */
- function _fullTLDValidation($email, $options)
- {
- $validate = array();
-
- switch ($options) {
- /** 1 */
- case VALIDATE_ITLD_EMAILS:
- array_push($validate, 'itld');
- break;
-
- /** 2 */
- case VALIDATE_GTLD_EMAILS:
- array_push($validate, 'gtld');
- break;
-
- /** 3 */
- case VALIDATE_ITLD_EMAILS | VALIDATE_GTLD_EMAILS:
- array_push($validate, 'itld');
- array_push($validate, 'gtld');
- break;
-
- /** 4 */
- case VALIDATE_CCTLD_EMAILS:
- array_push($validate, 'cctld');
- break;
-
- /** 5 */
- case VALIDATE_CCTLD_EMAILS | VALIDATE_ITLD_EMAILS:
- array_push($validate, 'cctld');
- array_push($validate, 'itld');
- break;
-
- /** 6 */
- case VALIDATE_CCTLD_EMAILS ^ VALIDATE_ITLD_EMAILS:
- array_push($validate, 'cctld');
- array_push($validate, 'itld');
- break;
-
- /** 7 - 8 */
- case VALIDATE_CCTLD_EMAILS | VALIDATE_ITLD_EMAILS | VALIDATE_GTLD_EMAILS:
- case VALIDATE_ALL_EMAILS:
- array_push($validate, 'cctld');
- array_push($validate, 'itld');
- array_push($validate, 'gtld');
- break;
- }
-
- /**
- * Debugging still, not implemented but code is somewhat here.
- */
-
- $self = new Validate;
-
- $toValidate = array();
-
- foreach ($validate as $valid) {
- $tmpVar = '_' . (string)$valid;
- $toValidate[$valid] = $self->{$tmpVar};
- }
-
- $e = $self->executeFullEmailValidation($email, $toValidate);
-
- return $e;
- }
- // {{{ protected function executeFullEmailValidation
- /**
- * Execute the validation
- *
- * This function will execute the full email vs tld
- * validation using an array of tlds passed to it.
- *
- * @access public
- * @param string $email The email to validate.
- * @param array $arrayOfTLDs The array of the TLDs to validate
- * @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
- *
- * @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);
- }
-
- /**
- * @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);
-
- 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';
-
- if ($use_rfc822? Validate::__emailRFC822($email, $options) :
- preg_match($regex, $email)) {
- if ($check_domain && function_exists('checkdnsrr')) {
- list (, $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 = $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 (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 = $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;
- }
-
- 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
- *
- * @returns int returns product of number digits with weights
- *
- * @access protected
- */
- 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
- *
- * @returns int -1 calculated control number is returned
- *
- * @access protected
- */
- 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 (optionsl) number
- * @param int $subtract (optional) numbier
- *
- * @returns bool true if valid, false if not
- *
- * @access protected
- */
- 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;
- }
-}
-
+<?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;
+ }
+}
+
diff --git a/install.php b/install.php
index 87a99a650..66e8e8712 100644
--- a/install.php
+++ b/install.php
@@ -52,23 +52,21 @@ function checkPrereqs()
foreach ($reqs as $req) {
if (!checkExtension($req)) {
- ?><p class="error">Cannot load required extension &quot;<?php echo $req; ?>&quot;.</p><?php
+ ?><p class="error">Cannot load required extension: <code><?php echo $req; ?></code></p><?php
return 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;
}
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;
}
@@ -89,65 +87,78 @@ 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>
+ </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>
+ <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>
-<?
+<?php
}
function updateStatus($status, $error=false)
{
?>
- <li>
-<?
- print $status;
-?>
- </li>
-<?
+ <li <?php echo ($error) ? 'class="error"': ''; ?>><?print $status;?></li>
+
+<?php
}
function handlePost()
{
?>
- <ul>
-<?
+
+<?php
$host = $_POST['host'];
$database = $_POST['database'];
$username = $_POST['username'];
$password = $_POST['password'];
$sitename = $_POST['sitename'];
-
+?>
+ <dl class="system_notice">
+ <dt>Page notice</dt>
+ <dd>
+ <ul>
+<?php
if (empty($host)) {
updateStatus("No hostname specified.", true);
showForm();
@@ -222,8 +233,8 @@ function handlePost()
}
updateStatus("Done!");
?>
- </ul>
-<?
+
+<?php
}
function writeConf($sitename, $sqlUrl)
@@ -253,21 +264,35 @@ 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="stylesheet" type="text/css" href="theme/base/css/display.css?version=0.8" media="screen, projection, tv"/>
+ <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/earthy/css/ie.css?version=0.8" /><![endif]-->
+ </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
index 000000000..5a3cc209a
--- /dev/null
+++ b/js/farbtastic/LICENSE.txt
@@ -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
index 000000000..21a1530bc
--- /dev/null
+++ b/js/farbtastic/farbtastic.go.js
@@ -0,0 +1,10 @@
+$(document).ready(function() {
+ var f = $.farbtastic('#color-picker');
+ var colors = $('#settings_design_color input');
+
+ colors
+ .each(function () { f.linkTo(this); })
+ .focus(function() {
+ f.linkTo(this);
+ });
+});
diff --git a/js/farbtastic/farbtastic.js b/js/farbtastic/farbtastic.js
new file mode 100644
index 000000000..24a377803
--- /dev/null
+++ b/js/farbtastic/farbtastic.js
@@ -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
index 000000000..3929bbb51
--- /dev/null
+++ b/js/farbtastic/marker.png
Binary files differ
diff --git a/js/farbtastic/mask.png b/js/farbtastic/mask.png
new file mode 100644
index 000000000..b0a4d406f
--- /dev/null
+++ b/js/farbtastic/mask.png
Binary files differ
diff --git a/js/farbtastic/wheel.png b/js/farbtastic/wheel.png
new file mode 100644
index 000000000..97b343d98
--- /dev/null
+++ b/js/farbtastic/wheel.png
Binary files differ
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
index 46090b8c1..86800d2a3 100644
--- a/lib/accountsettingsaction.php
+++ b/lib/accountsettingsaction.php
@@ -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')));
diff --git a/lib/action.php b/lib/action.php
index 2ec9329e0..3e43ffe3e 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -858,10 +858,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/common.php b/lib/common.php
index f983c4d16..00e5b0bc2 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -71,6 +71,7 @@ $config =
array('name' => 'Just another Laconica microblog',
'server' => $_server,
'theme' => 'default',
+ 'skin' => 'default',
'path' => $_path,
'logfile' => null,
'logo' => null,
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 4182d8808..8fccba73e 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -197,7 +197,7 @@ class NoticeListItem extends Widget
$this->out->elementStart('div', 'entry-content');
$this->showNoticeLink();
$this->showNoticeSource();
- $this->showReplyTo();
+ $this->showContext();
$this->out->elementEnd('div');
}
@@ -421,17 +421,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');
}
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index fde650d9e..f76f16e07 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -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);
}
}
+
diff --git a/lib/router.php b/lib/router.php
index 12590b790..9308c818a 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -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'));
}
@@ -165,6 +165,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',
diff --git a/lib/theme.php b/lib/theme.php
index 95030affe..bef660cbf 100644
--- a/lib/theme.php
+++ b/lib/theme.php
@@ -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);
+ }
+}
+
diff --git a/lib/twitter.php b/lib/twitter.php
index ccc6c93ca..c1d0dc254 100644
--- a/lib/twitter.php
+++ b/lib/twitter.php
@@ -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) ||
diff --git a/lib/util.php b/lib/util.php
index f862d7fcc..198185338 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -879,34 +879,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 +1157,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/scripts/statusfetcher.php b/scripts/statusfetcher.php
new file mode 100644
index 000000000..8f4b60cf7
--- /dev/null
+++ b/scripts/statusfetcher.php
@@ -0,0 +1,525 @@
+#!/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);
+
+// Uncomment this to get useful console output
+define('SCRIPT_DEBUG', true);
+
+require_once(INSTALLDIR . '/lib/common.php');
+
+$children = array();
+$flink_ids = null;
+
+$MAXCHILDREN = 5;
+$POLL_INTERVAL = 10; // 10 seconds
+
+do {
+
+ $flink = new Foreign_link();
+ $flink->service = 1; // Twitter
+ $cnt = $flink->find();
+
+ if (defined('SCRIPT_DEBUG')) {
+ print "Updating Twitter friends subscriptions for $cnt users.\n";
+ }
+
+ $flink_ids = array();
+
+ // XXX: This only reliably happens once. After the first interation of
+ // the do loop, the ->find() doesn't work ... lost DB connection?
+
+ while ($flink->fetch()) {
+
+ if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) {
+ $flink_ids[] = $flink->foreign_id;
+ }
+ }
+
+ $flink->free();
+ unset($flink);
+
+ foreach ($flink_ids as $f){
+
+ $pid = pcntl_fork();
+
+ if ($pid == -1) {
+ die ("Couldn't fork!");
+ }
+
+ // Parent
+ if ($pid) {
+ if (defined('SCRIPT_DEBUG')) {
+ print "Parent: forked " . $pid . "\n";
+ }
+ $children[] = $pid;
+ } else {
+
+ // Child
+
+ // XXX: Each child needs its own DB connection
+
+ getTimeline($f);
+ exit();
+ }
+
+ // Remove child from ps list as it finishes
+ while(($c = pcntl_wait($status, WNOHANG OR WUNTRACED)) > 0) {
+ if (defined('SCRIPT_DEBUG')) {
+ print "Child $c finished.\n";
+ }
+ remove_ps($children, $c);
+ }
+
+ // Wait if we have too many kids
+ if(sizeof($children) > $MAXCHILDREN) {
+ if (defined('SCRIPT_DEBUG')) {
+ print "Too many children. Waiting...\n";
+ }
+ if( ($c = pcntl_wait($status, WUNTRACED) ) > 0){
+ if (defined('SCRIPT_DEBUG')) {
+ print "Finished waiting for $c\n";
+ }
+ remove_ps($children, $c);
+ }
+ }
+ }
+
+ // Remove all children from the process list before restarting
+ while(($c = pcntl_wait($status, WUNTRACED)) > 0) {
+ if (defined('SCRIPT_DEBUG')) {
+ print "Child $c finished.\n";
+ }
+ remove_ps($children, $c);
+ }
+
+ // Rest for a bit before we fetch more statuses
+ if (defined('SCRIPT_DEBUG')) {
+ print "Waiting $POLL_INTERVAL secs before hitting Twitter again.\n";
+ }
+
+ sleep($POLL_INTERVAL);
+
+} while (true);
+
+
+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($fid)
+{
+
+ // XXX: Need to reconnect to the DB here?
+
+ $flink = Foreign_link::getByForeignID($fid, 1);
+ $fuser = $flink->getForeignUser();
+
+ if (empty($fuser)) {
+ common_log(LOG_WARNING, "Unmatched user for ID " . $flink->user_id);
+ if (defined('SCRIPT_DEBUG')) {
+ print "Unmatched user for ID $flink->user_id\n";
+ }
+ }
+
+ $screenname = $fuser->nickname;
+
+ $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.");
+ if (defined('SCRIPT_DEBUG')) {
+ print "Empty timeline!\n";
+ }
+ return;
+ }
+
+ foreach ($timeline as $status) {
+
+ // Hacktastic: filter out stuff coming from Laconica
+ $source = mb_strtolower(common_config('integration', 'source'));
+
+ if (preg_match("/$source/", mb_strtolower($status->source))) {
+ continue;
+ }
+
+ saveStatus($status, $flink);
+ }
+
+}
+
+function saveStatus($status, $flink)
+{
+ // Do we have a profile for this Twitter user?
+
+ $id = ensureProfile($status->user);
+ $profile = Profile::staticGet($id);
+
+ if (!$profile) {
+ common_log(LOG_ERR, 'Problem saving notice. No associated Profile.');
+ if (defined('SCRIPT_DEBUG')) {
+ print "Problem saving notice. No associated Profile.\n";
+ }
+ return null;
+ }
+
+ $uri = 'http://twitter.com/' . $status->user->screen_name .
+ '/status/' . $status->id;
+
+ // Skip save if notice source is Laconica or Identi.ca?
+
+ $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')) {
+ print "Could not save notice!\n";
+ }
+ }
+
+ // XXX: Figure out a better way to link replies?
+ $notice->saveReplies();
+
+ // XXX: Do we want to polute our tag cloud with hashtags from Twitter?
+ $notice->saveTags();
+ $notice->saveGroups();
+
+ $notice->query('COMMIT');
+
+ }
+
+ 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) {
+ common_debug("Profile for $profile->nickname found.");
+
+ // Check to see if the user's Avatar has changed
+ checkAvatar($user, $profile);
+ return $profile->id;
+
+ } else {
+ $debugmsg = 'Adding profile and remote profile ' .
+ "for Twitter user: $profileurl\n";
+ common_debug($debugmsg, __FILE__);
+ if (defined('SCRIPT_DEBUG')) {
+ print $debugmsg;
+ }
+
+ $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__);
+ if (defined('SCRIPT_DEBUG')) {
+ print 'Could not insert Profile: ' .
+ common_log_objstring($profile) . "\n";
+ }
+ $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__);
+ if (defined('SCRIPT_DEBUG')) {
+ print 'Could not insert Remote_profile: ' .
+ common_log_objstring($remote_pro) . "\n";
+ }
+ $profile->query("ROLLBACK");
+ return false;
+ }
+ }
+
+ $profile->query("COMMIT");
+ $profile->free();
+ unset($profile);
+
+ saveAvatars($user, $id);
+
+ return $id;
+ }
+}
+
+function checkAvatar($user, $profile)
+{
+ $path_parts = pathinfo($user->profile_image_url);
+ $newname = 'Twitter_' . $user->id . '_' .
+ $path_parts['basename'];
+
+ $oldname = $profile->getAvatar(48)->filename;
+
+ if ($newname != $oldname) {
+
+ common_debug("Avatar for Twitter user $profile->nickname has changed.");
+ common_debug("old: $oldname new: $newname");
+
+ if (defined('SCRIPT_DEBUG')) {
+ print "Avatar for Twitter user $user->id has changed.\n";
+ print "old: $oldname\n";
+ print "new: $newname\n";
+ }
+
+ $img_root = substr($path_parts['basename'], 0, -11);
+ $ext = $path_parts['extension'];
+ $mediatype = 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 (fetchAvatar($url, $filename)) {
+ 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)
+{
+ $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 = 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 (fetchAvatar($url, $filename)) {
+ newAvatar($id, $size, $mediatype, $filename);
+ } else {
+ common_log(LOG_WARNING, "Problem fetching Avatar: $url", __FILE__);
+ if (defined('SCRIPT_DEBUG')) {
+ print "Problem fetching Avatar: $url\n";
+ }
+ }
+ }
+}
+
+function updateAvatar($profile_id, $size, $mediatype, $filename) {
+
+ common_debug("updating avatar: $size");
+
+ $profile = Profile::staticGet($profile_id);
+
+ if (!$profile) {
+ common_debug("Couldn't get profile: $profile_id!");
+ if (defined('SCRIPT_DEBUG')) {
+ print "Couldn't get profile: $profile_id!\n";
+ }
+ return;
+ }
+
+ $sizes = array('mini' => 24, 'normal' => 48, 'bigger' => 73);
+ $avatar = $profile->getAvatar($sizes[$size]);
+
+ if ($avatar) {
+ common_debug("Deleting $size avatar for $profile->nickname.");
+ @unlink(INSTALLDIR . '/avatar/' . $avatar->filename);
+ $avatar->delete();
+ }
+
+ newAvatar($profile->id, $size, $mediatype, $filename);
+}
+
+function newAvatar($profile_id, $size, $mediatype, $filename)
+{
+ $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);
+
+ common_debug("new filename: $avatar->url");
+
+ $avatar->created = common_sql_now();
+
+ $id = $avatar->insert();
+
+ if (!$id) {
+ common_log_db_error($avatar, 'INSERT', __FILE__);
+ if (defined('SCRIPT_DEBUG')) {
+ print "Could not insert avatar!\n";
+ }
+
+ return null;
+ }
+
+ 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__);
+ if (defined('SCRIPT_DEBUG')) {
+ print "Couldn't open file! $filename\n";
+ }
+ return false;
+ }
+
+ common_debug("Fetching avatar: $url", __FILE__);
+ if (defined('SCRIPT_DEBUG')) {
+ print "Fetching avatar from Twitter: $url\n";
+ }
+
+ $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;
+}
diff --git a/theme/base/css/display.css b/theme/base/css/display.css
index dc6b4bc29..efa5f4ac6 100644
--- a/theme/base/css/display.css
+++ b/theme/base/css/display.css
@@ -727,7 +727,7 @@ clear:both;
float:left;
width:100%;
border-top-width:1px;
-border-top-style:dashed;
+border-top-style:dotted;
}
.notices li {
list-style-type:none;
@@ -1145,6 +1145,18 @@ 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;
+}
+
+.instructions ul {
+list-style-position:inside;
+}
.instructions p,
.instructions ul {
margin-bottom:18px;
diff --git a/theme/base/css/farbtastic.css b/theme/base/css/farbtastic.css
new file mode 100644
index 000000000..7efcc73c3
--- /dev/null
+++ b/theme/base/css/farbtastic.css
@@ -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
index 000000000..38b8692b4
--- /dev/null
+++ b/theme/base/default-avatar-mini.png
Binary files differ
diff --git a/theme/base/default-avatar-profile.png b/theme/base/default-avatar-profile.png
new file mode 100644
index 000000000..f8357d4fc
--- /dev/null
+++ b/theme/base/default-avatar-profile.png
Binary files differ
diff --git a/theme/base/default-avatar-stream.png b/theme/base/default-avatar-stream.png
new file mode 100644
index 000000000..6b63baa70
--- /dev/null
+++ b/theme/base/default-avatar-stream.png
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/arrow-left.gif b/theme/base/images/icons/twotone/green/arrow-left.gif
index afed19084..afed19084 100644
--- a/theme/default/images/icons/twotone/green/arrow-left.gif
+++ b/theme/base/images/icons/twotone/green/arrow-left.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/arrow-right.gif b/theme/base/images/icons/twotone/green/arrow-right.gif
index ee1707ed9..ee1707ed9 100644
--- a/theme/default/images/icons/twotone/green/arrow-right.gif
+++ b/theme/base/images/icons/twotone/green/arrow-right.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/disfavourite.gif b/theme/base/images/icons/twotone/green/disfavourite.gif
index 3946869ae..3946869ae 100644
--- a/theme/default/images/icons/twotone/green/disfavourite.gif
+++ b/theme/base/images/icons/twotone/green/disfavourite.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/edit.gif b/theme/base/images/icons/twotone/green/edit.gif
index c746aca60..c746aca60 100644
--- a/theme/default/images/icons/twotone/green/edit.gif
+++ b/theme/base/images/icons/twotone/green/edit.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/favourite.gif b/theme/base/images/icons/twotone/green/favourite.gif
index d93515e37..d93515e37 100644
--- a/theme/default/images/icons/twotone/green/favourite.gif
+++ b/theme/base/images/icons/twotone/green/favourite.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/mail.gif b/theme/base/images/icons/twotone/green/mail.gif
index 1084c862f..1084c862f 100644
--- a/theme/default/images/icons/twotone/green/mail.gif
+++ b/theme/base/images/icons/twotone/green/mail.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/news.gif b/theme/base/images/icons/twotone/green/news.gif
index 712c685dc..712c685dc 100644
--- a/theme/default/images/icons/twotone/green/news.gif
+++ b/theme/base/images/icons/twotone/green/news.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/quote.gif b/theme/base/images/icons/twotone/green/quote.gif
index 4ba1f0c03..4ba1f0c03 100644
--- a/theme/default/images/icons/twotone/green/quote.gif
+++ b/theme/base/images/icons/twotone/green/quote.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/reply.gif b/theme/base/images/icons/twotone/green/reply.gif
index 6ff01bb35..6ff01bb35 100644
--- a/theme/default/images/icons/twotone/green/reply.gif
+++ b/theme/base/images/icons/twotone/green/reply.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/shield.gif b/theme/base/images/icons/twotone/green/shield.gif
index 419d5ee4b..419d5ee4b 100644
--- a/theme/default/images/icons/twotone/green/shield.gif
+++ b/theme/base/images/icons/twotone/green/shield.gif
Binary files differ
diff --git a/theme/default/images/icons/twotone/green/trash.gif b/theme/base/images/icons/twotone/green/trash.gif
index 78dd64a3d..78dd64a3d 100644
--- a/theme/default/images/icons/twotone/green/trash.gif
+++ b/theme/base/images/icons/twotone/green/trash.gif
Binary files differ
diff --git a/theme/base/logo.png b/theme/base/logo.png
new file mode 100644
index 000000000..7c68b34f6
--- /dev/null
+++ b/theme/base/logo.png
Binary files differ
diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css
new file mode 100644
index 000000000..b87722eec
--- /dev/null
+++ b/theme/cloudy/css/display.css
@@ -0,0 +1,1550 @@
+/** 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; height:100%; }
+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:145px;
+}
+
+.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-secondary {
+margin-left:29px;
+padding:0;
+}
+
+#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-secondary {
+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-secondary {
+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
index 000000000..095122100
--- /dev/null
+++ b/theme/cloudy/css/ie.css
@@ -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
index 000000000..c0f1d411f
--- /dev/null
+++ b/theme/cloudy/default-avatar-mini.png
Binary files differ
diff --git a/theme/cloudy/default-avatar-profile.png b/theme/cloudy/default-avatar-profile.png
new file mode 100644
index 000000000..9f281f94f
--- /dev/null
+++ b/theme/cloudy/default-avatar-profile.png
Binary files differ
diff --git a/theme/cloudy/default-avatar-stream.png b/theme/cloudy/default-avatar-stream.png
new file mode 100644
index 000000000..8d505871c
--- /dev/null
+++ b/theme/cloudy/default-avatar-stream.png
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_atom.png b/theme/cloudy/images/icons/icon_atom.png
new file mode 100644
index 000000000..6a001f11a
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_atom.png
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_disfavourite.gif b/theme/cloudy/images/icons/icon_disfavourite.gif
new file mode 100644
index 000000000..2b02ac8a6
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_disfavourite.gif
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_favourite.gif b/theme/cloudy/images/icons/icon_favourite.gif
new file mode 100644
index 000000000..716ce3549
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_favourite.gif
Binary files differ
diff --git a/theme/default/images/icons/icon_foaf.gif b/theme/cloudy/images/icons/icon_foaf.gif
index f8f784423..f8f784423 100644
--- a/theme/default/images/icons/icon_foaf.gif
+++ b/theme/cloudy/images/icons/icon_foaf.gif
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_processing.gif b/theme/cloudy/images/icons/icon_processing.gif
new file mode 100644
index 000000000..d0bce1542
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_processing.gif
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_reply.gif b/theme/cloudy/images/icons/icon_reply.gif
new file mode 100644
index 000000000..a4379a70b
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_reply.gif
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_rss.png b/theme/cloudy/images/icons/icon_rss.png
new file mode 100644
index 000000000..0ccd1ce25
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_rss.png
Binary files differ
diff --git a/theme/cloudy/images/icons/icon_trash.gif b/theme/cloudy/images/icons/icon_trash.gif
new file mode 100644
index 000000000..916a332a3
--- /dev/null
+++ b/theme/cloudy/images/icons/icon_trash.gif
Binary files differ
diff --git a/theme/default/images/icons/icon_vcard.gif b/theme/cloudy/images/icons/icon_vcard.gif
index 6d52947f3..6d52947f3 100644
--- a/theme/default/images/icons/icon_vcard.gif
+++ b/theme/cloudy/images/icons/icon_vcard.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-left.gif b/theme/cloudy/images/icons/twotone/green/arrow-left.gif
index afed19084..afed19084 100644
--- a/theme/identica/images/icons/twotone/green/arrow-left.gif
+++ b/theme/cloudy/images/icons/twotone/green/arrow-left.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-right.gif b/theme/cloudy/images/icons/twotone/green/arrow-right.gif
index ee1707ed9..ee1707ed9 100644
--- a/theme/identica/images/icons/twotone/green/arrow-right.gif
+++ b/theme/cloudy/images/icons/twotone/green/arrow-right.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/edit.gif b/theme/cloudy/images/icons/twotone/green/edit.gif
index c746aca60..c746aca60 100644
--- a/theme/identica/images/icons/twotone/green/edit.gif
+++ b/theme/cloudy/images/icons/twotone/green/edit.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/mail.gif b/theme/cloudy/images/icons/twotone/green/mail.gif
index 1084c862f..1084c862f 100644
--- a/theme/identica/images/icons/twotone/green/mail.gif
+++ b/theme/cloudy/images/icons/twotone/green/mail.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/news.gif b/theme/cloudy/images/icons/twotone/green/news.gif
index 712c685dc..712c685dc 100644
--- a/theme/identica/images/icons/twotone/green/news.gif
+++ b/theme/cloudy/images/icons/twotone/green/news.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/quote.gif b/theme/cloudy/images/icons/twotone/green/quote.gif
index 4ba1f0c03..4ba1f0c03 100644
--- a/theme/identica/images/icons/twotone/green/quote.gif
+++ b/theme/cloudy/images/icons/twotone/green/quote.gif
Binary files differ
diff --git a/theme/identica/images/icons/twotone/green/shield.gif b/theme/cloudy/images/icons/twotone/green/shield.gif
index 419d5ee4b..419d5ee4b 100644
--- a/theme/identica/images/icons/twotone/green/shield.gif
+++ b/theme/cloudy/images/icons/twotone/green/shield.gif
Binary files 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
index 000000000..577be1871
--- /dev/null
+++ b/theme/cloudy/images/illustrations/illu_arrow-up-01.gif
Binary files 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
index 000000000..41cd622cf
--- /dev/null
+++ b/theme/cloudy/images/illustrations/illu_clouds-01.gif
Binary files differ
diff --git a/theme/cloudy/images/illustrations/illu_jcrop.gif b/theme/cloudy/images/illustrations/illu_jcrop.gif
new file mode 100644
index 000000000..72ea7ccb5
--- /dev/null
+++ b/theme/cloudy/images/illustrations/illu_jcrop.gif
Binary files 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
index 000000000..82290f483
--- /dev/null
+++ b/theme/cloudy/images/illustrations/illu_progress_loading-01.gif
Binary files 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
index 000000000..6cb51b298
--- /dev/null
+++ b/theme/cloudy/images/illustrations/illu_unicorn-01.png
Binary files differ
diff --git a/theme/cloudy/logo.png b/theme/cloudy/logo.png
new file mode 100644
index 000000000..7c68b34f6
--- /dev/null
+++ b/theme/cloudy/logo.png
Binary files differ
diff --git a/theme/default/css/display.css b/theme/default/css/display.css
index 69a600cc2..1fc99eff7 100644
--- a/theme/default/css/display.css
+++ b/theme/default/css/display.css
@@ -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,7 +30,7 @@ input, textarea, select,
border-color:#aaa;
}
#filter_tags ul li {
-border-color:#97BFD1;
+border-color:#C3D6DF;
}
.form_settings input.form_action-secondary {
@@ -69,7 +69,7 @@ color:#002E6E;
border-top-color:#D1D9E4;
}
.section .profile {
-border-top-color:#97BFD1;
+border-top-color:#C3D6DF;
}
#content .notice p.entry-content a:visited {
@@ -120,7 +120,7 @@ background-color:#EFF3DC;
}
#anon_notice {
-background-color:#97BFD1;
+background-color:#C3D6DF;
color:#fff;
border-color:#fff;
}
@@ -163,22 +163,22 @@ 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 */
@@ -191,16 +191,16 @@ background-color:#fcfcfc;
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,
@@ -224,7 +224,7 @@ background-color:#fcfcfc;
/*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 +233,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
index 22853edc4..000000000
--- a/theme/default/images/icons/icon_atom.jpg
+++ /dev/null
Binary files differ
diff --git a/theme/default/images/icons/icon_rss.jpg b/theme/default/images/icons/icon_rss.jpg
deleted file mode 100644
index da23422d0..000000000
--- a/theme/default/images/icons/icon_rss.jpg
+++ /dev/null
Binary files 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
index ca796c8a3..000000000
--- a/theme/default/images/icons/twotone/green/against.gif
+++ /dev/null
Binary files 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
index c709e5877..000000000
--- a/theme/default/images/icons/twotone/green/arrow-down.gif
+++ /dev/null
Binary files 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
index a4a98035d..000000000
--- a/theme/default/images/icons/twotone/green/arrow-downleft.gif
+++ /dev/null
Binary files 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
index 3e6001a61..000000000
--- a/theme/default/images/icons/twotone/green/arrow-downright.gif
+++ /dev/null
Binary files 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
index d0f5fbeaa..000000000
--- a/theme/default/images/icons/twotone/green/arrow-up.gif
+++ /dev/null
Binary files 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
index 1e9e6935b..000000000
--- a/theme/default/images/icons/twotone/green/arrow-upleft.gif
+++ /dev/null
Binary files 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
index c7fecc8a0..000000000
--- a/theme/default/images/icons/twotone/green/arrow-upright.gif
+++ /dev/null
Binary files 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
index 33a9540c8..000000000
--- a/theme/default/images/icons/twotone/green/back-forth.gif
+++ /dev/null
Binary files 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
index 23f318ecc..000000000
--- a/theme/default/images/icons/twotone/green/bookmark.gif
+++ /dev/null
Binary files 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
index f70652c03..000000000
--- a/theme/default/images/icons/twotone/green/bulb.gif
+++ /dev/null
Binary files 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
index a09b65aca..000000000
--- a/theme/default/images/icons/twotone/green/calendar.gif
+++ /dev/null
Binary files 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
index 7884b02dd..000000000
--- a/theme/default/images/icons/twotone/green/calendar2.gif
+++ /dev/null
Binary files 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
index 1a85fbad0..000000000
--- a/theme/default/images/icons/twotone/green/camera.gif
+++ /dev/null
Binary files 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
index 47eaa0a2e..000000000
--- a/theme/default/images/icons/twotone/green/cart.gif
+++ /dev/null
Binary files 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
index 3ad2c322b..000000000
--- a/theme/default/images/icons/twotone/green/caution.gif
+++ /dev/null
Binary files 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
index 136d74517..000000000
--- a/theme/default/images/icons/twotone/green/chart.gif
+++ /dev/null
Binary files 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
index 892429d48..000000000
--- a/theme/default/images/icons/twotone/green/checkmark.gif
+++ /dev/null
Binary files 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
index 9317bdcd0..000000000
--- a/theme/default/images/icons/twotone/green/clipboard.gif
+++ /dev/null
Binary files 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
index d1410f925..000000000
--- a/theme/default/images/icons/twotone/green/clock.gif
+++ /dev/null
Binary files 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
index 0410fc6e8..000000000
--- a/theme/default/images/icons/twotone/green/closed-folder.gif
+++ /dev/null
Binary files 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
index 29ce02492..000000000
--- a/theme/default/images/icons/twotone/green/database.gif
+++ /dev/null
Binary files 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
index e970b0a30..000000000
--- a/theme/default/images/icons/twotone/green/diskette.gif
+++ /dev/null
Binary files 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
index 9c08f4a3a..000000000
--- a/theme/default/images/icons/twotone/green/document.gif
+++ /dev/null
Binary files 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
index 2e8648264..000000000
--- a/theme/default/images/icons/twotone/green/double-arrow.gif
+++ /dev/null
Binary files 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
index 7e0906cfe..000000000
--- a/theme/default/images/icons/twotone/green/eject.gif
+++ /dev/null
Binary files 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
index 588e28c26..000000000
--- a/theme/default/images/icons/twotone/green/exclaim.gif
+++ /dev/null
Binary files 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
index 28e495103..000000000
--- a/theme/default/images/icons/twotone/green/fastforward.gif
+++ /dev/null
Binary files 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
index 68c8aee25..000000000
--- a/theme/default/images/icons/twotone/green/flag.gif
+++ /dev/null
Binary files 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
index 0c1794b4e..000000000
--- a/theme/default/images/icons/twotone/green/graph.gif
+++ /dev/null
Binary files 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
index c4118d53b..000000000
--- a/theme/default/images/icons/twotone/green/grow.gif
+++ /dev/null
Binary files 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
index 5be6c67dd..000000000
--- a/theme/default/images/icons/twotone/green/headphones.gif
+++ /dev/null
Binary files 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
index d2a3421ef..000000000
--- a/theme/default/images/icons/twotone/green/home.gif
+++ /dev/null
Binary files 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
index b62b9480c..000000000
--- a/theme/default/images/icons/twotone/green/hourglass.gif
+++ /dev/null
Binary files 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
index 86ef1f8b4..000000000
--- a/theme/default/images/icons/twotone/green/info.gif
+++ /dev/null
Binary files 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
index ccf357ab2..000000000
--- a/theme/default/images/icons/twotone/green/key.gif
+++ /dev/null
Binary files 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
index db00706b5..000000000
--- a/theme/default/images/icons/twotone/green/lock.gif
+++ /dev/null
Binary files 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
index d2c30b1d2..000000000
--- a/theme/default/images/icons/twotone/green/move.gif
+++ /dev/null
Binary files 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
index 64b51d4e1..000000000
--- a/theme/default/images/icons/twotone/green/music.gif
+++ /dev/null
Binary files 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
index bcc0b149b..000000000
--- a/theme/default/images/icons/twotone/green/note.gif
+++ /dev/null
Binary files 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
index d41300a08..000000000
--- a/theme/default/images/icons/twotone/green/open-folder.gif
+++ /dev/null
Binary files 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
index 1d45f1d1e..000000000
--- a/theme/default/images/icons/twotone/green/paper-clip.gif
+++ /dev/null
Binary files 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
index a8c7805be..000000000
--- a/theme/default/images/icons/twotone/green/paper-clip2.gif
+++ /dev/null
Binary files 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
index ced0b6440..000000000
--- a/theme/default/images/icons/twotone/green/pause.gif
+++ /dev/null
Binary files 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
index 69359f764..000000000
--- a/theme/default/images/icons/twotone/green/phone.gif
+++ /dev/null
Binary files 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
index 794ec85b6..000000000
--- a/theme/default/images/icons/twotone/green/play.gif
+++ /dev/null
Binary files 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
index 4407d0b2d..000000000
--- a/theme/default/images/icons/twotone/green/plus.gif
+++ /dev/null
Binary files 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
index 17727d5d7..000000000
--- a/theme/default/images/icons/twotone/green/print.gif
+++ /dev/null
Binary files 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
index 1689efcd0..000000000
--- a/theme/default/images/icons/twotone/green/question-mark.gif
+++ /dev/null
Binary files 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
index 8a8b8144f..000000000
--- a/theme/default/images/icons/twotone/green/refresh.gif
+++ /dev/null
Binary files 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
index aca3ee35b..000000000
--- a/theme/default/images/icons/twotone/green/rewind.gif
+++ /dev/null
Binary files 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
index c36463d0d..000000000
--- a/theme/default/images/icons/twotone/green/search.gif
+++ /dev/null
Binary files 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
index adca7aa3e..000000000
--- a/theme/default/images/icons/twotone/green/skip-back.gif
+++ /dev/null
Binary files 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
index ae5417f2f..000000000
--- a/theme/default/images/icons/twotone/green/skip.gif
+++ /dev/null
Binary files 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
index 033506732..000000000
--- a/theme/default/images/icons/twotone/green/skull.gif
+++ /dev/null
Binary files 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
index 47d61b106..000000000
--- a/theme/default/images/icons/twotone/green/statusbar.gif
+++ /dev/null
Binary files 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
index e0b108d35..000000000
--- a/theme/default/images/icons/twotone/green/stop.gif
+++ /dev/null
Binary files 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
index 65c0c4a0a..000000000
--- a/theme/default/images/icons/twotone/green/template.gif
+++ /dev/null
Binary files 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
index 45e143b7a..000000000
--- a/theme/default/images/icons/twotone/green/text-bigger.gif
+++ /dev/null
Binary files 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
index a54d0c1d3..000000000
--- a/theme/default/images/icons/twotone/green/text-smaller.gif
+++ /dev/null
Binary files 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
index 97e54b964..000000000
--- a/theme/default/images/icons/twotone/green/two-docs.gif
+++ /dev/null
Binary files 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
index 45aad25c4..000000000
--- a/theme/default/images/icons/twotone/green/twotone.gif
+++ /dev/null
Binary files 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
index 6869b3050..000000000
--- a/theme/default/images/icons/twotone/green/undo.gif
+++ /dev/null
Binary files 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
index c85460fcd..000000000
--- a/theme/default/images/icons/twotone/green/user.gif
+++ /dev/null
Binary files 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
index 4d421c1bb..000000000
--- a/theme/default/images/icons/twotone/green/vegetable.gif
+++ /dev/null
Binary files 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
index ffb2efea0..000000000
--- a/theme/default/images/icons/twotone/green/x.gif
+++ /dev/null
Binary files 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
index a59a5bb50..000000000
--- a/theme/default/images/icons/twotone/green/zoom-in.gif
+++ /dev/null
Binary files 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
index c61f999fd..000000000
--- a/theme/default/images/icons/twotone/green/zoom-out.gif
+++ /dev/null
Binary files differ
diff --git a/theme/default/logo.png b/theme/default/logo.png
new file mode 100644
index 000000000..fdead6c4a
--- /dev/null
+++ b/theme/default/logo.png
Binary files differ
diff --git a/theme/earthy/css/base.css b/theme/earthy/css/base.css
new file mode 100644
index 000000000..6f46eef97
--- /dev/null
+++ b/theme/earthy/css/base.css
@@ -0,0 +1,1188 @@
+/** theme: earthy 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 { 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;
+text-align:right;
+}
+#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-secondary {
+margin-left:29px;
+padding:0;
+}
+
+#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: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;
+-moz-border-radius-topleft:4px;
+-moz-border-radius-topright:4px;
+-webkit-border-top-left-radius:4px;
+-webkit-border-top-right-radius:4px;
+border-width:1px;
+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:63.009%;
+min-height:259px;
+padding-top:1.795%;
+padding-bottom:1.795%;
+float:right;
+clear:both;
+border-radius:7px;
+border-style:solid;
+border-width:0;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:27.917%;
+min-height:259px;
+float:right;
+margin-right:4.385%;
+margin-top:73px;
+padding:1.795%;
+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: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;
+clear:both;
+float:left;
+width:100%;
+border-width:1px;
+border-style:solid;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#content .notice,
+#content .profile {
+padding:1.795%;
+margin-bottom:44px;
+}
+#content .notice {
+width:96.25%;
+}
+
+.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;
+}
+
+.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: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:70%;
+}
+#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%;
+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;
+}
+.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/earthy/css/display.css b/theme/earthy/css/display.css
new file mode 100644
index 000000000..b67700f2d
--- /dev/null
+++ b/theme/earthy/css/display.css
@@ -0,0 +1,251 @@
+/** theme: earthy
+ *
+ * @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:#665500;
+}
+body {
+font-family: Verdana, sans-serif;
+font-size:1em;
+}
+address {
+margin-right:7.18%;
+}
+
+h1 {
+color:#fff;
+}
+
+input, textarea, select, option {
+font-family: Verdana, sans-serif;
+}
+input, textarea, select,
+.entity_remote_subscribe {
+border-color:#aaa;
+}
+#filter_tags ul li {
+border-color:#ddd;
+}
+
+.form_settings input.form_action-secondary {
+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:#dddd33;
+}
+
+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-secondary {
+color:#ee4400;
+}
+
+.notice,
+.profile {
+border-color:#DDAA00;
+}
+.section .profile {
+border-top-color:#aaaa66;
+}
+
+#content .notice p.entry-content a:visited {
+background-color:#fcfcfc;
+}
+#content .notice p.entry-content .vcard a {
+background-color:#fcfffc;
+}
+
+#aside_primary {
+background-color:#DDAA00;
+}
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count {
+color:#000;
+}
+#form_notice.processing #notice_action-submit {
+background:#dddd33 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:#dddd33;
+}
+#content .notice,
+#content .profile,
+#site_nav_local_views .current a {
+background-color:#dddd33;
+}
+#site_nav_local_views .current a {
+color:#EE4400;
+}
+#site_nav_local_views a {
+background-color:rgba(255, 255, 255, 0.2);
+color:#fff;
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.4);
+}
+
+.error {
+background-color:#F7E8E8;
+}
+.success {
+background-color:#EFF3DC;
+}
+
+#anon_notice {
+background-color:#aaaa66;
+color:#dddd33;
+border-color:#dddd33;
+}
+
+#showstream #anon_notice {
+background-color:#9BB43E;
+}
+
+#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:#dddd33;
+}
+.form_user_unsubscribe input.submit,
+.form_group_leave input.submit,
+.form_user_authorization input.reject {
+background-color:#aaaa66;
+}
+
+.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:#DDAA00;
+}
+.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/earthy/css/ie.css b/theme/earthy/css/ie.css
new file mode 100644
index 000000000..2f463bb44
--- /dev/null
+++ b/theme/earthy/css/ie.css
@@ -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/earthy/default-avatar-mini.png b/theme/earthy/default-avatar-mini.png
new file mode 100644
index 000000000..38b8692b4
--- /dev/null
+++ b/theme/earthy/default-avatar-mini.png
Binary files differ
diff --git a/theme/earthy/default-avatar-profile.png b/theme/earthy/default-avatar-profile.png
new file mode 100644
index 000000000..f8357d4fc
--- /dev/null
+++ b/theme/earthy/default-avatar-profile.png
Binary files differ
diff --git a/theme/earthy/default-avatar-stream.png b/theme/earthy/default-avatar-stream.png
new file mode 100644
index 000000000..6b63baa70
--- /dev/null
+++ b/theme/earthy/default-avatar-stream.png
Binary files differ
diff --git a/theme/earthy/logo.png b/theme/earthy/logo.png
new file mode 100644
index 000000000..7c68b34f6
--- /dev/null
+++ b/theme/earthy/logo.png
Binary files differ
diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css
index d05578d43..cc19da0f7 100644
--- a/theme/identica/css/display.css
+++ b/theme/identica/css/display.css
@@ -167,18 +167,18 @@ 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 */
@@ -191,16 +191,16 @@ background-color:#fcfcfc;
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,
@@ -224,7 +224,7 @@ background-color:#fcfcfc;
/*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 +233,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
index 22853edc4..000000000
--- a/theme/identica/images/icons/icon_atom.jpg
+++ /dev/null
Binary files differ
diff --git a/theme/identica/images/icons/icon_foaf.gif b/theme/identica/images/icons/icon_foaf.gif
deleted file mode 100644
index f8f784423..000000000
--- a/theme/identica/images/icons/icon_foaf.gif
+++ /dev/null
Binary files differ
diff --git a/theme/identica/images/icons/icon_rss.jpg b/theme/identica/images/icons/icon_rss.jpg
deleted file mode 100644
index da23422d0..000000000
--- a/theme/identica/images/icons/icon_rss.jpg
+++ /dev/null
Binary files differ
diff --git a/theme/identica/images/icons/icon_vcard.gif b/theme/identica/images/icons/icon_vcard.gif
deleted file mode 100644
index 6d52947f3..000000000
--- a/theme/identica/images/icons/icon_vcard.gif
+++ /dev/null
Binary files 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
index ca796c8a3..000000000
--- a/theme/identica/images/icons/twotone/green/against.gif
+++ /dev/null
Binary files 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
index c709e5877..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-down.gif
+++ /dev/null
Binary files 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
index a4a98035d..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-downleft.gif
+++ /dev/null
Binary files 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
index 3e6001a61..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-downright.gif
+++ /dev/null
Binary files 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
index d0f5fbeaa..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-up.gif
+++ /dev/null
Binary files 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
index 1e9e6935b..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-upleft.gif
+++ /dev/null
Binary files 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
index c7fecc8a0..000000000
--- a/theme/identica/images/icons/twotone/green/arrow-upright.gif
+++ /dev/null
Binary files 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
index 33a9540c8..000000000
--- a/theme/identica/images/icons/twotone/green/back-forth.gif
+++ /dev/null
Binary files 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
index 23f318ecc..000000000
--- a/theme/identica/images/icons/twotone/green/bookmark.gif
+++ /dev/null
Binary files 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
index f70652c03..000000000
--- a/theme/identica/images/icons/twotone/green/bulb.gif
+++ /dev/null
Binary files 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
index a09b65aca..000000000
--- a/theme/identica/images/icons/twotone/green/calendar.gif
+++ /dev/null
Binary files 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
index 7884b02dd..000000000
--- a/theme/identica/images/icons/twotone/green/calendar2.gif
+++ /dev/null
Binary files 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
index 1a85fbad0..000000000
--- a/theme/identica/images/icons/twotone/green/camera.gif
+++ /dev/null
Binary files 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
index 47eaa0a2e..000000000
--- a/theme/identica/images/icons/twotone/green/cart.gif
+++ /dev/null
Binary files 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
index 3ad2c322b..000000000
--- a/theme/identica/images/icons/twotone/green/caution.gif
+++ /dev/null
Binary files 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
index 136d74517..000000000
--- a/theme/identica/images/icons/twotone/green/chart.gif
+++ /dev/null
Binary files 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
index 892429d48..000000000
--- a/theme/identica/images/icons/twotone/green/checkmark.gif
+++ /dev/null
Binary files 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
index 9317bdcd0..000000000
--- a/theme/identica/images/icons/twotone/green/clipboard.gif
+++ /dev/null
Binary files 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
index d1410f925..000000000
--- a/theme/identica/images/icons/twotone/green/clock.gif
+++ /dev/null
Binary files 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
index 0410fc6e8..000000000
--- a/theme/identica/images/icons/twotone/green/closed-folder.gif
+++ /dev/null
Binary files 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
index 29ce02492..000000000
--- a/theme/identica/images/icons/twotone/green/database.gif
+++ /dev/null
Binary files 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
index 3946869ae..000000000
--- a/theme/identica/images/icons/twotone/green/disfavourite.gif
+++ /dev/null
Binary files 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
index e970b0a30..000000000
--- a/theme/identica/images/icons/twotone/green/diskette.gif
+++ /dev/null
Binary files 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
index 9c08f4a3a..000000000
--- a/theme/identica/images/icons/twotone/green/document.gif
+++ /dev/null
Binary files 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
index 2e8648264..000000000
--- a/theme/identica/images/icons/twotone/green/double-arrow.gif
+++ /dev/null
Binary files 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
index 7e0906cfe..000000000
--- a/theme/identica/images/icons/twotone/green/eject.gif
+++ /dev/null
Binary files 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
index 588e28c26..000000000
--- a/theme/identica/images/icons/twotone/green/exclaim.gif
+++ /dev/null
Binary files 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
index 28e495103..000000000
--- a/theme/identica/images/icons/twotone/green/fastforward.gif
+++ /dev/null
Binary files 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
index d93515e37..000000000
--- a/theme/identica/images/icons/twotone/green/favourite.gif
+++ /dev/null
Binary files 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
index 68c8aee25..000000000
--- a/theme/identica/images/icons/twotone/green/flag.gif
+++ /dev/null
Binary files 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
index 0c1794b4e..000000000
--- a/theme/identica/images/icons/twotone/green/graph.gif
+++ /dev/null
Binary files 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
index c4118d53b..000000000
--- a/theme/identica/images/icons/twotone/green/grow.gif
+++ /dev/null
Binary files 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
index 5be6c67dd..000000000
--- a/theme/identica/images/icons/twotone/green/headphones.gif
+++ /dev/null
Binary files 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
index d2a3421ef..000000000
--- a/theme/identica/images/icons/twotone/green/home.gif
+++ /dev/null
Binary files 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
index b62b9480c..000000000
--- a/theme/identica/images/icons/twotone/green/hourglass.gif
+++ /dev/null
Binary files 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
index 86ef1f8b4..000000000
--- a/theme/identica/images/icons/twotone/green/info.gif
+++ /dev/null
Binary files 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
index ccf357ab2..000000000
--- a/theme/identica/images/icons/twotone/green/key.gif
+++ /dev/null
Binary files 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
index db00706b5..000000000
--- a/theme/identica/images/icons/twotone/green/lock.gif
+++ /dev/null
Binary files 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
index d2c30b1d2..000000000
--- a/theme/identica/images/icons/twotone/green/move.gif
+++ /dev/null
Binary files 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
index 64b51d4e1..000000000
--- a/theme/identica/images/icons/twotone/green/music.gif
+++ /dev/null
Binary files 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
index bcc0b149b..000000000
--- a/theme/identica/images/icons/twotone/green/note.gif
+++ /dev/null
Binary files 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
index d41300a08..000000000
--- a/theme/identica/images/icons/twotone/green/open-folder.gif
+++ /dev/null
Binary files 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
index 1d45f1d1e..000000000
--- a/theme/identica/images/icons/twotone/green/paper-clip.gif
+++ /dev/null
Binary files 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
index a8c7805be..000000000
--- a/theme/identica/images/icons/twotone/green/paper-clip2.gif
+++ /dev/null
Binary files 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
index ced0b6440..000000000
--- a/theme/identica/images/icons/twotone/green/pause.gif
+++ /dev/null
Binary files 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
index 69359f764..000000000
--- a/theme/identica/images/icons/twotone/green/phone.gif
+++ /dev/null
Binary files 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
index 794ec85b6..000000000
--- a/theme/identica/images/icons/twotone/green/play.gif
+++ /dev/null
Binary files 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
index 4407d0b2d..000000000
--- a/theme/identica/images/icons/twotone/green/plus.gif
+++ /dev/null
Binary files 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
index 17727d5d7..000000000
--- a/theme/identica/images/icons/twotone/green/print.gif
+++ /dev/null
Binary files 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
index 1689efcd0..000000000
--- a/theme/identica/images/icons/twotone/green/question-mark.gif
+++ /dev/null
Binary files 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
index 8a8b8144f..000000000
--- a/theme/identica/images/icons/twotone/green/refresh.gif
+++ /dev/null
Binary files 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
index 6ff01bb35..000000000
--- a/theme/identica/images/icons/twotone/green/reply.gif
+++ /dev/null
Binary files 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
index aca3ee35b..000000000
--- a/theme/identica/images/icons/twotone/green/rewind.gif
+++ /dev/null
Binary files 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
index c36463d0d..000000000
--- a/theme/identica/images/icons/twotone/green/search.gif
+++ /dev/null
Binary files 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
index adca7aa3e..000000000
--- a/theme/identica/images/icons/twotone/green/skip-back.gif
+++ /dev/null
Binary files 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
index ae5417f2f..000000000
--- a/theme/identica/images/icons/twotone/green/skip.gif
+++ /dev/null
Binary files 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
index 033506732..000000000
--- a/theme/identica/images/icons/twotone/green/skull.gif
+++ /dev/null
Binary files 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
index 47d61b106..000000000
--- a/theme/identica/images/icons/twotone/green/statusbar.gif
+++ /dev/null
Binary files 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
index e0b108d35..000000000
--- a/theme/identica/images/icons/twotone/green/stop.gif
+++ /dev/null
Binary files 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
index 65c0c4a0a..000000000
--- a/theme/identica/images/icons/twotone/green/template.gif
+++ /dev/null
Binary files 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
index 45e143b7a..000000000
--- a/theme/identica/images/icons/twotone/green/text-bigger.gif
+++ /dev/null
Binary files 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
index a54d0c1d3..000000000
--- a/theme/identica/images/icons/twotone/green/text-smaller.gif
+++ /dev/null
Binary files 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
index 78dd64a3d..000000000
--- a/theme/identica/images/icons/twotone/green/trash.gif
+++ /dev/null
Binary files 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
index 97e54b964..000000000
--- a/theme/identica/images/icons/twotone/green/two-docs.gif
+++ /dev/null
Binary files 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
index 45aad25c4..000000000
--- a/theme/identica/images/icons/twotone/green/twotone.gif
+++ /dev/null
Binary files 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
index 6869b3050..000000000
--- a/theme/identica/images/icons/twotone/green/undo.gif
+++ /dev/null
Binary files 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
index c85460fcd..000000000
--- a/theme/identica/images/icons/twotone/green/user.gif
+++ /dev/null
Binary files 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
index 4d421c1bb..000000000
--- a/theme/identica/images/icons/twotone/green/vegetable.gif
+++ /dev/null
Binary files 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
index ffb2efea0..000000000
--- a/theme/identica/images/icons/twotone/green/x.gif
+++ /dev/null
Binary files 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
index a59a5bb50..000000000
--- a/theme/identica/images/icons/twotone/green/zoom-in.gif
+++ /dev/null
Binary files 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
index c61f999fd..000000000
--- a/theme/identica/images/icons/twotone/green/zoom-out.gif
+++ /dev/null
Binary files differ
diff --git a/theme/otalk/css/base.css b/theme/otalk/css/base.css
new file mode 100644
index 000000000..379590d30
--- /dev/null
+++ b/theme/otalk/css/base.css
@@ -0,0 +1,1205 @@
+/** 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; 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 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-secondary {
+margin-left:29px;
+padding:0;
+}
+
+#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:100%;
+min-height:259px;
+padding-top:1.795%;
+padding-bottom: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:0;
+margin-bottom:18px;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float:left;
+}
+
+#aside_primary {
+width:96.3%;
+min-height:259px;
+float:left;
+clear:both;
+padding:1.795%;
+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:25%;
+margin-left:17px;
+margin-bottom:47px;
+clear:none;
+overflow:hidden;
+padding: 0 0 0 65px;
+min-height:235px;
+}
+
+#aside_primary .notice {
+margin-bottom:18px;
+}
+
+
+/* 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
index 000000000..22e0530ec
--- /dev/null
+++ b/theme/otalk/css/display.css
@@ -0,0 +1,293 @@
+/** 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 {
+/*background-color:#F0F2F5;*/
+}
+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-secondary {
+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-secondary {
+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
index 000000000..2f463bb44
--- /dev/null
+++ b/theme/otalk/css/ie.css
@@ -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
index 000000000..38b8692b4
--- /dev/null
+++ b/theme/otalk/default-avatar-mini.png
Binary files differ
diff --git a/theme/otalk/default-avatar-profile.png b/theme/otalk/default-avatar-profile.png
new file mode 100644
index 000000000..f8357d4fc
--- /dev/null
+++ b/theme/otalk/default-avatar-profile.png
Binary files differ
diff --git a/theme/otalk/default-avatar-stream.png b/theme/otalk/default-avatar-stream.png
new file mode 100644
index 000000000..6b63baa70
--- /dev/null
+++ b/theme/otalk/default-avatar-stream.png
Binary files 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
index 000000000..197775976
--- /dev/null
+++ b/theme/otalk/images/illustrations/illu_arrow-left-01.gif
Binary files 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
index 000000000..5a72eafcb
--- /dev/null
+++ b/theme/otalk/images/illustrations/illu_pattern-01.png
Binary files differ
diff --git a/theme/otalk/logo.png b/theme/otalk/logo.png
new file mode 100644
index 000000000..7c68b34f6
--- /dev/null
+++ b/theme/otalk/logo.png
Binary files differ