summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorKlap-in <klapinklapin@gmail.com>2013-05-21 22:47:49 +0200
committerKlap-in <klapinklapin@gmail.com>2013-05-21 22:47:49 +0200
commitd54f79638bcd4567f3d20469bfb7ab95c1fe8d24 (patch)
tree5a400d45139fd1772e4cadceee1ddb2113240ab1 /inc
parentf481fb8c448406f875dbf08e2aaa94a59e3b0f93 (diff)
downloadrpg-d54f79638bcd4567f3d20469bfb7ab95c1fe8d24.tar.gz
rpg-d54f79638bcd4567f3d20469bfb7ab95c1fe8d24.tar.bz2
Added media_isexternal()
Diffstat (limited to 'inc')
-rw-r--r--inc/media.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/inc/media.php b/inc/media.php
index e29a47631..f3b1a0af5 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -83,6 +83,18 @@ function media_metasave($id,$auth,$data){
}
/**
+ * check if a media is external source
+ *
+ * @author Gerrit Uitslag <klapinklapin@gmail.com>
+ * @param string $id the media ID or URL
+ * @return bool
+ */
+function media_isexternal($id){
+ if (preg_match('#^(https?|ftp)://#i', $id)) return true;
+ return false;
+}
+
+/**
* Check if a media item is public (eg, external URL or readable by @ALL)
*
* @author Andreas Gohr <andi@splitbrain.org>
@@ -90,7 +102,7 @@ function media_metasave($id,$auth,$data){
* @return bool
*/
function media_ispublic($id){
- if(preg_match('/^https?:\/\//i',$id)) return true;
+ if(media_isexternal($id)) return true;
$id = cleanID($id);
if(auth_aclcheck(getNS($id).':*', '', array()) >= AUTH_READ) return true;
return false;