From 0a8a7659169f5535af34c1c9d6fdaad339f492f9 Mon Sep 17 00:00:00 2001
From: Roland Haeder
Date: Mon, 25 Jan 2016 13:29:05 +0100
Subject: [PATCH] Merged
Signed-off-by: Roland Haeder
---
.gitignore | 5 +-
.gitmodules | 3 +
actions/addpeopletag.php | 7 +-
actions/apiaccountratelimitstatus.php | 2 +-
actions/apiaccountupdatedeliverydevice.php | 4 +-
actions/apiaccountverifycredentials.php | 11 +-
actions/apiatomservice.php | 4 +-
actions/apiattachment.php | 2 +-
actions/apicheckhub.php | 2 +-
actions/apiconversation.php | 2 +-
actions/apiexternalprofileshow.php | 2 +-
actions/apifriendshipsexists.php | 2 +-
actions/apifriendshipsshow.php | 2 +-
actions/apignusocialconfig.php | 2 +-
actions/apignusocialversion.php | 2 +-
actions/apigroupadmins.php | 2 +-
actions/apigroupismember.php | 2 +-
actions/apigrouplist.php | 2 +-
actions/apigrouplistall.php | 6 +-
actions/apigroupmembership.php | 2 +-
actions/apigroupshow.php | 2 +-
actions/apihelptest.php | 6 +-
actions/apilist.php | 2 +-
actions/apilistmemberships.php | 2 +-
actions/apilists.php | 2 +-
actions/apilistsubscriber.php | 4 +-
actions/apilistsubscriptions.php | 2 +-
actions/apimediaupload.php | 5 +-
actions/apioauthaccesstoken.php | 2 +-
actions/apioauthauthorize.php | 6 +-
actions/apioauthrequesttoken.php | 4 +-
actions/apisearchatom.php | 4 +-
actions/apisearchjson.php | 6 +-
actions/apistatusesdestroy.php | 4 +-
actions/apistatusesshow.php | 2 +-
actions/apisubscriptions.php | 2 +-
actions/apitimelinefriends.php | 2 +-
actions/apitimelinegroup.php | 2 +-
actions/apitimelinehome.php | 2 +-
actions/apitimelinelist.php | 2 +-
actions/apitimelinementions.php | 2 +-
actions/apitimelinepublic.php | 2 +-
actions/apitimelinetag.php | 2 +-
actions/apitimelineuser.php | 2 +-
actions/apitrends.php | 4 +-
actions/apiuserprofileimage.php | 2 +-
actions/apiusershow.php | 2 +-
actions/approvegroup.php | 4 +-
actions/approvesub.php | 4 +-
actions/atompubshowsubscription.php | 2 +-
actions/attachment.php | 2 +-
actions/avatarbynickname.php | 2 +-
actions/backupaccount.php | 2 +-
actions/block.php | 7 +-
actions/blockedfromgroup.php | 4 +-
actions/cancelgroup.php | 4 +-
actions/confirmaddress.php | 2 +-
actions/deleteaccount.php | 2 +-
actions/deleteapplication.php | 4 +-
actions/deletegroup.php | 4 +-
actions/deleteuser.php | 4 +-
actions/doc.php | 2 +-
actions/editapplication.php | 4 +-
actions/editpeopletag.php | 4 +-
actions/featured.php | 6 +-
actions/foaf.php | 2 +-
actions/foafgroup.php | 6 +-
actions/geocode.php | 6 +-
actions/getfile.php | 2 +-
actions/grantrole.php | 2 +-
actions/groupblock.php | 4 +-
actions/groupbyid.php | 2 +-
actions/groupmembers.php | 2 +-
actions/groupqueue.php | 4 +-
actions/grouprss.php | 2 +-
actions/groups.php | 6 +-
actions/groupunblock.php | 4 +-
actions/invite.php | 11 +-
actions/logout.php | 7 +-
actions/makeadmin.php | 4 +-
actions/microsummary.php | 4 +-
actions/noticesearch.php | 4 +-
actions/noticesearchrss.php | 2 +-
actions/nudge.php | 4 +-
actions/opensearch.php | 4 +-
actions/otp.php | 4 +-
actions/peopletag.php | 6 +-
actions/peopletagautocomplete.php | 6 +-
actions/peopletagged.php | 8 +-
actions/peopletagsbyuser.php | 14 +-
actions/peopletagsforuser.php | 6 +-
actions/peopletagsubscribers.php | 8 +-
actions/peopletagsubscriptions.php | 6 +-
actions/pluginenable.php | 4 +-
actions/profilecompletion.php | 4 +-
actions/profiletagbyid.php | 6 +-
actions/publicrss.php | 2 +-
actions/publictagcloud.php | 24 +-
actions/recoverpassword.php | 2 +-
actions/redirect.php | 4 +-
actions/redirecturl.php | 2 +-
actions/register.php | 2 +-
actions/removepeopletag.php | 6 +-
actions/replies.php | 2 +-
actions/repliesrss.php | 2 +-
actions/restoreaccount.php | 2 +-
actions/revokerole.php | 2 +-
actions/robotstxt.php | 2 +-
actions/rsd.php | 6 +-
actions/sandbox.php | 2 +-
actions/selftag.php | 2 +-
actions/showapplication.php | 4 +-
actions/showgroup.php | 2 +-
actions/shownotice.php | 2 +-
actions/silence.php | 2 +-
actions/subedit.php | 4 +-
actions/subscribe.php | 4 +-
actions/subscribepeopletag.php | 4 +-
actions/sup.php | 4 +-
actions/tag.php | 2 +-
actions/tagrss.php | 2 +-
actions/unblock.php | 2 +-
actions/unsandbox.php | 2 +-
actions/unsilence.php | 2 +-
actions/unsubscribe.php | 2 +-
actions/unsubscribepeopletag.php | 4 +-
actions/userrss.php | 2 +-
actions/version.php | 2 +-
classes/Avatar.php | 17 +-
classes/Confirm_address.php | 2 +-
classes/File.php | 3 +
classes/File_redirection.php | 4 +-
classes/File_thumbnail.php | 3 +
classes/Memcached_DataObject.php | 2 +-
classes/Notice.php | 77 +-
classes/Notice_tag.php | 45 +
classes/User_group.php | 15 +-
extlib/DB/DataObject/createTables.php | 0
index.php | 15 +-
installer.txt | 649 ++++++++++++++
lib/action.php | 2 +-
lib/activity.php | 1 +
lib/activityimporter.php | 9 +-
lib/activityutils.php | 6 +-
lib/adminpanelaction.php | 4 +-
lib/apilistusers.php | 2 +-
lib/apioauthaction.php | 2 +-
lib/attachmentlist.php | 4 +-
lib/attachmentlistitem.php | 2 +-
lib/attachmenttagcloudsection.php | 2 +-
lib/default.php | 3 +-
lib/docfile.php | 32 +-
lib/formaction.php | 2 +-
lib/framework.php | 25 +-
lib/grouplist.php | 2 +-
lib/groupmemberlist.php | 2 +-
lib/grouptagcloudsection.php | 2 +-
lib/imagefile.php | 19 +-
lib/implugin.php | 4 +-
lib/inboxtagcloudsection.php | 2 +-
lib/infoaction.php | 2 +-
lib/installer.php | 5 +-
lib/inviteform.php | 12 +
lib/iomaster.php | 4 +-
lib/menu.php | 20 +-
lib/noticeform.php | 10 +-
lib/noticelistitem.php | 4 +-
lib/personaltagcloudsection.php | 2 +-
lib/pluginlist.php | 2 +-
lib/profileaction.php | 11 +-
lib/profileformaction.php | 4 +-
lib/publictagcloudsection.php | 2 +-
lib/router.php | 8 +-
lib/schemaupdater.php | 10 +-
lib/searchaction.php | 4 +-
lib/tagcloudsection.php | 7 +-
lib/urlmapper.php | 2 +-
lib/urlshortenerplugin2.php | 212 +++++
lib/util.php | 10 +-
plugins/APC/APCPlugin.php | 116 +++
.../AccountManager/AccountManagerPlugin.php | 2 +-
.../accountmanagementcontroldocument.php | 2 +-
.../accountmanagementsessionstatus.php | 2 +-
plugins/ActivitySpam/ActivitySpamPlugin.php | 6 +-
plugins/ActivitySpam/actions/spam.php | 4 +-
plugins/ActivitySpam/classes/spam_score.php | 2 +-
.../ActivitySpam/scripts/silencespammer.php | 2 +-
plugins/ActivitySpam/scripts/testuser.php | 2 +-
plugins/ActivitySpam/scripts/trainuser.php | 2 +-
plugins/Adsense/AdsensePlugin.php | 199 +++++
plugins/Aim/AimPlugin.php | 165 ++++
plugins/Aim/lib/aimmanager.php | 100 +++
plugins/AnonymousFave/AnonymousFavePlugin.php | 8 +-
.../AnonymousFave/actions/anondisfavor.php | 2 +-
plugins/AnonymousFave/actions/anonfavor.php | 2 +-
.../scripts/initialize_fave_tallys.php | 2 +-
plugins/ApiLogger/ApiLoggerPlugin.php | 2 +-
plugins/Autocomplete/AutocompletePlugin.php | 4 +-
plugins/Autocomplete/actions/autocomplete.php | 2 +-
plugins/BitlyUrl/BitlyUrlPlugin.php | 2 +-
plugins/Blacklist/BlacklistPlugin.php | 16 +-
plugins/BlogspamNet/BlogspamNetPlugin.php | 2 +-
plugins/Bookmark/BookmarkPlugin.php | 10 +-
.../Bookmark/actions/apitimelinebookmarks.php | 6 +-
plugins/Bookmark/actions/bookmarkforurl.php | 10 +-
plugins/Bookmark/actions/bookmarks.php | 8 +-
plugins/Bookmark/actions/bookmarksrss.php | 38 +
plugins/Bookmark/actions/importdelicious.php | 2 +-
plugins/Bookmark/actions/newbookmark.php | 2 +-
plugins/Bookmark/actions/noticebyurl.php | 2 +-
plugins/Bookmark/classes/Bookmark.php | 18 +
plugins/Bookmark/scripts/importbookmarks.php | 2 +-
.../CasAuthenticationPlugin.php | 8 +-
.../CasAuthentication/actions/caslogin.php | 2 +-
.../ClientSideShortenPlugin.php | 4 +-
plugins/ClientSideShorten/actions/shorten.php | 4 +-
.../ConversationTree/lib/conversationtree.php | 2 +-
plugins/DirectMessage/DirectMessagePlugin.php | 2 +-
.../actions/apidirectmessage.php | 19 +-
plugins/DirectMessage/actions/showmessage.php | 6 +-
plugins/DirectMessage/classes/Message.php | 4 +-
.../DirectMessage/lib/inboxmessagelist.php | 119 +++
.../DirectionDetectorPlugin.php | 10 +-
plugins/Directory/DirectoryPlugin.php | 20 +-
plugins/Directory/actions/groupdirectory.php | 2 +-
plugins/Directory/actions/userdirectory.php | 2 +-
plugins/Directory/lib/sortablegrouplist.php | 6 +-
.../lib/sortablesubscriptionlist.php | 27 +
.../DomainStatusNetworkPlugin.php | 2 +-
.../DomainStatusNetwork/actions/globalapi.php | 2 +-
.../scripts/installforemail.php | 2 +-
.../scripts/proposesite.php | 2 +-
.../scripts/sitefordomain.php | 2 +-
.../DomainWhitelist/DomainWhitelistPlugin.php | 9 +-
.../EmailRegistrationPlugin.php | 6 +-
.../actions/emailregister.php | 2 +-
.../scripts/cancelemailregistration.php | 2 +-
.../scripts/registeremailuser.php | 2 +-
plugins/EmailReminder/EmailReminderPlugin.php | 5 +-
.../scripts/sendemailreminder.php | 2 +-
plugins/EmailSummary/EmailSummaryPlugin.php | 2 +-
.../EmailSummary/scripts/sendemailsummary.php | 2 +-
plugins/Event/EventPlugin.php | 12 +-
plugins/Event/actions/cancelrsvp.php | 9 +-
plugins/Event/actions/newevent.php | 2 +-
plugins/Event/actions/newrsvp.php | 2 +-
plugins/Event/actions/timelist.php | 4 +-
plugins/Event/classes/Happening.php | 4 +-
plugins/Event/classes/RSVP.php | 6 +-
.../ExtendedProfile/ExtendedProfilePlugin.php | 3 +-
.../ExtendedProfile/actions/profiledetail.php | 5 +
.../actions/userautocomplete.php | 6 +-
.../FacebookBridge/FacebookBridgePlugin.php | 10 +-
.../actions/facebookdeauthorize.php | 4 +-
.../actions/facebookfinishlogin.php | 4 +-
.../FacebookBridge/actions/facebooklogin.php | 2 +-
.../actions/facebooksettings.php | 12 +
.../Favorite/actions/apifavoritecreate.php | 16 +-
.../Favorite/actions/apifavoritedestroy.php | 8 +-
plugins/Favorite/actions/apistatusesfavs.php | 8 +-
.../Favorite/actions/apitimelinefavorites.php | 2 +-
.../Favorite/actions/atompubfavoritefeed.php | 2 +-
.../Favorite/actions/atompubshowfavorite.php | 2 +-
plugins/Favorite/actions/favorited.php | 6 +-
plugins/Favorite/actions/favoritesrss.php | 15 +
plugins/Favorite/actions/showfavorites.php | 97 +-
plugins/Favorite/classes/Fave.php | 2 +-
plugins/ForceGroup/ForceGroupPlugin.php | 2 +-
.../GNUsocialPhoto/GNUsocialPhotoPlugin.php | 2 +-
plugins/GNUsocialPhoto/actions/newphoto.php | 4 +-
plugins/GNUsocialPhoto/classes/Photo.php | 4 +-
.../GNUsocialPhotos/GNUsocialPhotosPlugin.php | 12 +-
plugins/GNUsocialPhotos/actions/editphoto.php | 4 +-
plugins/GNUsocialPhotos/actions/photos.php | 6 +-
.../GNUsocialPhotos/actions/photoupload.php | 4 +-
.../GNUsocialProfileExtensionsPlugin.php | 9 +-
.../actions/bio.php | 4 +-
.../lib/noticetree.php | 2 +-
.../GNUsocialVideo/GNUsocialVideoPlugin.php | 2 +-
plugins/GNUsocialVideo/actions/postvideo.php | 4 +-
plugins/GNUsocialVideo/actions/showvideo.php | 2 +-
plugins/GNUsocialVideo/classes/Video.php | 4 +-
.../GroupPrivateMessagePlugin.php | 9 +-
.../actions/groupinbox.php | 2 +-
.../actions/showgroupmessage.php | 2 +-
plugins/Irc/IrcPlugin.php | 385 ++++++++
.../Tests/Phergie/Plugin/HandlerTest.php | 837 ++++++++++++++++++
plugins/Irc/lib/ircmanager.php | 357 ++++++++
.../LdapAuthenticationPlugin.php | 2 +-
plugins/LdapCommon/LdapCommon.php | 2 +-
plugins/LinkPreview/LinkPreviewPlugin.php | 2 +-
plugins/LinkPreview/actions/oembedproxy.php | 2 +-
plugins/Mapstraction/MapstractionPlugin.php | 4 +-
plugins/Mapstraction/actions/allmap.php | 2 +-
plugins/Mapstraction/actions/map.php | 6 +-
plugins/Mapstraction/actions/usermap.php | 2 +-
plugins/Minify/MinifyPlugin.php | 4 +-
plugins/Minify/actions/minify.php | 6 +-
.../extlib/minify/min/lib/Solar/Dir.php | 4 +-
plugins/ModHelper/ModHelperPlugin.php | 2 +-
plugins/ModLog/ModLogPlugin.php | 10 +-
plugins/ModPlus/ModPlusPlugin.php | 2 +-
plugins/Mollom/MollomPlugin.php | 2 +-
plugins/NoticeTitle/NoticeTitlePlugin.php | 4 +-
plugins/NoticeTitle/classes/Notice_title.php | 2 +-
plugins/OStatus/OStatusPlugin.php | 18 +-
plugins/OStatus/actions/ostatusinit.php | 3 +-
plugins/OStatus/actions/ostatustag.php | 2 +-
plugins/OStatus/classes/FeedSub.php | 2 +-
plugins/OStatus/classes/Ostatus_profile.php | 33 +-
plugins/OStatus/lib/magicenvelope.php | 6 +-
plugins/OStatus/lib/ostatusqueuehandler.php | 6 +-
plugins/OStatus/lib/salmonaction.php | 11 +-
plugins/OStatus/scripts/fixup-shadow.php | 8 +-
plugins/OStatus/scripts/gcfeeds.php | 2 +-
plugins/OStatus/scripts/renew-feeds.php | 2 +-
plugins/OStatus/scripts/resub-feed.php | 2 +-
plugins/OStatus/scripts/rm_bad_feedsubs.php | 2 +-
plugins/OStatus/scripts/testfeed.php | 2 +-
.../OStatus/scripts/update-profile-data.php | 2 +-
plugins/OStatus/scripts/update-profile.php | 2 +-
.../scripts/update_ostatus_profiles.php | 4 +-
plugins/OStatus/tests/gettext-speedtest.php | 2 +-
plugins/OStatus/tests/slap.php | 2 +-
plugins/Oembed/actions/oembed.php | 2 +-
plugins/Oembed/classes/File_oembed.php | 3 +
plugins/Oembed/scripts/fixup_files.php | 2 +-
plugins/OfflineBackup/OfflineBackupPlugin.php | 4 +-
.../lib/offlinebackupqueuehandler.php | 2 +-
.../OpenExternalLinkTargetPlugin.php | 2 +-
plugins/OpenID/OpenIDPlugin.php | 8 +-
plugins/OpenID/actions/finishaddopenid.php | 2 +-
plugins/OpenID/actions/finishopenidlogin.php | 6 +-
plugins/OpenID/actions/openidlogin.php | 2 +-
plugins/OpenID/actions/openidserver.php | 4 +-
plugins/OpenID/actions/openidtrust.php | 6 +-
plugins/OpenID/openid.php | 4 +-
plugins/OpenX/OpenXPlugin.php | 4 +-
.../OpportunisticQM/OpportunisticQMPlugin.php | 28 +-
.../lib/opportunisticqueuemanager.php | 1 +
.../PiwikAnalytics/PiwikAnalyticsPlugin.php | 2 +-
plugins/Poll/PollPlugin.php | 20 +-
plugins/Poll/actions/newpoll.php | 2 +-
plugins/Poll/actions/respondpoll.php | 2 +-
plugins/Poll/classes/Poll.php | 10 +-
plugins/Poll/classes/Poll_response.php | 10 +-
plugins/PostDebug/PostDebugPlugin.php | 4 +-
plugins/PtitUrl/PtitUrlPlugin.php | 1 +
plugins/QnA/QnAPlugin.php | 12 +-
plugins/QnA/actions/qnaclosequestion.php | 2 +-
plugins/QnA/actions/qnanewanswer.php | 2 +-
plugins/QnA/actions/qnanewquestion.php | 2 +-
plugins/QnA/actions/qnareviseanswer.php | 2 +-
plugins/QnA/actions/qnavote.php | 2 +-
plugins/QnA/classes/QnA_Answer.php | 14 +-
plugins/QnA/classes/QnA_Question.php | 10 +-
plugins/QnA/classes/QnA_Vote.php | 2 +-
plugins/QnA/forms/qnanewquestion.php | 2 +-
plugins/RSSCloud/RSSCloudPlugin.php | 6 +-
.../RSSCloud/actions/loggingaggregator.php | 4 +-
.../actions/rsscloudrequestnotify.php | 4 +-
plugins/Realtime/RealtimePlugin.php | 8 +-
plugins/Realtime/actions/closechannel.php | 3 +-
plugins/Realtime/actions/keepalivechannel.php | 3 +-
plugins/Realtime/scripts/cleanupchannels.php | 2 +-
plugins/Recaptcha/RecaptchaPlugin.php | 14 +-
.../RegisterThrottlePlugin.php | 4 +-
.../RequireValidatedEmailPlugin.php | 2 +-
.../scripts/registerbyemail.php | 2 +-
plugins/SQLProfile/SQLProfilePlugin.php | 2 +-
plugins/Sample/actions/hello.php | 6 +-
plugins/SearchSub/SearchSubPlugin.php | 5 +-
plugins/SearchSub/actions/searchsub.php | 4 +-
plugins/SearchSub/actions/searchsubs.php | 2 +-
plugins/SearchSub/actions/searchunsub.php | 2 +-
plugins/SearchSub/classes/SearchSub.php | 12 +
plugins/Share/actions/apistatusesretweets.php | 6 +-
.../actions/apitimelineretweetedbyme.php | 4 +-
.../actions/apitimelineretweetedtome.php | 2 +-
.../Share/actions/apitimelineretweetsofme.php | 6 +-
.../SiteNoticeInSidebarPlugin.php | 4 +-
plugins/Sitemap/SitemapPlugin.php | 2 +-
plugins/Sitemap/actions/noticesitemap.php | 2 +-
plugins/Sitemap/actions/sitemap.php | 2 +-
plugins/Sitemap/actions/sitemapindex.php | 2 +-
plugins/Sitemap/actions/usersitemap.php | 2 +-
plugins/Sitemap/scripts/updatecounts.php | 2 +-
.../SlicedFavorites/SlicedFavoritesPlugin.php | 2 +-
.../actions/favoritedslice.php | 13 +-
plugins/SphinxSearch/scripts/gen_config.php | 2 +-
plugins/SphinxSearch/scripts/index_update.php | 2 +-
plugins/Spotify/SpotifyPlugin.php | 119 +++
plugins/Statistics/README.md | 1 +
plugins/Statistics/StatisticsPlugin.php | 1 +
plugins/Statistics/actions | 1 +
.../StrictTransportSecurityPlugin.php | 2 +-
plugins/SubMirror/SubMirrorPlugin.php | 4 +-
plugins/SubMirror/actions/mirrorsettings.php | 47 +
plugins/SubMirror/classes/SubMirror.php | 7 +-
plugins/TabFocus/TabFocusPlugin.php | 2 +-
plugins/TagSub/TagSubPlugin.php | 4 +-
plugins/TagSub/actions/tagsub.php | 4 +-
plugins/TagSub/actions/tagsubs.php | 2 +-
plugins/TagSub/actions/tagunsub.php | 2 +-
plugins/TagSub/classes/TagSub.php | 12 +
plugins/TinyMCE/TinyMCEPlugin.php | 348 ++++++++
plugins/TwitterBridge/TwitterBridgePlugin.php | 10 +-
.../actions/twitterauthorization.php | 33 +
.../TwitterBridge/actions/twitterlogin.php | 15 +
.../daemons/synctwitterfriends.php | 2 +-
.../TwitterBridge/daemons/twitterdaemon.php | 2 +-
.../daemons/twitterstatusfetcher.php | 16 +-
.../TwitterBridge/lib/jsonstreamreader.php | 10 +-
.../TwitterBridge/lib/tweetinqueuehandler.php | 11 +
plugins/TwitterBridge/scripts/fakestream.php | 2 +-
.../scripts/initialize_notice_to_status.php | 2 +-
plugins/TwitterBridge/scripts/streamtest.php | 2 +-
plugins/UserFlag/UserFlagPlugin.php | 8 +-
plugins/UserFlag/actions/adminprofileflag.php | 6 +-
plugins/UserFlag/actions/clearflag.php | 4 +-
plugins/UserFlag/actions/flagprofile.php | 4 +-
plugins/UserLimit/UserLimitPlugin.php | 12 +-
plugins/WebFinger/WebFingerPlugin.php | 4 +-
plugins/WebFinger/lib/xrdaction.php | 2 +-
.../WikiHowProfile/WikiHowProfilePlugin.php | 4 +-
plugins/XCache/XCachePlugin.php | 120 +++
plugins/Xmpp/XmppPlugin.php | 2 +-
plugins/Xmpp/lib/xmppmanager.php | 4 +-
.../YammerImport/actions/yammeradminpanel.php | 192 ++++
plugins/YammerImport/actions/yammerauth.php | 77 ++
plugins/YammerImport/lib/yammerimporter.php | 512 +++++++++++
scripts/allsites.php | 2 +-
scripts/backupuser.php | 2 +-
scripts/checkschema.php | 2 +-
scripts/clean_thumbnails.php | 2 +-
scripts/clear_jabber.php | 2 +-
scripts/clearcache.php | 2 +-
scripts/command.php | 2 +-
.../{commandline.inc => commandline.inc.php} | 3 +-
scripts/console.php | 2 +-
scripts/createsim.php | 58 +-
scripts/deletegroup.php | 2 +-
scripts/deleteprofile.php | 2 +-
scripts/docgen.php | 2 +-
scripts/dumpschema.php | 4 +-
scripts/fixup_deletions.php | 2 +-
scripts/fixup_group_profiles.php | 98 ++
scripts/flushrouter.php | 4 +-
scripts/flushsite.php | 4 +-
scripts/getpiddir.php | 2 +-
scripts/getvaliddaemons.php | 2 +-
scripts/gnusocialversion.php | 2 +-
scripts/handlequeued.php | 2 +-
scripts/imdaemon.php | 2 +-
scripts/importtwitteratom.php | 2 +-
scripts/joingroup.php | 2 +-
scripts/leavegroup.php | 2 +-
scripts/maildaemon.php | 2 +-
scripts/make-release.php | 2 +-
scripts/makegroupadmin.php | 2 +-
scripts/moveuser.php | 2 +-
scripts/queuectl.php | 2 +-
scripts/queuedaemon.php | 2 +-
scripts/registeruser.php | 2 +-
scripts/restoreuser.php | 2 +-
scripts/sendemail.php | 2 +-
scripts/sessiongc.php | 2 +-
scripts/setconfig.php | 2 +-
scripts/setpassword.php | 2 +-
scripts/settag.php | 2 +-
scripts/showcache.php | 2 +-
scripts/showplugins.php | 2 +-
scripts/showtable.php | 2 +-
scripts/startdaemons.sh | 2 +-
scripts/stopdaemons.sh | 4 +-
scripts/strip_geo.php | 2 +-
scripts/uncache_users.php | 2 +-
scripts/updatelocation.php | 2 +-
scripts/updateurls.php | 2 +-
scripts/upgrade.php | 2 +-
scripts/useremail.php | 2 +-
scripts/userrole.php | 2 +-
statistics_plugin | 1 +
tests/UserRightsTest.php | 5 +-
tests/atompub/atompub_test.php | 2 +-
tests/oauth/fetch_temp_creds.php | 2 +-
tests/oauth/fetch_token_creds.php | 2 +-
tests/oauth/oauth_post_notice.php | 2 +-
tests/oauth/oauth_verify_creds.php | 2 +-
489 files changed, 6164 insertions(+), 898 deletions(-)
create mode 100644 .gitmodules
mode change 100755 => 100644 extlib/DB/DataObject/createTables.php
create mode 100644 installer.txt
create mode 100644 lib/urlshortenerplugin2.php
create mode 100644 plugins/APC/APCPlugin.php
create mode 100644 plugins/Adsense/AdsensePlugin.php
create mode 100644 plugins/Aim/AimPlugin.php
create mode 100644 plugins/Aim/lib/aimmanager.php
create mode 100644 plugins/Irc/IrcPlugin.php
create mode 100644 plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/HandlerTest.php
create mode 100644 plugins/Irc/lib/ircmanager.php
create mode 100644 plugins/Spotify/SpotifyPlugin.php
create mode 120000 plugins/Statistics/README.md
create mode 120000 plugins/Statistics/StatisticsPlugin.php
create mode 120000 plugins/Statistics/actions
create mode 100644 plugins/TinyMCE/TinyMCEPlugin.php
create mode 100644 plugins/XCache/XCachePlugin.php
create mode 100644 plugins/YammerImport/actions/yammeradminpanel.php
create mode 100644 plugins/YammerImport/actions/yammerauth.php
create mode 100644 plugins/YammerImport/lib/yammerimporter.php
rename scripts/{commandline.inc => commandline.inc.php} (98%)
create mode 100755 scripts/fixup_group_profiles.php
create mode 160000 statistics_plugin
mode change 100755 => 100644 tests/oauth/fetch_temp_creds.php
mode change 100755 => 100644 tests/oauth/fetch_token_creds.php
mode change 100755 => 100644 tests/oauth/oauth_verify_creds.php
diff --git a/.gitignore b/.gitignore
index 102173e832..06cd295e86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,7 @@ php.log
.DS_Store
nbproject
*.mo
-
+*log*
+htaccess-sample
+installer.txt
+extlib/DB.php
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..8714c3f611
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "statistics_plugin"]
+ path = statistics_plugin
+ url = https://dev.pztrn.name/statistics_plugin.git
diff --git a/actions/addpeopletag.php b/actions/addpeopletag.php
index b501ce0fd9..56bb206dc4 100644
--- a/actions/addpeopletag.php
+++ b/actions/addpeopletag.php
@@ -65,7 +65,7 @@ class AddpeopletagAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -119,7 +119,7 @@ class AddpeopletagAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
// Throws exception on error
$ptag = Profile_tag::setTag($this->user->id, $this->tagged->id,
@@ -127,7 +127,8 @@ class AddpeopletagAction extends Action
if (!$ptag) {
$user = User::getKV('id', $id);
- if ($user) {
+
+ if ($user instanceof User) {
$this->clientError(
// TRANS: Client error displayed when an unknown error occurs when adding a user to a list.
// TRANS: %s is a username.
diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php
index 592cf908fc..167a2dd6f5 100644
--- a/actions/apiaccountratelimitstatus.php
+++ b/actions/apiaccountratelimitstatus.php
@@ -112,7 +112,7 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php
index a3cbb418b6..370423ad2e 100644
--- a/actions/apiaccountupdatedeliverydevice.php
+++ b/actions/apiaccountupdatedeliverydevice.php
@@ -54,7 +54,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -73,7 +73,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apiaccountverifycredentials.php b/actions/apiaccountverifycredentials.php
index 9b98fa6d81..f82060f547 100644
--- a/actions/apiaccountverifycredentials.php
+++ b/actions/apiaccountverifycredentials.php
@@ -48,9 +48,16 @@ if (!defined('STATUSNET')) {
*/
class ApiAccountVerifyCredentialsAction extends ApiAuthAction
{
+ /**
+ * Handle the request
+ *
+ * Check whether the credentials are valid and output the result
+ *
+ * @return void
+ */
protected function handle()
{
- parent::handle();
+ parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
@@ -78,7 +85,7 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apiatomservice.php b/actions/apiatomservice.php
index 9e45a30fcc..6ee3eba595 100644
--- a/actions/apiatomservice.php
+++ b/actions/apiatomservice.php
@@ -51,7 +51,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
* @return boolean success flag
*
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('id'));
@@ -71,7 +71,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apiattachment.php b/actions/apiattachment.php
index 505d50330e..b92709f5d6 100644
--- a/actions/apiattachment.php
+++ b/actions/apiattachment.php
@@ -99,7 +99,7 @@ class ApiAttachmentAction extends ApiAuthAction
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apicheckhub.php b/actions/apicheckhub.php
index e11b7da4b7..19cc4d19f6 100644
--- a/actions/apicheckhub.php
+++ b/actions/apicheckhub.php
@@ -108,7 +108,7 @@ class ApiCheckHubAction extends ApiAuthAction
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apiconversation.php b/actions/apiconversation.php
index 5e1102b2f6..728d62c24b 100644
--- a/actions/apiconversation.php
+++ b/actions/apiconversation.php
@@ -156,7 +156,7 @@ class ApiconversationAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/actions/apiexternalprofileshow.php b/actions/apiexternalprofileshow.php
index 4e8419cf6b..2fe7450034 100644
--- a/actions/apiexternalprofileshow.php
+++ b/actions/apiexternalprofileshow.php
@@ -92,7 +92,7 @@ class ApiExternalProfileShowAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php
index 4bb771292d..21d82f96fd 100644
--- a/actions/apifriendshipsexists.php
+++ b/actions/apifriendshipsexists.php
@@ -111,7 +111,7 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php
index c08e984b9a..31f47ce2f1 100644
--- a/actions/apifriendshipsshow.php
+++ b/actions/apifriendshipsshow.php
@@ -162,7 +162,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apignusocialconfig.php b/actions/apignusocialconfig.php
index 813073a9ed..e86a5636e3 100644
--- a/actions/apignusocialconfig.php
+++ b/actions/apignusocialconfig.php
@@ -141,7 +141,7 @@ class ApiGNUsocialConfigAction extends ApiAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apignusocialversion.php b/actions/apignusocialversion.php
index a56630c666..772e40270d 100644
--- a/actions/apignusocialversion.php
+++ b/actions/apignusocialversion.php
@@ -75,7 +75,7 @@ class ApiGNUsocialVersionAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigroupadmins.php b/actions/apigroupadmins.php
index e0b2475072..3754a831d4 100644
--- a/actions/apigroupadmins.php
+++ b/actions/apigroupadmins.php
@@ -139,7 +139,7 @@ class ApiGroupAdminsAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php
index c085f7b3c1..97ae325cb5 100644
--- a/actions/apigroupismember.php
+++ b/actions/apigroupismember.php
@@ -118,7 +118,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php
index 1953752b02..2f288bf04f 100644
--- a/actions/apigrouplist.php
+++ b/actions/apigrouplist.php
@@ -160,7 +160,7 @@ class ApiGroupListAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php
index 2fb3714257..6d7000e6b8 100644
--- a/actions/apigrouplistall.php
+++ b/actions/apigrouplistall.php
@@ -58,7 +58,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -77,7 +77,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
@@ -159,7 +159,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php
index 0e01f92f00..86ae091162 100644
--- a/actions/apigroupmembership.php
+++ b/actions/apigroupmembership.php
@@ -130,7 +130,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php
index a1643302e1..9a45d231a9 100644
--- a/actions/apigroupshow.php
+++ b/actions/apigroupshow.php
@@ -156,7 +156,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apihelptest.php b/actions/apihelptest.php
index a9cd7394c9..a41ebc9367 100644
--- a/actions/apihelptest.php
+++ b/actions/apihelptest.php
@@ -51,7 +51,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
return true;
@@ -64,7 +64,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
@@ -95,7 +95,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apilist.php b/actions/apilist.php
index dc909e62a6..94d95df5ef 100644
--- a/actions/apilist.php
+++ b/actions/apilist.php
@@ -194,7 +194,7 @@ class ApiListAction extends ApiBareAuthAction
*
* @return boolean is_read-only=false
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/actions/apilistmemberships.php b/actions/apilistmemberships.php
index bf7f0e84d8..37e6b77b05 100644
--- a/actions/apilistmemberships.php
+++ b/actions/apilistmemberships.php
@@ -108,7 +108,7 @@ class ApiListMembershipsAction extends ApiBareAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apilists.php b/actions/apilists.php
index 0b241638ad..42672e6191 100644
--- a/actions/apilists.php
+++ b/actions/apilists.php
@@ -188,7 +188,7 @@ class ApiListsAction extends ApiBareAuthAction
$this->prev_cursor) = Profile_list::getAtCursor($fn, array($this->scoped), $cursor, $count);
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/actions/apilistsubscriber.php b/actions/apilistsubscriber.php
index f5cda15ae9..a19ceec2fd 100644
--- a/actions/apilistsubscriber.php
+++ b/actions/apilistsubscriber.php
@@ -33,7 +33,7 @@ class ApiListSubscriberAction extends ApiBareAuthAction
{
var $list = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -52,7 +52,7 @@ class ApiListSubscriberAction extends ApiBareAuthAction
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apilistsubscriptions.php b/actions/apilistsubscriptions.php
index e5d8aebc4f..5fe4c378ae 100644
--- a/actions/apilistsubscriptions.php
+++ b/actions/apilistsubscriptions.php
@@ -95,7 +95,7 @@ class ApiListSubscriptionsAction extends ApiBareAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php
index fd1ff565c7..86742e07bd 100644
--- a/actions/apimediaupload.php
+++ b/actions/apimediaupload.php
@@ -48,14 +48,11 @@ class ApiMediaUploadAction extends ApiAuthAction
* Grab the file from the 'media' param, then store, and shorten
*
* @todo Upload throttle!
- *
- * @param array $args $_REQUEST data (unused)
- *
* @return void
*/
protected function handle()
{
- parent::handle();
+ parent::handle($args);
// Workaround for PHP returning empty $_POST and $_FILES when POST
// length > post_max_size in php.ini
diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php
index a1a70a9b9e..2080246607 100644
--- a/actions/apioauthaccesstoken.php
+++ b/actions/apioauthaccesstoken.php
@@ -52,7 +52,7 @@ class ApiOAuthAccessTokenAction extends ApiOAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php
index d0dcf9c9c7..68d19a398e 100644
--- a/actions/apioauthauthorize.php
+++ b/actions/apioauthauthorize.php
@@ -55,12 +55,12 @@ class ApiOAuthAuthorizeAction extends ApiOAuthAction
*
* @return boolean false
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -88,7 +88,7 @@ class ApiOAuthAuthorizeAction extends ApiOAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apioauthrequesttoken.php b/actions/apioauthrequesttoken.php
index e961f4f464..4f5a469caa 100644
--- a/actions/apioauthrequesttoken.php
+++ b/actions/apioauthrequesttoken.php
@@ -49,7 +49,7 @@ class ApiOAuthRequestTokenAction extends ApiOAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -69,7 +69,7 @@ class ApiOAuthRequestTokenAction extends ApiOAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apisearchatom.php b/actions/apisearchatom.php
index 7e79808a96..3c787b72ae 100644
--- a/actions/apisearchatom.php
+++ b/actions/apisearchatom.php
@@ -88,7 +88,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return boolean success
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -128,7 +128,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
common_debug("In apisearchatom handle()");
diff --git a/actions/apisearchjson.php b/actions/apisearchjson.php
index 794f23077b..424773f12b 100644
--- a/actions/apisearchjson.php
+++ b/actions/apisearchjson.php
@@ -57,7 +57,7 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return boolean true if nothing goes wrong
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -95,7 +95,7 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showResults();
@@ -129,7 +129,7 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php
index 2d32124c42..e1783f258a 100644
--- a/actions/apistatusesdestroy.php
+++ b/actions/apistatusesdestroy.php
@@ -64,7 +64,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -89,7 +89,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php
index 70b9a9c27a..988ed804e9 100644
--- a/actions/apistatusesshow.php
+++ b/actions/apistatusesshow.php
@@ -176,7 +176,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
}
diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php
index 081445129d..3f5d5f797b 100644
--- a/actions/apisubscriptions.php
+++ b/actions/apisubscriptions.php
@@ -129,7 +129,7 @@ abstract class ApiSubscriptionsAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php
index b14635ac33..b809699c7f 100644
--- a/actions/apitimelinefriends.php
+++ b/actions/apitimelinefriends.php
@@ -295,7 +295,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php
index 4201eb55f8..c9d375d4c9 100644
--- a/actions/apitimelinegroup.php
+++ b/actions/apitimelinegroup.php
@@ -171,7 +171,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php
index 42cd08cad7..5dca9a42cd 100644
--- a/actions/apitimelinehome.php
+++ b/actions/apitimelinehome.php
@@ -199,7 +199,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinelist.php b/actions/apitimelinelist.php
index 91b26bf6c7..75c9da034d 100644
--- a/actions/apitimelinelist.php
+++ b/actions/apitimelinelist.php
@@ -199,7 +199,7 @@ class ApiTimelineListAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php
index c1811ac01b..6465cdf85e 100644
--- a/actions/apitimelinementions.php
+++ b/actions/apitimelinementions.php
@@ -204,7 +204,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php
index 07dcace942..957c187f9f 100644
--- a/actions/apitimelinepublic.php
+++ b/actions/apitimelinepublic.php
@@ -286,7 +286,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php
index 1184440c7d..08b2f08356 100644
--- a/actions/apitimelinetag.php
+++ b/actions/apitimelinetag.php
@@ -178,7 +178,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 5debe3ed8c..f593b4da21 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -270,7 +270,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
}
diff --git a/actions/apitrends.php b/actions/apitrends.php
index a39769a34e..6e6810b95d 100644
--- a/actions/apitrends.php
+++ b/actions/apitrends.php
@@ -53,7 +53,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction
*
* @return boolean false if user doesn't exist
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
return true;
@@ -66,7 +66,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showTrends();
diff --git a/actions/apiuserprofileimage.php b/actions/apiuserprofileimage.php
index 47fc5e69ac..c9c8eab9af 100644
--- a/actions/apiuserprofileimage.php
+++ b/actions/apiuserprofileimage.php
@@ -110,7 +110,7 @@ class ApiUserProfileImageAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/apiusershow.php b/actions/apiusershow.php
index 35b5069860..04fcb7dd89 100644
--- a/actions/apiusershow.php
+++ b/actions/apiusershow.php
@@ -118,7 +118,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/approvegroup.php b/actions/approvegroup.php
index 2c8b354d34..b532a9b955 100644
--- a/actions/approvegroup.php
+++ b/actions/approvegroup.php
@@ -50,7 +50,7 @@ class ApprovegroupAction extends Action
/**
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -139,7 +139,7 @@ class ApprovegroupAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/approvesub.php b/actions/approvesub.php
index c9fa804412..0e70e3429e 100644
--- a/actions/approvesub.php
+++ b/actions/approvesub.php
@@ -50,7 +50,7 @@ class ApprovesubAction extends Action
/**
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -97,7 +97,7 @@ class ApprovesubAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$cur = common_current_user();
diff --git a/actions/atompubshowsubscription.php b/actions/atompubshowsubscription.php
index ee5a477d49..d80dd609e3 100644
--- a/actions/atompubshowsubscription.php
+++ b/actions/atompubshowsubscription.php
@@ -132,7 +132,7 @@ class AtompubshowsubscriptionAction extends AtompubAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
return false;
diff --git a/actions/attachment.php b/actions/attachment.php
index 1126759832..0bdead84a0 100644
--- a/actions/attachment.php
+++ b/actions/attachment.php
@@ -76,7 +76,7 @@ class AttachmentAction extends ManagedAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index 10a22e77bc..b366c62d80 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -85,7 +85,7 @@ class AvatarbynicknameAction extends Action
common_redirect($url, 302);
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/backupaccount.php b/actions/backupaccount.php
index 8f642f3b77..4d7b6fcfcd 100644
--- a/actions/backupaccount.php
+++ b/actions/backupaccount.php
@@ -149,7 +149,7 @@ class BackupaccountAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/block.php b/actions/block.php
index 53d8ae7ae0..018c6782fc 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -53,7 +53,7 @@ class BlockAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
@@ -78,7 +78,7 @@ class BlockAction extends ProfileFormAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) {
@@ -220,7 +220,8 @@ class BlockAction extends ProfileFormAction
function defaultReturnTo()
{
$user = common_current_user();
- if ($user) {
+
+ if ($user instanceof User) {
return common_local_url('subscribers',
array('nickname' => $user->nickname));
} else {
diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php
index a2e7c5767f..60f108dee3 100644
--- a/actions/blockedfromgroup.php
+++ b/actions/blockedfromgroup.php
@@ -44,7 +44,7 @@ class BlockedfromgroupAction extends GroupAction
{
var $page = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -151,7 +151,7 @@ class GroupBlockList extends ProfileList
$this->group = $group;
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new GroupBlockListItem($profile, $this->group, $this->action);
}
diff --git a/actions/cancelgroup.php b/actions/cancelgroup.php
index 93f630e060..90675d79bc 100644
--- a/actions/cancelgroup.php
+++ b/actions/cancelgroup.php
@@ -50,7 +50,7 @@ class CancelgroupAction extends Action
/**
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -127,7 +127,7 @@ class CancelgroupAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 806851001e..e2e8c1b834 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -60,7 +60,7 @@ class ConfirmaddressAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (!common_logged_in()) {
diff --git a/actions/deleteaccount.php b/actions/deleteaccount.php
index 8b80c6c6f2..cd7f6578fc 100644
--- a/actions/deleteaccount.php
+++ b/actions/deleteaccount.php
@@ -108,7 +108,7 @@ class DeleteaccountAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/actions/deleteapplication.php b/actions/deleteapplication.php
index 5d7441098c..1d9e6d1bb5 100644
--- a/actions/deleteapplication.php
+++ b/actions/deleteapplication.php
@@ -51,7 +51,7 @@ class DeleteapplicationAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
@@ -89,7 +89,7 @@ class DeleteapplicationAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/deletegroup.php b/actions/deletegroup.php
index c64bc1d8e9..87f518eb41 100644
--- a/actions/deletegroup.php
+++ b/actions/deletegroup.php
@@ -55,7 +55,7 @@ class DeletegroupAction extends RedirectingAction
* @fixme merge common setup code with other group actions
* @fixme allow group admins to delete their own groups
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -114,7 +114,7 @@ class DeletegroupAction extends RedirectingAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/deleteuser.php b/actions/deleteuser.php
index 6b74575ab4..fd0beb80ac 100644
--- a/actions/deleteuser.php
+++ b/actions/deleteuser.php
@@ -51,7 +51,7 @@ class DeleteuserAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
@@ -85,7 +85,7 @@ class DeleteuserAction extends ProfileFormAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) {
diff --git a/actions/doc.php b/actions/doc.php
index 694544dd03..d897b4e58c 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -86,7 +86,7 @@ class DocAction extends ManagedAction
*
* @return boolean read-only flag (false)
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/editapplication.php b/actions/editapplication.php
index c7e5f9052c..95ed98ad90 100644
--- a/actions/editapplication.php
+++ b/actions/editapplication.php
@@ -57,7 +57,7 @@ class EditApplicationAction extends Action
/**
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -94,7 +94,7 @@ class EditApplicationAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/editpeopletag.php b/actions/editpeopletag.php
index 45c8adaa7d..4e00cb2442 100644
--- a/actions/editpeopletag.php
+++ b/actions/editpeopletag.php
@@ -60,7 +60,7 @@ class EditpeopletagAction extends Action
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -135,7 +135,7 @@ class EditpeopletagAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/featured.php b/actions/featured.php
index 394cfe6a8b..dfd9f6f3be 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -49,12 +49,12 @@ class FeaturedAction extends Action
{
var $page = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -74,7 +74,7 @@ class FeaturedAction extends Action
}
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/foaf.php b/actions/foaf.php
index 260388ba44..4420c2d503 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -26,7 +26,7 @@ define('BOTH', 0);
// @todo XXX: Documentation missing.
class FoafAction extends ManagedAction
{
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/foafgroup.php b/actions/foafgroup.php
index f9c61ac5dc..a9cf5d9dc0 100644
--- a/actions/foafgroup.php
+++ b/actions/foafgroup.php
@@ -30,12 +30,12 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
// @todo XXX: Documentation missing.
class FoafGroupAction extends Action
{
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -76,7 +76,7 @@ class FoafGroupAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/geocode.php b/actions/geocode.php
index 9e208914c1..a0cd2fa159 100644
--- a/actions/geocode.php
+++ b/actions/geocode.php
@@ -47,7 +47,7 @@ class GeocodeAction extends Action
var $lon = null;
var $location = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$token = $this->trimmed('token');
@@ -70,7 +70,7 @@ class GeocodeAction extends Action
* @return nothing
*
*/
- function handle($args)
+ function handle(array $args=array())
{
header('Content-Type: application/json; charset=utf-8');
$location_object = array();
@@ -90,7 +90,7 @@ class GeocodeAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/getfile.php b/actions/getfile.php
index f0c98f7416..abdf5b69fc 100644
--- a/actions/getfile.php
+++ b/actions/getfile.php
@@ -86,7 +86,7 @@ class GetfileAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/grantrole.php b/actions/grantrole.php
index 35f0dcf961..59cb1cdd8e 100644
--- a/actions/grantrole.php
+++ b/actions/grantrole.php
@@ -49,7 +49,7 @@ class GrantRoleAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/groupblock.php b/actions/groupblock.php
index d65b62bdff..209284a85d 100644
--- a/actions/groupblock.php
+++ b/actions/groupblock.php
@@ -52,7 +52,7 @@ class GroupblockAction extends RedirectingAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
if (!common_logged_in()) {
@@ -110,7 +110,7 @@ class GroupblockAction extends RedirectingAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/groupbyid.php b/actions/groupbyid.php
index de87ec5c67..448924bf47 100644
--- a/actions/groupbyid.php
+++ b/actions/groupbyid.php
@@ -47,7 +47,7 @@ class GroupbyidAction extends ManagedAction
/** group we're viewing. */
protected $group = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/groupmembers.php b/actions/groupmembers.php
index 44c4dd6f99..b83854d043 100644
--- a/actions/groupmembers.php
+++ b/actions/groupmembers.php
@@ -47,7 +47,7 @@ class GroupmembersAction extends GroupAction
{
var $page = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/groupqueue.php b/actions/groupqueue.php
index c50eff36f8..060b5a2e7d 100644
--- a/actions/groupqueue.php
+++ b/actions/groupqueue.php
@@ -47,7 +47,7 @@ class GroupqueueAction extends GroupAction
{
var $page = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -153,7 +153,7 @@ class GroupqueueAction extends GroupAction
// @todo FIXME: documentation missing.
class GroupQueueList extends GroupMemberList
{
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new GroupQueueListItem($profile, $this->group, $this->action);
}
diff --git a/actions/grouprss.php b/actions/grouprss.php
index 14d85d89cd..166118b4ea 100644
--- a/actions/grouprss.php
+++ b/actions/grouprss.php
@@ -51,7 +51,7 @@ class GroupRssAction extends TargetedRss10Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/groups.php b/actions/groups.php
index d1bc8d9458..1bbce26f20 100644
--- a/actions/groups.php
+++ b/actions/groups.php
@@ -50,7 +50,7 @@ class GroupsAction extends Action
var $page = null;
var $profile = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -67,14 +67,14 @@ class GroupsAction extends Action
}
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/actions/groupunblock.php b/actions/groupunblock.php
index a24177f64c..a72486be48 100644
--- a/actions/groupunblock.php
+++ b/actions/groupunblock.php
@@ -52,7 +52,7 @@ class GroupunblockAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
if (!common_logged_in()) {
@@ -103,7 +103,7 @@ class GroupunblockAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/invite.php b/actions/invite.php
index 89b7e83bf6..0deb7a76ee 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -33,12 +33,12 @@ class InviteAction extends Action
return;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (!common_config('invite', 'enabled')) {
@@ -74,6 +74,7 @@ class InviteAction extends Action
$bestname = $profile->getBestName();
$sitename = common_config('site', 'name');
$personal = $this->trimmed('personal');
+ $language = $this->trimmed('language');
$addresses = explode("\n", $this->trimmed('addresses'));
foreach ($addresses as $email) {
@@ -128,7 +129,7 @@ class InviteAction extends Action
} catch (NoSuchUserException $e) {
// If email was not known, let's send an invite!
$this->sent[] = $email;
- $this->sendInvitation($email, $user, $personal);
+ $this->sendInvitation($email, $user, $personal, $language);
}
}
@@ -248,7 +249,7 @@ class InviteAction extends Action
}
}
- function sendInvitation($email, $user, $personal)
+ function sendInvitation($email, $user, $personal, $language)
{
$profile = $user->getProfile();
$bestname = $profile->getBestName();
@@ -284,7 +285,7 @@ class InviteAction extends Action
$title = (empty($personal)) ? 'invite' : 'invitepersonal';
// @todo FIXME: i18n issue.
- $inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths());
+ $inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths(), $language);
$body = $inviteTemplate->toHTML(array('inviter' => $bestname,
'inviterurl' => $profile->profileurl,
diff --git a/actions/logout.php b/actions/logout.php
index 5394a38c9f..b9dfe3b811 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -47,11 +47,16 @@ class LogoutAction extends ManagedAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
+ /**
+ * Class handler.
+ *
+ * @return nothing
+ */
protected function doPreparation()
{
if (!common_logged_in()) {
diff --git a/actions/makeadmin.php b/actions/makeadmin.php
index 05912e150c..24a7c02ee8 100644
--- a/actions/makeadmin.php
+++ b/actions/makeadmin.php
@@ -54,7 +54,7 @@ class MakeadminAction extends RedirectingAction
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
if (!common_logged_in()) {
@@ -111,7 +111,7 @@ class MakeadminAction extends RedirectingAction
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/microsummary.php b/actions/microsummary.php
index 2742eb9a04..03348617da 100644
--- a/actions/microsummary.php
+++ b/actions/microsummary.php
@@ -51,7 +51,7 @@ class MicrosummaryAction extends Action
*
* @return nothing
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
@@ -75,7 +75,7 @@ class MicrosummaryAction extends Action
print $user->nickname . ': ' . $notice->content;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index fd8fdf68e5..bcd2eb5065 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -50,7 +50,7 @@ class NoticesearchAction extends SearchAction
{
protected $q = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -186,7 +186,7 @@ class SearchNoticeList extends NoticeList {
$this->terms = $terms;
}
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new SearchNoticeListItem($notice, $this->out, $this->terms);
}
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index 2a5187b885..c19723ec33 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -89,7 +89,7 @@ class NoticesearchrssAction extends Rss10Action
return null;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/nudge.php b/actions/nudge.php
index 801d1f0681..5ceaa18063 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -55,7 +55,7 @@ class NudgeAction extends Action
*
* @return nothing
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
@@ -125,7 +125,7 @@ class NudgeAction extends Action
}
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/opensearch.php b/actions/opensearch.php
index b1529860a8..c3a494be1b 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -53,7 +53,7 @@ class OpensearchAction extends Action
*
* @return boolean false if user doesn't exist
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$type = $this->trimmed('type');
@@ -85,7 +85,7 @@ class OpensearchAction extends Action
$this->endXML();
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/otp.php b/actions/otp.php
index c44f3673ae..143eb6bdc1 100644
--- a/actions/otp.php
+++ b/actions/otp.php
@@ -53,7 +53,7 @@ class OtpAction extends Action
var $returnto;
var $lt;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -110,7 +110,7 @@ class OtpAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/peopletag.php b/actions/peopletag.php
index b0a6e2635d..46bdd165cf 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -44,7 +44,7 @@ class PeopletagAction extends Action
var $page = null;
var $tag = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -62,7 +62,7 @@ class PeopletagAction extends Action
}
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -84,7 +84,7 @@ class PeopletagAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/actions/peopletagautocomplete.php b/actions/peopletagautocomplete.php
index c239c03bfb..ee194e8381 100644
--- a/actions/peopletagautocomplete.php
+++ b/actions/peopletagautocomplete.php
@@ -44,7 +44,7 @@ class PeopletagautocompleteAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -112,9 +112,9 @@ class PeopletagautocompleteAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
- //common_log(LOG_DEBUG, 'Autocomplete data: ' . json_encode($this->tags));
+ //common_debug('Autocomplete data: ' . json_encode($this->tags));
if ($this->tags) {
print(json_encode($this->tags));
exit(0);
diff --git a/actions/peopletagged.php b/actions/peopletagged.php
index cf9ec053ed..98e0cd7125 100644
--- a/actions/peopletagged.php
+++ b/actions/peopletagged.php
@@ -48,12 +48,12 @@ class PeopletaggedAction extends Action
var $peopletag = null;
var $tagger = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -117,7 +117,7 @@ class PeopletaggedAction extends Action
}
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -167,7 +167,7 @@ class PeopletagMemberList extends ProfileList
$this->peopletag = $peopletag;
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new PeopletagMemberListItem($profile, $this->peopletag, $this->action);
}
diff --git a/actions/peopletagsbyuser.php b/actions/peopletagsbyuser.php
index 4a04ea2fbb..7a78a9fe8f 100644
--- a/actions/peopletagsbyuser.php
+++ b/actions/peopletagsbyuser.php
@@ -39,7 +39,7 @@ class PeopletagsbyuserAction extends Action
var $tagger = null;
var $tags = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -68,7 +68,7 @@ class PeopletagsbyuserAction extends Action
}
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -135,15 +135,15 @@ class PeopletagsbyuserAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
- # Post from the tag dropdown; redirect to a GET
+ // Post from the tag dropdown; redirect to a GET
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
- }
+ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
+ }
$this->showPage();
}
diff --git a/actions/peopletagsforuser.php b/actions/peopletagsforuser.php
index 7679be0b86..8dd94e33bf 100644
--- a/actions/peopletagsforuser.php
+++ b/actions/peopletagsforuser.php
@@ -38,7 +38,7 @@ class PeopletagsforuserAction extends Action
var $page = null;
var $tagged = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -54,7 +54,7 @@ class PeopletagsforuserAction extends Action
}
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -95,7 +95,7 @@ class PeopletagsforuserAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/actions/peopletagsubscribers.php b/actions/peopletagsubscribers.php
index 589d49caa3..dcb3af5c9f 100644
--- a/actions/peopletagsubscribers.php
+++ b/actions/peopletagsubscribers.php
@@ -48,12 +48,12 @@ class PeopletagsubscribersAction extends Action
var $peopletag = null;
var $tagger = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -117,7 +117,7 @@ class PeopletagsubscribersAction extends Action
}
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -167,7 +167,7 @@ class PeopletagSubscriberList extends ProfileList
$this->peopletag = $peopletag;
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new PeopletagSubscriberListItem($profile, $this->peopletag, $this->action);
}
diff --git a/actions/peopletagsubscriptions.php b/actions/peopletagsubscriptions.php
index 64edd09290..4b84bb3688 100644
--- a/actions/peopletagsubscriptions.php
+++ b/actions/peopletagsubscriptions.php
@@ -38,7 +38,7 @@ class PeopletagsubscriptionsAction extends Action
var $page = null;
var $profile = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -56,7 +56,7 @@ class PeopletagsubscriptionsAction extends Action
}
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -97,7 +97,7 @@ class PeopletagsubscriptionsAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/actions/pluginenable.php b/actions/pluginenable.php
index 707cbdecaa..711b1b2c56 100644
--- a/actions/pluginenable.php
+++ b/actions/pluginenable.php
@@ -64,7 +64,7 @@ class PluginEnableAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -121,7 +121,7 @@ class PluginEnableAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
$key = 'disable-' . $this->plugin;
Config::save('plugins', $key, $this->overrideValue());
diff --git a/actions/profilecompletion.php b/actions/profilecompletion.php
index aaf6026eb5..5880752fcf 100644
--- a/actions/profilecompletion.php
+++ b/actions/profilecompletion.php
@@ -68,7 +68,7 @@ class ProfilecompletionAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -120,7 +120,7 @@ class ProfilecompletionAction extends Action
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
$this->msg = null;
diff --git a/actions/profiletagbyid.php b/actions/profiletagbyid.php
index ce7298a2f6..af27b245c8 100644
--- a/actions/profiletagbyid.php
+++ b/actions/profiletagbyid.php
@@ -40,12 +40,12 @@ class ProfiletagbyidAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -83,7 +83,7 @@ class ProfiletagbyidAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
common_redirect($this->peopletag->homeUrl(), 303);
}
diff --git a/actions/publicrss.php b/actions/publicrss.php
index 5dcff3ba3d..85da8ed0c9 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -85,7 +85,7 @@ class PublicrssAction extends Rss10Action
// nop
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php
index db8185bb13..8daf18d504 100644
--- a/actions/publictagcloud.php
+++ b/actions/publictagcloud.php
@@ -46,7 +46,7 @@ define('TAGS_PER_PAGE', 100);
*/
class PublictagcloudAction extends Action
{
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -92,7 +92,7 @@ class PublictagcloudAction extends Action
$this->elementEnd('div');
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -103,18 +103,23 @@ class PublictagcloudAction extends Action
// This should probably be cached rather than recalculated
$tags = new Notice_tag();
- #Need to clear the selection and then only re-add the field
- #we are grouping by, otherwise it's not a valid 'group by'
- #even though MySQL seems to let it slide...
+ /*
+ * Need to clear the selection and then only re-add the field
+ * we are grouping by, otherwise it's not a valid 'group by'
+ * even though MySQL seems to let it slide...
+ */
$tags->selectAdd();
$tags->selectAdd('tag');
+ $tags->selectAdd('notice_id');
+ $tags->selectAdd('scope');
- #Add the aggregated columns...
+ // Add the aggregated columns...
$tags->selectAdd('max(notice_id) as last_notice_id');
$calc = common_sql_weight('created', common_config('tag', 'dropoff'));
$cutoff = sprintf("notice_tag.created > '%s'",
common_sql_date(time() - common_config('tag', 'cutoff')));
$tags->selectAdd($calc . ' as weight');
+ $tags->joinAdd(array('notice_id', 'notice:id'));
$tags->whereAdd($cutoff);
$tags->groupBy('tag');
$tags->orderBy('weight DESC');
@@ -130,8 +135,11 @@ class PublictagcloudAction extends Action
$tw = array();
$sum = 0;
while ($tags->fetch()) {
- $tw[$tags->tag] = $tags->weight;
- $sum += $tags->weight;
+ // Check scope:
+ if ($tags->isCurrentProfileInScope()) {
+ $tw[$tags->tag] = $tags->weight;
+ $sum += $tags->weight;
+ }
}
ksort($tw);
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index a3a5b8e5bc..14ed582db1 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -29,7 +29,7 @@ class RecoverpasswordAction extends Action
var $msg = null;
var $success = null;
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (common_logged_in()) {
diff --git a/actions/redirect.php b/actions/redirect.php
index 9cb03708db..c18a27f3a3 100644
--- a/actions/redirect.php
+++ b/actions/redirect.php
@@ -51,7 +51,7 @@ class RedirectAction extends Action
* @return boolean read-only flag (false)
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -63,7 +63,7 @@ class RedirectAction extends Action
*
* @return nothing
*/
- function handle($args)
+ function handle(array $args=array())
{
common_redirect(common_local_url($this->arg('nextAction'), $this->arg('args')));
}
diff --git a/actions/redirecturl.php b/actions/redirecturl.php
index 826ab66a67..724f46e909 100644
--- a/actions/redirecturl.php
+++ b/actions/redirecturl.php
@@ -59,7 +59,7 @@ class RedirecturlAction extends ManagedAction
common_redirect($this->file->getUrl(false), 301);
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/register.php b/actions/register.php
index 7ab04534f6..f030c279d8 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -120,7 +120,7 @@ class RegisterAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/removepeopletag.php b/actions/removepeopletag.php
index 8192e86b44..ee33517fda 100644
--- a/actions/removepeopletag.php
+++ b/actions/removepeopletag.php
@@ -66,7 +66,7 @@ class RemovepeopletagAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -120,7 +120,7 @@ class RemovepeopletagAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
// Throws exception on error
@@ -129,7 +129,7 @@ class RemovepeopletagAction extends Action
if (!$ptag) {
$user = User::getKV('id', $this->tagged->id);
- if ($user) {
+ if ($user instanceof User) {
$this->clientError(
// TRANS: Client error displayed when an unknown error occurs while delisting a user.
// TRANS: %s is a username.
diff --git a/actions/replies.php b/actions/replies.php
index ae6ec90658..de6c0dac43 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -152,7 +152,7 @@ class RepliesAction extends ShowstreamAction
$this->elementEnd('div');
}
- public function isReadOnly($args)
+ public function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 54f83592c0..e3f04b53a4 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -45,7 +45,7 @@ class RepliesrssAction extends TargetedRss10Action
return $c;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/restoreaccount.php b/actions/restoreaccount.php
index 81c792bd00..6b6cd64f94 100644
--- a/actions/restoreaccount.php
+++ b/actions/restoreaccount.php
@@ -258,7 +258,7 @@ class RestoreaccountAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/actions/revokerole.php b/actions/revokerole.php
index b55399598e..d3ec2ecdfa 100644
--- a/actions/revokerole.php
+++ b/actions/revokerole.php
@@ -49,7 +49,7 @@ class RevokeRoleAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/robotstxt.php b/actions/robotstxt.php
index fdfc2bd1bd..4df04b564a 100644
--- a/actions/robotstxt.php
+++ b/actions/robotstxt.php
@@ -76,7 +76,7 @@ class RobotstxtAction extends ManagedAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/rsd.php b/actions/rsd.php
index bd8042f0cd..6c47eeeff5 100644
--- a/actions/rsd.php
+++ b/actions/rsd.php
@@ -85,7 +85,7 @@ class RsdAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -126,7 +126,7 @@ class RsdAction extends Action
*
* @return nothing
*/
- function handle($args)
+ function handle(array $args=array())
{
header('Content-Type: application/rsd+xml');
@@ -207,7 +207,7 @@ class RsdAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/sandbox.php b/actions/sandbox.php
index af2eab3842..9397a09303 100644
--- a/actions/sandbox.php
+++ b/actions/sandbox.php
@@ -49,7 +49,7 @@ class SandboxAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/selftag.php b/actions/selftag.php
index b886c3d9f7..58f0460997 100644
--- a/actions/selftag.php
+++ b/actions/selftag.php
@@ -158,7 +158,7 @@ class SelftagAction extends Action
class SelfTagProfileList extends ProfileList
{
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new SelfTagProfileListItem($profile, $this->action);
}
diff --git a/actions/showapplication.php b/actions/showapplication.php
index d8ac293d40..c10883942f 100644
--- a/actions/showapplication.php
+++ b/actions/showapplication.php
@@ -65,7 +65,7 @@ class ShowApplicationAction extends Action
*
* @return success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -101,7 +101,7 @@ class ShowApplicationAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 46d0a227f5..da95b6a411 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -56,7 +56,7 @@ class ShowgroupAction extends GroupAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/shownotice.php b/actions/shownotice.php
index 23386868dd..f627b71f71 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -134,7 +134,7 @@ class ShownoticeAction extends ManagedAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/silence.php b/actions/silence.php
index 6a4f84deb9..ac25a0d184 100644
--- a/actions/silence.php
+++ b/actions/silence.php
@@ -49,7 +49,7 @@ class SilenceAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/subedit.php b/actions/subedit.php
index 47fe19ea24..4dc3e855aa 100644
--- a/actions/subedit.php
+++ b/actions/subedit.php
@@ -24,7 +24,7 @@ class SubeditAction extends Action
{
var $profile = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -58,7 +58,7 @@ class SubeditAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 320409afa0..1da061819b 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -64,7 +64,7 @@ class SubscribeAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -118,7 +118,7 @@ class SubscribeAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
// Throws exception on error
diff --git a/actions/subscribepeopletag.php b/actions/subscribepeopletag.php
index b83ff70010..ed9f282cfd 100644
--- a/actions/subscribepeopletag.php
+++ b/actions/subscribepeopletag.php
@@ -50,7 +50,7 @@ class SubscribepeopletagAction extends Action
/**
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -106,7 +106,7 @@ class SubscribepeopletagAction extends Action
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/sup.php b/actions/sup.php
index 911f0d9e55..b871983185 100644
--- a/actions/sup.php
+++ b/actions/sup.php
@@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
// @todo FIXME: documentation needed.
class SupAction extends Action
{
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
@@ -84,7 +84,7 @@ class SupAction extends Action
return $updates;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/tag.php b/actions/tag.php
index 751e8dcec5..9159e7c043 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -122,7 +122,7 @@ class TagAction extends ManagedAction
}
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/tagrss.php b/actions/tagrss.php
index 0d4d68ffba..286d168857 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -54,7 +54,7 @@ class TagrssAction extends Rss10Action
return $c;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/unblock.php b/actions/unblock.php
index 82d0d32c10..cb03214a9f 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -44,7 +44,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class UnblockAction extends ProfileFormAction
{
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/unsandbox.php b/actions/unsandbox.php
index b87736fcff..5e1110aa87 100644
--- a/actions/unsandbox.php
+++ b/actions/unsandbox.php
@@ -49,7 +49,7 @@ class UnsandboxAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/unsilence.php b/actions/unsilence.php
index c01c141b1c..cde37201b1 100644
--- a/actions/unsilence.php
+++ b/actions/unsilence.php
@@ -49,7 +49,7 @@ class UnsilenceAction extends ProfileFormAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
if (!parent::prepare($args)) {
return false;
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 4b85ba427c..ddc222923b 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -44,7 +44,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class UnsubscribeAction extends Action
{
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (!common_logged_in()) {
diff --git a/actions/unsubscribepeopletag.php b/actions/unsubscribepeopletag.php
index b5757ad6fd..42f0c20e6f 100644
--- a/actions/unsubscribepeopletag.php
+++ b/actions/unsubscribepeopletag.php
@@ -51,7 +51,7 @@ class UnsubscribepeopletagAction extends Action
* Prepare to run
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -106,7 +106,7 @@ class UnsubscribepeopletagAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/actions/userrss.php b/actions/userrss.php
index 7bed1dd256..147d98cc26 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -67,7 +67,7 @@ class UserrssAction extends TargetedRss10Action
parent::initRss();
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/actions/version.php b/actions/version.php
index 97115d23cd..49b2682c06 100644
--- a/actions/version.php
+++ b/actions/version.php
@@ -55,7 +55,7 @@ class VersionAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/classes/Avatar.php b/classes/Avatar.php
index 5ce2712dfb..c456bcf1b9 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -64,10 +64,14 @@ class Avatar extends Managed_DataObject
public static function deleteFromProfile(Profile $target, $original=true) {
try {
$avatars = self::getProfileAvatars($target);
+
foreach ($avatars as $avatar) {
+ assert($avatar instanceof Avatar);
+
if ($avatar->original && !$original) {
continue;
}
+
$avatar->delete();
}
} catch (NoAvatarException $e) {
@@ -91,6 +95,7 @@ class Avatar extends Managed_DataObject
}
$size = "{$width}x{$height}";
+
if (!isset(self::$_avatars[$target->id])) {
self::$_avatars[$target->id] = array();
} elseif (isset(self::$_avatars[$target->id][$size])){
@@ -98,6 +103,7 @@ class Avatar extends Managed_DataObject
}
$avatar = null;
+
if (Event::handle('StartProfileGetAvatar', array($target, $width, &$avatar))) {
$avatar = self::pkeyGet(
array(
@@ -106,6 +112,7 @@ class Avatar extends Managed_DataObject
'height' => $height,
)
);
+
Event::handle('EndProfileGetAvatar', array($target, $width, &$avatar));
}
@@ -178,7 +185,7 @@ class Avatar extends Managed_DataObject
}
if ($path[0] != '/') {
- $path = '/'.$path;
+ $path = '/' . $path;
}
$server = common_config('avatar', 'server');
@@ -212,6 +219,12 @@ class Avatar extends Managed_DataObject
try {
return self::byProfile($target, $width, $height)->displayUrl();
} catch (Exception $e) {
+ common_debug(sprintf('target=>id=%s,width=%s,height=%s,message=%s',
+ $target->id,
+ $width,
+ $height,
+ $e->getMessage()
+ ));
return self::defaultImage($width);
}
}
@@ -221,7 +234,7 @@ class Avatar extends Managed_DataObject
static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
AVATAR_STREAM_SIZE => 'stream',
AVATAR_MINI_SIZE => 'mini');
- return Theme::path('default-avatar-'.$sizenames[$size].'.png');
+ return Theme::path('default-avatar-' . $sizenames[$size] . '.png');
}
static function newSize(Profile $target, $width) {
diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php
index 97e1a75dab..af9dc9157e 100644
--- a/classes/Confirm_address.php
+++ b/classes/Confirm_address.php
@@ -49,7 +49,7 @@ class Confirm_address extends Managed_DataObject
return null;
}
- static function saveNew($user, $address, $addressType, $extra=null)
+ static function saveNew(User $user, $address, $addressType, $extra=null)
{
$ca = new Confirm_address();
diff --git a/classes/File.php b/classes/File.php
index 2390f848de..735655489b 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -423,6 +423,9 @@ class File extends Managed_DataObject
}
}
+ // Debug log (convert crop to int to have TRUE being displayed as 1 and FALSE as 0)
+ /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop));
+
return $image->getFileThumbnail($width, $height, $crop);
}
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
index 03df3de1b1..1cbf6796c0 100644
--- a/classes/File_redirection.php
+++ b/classes/File_redirection.php
@@ -338,7 +338,7 @@ class File_redirection extends Managed_DataObject
return $out_url;
}
- static function saveNew($data, $file_id, $url) {
+ static function saveNew(array $data, $file_id, $url) {
$file_redir = new File_redirection;
$file_redir->urlhash = File::hashurl($url);
$file_redir->url = $url;
@@ -397,4 +397,4 @@ class File_redirection extends Managed_DataObject
return $this->file;
}
-}
\ No newline at end of file
+}
diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php
index 186ffc50a0..ccfcd0e5ae 100644
--- a/classes/File_thumbnail.php
+++ b/classes/File_thumbnail.php
@@ -61,6 +61,9 @@ class File_thumbnail extends Managed_DataObject
* @param int $file_id
*/
public static function saveNew($data, $file_id) {
+ // @TODO Must be an object (see below code)
+ assert(is_object($data));
+
if (!empty($data->thumbnail_url)) {
// Non-photo types such as video will usually
// show us a thumbnail, though it's not required.
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 41ce715210..b5057ba220 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -650,7 +650,7 @@ class Memcached_DataObject extends Safe_DataObject
} else {
$msg = sprintf("DB query (%0.3fs): %s", $delta, $clean);
}
- common_log(LOG_DEBUG, $msg);
+ common_debug($msg);
}
if ($fail) {
diff --git a/classes/Notice.php b/classes/Notice.php
index 60c821ae5d..f40e94f461 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -330,7 +330,7 @@ class Notice extends Managed_DataObject
* Record the given set of hash tags in the db for this notice.
* Given tag strings will be normalized and checked for dupes.
*/
- function saveKnownTags($hashtags)
+ function saveKnownTags(array $hashtags)
{
//turn each into their canonical tag
//this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
@@ -414,7 +414,7 @@ class Notice extends Managed_DataObject
* @return Notice
* @throws ClientException
*/
- static function saveNew($profile_id, $content, $source, array $options=null) {
+ static function saveNew($profile_id, $content, $source, array $options=array()) {
$defaults = array('uri' => null,
'url' => null,
'conversation' => null, // URI of conversation
@@ -425,13 +425,16 @@ class Notice extends Managed_DataObject
'object_type' => null,
'verb' => null);
- if (!empty($options) && is_array($options)) {
+ /*
+ * Above type-hint is already array, so simply count it, this saves
+ * "some" CPU cycles.
+ */
+ if (count($options) > 0) {
$options = array_merge($defaults, $options);
- extract($options);
- } else {
- extract($defaults);
}
+ extract($options);
+
if (!isset($is_local)) {
$is_local = Notice::LOCAL_PUBLIC;
}
@@ -532,8 +535,7 @@ class Notice extends Managed_DataObject
throw new ClientException(_('You cannot repeat your own notice.'));
}
- if ($repeat->scope != Notice::SITE_SCOPE &&
- $repeat->scope != Notice::PUBLIC_SCOPE) {
+ if ($repeat->isPrivateScope()) {
// TRANS: Client error displayed when trying to repeat a non-public notice.
throw new ClientException(_('Cannot repeat a private notice.'), 403);
}
@@ -1151,7 +1153,7 @@ class Notice extends Managed_DataObject
*
* @return void
*/
- function saveKnownUrls($urls)
+ function saveKnownUrls(array $urls)
{
if (common_config('attachments', 'process_links')) {
// @fixme validation?
@@ -1763,7 +1765,7 @@ class Notice extends Managed_DataObject
return $this->_replies[$this->getID()];
}
- function _setReplies($replies)
+ function _setReplies(array $replies)
{
$this->_replies[$this->getID()] = $replies;
}
@@ -1858,11 +1860,11 @@ class Notice extends Managed_DataObject
}
$groups = User_group::multiGet('id', $ids);
- $this->_groups[$this->id] = $groups->fetchAll();
+ $this->_setGroups($groups->fetchAll());
return $this->_groups[$this->id];
}
- function _setGroups($groups)
+ function _setGroups(array $groups)
{
$this->_groups[$this->id] = $groups;
}
@@ -2577,6 +2579,37 @@ class Notice extends Managed_DataObject
*/
public function getTags()
{
+ // Check default scope (non-private notices)
+ $inScope = (!$this->isPrivateScope());
+
+ // Get current profile
+ $profile = Profile::current();
+
+ // Is the general scope check okay and the user in logged in?
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: inScope=' . intval($inScope) . ',profile[]=' . gettype($profile));
+ if (($inScope === TRUE) && ($profile instanceof Profile)) {
+ /*
+ * Check scope, else a privacy leaks happens this way:
+ *
+ * 1) Bob and Alice follow each other and write private notices
+ * (this->scope=2) to each other.
+ * 2) Bob uses tags in his private notice to alice (which she can
+ * read from him).
+ * 3) Alice adds that notice (with tags) to her favorites
+ * ("faving") it.
+ * 4) The tags from Bob's private notice becomes visible in Alice's
+ * profile.
+ *
+ * This has the simple background that the scope is not being
+ * re-checked. This has to be done here at this point because given
+ * above scenario is a privacy leak as the tags may be *really*
+ * private (nobody else shall see them) such as initmate words or
+ * very political words.
+ */
+ $inScope = $this->inScope($profile);
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: inScope=' . intval($inScope) . ' - After inScope() has been called.');
+ }
+
$tags = array();
$keypart = sprintf('notice:tags:%d', $this->id);
@@ -2588,7 +2621,9 @@ class Notice extends Managed_DataObject
} else {
$tag = new Notice_tag();
$tag->notice_id = $this->id;
- if ($tag->find()) {
+
+ // Check scope for privacy-leak protection (see some lines above why)
+ if (($inScope === TRUE) && ($tag->find())) {
while ($tag->fetch()) {
$tags[] = $tag->tag;
}
@@ -2730,7 +2765,7 @@ class Notice extends Managed_DataObject
*
* @return boolean whether the profile is in the notice's scope
*/
- function inScope($profile)
+ function inScope(Profile $profile=null)
{
if (is_null($profile)) {
$keypart = sprintf('notice:in-scope-for:%d:null', $this->id);
@@ -2753,7 +2788,7 @@ class Notice extends Managed_DataObject
return ($result == 1) ? true : false;
}
- protected function _inScope($profile)
+ protected function _inScope(Profile $profile=null)
{
$scope = is_null($this->scope) ? self::defaultScope() : $this->getScope();
@@ -2818,7 +2853,7 @@ class Notice extends Managed_DataObject
return !$this->isHiddenSpam($profile);
}
- function isHiddenSpam($profile) {
+ function isHiddenSpam(Profile $profile=null) {
// Hide posts by silenced users from everyone but moderators.
@@ -2903,7 +2938,7 @@ class Notice extends Managed_DataObject
return $scope;
}
- static function fillProfiles($notices)
+ static function fillProfiles(array $notices)
{
$map = self::getProfiles($notices);
foreach ($notices as $entry=>$notice) {
@@ -2920,7 +2955,7 @@ class Notice extends Managed_DataObject
return array_values($map);
}
- static function getProfiles(&$notices)
+ static function getProfiles(array &$notices)
{
$ids = array();
foreach ($notices as $notice) {
@@ -2930,7 +2965,7 @@ class Notice extends Managed_DataObject
return Profile::pivotGet('id', $ids);
}
- static function fillGroups(&$notices)
+ static function fillGroups(array &$notices)
{
$ids = self::_idsOf($notices);
$gis = Group_inbox::listGet('notice_id', $ids);
@@ -2965,7 +3000,7 @@ class Notice extends Managed_DataObject
return array_keys($ids);
}
- static function fillAttachments(&$notices)
+ static function fillAttachments(array &$notices)
{
$ids = self::_idsOf($notices);
$f2pMap = File_to_post::listGet('post_id', $ids);
@@ -2989,7 +3024,7 @@ class Notice extends Managed_DataObject
}
}
- static function fillReplies(&$notices)
+ static function fillReplies(array &$notices)
{
$ids = self::_idsOf($notices);
$replyMap = Reply::listGet('notice_id', $ids);
diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php
index b864de8009..ecfa9dcf44 100644
--- a/classes/Notice_tag.php
+++ b/classes/Notice_tag.php
@@ -81,4 +81,49 @@ class Notice_tag extends Managed_DataObject
return $url;
}
+
+ /**
+ * Checks whether the current profile is allowed (in scope) to see this tag.
+ *
+ * @return $inScope Whether the current profile is allowed to see this tag
+ */
+ function isCurrentProfileInScope () {
+ // Check scope, default is allowed
+ $inScope = TRUE;
+
+ // 1) Get notice object and set id
+ $notice = new Notice();
+ $notice->id = $this->notice_id;
+
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] this->tag=' . $this->tag . ',this->notice_id=' . $this->notice_id . ' - Calling find() ... fetch() ...');
+
+ // Fetch notice
+ if ((!$notice->find()) || (!$notice->fetch())) {
+ // No longer valid, so better don't allow to see it
+ return FALSE;
+ }
+
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] this->tag=' . $this->tag . ',notice->id=' . $notice->id . ',notice->scope=' . $notice->scope);
+
+ // Is it private scope?
+ if ($notice->isPrivateScope()) {
+ // 2) Get current profile
+ $profile = Profile::current();
+
+ // Is the profile not set?
+ if (!$profile instanceof Profile) {
+ // Public viewer shall not see a tag from a private dent (privacy leak)
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] Not logged in (public view).');
+ $inScope = FALSE;
+ } elseif (!$notice->inScope($profile)) {
+ // Current profile is not in scope (not allowed to see) of notice
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] profile->id=' . $profile->id . ' is not allowed to see this tag.');
+ $inScope = FALSE;
+ }
+ }
+
+ // Return result
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] this->tag=' . $this->tag . ',this->weight=' . $this->weight . ',inScope=' . intval($inScope) . ' - EXIT!');
+ return $inScope;
+ }
}
diff --git a/classes/User_group.php b/classes/User_group.php
index 2484f3f265..d89f3376f8 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -92,9 +92,22 @@ class User_group extends Managed_DataObject
{
if (!isset($this->_profile[$this->profile_id])) {
$profile = Profile::getKV('id', $this->profile_id);
+
if (!$profile instanceof Profile) {
- throw new GroupNoProfileException($this);
+
+ $profile = new Profile();
+ $profile->nickname = $this->nickname;
+ $profile->fullname = $this->fullname;
+ $profile->profileurl = $this->mainpage;
+ $profile->homepage = $this->homepage;
+ $profile->bio = $this->description;
+ $profile->location = $this->location;
+ $profile->created = common_sql_now();
+ $this->profile_id = $profile->insert();
+
+ //throw new GroupNoProfileException($this);
}
+
$this->_profile[$this->profile_id] = $profile;
}
return $this->_profile[$this->profile_id];
diff --git a/extlib/DB/DataObject/createTables.php b/extlib/DB/DataObject/createTables.php
old mode 100755
new mode 100644
diff --git a/index.php b/index.php
index 44599d68e9..c68e8836fd 100644
--- a/index.php
+++ b/index.php
@@ -37,6 +37,9 @@
* @license GNU Affero General Public License http://www.gnu.org/licenses/
*/
+// Comment in if you have xdebug installed and need a detailed backtrace:
+//xdebug_start_trace();
+
$_startTime = microtime(true);
$_perfCounters = array();
@@ -314,14 +317,14 @@ function main()
} else {
try {
call_user_func("$action_class::run", $args);
- } catch (ClientException $cex) {
- $cac = new ClientErrorAction($cex->getMessage(), $cex->getCode());
+ } catch (ClientException $e) {
+ $cac = new ClientErrorAction($e->getMessage(), $e->getCode());
$cac->showPage();
- } catch (ServerException $sex) { // snort snort guffaw
- $sac = new ServerErrorAction($sex->getMessage(), $sex->getCode(), $sex);
+ } catch (ServerException $e) { // snort snort guffaw
+ $sac = new ServerErrorAction($e->getMessage(), $e->getCode(), $e);
$sac->showPage();
- } catch (Exception $ex) {
- $sac = new ServerErrorAction($ex->getMessage(), 500, $ex);
+ } catch (Exception $e) {
+ $sac = new ServerErrorAction($e->getMessage(), 500, $e);
$sac->showPage();
}
}
diff --git a/installer.txt b/installer.txt
new file mode 100644
index 0000000000..b649dc3e2c
--- /dev/null
+++ b/installer.txt
@@ -0,0 +1,649 @@
+.
+ *
+ * @category Installation
+ * @package Installation
+ *
+ * @author Adrian Lang
+ * @author Brenda Wallace
+ * @author Brett Taylor
+ * @author Brion Vibber
+ * @author CiaranG
+ * @author Craig Andrews
+ * @author Eric Helgeson
+ * @author Evan Prodromou
+ * @author Mikael Nordfeldth
+ * @author Robin Millette
+ * @author Sarven Capadisli
+ * @author Tom Adams
+ * @author Zach Copley
+ * @copyright 2009-2010 StatusNet, Inc http://status.net
+ * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
+ * @license GNU Affero General Public License http://www.gnu.org/licenses/
+ * @version 1.0.x
+ * @link http://status.net
+ */
+
+abstract class Installer
+{
+ /** Web site info */
+ public $sitename, $server, $path, $fancy, $siteProfile, $ssl;
+ /** DB info */
+ public $host, $database, $dbtype, $username, $password, $db;
+ /** Administrator info */
+ public $adminNick, $adminPass, $adminEmail, $adminUpdates;
+ /** Should we skip writing the configuration file? */
+ public $skipConfig = false;
+
+ public static $dbModules = array(
+ 'mysql' => array(
+ 'name' => 'MySQL',
+ 'check_module' => 'mysqli',
+ 'scheme' => 'mysqli', // DSN prefix for PEAR::DB
+ ),
+ 'pgsql' => array(
+ 'name' => 'PostgreSQL',
+ 'check_module' => 'pgsql',
+ 'scheme' => 'pgsql', // DSN prefix for PEAR::DB
+ ),
+ );
+
+ /**
+ * Attempt to include a PHP file and report if it worked, while
+ * suppressing the annoying warning messages on failure.
+ */
+ private function haveIncludeFile($filename) {
+ $old = error_reporting(error_reporting() & ~E_WARNING);
+ $ok = include_once($filename);
+ error_reporting($old);
+ return $ok;
+ }
+
+ /**
+ * Check if all is ready for installation
+ *
+ * @return void
+ */
+ function checkPrereqs()
+ {
+ $pass = true;
+
+ $config = INSTALLDIR.'/config.php';
+ if (file_exists($config)) {
+ if (!is_writable($config) || filesize($config) > 0) {
+ if (filesize($config) == 0) {
+ $this->warning('Config file "config.php" already exists and is empty, but is not writable.');
+ } else {
+ $this->warning('Config file "config.php" already exists.');
+ }
+ $pass = false;
+ }
+ }
+
+ if (version_compare(PHP_VERSION, '5.3.2', '<')) {
+ $this->warning('Require PHP version 5.3.2 or greater.');
+ $pass = false;
+ }
+
+ $reqs = array('gd', 'curl', 'json',
+ 'xmlwriter', 'mbstring', 'xml', 'dom', 'simplexml');
+
+ foreach ($reqs as $req) {
+ if (!$this->checkExtension($req)) {
+ $this->warning(sprintf('Cannot load required extension: %s
', $req));
+ $pass = false;
+ }
+ }
+
+ // Make sure we have at least one database module available
+ $missingExtensions = array();
+ foreach (self::$dbModules as $type => $info) {
+ if (!$this->checkExtension($info['check_module'])) {
+ $missingExtensions[] = $info['check_module'];
+ }
+ }
+
+ if (count($missingExtensions) == count(self::$dbModules)) {
+ $req = implode(', ', $missingExtensions);
+ $this->warning(sprintf('Cannot find a database extension. You need at least one of %s.', $req));
+ $pass = false;
+ }
+
+ // @fixme this check seems to be insufficient with Windows ACLs
+ if (!is_writable(INSTALLDIR)) {
+ $this->warning(sprintf('Cannot write config file to: %s
', INSTALLDIR),
+ sprintf('On your server, try this command: chmod a+w %s
', INSTALLDIR));
+ $pass = false;
+ }
+
+ // Check the subdirs used for file uploads
+ $fileSubdirs = array('avatar', 'background', 'file');
+ foreach ($fileSubdirs as $fileSubdir) {
+ $fileFullPath = INSTALLDIR."/$fileSubdir/";
+ if (!is_writable($fileFullPath)) {
+ $this->warning(sprintf('Cannot write to %s directory: %s
', $fileSubdir, $fileFullPath),
+ sprintf('On your server, try this command: chmod a+w %s
', $fileFullPath));
+ $pass = false;
+ }
+ }
+
+ return $pass;
+ }
+
+ /**
+ * Checks if a php extension is both installed and loaded
+ *
+ * @param string $name of extension to check
+ *
+ * @return boolean whether extension is installed and loaded
+ */
+ function checkExtension($name)
+ {
+ if (extension_loaded($name)) {
+ return true;
+ } elseif (function_exists('dl') && ini_get('enable_dl') && !ini_get('safe_mode')) {
+ // dl will throw a fatal error if it's disabled or we're in safe mode.
+ // More fun, it may not even exist under some SAPIs in 5.3.0 or later...
+ $soname = $name . '.' . PHP_SHLIB_SUFFIX;
+ if (PHP_SHLIB_SUFFIX == 'dll') {
+ $soname = "php_" . $soname;
+ }
+ return @dl($soname);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Basic validation on the database paramters
+ * Side effects: error output if not valid
+ *
+ * @return boolean success
+ */
+ function validateDb()
+ {
+ $fail = false;
+
+ if (empty($this->host)) {
+ $this->updateStatus("No hostname specified.", true);
+ $fail = true;
+ }
+
+ if (empty($this->database)) {
+ $this->updateStatus("No database specified.", true);
+ $fail = true;
+ }
+
+ if (empty($this->username)) {
+ $this->updateStatus("No username specified.", true);
+ $fail = true;
+ }
+
+ if (empty($this->sitename)) {
+ $this->updateStatus("No sitename specified.", true);
+ $fail = true;
+ }
+
+ return !$fail;
+ }
+
+ /**
+ * Basic validation on the administrator user paramters
+ * Side effects: error output if not valid
+ *
+ * @return boolean success
+ */
+ function validateAdmin()
+ {
+ $fail = false;
+
+ if (empty($this->adminNick)) {
+ $this->updateStatus("No initial user nickname specified.", true);
+ $fail = true;
+ }
+ if ($this->adminNick && !preg_match('/^[0-9a-z]{1,64}$/', $this->adminNick)) {
+ $this->updateStatus('The user nickname "' . htmlspecialchars($this->adminNick) .
+ '" is invalid; should be plain letters and numbers no longer than 64 characters.', true);
+ $fail = true;
+ }
+ // @fixme hardcoded list; should use Nickname::isValid()
+ // if/when it's safe to have loaded the infrastructure here
+ $blacklist = array('main', 'panel', 'twitter', 'settings', 'rsd.xml', 'favorited', 'featured', 'favoritedrss', 'featuredrss', 'rss', 'getfile', 'api', 'groups', 'group', 'peopletag', 'tag', 'user', 'message', 'conversation', 'bookmarklet', 'notice', 'attachment', 'search', 'index.php', 'doc', 'opensearch', 'robots.txt', 'xd_receiver.html', 'facebook');
+ if (in_array($this->adminNick, $blacklist)) {
+ $this->updateStatus('The user nickname "' . htmlspecialchars($this->adminNick) .
+ '" is reserved.', true);
+ $fail = true;
+ }
+
+ if (empty($this->adminPass)) {
+ $this->updateStatus("No initial user password specified.", true);
+ $fail = true;
+ }
+
+ return !$fail;
+ }
+
+ /**
+ * Make sure a site profile was selected
+ *
+ * @return type boolean success
+ */
+ function validateSiteProfile()
+ {
+ if (empty($this->siteProfile)) {
+ $this->updateStatus("No site profile selected.", true);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Set up the database with the appropriate function for the selected type...
+ * Saves database info into $this->db.
+ *
+ * @fixme escape things in the connection string in case we have a funny pass etc
+ * @return mixed array of database connection params on success, false on failure
+ */
+ function setupDatabase()
+ {
+ if ($this->db) {
+ throw new Exception("Bad order of operations: DB already set up.");
+ }
+ $this->updateStatus("Starting installation...");
+
+ if (empty($this->password)) {
+ $auth = '';
+ } else {
+ $auth = ":$this->password";
+ }
+ $scheme = self::$dbModules[$this->dbtype]['scheme'];
+ $dsn = "{$scheme}://{$this->username}{$auth}@{$this->host}/{$this->database}";
+
+ $this->updateStatus("Checking database...");
+ $conn = $this->connectDatabase($dsn);
+
+ // ensure database encoding is UTF8
+ if ($this->dbtype == 'mysql') {
+ // @fixme utf8m4 support for mysql 5.5?
+ // Force the comms charset to utf8 for sanity
+ // This doesn't currently work. :P
+ //$conn->executes('set names utf8');
+ } else if ($this->dbtype == 'pgsql') {
+ $record = $conn->getRow('SHOW server_encoding');
+ if ($record->server_encoding != 'UTF8') {
+ $this->updateStatus("GNU social requires UTF8 character encoding. Your database is ". htmlentities($record->server_encoding));
+ return false;
+ }
+ }
+
+ $res = $this->updateStatus("Creating database tables...");
+ if (!$this->createCoreTables($conn)) {
+ $this->updateStatus("Error creating tables.", true);
+ return false;
+ }
+
+ foreach (array('sms_carrier' => 'SMS carrier',
+ 'notice_source' => 'notice source',
+ 'foreign_services' => 'foreign service')
+ as $scr => $name) {
+ $this->updateStatus(sprintf("Adding %s data to database...", $name));
+ $res = $this->runDbScript($scr.'.sql', $conn);
+ if ($res === false) {
+ $this->updateStatus(sprintf("Can't run %s script.", $name), true);
+ return false;
+ }
+ }
+
+ $db = array('type' => $this->dbtype, 'database' => $dsn);
+ return $db;
+ }
+
+ /**
+ * Open a connection to the database.
+ *
+ * @param $dsn
+ * @return
+ */
+ function connectDatabase($dsn)
+ {
+ global $_DB;
+ return $_DB->connect($dsn);
+ }
+
+ /**
+ * Create core tables on the given database connection.
+ *
+ * @param DB_common $conn
+ */
+ function createCoreTables(DB_common $conn)
+ {
+ $schema = Schema::get($conn);
+ $tableDefs = $this->getCoreSchema();
+ foreach ($tableDefs as $name => $def) {
+ if (defined('DEBUG_INSTALLER')) {
+ echo " $name ";
+ }
+ $schema->ensureTable($name, $def);
+ }
+ return true;
+ }
+
+ /**
+ * Fetch the core table schema definitions.
+ *
+ * @return array of table names => table def arrays
+ */
+ function getCoreSchema()
+ {
+ $schema = array();
+ include INSTALLDIR . '/db/core.php';
+ return $schema;
+ }
+
+ /**
+ * Return a parseable PHP literal for the given value.
+ * This will include quotes for strings, etc.
+ *
+ * @param mixed $val
+ * @return string
+ */
+ function phpVal($val)
+ {
+ return var_export($val, true);
+ }
+
+ /**
+ * Return an array of parseable PHP literal for the given values.
+ * These will include quotes for strings, etc.
+ *
+ * @param mixed $val
+ * @return array
+ */
+ function phpVals($map)
+ {
+ return array_map(array($this, 'phpVal'), $map);
+ }
+
+ /**
+ * Write a stock configuration file.
+ *
+ * @return boolean success
+ *
+ * @fixme escape variables in output in case we have funny chars, apostrophes etc
+ */
+ function writeConf()
+ {
+ $vals = $this->phpVals(array(
+ 'sitename' => $this->sitename,
+ 'server' => $this->server,
+ 'path' => $this->path,
+ 'ssl' => in_array($this->ssl, array('never', 'sometimes', 'always'))
+ ? $this->ssl
+ : 'never',
+ 'db_database' => $this->db['database'],
+ 'db_type' => $this->db['type']
+ ));
+
+ // assemble configuration file in a string
+ $cfg = "fancy ? "\$config['site']['fancy'] = true;\n\n":'').
+
+ // database
+ "\$config['db']['database'] = {$vals['db_database']};\n\n".
+ ($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').
+ "\$config['db']['type'] = {$vals['db_type']};\n\n";
+
+ // Normalize line endings for Windows servers
+ $cfg = str_replace("\n", PHP_EOL, $cfg);
+
+ // write configuration file out to install directory
+ $res = file_put_contents(INSTALLDIR.'/config.php', $cfg);
+
+ return $res;
+ }
+
+ /**
+ * Write the site profile. We do this after creating the initial user
+ * in case the site profile is set to single user. This gets around the
+ * 'chicken-and-egg' problem of the system requiring a valid user for
+ * single user mode, before the intial user is actually created. Yeah,
+ * we should probably do this in smarter way.
+ *
+ * @return int res number of bytes written
+ */
+ function writeSiteProfile()
+ {
+ $vals = $this->phpVals(array(
+ 'site_profile' => $this->siteProfile,
+ 'nickname' => $this->adminNick
+ ));
+
+ $cfg =
+ // site profile
+ "\$config['site']['profile'] = {$vals['site_profile']};\n";
+
+ if ($this->siteProfile == "singleuser") {
+ $cfg .= "\$config['singleuser']['nickname'] = {$vals['nickname']};\n\n";
+ } else {
+ $cfg .= "\n";
+ }
+
+ // Normalize line endings for Windows servers
+ $cfg = str_replace("\n", PHP_EOL, $cfg);
+
+ // write configuration file out to install directory
+ $res = file_put_contents(INSTALLDIR.'/config.php', $cfg, FILE_APPEND);
+
+ return $res;
+ }
+
+ /**
+ * Install schema into the database
+ *
+ * @param string $filename location of database schema file
+ * @param DB_common $conn connection to database
+ *
+ * @return boolean - indicating success or failure
+ */
+ function runDbScript($filename, DB_common $conn)
+ {
+ $sql = trim(file_get_contents(INSTALLDIR . '/db/' . $filename));
+ $stmts = explode(';', $sql);
+ foreach ($stmts as $stmt) {
+ $stmt = trim($stmt);
+ if (!mb_strlen($stmt)) {
+ continue;
+ }
+ try {
+ $res = $conn->simpleQuery($stmt);
+ } catch (Exception $e) {
+ $error = $e->getMessage();
+ $this->updateStatus("ERROR ($error) for SQL '$stmt'");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Create the initial admin user account.
+ * Side effect: may load portions of GNU social framework.
+ * Side effect: outputs program info
+ */
+ function registerInitialUser()
+ {
+ require_once INSTALLDIR . '/lib/common.php';
+
+ $data = array('nickname' => $this->adminNick,
+ 'password' => $this->adminPass,
+ 'fullname' => $this->adminNick);
+ if ($this->adminEmail) {
+ $data['email'] = $this->adminEmail;
+ }
+ $user = User::register($data);
+
+ if (empty($user)) {
+ return false;
+ }
+
+ // give initial user carte blanche
+
+ $user->grantRole('owner');
+ $user->grantRole('moderator');
+ $user->grantRole('administrator');
+
+ // Attempt to do a remote subscribe to update@status.net
+ // Will fail if instance is on a private network.
+
+ if ($this->adminUpdates && class_exists('Ostatus_profile')) {
+ try {
+ $oprofile = Ostatus_profile::ensureProfileURL('http://update.status.net/');
+ Subscription::start($user->getProfile(), $oprofile->localProfile());
+ $this->updateStatus("Set up subscription to update@status.net.");
+ } catch (Exception $e) {
+ $this->updateStatus("Could not set up subscription to update@status.net.", true);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * The beef of the installer!
+ * Create database, config file, and admin user.
+ *
+ * Prerequisites: validation of input data.
+ *
+ * @return boolean success
+ */
+ function doInstall()
+ {
+ global $config;
+
+ $this->updateStatus("Initializing...");
+ ini_set('display_errors', 1);
+ error_reporting(E_ALL);
+ if (!defined('GNUSOCIAL')) {
+ define('GNUSOCIAL', true);
+ }
+ if (!defined('STATUSNET')) {
+ define('STATUSNET', true);
+ }
+
+ require_once INSTALLDIR . '/lib/framework.php';
+ StatusNet::initDefaults($this->server, $this->path);
+
+ if ($this->siteProfile == "singleuser") {
+ // Until we use ['site']['profile']==='singleuser' everywhere
+ $config['singleuser']['enabled'] = true;
+ }
+
+ try {
+ $this->db = $this->setupDatabase();
+ if (!$this->db) {
+ // database connection failed, do not move on to create config file.
+ return false;
+ }
+ } catch (Exception $e) {
+ // Lower-level DB error!
+ $this->updateStatus("Database error: " . $e->getMessage(), true);
+ return false;
+ }
+
+ // Make sure we can write to the file twice
+ $oldUmask = umask(000);
+
+ if (!$this->skipConfig) {
+ $this->updateStatus("Writing config file...");
+ $res = $this->writeConf();
+
+ if (!$res) {
+ $this->updateStatus("Can't write config file.", true);
+ return false;
+ }
+ }
+
+ if (!empty($this->adminNick)) {
+ // Okay, cross fingers and try to register an initial user
+ if ($this->registerInitialUser()) {
+ $this->updateStatus(
+ "An initial user with the administrator role has been created."
+ );
+ } else {
+ $this->updateStatus(
+ "Could not create initial user account.",
+ true
+ );
+ return false;
+ }
+ }
+
+ if (!$this->skipConfig) {
+ $this->updateStatus("Setting site profile...");
+ $res = $this->writeSiteProfile();
+
+ if (!$res) {
+ $this->updateStatus("Can't write to config file.", true);
+ return false;
+ }
+ }
+
+ // Restore original umask
+ umask($oldUmask);
+ // Set permissions back to something decent
+ chmod(INSTALLDIR.'/config.php', 0644);
+
+ $scheme = $this->ssl === 'always' ? 'https' : 'http';
+ $link = "{$scheme}://{$this->server}/{$this->path}";
+
+ $this->updateStatus("GNU social has been installed at $link");
+ $this->updateStatus(
+ 'DONE! You can visit your new GNU social site (log in as "'.htmlspecialchars($this->adminNick).'"). If this is your first GNU social install, make your experience the best possible by visiting our resource site to join the mailing list and good documentation.'
+ );
+
+ return true;
+ }
+
+ /**
+ * Output a pre-install-time warning message
+ * @param string $message HTML ok, but should be plaintext-able
+ * @param string $submessage HTML ok, but should be plaintext-able
+ */
+ abstract function warning($message, $submessage='');
+
+ /**
+ * Output an install-time progress message
+ * @param string $message HTML ok, but should be plaintext-able
+ * @param boolean $error true if this should be marked as an error condition
+ */
+ abstract function updateStatus($status, $error=false);
+
+}
diff --git a/lib/action.php b/lib/action.php
index c2d60e11e9..ca8ece7ebc 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -1221,7 +1221,7 @@ class Action extends HTMLOutputter // lawsuit
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/lib/activity.php b/lib/activity.php
index 3128088ca2..9282461c1c 100644
--- a/lib/activity.php
+++ b/lib/activity.php
@@ -107,6 +107,7 @@ class Activity
public $selfLink; //
public $editLink; //
public $generator; // ActivityObject representing the generating application
+
/**
* Turns a regular old Atom into a magical activity
*
diff --git a/lib/activityimporter.php b/lib/activityimporter.php
index c4dd797e6d..51ea8ddf6b 100644
--- a/lib/activityimporter.php
+++ b/lib/activityimporter.php
@@ -306,7 +306,7 @@ class ActivityImporter extends QueueHandler
// Is the recipient a remote group?
$oprofile = Ostatus_profile::ensureProfileURI($recipient);
- if ($oprofile) {
+ if ($oprofile instanceof Ostatus_profile) {
if (!$oprofile->isGroup()) {
// may be canonicalized or something
$replies[] = $oprofile->uri;
@@ -321,10 +321,11 @@ class ActivityImporter extends QueueHandler
if ($id) {
$group = User_group::getKV('id', $id);
- if ($group) {
+ if ($group instanceof User_group) {
// Deliver to all members of this local group if allowed.
- $profile = $sender->localProfile();
- if ($profile->isMember($group)) {
+ $profile = Profile::getKV('id', $recipient);
+
+ if (($profile instanceof Profile) && ($profile->isMember($group))) {
$groups[] = $group->id;
} else {
common_log(LOG_INFO, "Skipping reply to local group {$group->nickname} as sender {$profile->id} is not a member");
diff --git a/lib/activityutils.php b/lib/activityutils.php
index 8a2be35022..76e4777deb 100644
--- a/lib/activityutils.php
+++ b/lib/activityutils.php
@@ -301,7 +301,7 @@ class ActivityUtils
return false;
}
- static function getFeedAuthor($feedEl)
+ static function getFeedAuthor(DOMElement $feedEl)
{
// Try old and deprecated activity:subject
@@ -348,10 +348,10 @@ class ActivityUtils
return null;
}
- static function compareTypes($type, $objects)
+ static function compareTypes($type, array $objects)
{
$type = self::resolveUri($type);
- foreach ((array)$objects as $object) {
+ foreach ($objects as $object) {
if ($type === self::resolveUri($object)) {
return true;
}
diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php
index 2ac92cb5c6..af6e11a511 100644
--- a/lib/adminpanelaction.php
+++ b/lib/adminpanelaction.php
@@ -60,7 +60,7 @@ class AdminPanelAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -119,7 +119,7 @@ class AdminPanelAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->checkSessionToken();
diff --git a/lib/apilistusers.php b/lib/apilistusers.php
index 13d1a8c580..cf3a865538 100644
--- a/lib/apilistusers.php
+++ b/lib/apilistusers.php
@@ -163,7 +163,7 @@ class ApiListUsersAction extends ApiBareAuthAction
{
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/lib/apioauthaction.php b/lib/apioauthaction.php
index 95a3bec45d..53be050022 100644
--- a/lib/apioauthaction.php
+++ b/lib/apioauthaction.php
@@ -49,7 +49,7 @@ class ApiOAuthAction extends ApiAction
*
* @return boolean false
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
index 4d4b451167..f08524e09b 100644
--- a/lib/attachmentlist.php
+++ b/lib/attachmentlist.php
@@ -99,12 +99,12 @@ class AttachmentList extends Widget
function showListStart()
{
- $this->out->elementStart('ol', array('class' => 'attachments'));
+ $this->out->elementStart('div', array('class' => 'attachments'));
}
function showListEnd()
{
- $this->out->elementEnd('ol');
+ $this->out->elementEnd('div');
}
/**
diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php
index 2d484fb6a8..1f2a925b0c 100644
--- a/lib/attachmentlistitem.php
+++ b/lib/attachmentlistitem.php
@@ -217,7 +217,7 @@ class AttachmentListItem extends Widget
$scripts[] = $script;
}
foreach ($scripts as $script) {
- common_log(LOG_DEBUG, $script->textContent);
+ common_debug($script->textContent);
$script->parentNode->removeChild($script);
}
diff --git a/lib/attachmenttagcloudsection.php b/lib/attachmenttagcloudsection.php
index 2c8fc5ee1a..5a8614ebb1 100644
--- a/lib/attachmenttagcloudsection.php
+++ b/lib/attachmenttagcloudsection.php
@@ -75,7 +75,7 @@ class AttachmentTagCloudSection extends TagCloudSection
function getTags()
{
$notice_tag = new Notice_tag;
- $query = 'select tag,count(tag) as weight from notice_tag join file_to_post on (notice_tag.notice_id=post_id) join notice on notice_id = notice.id where file_id=' . $notice_tag->escape($this->out->attachment->id) . ' group by tag order by weight desc';
+ $query = 'select tag, notice_id, count(tag) as weight from notice_tag join file_to_post on (notice_tag.notice_id=post_id) join notice on notice_id = notice.id where file_id=' . $notice_tag->escape($this->out->attachment->id) . ' group by tag order by weight desc';
$notice_tag->query($query);
return $notice_tag;
}
diff --git a/lib/default.php b/lib/default.php
index 8d8ef11788..fb6b87c72f 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -133,7 +133,7 @@ $default =
'delete' => false,
'move' => true),
'image' =>
- array('jpegquality' => 85),
+ array('jpegquality' => 95),
'avatar' =>
array('server' => null,
'dir' => INSTALLDIR . '/avatar/',
@@ -210,6 +210,7 @@ $default =
array('server' => null,
'dir' => INSTALLDIR . '/file/',
'path' => $_path . '/file/',
+ 'chmod' => 0644, // Access rights (chmod) for any attachments
'sslserver' => null,
'sslpath' => null,
'ssl' => null,
diff --git a/lib/docfile.php b/lib/docfile.php
index 3331bcd19d..583f7ebc9b 100644
--- a/lib/docfile.php
+++ b/lib/docfile.php
@@ -55,12 +55,8 @@ class DocFile
$this->filename = $filename;
}
- static function forTitle($title, $paths)
+ static function forTitle($title, array $paths, $language=null)
{
- if (!is_array($paths)) {
- $paths = array($paths);
- }
-
$filename = null;
if (Event::handle('StartDocFileForTitle', array($title, &$paths, &$filename))) {
@@ -80,7 +76,7 @@ class DocFile
}
if (!empty($lang) || !empty($def)) {
- $filename = self::negotiateLanguage($lang, $def);
+ $filename = self::negotiateLanguage($lang, $def, $language);
break;
}
}
@@ -95,12 +91,8 @@ class DocFile
}
}
- function toHTML($args=null)
+ function toHTML(array $args=array())
{
- if (is_null($args)) {
- $args = array();
- }
-
if (empty($this->contents)) {
$this->contents = file_get_contents($this->filename);
}
@@ -114,7 +106,7 @@ class DocFile
INSTALLDIR.'/doc-src/');
$site = GNUsocial::currentSite();
-
+
if (!empty($site)) {
array_unshift($paths, INSTALLDIR.'/local/doc-src/'.$site.'/');
}
@@ -128,7 +120,7 @@ class DocFile
INSTALLDIR.'/mail-src/');
$site = GNUsocial::currentSite();
-
+
if (!empty($site)) {
array_unshift($paths, INSTALLDIR.'/local/mail-src/'.$site.'/');
}
@@ -136,12 +128,20 @@ class DocFile
return $paths;
}
- static function negotiateLanguage($filenames, $defaultFilename=null)
+ private static function negotiateLanguage(array $filenames, $defaultFilename=null, $language = null)
{
- // XXX: do this better
-
+ // Default is current language
$langcode = common_language();
+ // Is a language set?
+ if (!empty($language)) {
+ // And is it valid?
+ if (common_valid_language($language)) {
+ // Use this as language (e.g. from form)
+ $langcode = strval($language);
+ }
+ }
+
foreach ($filenames as $filename) {
if (preg_match('/\.'.$langcode.'$/', $filename)) {
return $filename;
diff --git a/lib/formaction.php b/lib/formaction.php
index 7d74fc4713..684f92bf96 100644
--- a/lib/formaction.php
+++ b/lib/formaction.php
@@ -63,7 +63,7 @@ class FormAction extends ManagedAction
return true;
}
- public function isReadOnly($args) {
+ public function isReadOnly(array $args=array()) {
return !$this->isPost();
}
diff --git a/lib/framework.php b/lib/framework.php
index f8c877954f..a159c662a5 100644
--- a/lib/framework.php
+++ b/lib/framework.php
@@ -27,7 +27,7 @@ define('GNUSOCIAL_LIFECYCLE', 'beta3'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', '
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
-define('GNUSOCIAL_CODENAME', 'Not decided yet');
+define('GNUSOCIAL_CODENAME', 'Only a fixed bug is a good bug.');
define('AVATAR_PROFILE_SIZE', 96);
define('AVATAR_STREAM_SIZE', 48);
@@ -110,6 +110,28 @@ function _have_config()
return GNUsocial::haveConfig();
}
+function common_get_temp_dir()
+{
+ // Try to get it from php.ini first
+ $temp_path = trim(ini_get('upload_tmp_dir'));
+
+ // Is it empty?
+ if (strlen($temp_path) == 0) {
+ // Then try sys_get_temp_dir()
+ $temp_path = trim(sys_get_temp_dir());
+
+ // Still empty?
+ if (strlen($temp_path) == 0) {
+ // Then set it to /tmp (ugly)
+ // @TODO Hard-coded non-Windows stuff!
+ $temp_path = '/tmp';
+ }
+ }
+
+ // Return found path
+ return $temp_path;
+}
+
function GNUsocial_class_autoload($cls)
{
if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) {
@@ -126,6 +148,7 @@ function GNUsocial_class_autoload($cls)
}
}
+
// Autoload function queue, starting with our own discovery method
spl_autoload_register('GNUsocial_class_autoload');
diff --git a/lib/grouplist.php b/lib/grouplist.php
index 39e904222a..d29a149573 100644
--- a/lib/grouplist.php
+++ b/lib/grouplist.php
@@ -136,7 +136,7 @@ class GroupList extends Widget
$this->out->elementEnd('div');
- if ($user) {
+ if ($user instanceof User) {
$this->out->elementStart('div', 'entity_actions');
$this->out->elementStart('ul');
$this->out->elementStart('li', 'entity_subscribe');
diff --git a/lib/groupmemberlist.php b/lib/groupmemberlist.php
index ba608213a4..f055e24731 100644
--- a/lib/groupmemberlist.php
+++ b/lib/groupmemberlist.php
@@ -12,7 +12,7 @@ class GroupMemberList extends ProfileList
$this->group = $group;
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new GroupMemberListItem($profile, $this->group, $this->action);
}
diff --git a/lib/grouptagcloudsection.php b/lib/grouptagcloudsection.php
index 5ed14560ce..68af4d3074 100644
--- a/lib/grouptagcloudsection.php
+++ b/lib/grouptagcloudsection.php
@@ -76,7 +76,7 @@ class GroupTagCloudSection extends TagCloudSection
$namestring = implode(',', $quoted);
- $qry = 'SELECT notice_tag.tag, '.
+ $qry = 'SELECT notice_tag.tag, notice_tag.notice_id, '.
$weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
diff --git a/lib/imagefile.php b/lib/imagefile.php
index 7107487737..1a23d7b5ab 100644
--- a/lib/imagefile.php
+++ b/lib/imagefile.php
@@ -76,13 +76,12 @@ class ImageFile
$info = @getimagesize($this->filepath);
- if (!(
- ($info[2] == IMAGETYPE_GIF && function_exists('imagecreatefromgif')) ||
- ($info[2] == IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) ||
- $info[2] == IMAGETYPE_BMP ||
- ($info[2] == IMAGETYPE_WBMP && function_exists('imagecreatefromwbmp')) ||
- ($info[2] == IMAGETYPE_XBM && function_exists('imagecreatefromxbm')) ||
- ($info[2] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')))) {
+ if (
+ ($info[2] == IMAGETYPE_GIF && !function_exists('imagecreatefromgif')) ||
+ ($info[2] == IMAGETYPE_JPEG && !function_exists('imagecreatefromjpeg')) ||
+ ($info[2] == IMAGETYPE_WBMP && !function_exists('imagecreatefromwbmp')) ||
+ ($info[2] == IMAGETYPE_XBM && !function_exists('imagecreatefromxbm')) ||
+ ($info[2] == IMAGETYPE_PNG && !function_exists('imagecreatefrompng'))) {
// TRANS: Exception thrown when trying to upload an unsupported image file format.
throw new UnsupportedMediaException(_('Unsupported image format.'), $this->filepath);
@@ -254,6 +253,9 @@ class ImageFile
if ($this->rotate == 0) {
// No rotational difference, just copy it as-is
@copy($this->filepath, $outpath);
+
+ // And set chmod
+ @chmod($outpath, common_config('attachments', 'chmod'));
return $outpath;
} elseif (abs($this->rotate) == 90) {
// Box is rotated 90 degrees in either direction,
@@ -352,6 +354,9 @@ class ImageFile
throw new Exception(_('Unknown file type'));
}
+ // Always chmod 0644 (default) to have other processes (e.g. queue daemon read it)
+ @chmod($outpath, common_config('attachments', 'chmod'));
+
imagedestroy($image_src);
imagedestroy($image_dest);
}
diff --git a/lib/implugin.php b/lib/implugin.php
index 457c9dba52..9e4de6beb1 100644
--- a/lib/implugin.php
+++ b/lib/implugin.php
@@ -521,7 +521,7 @@ abstract class ImPlugin extends Plugin
*
* @return boolean hook return
*/
- function onEndInitializeQueueManager($manager)
+ function onEndInitializeQueueManager(QueueManager $manager)
{
// If we don't require CLI mode, or if we do and GNUSOCIAL_CLI _is_ set, then connect the transports
// This check is made mostly because some IM plugins can't deliver to transports unless they
@@ -540,7 +540,7 @@ abstract class ImPlugin extends Plugin
return true;
}
- function onStartEnqueueNotice($notice, &$transports)
+ function onStartEnqueueNotice(Notice $notice, array &$transports)
{
$profile = Profile::getKV($notice->profile_id);
diff --git a/lib/inboxtagcloudsection.php b/lib/inboxtagcloudsection.php
index d19f76366d..fbc137041f 100644
--- a/lib/inboxtagcloudsection.php
+++ b/lib/inboxtagcloudsection.php
@@ -72,7 +72,7 @@ class InboxTagCloudSection extends TagCloudSection
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
- $qry = 'SELECT notice_tag.tag, '.
+ $qry = 'SELECT notice_tag.tag, notice_tag.notice_id, '.
$weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
diff --git a/lib/infoaction.php b/lib/infoaction.php
index f72bed59d6..d6c85d13d2 100644
--- a/lib/infoaction.php
+++ b/lib/infoaction.php
@@ -72,7 +72,7 @@ class InfoAction extends Action
return empty($this->title) ? '' : $this->title;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/lib/installer.php b/lib/installer.php
index 650845f0f0..ff7677dc7d 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -299,7 +299,10 @@ abstract class Installer
}
}
- if (!$conn instanceof DB_common) {
+ if (!is_object($conn)) {
+ // No object at all
+ throw new Exception('Fatal error: conn is no object.');
+ } elseif (!$conn instanceof DB_common) {
// Is not the right instance
throw new Exception('Cannot connect to database: ' . $conn->getMessage());
}
diff --git a/lib/inviteform.php b/lib/inviteform.php
index 364ca75b9b..be4dc163b0 100644
--- a/lib/inviteform.php
+++ b/lib/inviteform.php
@@ -93,6 +93,7 @@ class InviteForm extends Form
function formData()
{
$this->out->elementStart('ul', 'form_data');
+
$this->out->elementStart('li');
$this->out->textarea(
'addresses',
@@ -103,6 +104,7 @@ class InviteForm extends Form
_('Addresses of friends to invite (one per line).')
);
$this->out->elementEnd('li');
+
$this->out->elementStart('li');
$this->out->textarea(
// TRANS: Field label for a personal message to send to invitees.
@@ -112,6 +114,16 @@ class InviteForm extends Form
_('Optionally add a personal message to the invitation.')
);
$this->out->elementEnd('li');
+
+ $language = common_language();
+
+ $this->out->elementStart('li');
+ $this->out->dropdown('language', _('Language'),
+ // TRANS: Tooltip for dropdown list label in form for profile settings.
+ get_nice_language_list(), _('Preferred language.'),
+ false, $language);
+ $this->out->elementEnd('li');
+
$this->out->elementEnd('ul');
}
diff --git a/lib/iomaster.php b/lib/iomaster.php
index 7072761f2d..e53fc6511e 100644
--- a/lib/iomaster.php
+++ b/lib/iomaster.php
@@ -152,7 +152,7 @@ abstract class IoMaster
if ($timeout > 0 && empty($sockets)) {
// If we had no listeners, sleep until the pollers' next requested wakeup.
- common_log(LOG_DEBUG, "Sleeping $timeout seconds until next poll cycle...");
+ common_debug("Sleeping $timeout seconds until next poll cycle...");
$this->logState('sleep');
sleep($timeout);
}
@@ -190,7 +190,7 @@ abstract class IoMaster
}
} else if (common_config('queue', 'debug_memory')) {
$fmt = number_format($usage);
- common_log(LOG_DEBUG, "Memory usage $fmt");
+ common_debug("Memory usage $fmt");
}
}
}
diff --git a/lib/menu.php b/lib/menu.php
index 236e99263d..f0f797fe32 100644
--- a/lib/menu.php
+++ b/lib/menu.php
@@ -94,16 +94,20 @@ class Menu extends Widget
$this->out->elementStart('ul', $attrs);
foreach ($items as $item) {
+ assert(is_array($item));
+ assert(count($item) == 5);
+
list($actionName, $args, $label, $description, $id) = $item;
+
$this->item($actionName, $args, $label, $description, $id);
}
-
+
$this->out->elementEnd('ul');
-
+
Event::handle('EndNav', array($this, $tag, $items));
}
}
-
+
function item($actionName, array $args, $label, $description, $id=null, $cls=null)
{
if (empty($id)) {
@@ -124,6 +128,12 @@ class Menu extends Widget
{
if ($actionName != $this->actionName) {
return false;
+ } elseif (!is_array($args)) {
+ /*
+ * No array, then the below loop doesn't need to run and
+ * 'return false' will never be reached.
+ */
+ return true;
}
foreach ($this->actionArgs as $k => $v) {
@@ -134,11 +144,11 @@ class Menu extends Widget
return true;
}
-
+
function menuItemID($actionName, $args = null)
{
$id = sprintf('nav_%s', $actionName);
-
+
if (!is_null($args)) {
foreach ($args as $key => $value) {
$id .= '_' . $key . '_' . $value;
diff --git a/lib/noticeform.php b/lib/noticeform.php
index f9b2309119..698d1f6a60 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -97,17 +97,13 @@ class NoticeForm extends Form
* 'location_id' ID of location
* 'location_ns' Namespace of location
*/
- function __construct($action, $options=null)
+ function __construct(Action $action, array $options = array())
{
parent::__construct($action);
// When creating a notice form we don't want to collide with
// possibly existing HTML elements, as naming conventions are similar.
- $this->id_suffix = rand();
-
- if (is_null($options)) {
- $options = array();
- }
+ $this->id_suffix = mt_rand();
$this->actionName = $action->trimmed('action');
@@ -269,7 +265,7 @@ class NoticeForm extends Form
'type' => 'checkbox',
'class' => 'checkbox',
'id' => $this->id() . '-notice_data-geo',
- 'checked' => true, // ?
+ 'checked' => false, // Must be unchecked by default
));
$this->out->element('label', array('class' => 'notice_data-geo',
'for' => $this->id().'-notice_data-geo'),
diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php
index 4c4bde34a1..1adb326e37 100644
--- a/lib/noticelistitem.php
+++ b/lib/noticelistitem.php
@@ -201,7 +201,8 @@ class NoticeListItem extends Widget
{
if (Event::handle('StartShowNoticeOptions', array($this))) {
$user = common_current_user();
- if ($user) {
+
+ if ($user instanceof User) {
$this->out->elementStart('div', 'notice-options');
if (Event::handle('StartShowNoticeOptionItems', array($this))) {
$this->showReplyLink();
@@ -210,6 +211,7 @@ class NoticeListItem extends Widget
}
$this->out->elementEnd('div');
}
+
Event::handle('EndShowNoticeOptions', array($this));
}
}
diff --git a/lib/personaltagcloudsection.php b/lib/personaltagcloudsection.php
index 46b4661e89..3644de2015 100644
--- a/lib/personaltagcloudsection.php
+++ b/lib/personaltagcloudsection.php
@@ -59,7 +59,7 @@ class PersonalTagCloudSection extends TagCloudSection
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
- $qry = 'SELECT notice_tag.tag, '.
+ $qry = 'SELECT notice_tag.tag, notice_tag.notice_id, '.
$weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
diff --git a/lib/pluginlist.php b/lib/pluginlist.php
index 51c02aa245..40a889abd5 100644
--- a/lib/pluginlist.php
+++ b/lib/pluginlist.php
@@ -78,7 +78,7 @@ class PluginList extends Widget
}
}
- function newListItem($plugin)
+ function newListItem(Plugin $plugin)
{
return new PluginListItem($plugin, $this->out);
}
diff --git a/lib/profileaction.php b/lib/profileaction.php
index 22c960406a..3d9337c025 100644
--- a/lib/profileaction.php
+++ b/lib/profileaction.php
@@ -103,7 +103,7 @@ abstract class ProfileAction extends ManagedAction
return $this->target;
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -203,20 +203,19 @@ abstract class ProfileAction extends ManagedAction
// TRANS: H2 text for user statistics.
$this->element('h2', null, _('Statistics'));
- $profile = $this->target;
- $actionParams = array('nickname' => $profile->nickname);
+ $actionParams = array('nickname' => $this->target->nickname);
$stats = array(
array(
'id' => 'user-id',
// TRANS: Label for user statistics.
'label' => _('User ID'),
- 'value' => $profile->id,
+ 'value' => $this->target->id,
),
array(
'id' => 'member-since',
// TRANS: Label for user statistics.
'label' => _('Member since'),
- 'value' => date('j M Y', strtotime($profile->created))
+ 'value' => date('j M Y', strtotime($this->target->created))
),
array(
'id' => 'notices',
@@ -234,7 +233,7 @@ abstract class ProfileAction extends ManagedAction
);
// Give plugins a chance to add stats entries
- Event::handle('ProfileStats', array($profile, &$stats));
+ Event::handle('ProfileStats', array($this->target, &$stats));
foreach ($stats as $row) {
$this->showStatsRow($row);
diff --git a/lib/profileformaction.php b/lib/profileformaction.php
index 9ace6676c3..75f4359c9d 100644
--- a/lib/profileformaction.php
+++ b/lib/profileformaction.php
@@ -51,7 +51,7 @@ class ProfileFormAction extends RedirectingAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -96,7 +96,7 @@ class ProfileFormAction extends RedirectingAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/lib/publictagcloudsection.php b/lib/publictagcloudsection.php
index bf88091a90..1ba4fa0cf4 100644
--- a/lib/publictagcloudsection.php
+++ b/lib/publictagcloudsection.php
@@ -77,7 +77,7 @@ class PublicTagCloudSection extends TagCloudSection
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
- $qry = 'SELECT notice_tag.tag, '.
+ $qry = 'SELECT notice_tag.tag, notice_tag.notice_id, '.
$weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
diff --git a/lib/router.php b/lib/router.php
index 28ee42662d..bf8cb2b833 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -34,7 +34,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
/**
* URL Router
*
- * Cheap wrapper around Net_URL_Mapper
+ * Cheap wrapper around URLMapper
*
* @category URL
* @package StatusNet
@@ -182,7 +182,7 @@ class Router
foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
'oauthapps', 'email', 'sms', 'url') as $s) {
- $m->connect('settings/'.$s, array('action' => $s.'settings'));
+ $m->connect('settings/' . $s, array('action' => $s . 'settings'));
}
if (common_config('oldschool', 'enabled')) {
@@ -216,7 +216,7 @@ class Router
// The second of these is needed to make the link work correctly
// when inserted into the page. The first is needed to match the
- // route on the way in. Seems to be another Net_URL_Mapper bug to me.
+ // route on the way in. Seems to be another URLMapper bug to me.
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
array('q' => '.+'));
$m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
@@ -1119,7 +1119,7 @@ class Router
}
$url = $this->m->generate($args, $params, $fragment);
- // Due to a bug in the Net_URL_Mapper code, the returned URL may
+ // Due to a bug in the URLMapper code, the returned URL may
// contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We
// repair that here rather than modifying the upstream code...
diff --git a/lib/schemaupdater.php b/lib/schemaupdater.php
index 38b5b93865..575080a7bc 100644
--- a/lib/schemaupdater.php
+++ b/lib/schemaupdater.php
@@ -63,12 +63,12 @@ class SchemaUpdater
foreach ($this->tables as $table => $def) {
$checksum = $this->checksum($def);
if (empty($checksums[$table])) {
- common_log(LOG_DEBUG, "No previous schema_version for $table: updating to $checksum");
+ common_debug("No previous schema_version for $table: updating to $checksum");
} else if ($checksums[$table] == $checksum) {
- common_log(LOG_DEBUG, "Last schema_version for $table up to date: $checksum");
+ common_debug("Last schema_version for $table up to date: $checksum");
continue;
} else {
- common_log(LOG_DEBUG, "Last schema_version for $table is {$checksums[$table]}: updating to $checksum");
+ common_debug("Last schema_version for $table is {$checksums[$table]}: updating to $checksum");
}
//$this->conn->query('BEGIN');
$this->schema->ensureTable($table, $def);
@@ -108,7 +108,7 @@ class SchemaUpdater
return $checksums;
} catch (Exception $e) {
// no dice!
- common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet.");
+ common_debug("Possibly schema_version table doesn't exist yet.");
}
return $checksums;
@@ -134,7 +134,7 @@ class SchemaUpdater
}
} catch (Exception $e) {
// no dice!
- common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet.");
+ common_debug("Possibly schema_version table doesn't exist yet.");
}
$this->checksums[$table] = $checksum;
}
diff --git a/lib/searchaction.php b/lib/searchaction.php
index f8acf34f07..450b04ba7a 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -51,12 +51,12 @@ class SearchAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/lib/tagcloudsection.php b/lib/tagcloudsection.php
index 80a9042e0f..1ff973b902 100644
--- a/lib/tagcloudsection.php
+++ b/lib/tagcloudsection.php
@@ -50,6 +50,7 @@ class TagCloudSection extends Section
function showContent()
{
$tags = $this->getTags();
+ //* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . '] tags[]=' . gettype($tags));
if (!$tags) {
// TRANS: Content displayed in a tag cloud section if there are no tags.
@@ -63,8 +64,10 @@ class TagCloudSection extends Section
$sum = 0;
while ($tags->fetch() && ++$cnt <= TAGS_PER_SECTION) {
- $tw[$tags->tag] = $tags->weight;
- $sum += $tags->weight;
+ if ($tags->isCurrentProfileInScope()) {
+ $tw[$tags->tag] = $tags->weight;
+ $sum += $tags->weight;
+ }
}
if ($cnt == 0) {
diff --git a/lib/urlmapper.php b/lib/urlmapper.php
index 3a6f70fcda..bfc98ddd79 100644
--- a/lib/urlmapper.php
+++ b/lib/urlmapper.php
@@ -39,7 +39,7 @@ if (!defined('STATUSNET')) {
*
* Converts a path into a set of parameters, and vice versa
*
- * We used to use Net_URL_Mapper, so there's a wrapper class at Router, q.v.
+ * We used to use URLMapper, so there's a wrapper class at Router, q.v.
*
* NUM's vagaries are the main reason we have weirdnesses here.
*
diff --git a/lib/urlshortenerplugin2.php b/lib/urlshortenerplugin2.php
new file mode 100644
index 0000000000..cb11b12ec1
--- /dev/null
+++ b/lib/urlshortenerplugin2.php
@@ -0,0 +1,212 @@
+= 5.2
+ *
+ * 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 .
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Craig Andrews
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://gnu.io
+ */
+define("STATUSNET", 1);
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
+
+
+/**
+ * Class to handle Plugin exceptions
+ *
+ * @category Exception
+ * @package StatusNet
+ * @author Craig Andrews
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://gnu.io
+ */
+class PluginErrorException extends Exception {
+ protected $severity=0;
+ /**
+ * Setup costumizable Exceptions
+ * @var array $HTML Codes for Exceptionlists(see PluginErrorException::getFull())
+ */
+ protected $HTML=array(
+ 'code'=>array("start"=>'', "end"=>'
array("start"=>'' ),
+ 'list'=>array("start"=>"", "end"=>""));
+ /**
+ * Create specific extension for PluginExceptions
+ * @
+ */
+ public function __construct($message, $code, $severity, $filename, $lineno, $HTML='') {
+ $this->message = $message;
+ $this->code = $code;
+ $this->severity = $severity;
+ $this->file = $filename;
+ $this->line = $lineno;
+ }
+
+ public function getSeverity() {
+ return $this->severity;
+ }
+ public function printFull() {
+ echo "Catched Exception:
";
+ echo "- Message:
".$this->getMessage()."
";
+ echo "- Code:
".$this->getCode()."
";
+ echo "- Line:
".$this->getLine()."
";
+ echo "- File:
".$this->getFile()."
";
+ echo "- Severity:
".$this->getSeverity()."
";
+ echo "
Code: 0 means an uncatched Exception, triggered ";
+ echo "by PHP's parsing. This is probally an Syntax-Error.
";
+ }
+}
+/* Do done some exceptionrelated things done, befor
+ * we can start coding the real.
+ */
+function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ throw new PluginErrorException($errstr, 0, $errno, $errfile, $errline);
+}
+
+/* the Exceptionhandler for Syntax-Errors, throwed by PHP itself */
+/**
+ * Superclass for plugins that perform a url shortening
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Craig Andrews
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://darksider3.de/sn/urlshortenerplugin2.html
+ */
+
+abstract class UrlShortenerPlugin2
+{
+ public $shortenerName;
+ public $freeService = true;
+ /**
+ * Make an URL shorter.
+ *
+ * @param string $url URL to shorten
+ *
+ * @return string shortened version of the url/Null/Error
+ * @todo dont support old "shorten", name it to "shortUrl" to get well-named code.
+ */
+ protected abstract function shorten($url);
+
+
+ /**
+ * Utility to get the data at an URL
+ *
+ * @param string $url URL to fetch
+ * @exception PluginErrorExcpetion $e If HTTPClient throws an exception, print out.
+ * @return string response body
+ * @todo throw an exception in HTTPClient and make the PluginErrorException more generally
+ * so that we can use it more then ones, in every libfile.
+ */
+ protected function httpGet($url)
+ {
+ try
+ {
+ $request = HTTPClient::start();
+ $response = $request->get($url);
+ } catch(PluginErrorException $e)
+ {
+ $e->printFull();
+ return false;
+ }
+ return $response->getBody();
+ }
+ /**
+ * Utility to post a request and get a response URL
+ *
+ * @param string $url URL to fetch
+ * @param array $data post parameters
+ *
+ * @return string response body
+ *
+ */
+ protected function httpPost($url, $data)
+ {
+
+ $request = HTTPClient::start();
+ $response = $request->post($url, null, $data);
+ return $response->getBody();
+ }
+ // Hook handlers
+
+ /**
+ * Called when all plugins have been initialized
+ *
+ * @return boolean hook value
+ */
+
+ function onInitializePlugin()
+ {
+ if (!isset($this->shortenerName))
+ {
+ throw new Exception("@Admin must specifiy $this->shortenerName");
+ }
+ return true;
+ }
+ /**
+ * Called when a showing the URL shortener drop-down box
+ *
+ * Properties of the shortening service currently only
+ * include whether it's a free service.
+ *
+ * @param array &$shorteners array mapping shortener name to properties
+ *
+ * @return boolean hook value
+ */
+ function onGetUrlShorteners(&$shorteners)
+ {
+ $shorteners[$this->shortenerName] =array('freeService' => $this->freeService);
+ return true;
+ }
+
+ /**
+ * Called to shorten an URL
+ *
+ * @param string $url URL to shorten
+ * @param string $shortenerName Shortening service. Don't handle if it's
+ * not you!
+ * @param string &$shortenedUrl URL after shortening; out param.
+ *
+ * @return boolean hook value
+ */
+
+ function onStartShortenUrl($url, $shortenerName, &$shortenedUrl)
+ {
+ if ($shortenerName == $this->shortenerName)
+ {
+ $result = $this->shorten($url);
+ if (isset($result) && $result != null && $result !== false)
+ {
+ $shortenedUrl = $result;
+ //dont create an exception, so we can do that without.
+ common_log(LOG_INFO,
+ __CLASS__ . ": $this->shortenerName ".
+ "shortened $url to $shortenedUrl");
+ return false;
+ }
+ }
+ return true;
+ }
+}
+?>
diff --git a/lib/util.php b/lib/util.php
index 7ebbf42cf6..1da9cc3c17 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -321,7 +321,7 @@ function common_set_user($user)
return false;
}
- if ($user) {
+ if ($user instanceof User) {
if (Event::handle('StartSetUser', array(&$user))) {
if (!empty($user)) {
if (!$user->hasRight(Right::WEBLOGIN)) {
@@ -538,7 +538,7 @@ function common_user_cache_hash($user=false)
if ($user === false) {
$user = common_current_user();
}
- if ($user) {
+ if ($user instanceof User) {
return crc32($user->id . ':' . $user->nickname);
} else {
return '0';
@@ -2378,7 +2378,7 @@ function common_perf_counter($key, $val=null)
$_perfCounters[$key] = array($val);
}
if (common_config('site', 'logperf_detail')) {
- common_log(LOG_DEBUG, "PERF COUNTER HIT: $key $val");
+ common_debug("PERF COUNTER HIT: $key $val");
}
}
}
@@ -2392,14 +2392,14 @@ function common_log_perf_counters()
if (isset($_startTime)) {
$endTime = microtime(true);
$diff = round(($endTime - $_startTime) * 1000);
- common_log(LOG_DEBUG, "PERF runtime: ${diff}ms");
+ common_debug("PERF runtime: ${diff}ms");
}
$counters = $_perfCounters;
ksort($counters);
foreach ($counters as $key => $values) {
$count = count($values);
$unique = count(array_unique($values));
- common_log(LOG_DEBUG, "PERF COUNTER: $key $count ($unique unique)");
+ common_debug("PERF COUNTER: $key $count ($unique unique)");
}
}
}
diff --git a/plugins/APC/APCPlugin.php b/plugins/APC/APCPlugin.php
new file mode 100644
index 0000000000..8f2659d8e1
--- /dev/null
+++ b/plugins/APC/APCPlugin.php
@@ -0,0 +1,116 @@
+.
+ *
+ * @category Cache
+ * @package StatusNet
+ * @author Evan Prodromou
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ // This check helps protect against security problems;
+ // your code file can't be executed directly from the web.
+ exit(1);
+}
+
+/**
+ * A plugin to use APC's variable cache for the cache interface
+ *
+ * New plugin interface lets us use alternative cache systems
+ * for caching. This one uses APC's variable cache.
+ *
+ * @category Cache
+ * @package StatusNet
+ * @author Evan Prodromou
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+class APCPlugin extends Plugin
+{
+ /**
+ * Get a value associated with a key
+ *
+ * The value should have been set previously.
+ *
+ * @param string &$key in; Lookup key
+ * @param mixed &$value out; value associated with key
+ *
+ * @return boolean hook success
+ */
+ function onStartCacheGet(&$key, &$value)
+ {
+ $value = apc_fetch($key);
+ Event::handle('EndCacheGet', array($key, &$value));
+ return false;
+ }
+
+ /**
+ * Associate a value with a key
+ *
+ * @param string &$key in; Key to use for lookups
+ * @param mixed &$value in; Value to associate
+ * @param integer &$flag in; Flag (passed through to Memcache)
+ * @param integer &$expiry in; Expiry (passed through to Memcache)
+ * @param boolean &$success out; Whether the set was successful
+ *
+ * @return boolean hook success
+ */
+ function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success)
+ {
+ $success = apc_store($key, $value, ((is_null($expiry)) ? 0 : $expiry));
+
+ Event::handle('EndCacheSet', array($key, $value, $flag,
+ $expiry));
+ return false;
+ }
+
+ /**
+ * Delete a value associated with a key
+ *
+ * @param string &$key in; Key to lookup
+ * @param boolean &$success out; whether it worked
+ *
+ * @return boolean hook success
+ */
+ function onStartCacheDelete(&$key, &$success)
+ {
+ $success = apc_delete($key);
+ Event::handle('EndCacheDelete', array($key));
+ return false;
+ }
+
+ function onPluginVersion(array &$versions)
+ {
+ $versions[] = array('name' => 'APC',
+ 'version' => GNUSOCIAL_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => 'http://status.net/wiki/Plugin:APC',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('Use the APC variable cache to cache query results.'));
+ return true;
+ }
+}
diff --git a/plugins/AccountManager/AccountManagerPlugin.php b/plugins/AccountManager/AccountManagerPlugin.php
index 768f71510f..24a95395a3 100644
--- a/plugins/AccountManager/AccountManagerPlugin.php
+++ b/plugins/AccountManager/AccountManagerPlugin.php
@@ -61,7 +61,7 @@ class AccountManagerPlugin extends Plugin
common_local_url('AccountManagementControlDocument'));
}
- function onStartShowHTML($action)
+ function onStartShowHTML(Action $action)
{
//Account management discovery link
header('Link: <'.common_local_url('AccountManagementControlDocument').'>; rel="'. AccountManagerPlugin::AM_REL.'"; type="application/json"');
diff --git a/plugins/AccountManager/actions/accountmanagementcontroldocument.php b/plugins/AccountManager/actions/accountmanagementcontroldocument.php
index 955779b4ee..c3c7c5955b 100644
--- a/plugins/AccountManager/actions/accountmanagementcontroldocument.php
+++ b/plugins/AccountManager/actions/accountmanagementcontroldocument.php
@@ -49,7 +49,7 @@ class AccountManagementControlDocumentAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/AccountManager/actions/accountmanagementsessionstatus.php b/plugins/AccountManager/actions/accountmanagementsessionstatus.php
index 9eeff72402..b61fa59719 100644
--- a/plugins/AccountManager/actions/accountmanagementsessionstatus.php
+++ b/plugins/AccountManager/actions/accountmanagementsessionstatus.php
@@ -49,7 +49,7 @@ class AccountManagementSessionStatusAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/ActivitySpam/ActivitySpamPlugin.php b/plugins/ActivitySpam/ActivitySpamPlugin.php
index 9d61b2dddd..8d924dea97 100644
--- a/plugins/ActivitySpam/ActivitySpamPlugin.php
+++ b/plugins/ActivitySpam/ActivitySpamPlugin.php
@@ -118,7 +118,7 @@ class ActivitySpamPlugin extends Plugin
return true;
}
- function onNoticeDeleteRelated($notice) {
+ function onNoticeDeleteRelated(Notice $notice) {
$score = Spam_score::getKV('notice_id', $notice->id);
if (!empty($score)) {
$score->delete();
@@ -126,7 +126,7 @@ class ActivitySpamPlugin extends Plugin
return true;
}
- function onUserRightsCheck($profile, $right, &$result) {
+ function onUserRightsCheck(Profile $profile, $right, &$result) {
switch ($right) {
case self::REVIEWSPAM:
case self::TRAINSPAM:
@@ -191,7 +191,7 @@ class ActivitySpamPlugin extends Plugin
return true;
}
- function onEndShowStyles($action)
+ function onEndShowStyles(Action $action)
{
$action->element('style', null,
'.form-train-spam input.submit { background: url('.$this->path('icons/bullet_black.png').') no-repeat 0px 0px } ' . "\n" .
diff --git a/plugins/ActivitySpam/actions/spam.php b/plugins/ActivitySpam/actions/spam.php
index a66b73a829..667b0a3612 100644
--- a/plugins/ActivitySpam/actions/spam.php
+++ b/plugins/ActivitySpam/actions/spam.php
@@ -154,11 +154,9 @@ class SpamAction extends Action
* MAY override
*
* @param array $args other arguments
- *
* @return boolean is read only action?
*/
-
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/ActivitySpam/classes/spam_score.php b/plugins/ActivitySpam/classes/spam_score.php
index 5c583a2e07..6a2a11d069 100644
--- a/plugins/ActivitySpam/classes/spam_score.php
+++ b/plugins/ActivitySpam/classes/spam_score.php
@@ -53,7 +53,7 @@ class Spam_score extends Managed_DataObject
public $score; // float
public $created; // datetime
- function saveNew($notice, $result) {
+ function saveNew(Notice $notice, $result) {
$score = new Spam_score();
diff --git a/plugins/ActivitySpam/scripts/silencespammer.php b/plugins/ActivitySpam/scripts/silencespammer.php
index 3a5e585fd5..4e710d10a7 100644
--- a/plugins/ActivitySpam/scripts/silencespammer.php
+++ b/plugins/ActivitySpam/scripts/silencespammer.php
@@ -31,7 +31,7 @@ Users who post a lot of spam get silenced
-a --all All users
END_OF_SILENCESPAMMER_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
function testAllUsers($filter, $minimum, $percent) {
$found = false;
diff --git a/plugins/ActivitySpam/scripts/testuser.php b/plugins/ActivitySpam/scripts/testuser.php
index 0eee9324bf..af3cc5b47a 100644
--- a/plugins/ActivitySpam/scripts/testuser.php
+++ b/plugins/ActivitySpam/scripts/testuser.php
@@ -31,7 +31,7 @@ Test user activities against the spam filter
-a --all All users
END_OF_TESTUSER_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
function testAllUsers($filter) {
$found = false;
diff --git a/plugins/ActivitySpam/scripts/trainuser.php b/plugins/ActivitySpam/scripts/trainuser.php
index 974048b4c9..a0d60b9a7b 100644
--- a/plugins/ActivitySpam/scripts/trainuser.php
+++ b/plugins/ActivitySpam/scripts/trainuser.php
@@ -32,7 +32,7 @@ Train user activities against the spam filter
END_OF_TRAINUSER_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
function trainUser($filter, $user, $category) {
diff --git a/plugins/Adsense/AdsensePlugin.php b/plugins/Adsense/AdsensePlugin.php
new file mode 100644
index 0000000000..80d90facaa
--- /dev/null
+++ b/plugins/Adsense/AdsensePlugin.php
@@ -0,0 +1,199 @@
+.
+ *
+ * @category Ads
+ * @package StatusNet
+ * @author Evan Prodromou
+ * @copyright 2010 StatusNet Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * Plugin to add Google Adsense to StatusNet sites
+ *
+ * This plugin lets you add Adsense ad units to your StatusNet site.
+ *
+ * We support the 4 ad sizes for the Universal Ad Platform (UAP):
+ *
+ * Medium Rectangle
+ * (Small) Rectangle
+ * Leaderboard
+ * Wide Skyscraper
+ *
+ * They fit in different places on the default theme. Some themes
+ * might interact quite poorly with this plugin.
+ *
+ * To enable advertising, you must sign up with Google Adsense and
+ * get a client ID.
+ *
+ * https://www.google.com/adsense/
+ *
+ * You'll also need to create an Adsense for Content unit in one
+ * of the four sizes described above. At the end of the process,
+ * note the "google_ad_client" and "google_ad_slot" values in the
+ * resultant Javascript.
+ *
+ * Add the plugin to config.php like so:
+ *
+ * addPlugin('Adsense', array('client' => 'Your client ID',
+ * 'rectangle' => 'slot'));
+ *
+ * Here, your client ID is the value of google_ad_client and the
+ * slot is the value of google_ad_slot. Note that if you create
+ * a different size, you'll need to provide different arguments:
+ * 'mediumRectangle', 'leaderboard', or 'wideSkyscraper'.
+ *
+ * If for some reason your ad server is different from the default,
+ * use the 'adScript' parameter to set the full path to the ad script.
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Evan Prodromou
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ *
+ * @seeAlso UAPPlugin
+ */
+class AdsensePlugin extends UAPPlugin
+{
+ public $adScript = 'http://pagead2.googlesyndication.com/pagead/show_ads.js';
+ public $client = null;
+
+ function initialize()
+ {
+ parent::initialize();
+
+ // A little bit of chicanery so we avoid overwriting values that
+ // are passed in with the constructor
+ foreach (array('mediumRectangle', 'rectangle', 'leaderboard', 'wideSkyscraper', 'adScript', 'client') as $setting) {
+ $value = common_config('adsense', strtolower($setting));
+ if (!empty($value)) { // not found
+ $this->$setting = $value;
+ }
+ }
+ }
+
+ /**
+ * Show a medium rectangle 'ad'
+ *
+ * @param Action $action Action being shown
+ *
+ * @return void
+ */
+ protected function showMediumRectangle($action)
+ {
+ $this->showAdsenseCode($action, 300, 250, $this->mediumRectangle);
+ }
+
+ /**
+ * Show a rectangle 'ad'
+ *
+ * @param Action $action Action being shown
+ *
+ * @return void
+ */
+ protected function showRectangle($action)
+ {
+ $this->showAdsenseCode($action, 180, 150, $this->rectangle);
+ }
+
+ /**
+ * Show a wide skyscraper ad
+ *
+ * @param Action $action Action being shown
+ *
+ * @return void
+ */
+ protected function showWideSkyscraper($action)
+ {
+ $this->showAdsenseCode($action, 160, 600, $this->wideSkyscraper);
+ }
+
+ /**
+ * Show a leaderboard ad
+ *
+ * @param Action $action Action being shown
+ *
+ * @return void
+ */
+ protected function showLeaderboard($action)
+ {
+ $this->showAdsenseCode($action, 728, 90, $this->leaderboard);
+ }
+
+ /**
+ * Output the bits of JavaScript code to show Adsense
+ *
+ * @param Action $action Action being shown
+ * @param integer $width Width of the block
+ * @param integer $height Height of the block
+ * @param string $slot Slot identifier
+ *
+ * @return void
+ */
+ protected function showAdsenseCode($action, $width, $height, $slot)
+ {
+ $code = 'google_ad_client = "'.$this->client.'"; ';
+ $code .= 'google_ad_slot = "'.$slot.'"; ';
+ $code .= 'google_ad_width = '.$width.'; ';
+ $code .= 'google_ad_height = '.$height.'; ';
+
+ $action->inlineScript($code);
+
+ $action->script($this->adScript);
+ }
+
+ function onRouterInitialized(URLMapper $m)
+ {
+ $m->connect('panel/adsense',
+ array('action' => 'adsenseadminpanel'));
+
+ return true;
+ }
+
+ function onEndAdminPanelNav(Menu $menu) {
+ if (AdminPanelAction::canAdmin('adsense')) {
+ // TRANS: Menu item title/tooltip
+ $menu_title = _m('AdSense configuration');
+ // TRANS: Menu item for site administration
+ $menu->out->menuItem(common_local_url('adsenseadminpanel'), _m('MENU','AdSense'),
+ $menu_title, $action_name == 'adsenseadminpanel', 'nav_adsense_admin_panel');
+ }
+ return true;
+ }
+
+ function onPluginVersion(array &$versions)
+ {
+ $versions[] = array('name' => 'BlankAdPlugin',
+ 'version' => GNUSOCIAL_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => 'http://status.net/wiki/Plugin:Adsense',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('Plugin to add Google AdSense to StatusNet sites.'));
+ return true;
+ }
+}
diff --git a/plugins/Aim/AimPlugin.php b/plugins/Aim/AimPlugin.php
new file mode 100644
index 0000000000..1a90861e52
--- /dev/null
+++ b/plugins/Aim/AimPlugin.php
@@ -0,0 +1,165 @@
+.
+ *
+ * @category IM
+ * @package StatusNet
+ * @author Craig Andrews
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ // This check helps protect against security problems;
+ // your code file can't be executed directly from the web.
+ exit(1);
+}
+// We bundle the phptoclib library...
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/phptoclib');
+
+/**
+ * Plugin for AIM
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Craig Andrews
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
+ */
+class AimPlugin extends ImPlugin
+{
+ public $user = null;
+ public $password = null;
+ public $publicFeed = array();
+
+ public $transport = 'aim';
+
+ function getDisplayName()
+ {
+ // TRANS: Display name.
+ return _m('AIM');
+ }
+
+ function normalize($screenname)
+ {
+ $screenname = str_replace(" ","", $screenname);
+ return strtolower($screenname);
+ }
+
+ function daemonScreenname()
+ {
+ return $this->user;
+ }
+
+ function validate($screenname)
+ {
+ if(preg_match('/^[a-z]\w{2,15}$/i', $screenname)) {
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ /**
+ * Load related modules when needed
+ *
+ * @param string $cls Name of the class to be loaded
+ *
+ * @return boolean hook value; true means continue processing, false means stop.
+ */
+ function onAutoload($cls)
+ {
+ $dir = dirname(__FILE__);
+
+ switch ($cls)
+ {
+ case 'Aim':
+ require_once(INSTALLDIR.'/plugins/Aim/extlib/phptoclib/aimclassw.php');
+ return false;
+ }
+
+ return parent::onAutoload($cls);
+ }
+
+ function onStartImDaemonIoManagers(&$classes)
+ {
+ parent::onStartImDaemonIoManagers($classes);
+ $classes[] = new AimManager($this); // handles sending/receiving
+ return true;
+ }
+
+ function microiduri($screenname)
+ {
+ return 'aim:' . $screenname;
+ }
+
+ function sendMessage($screenname, $body)
+ {
+ $this->fake_aim->sendIm($screenname, $body);
+ $this->enqueueOutgoingRaw($this->fake_aim->would_be_sent);
+ return true;
+ }
+
+ /**
+ * Accept a queued input message.
+ *
+ * @return true if processing completed, false if message should be reprocessed
+ */
+ function receiveRawMessage($message)
+ {
+ $info=Aim::getMessageInfo($message);
+ $from = $info['from'];
+ $user = $this->getUser($from);
+ $notice_text = $info['message'];
+
+ $this->handleIncoming($from, $notice_text);
+
+ return true;
+ }
+
+ function initialize(){
+ if(!isset($this->user)){
+ // TRANS: Exception thrown in AIM plugin when user has not been specified.
+ throw new Exception(_m('Must specify a user.'));
+ }
+ if(!isset($this->password)){
+ // TRANS: Exception thrown in AIM plugin when password has not been specified.
+ throw new Exception(_m('Must specify a password.'));
+ }
+
+ $this->fake_aim = new Fake_Aim($this->user,$this->password,4);
+ return true;
+ }
+
+ function onPluginVersion(array &$versions)
+ {
+ $versions[] = array('name' => 'AIM',
+ 'version' => GNUSOCIAL_VERSION,
+ 'author' => 'Craig Andrews',
+ 'homepage' => 'http://status.net/wiki/Plugin:AIM',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('The AIM plugin allows users to send and receive notices over the AIM network.'));
+ return true;
+ }
+}
diff --git a/plugins/Aim/lib/aimmanager.php b/plugins/Aim/lib/aimmanager.php
new file mode 100644
index 0000000000..dab41755b3
--- /dev/null
+++ b/plugins/Aim/lib/aimmanager.php
@@ -0,0 +1,100 @@
+.
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+
+/**
+ * AIM background connection manager for AIM-using queue handlers,
+ * allowing them to send outgoing messages on the right connection.
+ *
+ * Input is handled during socket select loop, keepalive pings during idle.
+ * Any incoming messages will be handled.
+ *
+ * In a multi-site queuedaemon.php run, one connection will be instantiated
+ * for each site being handled by the current process that has XMPP enabled.
+ */
+class AimManager extends ImManager
+{
+ public $conn = null;
+ /**
+ * Initialize connection to server.
+ * @return boolean true on success
+ */
+ public function start($master)
+ {
+ if(parent::start($master))
+ {
+ $this->connect();
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ public function getSockets()
+ {
+ $this->connect();
+ if($this->conn){
+ return array($this->conn->myConnection);
+ }else{
+ return array();
+ }
+ }
+
+ /**
+ * Process AIM events that have come in over the wire.
+ * @param resource $socket
+ */
+ public function handleInput($socket)
+ {
+ common_debug("Servicing the AIM queue.");
+ $this->stats('aim_process');
+ $this->conn->receive();
+ }
+
+ function connect()
+ {
+ if (!$this->conn) {
+ $this->conn=new Aim($this->plugin->user,$this->plugin->password,4);
+ $this->conn->registerHandler("IMIn",array($this,"handle_aim_message"));
+ $this->conn->myServer="toc.oscar.aol.com";
+ $this->conn->signon();
+ // @todo i18n FIXME: Update translator documentation, please.
+ // TRANS: No idea what the use case for this message is.
+ $this->conn->setProfile(_m('Send me a message to post a notice'),false);
+ }
+ return $this->conn;
+ }
+
+ function handle_aim_message($data)
+ {
+ $this->plugin->enqueueIncomingRaw($data);
+ return true;
+ }
+
+ function send_raw_message($data)
+ {
+ $this->connect();
+ if (!$this->conn) {
+ return false;
+ }
+ $this->conn->sflapSend($data[0],$data[1],$data[2],$data[3]);
+ return true;
+ }
+}
diff --git a/plugins/AnonymousFave/AnonymousFavePlugin.php b/plugins/AnonymousFave/AnonymousFavePlugin.php
index 841b652401..e5230a8857 100644
--- a/plugins/AnonymousFave/AnonymousFavePlugin.php
+++ b/plugins/AnonymousFave/AnonymousFavePlugin.php
@@ -62,7 +62,7 @@ class AnonymousFavePlugin extends Plugin
// that anonymous faving is allowed for all users.
public $restricted = array();
- function onArgsInitialize() {
+ function onArgsInitialize(array &$args) {
// We always want a session because we're tracking anon users
common_ensure_session();
}
@@ -85,7 +85,7 @@ class AnonymousFavePlugin extends Plugin
return true;
}
- function onEndShowHTML($action)
+ function onEndShowHTML(Action $action)
{
if (!common_logged_in()) {
// Set a place to return to when submitting forms
@@ -93,14 +93,14 @@ class AnonymousFavePlugin extends Plugin
}
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
// Setup ajax calls for favoriting. Usually this is only done when
// a user is logged in.
$action->inlineScript('SN.U.NoticeFavor();');
}
- function onStartInitializeRouter($m)
+ function onStartInitializeRouter(URLMapper $m)
{
$m->connect('main/anonfavor', array('action' => 'AnonFavor'));
$m->connect('main/anondisfavor', array('action' => 'AnonDisFavor'));
diff --git a/plugins/AnonymousFave/actions/anondisfavor.php b/plugins/AnonymousFave/actions/anondisfavor.php
index 6b0fae82c1..1e42ca652b 100644
--- a/plugins/AnonymousFave/actions/anondisfavor.php
+++ b/plugins/AnonymousFave/actions/anondisfavor.php
@@ -47,7 +47,7 @@ class AnonDisfavorAction extends RedirectingAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/AnonymousFave/actions/anonfavor.php b/plugins/AnonymousFave/actions/anonfavor.php
index 287c25cbe9..6ce0e84a16 100644
--- a/plugins/AnonymousFave/actions/anonfavor.php
+++ b/plugins/AnonymousFave/actions/anonfavor.php
@@ -47,7 +47,7 @@ class AnonFavorAction extends RedirectingAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/AnonymousFave/scripts/initialize_fave_tallys.php b/plugins/AnonymousFave/scripts/initialize_fave_tallys.php
index a955620db5..e0d0213d8f 100755
--- a/plugins/AnonymousFave/scripts/initialize_fave_tallys.php
+++ b/plugins/AnonymousFave/scripts/initialize_fave_tallys.php
@@ -27,7 +27,7 @@ Offline script to initialize notice fave tallys
ENDOFHELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$notice = new Notice();
$notice->find();
diff --git a/plugins/ApiLogger/ApiLoggerPlugin.php b/plugins/ApiLogger/ApiLoggerPlugin.php
index 920009de5a..0db34fd5aa 100644
--- a/plugins/ApiLogger/ApiLoggerPlugin.php
+++ b/plugins/ApiLogger/ApiLoggerPlugin.php
@@ -32,7 +32,7 @@ class ApiLoggerPlugin extends Plugin
// 0.1 will check about 10% of hits, etc.
public $frequency = 1.0;
- function onArgsInitialize($args)
+ function onArgsInitialize(array &$args)
{
if (isset($args['action'])) {
$action = strtolower($args['action']);
diff --git a/plugins/Autocomplete/AutocompletePlugin.php b/plugins/Autocomplete/AutocompletePlugin.php
index 0f0c2592c2..0d3fdfc91d 100644
--- a/plugins/Autocomplete/AutocompletePlugin.php
+++ b/plugins/Autocomplete/AutocompletePlugin.php
@@ -39,7 +39,7 @@ class AutocompletePlugin extends Plugin
parent::__construct();
}
- function onEndShowScripts($action){
+ function onEndShowScripts(Action $action){
if (common_logged_in()) {
$action->element('span', array('id' => 'autocomplete-api',
'data-url' => common_local_url('autocomplete')));
@@ -47,7 +47,7 @@ class AutocompletePlugin extends Plugin
}
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('main/autocomplete/suggest', array('action'=>'autocomplete'));
}
diff --git a/plugins/Autocomplete/actions/autocomplete.php b/plugins/Autocomplete/actions/autocomplete.php
index 04acaefd38..c3e0433a89 100644
--- a/plugins/Autocomplete/actions/autocomplete.php
+++ b/plugins/Autocomplete/actions/autocomplete.php
@@ -178,7 +178,7 @@ class AutocompleteAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/BitlyUrl/BitlyUrlPlugin.php b/plugins/BitlyUrl/BitlyUrlPlugin.php
index 13a1bf2ec4..3b6474dd86 100644
--- a/plugins/BitlyUrl/BitlyUrlPlugin.php
+++ b/plugins/BitlyUrl/BitlyUrlPlugin.php
@@ -188,7 +188,7 @@ class BitlyUrlPlugin extends UrlShortenerPlugin
/**
* Add the bit.ly admin panel to the list...
*/
- function onEndAdminPanelNav($nav)
+ function onEndAdminPanelNav(Menu $nav)
{
if (AdminPanelAction::canAdmin('bitly')) {
$action_name = $nav->action->trimmed('action');
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php
index bad89f2457..d1ee2912af 100644
--- a/plugins/Blacklist/BlacklistPlugin.php
+++ b/plugins/Blacklist/BlacklistPlugin.php
@@ -122,7 +122,7 @@ class BlacklistPlugin extends Plugin
*
* @return boolean hook value
*/
- function onStartRegisterUser(&$user, &$profile)
+ function onStartRegisterUser(User &$user, Profile &$profile)
{
$homepage = strtolower($profile->homepage);
@@ -330,7 +330,7 @@ class BlacklistPlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndAdminPanelNav($nav)
+ function onEndAdminPanelNav(Menu $nav)
{
if (AdminPanelAction::canAdmin('blacklist')) {
@@ -348,7 +348,7 @@ class BlacklistPlugin extends Plugin
return true;
}
- function onEndDeleteUserForm($action, $user)
+ function onEndDeleteUserForm(Action $action, User $user)
{
$cur = common_current_user();
@@ -386,7 +386,7 @@ class BlacklistPlugin extends Plugin
$action->elementEnd('ul');
}
- function onEndDeleteUser($action, $user)
+ function onEndDeleteUser(Action $action, User $user)
{
if ($action->boolean('blacklisthomepage')) {
$pattern = $action->trimmed('blacklisthomepagepattern');
@@ -401,7 +401,7 @@ class BlacklistPlugin extends Plugin
return true;
}
- function checkboxAndText($action, $checkID, $label, $textID, $value)
+ private function checkboxAndText(Action $action, $checkID, $label, $textID, $value)
{
$action->element('input', array('name' => $checkID,
'type' => 'checkbox',
@@ -433,17 +433,17 @@ class BlacklistPlugin extends Plugin
return $hostname;
}
- function onStartHandleFeedEntry($activity)
+ function onStartHandleFeedEntry(Activity $activity)
{
return $this->_checkActivity($activity);
}
- function onStartHandleSalmon($activity)
+ function onStartHandleSalmon(Activity $activity)
{
return $this->_checkActivity($activity);
}
- function _checkActivity($activity)
+ function _checkActivity(Activity $activity)
{
$actor = $activity->actor;
diff --git a/plugins/BlogspamNet/BlogspamNetPlugin.php b/plugins/BlogspamNet/BlogspamNetPlugin.php
index 2cab69be30..3df1e29f2e 100644
--- a/plugins/BlogspamNet/BlogspamNetPlugin.php
+++ b/plugins/BlogspamNet/BlogspamNetPlugin.php
@@ -65,7 +65,7 @@ class BlogspamNetPlugin extends Plugin
}
}
- function onStartNoticeSave($notice)
+ function onStartNoticeSave(Notice $notice)
{
$args = $this->testArgs($notice);
common_debug("Blogspamnet args = " . print_r($args, TRUE));
diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php
index 8b4abd2b42..5186132d20 100644
--- a/plugins/Bookmark/BookmarkPlugin.php
+++ b/plugins/Bookmark/BookmarkPlugin.php
@@ -57,7 +57,7 @@ class BookmarkPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
- function onUserRightsCheck($profile, $right, &$result)
+ function onUserRightsCheck(Profile $profile, $right, &$result)
{
if ($right == self::IMPORTDELICIOUS) {
$result = !$profile->isSilenced();
@@ -90,13 +90,13 @@ class BookmarkPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
- function onEndShowStyles($action)
+ function onEndShowStyles(Action $action)
{
$action->cssLink($this->path('css/bookmark.css'));
return true;
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$action->script($this->path('js/bookmark.js'));
return true;
@@ -163,7 +163,7 @@ class BookmarkPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
- function onEndInitializeQueueManager($qm)
+ function onEndInitializeQueueManager(QueueManager $qm)
{
$qm->connect('dlcsback', 'DeliciousBackupImporter');
$qm->connect('dlcsbkmk', 'DeliciousBookmarkImporter');
@@ -219,7 +219,7 @@ class BookmarkPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
- function onEndProfileSettingsActions($action)
+ function onEndProfileSettingsActions(Action $action)
{
$user = common_current_user();
diff --git a/plugins/Bookmark/actions/apitimelinebookmarks.php b/plugins/Bookmark/actions/apitimelinebookmarks.php
index ee43617127..ac65722480 100644
--- a/plugins/Bookmark/actions/apitimelinebookmarks.php
+++ b/plugins/Bookmark/actions/apitimelinebookmarks.php
@@ -57,7 +57,7 @@ class ApiTimelineBookmarksAction extends ApiBareAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -82,7 +82,7 @@ class ApiTimelineBookmarksAction extends ApiBareAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showTimeline();
@@ -207,7 +207,7 @@ class ApiTimelineBookmarksAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Bookmark/actions/bookmarkforurl.php b/plugins/Bookmark/actions/bookmarkforurl.php
index c4cc4a8487..9fc0166b08 100644
--- a/plugins/Bookmark/actions/bookmarkforurl.php
+++ b/plugins/Bookmark/actions/bookmarkforurl.php
@@ -59,7 +59,7 @@ class BookmarkforurlAction extends Action
*
* @return boolean true
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -103,11 +103,9 @@ class BookmarkforurlAction extends Action
* Handler method
*
* @param array $args is ignored since it's now passed in in prepare()
- *
* @return void
*/
-
- function handle($args=null)
+ function handle(array $args=array())
{
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
@@ -126,11 +124,9 @@ class BookmarkforurlAction extends Action
* MAY override
*
* @param array $args other arguments
- *
* @return boolean is read only action?
*/
-
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/plugins/Bookmark/actions/bookmarks.php b/plugins/Bookmark/actions/bookmarks.php
index 6c79fa1d02..65a61a0bfb 100644
--- a/plugins/Bookmark/actions/bookmarks.php
+++ b/plugins/Bookmark/actions/bookmarks.php
@@ -60,7 +60,7 @@ class BookmarksAction extends Action
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -74,7 +74,7 @@ class BookmarksAction extends Action
$nickname = $this->returnToArgs();
$nickname = $nickname[1]['nickname'];
}
-
+
$this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
@@ -107,7 +107,7 @@ class BookmarksAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -223,7 +223,7 @@ class BookmarksAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Bookmark/actions/bookmarksrss.php b/plugins/Bookmark/actions/bookmarksrss.php
index 955b782666..8e2d8319db 100644
--- a/plugins/Bookmark/actions/bookmarksrss.php
+++ b/plugins/Bookmark/actions/bookmarksrss.php
@@ -46,7 +46,45 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/
class BookmarksrssAction extends TargetedRss10Action
{
+<<<<<<< .merge_file_wVLYTY
protected function getNotices()
+=======
+ /** The user whose bookmarks to display */
+
+ var $user = null;
+
+ /**
+ * Find the user to display by supplied nickname
+ *
+ * @param array $args Arguments from $_REQUEST
+ *
+ * @return boolean success
+ */
+ function prepare(array $args=array())
+ {
+ parent::prepare($args);
+
+ $nickname = $this->trimmed('nickname');
+ $this->user = User::getKV('nickname', $nickname);
+
+ if (!$this->user) {
+ // TRANS: Client error displayed when trying to get the RSS feed with bookmarks of a user that does not exist.
+ $this->clientError(_('No such user.'));
+ } else {
+ $this->notices = $this->getNotices($this->limit);
+ return true;
+ }
+ }
+
+ /**
+ * Get notices
+ *
+ * @param integer $limit max number of notices to return
+ *
+ * @return array notices
+ */
+ function getNotices($limit=0)
+>>>>>>> .merge_file_BfWnQY
{
$stream = new BookmarksNoticeStream($this->target->getID(), true);
return $stream->getNotices(0, $this->limit)->fetchAll();
diff --git a/plugins/Bookmark/actions/importdelicious.php b/plugins/Bookmark/actions/importdelicious.php
index 85a63e8470..149e807343 100644
--- a/plugins/Bookmark/actions/importdelicious.php
+++ b/plugins/Bookmark/actions/importdelicious.php
@@ -245,7 +245,7 @@ class ImportdeliciousAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return !$this->isPost();
}
diff --git a/plugins/Bookmark/actions/newbookmark.php b/plugins/Bookmark/actions/newbookmark.php
index 470ad417a4..466cbc5d80 100644
--- a/plugins/Bookmark/actions/newbookmark.php
+++ b/plugins/Bookmark/actions/newbookmark.php
@@ -143,7 +143,7 @@ class NewbookmarkAction extends FormAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Bookmark/actions/noticebyurl.php b/plugins/Bookmark/actions/noticebyurl.php
index d5f9940805..e0eb61a05e 100644
--- a/plugins/Bookmark/actions/noticebyurl.php
+++ b/plugins/Bookmark/actions/noticebyurl.php
@@ -142,7 +142,7 @@ class NoticebyurlAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Bookmark/classes/Bookmark.php b/plugins/Bookmark/classes/Bookmark.php
index b593bc1909..cead83e259 100644
--- a/plugins/Bookmark/classes/Bookmark.php
+++ b/plugins/Bookmark/classes/Bookmark.php
@@ -92,12 +92,16 @@ class Bookmark extends Managed_DataObject
* @return Bookmark The found bookmark object.
* @throws NoResultException When you don't find it after all.
*/
+<<<<<<< .merge_file_5dZvDX
static public function fromStored(Notice $stored)
{
return self::getByPK(array('uri' => $stored->getUri()));
}
public function getStored()
+=======
+ static function getByNotice(Notice $notice)
+>>>>>>> .merge_file_cVGSQX
{
return Notice::getByKeys(array('uri' => $this->getUri()));
}
@@ -157,7 +161,12 @@ class Bookmark extends Managed_DataObject
*
* @return Bookmark the Bookmark object
*/
+<<<<<<< .merge_file_5dZvDX
static function saveActivityObject(ActivityObject $actobj, Notice $stored)
+=======
+ static function saveNew(Profile $profile, $title, $url, $rawtags, $description,
+ array $options=array())
+>>>>>>> .merge_file_cVGSQX
{
$url = null;
// each extra element is array('tagname', array('attr'=>'val', ...), 'content')
@@ -177,11 +186,20 @@ class Bookmark extends Managed_DataObject
throw new ClientException(sprintf(_m('Expected exactly 1 link rel=related in a Bookmark, got %1$d.'), count($relLinkEls)));
}
+<<<<<<< .merge_file_5dZvDX
if (!strlen($actobj->title)) {
throw new ClientException(_m('You must provide a non-empty title.'));
}
if (!common_valid_http_url($url)) {
throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).'));
+=======
+ if (array_key_exists('uri', $options)) {
+ $other = Bookmark::getKV('uri', $options['uri']);
+ if (!empty($other)) {
+ // TRANS: Client exception thrown when trying to save a new bookmark that already exists.
+ throw new ClientException(_m('Bookmark already exists.'));
+ }
+>>>>>>> .merge_file_cVGSQX
}
try {
diff --git a/plugins/Bookmark/scripts/importbookmarks.php b/plugins/Bookmark/scripts/importbookmarks.php
index c47a042973..af7dd2d1e0 100644
--- a/plugins/Bookmark/scripts/importbookmarks.php
+++ b/plugins/Bookmark/scripts/importbookmarks.php
@@ -42,7 +42,7 @@ Restore a backed-up Delicious.com bookmark file
-f --file file to read from (STDIN by default)
END_OF_IMPORTBOOKMARKS_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
/**
* Get the bookmarks file as a string
diff --git a/plugins/CasAuthentication/CasAuthenticationPlugin.php b/plugins/CasAuthentication/CasAuthenticationPlugin.php
index 461655264e..423d22ddb1 100644
--- a/plugins/CasAuthentication/CasAuthenticationPlugin.php
+++ b/plugins/CasAuthentication/CasAuthenticationPlugin.php
@@ -60,7 +60,7 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
return parent::onAutoload($cls);
}
- function onArgsInitialize(&$args)
+ function onArgsInitialize(array &$args)
{
if($this->takeOverLogin && $args['action'] == 'login')
{
@@ -68,13 +68,13 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
}
}
- function onStartInitializeRouter($m)
+ function onStartInitializeRouter(URLMapper $m)
{
$m->connect('main/cas', array('action' => 'caslogin'));
return true;
}
- function onEndLoginGroupNav($action)
+ function onEndLoginGroupNav(Action $action)
{
$action_name = $action->trimmed('action');
@@ -88,7 +88,7 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
return true;
}
- function onEndShowPageNotice($action)
+ function onEndShowPageNotice(Action $action)
{
$name = $action->trimmed('action');
diff --git a/plugins/CasAuthentication/actions/caslogin.php b/plugins/CasAuthentication/actions/caslogin.php
index 09377c62eb..96e252b824 100644
--- a/plugins/CasAuthentication/actions/caslogin.php
+++ b/plugins/CasAuthentication/actions/caslogin.php
@@ -21,7 +21,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class CasloginAction extends Action
{
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (common_is_real_login()) {
diff --git a/plugins/ClientSideShorten/ClientSideShortenPlugin.php b/plugins/ClientSideShorten/ClientSideShortenPlugin.php
index 4d87ab2240..9dd3b1f515 100644
--- a/plugins/ClientSideShorten/ClientSideShortenPlugin.php
+++ b/plugins/ClientSideShorten/ClientSideShortenPlugin.php
@@ -38,7 +38,7 @@ class ClientSideShortenPlugin extends Plugin
parent::__construct();
}
- function onEndShowScripts($action){
+ function onEndShowScripts(Action $action){
if (common_logged_in()) {
$user = common_current_user();
$action->inlineScript('var maxNoticeLength = ' . User_urlshortener_prefs::maxNoticeLength($user));
@@ -47,7 +47,7 @@ class ClientSideShortenPlugin extends Plugin
}
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
if (common_logged_in()) {
$m->connect('plugins/ClientSideShorten/shorten', array('action'=>'shorten'));
diff --git a/plugins/ClientSideShorten/actions/shorten.php b/plugins/ClientSideShorten/actions/shorten.php
index 6840d532aa..376e245fc7 100644
--- a/plugins/ClientSideShorten/actions/shorten.php
+++ b/plugins/ClientSideShorten/actions/shorten.php
@@ -45,7 +45,7 @@ class ShortenAction extends Action
{
private $text;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->groups=array();
@@ -58,7 +58,7 @@ class ShortenAction extends Action
return true;
}
- function handle($args=null)
+ function handle(array $args=array())
{
parent::handle($args);
header('Content-Type: text/plain');
diff --git a/plugins/ConversationTree/lib/conversationtree.php b/plugins/ConversationTree/lib/conversationtree.php
index 144902fce2..ff39b3e4f4 100644
--- a/plugins/ConversationTree/lib/conversationtree.php
+++ b/plugins/ConversationTree/lib/conversationtree.php
@@ -140,7 +140,7 @@ class ConversationTree extends NoticeList
*
* @return NoticeListItem a list item to show
*/
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new ConversationTreeItem($notice, $this->out);
}
diff --git a/plugins/DirectMessage/DirectMessagePlugin.php b/plugins/DirectMessage/DirectMessagePlugin.php
index de13ef680f..34533ba9e8 100644
--- a/plugins/DirectMessage/DirectMessagePlugin.php
+++ b/plugins/DirectMessage/DirectMessagePlugin.php
@@ -149,7 +149,7 @@ class DirectMessagePlugin extends Plugin
return true;
}
- public function onProfileDeleteRelated(Profile $profile, &$related)
+ public function onProfileDeleteRelated(Profile $profile, array &$related)
{
$msg = new Message();
$msg->from_profile = $profile->id;
diff --git a/plugins/DirectMessage/actions/apidirectmessage.php b/plugins/DirectMessage/actions/apidirectmessage.php
index 8e7f6f8061..52417ae4fc 100644
--- a/plugins/DirectMessage/actions/apidirectmessage.php
+++ b/plugins/DirectMessage/actions/apidirectmessage.php
@@ -60,7 +60,11 @@ class ApiDirectMessageAction extends ApiAuthAction
*
* @return boolean success flag
*/
+<<<<<<< .merge_file_m7N4pd
protected function prepare(array $args=array())
+=======
+ function prepare(array $args=array())
+>>>>>>> .merge_file_lMcE3c
{
parent::prepare($args);
@@ -110,7 +114,20 @@ class ApiDirectMessageAction extends ApiAuthAction
return true;
}
+<<<<<<< .merge_file_m7N4pd
protected function handle()
+=======
+ /**
+ * Handle the request
+ *
+ * Show the messages
+ *
+ * @param array $args $_REQUEST data (unused)
+ *
+ * @return void
+ */
+ function handle(array $args=array())
+>>>>>>> .merge_file_lMcE3c
{
parent::handle();
$this->showMessages();
@@ -186,7 +203,7 @@ class ApiDirectMessageAction extends ApiAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/DirectMessage/actions/showmessage.php b/plugins/DirectMessage/actions/showmessage.php
index 86fbee8b73..0987ee3aa7 100644
--- a/plugins/DirectMessage/actions/showmessage.php
+++ b/plugins/DirectMessage/actions/showmessage.php
@@ -62,7 +62,7 @@ class ShowmessageAction extends Action
*
* @return success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -89,7 +89,7 @@ class ShowmessageAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
$this->showPage();
}
@@ -124,7 +124,7 @@ class ShowmessageAction extends Action
$this->elementEnd('ul');
}
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/DirectMessage/classes/Message.php b/plugins/DirectMessage/classes/Message.php
index 5f8d27b4f1..29c177445c 100644
--- a/plugins/DirectMessage/classes/Message.php
+++ b/plugins/DirectMessage/classes/Message.php
@@ -83,12 +83,14 @@ class Message extends Managed_DataObject
$msg->from_profile = $from;
$msg->to_profile = $to;
- if ($user) {
+
+ if ($user instanceof User) {
// Use the sender's URL shortening options.
$msg->content = $user->shortenLinks($content);
} else {
$msg->content = common_shorten_links($content);
}
+
$msg->rendered = common_render_text($msg->content);
$msg->created = common_sql_now();
$msg->source = $source;
diff --git a/plugins/DirectMessage/lib/inboxmessagelist.php b/plugins/DirectMessage/lib/inboxmessagelist.php
index f24f540b04..07c62ac850 100644
--- a/plugins/DirectMessage/lib/inboxmessagelist.php
+++ b/plugins/DirectMessage/lib/inboxmessagelist.php
@@ -4,7 +4,126 @@ if (!defined('GNUSOCIAL')) { exit(1); }
class InboxMessageList extends MessageList
{
+<<<<<<< .merge_file_NIw5Kk
function newItem($message)
+=======
+ var $page = null;
+
+ function prepare(array $args=array())
+ {
+ parent::prepare($args);
+
+ $nickname = common_canonical_nickname($this->arg('nickname'));
+ $this->user = User::getKV('nickname', $nickname);
+ $this->page = $this->trimmed('page');
+
+ if (!$this->page) {
+ $this->page = 1;
+ }
+
+ common_set_returnto($this->selfUrl());
+
+ return true;
+ }
+
+ /**
+ * output page based on arguments
+ *
+ * @param array $args HTTP arguments (from $_REQUEST)
+ *
+ * @return void
+ */
+ function handle(array $args=array())
+ {
+ parent::handle($args);
+
+ if (!$this->user) {
+ // TRANS: Client error displayed when trying to access a mailbox without providing a user.
+ $this->clientError(_('No such user.'), 404);
+ }
+
+ $cur = common_current_user();
+
+ if (!$cur || $cur->id != $this->user->id) {
+ // TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
+ $this->clientError(_('Only the user can read their own mailboxes.'), 403);
+ }
+
+ $this->showPage();
+ }
+
+ function showNoticeForm()
+ {
+ $message_form = new MessageForm($this);
+ $message_form->show();
+ }
+
+ function showContent()
+ {
+ $message = $this->getMessages();
+
+ if ($message) {
+
+ $ml = $this->getMessageList($message);
+
+ $cnt = $ml->show();
+
+ $this->pagination($this->page > 1,
+ $cnt > MESSAGES_PER_PAGE,
+ $this->page,
+ $this->trimmed('action'),
+ array('nickname' => $this->user->nickname));
+ } else {
+ $this->element('p',
+ 'guide',
+ // TRANS: Message displayed when there are no private messages in the inbox of a user.
+ _('You have no private messages. '.
+ 'You can send private message to engage other users in conversation. '.
+ 'People can send you messages for your eyes only.'));
+ }
+ }
+
+ function getMessages()
+ {
+ return null;
+ }
+
+ function getMessageList($message)
+ {
+ return null;
+ }
+
+ /**
+ * Show the page notice
+ *
+ * Shows instructions for the page
+ *
+ * @return void
+ */
+ function showPageNotice()
+ {
+ $instr = $this->getInstructions();
+ $output = common_markup_to_html($instr);
+
+ $this->elementStart('div', 'instructions');
+ $this->raw($output);
+ $this->elementEnd('div');
+ }
+
+ /**
+ * Mailbox actions are read only
+ *
+ * @param array $args other arguments
+ *
+ * @return boolean
+ */
+ function isReadOnly(array $args=array())
+ {
+ return true;
+ }
+
+ function showObjectNav()
+>>>>>>> .merge_file_WapUGk
{
return new InboxMessageListItem($this->out, $message);
}
diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php
index b721ebb20e..f0b56bb53e 100644
--- a/plugins/DirectionDetector/DirectionDetectorPlugin.php
+++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php
@@ -36,7 +36,7 @@ class DirectionDetectorPlugin extends Plugin {
*
* @param object $notice notice is going to be saved
*/
- public function onStartNoticeSave($notice){
+ public function onStartNoticeSave(Notice $notice){
// don't use getRendered() here since it's not saved yet and thus can't ->update in case that would happen
if(!preg_match('//', $notice->rendered) && self::isRTL($notice->content))
$notice->rendered = ''.$notice->rendered.'';
@@ -49,7 +49,7 @@ class DirectionDetectorPlugin extends Plugin {
* @param string $content
* @return boolean
*/
- public static function isRTL($content){
+ public static function isRTL($content) {
$content = self::getClearText($content);
$words = explode(' ', $content);
$rtl = 0;
@@ -72,7 +72,7 @@ class DirectionDetectorPlugin extends Plugin {
* @param string $str
* @return boolean
*/
- public static function startsWithRTLCharacter($str){
+ public static function startsWithRTLCharacter($str ){
if (strlen($str) < 1) {
return false;
}
@@ -107,7 +107,7 @@ class DirectionDetectorPlugin extends Plugin {
* @param string $str
* @return string
*/
- private static function getClearText($str){
+ private static function getClearText($str) {
$str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group
$str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet
$str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces
@@ -119,7 +119,7 @@ class DirectionDetectorPlugin extends Plugin {
*
* @param Action $action
*/
- function onEndShowScripts($action){
+ function onEndShowScripts(Action $action){
if (common_logged_in()) {
$action->script($this->path('jquery.DirectionDetector.js'));
}
diff --git a/plugins/Directory/DirectoryPlugin.php b/plugins/Directory/DirectoryPlugin.php
index e06c1c7271..d940b813db 100644
--- a/plugins/Directory/DirectoryPlugin.php
+++ b/plugins/Directory/DirectoryPlugin.php
@@ -82,37 +82,36 @@ class DirectoryPlugin extends Plugin
$m->connect(
'directory/users/:filter/sort_by/:sort/reverse/:reverse',
array('action' => 'userdirectory'),
- array('filter' => '[0-9a-zA-Z]|(0-9)'),
+ array('filter' => '[0-9a-zA-Z]|(0-9)'),
array('sort' => '[a-z]+'),
- array('reverse' => '[0-9]')
+ array('reverse' => '[0-9]')
);
$m->connect(
'directory/users/:filter/sort_by/:sort',
array('action' => 'userdirectory'),
- array('filter' => '[0-9a-zA-Z]|(0-9)'),
- array('sort' => '[a-z]+')
- );
-
+ array('filter' => '[0-9a-zA-Z]|(0-9)'),
+ array('sort' => '[a-z]+')
+ );
$m->connect(
'directory/users/:filter',
array('action' => 'userdirectory'),
array('filter' => '[0-9a-zA-Z]|(0-9)')
);
-
+
$m->connect(
'directory/users/sort_by/:sort/reverse/:reverse',
array('action' => 'userdirectory'),
array('sort' => '[a-z]+'),
- array('reverse' => '[0-9]')
+ array('reverse' => '[0-9]')
);
$m->connect(
'directory/users/sort_by/:sort',
array('action' => 'userdirectory'),
- array('sort' => '[a-z]+')
- );
+ array('sort' => '[a-z]+')
+ );
$m->connect(
'directory/users',
@@ -135,7 +134,6 @@ class DirectoryPlugin extends Plugin
array('action' => 'groupdirectory')
);
-
return true;
}
diff --git a/plugins/Directory/actions/groupdirectory.php b/plugins/Directory/actions/groupdirectory.php
index 124ccffe75..a8485bd414 100644
--- a/plugins/Directory/actions/groupdirectory.php
+++ b/plugins/Directory/actions/groupdirectory.php
@@ -129,7 +129,7 @@ class GroupdirectoryAction extends ManagedAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Directory/actions/userdirectory.php b/plugins/Directory/actions/userdirectory.php
index f178408e8b..55ce0de420 100644
--- a/plugins/Directory/actions/userdirectory.php
+++ b/plugins/Directory/actions/userdirectory.php
@@ -127,7 +127,7 @@ class UserdirectoryAction extends ManagedAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Directory/lib/sortablegrouplist.php b/plugins/Directory/lib/sortablegrouplist.php
index 0da705e919..c41c57c365 100644
--- a/plugins/Directory/lib/sortablegrouplist.php
+++ b/plugins/Directory/lib/sortablegrouplist.php
@@ -105,7 +105,11 @@ class SortableGroupList extends SortableSubscriptionList
$this->out->elementStart('tbody');
}
+<<<<<<< .merge_file_3awMBt
function newListItem(Profile $profile)
+=======
+ function newListItem(Profile $profile, $odd)
+>>>>>>> .merge_file_0Q1cxt
{
return new SortableGroupListItem($profile, $this->owner, $this->action);
}
@@ -218,8 +222,8 @@ class SortableGroupListItem extends SortableSubscriptionListItem
function showJoinButton()
{
$user = $this->owner;
- if ($user) {
+ if ($user instanceof User) {
$this->out->elementStart('li', 'entity_subscribe');
// XXX: special-case for user looking at own
// subscriptions page
diff --git a/plugins/Directory/lib/sortablesubscriptionlist.php b/plugins/Directory/lib/sortablesubscriptionlist.php
index ec8874b2e5..f37ccc05f7 100644
--- a/plugins/Directory/lib/sortablesubscriptionlist.php
+++ b/plugins/Directory/lib/sortablesubscriptionlist.php
@@ -114,7 +114,34 @@ class SortableSubscriptionList extends SubscriptionList
$this->out->elementEnd('table');
}
+<<<<<<< .merge_file_0ePMGB
function newListItem(Profile $profile)
+=======
+ function showProfiles()
+ {
+ // Note: we don't use fetchAll() because it's borked with query()
+
+ $profiles = array();
+
+ while ($this->profile->fetch()) {
+ $profiles[] = clone($this->profile);
+ }
+
+ $cnt = count($profiles);
+
+ $max = min($cnt, $this->maxProfiles());
+
+ for ($i = 0; $i < $max; $i++) {
+ $odd = ($i % 2 == 0); // for zebra striping
+ $pli = $this->newListItem($profiles[$i], $odd);
+ $pli->show();
+ }
+
+ return $cnt;
+ }
+
+ function newListItem(Profile $profile, $odd)
+>>>>>>> .merge_file_vaqBzB
{
return new SortableSubscriptionListItem($profile, $this->owner, $this->action);
}
diff --git a/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php b/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php
index 062151db17..2443139af6 100644
--- a/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php
+++ b/plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php
@@ -124,7 +124,7 @@ class DomainStatusNetworkPlugin extends Plugin
return true;
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
if (common_config('globalapi', 'enabled')) {
foreach (array('register', 'login', 'recover') as $method) {
diff --git a/plugins/DomainStatusNetwork/actions/globalapi.php b/plugins/DomainStatusNetwork/actions/globalapi.php
index d47a254940..b283ce8da6 100644
--- a/plugins/DomainStatusNetwork/actions/globalapi.php
+++ b/plugins/DomainStatusNetwork/actions/globalapi.php
@@ -57,7 +57,7 @@ class GlobalApiAction extends Action
* @return boolean continuation flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
GNUsocial::setApi(true); // reduce exception reports to aid in debugging
diff --git a/plugins/DomainStatusNetwork/scripts/installforemail.php b/plugins/DomainStatusNetwork/scripts/installforemail.php
index f773094a74..1815b97759 100755
--- a/plugins/DomainStatusNetwork/scripts/installforemail.php
+++ b/plugins/DomainStatusNetwork/scripts/installforemail.php
@@ -35,7 +35,7 @@ Create a new account and, if necessary, a new network for the given email addres
END_OF_INSTALLFOREMAIL_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$email = $args[0];
diff --git a/plugins/DomainStatusNetwork/scripts/proposesite.php b/plugins/DomainStatusNetwork/scripts/proposesite.php
index 96a722fdab..28741a5d4f 100755
--- a/plugins/DomainStatusNetwork/scripts/proposesite.php
+++ b/plugins/DomainStatusNetwork/scripts/proposesite.php
@@ -28,7 +28,7 @@ Prints site information for the domain given
END_OF_SITEFORDOMAIN_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$domain = DomainStatusNetworkPlugin::toDomain($args[0]);
diff --git a/plugins/DomainStatusNetwork/scripts/sitefordomain.php b/plugins/DomainStatusNetwork/scripts/sitefordomain.php
index 59412cceba..2eaa600d25 100755
--- a/plugins/DomainStatusNetwork/scripts/sitefordomain.php
+++ b/plugins/DomainStatusNetwork/scripts/sitefordomain.php
@@ -28,7 +28,7 @@ Prints site information for the domain given
END_OF_SITEFORDOMAIN_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$domain = DomainStatusNetworkPlugin::toDomain($args[0]);
diff --git a/plugins/DomainWhitelist/DomainWhitelistPlugin.php b/plugins/DomainWhitelist/DomainWhitelistPlugin.php
index 2e15dd809a..76486f65b0 100644
--- a/plugins/DomainWhitelist/DomainWhitelistPlugin.php
+++ b/plugins/DomainWhitelist/DomainWhitelistPlugin.php
@@ -65,7 +65,7 @@ class DomainWhitelistPlugin extends Plugin
*
* @return boolean hook flag
*/
- function onEndShowStatusNetScripts($action) {
+ public function onEndShowStatusNetScripts(Action $action) {
$name = $action->arg('action');
if ($name == 'invite') {
$action->script($this->getPath() . '/js/whitelistinvite.js');
@@ -73,13 +73,14 @@ class DomainWhitelistPlugin extends Plugin
return true;
}
- function onRequireValidatedEmailPlugin_Override($user, &$knownGood)
+ public function onRequireValidatedEmailPlugin_Override(User $user, &$knownGood)
{
$knownGood = (!empty($user->email) && $this->matchesWhitelist($user->email));
return true;
}
- function onEndValidateUserEmail($user, $email, &$valid)
+ // @TODO Most callers are given NULL as first argument
+ public function onEndValidateUserEmail($user, $email, &$valid)
{
if ($valid) { // it's otherwise valid
if (!$this->matchesWhitelist($email)) {
@@ -102,7 +103,7 @@ class DomainWhitelistPlugin extends Plugin
return true;
}
- function onStartAddEmailAddress($user, $email)
+ public function onStartAddEmailAddress(User $user, $email)
{
if (!$this->matchesWhitelist($email)) {
// TRANS: Exception thrown when an e-mail address does not match the site's domain whitelist.
diff --git a/plugins/EmailRegistration/EmailRegistrationPlugin.php b/plugins/EmailRegistration/EmailRegistrationPlugin.php
index 9e0fd58856..77ac763bd0 100644
--- a/plugins/EmailRegistration/EmailRegistrationPlugin.php
+++ b/plugins/EmailRegistration/EmailRegistrationPlugin.php
@@ -49,7 +49,7 @@ class EmailRegistrationPlugin extends Plugin
{
const CONFIRMTYPE = 'register';
- function onArgsInitialize(&$args)
+ function onArgsInitialize(array &$args)
{
if (array_key_exists('action', $args) && $args['action'] == 'register') {
// YOINK!
@@ -72,7 +72,7 @@ class EmailRegistrationPlugin extends Plugin
$dir = dirname(__FILE__);
// @todo FIXME: i18n issue.
- $docFile = DocFile::forTitle($title, $dir.'/doc-src/');
+ $docFile = DocFile::forTitle($title, array($dir . '/doc-src/'));
if (!empty($docFile)) {
$output = $docFile->toHTML();
@@ -163,7 +163,7 @@ class EmailRegistrationPlugin extends Plugin
mail_send($recipients, $headers, $body);
}
- function onEndDocFileForTitle($title, $paths, &$filename)
+ function onEndDocFileForTitle($title, array $paths, &$filename)
{
if ($title == 'confirmemailreg' && empty($filename)) {
$filename = dirname(__FILE__).'/mail-src/'.$title;
diff --git a/plugins/EmailRegistration/actions/emailregister.php b/plugins/EmailRegistration/actions/emailregister.php
index 7fa2aa22cf..44c60e2cf2 100644
--- a/plugins/EmailRegistration/actions/emailregister.php
+++ b/plugins/EmailRegistration/actions/emailregister.php
@@ -391,7 +391,7 @@ class EmailregisterAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
diff --git a/plugins/EmailRegistration/scripts/cancelemailregistration.php b/plugins/EmailRegistration/scripts/cancelemailregistration.php
index d834aade60..7ae81f7ccf 100755
--- a/plugins/EmailRegistration/scripts/cancelemailregistration.php
+++ b/plugins/EmailRegistration/scripts/cancelemailregistration.php
@@ -33,7 +33,7 @@ Cancel an email registration code
END_OF_REGISTEREMAILUSER_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
if (count($args) == 0) {
show_help();
diff --git a/plugins/EmailRegistration/scripts/registeremailuser.php b/plugins/EmailRegistration/scripts/registeremailuser.php
index 02915240d3..a785a76a66 100755
--- a/plugins/EmailRegistration/scripts/registeremailuser.php
+++ b/plugins/EmailRegistration/scripts/registeremailuser.php
@@ -34,7 +34,7 @@ register a new user by email address.
END_OF_REGISTEREMAILUSER_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
if (count($args) == 0) {
show_help();
diff --git a/plugins/EmailReminder/EmailReminderPlugin.php b/plugins/EmailReminder/EmailReminderPlugin.php
index 9ac6275537..9ba3d125e1 100644
--- a/plugins/EmailReminder/EmailReminderPlugin.php
+++ b/plugins/EmailReminder/EmailReminderPlugin.php
@@ -68,7 +68,7 @@ class EmailReminderPlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndInitializeQueueManager($qm)
+ function onEndInitializeQueueManager(QueueManager $qm)
{
$qm->connect('siterem', 'SiteConfirmReminderHandler');
$qm->connect('uregrem', 'UserConfirmRegReminderHandler');
@@ -77,7 +77,7 @@ class EmailReminderPlugin extends Plugin
return true;
}
- function onEndDocFileForTitle($title, $paths, &$filename)
+ function onEndDocFileForTitle($title, array $paths, &$filename)
{
if (empty($filename)) {
$filename = dirname(__FILE__) . '/mail-src/' . $title;
@@ -127,6 +127,7 @@ class EmailReminderPlugin extends Plugin
* Send a real live email reminder
*
* @todo This would probably be better as two or more sep functions
+ * @todo Add language support?
*
* @param string $type type of reminder
* @param mixed $object Confirm_address or Invitation object
diff --git a/plugins/EmailReminder/scripts/sendemailreminder.php b/plugins/EmailReminder/scripts/sendemailreminder.php
index 5b5b26dde3..b126f9e049 100755
--- a/plugins/EmailReminder/scripts/sendemailreminder.php
+++ b/plugins/EmailReminder/scripts/sendemailreminder.php
@@ -35,7 +35,7 @@ Send an email summary of the inbox to users
END_OF_SENDEMAILREMINDER_HELP;
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
$quiet = have_option('q', 'quiet');
diff --git a/plugins/EmailSummary/EmailSummaryPlugin.php b/plugins/EmailSummary/EmailSummaryPlugin.php
index bc47fdece9..e00617ee3d 100644
--- a/plugins/EmailSummary/EmailSummaryPlugin.php
+++ b/plugins/EmailSummary/EmailSummaryPlugin.php
@@ -85,7 +85,7 @@ class EmailSummaryPlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndInitializeQueueManager($qm)
+ function onEndInitializeQueueManager(QueueManager $qm)
{
$qm->connect('sitesum', 'SiteEmailSummaryHandler');
$qm->connect('usersum', 'UserEmailSummaryHandler');
diff --git a/plugins/EmailSummary/scripts/sendemailsummary.php b/plugins/EmailSummary/scripts/sendemailsummary.php
index 721fede55b..b132975bcd 100644
--- a/plugins/EmailSummary/scripts/sendemailsummary.php
+++ b/plugins/EmailSummary/scripts/sendemailsummary.php
@@ -33,7 +33,7 @@ Send an email summary of the inbox to users
END_OF_SENDEMAILSUMMARY_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
if (have_option('u', 'universe')) {
$sn = new Status_network();
diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php
index 6a00907aa9..8470e5bafb 100644
--- a/plugins/Event/EventPlugin.php
+++ b/plugins/Event/EventPlugin.php
@@ -336,29 +336,29 @@ class EventPlugin extends MicroAppPlugin
{
switch ($notice->object_type) {
case Happening::OBJECT_TYPE:
- common_log(LOG_DEBUG, "Deleting event from notice...");
+ common_debug("Deleting event from notice...");
$happening = Happening::fromNotice($notice);
$happening->delete();
break;
case RSVP::POSITIVE:
case RSVP::NEGATIVE:
case RSVP::POSSIBLE:
- common_log(LOG_DEBUG, "Deleting rsvp from notice...");
+ common_debug("Deleting rsvp from notice...");
$rsvp = RSVP::fromNotice($notice);
- common_log(LOG_DEBUG, "to delete: $rsvp->id");
+ common_debug("to delete: $rsvp->id");
$rsvp->delete();
break;
default:
- common_log(LOG_DEBUG, "Not deleting related, wtf...");
+ common_debug("Not deleting related, wtf...");
}
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$action->script($this->path('js/event.js'));
}
- function onEndShowStyles($action)
+ function onEndShowStyles(Action $action)
{
$action->cssLink($this->path('css/event.css'));
return true;
diff --git a/plugins/Event/actions/cancelrsvp.php b/plugins/Event/actions/cancelrsvp.php
index 662a1de0b3..e3b595539d 100644
--- a/plugins/Event/actions/cancelrsvp.php
+++ b/plugins/Event/actions/cancelrsvp.php
@@ -137,10 +137,15 @@ class CancelrsvpAction extends Action
$notice = $this->rsvp->getNotice();
// NB: this will delete the rsvp, too
if (!empty($notice)) {
+<<<<<<< .merge_file_GZsuBh
common_log(LOG_DEBUG, "Deleting notice...");
$notice->deleteAs($this->scoped);
+=======
+ common_debug("Deleting notice...");
+ $notice->delete();
+>>>>>>> .merge_file_6baWxh
} else {
- common_log(LOG_DEBUG, "Deleting RSVP alone...");
+ common_debug("Deleting RSVP alone...");
$this->rsvp->delete();
}
} catch (ClientException $ce) {
@@ -190,7 +195,7 @@ class CancelrsvpAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Event/actions/newevent.php b/plugins/Event/actions/newevent.php
index 57cd1bb37e..6d0165983d 100644
--- a/plugins/Event/actions/newevent.php
+++ b/plugins/Event/actions/newevent.php
@@ -300,7 +300,7 @@ class NeweventAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Event/actions/newrsvp.php b/plugins/Event/actions/newrsvp.php
index adc9751448..ea32b2b368 100644
--- a/plugins/Event/actions/newrsvp.php
+++ b/plugins/Event/actions/newrsvp.php
@@ -197,7 +197,7 @@ class NewrsvpAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Event/actions/timelist.php b/plugins/Event/actions/timelist.php
index 092fa6bda5..580cfab74e 100644
--- a/plugins/Event/actions/timelist.php
+++ b/plugins/Event/actions/timelist.php
@@ -42,7 +42,7 @@ class TimelistAction extends Action {
*
* @return boolean true
*/
- function prepare($args) {
+ function prepare(array $args=array()) {
parent::prepare($args);
$this->start = $this->arg('start');
$this->duration = $this->boolean('duration', false);
@@ -56,7 +56,7 @@ class TimelistAction extends Action {
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/Event/classes/Happening.php b/plugins/Event/classes/Happening.php
index 9ef288eca4..fd8c3c8a2a 100644
--- a/plugins/Event/classes/Happening.php
+++ b/plugins/Event/classes/Happening.php
@@ -100,7 +100,7 @@ class Happening extends Managed_DataObject
);
}
- static function saveNew($profile, $start_time, $end_time, $title, $location, $description, $url, $options=array())
+ static function saveNew(Profile $profile, $start_time, $end_time, $title, $location, $description, $url, array $options=array())
{
if (array_key_exists('uri', $options)) {
$other = Happening::getKV('uri', $options['uri']);
@@ -210,7 +210,7 @@ class Happening extends Managed_DataObject
return Notice::getKV('uri', $this->getUri());
}
- static function fromNotice($notice)
+ static function fromNotice(Notice $notice)
{
return Happening::getKV('uri', $notice->getUri());
}
diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php
index 90c9d25a8d..f95fdc43c3 100644
--- a/plugins/Event/classes/RSVP.php
+++ b/plugins/Event/classes/RSVP.php
@@ -91,7 +91,11 @@ class RSVP extends Managed_DataObject
);
}
+<<<<<<< .merge_file_5LWulC
static public function beforeSchemaUpdate()
+=======
+ function saveNew(Profile $profile, $event, $verb, array $options = array())
+>>>>>>> .merge_file_iCY7gC
{
$table = strtolower(get_called_class());
$schema = Schema::get();
@@ -319,7 +323,7 @@ class RSVP extends Managed_DataObject
$this->response);
}
- static function toHTML($profile, $event, $response)
+ static function toHTML(Profile $profile, Event $event, $response)
{
$fmt = null;
diff --git a/plugins/ExtendedProfile/ExtendedProfilePlugin.php b/plugins/ExtendedProfile/ExtendedProfilePlugin.php
index ea928b995e..1254143702 100644
--- a/plugins/ExtendedProfile/ExtendedProfilePlugin.php
+++ b/plugins/ExtendedProfile/ExtendedProfilePlugin.php
@@ -81,7 +81,8 @@ class ExtendedProfilePlugin extends Plugin
function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) {
$user = User::getKV('id', $profile->id);
- if ($user) {
+
+ if ($user instanceof User) {
$url = common_local_url('profiledetail', array('nickname' => $user->nickname));
// TRANS: Link text on user profile page leading to extended profile page.
$out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));
diff --git a/plugins/ExtendedProfile/actions/profiledetail.php b/plugins/ExtendedProfile/actions/profiledetail.php
index ea0b8ad630..ccb472e692 100644
--- a/plugins/ExtendedProfile/actions/profiledetail.php
+++ b/plugins/ExtendedProfile/actions/profiledetail.php
@@ -21,7 +21,12 @@ if (!defined('GNUSOCIAL')) { exit(1); }
class ProfileDetailAction extends ShowstreamAction
{
+<<<<<<< .merge_file_YX3UPL
function isReadOnly($args)
+=======
+
+ function isReadOnly(array $args=array())
+>>>>>>> .merge_file_HWH83L
{
return true;
}
diff --git a/plugins/ExtendedProfile/actions/userautocomplete.php b/plugins/ExtendedProfile/actions/userautocomplete.php
index d4857429e0..a77c1ec492 100644
--- a/plugins/ExtendedProfile/actions/userautocomplete.php
+++ b/plugins/ExtendedProfile/actions/userautocomplete.php
@@ -43,7 +43,7 @@ class UserautocompleteAction extends Action
*
* @return boolean true if nothing goes wrong
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->query = $this->trimmed('term');
@@ -57,7 +57,7 @@ class UserautocompleteAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showResults();
@@ -106,7 +106,7 @@ class UserautocompleteAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/FacebookBridge/FacebookBridgePlugin.php b/plugins/FacebookBridge/FacebookBridgePlugin.php
index a19cc0349b..e9db033535 100644
--- a/plugins/FacebookBridge/FacebookBridgePlugin.php
+++ b/plugins/FacebookBridge/FacebookBridgePlugin.php
@@ -190,7 +190,7 @@ class FacebookBridgePlugin extends Plugin
*
* @return void
*/
- function onEndLoginGroupNav($action)
+ function onEndLoginGroupNav(Action $action)
{
$action_name = $action->trimmed('action');
@@ -229,7 +229,7 @@ class FacebookBridgePlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndAdminPanelNav($nav)
+ function onEndAdminPanelNav(Menu $nav)
{
if (AdminPanelAction::canAdmin('facebook')) {
@@ -329,7 +329,7 @@ class FacebookBridgePlugin extends Plugin
* @param Action $action the current action
*
*/
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
if ($this->needsScripts($action)) {
@@ -449,7 +449,7 @@ ENDOFSCRIPT;
*
* @return boolean hook return
*/
- function onStartEnqueueNotice($notice, &$transports)
+ function onStartEnqueueNotice(Notice $notice, array &$transports)
{
if (self::hasApplication() && $notice->isLocal() && $notice->inScope(null)) {
array_push($transports, 'facebook');
@@ -464,7 +464,7 @@ ENDOFSCRIPT;
*
* @return boolean hook return
*/
- function onEndInitializeQueueManager($manager)
+ function onEndInitializeQueueManager(QueueManager $manager)
{
if (self::hasApplication()) {
$manager->connect('facebook', 'FacebookQueueHandler');
diff --git a/plugins/FacebookBridge/actions/facebookdeauthorize.php b/plugins/FacebookBridge/actions/facebookdeauthorize.php
index 443b768f5c..e714f48789 100644
--- a/plugins/FacebookBridge/actions/facebookdeauthorize.php
+++ b/plugins/FacebookBridge/actions/facebookdeauthorize.php
@@ -48,7 +48,7 @@ class FacebookdeauthorizeAction extends Action
*
* @return boolean true
*/
- function prepare($args)
+ function prepare(array $args=array())
{
$this->facebook = Facebookclient::getFacebook();
@@ -60,7 +60,7 @@ class FacebookdeauthorizeAction extends Action
*
* @param array $args is ignored since it's now passed in in prepare()
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php
index 7cf493a994..4a9e09b53d 100644
--- a/plugins/FacebookBridge/actions/facebookfinishlogin.php
+++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php
@@ -37,7 +37,7 @@ class FacebookfinishloginAction extends Action
private $fbuser = null; // Facebook user object (JSON)
private $accessToken = null; // Access token provided by Facebook JS API
- function prepare($args) {
+ function prepare(array $args=array()) {
parent::prepare($args);
// Check cookie for a valid access_token
@@ -79,7 +79,7 @@ class FacebookfinishloginAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/FacebookBridge/actions/facebooklogin.php b/plugins/FacebookBridge/actions/facebooklogin.php
index f30822b63f..558dd1bfb7 100644
--- a/plugins/FacebookBridge/actions/facebooklogin.php
+++ b/plugins/FacebookBridge/actions/facebooklogin.php
@@ -34,7 +34,7 @@ if (!defined('STATUSNET')) {
class FacebookloginAction extends Action
{
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/FacebookBridge/actions/facebooksettings.php b/plugins/FacebookBridge/actions/facebooksettings.php
index 67dd20e036..2914b0fb2e 100644
--- a/plugins/FacebookBridge/actions/facebooksettings.php
+++ b/plugins/FacebookBridge/actions/facebooksettings.php
@@ -42,7 +42,19 @@ if (!defined('GNUSOCIAL')) { exit(1); }
class FacebooksettingsAction extends SettingsAction {
private $facebook; // Facebook PHP-SDK client obj
+<<<<<<< .merge_file_3MYh91
protected $flink;
+=======
+ /**
+ * For initializing members of the class.
+ *
+ * @param array $argarray misc. arguments
+ *
+ * @return boolean true
+ */
+ function prepare(array $args=array()) {
+ parent::prepare($args);
+>>>>>>> .merge_file_egnS41
protected function doPreparation()
{
diff --git a/plugins/Favorite/actions/apifavoritecreate.php b/plugins/Favorite/actions/apifavoritecreate.php
index 7e63b199e2..7ff8f391b2 100644
--- a/plugins/Favorite/actions/apifavoritecreate.php
+++ b/plugins/Favorite/actions/apifavoritecreate.php
@@ -52,14 +52,19 @@ class ApiFavoriteCreateAction extends ApiAuthAction
protected $needPost = true;
+ /**
+ * Take arguments for running
+ *
+ * @return boolean success flag
+ */
protected function prepare(array $args=array())
{
parent::prepare($args);
$this->notice = Notice::getKV($this->arg('id'));
if (!empty($this->notice->repeat_of)) {
- common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of);
- common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead');
+ common_debug('Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of);
+ common_debug('Will Fave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
$this->notice = Notice::getKV($real_notice_id);
}
@@ -67,6 +72,13 @@ class ApiFavoriteCreateAction extends ApiAuthAction
return true;
}
+ /**
+ * Handle the request
+ *
+ * Check the format and show the user info
+ *
+ * @return void
+ */
protected function handle()
{
parent::handle();
diff --git a/plugins/Favorite/actions/apifavoritedestroy.php b/plugins/Favorite/actions/apifavoritedestroy.php
index 1c63ad2628..03472ce6ba 100644
--- a/plugins/Favorite/actions/apifavoritedestroy.php
+++ b/plugins/Favorite/actions/apifavoritedestroy.php
@@ -57,15 +57,15 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
*
* @return boolean success flag
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->user = $this->auth_user;
$this->notice = Notice::getKV($this->arg('id'));
if ($this->notice->repeat_of != '' ) {
- common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id);
- common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead');
+ common_debug('Trying to unFave '.$this->notice->id);
+ common_debug('Will unFave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
$this->notice = Notice::getKV($real_notice_id);
}
@@ -82,7 +82,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/Favorite/actions/apistatusesfavs.php b/plugins/Favorite/actions/apistatusesfavs.php
index 01a5d3014e..baba0c8db8 100644
--- a/plugins/Favorite/actions/apistatusesfavs.php
+++ b/plugins/Favorite/actions/apistatusesfavs.php
@@ -105,12 +105,12 @@ class ApiStatusesFavsAction extends ApiAuthAction
$profile = Profile::getKV('id', $id);
$ids_with_profile_data[$i]['user_id'] = $id;
$ids_with_profile_data[$i]['nickname'] = $profile->nickname;
- $ids_with_profile_data[$i]['fullname'] = $profile->fullname;
- $ids_with_profile_data[$i]['profileurl'] = $profile->profileurl;
+ $ids_with_profile_data[$i]['fullname'] = $profile->fullname;
+ $ids_with_profile_data[$i]['profileurl'] = $profile->profileurl;
$profile = new Profile();
$profile->id = $id;
$avatarurl = $profile->avatarUrl(24);
- $ids_with_profile_data[$i]['avatarurl'] = $avatarurl;
+ $ids_with_profile_data[$i]['avatarurl'] = $avatarurl;
$i++;
}
@@ -129,7 +129,7 @@ class ApiStatusesFavsAction extends ApiAuthAction
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Favorite/actions/apitimelinefavorites.php b/plugins/Favorite/actions/apitimelinefavorites.php
index 366177078f..e3f6fd13b8 100644
--- a/plugins/Favorite/actions/apitimelinefavorites.php
+++ b/plugins/Favorite/actions/apitimelinefavorites.php
@@ -203,7 +203,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Favorite/actions/atompubfavoritefeed.php b/plugins/Favorite/actions/atompubfavoritefeed.php
index b8dae707b3..cd8e8daddf 100644
--- a/plugins/Favorite/actions/atompubfavoritefeed.php
+++ b/plugins/Favorite/actions/atompubfavoritefeed.php
@@ -233,7 +233,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Favorite/actions/atompubshowfavorite.php b/plugins/Favorite/actions/atompubshowfavorite.php
index 2b8c9704aa..bbdddc07d9 100644
--- a/plugins/Favorite/actions/atompubshowfavorite.php
+++ b/plugins/Favorite/actions/atompubshowfavorite.php
@@ -161,7 +161,7 @@ class AtompubshowfavoriteAction extends ApiAuthAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
diff --git a/plugins/Favorite/actions/favorited.php b/plugins/Favorite/actions/favorited.php
index 849a1c8b07..6914bd61f5 100644
--- a/plugins/Favorite/actions/favorited.php
+++ b/plugins/Favorite/actions/favorited.php
@@ -81,7 +81,7 @@ class FavoritedAction extends Action
*
* @return boolean true
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
@@ -95,7 +95,7 @@ class FavoritedAction extends Action
*
* @todo move queries from showContent() to here
*/
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -114,7 +114,7 @@ class FavoritedAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/Favorite/actions/favoritesrss.php b/plugins/Favorite/actions/favoritesrss.php
index ca5602d5ec..93301ad6d2 100644
--- a/plugins/Favorite/actions/favoritesrss.php
+++ b/plugins/Favorite/actions/favoritesrss.php
@@ -45,7 +45,22 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/
class FavoritesrssAction extends TargetedRss10Action
{
+<<<<<<< .merge_file_ZRP5X2
protected function getNotices()
+=======
+ /** The user whose favorites to display */
+
+ var $user = null;
+
+ /**
+ * Find the user to display by supplied nickname
+ *
+ * @param array $args Arguments from $_REQUEST
+ *
+ * @return boolean success
+ */
+ function prepare(array $args=array())
+>>>>>>> .merge_file_e11sr1
{
// is this our own stream?
$own = $this->scoped instanceof Profile ? $this->target->getID() === $this->scoped->getID() : false;
diff --git a/plugins/Favorite/actions/showfavorites.php b/plugins/Favorite/actions/showfavorites.php
index cba29063c2..a429025396 100644
--- a/plugins/Favorite/actions/showfavorites.php
+++ b/plugins/Favorite/actions/showfavorites.php
@@ -40,6 +40,31 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/
class ShowfavoritesAction extends ShowstreamAction
{
+<<<<<<< .merge_file_M0c3R1
+=======
+ /** User we're getting the faves of */
+ var $user = null;
+ /** Page of the faves we're on */
+ var $page = null;
+
+ /**
+ * Is this a read-only page?
+ *
+ * @return boolean true
+ */
+ function isReadOnly(array $args=array())
+ {
+ return true;
+ }
+
+ /**
+ * Title of the page
+ *
+ * Includes name of user and page number.
+ *
+ * @return string title of page
+ */
+>>>>>>> .merge_file_PD3TQ1
function title()
{
if ($this->page == 1) {
@@ -55,10 +80,80 @@ class ShowfavoritesAction extends ShowstreamAction
}
}
+<<<<<<< .merge_file_M0c3R1
public function getStream()
{
$own = $this->scoped instanceof Profile ? $this->scoped->sameAs($this->getTarget()) : false;
return new FaveNoticeStream($this->getTarget()->getID(), $own);
+=======
+ /**
+ * Prepare the object
+ *
+ * Check the input values and initialize the object.
+ * Shows an error page on bad input.
+ *
+ * @param array $args $_REQUEST data
+ *
+ * @return boolean success flag
+ */
+ function prepare(array $args=array())
+ {
+ parent::prepare($args);
+
+ $nickname = common_canonical_nickname($this->arg('nickname'));
+
+ $this->user = User::getKV('nickname', $nickname);
+
+ if (!$this->user) {
+ // TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
+ $this->clientError(_('No such user.'));
+ }
+
+ $this->page = $this->trimmed('page');
+
+ if (!$this->page) {
+ $this->page = 1;
+ }
+
+ common_set_returnto($this->selfUrl());
+
+ $cur = common_current_user();
+
+ // Show imported/gateway notices as well as local if
+ // the user is looking at their own favorites, otherwise not.
+ $this->notice = Fave::stream($this->user->id,
+ ($this->page-1)*NOTICES_PER_PAGE, // offset
+ NOTICES_PER_PAGE + 1, // limit
+ (!empty($cur) && $cur->id == $this->user->id) // own feed?
+ );
+
+ if (empty($this->notice)) {
+ // TRANS: Server error displayed when favourite notices could not be retrieved from the database.
+ $this->serverError(_('Could not retrieve favorite notices.'));
+ }
+
+ if($this->page > 1 && $this->notice->N == 0){
+ // TRANS: Client error when page not found (404)
+ $this->clientError(_('No such page.'), 404);
+ }
+
+ return true;
+ }
+
+ /**
+ * Handle a request
+ *
+ * Just show the page. All args already handled.
+ *
+ * @param array $args $_REQUEST data
+ *
+ * @return void
+ */
+ function handle(array $args=array())
+ {
+ parent::handle($args);
+ $this->showPage();
+>>>>>>> .merge_file_PD3TQ1
}
function getFeeds()
@@ -149,7 +244,7 @@ class ShowfavoritesAction extends ShowstreamAction
class FavoritesNoticeList extends NoticeList
{
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new FavoritesNoticeListItem($notice, $this->out);
}
diff --git a/plugins/Favorite/classes/Fave.php b/plugins/Favorite/classes/Fave.php
index 77b97c8093..f8880c5be3 100644
--- a/plugins/Favorite/classes/Fave.php
+++ b/plugins/Favorite/classes/Fave.php
@@ -267,7 +267,7 @@ class Fave extends Managed_DataObject
*
* @return array Array of Fave objects
*/
- static public function byNotice($notice)
+ static public function byNotice(Notice $notice)
{
if (!isset(self::$_faves[$notice->id])) {
self::fillFaves(array($notice->id));
diff --git a/plugins/ForceGroup/ForceGroupPlugin.php b/plugins/ForceGroup/ForceGroupPlugin.php
index 56e33355e8..a27436e6fa 100644
--- a/plugins/ForceGroup/ForceGroupPlugin.php
+++ b/plugins/ForceGroup/ForceGroupPlugin.php
@@ -49,7 +49,7 @@ class ForceGroupPlugin extends Plugin
* @param Notice $notice
* @return boolean event hook return
*/
- function onStartNoticeDistribute($notice)
+ function onStartNoticeDistribute(Notice $notice)
{
$profile = $notice->getProfile();
diff --git a/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php b/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
index 44a6e3fe34..78fe21d26d 100644
--- a/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
+++ b/plugins/GNUsocialPhoto/GNUsocialPhotoPlugin.php
@@ -44,7 +44,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
return true;
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('main/photo/new', array('action' => 'newphoto'));
$m->connect('main/photo/:id', array('action' => 'showphoto'));
diff --git a/plugins/GNUsocialPhoto/actions/newphoto.php b/plugins/GNUsocialPhoto/actions/newphoto.php
index 18ae5523a0..77c05e3807 100644
--- a/plugins/GNUsocialPhoto/actions/newphoto.php
+++ b/plugins/GNUsocialPhoto/actions/newphoto.php
@@ -33,7 +33,7 @@ class NewphotoAction extends Action
{
var $user = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->user = common_current_user();
@@ -50,7 +50,7 @@ class NewphotoAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/GNUsocialPhoto/classes/Photo.php b/plugins/GNUsocialPhoto/classes/Photo.php
index 4e4ee69c97..c10b64524d 100644
--- a/plugins/GNUsocialPhoto/classes/Photo.php
+++ b/plugins/GNUsocialPhoto/classes/Photo.php
@@ -46,7 +46,7 @@ class Photo extends Managed_DataObject
public $description; // text
public $profile_id; // int
- public static function getByNotice($notice)
+ public static function getByNotice(Notice $notice)
{
return self::getKV('uri', $notice->uri);
}
@@ -81,7 +81,7 @@ class Photo extends Managed_DataObject
);
}
- static function saveNew(Profile $profile, $photo_uri, $thumb_uri, $title, $description, $options=array())
+ static function saveNew(Profile $profile, $photo_uri, $thumb_uri, $title, $description, array $options=array())
{
$photo = new Photo();
diff --git a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
index 36956e5b9b..5e0f3f780e 100644
--- a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
+++ b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
@@ -44,7 +44,7 @@ class GNUsocialPhotosPlugin extends Plugin
$schema->ensureTable('GNUsocialPhotoAlbum', GNUsocialPhotoAlbum::schemaDef());
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect(':nickname/photos', array('action' => 'photos'));
$m->connect(':nickname/photos/:albumid', array('action' => 'photos'));
@@ -54,7 +54,7 @@ class GNUsocialPhotosPlugin extends Plugin
return true;
}
- function onStartNoticeDistribute($notice)
+ function onStartNoticeDistribute(Notice $notice)
{
common_log(LOG_INFO, "event: StartNoticeDistribute");
if (GNUsocialPhotoTemp::$tmp) {
@@ -84,7 +84,7 @@ class GNUsocialPhotosPlugin extends Plugin
}
- function onStartHandleFeedEntry($activity)
+ function onStartHandleFeedEntry(Activity $activity)
{
common_log(LOG_INFO, 'photo plugin: onEndAtomPubNewActivity');
$oprofile = Ostatus_profile::ensureActorProfile($activity);
@@ -121,7 +121,7 @@ class GNUsocialPhotosPlugin extends Plugin
return true;
}
- function onStartShowNoticeItem($action)
+ function onStartShowNoticeItem(Action $action)
{
$photo = GNUsocialPhoto::getKV('notice_id', $action->notice->id);
if($photo) {
@@ -157,12 +157,12 @@ class GNUsocialPhotosPlugin extends Plugin
_('Photo gallery'), $nav->action->trimmed('action') == 'photos', 'nav_photos');
}
- function onEndShowStyles($action)
+ function onEndShowStyles(Action $action)
{
$action->cssLink('/plugins/GNUsocialPhotos/res/style.css');
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$action->script('plugins/GNUsocialPhotos/res/gnusocialphotos.js');
}
diff --git a/plugins/GNUsocialPhotos/actions/editphoto.php b/plugins/GNUsocialPhotos/actions/editphoto.php
index 35dac7bf3f..8aa63a06d7 100644
--- a/plugins/GNUsocialPhotos/actions/editphoto.php
+++ b/plugins/GNUsocialPhotos/actions/editphoto.php
@@ -36,7 +36,7 @@ class EditphotoAction extends Action
{
var $user = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$args = $this->returnToArgs();
@@ -46,7 +46,7 @@ class EditphotoAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php
index b1e1b73ff1..a180be8c12 100644
--- a/plugins/GNUsocialPhotos/actions/photos.php
+++ b/plugins/GNUsocialPhotos/actions/photos.php
@@ -38,7 +38,7 @@ class PhotosAction extends Action
{
var $user = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -53,7 +53,7 @@ class PhotosAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -82,7 +82,7 @@ class PhotosAction extends Action
$this->element('option', array('value' => '120'), _("Medium"));
$this->element('option', array('value' => '400'), _("Normal"));
$this->elementEnd('select');
- }
+ }
function showAlbums()
{
diff --git a/plugins/GNUsocialPhotos/actions/photoupload.php b/plugins/GNUsocialPhotos/actions/photoupload.php
index 25bd4f84d0..a8874ea13b 100644
--- a/plugins/GNUsocialPhotos/actions/photoupload.php
+++ b/plugins/GNUsocialPhotos/actions/photoupload.php
@@ -36,14 +36,14 @@ class PhotouploadAction extends Action
{
var $user = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->user = common_current_user();
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if($_SERVER['REQUEST_METHOD'] == 'POST') {
diff --git a/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php b/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php
index c4628c4ecc..6bf6a15984 100644
--- a/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php
+++ b/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php
@@ -40,10 +40,9 @@ class GNUsocialProfileExtensionsPlugin extends Plugin
$schema = Schema::get();
$schema->ensureTable('GNUsocialProfileExtensionField', GNUsocialProfileExtensionField::schemaDef());
$schema->ensureTable('GNUsocialProfileExtensionResponse', GNUsocialProfileExtensionResponse::schemaDef());
-
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect(':nickname/bio', array('action' => 'bio'));
$m->connect('admin/profilefields', array('action' => 'profilefieldsAdminPanel'));
@@ -103,17 +102,17 @@ class GNUsocialProfileExtensionsPlugin extends Plugin
}
}
- function onEndShowStyles($action)
+ function onEndShowStyles(Action $action)
{
$action->cssLink('/plugins/GNUsocialProfileExtensions/res/style.css');
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$action->script('plugins/GNUsocialProfileExtensions/js/profile.js');
}
- function onEndAdminPanelNav($nav)
+ function onEndAdminPanelNav(Menu $nav)
{
if (AdminPanelAction::canAdmin('profilefields')) {
diff --git a/plugins/GNUsocialProfileExtensions/actions/bio.php b/plugins/GNUsocialProfileExtensions/actions/bio.php
index 269389e07d..fc49003cb4 100644
--- a/plugins/GNUsocialProfileExtensions/actions/bio.php
+++ b/plugins/GNUsocialProfileExtensions/actions/bio.php
@@ -38,7 +38,7 @@ class BioAction extends Action
{
var $user = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -51,7 +51,7 @@ class BioAction extends Action
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/plugins/GNUsocialProfileExtensions/lib/noticetree.php b/plugins/GNUsocialProfileExtensions/lib/noticetree.php
index 95df528388..380672ebb5 100644
--- a/plugins/GNUsocialProfileExtensions/lib/noticetree.php
+++ b/plugins/GNUsocialProfileExtensions/lib/noticetree.php
@@ -103,7 +103,7 @@ class NoticeTree extends NoticeList
$this->out->elementEnd('li');
}
- function newListItem($notice)
+ function newListItem(Notice $notice)
{
return new NoticeTreeItem($notice, $this->out);
}
diff --git a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
index 3310712ba7..abf0f30430 100644
--- a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
+++ b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php
@@ -44,7 +44,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
return true;
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('main/postvideo', array('action' => 'postvideo'));
$m->connect('showvideo/:id', array('action' => 'showvideo'));
diff --git a/plugins/GNUsocialVideo/actions/postvideo.php b/plugins/GNUsocialVideo/actions/postvideo.php
index bdd86abc9e..aae0fe98e6 100644
--- a/plugins/GNUsocialVideo/actions/postvideo.php
+++ b/plugins/GNUsocialVideo/actions/postvideo.php
@@ -34,7 +34,7 @@ class PostvideoAction extends Action {
var $user = null;
var $url = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->user = common_current_user();
@@ -54,7 +54,7 @@ class PostvideoAction extends Action {
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/GNUsocialVideo/actions/showvideo.php b/plugins/GNUsocialVideo/actions/showvideo.php
index 628d08642a..5021c19c99 100644
--- a/plugins/GNUsocialVideo/actions/showvideo.php
+++ b/plugins/GNUsocialVideo/actions/showvideo.php
@@ -34,7 +34,7 @@ class ShowvideoAction extends ShownoticeAction
protected $id = null;
protected $vid = null;
- function prepare($args)
+ function prepare(array $args=array())
{
OwnerDesignAction::prepare($args);
$this->id = $this->trimmed('id');
diff --git a/plugins/GNUsocialVideo/classes/Video.php b/plugins/GNUsocialVideo/classes/Video.php
index 09c1f6b844..9ba395d8ca 100644
--- a/plugins/GNUsocialVideo/classes/Video.php
+++ b/plugins/GNUsocialVideo/classes/Video.php
@@ -43,7 +43,7 @@ class Video extends Managed_DataObject
public $url; // varchar (191) not 255 because utf8mb4 takes more space
public $profile_id; // int
- public static function getByNotice($notice)
+ public static function getByNotice(Notice $notice)
{
return self::getKV('uri', $notice->uri);
}
@@ -75,7 +75,7 @@ class Video extends Managed_DataObject
);
}
- static function saveNew(Profile $profile, $url, $options=array())
+ static function saveNew(Profile $profile, $url, array $options=array())
{
$vid = new Video();
diff --git a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
index 61828239ca..0f5c1a8830 100644
--- a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
+++ b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
@@ -124,7 +124,7 @@ class GroupPrivateMessagePlugin extends Plugin
*
* @result boolean hook value
*/
- function onEndGroupSave($group)
+ function onEndGroupSave(User_group $group)
{
$gps = new Group_privacy_settings();
@@ -193,9 +193,10 @@ class GroupPrivateMessagePlugin extends Plugin
assert(is_callable(array($action, 'getGroup')));
$gps = null;
+ $group = $action->getGroup();
- if ($action->getGroup() instanceof User_group) {
- $gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id);
+ if ($group instanceof User_group) {
+ $gps = Group_privacy_settings::getKV('group_id', $group->id);
}
$orig = null;
@@ -324,7 +325,7 @@ class GroupPrivateMessagePlugin extends Plugin
foreach (array_unique($match[1]) as $nickname) {
$group = User_group::getForNickname($nickname, $profile);
- if (empty($group)) {
+ if (!$group instanceof User_group) {
continue;
}
diff --git a/plugins/GroupPrivateMessage/actions/groupinbox.php b/plugins/GroupPrivateMessage/actions/groupinbox.php
index f4656bfd8e..09bcbda323 100644
--- a/plugins/GroupPrivateMessage/actions/groupinbox.php
+++ b/plugins/GroupPrivateMessage/actions/groupinbox.php
@@ -155,7 +155,7 @@ class GroupinboxAction extends GroupAction
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/GroupPrivateMessage/actions/showgroupmessage.php b/plugins/GroupPrivateMessage/actions/showgroupmessage.php
index 4c2e7a71f6..0c4d1342a9 100644
--- a/plugins/GroupPrivateMessage/actions/showgroupmessage.php
+++ b/plugins/GroupPrivateMessage/actions/showgroupmessage.php
@@ -146,7 +146,7 @@ class ShowgroupmessageAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php
new file mode 100644
index 0000000000..99dc4b2bc1
--- /dev/null
+++ b/plugins/Irc/IrcPlugin.php
@@ -0,0 +1,385 @@
+.
+ *
+ * @category IM
+ * @package StatusNet
+ * @author Luke Fitzgerald
+ * @copyright 2010 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ // This check helps protect against security problems;
+ // your code file can't be executed directly from the web.
+ exit(1);
+}
+
+// We bundle the Phergie library...
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/phergie');
+
+/**
+ * Plugin for IRC
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Luke Fitzgerald
+ * @copyright 2010 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
+ */
+class IrcPlugin extends ImPlugin {
+ public $host = null;
+ public $port = null;
+ public $username = null;
+ public $realname = null;
+ public $nick = null;
+ public $password = null;
+ public $nickservidentifyregexp = null;
+ public $nickservpassword = null;
+ public $channels = null;
+ public $transporttype = null;
+ public $encoding = null;
+ public $pinginterval = null;
+
+ public $regcheck = null;
+ public $unregregexp = null;
+ public $regregexp = null;
+
+ public $transport = 'irc';
+ protected $whiteList;
+ protected $fake_irc;
+
+ /**
+ * Get the internationalized/translated display name of this IM service
+ *
+ * @return string Name of service
+ */
+ public function getDisplayName() {
+ // TRANS: Service name for IRC.
+ return _m('IRC');
+ }
+
+ /**
+ * Normalize a screenname for comparison
+ *
+ * @param string $screenname Screenname to normalize
+ * @return string An equivalent screenname in normalized form
+ */
+ public function normalize($screenname) {
+ $screenname = str_replace(" ","", $screenname);
+ return strtolower($screenname);
+ }
+
+ /**
+ * Get the screenname of the daemon that sends and receives messages
+ *
+ * @return string Screenname
+ */
+ public function daemonScreenname() {
+ return $this->nick;
+ }
+
+ /**
+ * Validate (ensure the validity of) a screenname
+ *
+ * @param string $screenname Screenname to validate
+ * @return boolean true if screenname is valid
+ */
+ public function validate($screenname) {
+ if (preg_match('/\A[a-z0-9\-_]{1,1000}\z/i', $screenname)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Load related modules when needed
+ *
+ * @param string $cls Name of the class to be loaded
+ * @return boolean hook value; true means continue processing, false means stop.
+ */
+ public function onAutoload($cls) {
+ // in the beginning of this file, we have added an include path
+ if (substr($cls, 0, 7) == 'Phergie') {
+ include_once str_replace('_', DIRECTORY_SEPARATOR, $cls) . '.php';
+ return false;
+ }
+
+ return parent::onAutoload($cls);
+ }
+
+ /*
+ * Start manager on daemon start
+ *
+ * @param array &$versions Array to insert manager into
+ * @return boolean
+ */
+ public function onStartImDaemonIoManagers(&$classes) {
+ parent::onStartImDaemonIoManagers($classes);
+ $classes[] = new IrcManager($this); // handles sending/receiving
+ return true;
+ }
+
+ /**
+ * Ensure the database table is present
+ *
+ */
+ public function onCheckSchema() {
+ $schema = Schema::get();
+
+ // For storing messages while sessions become ready
+ $schema->ensureTable('irc_waiting_message', Irc_waiting_message::schemaDef());
+ return true;
+ }
+
+ /**
+ * Get a microid URI for the given screenname
+ *
+ * @param string $screenname Screenname
+ * @return string microid URI
+ */
+ public function microiduri($screenname) {
+ return 'irc:' . $screenname;
+ }
+
+ /**
+ * Send a message to a given screenname
+ *
+ * @param string $screenname Screenname to send to
+ * @param string $body Text to send
+ * @return boolean true on success
+ */
+ public function sendMessage($screenname, $body) {
+ $lines = explode("\n", $body);
+ foreach ($lines as $line) {
+ $this->fake_irc->doPrivmsg($screenname, $line);
+ $this->enqueueOutgoingRaw(array('type' => 'message', 'prioritise' => 0, 'data' => $this->fake_irc->would_be_sent));
+ }
+ return true;
+ }
+
+ /**
+ * Accept a queued input message.
+ *
+ * @return boolean true if processing completed, false if message should be reprocessed
+ */
+ public function receiveRawMessage($data) {
+ if (strpos($data['source'], '#') === 0) {
+ $message = $data['message'];
+ $parts = explode(' ', $message, 2);
+ $command = $parts[0];
+ if (in_array($command, $this->whiteList)) {
+ $this->handle_channel_incoming($data['sender'], $data['source'], $message);
+ } else {
+ $this->handleIncoming($data['sender'], $message);
+ }
+ } else {
+ $this->handleIncoming($data['sender'], $data['message']);
+ }
+ return true;
+ }
+
+ /**
+ * Helper for handling incoming messages from a channel requiring response
+ * to the channel instead of via PM
+ *
+ * @param string $nick Screenname the message was sent from
+ * @param string $channel Channel the message originated from
+ * @param string $message Message text
+ * @param boolean true on success
+ */
+ protected function handle_channel_incoming($nick, $channel, $notice_text) {
+ $user = $this->getUser($nick);
+ // For common_current_user to work
+ global $_cur;
+ $_cur = $user;
+
+ if (!$user) {
+ $this->sendFromSite($nick, 'Unknown user; go to ' .
+ common_local_url('imsettings') .
+ ' to add your address to your account');
+ common_log(LOG_WARNING, 'Message from unknown user ' . $nick);
+ return;
+ }
+ if ($this->handle_channel_command($user, $channel, $notice_text)) {
+ common_log(LOG_INFO, "Command message by $nick handled.");
+ return;
+ } else if ($this->isAutoreply($notice_text)) {
+ common_log(LOG_INFO, 'Ignoring auto reply from ' . $nick);
+ return;
+ } else if ($this->isOtr($notice_text)) {
+ common_log(LOG_INFO, 'Ignoring OTR from ' . $nick);
+ return;
+ } else {
+ common_log(LOG_INFO, 'Posting a notice from ' . $user->nickname);
+ $this->addNotice($nick, $user, $notice_text);
+ }
+
+ $user->free();
+ unset($user);
+ unset($_cur);
+ unset($message);
+ }
+
+ /**
+ * Attempt to handle a message from a channel as a command
+ *
+ * @param User $user User the message is from
+ * @param string $channel Channel the message originated from
+ * @param string $body Message text
+ * @return boolean true if the message was a command and was executed, false if it was not a command
+ */
+ protected function handle_channel_command($user, $channel, $body) {
+ $inter = new CommandInterpreter();
+ $cmd = $inter->handle_command($user, $body);
+ if ($cmd) {
+ $chan = new ChannelResponseChannel($this, $channel);
+ $cmd->execute($chan);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Send a confirmation code to a user
+ *
+ * @param string $screenname screenname sending to
+ * @param string $code the confirmation code
+ * @param User $user user sending to
+ * @return boolean success value
+ */
+ public function sendConfirmationCode($screenname, $code, $user, $checked = false) {
+ // TRANS: Body text for e-mail confirmation message for IRC.
+ // TRANS: %1$s is a user nickname, %2$s is the StatusNet sitename,
+ // TRANS: %3$s is the plugin display name ("IRC"), %4$s is the confirm address URL.
+ $body = sprintf(_m('User "%1$s" on %2$s has said that your %3$s screenname belongs to them. ' .
+ 'If that\'s true, you can confirm by clicking on this URL: ' .
+ '%4$s' .
+ ' . (If you cannot click it, copy-and-paste it into the ' .
+ 'address bar of your browser). If that user is not you, ' .
+ 'or if you did not request this confirmation, just ignore this message.'),
+ $user->nickname, common_config('site', 'name'), $this->getDisplayName(), common_local_url('confirmaddress', array('code' => $code)));
+
+ if ($this->regcheck && !$checked) {
+ return $this->checked_sendConfirmationCode($screenname, $code, $user);
+ } else {
+ return $this->sendMessage($screenname, $body);
+ }
+ }
+
+ /**
+ * Only sends the confirmation message if the nick is
+ * registered
+ *
+ * @param string $screenname Screenname sending to
+ * @param string $code The confirmation code
+ * @param User $user User sending to
+ * @return boolean true on succes
+ */
+ public function checked_sendConfirmationCode($screenname, $code, $user) {
+ $this->fake_irc->doPrivmsg('NickServ', 'INFO '.$screenname);
+ $this->enqueueOutgoingRaw(
+ array(
+ 'type' => 'nickcheck',
+ 'prioritise' => 1,
+ 'data' => $this->fake_irc->would_be_sent,
+ 'nickdata' =>
+ array(
+ 'screenname' => $screenname,
+ 'code' => $code,
+ 'user' => $user
+ )
+ )
+ );
+ return true;
+ }
+
+ /**
+ * Initialize plugin
+ *
+ * @return boolean
+ */
+ public function initialize() {
+ if (!isset($this->host)) {
+ // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration.
+ throw new Exception(_m('You must specify a host.'));
+ }
+ if (!isset($this->username)) {
+ // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration.
+ throw new Exception(_m('You must specify a username.'));
+ }
+ if (!isset($this->realname)) {
+ // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration.
+ throw new Exception(_m('You must specify a "real name".'));
+ }
+ if (!isset($this->nick)) {
+ // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration.
+ throw new Exception(_m('You must specify a nickname.'));
+ }
+
+ if (!isset($this->port)) {
+ $this->port = 6667;
+ }
+ if (!isset($this->transporttype)) {
+ $this->transporttype = 'tcp';
+ }
+ if (!isset($this->encoding)) {
+ $this->encoding = 'UTF-8';
+ }
+ if (!isset($this->pinginterval)) {
+ $this->pinginterval = 120;
+ }
+
+ if (!isset($this->regcheck)) {
+ $this->regcheck = true;
+ }
+
+ $this->fake_irc = new FakeIrc;
+
+ /*
+ * Commands allowed to return output to a channel
+ */
+ $this->whiteList = array('stats', 'last', 'get');
+
+ return true;
+ }
+
+ /**
+ * Get plugin information
+ *
+ * @param array $versions Array to insert information into
+ * @return void
+ */
+ public function onPluginVersion(array &$versions) {
+ $versions[] = array('name' => 'IRC',
+ 'version' => GNUSOCIAL_VERSION,
+ 'author' => 'Luke Fitzgerald',
+ 'homepage' => 'http://status.net/wiki/Plugin:IRC',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('The IRC plugin allows users to send and receive notices over an IRC network.'));
+ return true;
+ }
+}
diff --git a/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/HandlerTest.php b/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/HandlerTest.php
new file mode 100644
index 0000000000..98c70dfcee
--- /dev/null
+++ b/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/HandlerTest.php
@@ -0,0 +1,837 @@
+
+ * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
+ * @license http://phergie.org/license New BSD License
+ * @link http://pear.phergie.org/package/Phergie_Tests
+ */
+
+/**
+ * Unit test suite for Pherge_Plugin_Handler.
+ *
+ * @category Phergie
+ * @package Phergie_Tests
+ * @author Phergie Development Team
+ * @license http://phergie.org/license New BSD License
+ * @link http://pear.phergie.org/package/Phergie_Tests
+ */
+class Phergie_Plugin_HandlerTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * Plugin handler instance being tested
+ *
+ * @var Phergie_Plugin_Handler
+ */
+ protected $handler;
+
+ /**
+ * Mock Phergie_Config instance passed to the plugin handler constructor
+ *
+ * @var Phergie_Config
+ */
+ protected $config;
+
+ /**
+ * Mock Phergie_Event_Handler instance passed to the plugin handler
+ * constructor
+ *
+ * @var Phergie_Event_Handler
+ */
+ protected $events;
+
+ /**
+ * Returns a mock plugin instance.
+ *
+ * @param string $name Optional short name for the mock plugin, defaults
+ * to 'TestPlugin'
+ * @param array $methods Optional list of methods to override
+ *
+ * @return Phergie_Plugin_Abstract
+ */
+ protected function getMockPlugin($name = 'TestPlugin', array $methods = array())
+ {
+ $methods[] = 'getName';
+ $plugin = $this->getMock('Phergie_Plugin_Abstract', $methods);
+ $plugin
+ ->expects($this->any())
+ ->method('getName')
+ ->will($this->returnValue($name));
+ return $plugin;
+ }
+
+ /**
+ * Sets up a new handler instance before each test.
+ *
+ * @return void
+ */
+ public function setUp()
+ {
+ $this->config = $this->getMock('Phergie_Config');
+ $this->events = $this->getMock('Phergie_Event_Handler');
+ $this->handler = new Phergie_Plugin_Handler(
+ $this->config,
+ $this->events
+ );
+ }
+
+ /**
+ * Tests iterability of the plugin handler.
+ *
+ * @return void
+ */
+ public function testImplementsIteratorAggregate()
+ {
+ $reflection = new ReflectionObject($this->handler);
+
+ $this->assertTrue(
+ $reflection->implementsInterface('IteratorAggregate'),
+ 'Handler does not implement IteratorAggregate'
+ );
+
+ $this->assertType(
+ 'Iterator',
+ $this->handler->getIterator(),
+ 'getIterator() must return an iterator'
+ );
+ }
+
+ /**
+ * Tests that a default iterator is returned if none is explicitly set.
+ *
+ * @return void
+ */
+ public function testGetIteratorReturnsDefault()
+ {
+ $this->assertType(
+ 'Phergie_Plugin_Iterator',
+ $this->handler->getIterator()
+ );
+ }
+
+ /**
+ * Tests the ability to change the handler's iterator class when a valid
+ * class is specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithValidClass()
+ {
+ eval('
+ class DummyIterator extends FilterIterator {
+ public function accept() {
+ return true;
+ }
+ }
+ ');
+
+ $this->handler->setIteratorClass('DummyIterator');
+
+ $this->assertType(
+ 'DummyIterator',
+ $this->handler->getIterator()
+ );
+ }
+
+ /**
+ * Tests that a failure occurs when a nonexistent iterator class is
+ * specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithNonexistentClass()
+ {
+ try {
+ $this->handler->setIteratorClass('FooIterator');
+ $this->fail('Expected exception was not thrown');
+ } catch (Phergie_Plugin_Exception $e) {
+ return;
+ }
+ $this->fail('Unexpected exception was thrown');
+ }
+
+ /**
+ * Tests that a failure occurs when a class that is not a subclass of
+ * FilterIterator is specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithNonFilterIteratorClass()
+ {
+ try {
+ $this->handler->setIteratorClass('ArrayIterator');
+ $this->fail('Expected exception was not thrown');
+ } catch (Phergie_Plugin_Exception $e) {
+ return;
+ }
+ $this->fail('Unexpected exception was thrown');
+ }
+
+ /**
+ * Tests countability of the plugin handler.
+ *
+ * @return void
+ */
+ public function testImplementsCountable()
+ {
+ $reflection = new ReflectionObject($this->handler);
+
+ $this->assertTrue(
+ $reflection->implementsInterface('Countable'),
+ 'Handler does not implement Countable'
+ );
+
+ $this->assertType(
+ 'int',
+ count($this->handler),
+ 'count() must return an integer'
+ );
+ }
+
+ /**
+ * Tests the plugin handler exposing added plugins as instance
+ * properties of the handler via isset().
+ *
+ * @return void
+ */
+ public function testImplementsIsset()
+ {
+ $pluginName = 'TestPlugin';
+ $this->assertFalse(isset($this->handler->{$pluginName}));
+ $plugin = $this->getMockPlugin($pluginName);
+ $this->handler->addPlugin($plugin);
+ $this->assertTrue(isset($this->handler->{$pluginName}));
+ }
+
+ /**
+ * Tests the plugin handler exposing added plugins as instance
+ * properties of the handler.
+ *
+ * @depends testImplementsIsset
+ * @return void
+ */
+ public function testImplementsGet()
+ {
+ $plugin = $this->getMockPlugin();
+ $this->handler->addPlugin($plugin);
+ $name = $plugin->getName();
+ $getPlugin = $this->handler->getPlugin($name);
+ $this->assertTrue(isset($this->handler->$name));
+ $get = $this->handler->$name;
+ $this->assertSame($getPlugin, $get);
+ }
+
+ /**
+ * Tests the plugin handler allowing for plugin removal via unset().
+ *
+ * @depends testImplementsGet
+ * @return void
+ */
+ public function testImplementsUnset()
+ {
+ $plugin = $this->getMockPlugin();
+ $this->handler->addPlugin($plugin);
+ unset($this->handler->{$plugin->getName()});
+ $this->assertFalse($this->handler->hasPlugin($plugin->getName()));
+ }
+
+ /**
+ * Tests the plugin handler executing a callback on all contained
+ * plugins.
+ *
+ * @return void
+ */
+ public function testImplementsCall()
+ {
+ foreach (range(1, 2) as $index) {
+ $plugin = $this->getMockPlugin('TestPlugin' . $index, array('callback'));
+ $plugin
+ ->expects($this->once())
+ ->method('callback');
+ $this->handler->addPlugin($plugin);
+ }
+
+ $this->assertTrue($this->handler->callback());
+ }
+
+ /**
+ * Tests a newly instantiated handler not having plugins associated with
+ * it.
+ *
+ * @depends testImplementsCountable
+ * @return void
+ */
+ public function testEmptyHandlerHasNoPlugins()
+ {
+ $this->assertEquals(0, count($this->handler));
+ }
+
+ /**
+ * Tests a newly instantiated handler not having autoloading enabled by
+ * default.
+ *
+ * @return void
+ */
+ public function testGetAutoloadDefaultsToNotAutoload()
+ {
+ $this->assertFalse($this->handler->getAutoload());
+ }
+
+ /**
+ * Tests setAutoload().
+ *
+ * @depends testGetAutoloadDefaultsToNotAutoload
+ * @return void
+ */
+ public function testSetAutoload()
+ {
+ $this->assertSame(
+ $this->handler->setAutoload(true),
+ $this->handler,
+ 'setAutoload() does not provide a fluent interface'
+ );
+
+ $this->assertTrue(
+ $this->handler->getAutoload(),
+ 'setAutoload() had no effect on getAutoload()'
+ );
+ }
+
+ /**
+ * Tests addPath() providing a fluent interface.
+ *
+ * @return void
+ */
+ public function testAddPathProvidesFluentInterface()
+ {
+ $handler = $this->handler->addPath(dirname(__FILE__));
+ $this->assertSame($this->handler, $handler);
+ }
+
+ /**
+ * Tests addPath() throwing an exception when it cannot read the
+ * directory.
+ *
+ * @return void
+ */
+ public function testAddPathThrowsExceptionOnUnreadableDirectory()
+ {
+ try {
+ $this->handler->addPath('/an/unreadable/directory/path');
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_DIRECTORY_NOT_READABLE,
+ $e->getCode()
+ );
+ return;
+ }
+
+ $this->fail('An expected exception has not been raised');
+ }
+
+ /**
+ * Tests adding a path to the plugin handler.
+ *
+ * @return void
+ */
+ public function testAddPath()
+ {
+ $pluginName = 'Mock';
+
+ try {
+ $this->handler->addPlugin($pluginName);
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_CLASS_NOT_FOUND,
+ $e->getCode()
+ );
+ }
+
+ if (!isset($e)) {
+ $this->fail('Plugin loaded, path was already present');
+ }
+
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+
+ try {
+ $this->handler->addPlugin($pluginName);
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->fail('Added path, plugin still not found');
+ }
+ }
+
+ /**
+ * Tests addPlugin() returning an added plugin instance.
+ *
+ * @return void
+ */
+ public function testAddPluginByInstanceReturnsPluginInstance()
+ {
+ $plugin = $this->getMockPlugin();
+ $returnedPlugin = $this->handler->addPlugin($plugin);
+ $this->assertSame(
+ $returnedPlugin,
+ $plugin,
+ 'addPlugin() does not return the instance passed to it'
+ );
+ }
+
+ /**
+ * Tests adding a plugin to the handler using the plugin's short name.
+ *
+ * @return void
+ */
+ public function testAddPluginByShortName()
+ {
+ $pluginName = 'Mock';
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+
+ $returnedPlugin = $this->handler->addPlugin($pluginName);
+ $this->assertTrue($this->handler->hasPlugin($pluginName));
+
+ $this->assertType(
+ 'Phergie_Plugin_Mock',
+ $this->handler->getPlugin($pluginName)
+ );
+
+ $this->assertSame(
+ $this->handler->getPlugin($pluginName),
+ $returnedPlugin,
+ 'Handler does not contain added plugin'
+ );
+ }
+
+
+ /**
+ * Tests adding a plugin instance to the handler.
+ *
+ * @return void
+ */
+ public function testAddPluginByInstance()
+ {
+ $plugin = $this->getMockPlugin();
+ $returnedPlugin = $this->handler->addPlugin($plugin);
+ $this->assertTrue($this->handler->hasPlugin('TestPlugin'));
+
+ $this->assertSame(
+ $plugin,
+ $returnedPlugin,
+ 'addPlugin() does not return added plugin instance'
+ );
+
+ $this->assertSame(
+ $plugin,
+ $this->handler->getPlugin('TestPlugin'),
+ 'getPlugin() does not return added plugin instance'
+ );
+ }
+
+ /**
+ * Tests addPlugin() throwing an exception when the plugin class file
+ * can't be found.
+ *
+ * @return void
+ */
+ public function testAddPluginThrowsExceptionWhenPluginFileNotFound()
+ {
+ try {
+ $this->handler->addPlugin('TestPlugin');
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_CLASS_NOT_FOUND,
+ $e->getCode()
+ );
+ return;
+ }
+
+ $this->fail('An expected exception has not been raised');
+ }
+
+ /**
+ * Recursively removes all files and subdirectories in a directory.
+ *
+ * @param string $path Directory path
+ * @return void
+ */
+ private function removeDirectory($path)
+ {
+ if (file_exists($path)) {
+ $it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($path),
+ RecursiveIteratorIterator::CHILD_FIRST
+ );
+ foreach ($it as $entry) {
+ if ($it->isDot()) {
+ continue;
+ }
+ if ($entry->isDir()) {
+ rmdir($entry->getPathname());
+ } else {
+ unlink($entry->getPathname());
+ }
+ }
+ }
+ }
+
+ /**
+ * Tests addPlugin() throwing an exception when the plugin class file is
+ * found, but does not contain the plugin class as expected.
+ *
+ * @return void
+ */
+ public function testAddPluginThrowsExceptionWhenPluginClassNotFound()
+ {
+ $path = common_get_temp_dir() . '/Phergie/Plugin';
+ $this->removeDirectory(dirname($path));
+ mkdir($path, 0777, true);
+ touch($path . '/TestPlugin.php');
+ $this->handler->addPath($path, 'Phergie_Plugin_');
+
+ try {
+ $this->handler->addPlugin('TestPlugin');
+ } catch(Phergie_Plugin_Exception $e) { }
+
+ if (isset($e)) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_CLASS_NOT_FOUND,
+ $e->getCode()
+ );
+ } else {
+ $this->fail('An expected exception has not been raised');
+ }
+
+ $this->removeDirectory(dirname($path));
+ }
+
+ /**
+ * Tests addPlugin() throwing an exception when trying to instantiate a
+ * class that doesn't extend Phergie_Plugin_Abstract.
+ *
+ * @return void
+ */
+ public function testAddPluginThrowsExceptionIfRequestingNonPlugin()
+ {
+ try {
+ $this->handler->addPlugin('Handler');
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_INCORRECT_BASE_CLASS,
+ $e->getCode()
+ );
+ return;
+ }
+
+ $this->fail('An expected exception has not been raised');
+ }
+
+ /**
+ * Tests addPlugin() throwing an exception when trying to instantiate a
+ * class that can't be instantiated.
+ *
+ * @return void
+ */
+ public function testAddPluginThrowsExceptionIfPluginNotInstantiable()
+ {
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+ try {
+ $this->handler->addPlugin('TestNonInstantiablePluginFromFile');
+ } catch(Phergie_Plugin_Exception $e) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_CLASS_NOT_INSTANTIABLE,
+ $e->getCode()
+ );
+ return;
+ }
+
+ $this->fail('An expected exception has not been raised');
+ }
+
+ /**
+ * Tests adding a plugin by its short name with arguments passed to the
+ * plugin constructor.
+ *
+ * @return void
+ */
+ public function testAddPluginShortNamePassesArgsToConstructor()
+ {
+ $pluginName = 'Mock';
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+
+ $arguments = array('a', 'b', 'c');
+ $plugin = $this->handler->addPlugin($pluginName, $arguments);
+
+ $this->assertAttributeSame(
+ $arguments,
+ 'arguments',
+ $plugin,
+ 'Arguments do not match'
+ );
+ }
+
+ /**
+ * Tests addPlugin() passing Phergie_Config to an instantiated plugin.
+ *
+ * @return void
+ */
+ public function testAddPluginPassesConstructorArguments()
+ {
+ $pluginName = 'Mock';
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+ $plugin = $this->handler->addPlugin($pluginName);
+
+ $this->assertSame(
+ $this->config,
+ $plugin->getConfig(),
+ 'Phergie_Config instances do not match'
+ );
+
+ $this->assertSame(
+ $this->events,
+ $plugin->getEventHandler(),
+ 'Phergie_Event_Handler instances do not match'
+ );
+ }
+
+ /**
+ * Tests addPlugin() calling onLoad() on an instantiated plugin.
+ *
+ * @return void
+ */
+ public function testAddPluginCallsOnLoadOnInstantiatedPlugin()
+ {
+ $plugin = $this->getMockPlugin(null, array('onLoad'));
+ $plugin
+ ->expects($this->once())
+ ->method('onLoad');
+ $this->handler->addPlugin($plugin);
+ }
+
+ /**
+ * Tests addPlugin() returning the same plugin when called twice.
+ *
+ * @return void
+ */
+ public function testAddPluginReturnsSamePluginWhenAskedTwice()
+ {
+ $pluginName = 'Mock';
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+ $plugin1 = $this->handler->addPlugin($pluginName);
+ $plugin2 = $this->handler->addPlugin($pluginName);
+ $this->assertSame($plugin1, $plugin2);
+ }
+
+ /**
+ * Tests getPlugin() throwing an exception when trying to get an
+ * unloaded plugin with autoload disabled.
+ *
+ * @depends testGetAutoloadDefaultsToNotAutoload
+ * @return void
+ */
+ public function testExceptionThrownWhenLoadingPluginWithoutAutoload()
+ {
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+
+ try {
+ $this->handler->getPlugin('Mock');
+ } catch (Phergie_Plugin_Exception $expected) {
+ $this->assertEquals(
+ Phergie_Plugin_Exception::ERR_PLUGIN_NOT_LOADED,
+ $expected->getCode()
+ );
+ return;
+ }
+
+ $this->fail('An expected exception has not been raised');
+ }
+
+ /**
+ * Tests addPlugins() with a plugin short name and no plugin constructor
+ * arguments.
+ *
+ * @depends testAddPluginByShortName
+ * @depends testAddPluginByInstance
+ * @return void
+ */
+ public function testAddPluginsWithoutArguments()
+ {
+ $prefix = 'Phergie_Plugin_';
+ $this->handler->addPath(dirname(__FILE__), $prefix);
+
+ $plugin = 'Mock';
+ $this->handler->addPlugins(array($plugin));
+ $returnedPlugin = $this->handler->getPlugin($plugin);
+ $this->assertContains(
+ get_class($returnedPlugin),
+ $prefix . $plugin,
+ 'Short name plugin not of expected class'
+ );
+ }
+
+ /**
+ * Tests addPlugins() with a plugin short name and plugin constructor
+ * arguments.
+ *
+ * @depends testAddPluginByShortName
+ * @depends testAddPluginByInstance
+ * @return void
+ */
+ public function testAddPluginsWithArguments()
+ {
+ $prefix = 'Phergie_Plugin_';
+ $this->handler->addPath(dirname(__FILE__), $prefix);
+
+ $arguments = array(1, 2, 3);
+ $plugin = array('Mock', $arguments);
+ $this->handler->addPlugins(array($plugin));
+ $returnedPlugin = $this->handler->getPlugin('Mock');
+ $this->assertEquals(
+ $arguments,
+ $returnedPlugin->getArguments(),
+ 'Constructor arguments for instance plugin do not match'
+ );
+ }
+
+ /**
+ * Tests removePlugin() with a plugin instance.
+ *
+ * @depends testAddPluginByInstance
+ * @return void
+ */
+ public function testRemovePluginByInstance()
+ {
+ $plugin = $this->getMockPlugin();
+ $this->handler->addPlugin($plugin);
+ $this->handler->removePlugin($plugin);
+ $this->assertFalse(
+ $this->handler->hasPlugin($plugin->getName()),
+ 'Plugin was not removed'
+ );
+ }
+
+ /**
+ * Tests removePlugin() with a plugin short name.
+ *
+ * @depends testAddPluginByShortName
+ * @return void
+ */
+ public function testRemovePluginByShortName()
+ {
+ $plugin = 'Mock';
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+
+ $this->handler->addPlugin($plugin);
+ $this->handler->removePlugin($plugin);
+ $this->assertFalse(
+ $this->handler->hasPlugin($plugin),
+ 'Plugin was not removed'
+ );
+ }
+
+ /**
+ * Tests getPlugin() when the plugin is not already loaded and
+ * autoloading is disabled.
+ *
+ * @depends testSetAutoload
+ * @return void
+ */
+ public function testGetPluginWithAutoloadEnabled()
+ {
+ $this->handler->setAutoload(true);
+ $this->handler->addPath(dirname(__FILE__), 'Phergie_Plugin_');
+ $plugin = $this->handler->getPlugin('Mock');
+ $this->assertType(
+ 'Phergie_Plugin_Mock',
+ $plugin,
+ 'Retrieved plugin not of expected class'
+ );
+ }
+
+ /**
+ * Tests getPlugins().
+ *
+ * @depends testGetPluginWithAutoloadEnabled
+ * @return void
+ */
+ public function testGetPlugins()
+ {
+ $plugin1 = $this->getMockPlugin('TestPlugin1');
+ $this->handler->addPlugin($plugin1);
+
+ $plugin2 = $this->getMockPlugin('TestPlugin2');
+ $this->handler->addPlugin($plugin2);
+
+ $expected = array(
+ 'testplugin1' => $plugin1,
+ 'testplugin2' => $plugin2,
+ );
+
+ $actual = $this->handler->getPlugins();
+ $this->assertEquals($expected, $actual);
+
+ $actual = $this->handler->getPlugins(array('testplugin1', 'testplugin2'));
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Tests that multiple plugin iterators can be used concurrently.
+ *
+ * @return void
+ */
+ public function testUseMultiplePluginIteratorsConcurrently()
+ {
+ $plugin1 = $this->getMockPlugin('TestPlugin1');
+ $this->handler->addPlugin($plugin1);
+
+ $plugin2 = $this->getMockPlugin('TestPlugin2');
+ $this->handler->addPlugin($plugin2);
+
+ $iterator1 = $this->handler->getIterator();
+ $iterator1->next();
+ $this->assertSame($plugin2, $iterator1->current());
+
+ $iterator2 = $this->handler->getIterator();
+ $this->assertSame($plugin1, $iterator2->current());
+ }
+
+ /**
+ * Tests adding plugin paths via configuration.
+ *
+ * @return void
+ */
+ public function testAddPluginPathsViaConfiguration()
+ {
+ $dir = dirname(__FILE__);
+ $prefix = 'Phergie_Plugin_';
+ $paths = array($dir => $prefix);
+ $this->config
+ ->expects($this->any())
+ ->method('offsetExists')
+ ->will($this->returnValue(true));
+ $this->config
+ ->expects($this->any())
+ ->method('offsetGet')
+ ->will($this->returnValue($paths));
+
+ // Reinitialize the handler so the configuration change takes effect
+ // within the constructor
+ $this->handler = new Phergie_Plugin_Handler(
+ $this->config,
+ $this->events
+ );
+
+ $this->handler->setAutoload(true);
+ $this->handler->getPlugin('Mock');
+ }
+}
diff --git a/plugins/Irc/lib/ircmanager.php b/plugins/Irc/lib/ircmanager.php
new file mode 100644
index 0000000000..11ba2bd7ed
--- /dev/null
+++ b/plugins/Irc/lib/ircmanager.php
@@ -0,0 +1,357 @@
+.
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+
+/**
+ * IRC background connection manager for IRC-using queue handlers,
+ * allowing them to send outgoing messages on the right connection.
+ *
+ * Input is handled during socket select loop, Any incoming messages will be handled.
+ *
+ * In a multi-site queuedaemon.php run, one connection will be instantiated
+ * for each site being handled by the current process that has IRC enabled.
+ */
+class IrcManager extends ImManager {
+ protected $conn = null;
+ protected $lastPing = null;
+ protected $messageWaiting = true;
+ protected $lastMessage = null;
+
+ protected $regChecks = array();
+ protected $regChecksLookup = array();
+
+ protected $connected = false;
+
+ /**
+ * Initialize connection to server.
+ *
+ * @return boolean true on success
+ */
+ public function start($master) {
+ if (parent::start($master)) {
+ $this->connect();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Return any open sockets that the run loop should listen
+ * for input on.
+ *
+ * @return array Array of socket resources
+ */
+ public function getSockets() {
+ $this->connect();
+ if ($this->conn) {
+ return $this->conn->getSockets();
+ } else {
+ return array();
+ }
+ }
+
+ /**
+ * Request a maximum timeout for listeners before the next idle period.
+ *
+ * @return integer Maximum timeout
+ */
+ public function timeout() {
+ if ($this->messageWaiting) {
+ return 1;
+ } else {
+ return $this->plugin->pinginterval;
+ }
+ }
+
+ /**
+ * Idle processing for io manager's execution loop.
+ *
+ * @return void
+ */
+ public function idle() {
+ // Send a ping if necessary
+ if (empty($this->lastPing) || time() - $this->lastPing > $this->plugin->pinginterval) {
+ $this->sendPing();
+ }
+
+ if ($this->connected) {
+ // Send a waiting message if appropriate
+ if ($this->messageWaiting && time() - $this->lastMessage > 1) {
+ $wm = Irc_waiting_message::top();
+ if ($wm === NULL) {
+ $this->messageWaiting = false;
+ return;
+ }
+
+ $data = unserialize($wm->data);
+ $wm->incAttempts();
+
+ if ($this->send_raw_message($data)) {
+ $wm->delete();
+ } else {
+ if ($wm->attempts <= common_config('queue', 'max_retries')) {
+ // Try again next idle
+ $wm->releaseClaim();
+ } else {
+ // Exceeded the maximum number of retries
+ $wm->delete();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Process IRC events that have come in over the wire.
+ *
+ * @param resource $socket Socket to handle input on
+ * @return void
+ */
+ public function handleInput($socket) {
+ common_debug('Servicing the IRC queue.');
+ $this->stats('irc_process');
+
+ try {
+ $this->conn->handleEvents();
+ } catch (Phergie_Driver_Exception $e) {
+ $this->connected = false;
+ $this->conn->reconnect();
+ }
+ }
+
+ /**
+ * Initiate connection
+ *
+ * @return void
+ */
+ public function connect() {
+ if (!$this->conn) {
+ $this->conn = new Phergie_StatusnetBot;
+
+ $config = new Phergie_Config;
+ $config->readArray(
+ array(
+ 'connections' => array(
+ array(
+ 'host' => $this->plugin->host,
+ 'port' => $this->plugin->port,
+ 'username' => $this->plugin->username,
+ 'realname' => $this->plugin->realname,
+ 'nick' => $this->plugin->nick,
+ 'password' => $this->plugin->password,
+ 'transport' => $this->plugin->transporttype,
+ 'encoding' => $this->plugin->encoding
+ )
+ ),
+
+ 'driver' => 'statusnet',
+
+ 'processor' => 'async',
+ 'processor.options' => array('sec' => 0, 'usec' => 0),
+
+ 'plugins' => array(
+ 'Pong',
+ 'NickServ',
+ 'AutoJoin',
+ 'Statusnet',
+ ),
+
+ 'plugins.autoload' => true,
+
+ // Uncomment to enable debugging output
+ //'ui.enabled' => true,
+
+ 'nickserv.password' => $this->plugin->nickservpassword,
+ 'nickserv.identify_message' => $this->plugin->nickservidentifyregexp,
+
+ 'autojoin.channels' => $this->plugin->channels,
+
+ 'statusnet.messagecallback' => array($this, 'handle_irc_message'),
+ 'statusnet.regcallback' => array($this, 'handle_reg_response'),
+ 'statusnet.connectedcallback' => array($this, 'handle_connected'),
+ 'statusnet.unregregexp' => $this->plugin->unregregexp,
+ 'statusnet.regregexp' => $this->plugin->regregexp
+ )
+ );
+
+ $this->conn->setConfig($config);
+ $this->conn->connect();
+ $this->lastPing = time();
+ $this->lastMessage = time();
+ }
+ return $this->conn;
+ }
+
+ /**
+ * Called via a callback when a message is received
+ * Passes it back to the queuing system
+ *
+ * @param array $data Data
+ * @return boolean
+ */
+ public function handle_irc_message($data) {
+ $this->plugin->enqueueIncomingRaw($data);
+ return true;
+ }
+
+ /**
+ * Called via a callback when NickServ responds to
+ * the bots query asking if a nick is registered
+ *
+ * @param array $data Data
+ * @return void
+ */
+ public function handle_reg_response($data) {
+ // Retrieve data
+ $screenname = $data['screenname'];
+ $nickdata = $this->regChecks[$screenname];
+ $usernick = $nickdata['user']->nickname;
+
+ if (isset($this->regChecksLookup[$usernick])) {
+ if ($data['registered']) {
+ // Send message
+ $this->plugin->sendConfirmationCode($screenname, $nickdata['code'], $nickdata['user'], true);
+ } else {
+ // TRANS: Message given when using an unregistered IRC nickname.
+ $this->plugin->sendMessage($screenname, _m('Your nickname is not registered so IRC connectivity cannot be enabled.'));
+
+ $confirm = new Confirm_address();
+
+ $confirm->user_id = $user->id;
+ $confirm->address_type = $this->plugin->transport;
+
+ if ($confirm->find(true)) {
+ $result = $confirm->delete();
+
+ if (!$result) {
+ common_log_db_error($confirm, 'DELETE', __FILE__);
+ // TRANS: Server error thrown on database error when deleting IRC nickname confirmation.
+ throw new ServerException(_m('Could not delete confirmation.'));
+ }
+ }
+ }
+
+ // Unset lookup value
+ unset($this->regChecksLookup[$usernick]);
+
+ // Unset data
+ unset($this->regChecks[$screename]);
+ }
+ }
+
+ /**
+ * Called when the connection is established
+ *
+ * @return void
+ */
+ public function handle_connected() {
+ $this->connected = true;
+ }
+
+ /**
+ * Enters a message into the database for sending when ready
+ *
+ * @param string $command Command
+ * @param array $args Arguments
+ * @return boolean
+ */
+ protected function enqueue_waiting_message($data) {
+ $wm = new Irc_waiting_message();
+
+ $wm->data = serialize($data);
+ $wm->prioritise = $data['prioritise'];
+ $wm->attempts = 0;
+ $wm->created = common_sql_now();
+ $result = $wm->insert();
+
+ if (!$result) {
+ common_log_db_error($wm, 'INSERT', __FILE__);
+ // TRANS: Server exception thrown when an IRC waiting queue item could not be added to the database.
+ throw new ServerException(_m('Database error inserting IRC waiting queue item.'));
+ }
+
+ return true;
+ }
+
+ /**
+ * Send a message using the daemon
+ *
+ * @param $data Message data
+ * @return boolean true on success
+ */
+ public function send_raw_message($data) {
+ $this->connect();
+ if (!$this->conn) {
+ return false;
+ }
+
+ if ($data['type'] != 'delayedmessage') {
+ if ($data['type'] != 'message') {
+ // Nick checking
+ $nickdata = $data['nickdata'];
+ $usernick = $nickdata['user']->nickname;
+ $screenname = $nickdata['screenname'];
+
+ // Cancel any existing checks for this user
+ if (isset($this->regChecksLookup[$usernick])) {
+ unset($this->regChecks[$this->regChecksLookup[$usernick]]);
+ }
+
+ $this->regChecks[$screenname] = $nickdata;
+ $this->regChecksLookup[$usernick] = $screenname;
+ }
+
+ // If there is a backlog or we need to wait, queue the message
+ if ($this->messageWaiting || time() - $this->lastMessage < 1) {
+ $this->enqueue_waiting_message(
+ array(
+ 'type' => 'delayedmessage',
+ 'prioritise' => $data['prioritise'],
+ 'data' => $data['data']
+ )
+ );
+ $this->messageWaiting = true;
+ return true;
+ }
+ }
+
+ try {
+ $this->conn->send($data['data']['command'], $data['data']['args']);
+ } catch (Phergie_Driver_Exception $e) {
+ $this->connected = false;
+ $this->conn->reconnect();
+ return false;
+ }
+
+ $this->lastMessage = time();
+ return true;
+ }
+
+ /**
+ * Sends a ping
+ *
+ * @return void
+ */
+ protected function sendPing() {
+ $this->lastPing = time();
+ $this->conn->send('PING', $this->lastPing);
+ }
+}
diff --git a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
index 0efaec99b2..8eeb1004b0 100644
--- a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
+++ b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
@@ -58,7 +58,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
return parent::onAutoload($cls);
}
- function onEndShowPageNotice($action)
+ function onEndShowPageNotice(Action $action)
{
$name = $action->trimmed('action');
$instr = false;
diff --git a/plugins/LdapCommon/LdapCommon.php b/plugins/LdapCommon/LdapCommon.php
index 7d052d5b24..aea1b72ea4 100644
--- a/plugins/LdapCommon/LdapCommon.php
+++ b/plugins/LdapCommon/LdapCommon.php
@@ -370,7 +370,7 @@ class LdapCommon
mt_srand((double)microtime() * 1000000);
while( strlen( $str ) < $length )
- $str .= substr( $possible, ( rand() % strlen( $possible ) ), 1 );
+ $str .= substr( $possible, ( mt_rand() % strlen( $possible ) ), 1 );
return $str;
}
diff --git a/plugins/LinkPreview/LinkPreviewPlugin.php b/plugins/LinkPreview/LinkPreviewPlugin.php
index 5edf66767d..5e04d4d154 100644
--- a/plugins/LinkPreview/LinkPreviewPlugin.php
+++ b/plugins/LinkPreview/LinkPreviewPlugin.php
@@ -48,7 +48,7 @@ class LinkPreviewPlugin extends Plugin
* @param Action $action
* @return boolean hook result
*/
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$user = common_current_user();
if ($user && common_config('attachments', 'process_links')) {
diff --git a/plugins/LinkPreview/actions/oembedproxy.php b/plugins/LinkPreview/actions/oembedproxy.php
index 97b0942441..c0473fb597 100644
--- a/plugins/LinkPreview/actions/oembedproxy.php
+++ b/plugins/LinkPreview/actions/oembedproxy.php
@@ -46,7 +46,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class OembedproxyAction extends OembedAction
{
- function handle($args)
+ function handle(array $args=array())
{
// Trigger short error responses; not a human-readable web page.
GNUsocial::setApi(true);
diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php
index fcc9d88e56..91e3edac40 100644
--- a/plugins/Mapstraction/MapstractionPlugin.php
+++ b/plugins/Mapstraction/MapstractionPlugin.php
@@ -63,7 +63,7 @@ class MapstractionPlugin extends Plugin
*
* @return boolean event handler return
*/
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect(':nickname/all/map',
array('action' => 'allmap'),
@@ -83,7 +83,7 @@ class MapstractionPlugin extends Plugin
*
* @return boolean event handler return
*/
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$actionName = $action->trimmed('action');
diff --git a/plugins/Mapstraction/actions/allmap.php b/plugins/Mapstraction/actions/allmap.php
index 21bdf62eaa..173629853c 100644
--- a/plugins/Mapstraction/actions/allmap.php
+++ b/plugins/Mapstraction/actions/allmap.php
@@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
*/
class AllmapAction extends MapAction
{
- function prepare($args)
+ function prepare(array $args=array())
{
if (parent::prepare($args)) {
$stream = new InboxNoticeStream($this->user->getProfile(), $this->scoped);
diff --git a/plugins/Mapstraction/actions/map.php b/plugins/Mapstraction/actions/map.php
index 75a065a26a..14712bb992 100644
--- a/plugins/Mapstraction/actions/map.php
+++ b/plugins/Mapstraction/actions/map.php
@@ -48,7 +48,7 @@ class MapAction extends Action
var $page = null;
var $notices = null;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
@@ -94,7 +94,7 @@ class MapAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
@@ -135,7 +135,7 @@ class MapAction extends Action
return true;
}
- function noticeAsJson($notice)
+ function noticeAsJson(Notice $notice)
{
// FIXME: this code should be abstracted to a neutral third
// party, like Notice::asJson(). I'm not sure of the ethics
diff --git a/plugins/Mapstraction/actions/usermap.php b/plugins/Mapstraction/actions/usermap.php
index 99a43e538a..4aef1400ab 100644
--- a/plugins/Mapstraction/actions/usermap.php
+++ b/plugins/Mapstraction/actions/usermap.php
@@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
*/
class UsermapAction extends MapAction
{
- function prepare($args)
+ function prepare(array $args=array())
{
if(parent::prepare($args)) {
$this->notice = empty($this->tag)
diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php
index 1dd3bdcf34..e2d6c87674 100644
--- a/plugins/Minify/MinifyPlugin.php
+++ b/plugins/Minify/MinifyPlugin.php
@@ -51,7 +51,7 @@ class MinifyPlugin extends Plugin
*
* @return boolean hook return
*/
- function onStartInitializeRouter($m)
+ function onStartInitializeRouter(URLMapper $m)
{
$m->connect('main/min',
array('action' => 'minify'));
@@ -152,7 +152,7 @@ class MinifyPlugin extends Plugin
return JSMin::minify($code);
}
- static function minifyCss($code, $options = array()) {
+ static function minifyCss($code, array $options = array()) {
require_once('Minify/CSS.php');
return Minify_CSS::minify($code,$options);
}
diff --git a/plugins/Minify/actions/minify.php b/plugins/Minify/actions/minify.php
index d7ec5d1392..671e22f5a6 100644
--- a/plugins/Minify/actions/minify.php
+++ b/plugins/Minify/actions/minify.php
@@ -30,12 +30,12 @@ class MinifyAction extends Action
var $file;
var $v;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->v = $args['v'];
@@ -70,7 +70,7 @@ class MinifyAction extends Action
return filemtime($this->file);
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
diff --git a/plugins/Minify/extlib/minify/min/lib/Solar/Dir.php b/plugins/Minify/extlib/minify/min/lib/Solar/Dir.php
index 37f7169624..0d1555c947 100644
--- a/plugins/Minify/extlib/minify/min/lib/Solar/Dir.php
+++ b/plugins/Minify/extlib/minify/min/lib/Solar/Dir.php
@@ -134,8 +134,8 @@ class Solar_Dir {
if (! Solar_Dir::$_tmp) {
// use the system if we can
- if (function_exists('sys_get_temp_dir')) {
- $tmp = sys_get_temp_dir();
+ if (function_exists('common_get_temp_dir')) {
+ $tmp = common_get_temp_dir();
} else {
$tmp = Solar_Dir::_tmp();
}
diff --git a/plugins/ModHelper/ModHelperPlugin.php b/plugins/ModHelper/ModHelperPlugin.php
index 2752a21539..b37ea44578 100644
--- a/plugins/ModHelper/ModHelperPlugin.php
+++ b/plugins/ModHelper/ModHelperPlugin.php
@@ -42,7 +42,7 @@ class ModHelperPlugin extends Plugin
return true;
}
- function onUserRightsCheck($profile, $right, &$result)
+ function onUserRightsCheck(Profile $profile, $right, &$result)
{
if (in_array($right, self::$rights)) {
// Hrm.... really we should confirm that the *other* user isn't privleged. :)
diff --git a/plugins/ModLog/ModLogPlugin.php b/plugins/ModLog/ModLogPlugin.php
index d1e01ca849..aa275fd82a 100644
--- a/plugins/ModLog/ModLogPlugin.php
+++ b/plugins/ModLog/ModLogPlugin.php
@@ -71,7 +71,7 @@ class ModLogPlugin extends Plugin
return true;
}
- function onEndGrantRole($profile, $role)
+ function onEndGrantRole(Profile $profile, $role)
{
$modlog = new ModLog();
@@ -79,7 +79,7 @@ class ModLogPlugin extends Plugin
$modlog->profile_id = $profile->id;
$cur = common_current_user();
-
+
if (!empty($cur)) {
$modlog->moderator_id = $cur->id;
}
@@ -93,7 +93,7 @@ class ModLogPlugin extends Plugin
return true;
}
- function onEndRevokeRole($profile, $role)
+ function onEndRevokeRole(Profile $profile, $role)
{
$modlog = new ModLog();
@@ -102,7 +102,7 @@ class ModLogPlugin extends Plugin
$modlog->profile_id = $profile->id;
$scoped = Profile::current();
-
+
if ($scoped instanceof Profile) {
$modlog->moderator_id = $scoped->getID();
}
@@ -174,7 +174,7 @@ class ModLogPlugin extends Plugin
}
}
- function onUserRightsCheck($profile, $right, &$result) {
+ function onUserRightsCheck(Profile $profile, $right, &$result) {
switch ($right) {
case self::VIEWMODLOG:
$result = ($profile->hasRole(Profile_role::MODERATOR) || $profile->hasRole('modhelper'));
diff --git a/plugins/ModPlus/ModPlusPlugin.php b/plugins/ModPlus/ModPlusPlugin.php
index 816034f831..f0ef808eb5 100644
--- a/plugins/ModPlus/ModPlusPlugin.php
+++ b/plugins/ModPlus/ModPlusPlugin.php
@@ -74,7 +74,7 @@ class ModPlusPlugin extends Plugin
*
* @param ProfileListItem $item
*/
- function onStartProfileListItemProfile($item)
+ function onStartProfileListItemProfile(ProfileListItem $item)
{
$this->showProfileOptions($item->out, $item->profile->getProfile());
return true;
diff --git a/plugins/Mollom/MollomPlugin.php b/plugins/Mollom/MollomPlugin.php
index 382ce2ee5b..b4c9c1cf69 100644
--- a/plugins/Mollom/MollomPlugin.php
+++ b/plugins/Mollom/MollomPlugin.php
@@ -70,7 +70,7 @@ class MollomPlugin extends Plugin
public $private_key;
public $servers;
- function onStartNoticeSave($notice)
+ function onStartNoticeSave(Notice $notice)
{
if ( $this->public_key ) {
//Check spam
diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php
index 22528d0b50..5b302a0ce9 100644
--- a/plugins/NoticeTitle/NoticeTitlePlugin.php
+++ b/plugins/NoticeTitle/NoticeTitlePlugin.php
@@ -246,7 +246,7 @@ class NoticeTitlePlugin extends Plugin
*
* @return boolean hook value
*/
- function onNoticeDeleteRelated($notice)
+ function onNoticeDeleteRelated(Notice $notice)
{
$nt = Notice_title::getKV('notice_id', $notice->id);
@@ -264,7 +264,7 @@ class NoticeTitlePlugin extends Plugin
*
* @return boolean hook value
*/
- function onStartShowHeadTitle($action)
+ function onStartShowHeadTitle(Action $action)
{
$actionName = $action->trimmed('action');
diff --git a/plugins/NoticeTitle/classes/Notice_title.php b/plugins/NoticeTitle/classes/Notice_title.php
index f88ab70087..d45864bd6c 100644
--- a/plugins/NoticeTitle/classes/Notice_title.php
+++ b/plugins/NoticeTitle/classes/Notice_title.php
@@ -77,7 +77,7 @@ class Notice_title extends Managed_DataObject
*
* @return string title of the notice, or null if none
*/
- static function fromNotice($notice)
+ static function fromNotice(Notice $notice)
{
$nt = Notice_title::getKV('notice_id', $notice->id);
if (empty($nt)) {
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 7c509f0641..a984f86de1 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -127,7 +127,7 @@ class OStatusPlugin extends Plugin
/**
* Put saved notices into the queue for pubsub distribution.
*/
- function onStartEnqueueNotice($notice, &$transports)
+ function onStartEnqueueNotice(Notice $notice, array &$transports)
{
if ($notice->inScope(null)) {
// put our transport first, in case there's any conflict (like OMB)
@@ -240,7 +240,7 @@ class OStatusPlugin extends Plugin
/*
* If the field being looked for is URI look for the profile
*/
- function onStartProfileCompletionSearch($action, $profile, $search_engine) {
+ public function onStartProfileCompletionSearch(Action $action, Profile $profile, $search_engine) {
if ($action->field == 'uri') {
$profile->joinAdd(array('id', 'user:id'));
$profile->whereAdd('uri LIKE "%' . $profile->escape($q) . '%"');
@@ -281,7 +281,7 @@ class OStatusPlugin extends Plugin
* @param array &$mention in/out param: set of found mentions
* @return boolean hook return value
*/
- function onEndFindMentions(Profile $sender, $text, &$mentions)
+ function onEndFindMentions(Profile $sender, $text, array &$mentions)
{
$matches = array();
@@ -370,7 +370,7 @@ class OStatusPlugin extends Plugin
* @param Profile &$profile
* @return hook return code
*/
- function onStartCommandGetProfile($command, $arg, &$profile)
+ public function onStartCommandGetProfile(Command $command, $arg, Profile &$profile = null)
{
$oprofile = $this->pullRemoteProfile($arg);
if ($oprofile instanceof Ostatus_profile && !$oprofile->isGroup()) {
@@ -397,7 +397,7 @@ class OStatusPlugin extends Plugin
* @param User_group &$group
* @return hook return code
*/
- function onStartCommandGetGroup($command, $arg, &$group)
+ function onStartCommandGetGroup(Command $command, $arg, User_group &$group = null)
{
$oprofile = $this->pullRemoteProfile($arg);
if ($oprofile instanceof Ostatus_profile && $oprofile->isGroup()) {
@@ -473,7 +473,7 @@ class OStatusPlugin extends Plugin
return true;
}
- function onEndShowStatusNetScripts($action) {
+ public function onEndShowStatusNetScripts(Action $action) {
$action->script($this->path('js/ostatus.js'));
return true;
}
@@ -531,7 +531,7 @@ class OStatusPlugin extends Plugin
if ($oprofile instanceof Ostatus_profile) {
$oprofile->processFeed($feed, 'push');
} else {
- common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri");
+ common_debug("No ostatus profile for incoming feed $feedsub->uri");
}
}
@@ -1139,7 +1139,7 @@ class OStatusPlugin extends Plugin
$oprofile->query(sprintf($sql, $profile->id, $profile->id));
if ($oprofile->N == 0) {
- common_log(LOG_DEBUG, "No OStatus remote subscribees for $profile->nickname");
+ common_debug("No OStatus remote subscribees for $profile->nickname");
return true;
}
@@ -1381,7 +1381,7 @@ class OStatusPlugin extends Plugin
return true;
}
- public function onProfileDeleteRelated($profile, &$related)
+ public function onProfileDeleteRelated(Profile $profile, array &$related)
{
// Ostatus_profile has a 'profile_id' property, which will be used to find the object
$related[] = 'Ostatus_profile';
diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php
index 64b47df498..d1a4d24c80 100644
--- a/plugins/OStatus/actions/ostatusinit.php
+++ b/plugins/OStatus/actions/ostatusinit.php
@@ -211,7 +211,8 @@ class OStatusInitAction extends Action
{
if ($this->nickname) {
$user = User::getKV('nickname', $this->nickname);
- if ($user) {
+
+ if ($user instanceof User) {
return common_local_url('userbyid', array('id' => $user->id));
} else {
// TRANS: Client error.
diff --git a/plugins/OStatus/actions/ostatustag.php b/plugins/OStatus/actions/ostatustag.php
index fa999fe09a..d054c3e59f 100644
--- a/plugins/OStatus/actions/ostatustag.php
+++ b/plugins/OStatus/actions/ostatustag.php
@@ -31,7 +31,7 @@ class OStatusTagAction extends OStatusInitAction
var $profile;
var $err;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php
index 0c7129e885..b0875c2988 100644
--- a/plugins/OStatus/classes/FeedSub.php
+++ b/plugins/OStatus/classes/FeedSub.php
@@ -487,7 +487,7 @@ class FeedSub extends Managed_DataObject
return true;
}
if (common_config('feedsub', 'debug')) {
- $tempfile = tempnam(sys_get_temp_dir(), 'feedsub-receive');
+ $tempfile = tempnam(common_get_temp_dir(), 'feedsub-receive');
if ($tempfile) {
file_put_contents($tempfile, $post);
}
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index a8269bdf07..b4df92e2da 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -371,9 +371,10 @@ class Ostatus_profile extends Managed_DataObject
* send immediately but won't get the return value.
*
* @param mixed $entry XML string, Notice, or Activity
+ * @param Profile $actor Acting profile
* @return boolean success
*/
- public function notifyDeferred($entry, $actor)
+ public function notifyDeferred($entry, Profile $actor)
{
if ($this->salmonuri) {
try {
@@ -526,7 +527,7 @@ class Ostatus_profile extends Managed_DataObject
* @param string $method 'push' or 'salmon'
* @return mixed saved Notice or false
*/
- public function processPost($activity, $method)
+ public function processPost(Activity $activity, $method)
{
$actor = ActivityUtils::checkAuthorship($activity, $this->localProfile());
@@ -550,7 +551,7 @@ class Ostatus_profile extends Managed_DataObject
*/
static public function filterAttention(Profile $sender, array $attention)
{
- common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', array_keys($attention)));
+ common_debug("Original reply recipients: " . implode(', ', array_keys($attention)));
$groups = array();
$replies = array();
foreach ($attention as $recipient=>$type) {
@@ -572,11 +573,11 @@ class Ostatus_profile extends Managed_DataObject
if ($sender->isMember($group)) {
$groups[] = $group->id;
} else {
- common_log(LOG_DEBUG, sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id));
+ common_debug(sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id));
}
continue;
} else {
- common_log(LOG_DEBUG, "Skipping reply to bogus group $recipient");
+ common_debug("Skipping reply to bogus group $recipient");
}
}
@@ -594,12 +595,12 @@ class Ostatus_profile extends Managed_DataObject
continue;
} catch (Exception $e) {
// Neither a recognizable local nor remote user!
- common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage());
+ common_debug("Skipping reply to unrecognized profile $recipient: " . $e->getMessage());
}
}
- common_log(LOG_DEBUG, "Local reply recipients: " . implode(', ', $replies));
- common_log(LOG_DEBUG, "Local group recipients: " . implode(', ', $groups));
+ common_debug("Local reply recipients: " . implode(', ', $replies));
+ common_debug("Local group recipients: " . implode(', ', $groups));
return array($groups, $replies);
}
@@ -890,13 +891,15 @@ class Ostatus_profile extends Managed_DataObject
// @todo FIXME: This should be better encapsulated
// ripped from oauthstore.php (for old OMB client)
- $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
+ $temp_filename = tempnam(common_get_temp_dir(), 'listener_avatar');
try {
$imgData = HTTPClient::quickGet($url);
+
// Make sure it's at least an image file. ImageFile can do the rest.
if (false === getimagesizefromstring($imgData)) {
throw new UnsupportedMediaException(_('Downloaded group avatar was not an image.'));
}
+
file_put_contents($temp_filename, $imgData);
unset($imgData); // No need to carry this in memory.
@@ -1115,7 +1118,7 @@ class Ostatus_profile extends Managed_DataObject
$discover = false;
if (!$homeuri) {
- common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true));
+ common_debug(__METHOD__ . " empty actor profile URI: " . var_export($activity, true));
// TRANS: Exception.
throw new Exception(_m('No profile URI.'));
}
@@ -1357,7 +1360,7 @@ class Ostatus_profile extends Managed_DataObject
// @todo tags from categories
if ($profile->id) {
- common_log(LOG_DEBUG, "Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
+ common_debug("Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
$profile->update($orig);
}
}
@@ -1381,12 +1384,12 @@ class Ostatus_profile extends Managed_DataObject
$group->homepage = self::getActivityObjectHomepage($object, $hints);
if ($group->id) { // If no id, we haven't called insert() yet, so don't run update()
- common_log(LOG_DEBUG, "Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
+ common_debug("Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
$group->update($orig);
}
}
- protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array()) {
+ protected static function updatePeopletag(Peopletag $tag, ActivityObject $object, array $hints=array()) {
$orig = clone($tag);
$tag->tag = $object->title;
@@ -1402,7 +1405,7 @@ class Ostatus_profile extends Managed_DataObject
$tag->tagger = $tagger->profile_id;
if ($tag->id) {
- common_log(LOG_DEBUG, "Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
+ common_debug("Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));
$tag->update($orig);
}
}
@@ -1804,7 +1807,7 @@ class Ostatus_profile extends Managed_DataObject
} else {
$actor = $activity->actor;
- if (empty($actor)) {
+ if (!$actor instanceof Profile) {
// OK here! assume the default
} else if ($actor->id == $this->getUri() || $actor->link == $this->getUri()) {
$this->updateFromActivityObject($actor);
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php
index 6786bfa298..a057da515b 100644
--- a/plugins/OStatus/lib/magicenvelope.php
+++ b/plugins/OStatus/lib/magicenvelope.php
@@ -340,19 +340,19 @@ class MagicEnvelope
public function verify(Profile $profile)
{
if ($this->alg != 'RSA-SHA256') {
- common_log(LOG_DEBUG, "Salmon error: bad algorithm");
+ common_debug("Salmon error: bad algorithm");
return false;
}
if ($this->encoding != self::ENCODING) {
- common_log(LOG_DEBUG, "Salmon error: bad encoding");
+ common_debug("Salmon error: bad encoding");
return false;
}
try {
$magicsig = $this->getKeyPair($profile, true); // Do discovery too if necessary
} catch (Exception $e) {
- common_log(LOG_DEBUG, "Salmon error: ".$e->getMessage());
+ common_debug("Salmon error: ".$e->getMessage());
return false;
}
diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php
index fed93b6ea6..cdf0ac9f21 100644
--- a/plugins/OStatus/lib/ostatusqueuehandler.php
+++ b/plugins/OStatus/lib/ostatusqueuehandler.php
@@ -166,7 +166,11 @@ class OStatusQueueHandler extends QueueHandler
$this->pushFeed($feed, array($this, 'peopletagFeedForNotice'), $ptag);
}
+<<<<<<< .merge_file_sx4QDh
function pingReply(Ostatus_profile $oprofile)
+=======
+ function pingReply(OStatus_profile $oprofile)
+>>>>>>> .merge_file_FBa6yh
{
if ($this->user) {
common_debug("OSTATUS [{$this->notice->getID()}]: pinging reply to {$oprofile->localProfile()->getNickname()} for local user '{$this->user->getID()}'");
@@ -174,7 +178,7 @@ class OStatusQueueHandler extends QueueHandler
// remote user or group.
// @fixme as an optimization we can skip this if the
// remote profile is subscribed to the author.
- $oprofile->notifyDeferred($this->notice, $this->user);
+ $oprofile->notifyDeferred($this->notice, $this->user->getProfile());
}
}
diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php
index a2703f1647..98e93d87e0 100644
--- a/plugins/OStatus/lib/salmonaction.php
+++ b/plugins/OStatus/lib/salmonaction.php
@@ -79,8 +79,17 @@ class SalmonAction extends Action
$this->clientError($e->getMessage());
}
+<<<<<<< .merge_file_rmpNGn
// Cryptographic verification test, throws exception on failure
$magic_env->verify($this->actor);
+=======
+ // Cryptographic verification test
+ if (!$magic_env->verify($this->actor)) {
+ common_debug("Salmon signature verification failed.");
+ // TRANS: Client error.
+ $this->clientError(_m('Salmon signature verification failed.'));
+ }
+>>>>>>> .merge_file_utstUn
return true;
}
@@ -93,7 +102,7 @@ class SalmonAction extends Action
{
parent::handle();
- common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
+ common_debug("Got a " . $this->activity->verb);
try {
if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) &&
Event::handle('StartHandleSalmon', array($this->activity))) {
diff --git a/plugins/OStatus/scripts/fixup-shadow.php b/plugins/OStatus/scripts/fixup-shadow.php
index ffaae5588d..817ef4eb16 100755
--- a/plugins/OStatus/scripts/fixup-shadow.php
+++ b/plugins/OStatus/scripts/fixup-shadow.php
@@ -31,7 +31,7 @@ for local users and groups.
END_OF_USERROLE_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$dry = have_option('dry-run');
@@ -156,7 +156,7 @@ while ($oprofile->fetch()) {
if (preg_match('!/group/(\d+)/id!', $oprofile->getUri(), $matches)) {
$id = intval($matches[1]);
$group = Local_group::getKV('group_id', $id);
- if ($group) {
+ if ($group instanceof Local_group) {
$nick = $group->nickname;
} else {
$nick = '';
@@ -165,11 +165,13 @@ while ($oprofile->fetch()) {
} else if (preg_match('!/user/(\d+)!', $uri, $matches)) {
$id = intval($matches[1]);
$user = User::getKV('id', $id);
- if ($user) {
+
+ if ($user instanceof User) {
$nick = $user->nickname;
} else {
$nick = '';
}
+
echo "user $id ($nick) hidden by $uri";
} else {
echo "$uri matched query, but we don't recognize it.\n";
diff --git a/plugins/OStatus/scripts/gcfeeds.php b/plugins/OStatus/scripts/gcfeeds.php
index a95cd54dbc..f1db4b358f 100755
--- a/plugins/OStatus/scripts/gcfeeds.php
+++ b/plugins/OStatus/scripts/gcfeeds.php
@@ -31,7 +31,7 @@ Clean up feeds that no longer have subscribers.
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$delete_inactive = have_option('d', 'delete-inactive');
$delcount = 0;
diff --git a/plugins/OStatus/scripts/renew-feeds.php b/plugins/OStatus/scripts/renew-feeds.php
index 8f8ac3ee1d..01136de417 100755
--- a/plugins/OStatus/scripts/renew-feeds.php
+++ b/plugins/OStatus/scripts/renew-feeds.php
@@ -26,7 +26,7 @@ Resubscribe to any soon expiring feeds. Default time to expiration is 1 day.
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
try {
$sub = FeedSub::renewalCheck();
diff --git a/plugins/OStatus/scripts/resub-feed.php b/plugins/OStatus/scripts/resub-feed.php
index d5d0924fbf..efad67dbb5 100755
--- a/plugins/OStatus/scripts/resub-feed.php
+++ b/plugins/OStatus/scripts/resub-feed.php
@@ -34,7 +34,7 @@ Options:
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$validate = new Validate();
diff --git a/plugins/OStatus/scripts/rm_bad_feedsubs.php b/plugins/OStatus/scripts/rm_bad_feedsubs.php
index ce1698a60c..1957f95cb3 100755
--- a/plugins/OStatus/scripts/rm_bad_feedsubs.php
+++ b/plugins/OStatus/scripts/rm_bad_feedsubs.php
@@ -41,7 +41,7 @@ the hub is probably either broken or doesn't exist.'
END_OF_HELP;
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
$dry = false;
diff --git a/plugins/OStatus/scripts/testfeed.php b/plugins/OStatus/scripts/testfeed.php
index da1eee292e..2a12069b5f 100755
--- a/plugins/OStatus/scripts/testfeed.php
+++ b/plugins/OStatus/scripts/testfeed.php
@@ -33,7 +33,7 @@ Mainly intended for testing funky feed formats.
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$validate = new Validate();
diff --git a/plugins/OStatus/scripts/update-profile-data.php b/plugins/OStatus/scripts/update-profile-data.php
index ca48dc34a7..c56bedd05c 100755
--- a/plugins/OStatus/scripts/update-profile-data.php
+++ b/plugins/OStatus/scripts/update-profile-data.php
@@ -37,7 +37,7 @@ Options:
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
function showProfileInfo(Ostatus_profile $oprofile) {
if ($oprofile->isGroup()) {
diff --git a/plugins/OStatus/scripts/update-profile.php b/plugins/OStatus/scripts/update-profile.php
index c5d9aa897c..40adda102e 100755
--- a/plugins/OStatus/scripts/update-profile.php
+++ b/plugins/OStatus/scripts/update-profile.php
@@ -30,7 +30,7 @@ things restarted if the hub or feed URLs have changed for the profile.
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$validate = new Validate();
diff --git a/plugins/OStatus/scripts/update_ostatus_profiles.php b/plugins/OStatus/scripts/update_ostatus_profiles.php
index 3f54c83cda..1f70bac897 100755
--- a/plugins/OStatus/scripts/update_ostatus_profiles.php
+++ b/plugins/OStatus/scripts/update_ostatus_profiles.php
@@ -36,7 +36,7 @@ you have no backup.
UPDATE_OSTATUS_PROFILES;
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
/*
* Hacky class to remove some checks and get public access to
@@ -54,7 +54,7 @@ class LooseOstatusProfile extends Ostatus_profile
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
- public static function updateProfileURL($profile_url, $hints=array())
+ public static function updateProfileURL($profile_url, array $hints=array())
{
$oprofile = null;
diff --git a/plugins/OStatus/tests/gettext-speedtest.php b/plugins/OStatus/tests/gettext-speedtest.php
index 0584af8ef4..52c8252c13 100644
--- a/plugins/OStatus/tests/gettext-speedtest.php
+++ b/plugins/OStatus/tests/gettext-speedtest.php
@@ -9,7 +9,7 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('GNUSOCIAL', true);
define('STATUSNET', true); // compatibility
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
require_once INSTALLDIR . '/extlib/php-gettext/gettext.inc';
common_init_locale("en_US");
diff --git a/plugins/OStatus/tests/slap.php b/plugins/OStatus/tests/slap.php
index e3f5439aed..eaef76d8cd 100755
--- a/plugins/OStatus/tests/slap.php
+++ b/plugins/OStatus/tests/slap.php
@@ -34,7 +34,7 @@ Test generation and sending of magic envelopes for Salmon slaps.
END_OF_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
if (!have_option('--notice')) {
print "$helptext";
diff --git a/plugins/Oembed/actions/oembed.php b/plugins/Oembed/actions/oembed.php
index 88ba52aa9f..fe412fb690 100644
--- a/plugins/Oembed/actions/oembed.php
+++ b/plugins/Oembed/actions/oembed.php
@@ -230,7 +230,7 @@ class OembedAction extends Action
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
diff --git a/plugins/Oembed/classes/File_oembed.php b/plugins/Oembed/classes/File_oembed.php
index 246a74fea0..02f48f623e 100644
--- a/plugins/Oembed/classes/File_oembed.php
+++ b/plugins/Oembed/classes/File_oembed.php
@@ -100,6 +100,9 @@ class File_oembed extends Managed_DataObject
* @param int $file_id
*/
public static function saveNew($data, $file_id) {
+ // @TODO Must be an object
+ assert(is_object($data));
+
$file_oembed = new File_oembed;
$file_oembed->file_id = $file_id;
if (!isset($data->version)) {
diff --git a/plugins/Oembed/scripts/fixup_files.php b/plugins/Oembed/scripts/fixup_files.php
index 50ddc8a994..d2fb6b9ccb 100755
--- a/plugins/Oembed/scripts/fixup_files.php
+++ b/plugins/Oembed/scripts/fixup_files.php
@@ -30,7 +30,7 @@ Patches up file entries with corrupted types and titles (the "h bug").
END_OF_USERROLE_HELP;
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
$dry = have_option('dry-run');
diff --git a/plugins/OfflineBackup/OfflineBackupPlugin.php b/plugins/OfflineBackup/OfflineBackupPlugin.php
index 1d7a17ca2c..2cc2ae00a0 100644
--- a/plugins/OfflineBackup/OfflineBackupPlugin.php
+++ b/plugins/OfflineBackup/OfflineBackupPlugin.php
@@ -50,7 +50,7 @@ if (!defined('STATUSNET')) {
class OfflineBackupPlugin extends Plugin
{
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('main/backupaccount',
array('action' => 'offlinebackup'));
@@ -65,7 +65,7 @@ class OfflineBackupPlugin extends Plugin
* @return boolean hook value
*/
- function onEndInitializeQueueManager($qm)
+ function onEndInitializeQueueManager(QueueManager $qm)
{
$qm->connect('backoff', 'OfflineBackupQueueHandler');
return true;
diff --git a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php
index 9f96193d95..82384f60bc 100644
--- a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php
+++ b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php
@@ -73,7 +73,7 @@ class OfflineBackupQueueHandler extends QueueHandler
{
// XXX: this is pretty lose-y; try another way
- $tmpdir = sys_get_temp_dir() . '/offline-backup/' . $user->nickname . '/' . common_date_iso8601(common_sql_now());
+ $tmpdir = common_get_temp_dir() . '/offline-backup/' . $user->nickname . '/' . common_date_iso8601(common_sql_now());
common_log(LOG_INFO, 'Writing backup data to ' . $tmpdir . ' for ' . $user->nickname);
diff --git a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php
index 06c75f7a93..a597f82996 100644
--- a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php
+++ b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php
@@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class OpenExternalLinkTargetPlugin extends Plugin
{
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
$action->inlineScript('$(document).on("click", "a[rel~=external]:not([class~=attachment])", function () { window.open(this.href); return false; });');
diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php
index 4e5a0bfe0c..95ca5730eb 100644
--- a/plugins/OpenID/OpenIDPlugin.php
+++ b/plugins/OpenID/OpenIDPlugin.php
@@ -125,7 +125,7 @@ class OpenIDPlugin extends Plugin
*
* @return boolean hook return
*/
- function onArgsInitialize($args)
+ function onArgsInitialize(array &$args)
{
if (common_config('site', 'openidonly')) {
if (array_key_exists('action', $args)) {
@@ -242,7 +242,7 @@ class OpenIDPlugin extends Plugin
*
* @return boolean hook return
*/
- function onEndLoginGroupNav($action)
+ function onEndLoginGroupNav(Action $action)
{
$this->showOpenIDLoginTab($action);
@@ -427,7 +427,7 @@ class OpenIDPlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndShowPageNotice($action)
+ function onEndShowPageNotice(Action $action)
{
$name = $action->trimmed('action');
@@ -566,7 +566,7 @@ class OpenIDPlugin extends Plugin
*
* @return boolean hook value
*/
- function onEndAdminPanelNav($nav)
+ function onEndAdminPanelNav(Menu $nav)
{
if (AdminPanelAction::canAdmin('openid')) {
diff --git a/plugins/OpenID/actions/finishaddopenid.php b/plugins/OpenID/actions/finishaddopenid.php
index 5182e50778..0661f2acfa 100644
--- a/plugins/OpenID/actions/finishaddopenid.php
+++ b/plugins/OpenID/actions/finishaddopenid.php
@@ -58,7 +58,7 @@ class FinishaddopenidAction extends Action
*
* @return void
*/
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (!common_logged_in()) {
diff --git a/plugins/OpenID/actions/finishopenidlogin.php b/plugins/OpenID/actions/finishopenidlogin.php
index 3a99988fb5..090ef8d450 100644
--- a/plugins/OpenID/actions/finishopenidlogin.php
+++ b/plugins/OpenID/actions/finishopenidlogin.php
@@ -29,7 +29,7 @@ class FinishopenidloginAction extends Action
var $username = null;
var $message = null;
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (common_is_real_login()) {
@@ -271,16 +271,18 @@ class FinishopenidloginAction extends Action
$user = oid_get_user($canonical);
- if ($user) {
+ if ($user instanceof User) {
oid_set_last($display);
// XXX: commented out at @edd's request until better
// control over how data flows from OpenID provider.
// oid_update_user($user, $sreg);
common_set_user($user);
common_real_login(true);
+
if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
common_rememberme($user);
}
+
unset($_SESSION['openid_rememberme']);
$this->goHome($user->nickname);
} else {
diff --git a/plugins/OpenID/actions/openidlogin.php b/plugins/OpenID/actions/openidlogin.php
index 86ebcae2e1..1728ff7d01 100644
--- a/plugins/OpenID/actions/openidlogin.php
+++ b/plugins/OpenID/actions/openidlogin.php
@@ -25,7 +25,7 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
class OpenidloginAction extends Action
{
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if (common_is_real_login()) {
diff --git a/plugins/OpenID/actions/openidserver.php b/plugins/OpenID/actions/openidserver.php
index b50a9129d7..512dc37467 100644
--- a/plugins/OpenID/actions/openidserver.php
+++ b/plugins/OpenID/actions/openidserver.php
@@ -50,14 +50,14 @@ class OpenidserverAction extends Action
{
var $oserver;
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
$this->oserver = oid_server();
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$request = $this->oserver->decodeRequest();
diff --git a/plugins/OpenID/actions/openidtrust.php b/plugins/OpenID/actions/openidtrust.php
index 3f8a3a93b7..1c09be85d9 100644
--- a/plugins/OpenID/actions/openidtrust.php
+++ b/plugins/OpenID/actions/openidtrust.php
@@ -35,7 +35,7 @@ class OpenidtrustAction extends Action
*
* @return boolean false
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}
@@ -51,7 +51,7 @@ class OpenidtrustAction extends Action
return _m('OpenID Identity Verification');
}
- function prepare($args)
+ function prepare(array $args=array())
{
parent::prepare($args);
common_ensure_session();
@@ -71,7 +71,7 @@ class OpenidtrustAction extends Action
return true;
}
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
if($_SERVER['REQUEST_METHOD'] == 'POST'){
diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php
index ee854e8140..403bf7e9da 100644
--- a/plugins/OpenID/openid.php
+++ b/plugins/OpenID/openid.php
@@ -346,7 +346,7 @@ function oid_check_teams($response)
$match = in_array($requiredTeam, $teams);
$is = $match ? 'is' : 'is not';
- common_log(LOG_DEBUG, "Remote user $is in required team $requiredTeam: [" . implode(', ', $teams) . "]");
+ common_debug("Remote user $is in required team $requiredTeam: [" . implode(', ', $teams) . "]");
return $match;
}
@@ -359,7 +359,7 @@ class AutosubmitAction extends Action
var $form_html = null;
var $form_id = null;
- function handle($args)
+ function handle(array $args=array())
{
parent::handle($args);
$this->showPage();
diff --git a/plugins/OpenX/OpenXPlugin.php b/plugins/OpenX/OpenXPlugin.php
index 8d80197be3..1d2b9d53e8 100644
--- a/plugins/OpenX/OpenXPlugin.php
+++ b/plugins/OpenX/OpenXPlugin.php
@@ -173,7 +173,7 @@ ENDOFSCRIPT;
return true;
}
- function onRouterInitialized($m)
+ function onRouterInitialized(URLMapper $m)
{
$m->connect('panel/openx',
array('action' => 'openxadminpanel'));
@@ -181,7 +181,7 @@ ENDOFSCRIPT;
return true;
}
- function onEndAdminPanelNav($menu) {
+ function onEndAdminPanelNav(Menu $menu) {
if (AdminPanelAction::canAdmin('openx')) {
// TRANS: Menu item title.
$menu_title = _m('OpenX configuration.');
diff --git a/plugins/OpportunisticQM/OpportunisticQMPlugin.php b/plugins/OpportunisticQM/OpportunisticQMPlugin.php
index 0b57fb4ccc..fdd484caef 100644
--- a/plugins/OpportunisticQM/OpportunisticQMPlugin.php
+++ b/plugins/OpportunisticQM/OpportunisticQMPlugin.php
@@ -1,11 +1,37 @@
.
+ *
+ * @category OpportunisticQMPlugin
+ * @package StatusNet
+ * @author Brion Vibber
+ * @copyright 2011 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
+ * @link http://status.net/
+ */
class OpportunisticQMPlugin extends Plugin {
public $qmkey = false;
public $secs_per_action = 1; // total seconds to run script per action
public $rel_to_pageload = true; // relative to pageload or queue start
- public function onRouterInitialized($m)
+ public function onRouterInitialized(URLMapper $m)
{
$m->connect('main/runqueue', array('action' => 'runqueue'));
}
diff --git a/plugins/OpportunisticQM/lib/opportunisticqueuemanager.php b/plugins/OpportunisticQM/lib/opportunisticqueuemanager.php
index 2834b9a0ee..db1404ba6c 100644
--- a/plugins/OpportunisticQM/lib/opportunisticqueuemanager.php
+++ b/plugins/OpportunisticQM/lib/opportunisticqueuemanager.php
@@ -111,6 +111,7 @@ class OpportunisticQueueManager extends DBQueueManager
try {
$this->poll();
} catch (RunQueueOutOfWorkException $e) {
+ common_debug('Opportunistic queue manager finished: ' . $e->getMessage());
return true;
}
}
diff --git a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php
index fa5894a8f5..59ef822cb2 100644
--- a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php
+++ b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php
@@ -76,7 +76,7 @@ class PiwikAnalyticsPlugin extends Plugin
*
* @return boolean ignored
*/
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $action)
{
// Slight modification to the default code.
// Loading the piwik.js file from a