Skip to content
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
2 changes: 2 additions & 0 deletions controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ApiController extends Controller {
protected $objectKey;
protected $objectName;
protected $subset;
protected $getOnly;
protected $singleObject;
protected $publications = false;
protected $legacyPublications = false;
Expand Down Expand Up @@ -446,6 +447,7 @@ public function init($extra) {

$this->scopeObject = !empty($extra['scopeObject']) ? $extra['scopeObject'] : $this->scopeObject;
$this->subset = !empty($extra['subset']) ? $extra['subset'] : $this->subset;
$this->getOnly = !empty($extra['getOnly']) ? $extra['getOnly'] : $this->getOnly;

$this->fileMode = !empty($extra['file'])
? (!empty($_GET['info']) ? 'info' : 'download')
Expand Down
3 changes: 3 additions & 0 deletions controllers/ItemsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ public function items() {
);
}
else if ($this->subset == 'children') {
if ($this->getOnly) {
$this->allowMethods(array('GET'));
}
$item = Zotero_Items::getByLibraryAndKey($this->objectLibraryID, $this->objectKey);
if (!$item) {
$this->e404("Item not found");
Expand Down
2 changes: 2 additions & 0 deletions include/config/routes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$router->map('/groups/i:objectGroupID/items/:objectKey/file', array('controller' => 'Items', 'extra' => array('allowHTTP' => true, 'file' => true)));
$router->map('/groups/i:objectGroupID/items/:objectKey/file/view', array('controller' => 'Items', 'extra' => array('allowHTTP' => true, 'file' => true, 'view' => true)));
$router->map('/groups/i:objectGroupID/items/:objectKey/file/view/url', ['controller' => 'Items', 'extra' => ['file' => true, 'viewurl' => true]]);
$router->map('/users/i:objectUserID/items/:objectKey/children', ['controller' => 'Items', 'extra' => ['subset' => 'children', 'getOnly' => true]]);
$router->map('/groups/i:objectGroupID/items/:objectKey/children', ['controller' => 'Items', 'extra' => ['subset' => 'children', 'getOnly' => true]]);

// Full-text content
$router->map('/users/i:objectUserID/items/:objectKey/fulltext', array('controller' => 'FullText', 'action' => 'itemContent'));
Expand Down