Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploader fixes #1524

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/libraries/controllers/ApiPhotoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ public function upload()
$this->plugin->setData('photo', $photo);
$this->plugin->invoke('onPhotoUploaded');

$this->user->setAttribute('stickyPermission', $permission);
$this->user->setAttribute('stickyLicense', $photo['license']);
$this->user->setAttributes(array('stickyLicense' => $photo['license'], 'stickyPermission' => $permission));
return $this->created("Photo {$photoId} uploaded successfully", $photo);
}

Expand Down
16 changes: 16 additions & 0 deletions src/libraries/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ public function setAttribute($name, $value)
return $this->update(array($name => $value));
}

/**
* Set several attributes.
*
* @return boolean
*/
public function setAttributes($attrs)
{
$new_array = array();
$keys = array_keys($attrs);
foreach ($attrs as $name => $value) {
$new_name = $this->getAttributeName($name);
$new_array[$new_name] = $attrs[$name];
}
return $this->update($new_array);
}

/**
* Set the session email.
*
Expand Down
2 changes: 1 addition & 1 deletion src/templates/upload-beta.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<div class="control-group">
<label for="tags">Permission</label>
<label for="permission">Permission</label>
<div class="controls">
<label class="radio inline private">
<input type="radio" name="permission" value="0"<?php if($preferences['permission'] === false || $preferences['permission'] === '0') { ?> checked="checked"<?php } ?>>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/upload-confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<hr>
<?php } ?>

<?php if(count($duplicatePhotos) > 0) { ?>
<?php if(isset($duplicatePhotos) && count($duplicatePhotos) > 0) { ?>
<strong><span class="label label-warning"><?php echo count($duplicatePhotos); ?> of them already existed in your account.</span></strong>
<div class="upload-preview">
<ul class="thumbnails duplicates">
Expand Down
2 changes: 1 addition & 1 deletion src/templates/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>

<div class="control-group">
<label for="tags">Permission</label>
<label for="permission">Permission</label>
<div class="controls">
<label class="radio inline private">
<input type="radio" name="permission" value="0"<?php if($preferences['permission'] === false || $preferences['permission'] === '0') { ?> checked="checked"<?php } ?>>
Expand Down