Commit Graph

42 Commits

Author SHA1 Message Date
Bharat Mediratta
79582ee5bf Fix up the titles in the default theme. They've been broken for a
while.  This fixes ticket #342.

The bug is that we were using $item instead of $theme->item().  But we
were also not special casing tags properly, and they are effectively
first class citizens (at least for now) so treat them properly.  Also,
set page_title by default in the theme so that we don't have to do an
empty() check on it (makes the theme easier to read) and move the
title out of Tags_Controller so that the theme has more control over
it.
2009-06-15 18:15:41 -07:00
Bharat Mediratta
dd854379c2 Sanitize all data we return via json_encode() to guard against XSS and
other data leaks.
2009-06-03 17:08:23 -07:00
Bharat Mediratta
91c7eb1200 Don't throw an error if there are no visible tags. 2009-06-01 23:00:10 -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
88a3d43ba9 Update all references to the core application to now point to the
gallery module.  This type of mass update is prone to some small bugs.
2009-05-27 16:17:29 -07:00
Tim Almdal
908618960b Since organize is now in the preview stage and will probably be
rewritten by beta2, pull all of its "tenticles" back into itself and
out of core or tags module.
2009-05-26 14:43:31 +00:00
Tim Almdal
ee0bd765b6 Implement a basic tag management interface with the organize drawer 2009-05-22 16:14:42 +00:00
Bharat Mediratta
5495037a3d Gee it's May already. Update copyright to 2009. 2009-05-13 20:04:58 +00:00
Bharat Mediratta
99c26f30c6 Allow users to enter multiple tags at once, split by space, semicolon
or comma.

Fixes ticket #193.
2009-05-13 01:43:47 +00:00
Jakob Hilden
b909132f54 tag changes in the tag admin should now work as expected 2009-03-25 04:47:25 +00:00
Tim Almdal
85f2c6b666 Move the setting of the page title into the controller that is
creating the page.  Provide for a default page title if none is
set. This allows less changes to page.html.php as different modules
want to change the page title.
2009-03-12 16:06:13 +00:00
Tim Almdal
b82b60c91a Rename tag.html.php to dynamic.html.php as part of ticket #115
creating Dynamic Albums.  This name change reflects the usage better
and allows multiple dynamic albums (including tags) to use the same
page template.
2009-03-12 15:40:08 +00:00
Tim Almdal
2b1f68a654 Continue the journey of replacing raw sql with ORM or Database method
calls (Ticket #68)
2009-02-27 00:19:12 +00:00
Andy Staudacher
e4a9b19bf9 Changing t() placeholder syntax from {{replace_me}} to %replace_me. 2009-01-15 10:02:41 +00:00
Andy Staudacher
a631fe29f3 i18n refactoring: Rename all _() (reserved by gettext) calls to t().
- And refactor printf to our string interpolation / pluralization syntax
- Also, a slight change to the translations_incomings table, using binary(16) instead of char(32) as message key.
2009-01-08 17:13:06 +00:00
Bharat Mediratta
3381f1d01a Put up an error if you try to reuse an existing tag name 2009-01-04 22:58:18 +00:00
Bharat Mediratta
92ceef27da Allow renaming of tags using a modal dialog. Put up a confirmation
dialog for deleting tags.  Remove the 4 character restriction on tags
(it was getting ignored by the add form anyway since it was mistakenly
referred to as tag_name there).
2009-01-04 08:44:06 +00:00
Bharat Mediratta
2c27469412 Simple admin tags interface. 2009-01-04 01:55:59 +00:00
Bharat Mediratta
6ab195854d Remove rest::JSON content type; it's causing lots of problems and it doesn't directly help since text/html works just as well for our JSON communications 2008-12-29 22:41:53 +00:00
Bharat Mediratta
fdc0f83024 Big round of normalization of the way that our controllers
communicate.  Almost all controllers now use JSON to speak to the
theme when we're dealing with form processing.  This means tht we only
send the form back and forth, but we use a JSON protocol to tell the
browser success/error status as well as the location of any newly
created resources, or where the browser should redirect the user.

Lots of small changes:
1) Admin -> Edit Profile is gone.  Instead I fixed the "Modify Profile" link
   in the top right corner to be a modal dialog

2) We use json_encode everywhere.  No more Atom/XML for now.  We can bring those
   back later, though.  For now there's a lot of code duplication but that'll be
   easy to clean up.

3) REST_Controller is no longer abstract.   All methods its subclasses should create
   throw exceptions, which means that subclasses don't have to implement stubs for
   those methods.

4) New pattern: helper method get_add_form calls take an Item_Model,
   not an id since we have to load the Item_Model in the controller
   anyway to check permissions.

5) User/Groups REST resources are separate from User/Group in the site
   admin.  They do different things, we should avoid confusing overlap.
2008-12-25 05:12:46 +00:00
Bharat Mediratta
fd49c74607 Convert tag module over to returning JSON. 2008-12-25 01:34:17 +00:00
Bharat Mediratta
c7193f9b2e Normalize our Admin controllers so that functions always print out
their results, as opposed to having them return their view back
upstream.  This is a little more code in every controller, but it's
much less magical and more consistent.

Look up the active_theme and active_admin_theme inside the view
itself, no need to do that in the controllers.  This makes view
initialization easier in the controllers.
2008-12-24 04:22:22 +00:00
Bharat Mediratta
b37047ff55 Add Item_Model::viewable() which we can use to restrict any query to
just items viewable by the active user.  Ie:

  ORM::factory("item")
    ->where("name", "foo")
    ->find_all()

Would get all items with the name "foo".

  ORM::factory("item")
    ->viewable()
    ->where("name", "foo")
    ->find_all()

Restricts it to just the set of items that the user is allowed to see.
2008-12-17 22:39:33 +00:00
Tim Almdal
1c279887aa Should be get_var not set_var 2008-12-14 03:48:32 +00:00
Bharat Mediratta
d480778108 Don't have to check if the item is loaded now, access::can will guard against unloaded items 2008-12-13 19:49:58 +00:00
Bharat Mediratta
65e237a59a Fix security pattern. We can't successfully call access::can unless the item is loaded. 2008-12-13 09:53:36 +00:00
Tim Almdal
e7a763a8c2 Add permission check on the tag add controller, in case some bypasses the view and tries to access the controller directly. 2008-12-13 08:27:14 +00:00
Tim Almdal
fc3fd3321d Add a permissions check to determine if the active user has edit permission on the item in order to display the tag add form 2008-12-13 07:49:27 +00:00
Tim Almdal
942dbe175c Remove a couple of todo's by store the "theme name", "admin theme name" and "page size" in the vars table and initializing when the core module is installed 2008-12-12 19:39:38 +00:00
Tim Almdal
bac4ff2046 1) Create a Theme_View class that combines the functionality of the Theme class with the View class.
2) Only define the form.html.php::DrawForm method once if there are multiple forms on the page (i.e. comments and add tags)
2008-11-27 16:19:07 +00:00
Bharat Mediratta
3992dad486 Move form generation off into tag::get_add_form(). We can't use a controller to generate the form (it's incompatible with our REST model where controllers print stuff) 2008-11-27 06:25:21 +00:00
Bharat Mediratta
d16790de0c Get rid of the placeholder "add tags here..." text, and clear the form
on submit.
2008-11-27 05:45:17 +00:00
Bharat Mediratta
72d16756b1 Refactor cloud generation into a helper so that we can call it from
Tags_Controller::_index().  This enables our Ajax code to reload the
tags block after we submit a new tag, so update the JS to do that
properly.
2008-11-27 05:37:20 +00:00
Bharat Mediratta
5447b83210 Clean up REST pattern in tags:
1) Generate the form in Tags_Controller::_form_add()
2) Process the form submit in Tags_Controller::_create()
3) Create the tag properly

This required me to limit our scope to adding one tag at a time, which
I think is fine if we're doing Ajax style tag addition.
2008-11-27 05:00:50 +00:00
Tim Almdal
b4b72b284b We are now submitting the ajax tag add form to the server correctly and rehooking the ajaxForm 2008-11-27 01:48:01 +00:00
Tim Almdal
d881c91e0c Trying to add tags, but it doesn't work yet. For some reason that i can't figure out, the form never validates and I never get into the true branch of the if. I'm taking a break for awhile. 2008-11-27 00:26:04 +00:00
Bharat Mediratta
974f9f7788 Add a new "tag" page type.
Create the concept of "page types" which let us specify the kind of
page that we're rendering in high level terms.  Currently there are
three page types: album, photo and tag.

The tag page type uses slightly different variables.  It has a $tag
but no $item.  Adjust all sidebar_block() functions to avoid printing
stuff that's dependent on the item if there is no item.

Simplify the tag code to stop trying to fake an item.

Update the theme slightly to use $item and $tag where appropriate
(notably, for making the <title> element).
2008-11-26 21:50:45 +00:00
Bharat Mediratta
9f37aaa1c2 Move Tag_Controller -> Tags_Controller to fit our REST pattern. 2008-11-26 20:40:04 +00:00
Bharat Mediratta
aa19a79e06 Clean up unnecessary comments, remove stray references to Comment_Controller 2008-11-26 20:33:06 +00:00
Tim Almdal
af9a27216d Modify the tag model to behave like a virtual album. There are two outstanding issues that i still have to resolve. The first being there is no thumbnail for the root directory, so it doesn't look quite right. And secondly, the bread crumb shows the dynamic tag album as hot having a parent. I wanted it to be the root directory, but i will overcome :-) 2008-11-26 16:48:00 +00:00
Tim Almdal
03bf3a6af2 Remove the more or less links 2008-11-26 05:08:43 +00:00
Tim Almdal
1ea0382f53 Moving right along on tags. Now the threshold for which tags can be changed. The default is to show all the tags (i.e. count >= the minimum frequency) by clicking on the "See Less" link, the tag cloud will not show the minimum frequency, so the number of tags shown is smaller.
The "See More" link works the opposite way.
2008-11-25 22:38:11 +00:00