summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/item_rest.php
AgeCommit message (Collapse)Author
2013-01-25#1956 - Escape LIKE queries (for _ and %).shadlaws
In MySQL queries, _ and % characters are treated as wildcards (similar to ? and *, respectively). - Added escape_for_like function to MY_Database.php - Added unit test to Database_Test - Corrected the five unescaped instances in the code using this function.
2013-01-21Update copyright to 2013. Fixes #1953.Bharat Mediratta
2012-12-18Check for "add" instead of "edit" in item_rest::post. Fixes #1929.Bharat Mediratta
2012-02-27Update copyright to 2012. #1822Bharat Mediratta
2011-01-21Update copyright to 2011.Bharat Mediratta
2010-11-27Clean up phpDoc on get() a little moreBharat Mediratta
2010-08-08Allow item_rest::put() to replace the current data file. RemoveBharat Mediratta
data_rest::put() altogether; it's no longer necessary.
2010-06-19Rework our exception framework to fit into Kohana's model better.Bharat Mediratta
Instead of overwriting Kohana_Exception::handle() (which we were doing in MY_Kohana_Exception) we instead use their existing template system. gallery/views/kohana/error.php overrides system/views/kohana/error.php and is the standard error template for all exceptions. Our version of error.php figures out the appropriate view based on context (cli, authenticated admin, guest viewing a 404, guest viewing a system error) and delegates appropriately. Each delegated view has a narrow responsibility. This paves the way for us to add new error views per module. For example, the rest module will define its own template in Rest_Exception and then its exceptions can be rendered the way that it wants (json encoded, in that case).
2010-06-15Revert "Change the item rest update processing to call theBharat Mediratta
item::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Changed the item::move method so it returns a message to be displayed if the caller chooses. And changed the move controller to display the message returned by the move if the item name was renamed as part of the move." Rolling this back for a couple of reasons: 1) Bug in move.php ("message.info" is not a function name) 2) Having the message come back from the API call as a side-effect is sloppy. We should find a cleaner way to do this checking. 3) having item::move() call save() on any changed values in the ORM is counter-intuitive. Move should move, save should save. I think the right approach here is to roll the move() code properly into save(). This reverts commit 2492280cc0ec9eb64a8daeccc7b5698ece7fea66.
2010-06-15Revert "Fix for ticket #1118. Create a item::save_with_retries helperBharat Mediratta
method, which encapsulates saving an item and handling name and slug conflicts. Call this instead of doing a save directly." Rolled this back because it fails KISS. We already have an API for saving models with Item_Model::save() that's consistent with all of our other model code. Adding a new way to save items is confusing and inconsistent. This reverts commit 9504f71efcadc7ed27f6f09e5d663e8025bf3b86.
2010-06-15Fix for ticket #1118. Create a item::save_with_retries helper method, which ↵Tim Almdal
encapsulates saving an item and handling name and slug conflicts. Call this instead of doing a save directly.
2010-06-15Change the item rest update processing to call the item::move(source, ↵Tim Almdal
target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Changed the item::move method so it returns a message to be displayed if the caller chooses. And changed the move controller to display the message returned by the move if the item name was renamed as part of the move.
2010-06-15Only change the weights of the album children if the item sort_column is set ↵Tim Almdal
to weight.
2010-06-15Revert "Change the item rest update processing to call the ↵Tim Almdal
itemm::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Also, only change the weights of the album children if the item sort_column is set to weight." This reverts commit 603d4640141a43350f50da747d747456b28fdd93.
2010-06-15Change the item rest update processing to call the itemm::move(source, ↵Tim Almdal
target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Also, only change the weights of the album children if the item sort_column is set to weight.
2010-06-08Don't use the standard error formatting for exceptions that have occurred as ↵Tim Almdal
part of a REST request. Format the exception as a json encoded text string so the client can extract the fault information if they so choose.
2010-06-06Merge branch 'master' into talmdal_devTim Almdal
2010-06-06Fix an unused variable caused by converting straight query paramsBharat Mediratta
to $entity based params.
2010-05-28If the file is empty (i.e. the upload failed, then throw a 'bad request' ↵Tim Almdal
exception before trying to create the item.
2010-05-18Save the item before updating the order of the children. Also always ↵Tim Almdal
increment the weight count (even if it is equal to the weight of the current child)
2010-04-16Only return the members element to the rest client if the item is an album. ↵Tim Almdal
This makes it consistent to the rest client that collections will have a members element.
2010-04-04REST changes: Allow PUT and POST requests to modify members, notBharat Mediratta
just entity. TESTS ARE NOT UPDATED YET. - Fix item_rest::get() to maintain the proper sort order, which requires duplicating some Item_Model code. - Elide "weight" from the REST version of item - Adjust the weight of members according to the order they're returned from the client. You can't add or remove members here, you can only reorder them. - Changed the wire protocol to handle more complex values. Now "entity" and "members" are JSON encoded. The Gallery3 helper does this correctly. - Changed the wire protocol for tag_item -- now it stores the tag and item urls in the entity, not as members. This is more consistent. - Added missing security for renaming and deleting tags. - Got rid of vestigial tag_rest::post(). We add/remove tags via the relationship.
2010-03-03Update the copyright to 2010. It's only 3 months into the year :-)Bharat Mediratta
2010-02-12Revert "1) Add a depth parameter to retrieving an item thru the rest api"Bharat Mediratta
This reverts commit 3439671bcfb99c1884285e4b4e53295f044e688f.
2010-02-121) Add a depth parameter to retrieving an item thru the rest apiTim Almdal
2) Standardize the structure of members so that client programs can consistently parse the return information. 3) Added a summary parameter so that client programs can easily determine if the information returned is summary (item type, item title) or the full meal deal
2010-01-30Use Item_Model::as_restful_array() to simplify tests.Bharat Mediratta
2010-01-30Remap parent_id and album_cover_item_id to and from RESTful urls.Bharat Mediratta
2010-01-27Convert back to using ORM::factory(..., $id) instead of calling where().Bharat Mediratta
2010-01-27Change "resource" to "entity" in REST responses. They're allBharat Mediratta
resources, but we differentiate resources as collections and entities.
2010-01-22Return the url of the newly created item from post().Bharat Mediratta
Don't try to access ORM::$changed -- it's protected.
2010-01-22Reshape the rest code to be more consistent with regards toBharat Mediratta
relationships. Now when you view a resource, it has 4 top level elements: url: the url of this resource resource: array of key value pairs describing the resource members: array of urls to members of this collection relationships: array of array of members. Relationships are a special type of collection that links two different resources together. To remove a relationship, just DELETE its url. To create a relationship, POST to its collection. Individual modules can add their own relationships to any resource via a callback mechanism. Example: Array( [url] => http://g3.com/rest/item/1 [resource] => Array ( [id] => 1 [album_cover_item_id] => 4 [captured] => [created] => 1264056417 [description] => [height] => ... ) [members] => Array( [0] => http://g3.com/rest/item/2 [1] => http://g3.com/rest/item/3 [2] => http://g3.com/rest/item/4 [3] => http://g3.com/rest/item/5 ... ) [relationships] => Array( [tags] => Array ( [0] => http://g3.com/rest/tag_item/2,1 [1] => http://g3.com/rest/tag_item/23,1 ) ) )