summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;