]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
smaller packet
authorEvan Prodromou <evan@prodromou.name>
Sun, 18 May 2008 01:55:51 +0000 (21:55 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sun, 18 May 2008 01:55:51 +0000 (21:55 -0400)
darcs-hash:20080518015551-84dde-65964e140ed0b6c23aeee368fcffccdc14d71c61.gz

actions/all.php
actions/profilesettings.php
actions/subscribed.php
lib/common.php

index 949c7227502d62bf394bd008a004dbea15ba4a69..92ae385ca76df611b56aa7a9130e2bc4fb3dbdea 100644 (file)
@@ -31,7 +31,7 @@ class AllAction extends ShowstreamAction {
                
                # XXX: chokety and bad
 
-               $notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$profile->id.')', 'OR');
+               $notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$profile->id.' and subscribed = notice.profile_id)', 'OR');
                $notice->whereAdd('profile_id = ' . $profile->id, 'OR');
                
                $notice->orderBy('created DESC');
index fff6e3bd9a078d8e1c46a51f976d9bacc116d83e..f1f4844d1946d8f6d2c95286a7d5404f5233f117 100644 (file)
@@ -24,6 +24,8 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
 class ProfilesettingsAction extends SettingsAction {
        
        function show_form($msg=NULL, $success=false) {
+               $user = common_current_user();
+               $profile = $user->getProfile();
                common_show_header(_t('Profile settings'));
                $this->settings_menu();
                $this->message($msg, $success);
@@ -31,20 +33,23 @@ class ProfilesettingsAction extends SettingsAction {
                                                                                   'id' => 'profilesettings',
                                                                                   'action' => 
                                                                                   common_local_url('profilesettings')));
-               common_input('nickname', _t('Nickname'));
-               common_input('fullname', _t('Full name'));
-               common_input('email', _t('Email address'));             
-               common_input('homepage', _t('Homepage'));                               
-               common_input('bio', _t('Bio'));
-               common_input('location', _t('Location'));
+               # too much common patterns here... abstractable?
+               common_input('nickname', _t('Nickname'), 
+                                        ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname);
+               common_input('fullname', _t('Full name'),
+                                        ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
+               common_input('email', _t('Email address'),
+                                        ($this->arg('email')) ? $this->arg('email') : $user->email);
+               common_input('homepage', _t('Homepage'),
+                                        ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage);                               
+               common_input('bio', _t('Bio'),
+                                        ($this->arg('bio')) ? $this->arg('bio') : $profile->bio);
+               common_input('location', _t('Location'),
+                                        ($this->arg('location')) ? $this->arg('location') : $profile->location);
                common_element('input', array('name' => 'submit',
                                                                          'type' => 'submit',
-                                                                         'id' => 'submit'),
-                                          _t('Login'));
-               common_element('input', array('name' => 'cancel',
-                                                                         'type' => 'button',
-                                                                         'id' => 'cancel'),
-                                          _t('Cancel'));
+                                                                         'id' => 'submit',
+                                                                         'value' => _t('Save')));
                common_element_end('form');
                common_show_footer();
        }
index 8e0b2bc6b191c1e0a3ff98fadcd586806315ab2d..158e34f9d08cadd9c556823ed250b0677bf805a6 100644 (file)
@@ -41,12 +41,12 @@ class SubscribedAction extends Action {
 
        function show_subscribed($profile, $page) {
 
-               $sub = DB_DataObject::factory('subscriptions');
-               $sub->subscribed = $profile->id;
+               $subs = DB_DataObject::factory('subscription');
+               $subs->subscribed = $profile->id;
                
                # We ask for an extra one to know if we need to do another page
                
-               $sub->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
+               $subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1);
 
                $subs_count = $subs->find();
                
index e8a7ac6aed2d6b772fb6047bc241c4f4b9a796a5..03096260bc353f72ffb09229d98f156b93646025 100644 (file)
@@ -168,11 +168,15 @@ function common_menu_item($url, $text, $title=NULL) {
        common_element_end('li');
 }
 
-function common_input($id, $label) {
+function common_input($id, $label, $value=NULL) {
        common_element('label', array('for' => $id), $label);
-       common_element('input', array('name' => $id,
-                                                                 'type' => 'text',
-                                                                 'id' => $id));
+       $attrs = array('name' => $id,
+                                  'type' => 'text',
+                                  'id' => $id);
+       if ($value) {
+               $attrs['value'] = htmlspecialchars($value);
+       }
+       common_element('input', $attrs);
 }
 
 # salted, hashed passwords are stored in the DB