summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index ec1f86703..c120fa376 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -862,7 +862,14 @@ function common_xml_safe_str($str)
function common_tag_link($tag)
{
$canonical = common_canonical_tag($tag);
- $url = common_local_url('tag', array('tag' => $canonical));
+ if (common_config('singleuser', 'enabled')) {
+ // regular TagAction isn't set up in 1user mode
+ $url = common_local_url('showstream',
+ array('nickname' => common_config('singleuser', 'nickname'),
+ 'tag' => $canonical));
+ } else {
+ $url = common_local_url('tag', array('tag' => $canonical));
+ }
$xs = new XMLStringer();
$xs->elementStart('span', 'tag');
$xs->element('a', array('href' => $url,
@@ -1272,12 +1279,38 @@ function common_mtrand($bytes)
return $enc;
}
+/**
+ * Record the given URL as the return destination for a future
+ * form submission, to be read by common_get_returnto().
+ *
+ * @param string $url
+ *
+ * @fixme as a session-global setting, this can allow multiple forms
+ * to conflict and overwrite each others' returnto destinations if
+ * the user has multiple tabs or windows open.
+ *
+ * Should refactor to index with a token or otherwise only pass the
+ * data along its intended path.
+ */
function common_set_returnto($url)
{
common_ensure_session();
$_SESSION['returnto'] = $url;
}
+/**
+ * Fetch a return-destination URL previously recorded by
+ * common_set_returnto().
+ *
+ * @return mixed URL string or null
+ *
+ * @fixme as a session-global setting, this can allow multiple forms
+ * to conflict and overwrite each others' returnto destinations if
+ * the user has multiple tabs or windows open.
+ *
+ * Should refactor to index with a token or otherwise only pass the
+ * data along its intended path.
+ */
function common_get_returnto()
{
common_ensure_session();