From 3a59199040a4360b279c6c51700b74a643bbaf51 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 19:38:04 +0800 Subject: [PATCH 1/6] Fix "Undefined property: DisfavorAction::$id" --- actions/disfavor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/disfavor.php b/actions/disfavor.php index bc13b09da5..4064a0d988 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -75,7 +75,7 @@ class DisfavorAction extends Action return; } $fave = new Fave(); - $fave->user_id = $this->id; + $fave->user_id = $user->id; $fave->notice_id = $notice->id; if (!$fave->find(true)) { $this->clientError(_('This notice is not a favorite!')); From 216ada5cc4cc73eb8c9d22e9ad19cec0d07ff9ea Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 19:48:26 +0800 Subject: [PATCH 2/6] Fix "Trying to get property of non-object" errors in groupeditform.php --- lib/groupeditform.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/groupeditform.php b/lib/groupeditform.php index ca674f3c8e..3014dd1c56 100644 --- a/lib/groupeditform.php +++ b/lib/groupeditform.php @@ -131,30 +131,46 @@ class GroupEditForm extends Form function formData() { + if ($this->group) { + $id = $this->group->id; + $nickname = $this->group->nickname; + $fullname = $this->group->fullname; + $homepage = $this->group->homepage; + $description = $this->group->description; + $location = $this->group->location; + } else { + $id = ''; + $nickname = ''; + $fullname = ''; + $homepage = ''; + $description = ''; + $location = ''; + } + $this->out->elementStart('ul', 'form_data'); $this->out->elementStart('li'); - $this->out->hidden('groupid', $this->group->id); + $this->out->hidden('groupid', $id); $this->out->input('nickname', _('Nickname'), - ($this->out->arg('nickname')) ? $this->out->arg('nickname') : $this->group->nickname, + ($this->out->arg('nickname')) ? $this->out->arg('nickname') : $nickname, _('1-64 lowercase letters or numbers, no punctuation or spaces')); $this->out->elementEnd('li'); $this->out->elementStart('li'); $this->out->input('fullname', _('Full name'), - ($this->out->arg('fullname')) ? $this->out->arg('fullname') : $this->group->fullname); + ($this->out->arg('fullname')) ? $this->out->arg('fullname') : $fullname); $this->out->elementEnd('li'); $this->out->elementStart('li'); $this->out->input('homepage', _('Homepage'), - ($this->out->arg('homepage')) ? $this->out->arg('homepage') : $this->group->homepage, + ($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage, _('URL of the homepage or blog of the group or topic')); $this->out->elementEnd('li'); $this->out->elementStart('li'); $this->out->textarea('description', _('Description'), - ($this->out->arg('description')) ? $this->out->arg('description') : $this->group->description, + ($this->out->arg('description')) ? $this->out->arg('description') : $description, _('Describe the group or topic in 140 chars')); $this->out->elementEnd('li'); $this->out->elementStart('li'); $this->out->input('location', _('Location'), - ($this->out->arg('location')) ? $this->out->arg('location') : $this->group->location, + ($this->out->arg('location')) ? $this->out->arg('location') : $location, _('Location for the group, if any, like "City, State (or Region), Country"')); $this->out->elementEnd('li'); $this->out->elementEnd('ul'); From 1b76df4b6aa4d5f092fa4f7188a9e853443452e1 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 19:49:33 +0800 Subject: [PATCH 3/6] Fix "Undefined variable: cnt" --- actions/groups.php | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/groups.php b/actions/groups.php index 26b52a5fcd..1cf3599593 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -113,6 +113,7 @@ class GroupsAction extends Action $groups->orderBy('created DESC'); $groups->limit($offset, $limit); + $cnt = 0; if ($groups->find()) { $gl = new GroupList($groups, null, $this); $cnt = $gl->show(); From cfea2b0c4e21bc61ec250c8f34ec8c9aa6536e83 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 19:55:41 +0800 Subject: [PATCH 4/6] Fix "Trying to get property of non-object" errors when accessing the people search results page --- lib/peoplesearchresults.php | 2 +- lib/profilelist.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/peoplesearchresults.php b/lib/peoplesearchresults.php index d3f8408525..9cd162baa0 100644 --- a/lib/peoplesearchresults.php +++ b/lib/peoplesearchresults.php @@ -56,7 +56,7 @@ class PeopleSearchResults extends ProfileList function __construct($profile, $terms, $action) { - parent::__construct($profile, $terms, $action); + parent::__construct($profile, null, $action); $this->terms = array_map('preg_quote', array_map('htmlspecialchars', $terms)); $this->pattern = '/('.implode('|',$terms).')/i'; diff --git a/lib/profilelist.php b/lib/profilelist.php index a4cc235552..c22da00cb2 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -208,7 +208,7 @@ class ProfileList extends Widget } $this->out->elementEnd('li'); $this->out->elementStart('li', 'entity_block'); - if ($user->id == $this->owner->id) { + if ($this->owner && $user->id == $this->owner->id) { $this->showBlockForm(); } $this->out->elementEnd('li'); From e2b20bd1e6087594b6069117ccb675f751ddc17a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 19:58:30 +0800 Subject: [PATCH 5/6] Fix "Trying to get property of non-object" errors when a user tries to log in using an unknown nickname --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index b3a94a5a01..32e178b3ee 100644 --- a/lib/util.php +++ b/lib/util.php @@ -114,7 +114,7 @@ function common_check_user($nickname, $password) return false; } $user = User::staticGet('nickname', $nickname); - if (is_null($user)) { + if (is_null($user) || $user === false) { return false; } else { if (0 == strcmp(common_munge_password($password, $user->id), From 53f31a247e4355318e8a997451930a1b1772099c Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 12 Jun 2009 20:03:18 +0800 Subject: [PATCH 6/6] Fix missing max_id in API search calls --- actions/twitapisearchatom.php | 1 + lib/jsonsearchresultslist.php | 1 + 2 files changed, 2 insertions(+) diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index eb9ab5d8e9..c223a7e27c 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -169,6 +169,7 @@ class TwitapisearchatomAction extends TwitterapiAction $this->cnt = $notice->find(); $cnt = 0; + $this->max_id = 0; while ($notice->fetch()) { diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php index f786c20a80..7beea9328d 100644 --- a/lib/jsonsearchresultslist.php +++ b/lib/jsonsearchresultslist.php @@ -89,6 +89,7 @@ class JSONSearchResultsList function show() { $cnt = 0; + $this->max_id = 0; $time_start = microtime(true);