]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' into 0.9.x
authorBrion Vibber <brion@pobox.com>
Fri, 21 May 2010 20:15:08 +0000 (13:15 -0700)
committerBrion Vibber <brion@pobox.com>
Fri, 21 May 2010 20:15:08 +0000 (13:15 -0700)
1  2 
actions/block.php
actions/deleteuser.php
actions/groupblock.php
lib/util.php

diff --combined actions/block.php
index 11565e20c528d63a4d6920b25180d9ed63a77d9b,239a50868d3913614b4fbc16b497bad3624fb3b6..93f8ec93709867794770f734db283d641a4c669f
@@@ -87,13 -87,15 +87,15 @@@ class BlockAction extends ProfileFormAc
      {
          if ($_SERVER['REQUEST_METHOD'] == 'POST') {
              if ($this->arg('no')) {
-                 $this->returnToArgs();
+                 $this->returnToPrevious();
              } elseif ($this->arg('yes')) {
                  $this->handlePost();
-                 $this->returnToArgs();
+                 $this->returnToPrevious();
              } else {
                  $this->showPage();
              }
+         } else {
+             $this->showPage();
          }
      }
  
       */
      function areYouSureForm()
      {
+         // @fixme if we ajaxify the confirmation form, skip the preview on ajax hits
+         $profile = new ArrayWrapper(array($this->profile));
+         $preview = new ProfileList($profile, $this);
+         $preview->show();
          $id = $this->profile->id;
          $this->elementStart('form', array('id' => 'block-' . $id,
                                             'method' => 'post',
                  $this->hidden($k, $v);
              }
          }
 -        $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user"));
 -        $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Block this user'));
 +        $this->submit('form_action-no',
 +                      // TRANS: Button label on the user block form.
 +                      _m('BUTTON','No'),
 +                      'submit form_action-primary',
 +                      'no',
 +                      // TRANS: Submit button title for 'No' when blocking a user.
 +                      _('Do not block this user'));
 +        $this->submit('form_action-yes',
 +                      // TRANS: Button label on the user block form.
 +                      _m('BUTTON','Yes'),
 +                      'submit form_action-secondary',
 +                      'yes',
 +                      // TRANS: Submit button title for 'Yes' when blocking a user.
 +                      _('Block this user'));
          $this->elementEnd('fieldset');
          $this->elementEnd('form');
      }
          $this->autofocus('form_action-yes');
      }
  
+     /**
+      * Override for form session token checks; on our first hit we're just
+      * requesting confirmation, which doesn't need a token. We need to be
+      * able to take regular GET requests from email!
+      * 
+      * @throws ClientException if token is bad on POST request or if we have
+      *         confirmation parameters which could trigger something.
+      */
+     function checkSessionToken()
+     {
+         if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
+             $this->arg('yes') ||
+             $this->arg('no')) {
+             return parent::checkSessionToken();
+         }
+     }
+     /**
+      * If we reached this form without returnto arguments, return to the
+      * current user's subscription list.
+      * 
+      * @return string URL
+      */
+     function defaultReturnTo()
+     {
+         $user = common_current_user();
+         if ($user) {
+             return common_local_url('subscribers',
+                                     array('nickname' => $user->nickname));
+         } else {
+             return common_local_url('public');
+         }
+     }
  }
diff --combined actions/deleteuser.php
index 1c1f19b0e60eb05a8ce7c576928dce2338a418e9,c0a8b20e2c535defab0941e6941ca881650c0d0f..02ded68b3181223d9474b5675f5b6b956867ff8e
@@@ -92,10 -92,10 +92,10 @@@ class DeleteuserAction extends ProfileF
      {
          if ($_SERVER['REQUEST_METHOD'] == 'POST') {
              if ($this->arg('no')) {
-                 $this->returnToArgs();
+                 $this->returnToPrevious();
              } elseif ($this->arg('yes')) {
                  $this->handlePost();
-                 $this->returnToArgs();
+                 $this->returnToPrevious();
              } else {
                  $this->showPage();
              }
              }
              Event::handle('EndDeleteUserForm', array($this, $this->user));
          }
 -        $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user"));
 -        $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this user'));
 +        $this->submit('form_action-no',
 +                      // TRANS: Button label on the delete user form.
 +                      _m('BUTTON','No'),
 +                      'submit form_action-primary',
 +                      'no',
 +                      // TRANS: Submit button title for 'No' when deleting a user.
 +                      _('Do not block this user'));
 +        $this->submit('form_action-yes',
 +                      // TRANS: Button label on the delete user form.
 +                      _m('BUTTON','Yes'),
 +                      'submit form_action-secondary',
 +                      'yes',
 +                      // TRANS: Submit button title for 'Yes' when deleting a user.
 +                      _('Delete this user'));
          $this->elementEnd('fieldset');
          $this->elementEnd('form');
      }
diff --combined actions/groupblock.php
index e52db6e111dc5fff6c2a84257fc3175a30d95ea1,2e06dc32496707eb1f3c819275ab45b4259503c0..39f783397ad08e18e47448f5b490ea35dec66250
@@@ -117,7 -117,7 +117,7 @@@ class GroupblockAction extends Redirect
          parent::handle($args);
          if ($_SERVER['REQUEST_METHOD'] == 'POST') {
              if ($this->arg('no')) {
-                 $this->returnToArgs();
+                 $this->returnToPrevious();
              } elseif ($this->arg('yes')) {
                  $this->blockProfile();
              } elseif ($this->arg('blockto')) {
                  $this->hidden($k, $v);
              }
          }
 -        $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user from this group"));
 -        $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Block this user from this group'));
 +        $this->submit('form_action-no',
 +                      // TRANS: Button label on the form to block a user from a group.
 +                      _m('BUTTON','No'),
 +                      'submit form_action-primary',
 +                      'no',
 +                      // TRANS: Submit button title for 'No' when blocking a user from a group.
 +                      _('Do not block this user from this group'));
 +        $this->submit('form_action-yes',
 +                      // TRANS: Button label on the form to block a user from a group.
 +                      _m('BUTTON','Yes'),
 +                      'submit form_action-secondary',
 +                      'yes',
 +                      // TRANS: Submit button title for 'Yes' when blocking a user from a group.
 +                      _('Block this user from this group'));
          $this->elementEnd('fieldset');
          $this->elementEnd('form');
      }
              return false;
          }
          
-         $this->returnToArgs();
+         $this->returnToPrevious();
      }
  
      /**
diff --combined lib/util.php
index 1e58f960cf3afc31e263add68a640cc579243199,59d5132ec60d86873e8d80274a42f5e8b5563570..524ce0071d89ef3754529e4069f2dc4894602746
@@@ -849,7 -849,7 +849,7 @@@ function common_linkify($url) 
      }
  
      if (!empty($f)) {
 -        if ($f->getEnclosure()) {
 +        if ($f->getEnclosure() || File_oembed::staticGet('file_id',$f->id)) {
              $is_attachment = true;
              $attachment_id = $f->id;
  
      return XMLStringer::estring('a', $attrs, $url);
  }
  
 -function common_shorten_links($text)
 +function common_shorten_links($text, $always = false)
  {
      $maxLength = Notice::maxContent();
 -    if ($maxLength == 0 || mb_strlen($text) <= $maxLength) return $text;
 +    if (!$always && ($maxLength == 0 || mb_strlen($text) <= $maxLength)) return $text;
      return common_replace_urls_callback($text, array('File_redirection', 'makeShort'));
  }
  
@@@ -1096,38 -1096,24 +1096,38 @@@ function common_date_string($dt
      if ($now < $t) { // that shouldn't happen!
          return common_exact_date($dt);
      } else if ($diff < 60) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('a few seconds ago');
      } else if ($diff < 92) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('about a minute ago');
      } else if ($diff < 3300) {
 +        // XXX: should support plural.
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return sprintf(_('about %d minutes ago'), round($diff/60));
      } else if ($diff < 5400) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('about an hour ago');
      } else if ($diff < 22 * 3600) {
 +        // XXX: should support plural.
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return sprintf(_('about %d hours ago'), round($diff/3600));
      } else if ($diff < 37 * 3600) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('about a day ago');
      } else if ($diff < 24 * 24 * 3600) {
 +        // XXX: should support plural.
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return sprintf(_('about %d days ago'), round($diff/(24*3600)));
      } else if ($diff < 46 * 24 * 3600) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('about a month ago');
      } else if ($diff < 330 * 24 * 3600) {
 +        // XXX: should support plural.
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return sprintf(_('about %d months ago'), round($diff/(30*24*3600)));
      } else if ($diff < 480 * 24 * 3600) {
 +        // TRANS: Used in notices to indicate when the notice was made compared to now.
          return _('about a year ago');
      } else {
          return common_exact_date($dt);
@@@ -1939,6 -1925,15 +1939,15 @@@ function common_url_to_nickname($url
              $path = preg_replace('@/$@', '', $parts['path']);
              $path = preg_replace('@^/@', '', $path);
              $path = basename($path);
+             // Hack for MediaWiki user pages, in the form:
+             // http://example.com/wiki/User:Myname
+             // ('User' may be localized.)
+             if (strpos($path, ':')) {
+                 $parts = array_filter(explode(':', $path));
+                 $path = $parts[count($parts) - 1];
+             }
              if ($path) {
                  return common_nicknamize($path);
              }