]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorRoland Häder <haeder@hmmdeutschland.de>
Fri, 9 Jan 2015 07:55:34 +0000 (08:55 +0100)
committerRoland Häder <haeder@hmmdeutschland.de>
Fri, 9 Jan 2015 07:55:34 +0000 (08:55 +0100)
Conflicts:
plugins/Poll/lib/polllistitem.php

Signed-off-by: Roland Häder <haeder@hmmdeutschland.de>
138 files changed:
actions/addpeopletag.php
actions/block.php
actions/removepeopletag.php
classes/User_group.php
extlib/DB/DataObject.php [changed mode: 0755->0644]
extlib/DB/DataObject/Cast.php [changed mode: 0755->0644]
extlib/DB/DataObject/Error.php [changed mode: 0755->0644]
extlib/DB/DataObject/Generator.php [changed mode: 0755->0644]
extlib/DB/DataObject/createTables.php [changed mode: 0755->0644]
extlib/Mail.php [changed mode: 0755->0644]
extlib/Mail/RFC822.php [changed mode: 0755->0644]
extlib/Mail/mail.php [changed mode: 0755->0644]
extlib/Mail/mock.php [changed mode: 0755->0644]
extlib/Mail/null.php [changed mode: 0755->0644]
extlib/Mail/sendmail.php [changed mode: 0755->0644]
extlib/Mail/smtp.php [changed mode: 0755->0644]
extlib/Mail/smtpmx.php [changed mode: 0755->0644]
extlib/Net/URL2.php [changed mode: 0755->0644]
index.php
lib/activityimporter.php
lib/default.php
lib/framework.php
lib/grouplist.php
lib/imagefile.php
lib/inboxnoticestream.php
lib/installer.php
lib/noticelistitem.php
lib/util.php
plugins/ActivitySpam/scripts/silencespammer.php
plugins/ActivitySpam/scripts/testuser.php
plugins/ActivitySpam/scripts/trainuser.php
plugins/AnonymousFave/scripts/initialize_fave_tallys.php
plugins/Blog/BlogPlugin.php
plugins/Bookmark/scripts/importbookmarks.php
plugins/DirectMessage/classes/Message.php
plugins/Directory/lib/sortablegrouplist.php
plugins/DomainStatusNetwork/scripts/installforemail.php
plugins/DomainStatusNetwork/scripts/proposesite.php
plugins/DomainStatusNetwork/scripts/sitefordomain.php
plugins/EmailRegistration/scripts/cancelemailregistration.php
plugins/EmailRegistration/scripts/registeremailuser.php
plugins/EmailReminder/scripts/sendemailreminder.php
plugins/EmailSummary/scripts/sendemailsummary.php
plugins/ExtendedProfile/ExtendedProfilePlugin.php
plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/HandlerTest.php
plugins/Minify/extlib/minify/min/lib/Solar/Dir.php
plugins/OStatus/actions/ostatusinit.php
plugins/OStatus/classes/FeedSub.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/scripts/fixup-shadow.php
plugins/OStatus/scripts/gcfeeds.php
plugins/OStatus/scripts/renew-feeds.php
plugins/OStatus/scripts/resub-feed.php
plugins/OStatus/scripts/rm_bad_feedsubs.php
plugins/OStatus/scripts/testfeed.php
plugins/OStatus/scripts/update-profile-data.php
plugins/OStatus/scripts/update-profile.php
plugins/OStatus/scripts/update_ostatus_profiles.php
plugins/OStatus/tests/gettext-speedtest.php
plugins/OStatus/tests/slap.php
plugins/Oembed/scripts/fixup_files.php
plugins/OfflineBackup/lib/offlinebackupqueuehandler.php
plugins/OpenID/actions/finishopenidlogin.php
plugins/Realtime/scripts/cleanupchannels.php
plugins/RequireValidatedEmail/scripts/registerbyemail.php
plugins/SearchSub/SearchSubPlugin.php
plugins/Sitemap/scripts/updatecounts.php
plugins/SlicedFavorites/actions/favoritedslice.php
plugins/SphinxSearch/scripts/gen_config.php
plugins/SphinxSearch/scripts/index_update.php
plugins/SubMirror/actions/mirrorsettings.php
plugins/TagSub/TagSubPlugin.php
plugins/TwitterBridge/daemons/synctwitterfriends.php
plugins/TwitterBridge/daemons/twitterdaemon.php
plugins/TwitterBridge/daemons/twitterstatusfetcher.php
plugins/TwitterBridge/scripts/fakestream.php
plugins/TwitterBridge/scripts/initialize_notice_to_status.php
plugins/TwitterBridge/scripts/streamtest.php
plugins/VideoThumbnails/VideoThumbnailsPlugin.php
plugins/WikiHowProfile/WikiHowProfilePlugin.php
plugins/YammerImport/lib/yammerimporter.php
scripts/allsites.php
scripts/backupuser.php
scripts/checkschema.php
scripts/clean_thumbnails.php
scripts/clear_jabber.php
scripts/clearcache.php
scripts/command.php
scripts/commandline.inc [deleted file]
scripts/commandline.inc.php [new file with mode: 0644]
scripts/console.php
scripts/createsim.php
scripts/deletegroup.php
scripts/deleteuser.php
scripts/docgen.php
scripts/dumpschema.php
scripts/fixup_deletions.php
scripts/flushrouter.php
scripts/flushsite.php
scripts/getpiddir.php
scripts/getvaliddaemons.php
scripts/gnusocialversion.php
scripts/handlequeued.php
scripts/imdaemon.php
scripts/importtwitteratom.php
scripts/joingroup.php
scripts/leavegroup.php
scripts/maildaemon.php
scripts/make-release.php
scripts/makegroupadmin.php
scripts/moveuser.php
scripts/queuectl.php
scripts/queuedaemon.php
scripts/registeruser.php
scripts/restoreuser.php
scripts/sendemail.php
scripts/sessiongc.php
scripts/setconfig.php
scripts/setpassword.php
scripts/settag.php
scripts/showcache.php
scripts/showplugins.php
scripts/showtable.php
scripts/startdaemons.sh
scripts/stopdaemons.sh
scripts/strip_geo.php
scripts/uncache_users.php
scripts/updatelocation.php
scripts/updateurls.php
scripts/upgrade.php
scripts/useremail.php
scripts/userrole.php
tests/UserRightsTest.php
tests/atompub/atompub_test.php
tests/oauth/fetch_temp_creds.php
tests/oauth/fetch_token_creds.php
tests/oauth/oauth_post_notice.php
tests/oauth/oauth_verify_creds.php

index b501ce0fd9679b245d36f300164f7b433e9cce26..551e9688597e6433dfd84a13d0aa0c2cc0c042d1 100644 (file)
@@ -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.
index 53d8ae7ae0600c17a800cfc5e927a7efd40facfd..71d009b788ae3e9fb292fba6f68ed9206b73c2cc 100644 (file)
@@ -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 {
index 8192e86b44fd4246c932136a92f6c01eee9f5022..3d9cfe5332de28ebec2a053d7ef8edaba92aed62 100644 (file)
@@ -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.
index aad38b635885540a29bf2b63e3b4b330744172b1..89731ee2644160cf06eabf6e7c1cd9cde1d0b1ce 100644 (file)
@@ -85,9 +85,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];
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 674099e7128c1193547cf1fe689a1e6032e0eb50..76e4cfe71623d3d320b2739aa76aafdb6eba740b 100644 (file)
--- 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();
 
index 4e13419ae7482ccd0aed3eac7ffad9e15e6ca789..2cf950183005a3477352488f68e965cb94200626 100644 (file)
@@ -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");
index 3f4f9ab056765828c153719de6738b6c01b8d6c0..a660c6b33dcd79b690ed8cd83161664a859afd9d 100644 (file)
@@ -131,7 +131,7 @@ $default =
               'delete' => false,
               'move' => true),
         'image' =>
-        array('jpegquality' => 85),
+        array('jpegquality' => 95),
         'avatar' =>
         array('server' => null,
               'dir' => INSTALLDIR . '/avatar/',
index d597a8d40d3380ed0dde2c4464942c06730dcb46..eebcb8602a5348153c49c2807513ba077c1f8c8f 100644 (file)
@@ -105,6 +105,28 @@ function _have_config()
     return StatusNet::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')) {
@@ -121,6 +143,7 @@ function GNUsocial_class_autoload($cls)
     }
 }
 
+
 // Autoload function queue, starting with our own discovery method
 spl_autoload_register('GNUsocial_class_autoload');
 
index 39e904222adc719af04cd06773ff4c639ede9d42..d29a149573323b56ffd612643de9a7aa59d49d0e 100644 (file)
@@ -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');
index 8a0f65232793a962716b49f74dc1fe4f27b3fa94..733a4bbc9c0d456d61350a6cd4671315f7758f6d 100644 (file)
@@ -61,13 +61,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);
index 87868b1d79aab4f2e6b852dac3a7106ac229c293..0d8733e079cc31989dd0e6ecc009a035154c607f 100644 (file)
@@ -139,11 +139,13 @@ class RawInboxNoticeStream extends NoticeStream
 
     function getNotices($offset, $limit, $sinceId, $maxId)
     {
+        //common_debug('offset=' . $offset . ',limit=' . $limit . ',sinceId=' . $sinceId . ',maxId=' . $maxId . ' - CALLED!');
         $all = array();
 
         do {
 
             $ids = $this->getNoticeIds($offset, $limit, $sinceId, $maxId);
+            //common_debug('ids()=' . count($ids));
 
             $notices = Notice::pivotGet('id', $ids);
 
@@ -158,8 +160,10 @@ class RawInboxNoticeStream extends NoticeStream
                 $limit  -= count($notices);
             }
 
+            //common_debug('all()=' . count($all));
         } while (count($notices) < count($ids) && count($ids) > 0);
 
+        //common_debug('all()=' . count($all) . ' - EXIT!');
         return new ArrayWrapper($all);
     }
 }
index cea7d29ec7df621801ffaeb934fc5fd7462b65ed..9a167618f7db42e8b4069ee759f32e39859833c2 100644 (file)
@@ -293,7 +293,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());
         }
index 8572c6583ee083c2040727f5d11557c3a23a4d17..15c07e31ca62b0c18a6ec8e21e0010f60aa7d16d 100644 (file)
@@ -151,7 +151,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();
@@ -161,6 +162,7 @@ class NoticeListItem extends Widget
                 }
                 $this->out->elementEnd('div');
             }
+
             Event::handle('EndShowNoticeOptions', array($this));
         }
     }
index 08a0cdea2fac9f736e164ac0e01e0a3f1bccd2c9..b0a7eeb7409ef831674a342a0139c5b1f13ed56a 100644 (file)
@@ -322,7 +322,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';
index 3a5e585fd5218c4296678459990c37f3569f3981..4e710d10a7bac3735dbcef765fd442947eae4ebc 100644 (file)
@@ -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;
index 0eee9324bf289bedf2992d31370b964e00592fdf..af3cc5b47a67ca18438e13fa1b605a9ed9e0858e 100644 (file)
@@ -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;
index 974048b4c911211e63c9975031490344372d1460..a0d60b9a7b96943a44bd18ae843526e5da9bc65f 100644 (file)
@@ -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) {
 
index a955620db57b3efa636bbdc62b39df7028a3e477..e0d0213d8f440b2dd8192a650f8fce52b6adad1d 100755 (executable)
@@ -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();
index 8d5532b8b17c508c1cce18f1960c20aaf07e7a9c..61485f8c84d495dff2d6d50913f659f018499c73 100644 (file)
@@ -111,7 +111,7 @@ class BlogPlugin extends MicroAppPlugin
 
     function tag()
     {
-        return 'blog';
+        return 'blogentry';
     }
 
     function types()
index c47a042973724f9b70ab008e87aee61757b4fe4a..af7dd2d1e06456b67e276e3c3a9eea1d9a394111 100644 (file)
@@ -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
index 3818a38f48ffcc6dfee7635036644866cf160685..bd568b6209f136501273db1aadfe36ec806db013 100644 (file)
@@ -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;
index 2849e75eba6fb69c5e8fc8f84dac17218d966d1c..03a83438a025073d7bbc9fe34f59a0c7c646e684 100644 (file)
@@ -234,8 +234,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
index f773094a74c426e9ccc023b43468d08e5a61cef2..1815b977596fe267ce731a1bf59a1de7b16a4040 100644 (file)
@@ -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];
 
index 96a722fdab775767ae943be3483be888905789eb..28741a5d4fb94a6cca6630d26c525e038e94ba8a 100644 (file)
@@ -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]);
 
index 59412ccebab6929169091d7ccddae77aa837d6b4..2eaa600d2598009bffb075811eaabbbc133fe8b6 100644 (file)
@@ -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]);
 
index d834aade600abdb032570d35fb9dc1f9b7bf5b36..7ae81f7ccf8f48ead06666ce58052fa3c03817fc 100644 (file)
@@ -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();
index 02915240d32d2e57b3abbff7f280e6dfd9256921..a785a76a6649080aefba71cc0323ed8172971292 100644 (file)
@@ -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();
index 2cc214a671c04e11bd874563099e3f0f0029e59d..707bb4090782059375d77a612e3f8efda424972f 100644 (file)
@@ -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');
 
index 01c11a210a009c6edbba4cf2a752c6966ca0db48..2743bd18523ba618a0b2c487819962aceaba6205 100644 (file)
@@ -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();
index a5cd823bb76ff14c5e6c37f0ed0c1892a6c409a9..6bdabea07dcd840c226ab2013210780a2b2ddffc 100644 (file)
@@ -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...'));
index 9ecdd327ae4f2eb52f01cea60321c942a9845ff1..98c70dfceeae881439fcd5137e6a699faa845b6e 100644 (file)
@@ -493,7 +493,7 @@ class Phergie_Plugin_HandlerTest extends PHPUnit_Framework_TestCase
      */
     public function testAddPluginThrowsExceptionWhenPluginClassNotFound()
     {
-        $path = sys_get_temp_dir() . '/Phergie/Plugin';
+        $path = common_get_temp_dir() . '/Phergie/Plugin';
         $this->removeDirectory(dirname($path));
         mkdir($path, 0777, true);
         touch($path . '/TestPlugin.php');
index 37f7169624c58b7d0ea1b6bbeff294a9d21b7b75..0d1555c9473cb6e47d24e8a258c09e1b5c9a8c97 100644 (file)
@@ -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();
             }
index 5666c898af4e91938e91c2c412174579089865f0..85ba31c2d8da1d0eb4897c816fdd84d2452417f8 100644 (file)
@@ -210,7 +210,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.
index 338c2f51445de04e57c949653258450c2f6faa42..419f416484b6b4f4ea19de9c52185389cdfd51db 100644 (file)
@@ -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);
                     }
index 96ab7f6be72ab4cef7bb78d83ec2f183ab4d5b69..60033ae03a359fb425b0a8f5b0561b38ffc1566d 100644 (file)
@@ -1251,11 +1251,11 @@ 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 {
             if (!copy($url, $temp_filename)) {
                 // TRANS: Server exception. %s is a URL.
-                throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url));
+                throw new ServerException(sprintf(_m('Unable to fetch avatar from %s to %s.'), $url, $temp_filename));
             }
 
             if ($this->isGroup()) {
index ffaae5588d1eae757e07e15ac654f27056d168fc..817ef4eb166cc9f97225443fd57ac564e4a63bb2 100644 (file)
@@ -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 = '<deleted>';
@@ -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 = '<deleted>';
         }
+
         echo "user $id ($nick) hidden by $uri";
     } else {
         echo "$uri matched query, but we don't recognize it.\n";
index a4f71ab77f350a35d16271851a92849b0fe45254..94ead535fb1eb31127b0d1273f4bd4ee0e1c4a55 100644 (file)
@@ -26,7 +26,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';
 
 $feedsub = new FeedSub();
 $feedsub->find();
index 8f8ac3ee1d968416dacd8557e6e5fba7360181a4..01136de4173c5e04e871bc966d1b6deab49106fe 100644 (file)
@@ -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();
index 3d13724f7db1336979a951e6f5616c8bae1dba9a..edf64cd5f6247c047dbe01c5c95bef1caab103a9 100644 (file)
@@ -34,7 +34,7 @@ Options:
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (empty($args[0]) || !Validate::uri($args[0])) {
     print "$helptext";
index ce1698a60c2bff4751a228127965bf6422e176e4..1957f95cb368f3cafce9cf6b36ce25acbb156a25 100644 (file)
@@ -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;
 
index 42f21a7aa0465e41439db0a6212f5c1a34bda67d..316b20b41d9af6bd9ee50149fe0bd737aaa659a4 100644 (file)
@@ -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';
 
 if (empty($args[0]) || !Validate::uri($args[0])) {
     print "$helptext";
index 116061a7c3bc626183a4a74d163da67bc558af5d..4e29148c865f71550ba4aa4dcb467b99aecf5d5b 100644 (file)
@@ -36,7 +36,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()) {
index ece19804420a1841d6a598ff98d1274137dae9ca..5b0c8b92e6af62a5f215019a3b8dba3aaee2e9b4 100644 (file)
@@ -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';
 
 if (empty($args[0]) || !Validate::uri($args[0])) {
     print "$helptext";
index a5c8ad5437030743ac258a4b96cfd1db1667730d..01116bb6f4d50d7b08c66cb9a845997c9d2871d4 100644 (file)
@@ -35,7 +35,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
@@ -70,11 +70,11 @@ class LooseOstatusProfile extends Ostatus_profile
 
         // @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 {
             if (!copy($url, $temp_filename)) {
                 // TRANS: Server exception. %s is a URL.
-                throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url));
+                throw new ServerException(sprintf(_m('Unable to fetch avatar from %s to %s.'), $url, $temp_filename));
             }
 
             if ($this->isGroup()) {
index 0584af8ef45669b789e08f8b9015825fe59e3683..52c8252c1394cf1058d42c738e9821a5097928a3 100644 (file)
@@ -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");
index e3f5439aed69bd239da22149538dfbbade619819..eaef76d8cdeb1f1e2e59b5cb568f1b0856395268 100644 (file)
@@ -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";
index 50ddc8a9943b2035885fc8ec88cf28de6f50ef4c..d2fb6b9ccb425e8ff6c1d8acc26120fecc6d3fe3 100755 (executable)
@@ -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');
 
index 9f96193d95758ed85c67db31bfd4a4c6216a42c2..82384f60bcc35765bb1df557e5c7be57ad9848ab 100644 (file)
@@ -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);
 
index 3a99988fb59093fccf76e6b064ab35482abdae26..23f12a9e8558b62ea612abb1fdeb4f2953c90ae2 100644 (file)
@@ -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 {
index ea195b02cddccb7b113f82f31329e9247ae54696..220d85b7e4b10355e4f64ac021524bacb37c4e78 100644 (file)
@@ -33,7 +33,7 @@ Garbage-collects old realtime channels
 
 END_OF_CLEANUPCHANNELS_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function cleanupChannels()
 {
index 4d2000ab0fe714903549880f040c1f97dc77cad0..6935e00ee5ff192073faf1faf3c99ba6ed5a1a5e 100644 (file)
@@ -30,7 +30,7 @@ Registers a new user by email address and sends a confirmation email
 
 END_OF_REGISTERBYEMAIL_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $email = get_option_value('e', 'email');
 
index dc7ff7b19a2fff843bb2db3e85ec3d696cd0d2af..f05ccf51c8d7211b69525b92df2cc9e9f0a8c5ce 100644 (file)
@@ -165,7 +165,8 @@ class SearchSubPlugin extends Plugin
     function onStartNoticeSearchShowResults($action, $q, $notice)
     {
         $user = common_current_user();
-        if ($user) {
+
+        if ($user instanceof User) {
             $search = $q;
             $searchsub = SearchSub::pkeyGet(array('search' => $search,
                                                   'profile_id' => $user->id));
@@ -174,6 +175,7 @@ class SearchSubPlugin extends Plugin
             } else {
                 $form = new SearchSubForm($action, $search);
             }
+
             $action->elementStart('div', 'entity_actions');
             $action->elementStart('ul');
             $action->elementStart('li', 'entity_subscribe');
@@ -182,6 +184,7 @@ class SearchSubPlugin extends Plugin
             $action->elementEnd('ul');
             $action->elementEnd('div');
         }
+
         return true;
     }
 
index 91bc0ac4e9720a23532973182c7bb749a06e1bb7..744dab82876e816f023fe1cd0878873eb7855bfe 100644 (file)
@@ -26,7 +26,7 @@ Update the notice and user counts cached in the database.
 
 END_OF_UPDATECOUNTS_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 // Will fill the cache
 
index 5c9fb31f8f97a790364d872a996b2a11e13bba27..bf4242d096586bdb9b2331015ed8e3c11b1f4982 100644 (file)
@@ -121,13 +121,13 @@ class FavoritedSliceAction extends FavoritedAction
         $exclude = $this->nicknamesToIds($this->excludeUsers);
 
         if (count($include) == 1) {
-            return "profile_id = " . intval($include[0]);
+            return '`profile_id` = ' . intval($include[0]);
         } else if (count($include) > 1) {
-            return "profile_id IN (" . implode(',', $include) . ")";
+            return '`profile_id` IN (' . implode(',', $include) . ')';
         } else if (count($exclude) == 1) {
-            return "profile_id != " . intval($exclude[0]);
+            return '`profile_id` != ' . intval($exclude[0]);
         } else if (count($exclude) > 1) {
-            return "profile_id NOT IN (" . implode(',', $exclude) . ")";
+            return '`profile_id` NOT IN (' . implode(',', $exclude) . ')';
         } else {
             return false;
         }
@@ -144,7 +144,8 @@ class FavoritedSliceAction extends FavoritedAction
         foreach ($nicks as $nick) {
             // not the most efficient way for a big list!
             $user = User::getKV('nickname', $nick);
-            if ($user) {
+
+            if ($user instanceof User) {
                 $ids[] = intval($user->id);
             }
         }
index e7f397747807755a169557d3ee77441da7eb3849..000a929243cf0469a436d8ce5ba3a3f76ac9834a 100755 (executable)
@@ -32,7 +32,7 @@ Generates sphinx.conf file based on StatusNet configuration.
 
 END_OF_TRIM_HELP;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 require dirname(__FILE__) . '/sphinx-utils.php';
 
 
index abac5434f7d33ba1946ba49bd075bc3a5e0b891c..79d9040e0e65bd4e3da5d554bbe4406de00bfdde 100755 (executable)
@@ -34,7 +34,7 @@ Runs Sphinx search indexer.
 
 END_OF_TRIM_HELP;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 require dirname(__FILE__) . '/sphinx-utils.php';
 
 sphinx_iterate_sites('sphinx_index_update');
index b5a49fe4fadb84846ef0968e46c01e3e60bede6e..44a1fba4576f51c896622c2898119701b665093f 100644 (file)
@@ -90,7 +90,8 @@ class MirrorSettingsAction extends SettingsAction
     function showFeedForm($mirror)
     {
         $profile = Profile::getKV('id', $mirror->subscribed);
-        if ($profile) {
+
+        if ($profile instanceof Profile) {
             $form = new EditMirrorForm($this, $profile);
             $form->show();
         }
index ef58553d2eb3f28a548d251efcfdc977ab98c490..2030d6f9e3b0f16a5e79bde97c8aa30bd5670bf4 100644 (file)
@@ -136,7 +136,8 @@ class TagSubPlugin extends Plugin
     function onStartTagShowContent(TagAction $action)
     {
         $user = common_current_user();
-        if ($user) {
+
+        if ($user instanceof User) {
             $tag = $action->trimmed('tag');
             $tagsub = TagSub::pkeyGet(array('tag' => $tag,
                                             'profile_id' => $user->id));
@@ -153,6 +154,7 @@ class TagSubPlugin extends Plugin
             $action->elementEnd('ul');
             $action->elementEnd('div');
         }
+
         return true;
     }
 
index 8b8ffbfd496bdbaaa0382f71c4bf12db2469a4a7..913cbbd4daf3c9ad08cabcbb151a6590539b613a 100755 (executable)
@@ -30,7 +30,7 @@ Batch script for synching local friends with Twitter friends.
 
 END_OF_TRIM_HELP;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 require_once dirname(__DIR__) . '/twitter.php';
 
 /**
index 8b774889d19722214cea7595862bd8e8eb48359e..e563f534934ce2a4ce09c8eeaa99079a95b53e51 100644 (file)
@@ -33,7 +33,7 @@ Daemon script for receiving new notices from Twitter users.
 
 END_OF_TWITTERDAEMON_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 class TwitterDaemon extends SpawningDaemon
 {
index 74fc77cd79a00b6a2e494c24e8cdff59a906b51f..47ba57f7ba2bd2633f3345e1a42d330b3de18a02 100755 (executable)
@@ -36,7 +36,7 @@ Batch script for retrieving Twitter messages from foreign service.
 
 END_OF_TRIM_HELP;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 require_once INSTALLDIR . '/lib/common.php';
 require_once INSTALLDIR . '/lib/daemon.php';
 require_once dirname(__DIR__) . '/twitter.php';
index e827a07117ca7b44623c0db3875c323cfc3341f3..f112f4f1907971b5bffc86c2e7b9348e57e11252 100644 (file)
@@ -42,7 +42,7 @@ data as it comes.
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('n')) {
     $nickname = get_option_value('n');
index f4a60c479d62498474f45710d7aae87535126b47..12fb2457482399bdacc8662b95d5c781f34dbd08 100644 (file)
@@ -29,7 +29,7 @@ version 0.9.5.
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 // We update any notices that may have come in from
 // Twitter that we don't have a status_id for. Note that
index 4e8340bb3f7c9a27473a22d3ccf4a67458446653..dc427a19fa1f73314676bb5dafba9812f83f8e42 100644 (file)
@@ -43,7 +43,7 @@ data as it comes.
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 require_once dirname(dirname(__FILE__)) . '/lib/jsonstreamreader.php';
 require_once dirname(dirname(__FILE__)) . '/lib/twitterstreamreader.php';
 
index 254931e5fbc0c9d0286f1f2eb18ca7474171347f..9023c3edecd6305c05e8d08b59ef758617436159 100644 (file)
@@ -67,7 +67,7 @@ class VideoThumbnailsPlugin extends Plugin
         }
 
         // Let's save our frame to a temporary file. If we fail, remove it.
-        $imgPath = tempnam(sys_get_temp_dir(), 'socialthumb');
+        $imgPath = tempnam(common_get_temp_dir(), 'socialthumb');
         if (!imagejpeg($frame->toGDImage(), $imgPath)) {
             @unlink($imgPath);
             return true;
index 6f45da6a707cbbbe8efbafad2736ed94f311c0ab..567e1951771e2a529c25d79c09574a46a13517fc 100644 (file)
@@ -178,7 +178,7 @@ class WikiHowProfilePlugin extends Plugin
 
         // @todo FIXME: This should be better encapsulated
         // ripped from OStatus via 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 {
             if (!copy($url, $temp_filename)) {
                 // TRANS: Exception thrown when fetching an avatar from a URL fails.
index 4cc5cb2d4a5d13f1d90415d3852ac38f13183370..6af0302f7749f7d3e420c4181493c27fdcac7587 100644 (file)
@@ -50,7 +50,8 @@ class YammerImporter
             return Profile::getKV('id', $profileId);
         } else {
             $user = User::getKV('nickname', $nickname);
-            if ($user) {
+
+            if ($user instanceof User) {
                 common_log(LOG_WARNING, "Copying Yammer profile info onto existing user $nickname");
                 $profile = $user->getProfile();
                 $this->savePropertiesOn($profile, $data['options'],
@@ -59,6 +60,7 @@ class YammerImporter
                 $user = User::register($data['options']);
                 $profile = $user->getProfile();
             }
+
             if ($data['avatar']) {
                 try {
                     $this->saveAvatar($data['avatar'], $profile);
@@ -159,7 +161,8 @@ class YammerImporter
             // Save "likes" as favorites...
             foreach ($data['faves'] as $nickname) {
                 $user = User::getKV('nickname', $nickname);
-                if ($user) {
+
+                if ($user instanceof User) {
                     Fave::addNew($user->getProfile(), $notice);
                 }
             }
@@ -334,7 +337,7 @@ class YammerImporter
 
                 // @fixme if we see a group link inline, don't add this?
                 $group = User_group::getKV('id', $groupId);
-                if ($group) {
+                if ($group instanceof User_group) {
                     $content .= ' !' . $group->nickname;
                 }
             }
@@ -442,7 +445,7 @@ class YammerImporter
 
         // @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 {
             if (!copy($url, $temp_filename)) {
                 // TRANS: Server exception thrown when an avatar could not be fetched.
index 211728c497fa9381bf53671738d1f2b8172768c7..59c4be2b912b93d82a87c53893f09f22946f24de 100755 (executable)
@@ -34,7 +34,7 @@ USAGE: allsites.php [OPTIONS]
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function print_all_sites() {
 
index 740ae25d446bbd0210f9af4aa6945b57a9d41fa1..409c2737e28b9120b6d1b00d115b87c9711137aa 100644 (file)
@@ -33,7 +33,7 @@ Export a StatusNet user history to a file
 
 END_OF_EXPORTACTIVITYSTREAM_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 try {
     $user = getUser();
index cec5773683ef8ef52d7c7b13ab615fe896a2163c..6a4c8c972ce6f396b072e3f97b8076c65ba93f46 100755 (executable)
@@ -32,7 +32,7 @@ Gives plugins a chance to update the database schema.
 
 END_OF_CHECKSCHEMA_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function tableDefs()
 {
index aef3f54aff50e1e305e402bee73a6ed1d9522bfd..04bf1083eef8e65b4261657bbe6b41f684c2a3f8 100755 (executable)
@@ -35,7 +35,7 @@ If the script seems to stop, it is processing correct File_thumbnail entries.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (!have_option('y', 'yes')) {
     print "About to delete locally generated thumbnails to allow regeneration. Are you sure? [y/N] ";
index a71ccb2d67834844888ded6be7c06fc1d812a58b..50edebd78ddc86352f4461bd217feb8c8ee964ff 100755 (executable)
@@ -34,7 +34,7 @@ Deletes a user's confirmed Jabber/XMPP address from the database.
 
 END_OF_DELETEUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index c67d6275d89194cbcaf1641443e695a9ce14cd03..5904681edd8a7fbea0ad96b0e76373d37f09d6c4 100644 (file)
@@ -33,7 +33,7 @@ clears the cached object based on the args
 
 END_OF_CLEARCACHE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $karg = get_option_value('k', 'key');
 
index 256743f5353bc43ff2c3a4c33957bd432d389223..5ffa5bda0de9e0611cc402d0c69da82869782828 100755 (executable)
@@ -33,7 +33,7 @@ Perform commands on behalf of a user, such as sub, unsub, join, drop
 
 END_OF_USERROLE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function interpretCommand($user, $body)
 {
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
deleted file mode 100644 (file)
index d7ee158..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/*
- * StatusNet - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// -*- mode: php -*-
-
-# Abort if called from a web server
-
-if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
-    print "This script must be run from the command line\n";
-    exit();
-}
-
-define('GNUSOCIAL', true);
-define('STATUSNET', true); //compatibility
-
-// Set various flags so we don't time out on long-running processes
-
-ini_set("max_execution_time", "0");
-ini_set("max_input_time", "0");
-set_time_limit(0);
-mb_internal_encoding('UTF-8');
-
-// Add extlib to our path so we can get Console_Getopt
-
-$_extra_path = array(INSTALLDIR.'/extlib/');
-
-set_include_path(implode(PATH_SEPARATOR, $_extra_path) . PATH_SEPARATOR . get_include_path());
-
-require_once 'Console/Getopt.php';
-
-// Note: $shortoptions and $longoptions should be pre-defined!
-
-$_default_shortoptions = 'qvhc:s:p:';
-
-$_default_longoptions = array('quiet', 'verbose', 'help', 'conf=', 'server=', 'path=');
-
-if (isset($shortoptions)) {
-    $shortoptions .= $_default_shortoptions;
-} else {
-    $shortoptions = $_default_shortoptions;
-}
-
-if (isset($longoptions)) {
-    $longoptions = array_merge($longoptions, $_default_longoptions);
-} else {
-    $longoptions = $_default_longoptions;
-}
-
-$parser = new Console_Getopt();
-
-$result = $parser->getopt($argv, $shortoptions, $longoptions);
-
-if (PEAR::isError($result)) {
-    print $result->getMessage()."\n";
-    exit(1);
-} else {
-    list($options, $args) = $result;
-}
-
-function show_help()
-{
-    global $helptext;
-
-    $_default_help_text = <<<END_OF_DEFAULT
-      General options:
-
-    -q --quiet           Quiet (little output)
-    -v --verbose         Verbose (lots of output)
-    -c --conf=<filename> Use <filename> as config file
-    -s --server=<name>   Use <name> as server name
-    -p --path=<path>     Use <path> as path name
-    -h --help            Show this message and quit.
-
-END_OF_DEFAULT;
-    if (isset($helptext)) {
-        print $helptext;
-    }
-    print $_default_help_text;
-    exit(0);
-}
-
-foreach ($options as $option) {
-
-    switch ($option[0]) {
-     case '--server':
-     case 's':
-        $server = $option[1];
-        break;
-
-     case '--path':
-     case 'p':
-        $path = $option[1];
-        break;
-
-     case '--conf':
-     case 'c':
-        $conffile = $option[1];
-        break;
-
-     case '--help':
-     case 'h':
-        show_help();
-    }
-}
-
-require_once INSTALLDIR . '/lib/common.php';
-
-set_error_handler('common_error_handler');
-
-// Set up the language infrastructure so we can localize anything that
-// needs to be sent out to users, such as mail notifications.
-common_init_language();
-
-function _make_matches($opt, $alt)
-{
-    $matches = array();
-
-    if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
-        $matches[] = '--'.$opt;
-    } else {
-        $matches[] = $opt;
-    }
-
-    if (!empty($alt)) {
-        if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
-            $matches[] = '--'.$alt;
-        } else {
-            $matches[] = $alt;
-        }
-    }
-
-    return $matches;
-}
-
-function have_option($opt, $alt=null)
-{
-    global $options;
-
-    $matches = _make_matches($opt, $alt);
-
-    foreach ($options as $option) {
-        if (in_array($option[0], $matches)) {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-function get_option_value($opt, $alt=null)
-{
-    global $options;
-
-    $matches = _make_matches($opt, $alt);
-
-    foreach ($options as $option) {
-        if (in_array($option[0], $matches)) {
-            return $option[1];
-        }
-    }
-
-    return null;
-}
-
-class NoUserArgumentException extends Exception
-{
-}
-
-function getUser()
-{
-    $user = null;
-
-    if (have_option('i', 'id')) {
-        $id = get_option_value('i', 'id');
-        $user = User::getKV('id', $id);
-        if (empty($user)) {
-            throw new Exception("Can't find user with id '$id'.");
-        }
-    } else if (have_option('n', 'nickname')) {
-        $nickname = get_option_value('n', 'nickname');
-        $user = User::getKV('nickname', $nickname);
-        if (empty($user)) {
-            throw new Exception("Can't find user with nickname '$nickname'");
-        }
-    } else {
-        throw new NoUserArgumentException("No user argument specified.");
-    }
-
-    return $user;
-}
-
-/** "Printf not quiet" */
-
-function printfnq()
-{
-    if (have_option('q', 'quiet')) {
-        return null;
-    }
-
-    $cargs  = func_num_args();
-
-    if ($cargs == 0) {
-        return 0;
-    }
-
-    $args   = func_get_args();
-    $format = array_shift($args);
-
-    return vprintf($format, $args);
-}
-
-/** "Print when verbose" */
-
-function printfv()
-{
-    if (!have_option('v', 'verbose')) {
-        return null;
-    }
-
-    $cargs  = func_num_args();
-
-    if ($cargs == 0) {
-        return 0;
-    }
-
-    $args   = func_get_args();
-    $format = array_shift($args);
-
-    return vprintf($format, $args);
-}
diff --git a/scripts/commandline.inc.php b/scripts/commandline.inc.php
new file mode 100644 (file)
index 0000000..0a5257c
--- /dev/null
@@ -0,0 +1,247 @@
+<?php
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// -*- mode: php -*-
+
+# Abort if called from a web server
+
+if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+    print "This script must be run from the command line\n";
+    exit();
+}
+
+define('GNUSOCIAL', true);
+define('STATUSNET', true); //compatibility
+
+// Set various flags so we don't time out on long-running processes
+
+ini_set("max_execution_time", "0");
+ini_set("max_input_time", "0");
+set_time_limit(0);
+mb_internal_encoding('UTF-8');
+error_reporting(0);
+
+// Add extlib to our path so we can get Console_Getopt
+
+$_extra_path = array(INSTALLDIR.'/extlib/');
+
+set_include_path(implode(PATH_SEPARATOR, $_extra_path) . PATH_SEPARATOR . get_include_path());
+
+require_once 'Console/Getopt.php';
+
+// Note: $shortoptions and $longoptions should be pre-defined!
+
+$_default_shortoptions = 'qvhc:s:p:';
+
+$_default_longoptions = array('quiet', 'verbose', 'help', 'conf=', 'server=', 'path=');
+
+if (isset($shortoptions)) {
+    $shortoptions .= $_default_shortoptions;
+} else {
+    $shortoptions = $_default_shortoptions;
+}
+
+if (isset($longoptions)) {
+    $longoptions = array_merge($longoptions, $_default_longoptions);
+} else {
+    $longoptions = $_default_longoptions;
+}
+
+$parser = new Console_Getopt();
+
+$result = $parser->getopt($argv, $shortoptions, $longoptions);
+
+if (PEAR::isError($result)) {
+    print $result->getMessage()."\n";
+    exit(1);
+} else {
+    list($options, $args) = $result;
+}
+
+function show_help()
+{
+    global $helptext;
+
+    $_default_help_text = <<<END_OF_DEFAULT
+      General options:
+
+    -q --quiet           Quiet (little output)
+    -v --verbose         Verbose (lots of output)
+    -c --conf=<filename> Use <filename> as config file
+    -s --server=<name>   Use <name> as server name
+    -p --path=<path>     Use <path> as path name
+    -h --help            Show this message and quit.
+
+END_OF_DEFAULT;
+    if (isset($helptext)) {
+        print $helptext;
+    }
+    print $_default_help_text;
+    exit(0);
+}
+
+foreach ($options as $option) {
+
+    switch ($option[0]) {
+     case '--server':
+     case 's':
+        $server = $option[1];
+        break;
+
+     case '--path':
+     case 'p':
+        $path = $option[1];
+        break;
+
+     case '--conf':
+     case 'c':
+        $conffile = $option[1];
+        break;
+
+     case '--help':
+     case 'h':
+        show_help();
+    }
+}
+
+require_once INSTALLDIR . '/lib/common.php';
+
+set_error_handler('common_error_handler');
+
+// Set up the language infrastructure so we can localize anything that
+// needs to be sent out to users, such as mail notifications.
+common_init_language();
+
+function _make_matches($opt, $alt)
+{
+    $matches = array();
+
+    if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) {
+        $matches[] = '--'.$opt;
+    } else {
+        $matches[] = $opt;
+    }
+
+    if (!empty($alt)) {
+        if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) {
+            $matches[] = '--'.$alt;
+        } else {
+            $matches[] = $alt;
+        }
+    }
+
+    return $matches;
+}
+
+function have_option($opt, $alt=null)
+{
+    global $options;
+
+    $matches = _make_matches($opt, $alt);
+
+    foreach ($options as $option) {
+        if (in_array($option[0], $matches)) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+function get_option_value($opt, $alt=null)
+{
+    global $options;
+
+    $matches = _make_matches($opt, $alt);
+
+    foreach ($options as $option) {
+        if (in_array($option[0], $matches)) {
+            return $option[1];
+        }
+    }
+
+    return null;
+}
+
+class NoUserArgumentException extends Exception
+{
+}
+
+function getUser()
+{
+    $user = null;
+
+    if (have_option('i', 'id')) {
+        $id = get_option_value('i', 'id');
+        $user = User::getKV('id', $id);
+        if (empty($user)) {
+            throw new Exception("Can't find user with id '$id'.");
+        }
+    } else if (have_option('n', 'nickname')) {
+        $nickname = get_option_value('n', 'nickname');
+        $user = User::getKV('nickname', $nickname);
+        if (empty($user)) {
+            throw new Exception("Can't find user with nickname '$nickname'");
+        }
+    } else {
+        throw new NoUserArgumentException("No user argument specified.");
+    }
+
+    return $user;
+}
+
+/** "Printf not quiet" */
+
+function printfnq()
+{
+    if (have_option('q', 'quiet')) {
+        return null;
+    }
+
+    $cargs  = func_num_args();
+
+    if ($cargs == 0) {
+        return 0;
+    }
+
+    $args   = func_get_args();
+    $format = array_shift($args);
+
+    return vprintf($format, $args);
+}
+
+/** "Print when verbose" */
+
+function printfv()
+{
+    if (!have_option('v', 'verbose')) {
+        return null;
+    }
+
+    $cargs  = func_num_args();
+
+    if ($cargs == 0) {
+        return 0;
+    }
+
+    $args   = func_get_args();
+    $format = array_shift($args);
+
+    return vprintf($format, $args);
+}
index c260ffaa0037cb41dc5942deae59589f5c8526b3..44f3934a1fcff1a8f20b8808230a6642595d4205 100755 (executable)
@@ -27,7 +27,7 @@ console.php - provide an interactive PHP interpreter for testing
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 // Assume we're on a terminal if on Windows, otherwise posix_isatty tells us.
 define('CONSOLE_INTERACTIVE', !function_exists('posix_isatty') || posix_isatty(0));
index 624043161da9f19fe0e3512e760e0f770e3f2ca4..a4b7667310da8e6520b055bf533d2bffa39aba3f 100644 (file)
@@ -49,7 +49,7 @@ Creates a lot of test users and notices to (loosely) simulate a real server.
 
 END_OF_CREATESIM_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 // XXX: make these command-line options
 
index f76a3dedc780e2207a3446c226fd535027450adb..fc00e70b083b91f9d9d721c17bffc78e7044f116 100755 (executable)
@@ -33,7 +33,7 @@ deletes a group from the database
 
 END_OF_DELETEGROUP_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index 25af1c5ce24a294b8f5d74810106f92690336ae7..e815ea208d7bc429e52a65e98028f7ea14291ff2 100755 (executable)
@@ -33,7 +33,7 @@ deletes a user from the database
 
 END_OF_DELETEUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index 6341b72706cc0b5e1878c8ce59265334d18029b5..9ca4d9dad5271640ca3a9b3975823451d72bc1d0 100755 (executable)
@@ -95,7 +95,7 @@ var_dump($replacements);
 $template = file_get_contents(dirname(__FILE__) . '/doxygen.tmpl');
 $template = strtr($template, $replacements);
 
-$templateFile = tempnam(sys_get_temp_dir(), 'statusnet-doxygen');
+$templateFile = tempnam(common_get_temp_dir(), 'statusnet-doxygen');
 file_put_contents($templateFile, $template);
 
 $cmd = "doxygen " . escapeshellarg($templateFile);
index 9c5e3cf8b38c2fd9808803ba9c2c8437fcddfb89..05638cda4cb22aed28c57fe79916a8c1b1814a49 100644 (file)
@@ -34,7 +34,7 @@ Attempt to pull a schema definition for a given table.
 END_OF_CHECKSCHEMA_HELP;
 
 $longoptions = array('diff', 'all', 'create', 'update', 'raw', 'checksum');
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function indentOptions($indent)
 {
@@ -250,4 +250,4 @@ if (count($args)) {
     }
 } else {
     show_help($helptext);
-}
\ No newline at end of file
+}
index 07ada7f9d95c49089192243f430bcd7f6c39ebb4..c029b1e7d4a31359802e8459eb785b58f805e538 100755 (executable)
@@ -33,7 +33,7 @@ Stray incompletely deleted items cause various fun problems!
 
 END_OF_USERROLE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 /**
  * Find the highest profile_id currently listed in the notice table;
index 51178a725c6d5acfb369cfcbebcb81387c897b75..a9952b4304fc2d4f01dd5cd03a25eff1b9d70205 100644 (file)
@@ -26,9 +26,9 @@ Flush the url router from cache.
 
 END_OF_FLUSHROUTER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $cache = Cache::instance();
 $cache->delete(Router::cacheKey());
 
-print "OK.\n";
\ No newline at end of file
+print "OK.\n";
index b7f385ac45f8652990f2849904845726814c470e..3950fb7cf71830b4b51b316bbf4606db130f8fca 100644 (file)
@@ -29,7 +29,7 @@ Flush the site with the given name from memcached.
 
 END_OF_FLUSHSITE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $nickname = common_config('site', 'nickname');
 
@@ -42,4 +42,4 @@ if (empty($sn)) {
 
 print "Flushing cache for {$nickname}...";
 $sn->decache();
-print "OK.\n";
\ No newline at end of file
+print "OK.\n";
index 8274c37c0f89c01e4ce485bc8f04dec7e9bdbbcc..00e845f80db821a8ccd1a2008b2ff3a078cf4968 100755 (executable)
@@ -25,6 +25,6 @@ getpiddir.php - print out the currently configured PID directory
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 echo common_config('daemon', 'piddir');
index 448fbb6d32cceb9282804fa6a162a66893a23aa2..f7aa0f60f88088cf06857042cf424b3650263ccc 100755 (executable)
@@ -36,7 +36,7 @@ ENDOFHELP;
 // No unnecessary error reporting to avoid invalid daemon names
 error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $daemons = array();
 
index dbe9c54c5ba9d838787dc2affbc3afe0265585f2..91c2dc7f646ec759ddac1bff7008876fbccee86c 100644 (file)
@@ -28,6 +28,6 @@ prints out the current version of the software
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 print GNUSOCIAL_VERSION."\n";
index eb7d8297136cdb3dd461752d0ca8bc65439120c1..3b272868c0023753e45ed37b9e2b885db4b79dba 100755 (executable)
@@ -28,7 +28,7 @@ as if it were being run through the queue.
 
 END_OF_QUEUE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (count($args) != 2) {
     show_help();
index 0298c00522b52b9d3d2d0dd3c4324a1fb7ae13bf..7d9ff1fe7dc7d1d65d0007c14e76219e713e196d 100755 (executable)
@@ -33,7 +33,7 @@ Daemon script for receiving new notices from IM users.
 
 END_OF_IM_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 class ImDaemon extends SpawningDaemon
 {
index a29526f27e1726f57f3679dcdab034fbf4350614..d121179f47a9e45e0fa1777d0d9f9c29c419b499 100644 (file)
@@ -33,7 +33,7 @@ import an Atom feed from Twitter as notices by a user
 
 END_OF_IMPORTTWITTERATOM_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
 
 function getAtomFeedDocument()
index bd73cbe79460b2c6788147237a7945367f4ebc98..df9aad10edd234c36991d48509b31bacbe32fc11 100644 (file)
@@ -34,7 +34,7 @@ Adds a local user to a local group.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 try {
     $user = getUser();
index 8f9ef33e7edb2d33b2615d0023506e8479f489f5..fd1362ef5ea6672e45bef57d4d2b85003f172bc9 100644 (file)
@@ -34,7 +34,7 @@ Removes a local user from a local group.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 try {
     $user = getUser();
index 3b1ef96a1e898617e86d56870f5c328106239bcc..5e9b6d22324b8b9844c843b431d3303b7b8b7046 100755 (executable)
@@ -26,7 +26,7 @@ as STDIN.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 require_once INSTALLDIR.'/lib/mailhandler.php';
 
 if (common_config('emailpost', 'enabled')) {
index 157cae067db619a491c0ed9d8a07a8f8ae97f1a5..a3d9c70eb061bdb435826dfc78bead11b27e92b3 100644 (file)
@@ -22,7 +22,7 @@
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $base = INSTALLDIR;
 $encBase = escapeshellarg($base);
index 345d93c665745896d99c81e5d1623b56a2c3700f..3d3b1d3e841accdfaddcbe98d3af8d091ed8a787 100644 (file)
@@ -32,7 +32,7 @@ makes a user the admin of a group
 
 END_OF_MAKEGROUPADMIN_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $nickname = get_option_value('n', 'nickname');
 $groupname = get_option_value('g', 'group');
index 17b3e0fb678e5e06c207f95476d0929e3d169bd6..ff08ee24ce3ac60e8e03b03e7f3b2c543f394495 100644 (file)
@@ -37,7 +37,7 @@ an HTTP or HTTPS URL (http://example.com/social/site/user/nickname).
 
 END_OF_MOVEUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 try {
 
index 1c9ea3353697b6f7d6e883efe100cceee94545d6..7524dabb15cfdf0cf2491e738cfccb62b54aa708 100755 (executable)
@@ -45,7 +45,7 @@ Global events:
 
 END_OF_QUEUECTL_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function doSendControl($message, $event, $param='')
 {
index 582a3dd888f825ed0ff398a77629fffab9bf9628..bdd630f3d5a2e6ef54c8ff3982a5fe7d8a27977b 100755 (executable)
@@ -68,7 +68,7 @@ Daemon script for running queued items.
 
 END_OF_QUEUE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 require_once(INSTALLDIR.'/lib/daemon.php');
 require_once(INSTALLDIR.'/classes/Queue_item.php');
index d2a47b6be9737b27f3cc30603aefd496cdbb9344..e212049bec8152b60d8216416105924b2d53b59c 100644 (file)
@@ -34,7 +34,7 @@ registers a user in the database
 
 END_OF_REGISTERUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $nickname = get_option_value('n', 'nickname');
 $password = get_option_value('w', 'password');
index 17f007b41206406c36d13e6711f7bda7d8535d71..c749b41a1253c4f51abe36e31be93a005bd88615 100644 (file)
@@ -33,7 +33,7 @@ neither ID or name provided, will create a new user.
 
 END_OF_RESTOREUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
 
 
index 0441bfe7ee9abef0ebc417ca31d2e4cb8bf9a8b9..9b89cbce7eccedaef96937a6536f4d29a2c852f9 100755 (executable)
@@ -33,7 +33,7 @@ Sends given email text to user.
 
 END_OF_USEREMAIL_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index af55ddf3f0d971d9c8af92636104c9527ecf4cb9..ef452fdb064f61847689f811368abcfb4d4fba47 100644 (file)
@@ -27,7 +27,7 @@ Delete old sessions from the server
 
 END_OF_GC_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $maxlifetime = ini_get('session.gc_maxlifetime');
 
index 009c50dbf291061c4513c918341067780510fcd3..dc6843b92d3e16e56c2b46079061260f59a9aa35 100755 (executable)
@@ -39,7 +39,7 @@ With no args, lists all currently set values.
 
 END_OF_SETCONFIG_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (empty($args)) {
     if (have_option('a', 'all')) {
index 3e9f5c17ca3e9ab8473dd8e849e7282eb703ec54..ef439488b273975f5474df15bf7744780af45ff0 100755 (executable)
@@ -27,7 +27,7 @@ Sets the password of user with name <username> to <password>
 
 END_OF_PASSWORD_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (count($args) < 2) {
     show_help();
index 19abce43c8018a5d1de97ca83e5740f730c2c294..3c234f2c31cdc430321c17d4abd082c94476a00c 100644 (file)
@@ -31,7 +31,7 @@ With -d, delete the tag.
 
 END_OF_SETTAG_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (count($args) < 1) {
     show_help();
index 8ef08467d6be139dd2a50ee11670962cbeb30cf7..b4fe7b63ce9601b8c9d67648597a6bec63e1ce99 100644 (file)
@@ -33,7 +33,7 @@ shows the cached object based on the args
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $karg = get_option_value('k');
 
index e79b4e72242888f4661eedba444473e27caf6101..8b950eb0aa8e2d02e28da63f42ae4cbe9f35b3db 100755 (executable)
@@ -20,7 +20,7 @@
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 foreach (StatusNet::getActivePlugins() as $plugin=>$args) {
     echo "$plugin: ";
index eb18a98e20d510cb3dfd2d8feee39abbd341dfd7..986260e1d23bdf8d16ac5ad2b425fae4217325a2 100644 (file)
@@ -26,7 +26,7 @@ Shows the structure of a table
 
 END_OF_SHOWTABLE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (count($args) != 1) {
     show_help();
index 2ed3528c5e0d5b28338df53bb43a14d6a6d292f8..c4d86053e92b09d92d26265b292a29d6074ff6fc 100755 (executable)
@@ -35,7 +35,7 @@ if [ $# -gt 1 ]; then
 fi
 
 DIR=`dirname $0`
-DAEMONS=`php $DIR/getvaliddaemons.php $ARGSG`
+DAEMONS=`$DIR/getvaliddaemons.php $ARGSG`
 
 for f in $DAEMONS; do
 
index 35841b64a85008e8dc509220b3bcbc487fcd271f..b4a3725d8dcfba215f1785c87e001b0b82879309 100755 (executable)
@@ -31,9 +31,9 @@ if [ $# -gt 0 ] ; then
 fi
 
 SDIR=`dirname $0`
-DIR=`php $SDIR/getpiddir.php $SITE`
+DIR=`$SDIR/getpiddir.php $SITE`
 
-DAEMONS=`php $SDIR/getvaliddaemons.php`
+DAEMONS=`$SDIR/getvaliddaemons.php`
 
 for f in $DAEMONS; do
     f=$(basename $f .php)
index 021b66885190dacbf944759738895272855256cc..165736816d8396c8d4d96bfb6cad1709d6a0cc63 100755 (executable)
@@ -36,7 +36,7 @@ Removes geolocation info from the given user's notices.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index b5955fd5aa9335a0ae259cdfb7baa24c3ea228bc..6cd2101ad7a4561378cf498456e99f569d3f25f3 100644 (file)
@@ -26,7 +26,7 @@ Uncache users listed in an ID file, default 'ids.txt'.
 
 ENDOFHELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $id_file = (count($args) > 1) ? $args[0] : 'ids.txt';
 
index abf9627cc71e6daffc61c3b26802b7a435bece14..c8024cb769a86fb6d868e52c483b6ef9b9084063 100644 (file)
@@ -34,7 +34,7 @@ set the location for a profile
 
 END_OF_UPDATELOCATION_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 try {
     $user = null;
index 35b835e4944ac435ac24cf6dd43d5090efaa4932..c49187c299407c194b27cb669f75ac3d395b3206 100644 (file)
@@ -29,7 +29,7 @@ update stored URLs in the system
 
 END_OF_UPDATEURLS_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function main()
 {
index c221a495af1cc04489643ce24bb3ce8a10bc1cd8..ec859e8f43e4c4eb033e305763ebff3c181e7b8b 100644 (file)
@@ -29,7 +29,7 @@ Upgrade database schema and data to latest software
 
 END_OF_UPGRADE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 function main()
 {
index 02c34678fb31eb1077a974a997f97c39c6e7ed56..91a9d3152bb7b72eb9abec81f43d730062b96a1b 100755 (executable)
@@ -33,7 +33,7 @@ Queries a user's registered email address, or queries the users with a given reg
 
 END_OF_USEREMAIL_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index d1061b18322417a6afb9c18e634dd5c6c467a78e..a5eddeae5fc3dd5a1525ff6d12bdd2d1b4863b6e 100644 (file)
@@ -34,7 +34,7 @@ modifies a role for the given user
 
 END_OF_USERROLE_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
index bd9124a91d38b1dd0cc6dcb793a9b7c12ff4d7d3..031be0cc4403919b92f225a41c222f6e5344860a 100644 (file)
@@ -18,13 +18,16 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
     function setUp()
     {
         $user = User::getKV('nickname', 'userrightstestuser');
-        if ($user) {
+
+        if ($user instanceof User) {
             // Leftover from a broken test run?
             $profile = $user->getProfile();
             $user->delete();
             $profile->delete();
         }
+
         $this->user = User::register(array('nickname' => 'userrightstestuser'));
+
         if (!$this->user) {
             throw new Exception("Couldn't register userrightstestuser");
         }
index fb675c778e3c33754f7da53da80dd9c92806b973..4259c0cdc701dde222477542b0e59448e3395142 100644 (file)
@@ -37,7 +37,7 @@ Options:
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $user = get_option_value('n', 'nickname');
 $pass = get_option_value('p', 'password');
index bea512a9149c227154f4a54a7d23db2da6661673..3d8767a6e1227aeaab7adb7a7e079a64dc82da61 100755 (executable)
@@ -20,7 +20,7 @@
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 require_once INSTALLDIR . '/extlib/OAuth.php';
 
 $ini = parse_ini_file("oauth.ini");
index a508c7240c2c1a786c625fdd02340c1a63c722ec..aac242d0df1ee52c9b93a40ce74e327cda6a2db6 100755 (executable)
@@ -52,7 +52,7 @@ $helptext = <<<END_OF_ETOKENS_HELP
 
 END_OF_ETOKENS_HELP;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 
 $token = $secret = $verifier = null;
 
index 23fc04b531567aedffc836627fc316eb7b563d88..6742ab1580b1dddd3c35772d70d878d6e2356bd8 100644 (file)
@@ -40,7 +40,7 @@ $token        = null;
 $token_secret = null;
 $update       = null;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 
 if (have_option('t', 'oauth_token')) {
     $token = get_option_value('t', 'oauth_token');
index a37538d87e4e03ef5ec022bd394127126753ab0e..c20c7eef03e4fc52c46cb2b5bb744e665ec24b67 100755 (executable)
@@ -37,7 +37,7 @@ END_OF_VERIFY_HELP;
 $token        = null;
 $token_secret = null;
 
-require_once INSTALLDIR . '/scripts/commandline.inc';
+require_once INSTALLDIR . '/scripts/commandline.inc.php';
 
 if (have_option('t', 'oauth_token')) {
     $token = get_option_value('t', 'oauth_token');