summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
authorKlap-in <klapinklapin@gmail.com>2013-07-21 23:10:32 +0200
committerKlap-in <klapinklapin@gmail.com>2013-07-21 23:10:32 +0200
commitb1ffadaa6963bbf83e61917c31e04c04c421ce9e (patch)
treef9a1391d2ee6536473b1672e249c1b11a67a5b0e /inc/media.php
parentfa3ed26bfbafa4d05ec77a799259d4a46baadd9a (diff)
parentfbd8067eeeb9f424981aad8b283e17f734c738c3 (diff)
downloadrpg-b1ffadaa6963bbf83e61917c31e04c04c421ce9e.tar.gz
rpg-b1ffadaa6963bbf83e61917c31e04c04c421ce9e.tar.bz2
Merge remote-tracking branch 'origin/master' into fetchimagetokexternal
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/inc/media.php b/inc/media.php
index 18148a446..fbe1363ec 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;