Skip to content

Commit

Permalink
Merge branch 'master' of git@gitorious.org:laconica/mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Prodromou committed Aug 10, 2009
2 parents 65c37d6 + d0793c0 commit 6aee059
Show file tree
Hide file tree
Showing 10 changed files with 476 additions and 229 deletions.
41 changes: 34 additions & 7 deletions actions/unsubscribe.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php
/*
/**
* Unsubscribe handler
*
* PHP version 5
*
* @category Action
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, 2009, Control Yourself, Inc.
*
Expand All @@ -17,6 +28,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

if (!defined('LACONICA')) {
exit(1);
}

/**
* Unsubscribe handler
*
* @category Action
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/
*/
class UnsubscribeAction extends Action
{

Expand All @@ -31,16 +56,18 @@ function handle($args)
$user = common_current_user();

if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)));
return;
}

# CSRF protection
/* Use a session token for CSRF protection. */

$token = $this->trimmed('token');

if (!$token || $token != common_session_token()) {
$this->clientError(_('There was a problem with your session token. Try again, please.'));
$this->clientError(_('There was a problem with your session token. ' .
'Try again, please.'));
return;
}

Expand All @@ -53,7 +80,7 @@ function handle($args)

$other = Profile::staticGet('id', $other_id);

if (!$other_id) {
if (!$other) {
$this->clientError(_('No profile with that id.'));
return;
}
Expand All @@ -76,8 +103,8 @@ function handle($args)
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname)),
common_redirect(common_local_url('subscriptions',
array('nickname' => $user->nickname)),
303);
}
}
Expand Down
7 changes: 5 additions & 2 deletions classes/Design.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static function toWebColor($color)
return new WebColor($color);
} catch (WebColorException $e) {
// This shouldn't happen
common_log(LOG_ERR, "Unable to create color for design $id.",
common_log(LOG_ERR, "Unable to create web color for $color",
__FILE__);
return null;
}
Expand Down Expand Up @@ -204,7 +204,10 @@ static function siteDesign()
'disposition');

foreach ($attrs as $attr) {
$siteDesign->$attr = common_config('design', $attr);
$val = common_config('design', $attr);
if ($val !== false) {
$siteDesign->$attr = $val;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions extlib/facebook/facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ public function __construct($api_key, $secret, $generate_session_secret=false) {
* @param bool resolve_auth_token convert an auth token into a session
*/
public function validate_fb_params($resolve_auth_token=true) {
$this->fb_params = $this->get_valid_fb_params($_POST, 48*3600, 'fb_sig');
$this->fb_params = $this->get_valid_fb_params($_POST, 48 * 3600, 'fb_sig');

// note that with preload FQL, it's possible to receive POST params in
// addition to GET, so use a different prefix to differentiate them
if (!$this->fb_params) {
$fb_params = $this->get_valid_fb_params($_GET, 48*3600, 'fb_sig');
$fb_post_params = $this->get_valid_fb_params($_POST, 48*3600, 'fb_post_sig');
$fb_params = $this->get_valid_fb_params($_GET, 48 * 3600, 'fb_sig');
$fb_post_params = $this->get_valid_fb_params($_POST, 48 * 3600, 'fb_post_sig');
$this->fb_params = array_merge($fb_params, $fb_post_params);
}

Expand Down
Loading

0 comments on commit 6aee059

Please sign in to comment.