diff options
author | Sebastian Egbers <sebastian@egbers.info> | 2012-06-25 13:59:39 +0200 |
---|---|---|
committer | Sebastian Egbers <sebastian@egbers.info> | 2012-06-25 13:59:39 +0200 |
commit | 020deedd7c68ce016b65056062d85567c91c3d37 (patch) | |
tree | b07a71b2d57d5dfae527ab9e2a6f42423bc8b327 /mod/photos.php | |
parent | cbf1cab0da2b67c8a88f301ce9ce6b83db27ec0b (diff) | |
parent | 7ea5917bf794c431fe304fa25380f19a6927cf63 (diff) | |
download | volse-hubzilla-020deedd7c68ce016b65056062d85567c91c3d37.tar.gz volse-hubzilla-020deedd7c68ce016b65056062d85567c91c3d37.tar.bz2 volse-hubzilla-020deedd7c68ce016b65056062d85567c91c3d37.zip |
Merge branch 'master' of https://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: '), |