Commit Graph

24 Commits

Author SHA1 Message Date
Bharat Mediratta
1067e68292 Redesign the way that we consider page types to create buckets of page
types, and a subtype for specifics.  Currently the top level bucket

   collection, item, other

Here are the core subtypes so far:

   collection: album, search, tag
   item: movie, photo
   other: login, reset, comment-fragment, comment

It's legal to create new page_subtypes whenever you want.  Use the
appropriate page_type to get the coarse grain behavior that you want.
2009-11-17 14:04:45 -08:00
Tim Almdal
88852c45ea Modified the so that a where clause can be passed into item::get_position. Was also able to remove the sub-select from the calculation of the current position as we already have the child item containing the sort column value.
Also added a where clause that ignores albums to the get_position, children and children_count method calls in photos.php and movies.php
2009-11-04 09:50:49 -08:00
Tim Almdal
4cb9ec1d6d Use the request::referrer to determine if we are editting the photo or album
from the context menu or from its photo or album page.
Fixes ticket #745.  Thanks to jankoprowski for the referrer approach.
2009-10-22 13:11:02 -07:00
Tim Almdal
95f3eb3aad When an album or photo is updated always return the photo/album location as
part of the response.  This insures that if the internet address changes, then
the page will reload properly.
2009-10-22 07:37:14 -07:00
Bharat Mediratta
0a66ef9cc7 Don't allow users to change the file extension of photos/movies
If you can change the extension, then you can alter the way the server
handles the file, which is a security problem.  So for example, you
can change a .JPG to a .PHP and then if you put some malicious PHP
code in the EXIF data, you can get the server to execute
it. Vulnerability is low because only users who have edit permissions
could do this.

Fixes ticket #846
2009-10-13 10:36:50 -07:00
Bharat Mediratta
123afc9542 Set children_count to 0, photos have no children. 2009-09-21 21:22:07 -07:00
Bharat Mediratta
9e6be40e31 Add viewable() protection to children() and children_count() calls.
This is not currently necessary (nor is it a security hole) because we
don't constrain permissions at the child level in the core, but it
makes our security audits easier and will enable the scenario where
somebody writes a module to add per-photo permissions.
2009-09-21 20:47:55 -07:00
Bharat Mediratta
a6581ede0b Fix Item_Model::get_position() so that our sort is stable when the comparison
row has a null value in the sort field.  Fix for #627

Note: this changes get_position() to take an Item_Model instead of an id!
2009-09-21 11:35:27 -07:00
Bharat Mediratta
2aad580f53 Move specialized (pretty) url generation back into Item_Model so that
we're not relying on overriding url::site() to do tricks around item
urls.  This means that you won't get item urls by doing
url::site("albums/37"), for example, but it also means that we won't
get pretty urls where we don't expect them (like in the action of a
<form> element).

Incidentally, this will help us move over to using the slug format
because if you've got a bad character in a url, the edit forms will
now work on it since they'll be id based.
2009-09-08 13:44:52 -07:00
Bharat Mediratta
78a42d9b83 1. Actually set the slug to the new value in the controllers.
2. Fix up an issue where we were crashing if there were no conflicting rows
3. Amend Item_Model so that if you change the slug, it flushes the cache
   for all children
2009-09-07 21:09:52 -07:00
Bharat Mediratta
f28353f4e1 Add the 'Internet Address' field to all items, along with proper
validation for the fields.
2009-09-07 21:01:51 -07:00
Bharat Mediratta
c887170555 Stay on the same page when editing albums/movies/photos. Fixes ticket 2009-08-31 21:10:22 -07:00
Andy Staudacher
8312eb116e XSS review fixes (mostly adding missing html::mark_clean()) calls. 2009-08-31 02:12:01 -07:00
Andy Staudacher
c01ac42c46 Refactor all calls of p::clean() to SafeString::of() and p::purify() to SafeString::purify().
Removing any p::clean() calls for arguments to t() and t2() since their args are wrapped in a SafeString anyway.
2009-08-29 12:48:40 -07:00
Tim Almdal
a7f4d7aced Revert commit 078c77a62b and change the
tag_event:item_edit_form to use the new Form_Script library to inject
script into a form.

Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
2009-07-28 21:00:25 +08:00
Tim Almdal
078c77a62b Add tag autocomplete to the album and photo edit pop up dialogs.
This required putting a wrapper view around the forms and passing
this view as the parameter to the item_edit_form event.  The view
contains a $script variable that the modules can add script to be
included in the form html when rendered as part of the ajax response.
2009-07-24 14:18:15 -07:00
Bharat Mediratta
60d6058880 Make some API changes simplify the tag editing code. We now have a
good pattern for allowing modules to add their own hooks to item forms!

1) Album, photo and movie forms now all use edit_item as the group and
   we publish item_edit_form and item_edit_form_completed events which
   makes it much easier in the module to handle all events.  They can
   still differentiate based on $item->type if they want to.

2) Added tag::clear_all() and tag::compact() functions which takes the
   place of hiwilson's tag::update() function and is now used in
   tag_event::item_delete().  This provides a simple API that allows
   us to have a lot less event handling code.  It's less efficient
   than what hiwilson was doing before in that it will delete and
   re-add tags, but if that ever turns out to be a performance issue
   we can do something about it then.
2009-07-20 08:51:12 -07:00
hiwilson
709d6c5faf (1)Add tag edit field in album/photo edit form. (2)provide edit functionality. (3)support multi-word tagging. 2009-07-20 08:02:07 -07:00
Bharat Mediratta
0f766b149d Second non-trivial change to the event code. We now publish model
related events from within the model handling code.  The only
exception to this currently is item_created which is challenging
because we have to save the item using ORM_MPTT::add_to_parent()
before the object itself is fully set up.  When we get that down to
one call to save() we can publish that event from within the model
also.
2009-07-16 12:31:40 -07:00
Bharat Mediratta
5b3b675b6d Non-trivial changes to the event handling code:
1) The item_updated event no longer takes the old and new items.
   Instead we overload ORM to track the original data and make
   that available via the item.  This will allow us to move event
   publishing down into the API methods which in turn will give us
   more stability since we won't require each controller to remember
   to do it.

2) ORM class now tracks the original values.  It doesn't track
   the original relationships (no need for that, yet)

3) Added new events:
     item_deleted
     group_deleted
     user_deleted
2009-07-16 11:19:34 -07:00
Bharat Mediratta
8f9a943f55 Fix a bunch of XSS vulnerabilities turned up by manual inspection
using the checklist in ticket #385.
2009-07-01 17:57:39 -07:00
Bharat Mediratta
4f0a3fefa0 Fix a bug in Item_Model::get_position() where we incorrectly using the
grandparent id.  Oops.  This caused navigation from photo back up to
album to be broken.

Also update Photos_Controller to use the active sort order.. it was
still hardcoded to use the id.  It's more efficient now, yay.

Fixes ticket #340.
2009-06-04 22:11:08 -07:00
Bharat Mediratta
43abcd9386 Security pass over all controller code. Mostly adding CSRF checking
and verifying user permissions, but there are several above-the-bar
changes:

1) Server add is now only available to admins.  This is a hard
   requirement because we have to limit server access (eg:
   server_add::children) to a user subset and the current permission
   model doesn't include that.  Easiest fix is to restrict to admins.
   Got rid of the server_add permission.

2) We now know check permissions at every level, which means in
   controllers AND in helpers.  This "belt and suspenders" approach will
   give us defense in depth in case we overlook it in one area.

3) We now do CSRF checking in every controller method that changes the
   code, in addition to the Forge auto-check.  Again, defense in depth
   and it makes scanning the code for security much simpler.

4) Moved Simple_Uploader_Controller::convert_filename_to_title to
   item:convert_filename_to_title

5) Fixed a bug in sending notification emails.

6) Fixed the Organize code to verify that you only have access to your
   own tasks.  In general, added permission checks to organize which had
   pretty much no validation code.

I did my best to verify every feature that I touched.
2009-06-01 22:40:22 -07:00
Bharat Mediratta
28b41056e3 Restructure things so that the application is now just another module.
Kohana makes this type of transition fairly straightforward in that
all controllers/helpers/etc are still located in the cascading
filesystem without any extra effort, except that I've temporarily
added a hack to force modules/gallery into the module path.

Rename what's left of "core" to be "application" so that it conforms
more closely to the Kohana standard (basically, just
application/config/config.php which is the minimal thing that you need
in the application directory)

There's still considerable work left to be done here.
2009-05-27 15:07:27 -07:00