summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-06-16 12:36:58 -0700
committerAndreas Gohr <andi@splitbrain.org>2013-06-16 12:36:58 -0700
commit06f8cfbed961eb9394fa29558dd29c79f87fc9ad (patch)
tree20b02ae07d943248a0a01191409cd02120e5fcb3 /inc/media.php
parentd6b7a2dd189b692f9a754f4f1a330abe6449669a (diff)
parentb9ee6a44e7499b5c2e9f117096cedc769ef2e25d (diff)
downloadrpg-06f8cfbed961eb9394fa29558dd29c79f87fc9ad.tar.gz
rpg-06f8cfbed961eb9394fa29558dd29c79f87fc9ad.tar.bz2
Merge pull request #225 from splitbrain/fetchftp
Add media_isexternal
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;