diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-02-16 21:08:09 +0000 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-02-16 21:08:09 +0000 |
commit | 1015a57dff9a6f85b8e0534d280aa1e09945a598 (patch) | |
tree | 22df08088c83971147283fd7d15db346bfbb8e0d /inc/common.php | |
parent | 7e9efe5266f592dc927dbf126a901e7dea2b4f5d (diff) | |
download | rpg-1015a57dff9a6f85b8e0534d280aa1e09945a598.tar.gz rpg-1015a57dff9a6f85b8e0534d280aa1e09945a598.tar.bz2 |
FS#2415 add to mediamanager (refactor pageinfo() and shift MEDIAMANAGER_STARTED after mediainfo() sets up )
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/inc/common.php b/inc/common.php index 28b527633..d4265f78c 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> + * @param unknown_type $id + * @param unknown_type $httpClient */ -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,40 @@ function pageinfo() { } } else { - $info['perm'] = auth_aclcheck($ID, '', null); + $info['perm'] = auth_aclcheck($id, '', null); $info['subscribed'] = false; $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; + $info['locked'] = checklock($ID); $info['filepath'] = fullpath(wikiFN($ID)); $info['exists'] = @file_exists($info['filepath']); @@ -210,8 +226,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; } |