summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-04 08:58:24 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-04 08:58:24 -0400
commitc378cc976f2fc2afd3b9e1a6d7a9536cb94dc77d (patch)
treeee16a3d420bb87bf9eb86bfaf149558a9305c7f7 /lib/util.php
parent822d5b8887a06ba1704a7eb417a35d4dcb84e948 (diff)
add an event for determining if an action is sensitive
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/util.php b/lib/util.php
index c8e318efe..cd9bd9ed8 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -715,14 +715,10 @@ function common_relative_profile($sender, $nickname, $dt=null)
function common_local_url($action, $args=null, $params=null, $fragment=null)
{
- static $sensitive = array('login', 'register', 'passwordsettings',
- 'twittersettings', 'finishopenidlogin',
- 'finishaddopenid', 'api');
-
$r = Router::get();
$path = $r->build($action, $args, $params, $fragment);
- $ssl = in_array($action, $sensitive);
+ $ssl = common_is_sensitive($action);
if (common_config('site','fancy')) {
$url = common_path(mb_substr($path, 1), $ssl);
@@ -736,6 +732,20 @@ function common_local_url($action, $args=null, $params=null, $fragment=null)
return $url;
}
+function common_is_sensitive($action)
+{
+ static $sensitive = array('login', 'register', 'passwordsettings',
+ 'twittersettings', 'finishopenidlogin',
+ 'finishaddopenid', 'api');
+ $ssl = null;
+
+ if (Event::handle('SensitiveAction', array($action, &$ssl))) {
+ $ssl = in_array($action, $sensitive);
+ }
+
+ return $ssl;
+}
+
function common_path($relative, $ssl=false)
{
$pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';