summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-06-16 11:51:28 -0700
committerAndreas Gohr <andi@splitbrain.org>2013-06-16 11:51:28 -0700
commit3f314099e3286ad91de618473f073ee01947ebda (patch)
tree111336c9354e8d956bdf294b1740c2eb182b8087 /inc
parent3394e804f34fc2636c519d9ec6e10e342adf520d (diff)
parent3074e3428bd5d1e38078dbac80a1eb9b96f917d7 (diff)
downloadrpg-3f314099e3286ad91de618473f073ee01947ebda.tar.gz
rpg-3f314099e3286ad91de618473f073ee01947ebda.tar.bz2
Merge pull request #180 from splitbrain/FS#2415
FS#2415, add $INFO to mediamanager
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php74
1 files changed, 53 insertions, 21 deletions
diff --git a/inc/common.php b/inc/common.php
index 760a9f6dc..b292fb75e 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -86,32 +86,20 @@ function formSecurityToken($print = true) {
}
/**
- * Return info about the current document as associative
- * array.
+ * Determine basic information for a request of $id
*
* @author Andreas Gohr <andi@splitbrain.org>
+ * @author Chris Smith <chris@jalakai.co.uk>
*/
-function pageinfo() {
- global $ID;
- global $REV;
- global $RANGE;
+function basicinfo($id, $htmlClient=true){
global $USERINFO;
- global $lang;
-
- // include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
- // FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
- $info['id'] = $ID;
- $info['rev'] = $REV;
// set info about manager/admin status.
$info['isadmin'] = false;
$info['ismanager'] = false;
if(isset($_SERVER['REMOTE_USER'])) {
- $sub = new Subscription();
-
$info['userinfo'] = $USERINFO;
- $info['perm'] = auth_quickaclcheck($ID);
- $info['subscribed'] = $sub->user_subscription();
+ $info['perm'] = auth_quickaclcheck($id);
$info['client'] = $_SERVER['REMOTE_USER'];
if($info['perm'] == AUTH_ADMIN) {
@@ -127,12 +115,46 @@ function pageinfo() {
}
} else {
- $info['perm'] = auth_aclcheck($ID, '', null);
- $info['subscribed'] = false;
+ $info['perm'] = auth_aclcheck($id, '', null);
$info['client'] = clientIP(true);
}
- $info['namespace'] = getNS($ID);
+ $info['namespace'] = getNS($id);
+
+ // mobile detection
+ if ($htmlClient) {
+ $info['ismobile'] = clientismobile();
+ }
+
+ return $info;
+ }
+
+/**
+ * Return info about the current document as associative
+ * array.
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function pageinfo() {
+ global $ID;
+ global $REV;
+ global $RANGE;
+ global $lang;
+
+ $info = basicinfo($ID);
+
+ // include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
+ // FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
+ $info['id'] = $ID;
+ $info['rev'] = $REV;
+
+ if(isset($_SERVER['REMOTE_USER'])) {
+ $sub = new Subscription();
+ $info['subscribed'] = $sub->user_subscription();
+ } else {
+ $info['subscribed'] = false;
+ }
+
$info['locked'] = checklock($ID);
$info['filepath'] = fullpath(wikiFN($ID));
$info['exists'] = @file_exists($info['filepath']);
@@ -210,8 +232,18 @@ function pageinfo() {
}
}
- // mobile detection
- $info['ismobile'] = clientismobile();
+ return $info;
+}
+
+/**
+ * Return information about the current media item as an associative array.
+ */
+function mediainfo(){
+ global $NS;
+ global $IMG;
+
+ $info = basicinfo("$NS:*");
+ $info['image'] = $IMG;
return $info;
}