diff options
author | Zvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net> | 2012-06-25 13:59:53 +0300 |
---|---|---|
committer | Zvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net> | 2012-06-25 13:59:53 +0300 |
commit | 94f895e98df73efe32a7c986a4b7844b0ab8fc01 (patch) | |
tree | 92324c19bb13025d8f2f0087212348a039acbec6 /mod/photos.php | |
parent | 00668aaa71336f48b141c443749a66c58a555503 (diff) | |
parent | 7ea5917bf794c431fe304fa25380f19a6927cf63 (diff) | |
download | volse-hubzilla-94f895e98df73efe32a7c986a4b7844b0ab8fc01.tar.gz volse-hubzilla-94f895e98df73efe32a7c986a4b7844b0ab8fc01.tar.bz2 volse-hubzilla-94f895e98df73efe32a7c986a4b7844b0ab8fc01.zip |
Merge git://github.com/friendica/friendica
Diffstat (limited to 'mod/photos.php')
-rw-r--r-- | mod/photos.php | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/mod/photos.php b/mod/photos.php index d96bc135e..ea4d7f81f 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -38,8 +38,10 @@ function photos_init(&$a) { $o .= '<div class="fn">' . $a->data['user']['username'] . '</div>'; $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg') . '" alt="' . $a->data['user']['username'] . '" /></div>'; $o .= '</div>'; - - if(! intval($a->data['user']['hidewall'])) { + + $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true); + + if($albums_visible) { $o .= '<div id="side-bar-photos-albums" class="widget">'; $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>'; @@ -709,6 +711,24 @@ function photos_post(&$a) { logger('mod/photos.php: photos_post(): loading the contents of ' . $src , LOGGER_DEBUG); $imagedata = @file_get_contents($src); + + + + $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ", + intval($a->data['user']['uid']) + ); + + $limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit'); + + if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) { + notice( upgrade_message() . EOL ); + @unlink($src); + $foo = 0; + call_hooks('photo_post_end',$foo); + killme(); + } + + $ph = new Photo($imagedata, $type); if(! $ph->is_valid()) { @@ -966,12 +986,25 @@ function photos_content(&$a) { <input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>'; - + $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ", + intval($a->data['user']['uid']) + ); + + + $limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit'); + if($limit !== false) { + $usage_message = sprintf( t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 ); + } + else { + $usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 ); + } + $tpl = get_markup_template('photos_upload.tpl'); $o .= replace_macros($tpl,array( '$pagename' => t('Upload Photos'), '$sessid' => session_id(), + '$usage' => $usage_message, '$nickname' => $a->data['user']['nickname'], '$newalbum' => t('New album name: '), '$existalbumtext' => t('or existing album name: '), |