summaryrefslogtreecommitdiff
path: root/classes/File.php
diff options
context:
space:
mode:
authorroot <root@ip-10-250-162-129.ec2.internal>2010-01-09 23:25:08 +0000
committerroot <root@ip-10-250-162-129.ec2.internal>2010-01-09 23:25:08 +0000
commitd59df6b27013fb534d6444d8e4790f2edcd9459a (patch)
treebd5bcc8e4ecd0e9391efdcac8ff906fd8b506a60 /classes/File.php
parentd6db8e58170e6e78a0fd67d50f7fea5d95b5d9c8 (diff)
parentf396701b6466749c09ce16b1e7f2f96c10b05cdd (diff)
Merge branch '0.9.x' of git://gitorious.org/statusnet/mainline into 0.9.x
Diffstat (limited to 'classes/File.php')
-rw-r--r--classes/File.php33
1 files changed, 20 insertions, 13 deletions
diff --git a/classes/File.php b/classes/File.php
index e04a9d525..6173f31d6 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -182,25 +182,32 @@ class File extends Memcached_DataObject
static function url($filename)
{
- $path = common_config('attachments', 'path');
+ if(common_config('site','private')) {
- if ($path[strlen($path)-1] != '/') {
- $path .= '/';
- }
+ return common_local_url('getfile',
+ array('filename' => $filename));
- if ($path[0] != '/') {
- $path = '/'.$path;
- }
+ } else {
+ $path = common_config('attachments', 'path');
- $server = common_config('attachments', 'server');
+ if ($path[strlen($path)-1] != '/') {
+ $path .= '/';
+ }
- if (empty($server)) {
- $server = common_config('site', 'server');
- }
+ if ($path[0] != '/') {
+ $path = '/'.$path;
+ }
+
+ $server = common_config('attachments', 'server');
- // XXX: protocol
+ if (empty($server)) {
+ $server = common_config('site', 'server');
+ }
- return 'http://'.$server.$path.$filename;
+ // XXX: protocol
+
+ return 'http://'.$server.$path.$filename;
+ }
}
function getEnclosure(){