From 1a0dc96e77fa00b4ae39b804155ef3786e425fd4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 22 Dec 2009 21:31:03 -0800 Subject: [PATCH 01/25] First pass at upgrading contrib code to the Kohana 2.4 standards. Here's a summary of the changes I made: 1) html::specialchars --> html::chars 2) ORM::orderby() -> ORM::order_by() 3) ORM::where() now takes 3 parameters including a comparator. So ORM::where("a", $b) is now ORM::where("a", "=", $b) and the middle value can be any comparator. 4) ORM::$loaded --> ORM::loaded() 5) Database::instance() --> db::build() (and there are some other subtle differences, like now you always call execute() at the end of the chain) 6) form::close() and form::close_fieldset() are now gone. Use and respectively. 7) Controller::$input is gone. Use Input::instance() instead. I've done very rudimentary testing so far. --- modules/atom/libraries/Atom_Entry.php | 2 +- modules/atom/libraries/Gallery_Atom_Entry.php | 2 +- modules/atom/libraries/Gallery_Atom_Feed.php | 2 +- .../basket/controllers/admin_configure.php | 2 +- .../controllers/admin_postage_bands.php | 20 +-- .../controllers/admin_product_lines.php | 20 +-- modules/basket/controllers/basket.php | 2 +- modules/basket/helpers/basket_event.php | 20 +-- modules/basket/helpers/postage_band.php | 4 +- modules/basket/helpers/product.php | 36 +++--- modules/basket/models/postage_band.php | 2 +- modules/basket/models/product.php | 2 +- modules/batchtag/controllers/batchtag.php | 20 +-- .../calendarview/controllers/calendarview.php | 78 ++++++------ modules/calendarview/libraries/Calendar.php | 2 +- .../views/calendarview_year.html.php | 118 +++++++++--------- .../contactowner/controllers/contactowner.php | 20 +-- .../helpers/contactowner_block.php | 26 ++-- .../developer/controllers/admin_developer.php | 8 +- modules/developer/helpers/developer_task.php | 4 +- .../developer/views/developer_module.html.php | 3 +- .../displaytags/helpers/displaytags_block.php | 10 +- modules/dynamic/controllers/dynamic.php | 6 +- .../itemchecksum/controllers/itemchecksum.php | 32 ++--- .../latestalbums/helpers/latestalbums_rss.php | 8 +- .../controllers/latestupdates.php | 56 ++++----- .../helpers/metadescription_theme.php | 4 +- .../helpers/minislideshow_event.php | 6 +- .../register/controllers/admin_register.php | 4 +- modules/register/controllers/register.php | 12 +- modules/register/helpers/register.php | 4 +- .../register/views/admin_register.html.php | 118 +++++++++--------- modules/rescue/helpers/rescue_task.php | 33 +++-- modules/rwinfo/helpers/rwinfo_theme.php | 2 +- modules/rwinfo/views/rwinfo_block.html.php | 2 +- modules/tagfaces/controllers/tagfaces.php | 46 +++---- modules/tagfaces/helpers/tagfaces_event.php | 14 +-- modules/tagfaces/helpers/tagfaces_theme.php | 6 +- .../views/drawfaces_highlight_block.html.php | 30 ++--- modules/tagsmap/controllers/admin_tagsmap.php | 44 +++---- modules/tagsmap/views/admin_tagsmap.html.php | 4 +- .../user_homes/helpers/user_homes_event.php | 25 ++-- themes/greydragon/helpers/exif_event.php | 5 +- themes/three_nids/controllers/three_nids.php | 6 +- themes/three_nids/helpers/three_nids.php | 6 +- 45 files changed, 447 insertions(+), 429 deletions(-) diff --git a/modules/atom/libraries/Atom_Entry.php b/modules/atom/libraries/Atom_Entry.php index 70bc6e3a..ceb5738e 100644 --- a/modules/atom/libraries/Atom_Entry.php +++ b/modules/atom/libraries/Atom_Entry.php @@ -36,7 +36,7 @@ class Atom_Entry_Core extends Atom_Base { } public function content($text, $type="html") { - $content = $this->dom->createElement("content", html::specialchars($text)); + $content = $this->dom->createElement("content", html::chars($text)); $content->setAttribute("type", $type); $this->element->appendChild($content); return $this; diff --git a/modules/atom/libraries/Gallery_Atom_Entry.php b/modules/atom/libraries/Gallery_Atom_Entry.php index ee5abd07..ab6e655c 100644 --- a/modules/atom/libraries/Gallery_Atom_Entry.php +++ b/modules/atom/libraries/Gallery_Atom_Entry.php @@ -27,7 +27,7 @@ class Gallery_Atom_Entry_Core extends Atom_Entry { parent::__construct("entry"); /* Set feed ID and self link. */ - $this->id(html::specialchars(url::abs_current())); + $this->id(html::chars(url::abs_current())); $this->link() ->rel("self") ->href(url::abs_current()); diff --git a/modules/atom/libraries/Gallery_Atom_Feed.php b/modules/atom/libraries/Gallery_Atom_Feed.php index ba44f15a..138421a2 100644 --- a/modules/atom/libraries/Gallery_Atom_Feed.php +++ b/modules/atom/libraries/Gallery_Atom_Feed.php @@ -27,7 +27,7 @@ class Gallery_Atom_Feed_Core extends Atom_Feed { parent::__construct("feed"); /* Set feed ID and self link. */ - $this->id(html::specialchars(url::abs_current())); + $this->id(html::chars(url::abs_current())); $this->link() ->rel("self") ->href(url::abs_current()); diff --git a/modules/basket/controllers/admin_configure.php b/modules/basket/controllers/admin_configure.php index 58a246ea..f01be179 100644 --- a/modules/basket/controllers/admin_configure.php +++ b/modules/basket/controllers/admin_configure.php @@ -48,7 +48,7 @@ class Admin_Configure_Controller extends Controller $view->content->form = $form; - //$view->content->products = ORM::factory("product")->orderby("name")->find_all(); + //$view->content->products = ORM::factory("product")->order_by("name")->find_all(); print $view; } diff --git a/modules/basket/controllers/admin_postage_bands.php b/modules/basket/controllers/admin_postage_bands.php index f843d0ca..8e13a587 100644 --- a/modules/basket/controllers/admin_postage_bands.php +++ b/modules/basket/controllers/admin_postage_bands.php @@ -27,7 +27,7 @@ class Admin_Postage_Bands_Controller extends Controller { $view = new Admin_View("admin.html"); $view->content = new View("admin_postage_bands.html"); - $view->content->postage_bands = ORM::factory("postage_band")->orderby("name")->find_all(); + $view->content->postage_bands = ORM::factory("postage_band")->order_by("name")->find_all(); print $view; } @@ -43,8 +43,8 @@ class Admin_Postage_Bands_Controller extends Controller $form = postage_band::get_add_form_admin(); $valid = $form->validate(); $name = $form->add_postage->inputs["name"]->value; - $postage = ORM::factory("postage_band")->where("name", $name)->find(); - if ($postage->loaded) { + $postage = ORM::factory("postage_band")->where("name", "=", $name)->find(); + if ($postage->loaded()) { $form->add_postage->inputs["name"]->add_error("in_use", 1); $valid = false; } @@ -68,7 +68,7 @@ class Admin_Postage_Bands_Controller extends Controller public function delete_postage_band_form($id) { $postage = ORM::factory("postage_band", $id); - if (!$postage->loaded) { + if (!$postage->loaded()) { kohana::show_404(); } print postage_band::get_delete_form_admin($postage); @@ -82,7 +82,7 @@ class Admin_Postage_Bands_Controller extends Controller } $postage = ORM::factory("postage_band", $id); - if (!$postage->loaded) { + if (!$postage->loaded()) { kohana::show_404(); } @@ -105,7 +105,7 @@ class Admin_Postage_Bands_Controller extends Controller access::verify_csrf(); $postage = ORM::factory("postage_band", $id); - if (!$postage->loaded) { + if (!$postage->loaded()) { kohana::show_404(); } @@ -115,10 +115,10 @@ class Admin_Postage_Bands_Controller extends Controller $new_name = $form->edit_postage->inputs["name"]->value; if ($new_name != $postage->name && ORM::factory("postage_band") - ->where("name", $new_name) - ->where("id !=", $postage->id) + ->where("name", "=", $new_name) + ->where("id", "<>", $postage->id) ->find() - ->loaded) { + ->loaded()) { $form->edit_postage->inputs["name"]->add_error("in_use", 1); $valid = false; } else { @@ -142,7 +142,7 @@ class Admin_Postage_Bands_Controller extends Controller public function edit_postage_band_form($id) { $postage = ORM::factory("postage_band", $id); - if (!$postage->loaded) { + if (!$postage->loaded()) { kohana::show_404(); } diff --git a/modules/basket/controllers/admin_product_lines.php b/modules/basket/controllers/admin_product_lines.php index f063ad36..def6654e 100644 --- a/modules/basket/controllers/admin_product_lines.php +++ b/modules/basket/controllers/admin_product_lines.php @@ -27,7 +27,7 @@ class Admin_Product_Lines_Controller extends Controller { $view = new Admin_View("admin.html"); $view->content = new View("admin_product_lines.html"); - $view->content->products = ORM::factory("product")->orderby("name")->find_all(); + $view->content->products = ORM::factory("product")->order_by("name")->find_all(); print $view; } @@ -43,8 +43,8 @@ class Admin_Product_Lines_Controller extends Controller $form = product::get_add_form_admin(); $valid = $form->validate(); $name = $form->add_product->inputs["name"]->value; - $product = ORM::factory("product")->where("name", $name)->find(); - if ($product->loaded) { + $product = ORM::factory("product")->where("name", "=", $name)->find(); + if ($product->loaded()) { $form->add_product->inputs["name"]->add_error("in_use", 1); $valid = false; } @@ -69,7 +69,7 @@ class Admin_Product_Lines_Controller extends Controller public function delete_product_form($id) { $product = ORM::factory("product", $id); - if (!$product->loaded) { + if (!$product->loaded()) { kohana::show_404(); } print product::get_delete_form_admin($product); @@ -83,7 +83,7 @@ class Admin_Product_Lines_Controller extends Controller } $product = ORM::factory("product", $id); - if (!$product->loaded) { + if (!$product->loaded()) { kohana::show_404(); } @@ -106,7 +106,7 @@ class Admin_Product_Lines_Controller extends Controller access::verify_csrf(); $product = ORM::factory("product", $id); - if (!$product->loaded) { + if (!$product->loaded()) { kohana::show_404(); } @@ -116,10 +116,10 @@ class Admin_Product_Lines_Controller extends Controller $new_name = $form->edit_product->inputs["name"]->value; if ($new_name != $product->name && ORM::factory("product") - ->where("name", $new_name) - ->where("id !=", $product->id) + ->where("name", "=", $new_name) + ->where("id", "<>", $product->id) ->find() - ->loaded) { + ->loaded()) { $form->edit_product->inputs["name"]->add_error("in_use", 1); $valid = false; } else { @@ -144,7 +144,7 @@ class Admin_Product_Lines_Controller extends Controller public function edit_product_form($id) { $product = ORM::factory("product", $id); - if (!$product->loaded) { + if (!$product->loaded()) { kohana::show_404(); } diff --git a/modules/basket/controllers/basket.php b/modules/basket/controllers/basket.php index 12841cde..bf788312 100644 --- a/modules/basket/controllers/basket.php +++ b/modules/basket/controllers/basket.php @@ -205,7 +205,7 @@ Items Ordered: // get the item to add $item = ORM::factory("item", $id); - if (!$item->loaded) + if (!$item->loaded()) { //TODO die("Not loaded id"); diff --git a/modules/basket/helpers/basket_event.php b/modules/basket/helpers/basket_event.php index ade43e96..a4093952 100644 --- a/modules/basket/helpers/basket_event.php +++ b/modules/basket/helpers/basket_event.php @@ -49,9 +49,9 @@ class basket_event_Core{ static function item_edit_form($item, $form){ $group = $form->group("products")->label(t("Available Products")); - $product_override = ORM::factory("product_override")->where('item_id', $item->id)->find(); + $product_override = ORM::factory("product_override")->where('item_id', "=", $item->id)->find(); $group->checkbox("all")->label("No products except.."); - if ($product_override->loaded){ + if ($product_override->loaded()){ $group->all->checked($product_override->none); } @@ -63,11 +63,11 @@ class basket_event_Core{ $cost = $product->cost; $checked = false; - if ($product_override->loaded){ + if ($product_override->loaded()){ $item_product = ORM::factory("item_product") - ->where('product_override_id', $product_override->id) - ->where('product_id', $product->id)->find(); - if ($item_product->loaded){ + ->where('product_override_id', "=", $product_override->id) + ->where('product_id', "=", $product->id)->find(); + if ($item_product->loaded()){ $checked = $item_product->include; if ($item_product->cost != -1){ $cost = $item_product->cost; @@ -82,7 +82,7 @@ class basket_event_Core{ } static function item_edit_form_completed($item, $form){ - $product_override = ORM::factory("product_override")->where('item_id', $item->id)->find(); + $product_override = ORM::factory("product_override")->where('item_id', "=", $item->id)->find(); if ($form->products->all->checked) { @@ -93,8 +93,8 @@ class basket_event_Core{ foreach ($products as $product){ $p_group = $form->products->__get("product_$product->id"); $item_product = ORM::factory("item_product") - ->where('product_override_id', $product_override->id) - ->where('product_id', $product->id)->find(); + ->where('product_override_id', "=", $product_override->id) + ->where('product_id', "=", $product->id)->find(); $item_product->include = $p_group->__get("exclude_$product->id")->checked; $item_product->cost = $p_group->__get("cost_$product->id")->value; @@ -105,7 +105,7 @@ class basket_event_Core{ } else { - if ($product_override->loaded){ + if ($product_override->loaded()){ $product_override->delete(); } } diff --git a/modules/basket/helpers/postage_band.php b/modules/basket/helpers/postage_band.php index b69f84c4..4a59d4a4 100644 --- a/modules/basket/helpers/postage_band.php +++ b/modules/basket/helpers/postage_band.php @@ -67,8 +67,8 @@ class postage_band_Core { * @return User_Model */ static function create($name, $flatrate, $peritemcost) { - $postage = ORM::factory("postage_band")->where("name", $name)->find(); - if ($postage->loaded) { + $postage = ORM::factory("postage_band")->where("name", "=", $name)->find(); + if ($postage->loaded()) { throw new Exception("@todo postage already EXISTS $name"); } diff --git a/modules/basket/helpers/product.php b/modules/basket/helpers/product.php index 8811d28e..e02cd70c 100644 --- a/modules/basket/helpers/product.php +++ b/modules/basket/helpers/product.php @@ -74,8 +74,8 @@ class product_Core { * @return User_Model */ static function create($name, $cost, $description, $postage_band) { - $product = ORM::factory("product")->where("name", $name)->find(); - if ($product->loaded) { + $product = ORM::factory("product")->where("name", "=", $name)->find(); + if ($product->loaded()) { throw new Exception("@todo USER_ALREADY_EXISTS $name"); } @@ -90,9 +90,9 @@ class product_Core { static function getProductArray($id){ $producta = array(); // check for product override - $product_override = ORM::factory("product_override")->where('item_id', $id)->find(); + $product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find(); - if (!$product_override->loaded){ + if (!$product_override->loaded()){ // no override found so check parents // check parents for product override $item = ORM::factory("item",$id); @@ -100,8 +100,8 @@ class product_Core { $parents = $item->parents(); foreach ($parents as $parent){ // check for product override - $product_override = ORM::factory("product_override")->where('item_id', $parent->id)->find(); - if ($product_override->loaded){ + $product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find(); + if ($product_override->loaded()){ break; } } @@ -111,13 +111,13 @@ class product_Core { foreach ($products as $product){ $show = true; $cost = $product->cost; - if ($product_override->loaded){ + if ($product_override->loaded()){ $show = !$product_override->none; $item_product = ORM::factory("item_product") - ->where('product_override_id', $product_override->id) - ->where('product_id', $product->id)->find(); + ->where('product_override_id', "=", $product_override->id) + ->where('product_id', "=", $product->id)->find(); - if ($item_product->loaded){ + if ($item_product->loaded()){ $cost = $item_product->cost; if (!$show){ $show = $item_product->include; @@ -137,9 +137,9 @@ class product_Core { static function isForSale($id){ // check for product override - $product_override = ORM::factory("product_override")->where('item_id', $id)->find(); + $product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find(); - if (!$product_override->loaded){ + if (!$product_override->loaded()){ // no override found so check parents // check parents for product override $item = ORM::factory("item",$id); @@ -147,8 +147,8 @@ class product_Core { $parents = $item->parents(); foreach ($parents as $parent){ // check for product override - $product_override = ORM::factory("product_override")->where('item_id', $parent->id)->find(); - if ($product_override->loaded){ + $product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find(); + if ($product_override->loaded()){ break; } } @@ -156,15 +156,15 @@ class product_Core { $products = ORM::factory("product")->find_all(); - if ($product_override->loaded && $product_override->none){ + if ($product_override->loaded() && $product_override->none){ foreach ($products as $product){ $item_product = ORM::factory("item_product") - ->where('product_override_id', $product_override->id) - ->where('product_id', $product->id)->find(); + ->where('product_override_id', "=", $product_override->id) + ->where('product_id', "=", $product->id)->find(); - if ($item_product->loaded){ + if ($item_product->loaded()){ if ($item_product->include){ return true; diff --git a/modules/basket/models/postage_band.php b/modules/basket/models/postage_band.php index 83eb6e08..d2595d67 100644 --- a/modules/basket/models/postage_band.php +++ b/modules/basket/models/postage_band.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Postage_Band_Model extends ORM { - var $rules = array( + var $form_rules = array( "name" => "length[1,32]"); protected $has_many=array('products'); diff --git a/modules/basket/models/product.php b/modules/basket/models/product.php index 2bd6a59b..5c1ff1dd 100644 --- a/modules/basket/models/product.php +++ b/modules/basket/models/product.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Product_Model extends ORM { - var $rules = array( + var $form_rules = array( "name" => "length[1,32]", "description" => "length[0,255]"); protected $belongs_to=array('postage_band'); diff --git a/modules/batchtag/controllers/batchtag.php b/modules/batchtag/controllers/batchtag.php index e4bbbf73..db4b081f 100644 --- a/modules/batchtag/controllers/batchtag.php +++ b/modules/batchtag/controllers/batchtag.php @@ -24,22 +24,24 @@ class BatchTag_Controller extends Controller { // Prevent Cross Site Request Forgery access::verify_csrf(); + $input = Input::instance(); + // Figure out if the contents of sub-albums should also be tagged - $str_tag_subitems = Input::instance()->post("tag_subitems"); + $str_tag_subitems = $input->post("tag_subitems"); $children = ""; if ($str_tag_subitems == false) { // Generate an array of all non-album items in the current album. $children = ORM::factory("item") - ->where("parent_id", $this->input->post("item_id")) - ->where("type !=", "album") - ->find_all(); + ->where("parent_id", "=", $input->post("item_id")) + ->where("type", "!=", "album") + ->find_all(); } else { // Generate an array of all non-album items in the current album // and any sub albums. - $children = ORM::factory("item", $this->input->post("item_id")) - ->where("type !=", "album") - ->descendants(); + $children = ORM::factory("item", $input->post("item_id")) + ->where("type", "!=", "album") + ->descendants(); } // Loop through each item in the album and make sure the user has @@ -50,7 +52,7 @@ class BatchTag_Controller extends Controller { // Assuming the user can view/edit the current item, loop // through each tag that was submitted and apply it to // the current item. - foreach (split(",", $this->input->post("name")) as $tag_name) { + foreach (split(",", $input->post("name")) as $tag_name) { $tag_name = trim($tag_name); if ($tag_name) { tag::add($child, $tag_name); @@ -60,7 +62,7 @@ class BatchTag_Controller extends Controller { } // Redirect back to the album. - $item = ORM::factory("item", $this->input->post("item_id")); + $item = ORM::factory("item", $input->post("item_id")); url::redirect(url::abs_site("{$item->type}s/{$item->id}")); } } diff --git a/modules/calendarview/controllers/calendarview.php b/modules/calendarview/controllers/calendarview.php index 457089fd..f5502b9b 100644 --- a/modules/calendarview/controllers/calendarview.php +++ b/modules/calendarview/controllers/calendarview.php @@ -50,18 +50,18 @@ class CalendarView_Controller extends Controller { if ($display_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() - ->where("owner_id", $display_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) + ->where("owner_id", "=", $display_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) ->find_all() ->count(); } @@ -88,19 +88,19 @@ class CalendarView_Controller extends Controller { if ($display_user == "-1") { $template->set_global("children", ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) - ->orderby("captured", "ASC") + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) + ->order_by("captured", "ASC") ->find_all($page_size, $offset)); } else { $template->set_global("children", ORM::factory("item") ->viewable() - ->where("owner_id", $display_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) - ->orderby("captured", "ASC") + ->where("owner_id", "=", $display_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year)) + ->order_by("captured", "ASC") ->find_all($page_size, $offset)); } @@ -126,18 +126,18 @@ class CalendarView_Controller extends Controller { if ($display_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() - ->where("owner_id", $display_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year)) + ->where("owner_id", "=", $display_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year)) ->find_all() ->count(); } @@ -164,19 +164,19 @@ class CalendarView_Controller extends Controller { if ($display_user == "-1") { $template->set_global("children", ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year)) - ->orderby("captured", "ASC") + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year)) + ->order_by("captured", "ASC") ->find_all($page_size, $offset)); } else { $template->set_global("children", ORM::factory("item") ->viewable() - ->where("owner_id", $display_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year)) - ->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year)) - ->orderby("captured", "ASC") + ->where("owner_id", "=", $display_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year)) + ->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year)) + ->order_by("captured", "ASC") ->find_all($page_size, $offset)); } @@ -204,9 +204,9 @@ class CalendarView_Controller extends Controller { foreach ($gallery_users as $one_user) { $count = ORM::factory("item") ->viewable() - ->where("owner_id", $one_user->id) - ->where("type !=", "album") - ->where("captured !=", "") + ->where("owner_id", "=", $one_user->id) + ->where("type", "!=", "album") + ->where("captured", "!=", "") ->find_all() ->count(); if ($count > 0) { @@ -219,10 +219,10 @@ class CalendarView_Controller extends Controller { $valid_years = Array(); $all_photos = ORM::factory("item") ->viewable() - //->where("owner_id", $one_user->id) - ->where("type !=", "album") - ->where("captured !=", "") - ->orderby("captured", "DESC") + //->where("owner_id", "=", $one_user->id) + ->where("type", "!=", "album") + ->where("captured", "!=", "") + ->order_by("captured", "DESC") ->find_all(); $counter = date('Y', $all_photos[count($all_photos)-1]->captured); while ($counter <= date('Y', $all_photos[0]->captured)) { diff --git a/modules/calendarview/libraries/Calendar.php b/modules/calendarview/libraries/Calendar.php index 193a6fb1..bc5cd2c5 100644 --- a/modules/calendarview/libraries/Calendar.php +++ b/modules/calendarview/libraries/Calendar.php @@ -59,7 +59,7 @@ class Calendar_Core extends Event_Subject { foreach ($days as $i => $day) { // Shorten the days to the expected length - $days[$i] = utf8::substr($day, 0, $length); + $days[$i] = mb_substr($day, 0, $length); } } diff --git a/modules/calendarview/views/calendarview_year.html.php b/modules/calendarview/views/calendarview_year.html.php index ff25dbff..76f09c4e 100644 --- a/modules/calendarview/views/calendarview_year.html.php +++ b/modules/calendarview/views/calendarview_year.html.php @@ -15,18 +15,18 @@ if ($calendar_user == "-1") { $month_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year)) ->find_all() ->count(); } else { $month_count = ORM::factory("item") ->viewable() ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year)) ->find_all() ->count(); } @@ -39,26 +39,26 @@ if ($calendar_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) ->find_all() ->count(); } if ($day_count > 0) { - $calendar -> attach($calendar -> event() - -> condition('year', $calendar_year) - -> condition('month', $counter_months) - -> condition('day', $curr_day) + $calendar -> attach($calendar -> event() + -> condition('year', $calendar_year) + -> condition('month', $counter_months) + -> condition('day', $curr_day) -> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count))); } $curr_day++; @@ -68,26 +68,26 @@ if ($calendar_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) + ->where("captured", "<",mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() - ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year)) + ->where("owner_id", "=", $calendar_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year)) ->find_all() ->count(); } if ($day_count > 0) { - $calendar -> attach($calendar -> event() - -> condition('year', $calendar_year) - -> condition('month', $counter_months) - -> condition('day', $MAX_DAYS) + $calendar -> attach($calendar -> event() + -> condition('year', $calendar_year) + -> condition('month', $counter_months) + -> condition('day', $MAX_DAYS) -> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count))); } } @@ -98,27 +98,27 @@ } $counter_months++; } - + // Do December seperately, because the mktime code is different. print ""; $calendar = new Calendar($counter_months, $calendar_year); if ($calendar_user == "-1") { $month_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, 1, 1, ($calendar_year + 1))) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1))) ->find_all() ->count(); } else { $month_count = ORM::factory("item") ->viewable() - ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, 1, 1, ($calendar_year + 1))) + ->where("owner_id", "=", $calendar_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1))) ->find_all() - ->count(); + ->count(); } if ($month_count > 0) { $curr_day = 1; @@ -127,26 +127,26 @@ if ($calendar_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() - ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) + ->where("owner_id", "=", $calendar_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year)) ->find_all() ->count(); } if ($day_count > 0) { - $calendar -> attach($calendar -> event() - -> condition('year', $calendar_year) - -> condition('month', $counter_months) - -> condition('day', $curr_day) + $calendar -> attach($calendar -> event() + -> condition('year', $calendar_year) + -> condition('month', $counter_months) + -> condition('day', $curr_day) -> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count))); } $curr_day++; @@ -154,26 +154,26 @@ if ($calendar_user == "-1") { $day_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, 1, 1, $calendar_year+1)) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1)) ->find_all() ->count(); } else { $day_count = ORM::factory("item") ->viewable() - ->where("owner_id", $calendar_user) - ->where("type !=", "album") - ->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) - ->where("captured <", mktime(0, 0, 0, 1, 1, $calendar_year+1)) + ->where("owner_id", "=", $calendar_user) + ->where("type", "!=", "album") + ->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year)) + ->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1)) ->find_all() - ->count(); + ->count(); } if ($day_count > 0) { - $calendar -> attach($calendar -> event() - -> condition('year', $calendar_year) - -> condition('month', $counter_months) - -> condition('day', $MAX_DAYS) + $calendar -> attach($calendar -> event() + -> condition('year', $calendar_year) + -> condition('month', $counter_months) + -> condition('day', $MAX_DAYS) -> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count))); } diff --git a/modules/contactowner/controllers/contactowner.php b/modules/contactowner/controllers/contactowner.php index eda03abf..6894049a 100644 --- a/modules/contactowner/controllers/contactowner.php +++ b/modules/contactowner/controllers/contactowner.php @@ -20,7 +20,7 @@ class ContactOwner_Controller extends Controller { public function emailowner() { // Display a form that a vistor can use to contact the site owner. - + // If this page is disabled, show a 404 error. if (module::get_var("contactowner", "contact_owner_link") != true) { kohana::show_404(); @@ -49,16 +49,16 @@ class ContactOwner_Controller extends Controller { public function emailid($user_id) { // Display a form that a vistor can use to contact a registered user. - + // If this page is disabled, show a 404 error. if (module::get_var("contactowner", "contact_user_link") != true) { kohana::show_404(); } - + // Locate the record for the user specified by $user_id, // use this to determine the user's name. $userDetails = ORM::factory("user") - ->where("id", $user_id) + ->where("id", "=", $user_id) ->find_all(); // Make a new form with a couple of text boxes. @@ -84,16 +84,16 @@ class ContactOwner_Controller extends Controller { public function sendemail() { // Process the data from the form into an email, // then send the email. - + // Copy the data from the email from into a couple of variables. $str_emailsubject = Input::instance()->post("email_subject"); $str_emailtoid = Input::instance()->post("email_to_id"); $str_emailfrom = Input::instance()->post("email_from"); $str_emailbody = Input::instance()->post("email_body"); - + // Add in some
tags to the message body where ever there are line breaks. $str_emailbody = str_replace("\n", "\n
", $str_emailbody); - + // Gallery's Sendmail library doesn't allow for custom from addresses, // so add the from email to the beginning of the message body instead. $str_emailbody = "Message Sent From " . $str_emailfrom . "\r\n\r\n

" . $str_emailbody; @@ -101,17 +101,17 @@ class ContactOwner_Controller extends Controller { // Figure out where the email is going to. $str_emailto = ""; if ($str_emailtoid == -1) { - // If the email id is "-1" send the message to a pre-determined + // If the email id is "-1" send the message to a pre-determined // owner email address. $str_emailto = module::get_var("contactowner", "contact_owner_email"); } else { // or else grab the email from the user table. $userDetails = ORM::factory("user") - ->where("id", $str_emailtoid) + ->where("id", "=", $str_emailtoid) ->find_all(); $str_emailto = $userDetails[0]->email; } - + // Send the email message. Sendmail::factory() ->to($str_emailto) diff --git a/modules/contactowner/helpers/contactowner_block.php b/modules/contactowner/helpers/contactowner_block.php index bf01d338..34c4eb53 100644 --- a/modules/contactowner/helpers/contactowner_block.php +++ b/modules/contactowner/helpers/contactowner_block.php @@ -24,19 +24,19 @@ class contactowner_block_Core { static function get($block_id, $theme) { $block = ""; - + switch ($block_id) { case "contact_owner": - + // Create a new block to display the links in. $block = new Block(); $block->css_id = "g-contact-owner"; $block->title = t("Contact"); $block->content = new View("contactowner_block.html"); - + // if $displayBlock is true, this block will be displayed, // if there aren't any links to put in the block for whatever reason - // then $displayBlock will rename set to false and the + // then $displayBlock will rename set to false and the // block will not be displayed. $displayBlock = false; @@ -44,29 +44,29 @@ class contactowner_block_Core { // Locate the record for the user that created the current item. // Their name will be displayed as part of the contact link. $userDetails = ORM::factory("user") - ->where("id", $theme->item->owner_id) + ->where("id", "=", $theme->item->owner_id) ->find_all(); - + // Figure out if the contact item owner email link should be displayed. // only display it if the current owner has an email address and // the option for allowing item owners to be contacted is set to true. - if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && + if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && (module::get_var("contactowner", "contact_user_link") == true)) { - $block->content->userLink = "item->owner_id) . "\">" . t("Contact") . " " . + $block->content->userLink = "item->owner_id) . "\">" . t("Contact") . " " . $userDetails[0]->name . ""; $displayBlock = true; } } - + // Figure out if the contact site owner link should be displayed. if (module::get_var("contactowner", "contact_owner_link")) { - $block->content->ownerLink = "content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . ""; $displayBlock = true; } - - break; + + break; } if ($displayBlock) { diff --git a/modules/developer/controllers/admin_developer.php b/modules/developer/controllers/admin_developer.php index e8d1c426..7d6052bb 100644 --- a/modules/developer/controllers/admin_developer.php +++ b/modules/developer/controllers/admin_developer.php @@ -174,7 +174,7 @@ class Admin_Developer_Controller extends Admin_Controller { } function mptt_graph() { - $items = ORM::factory("item")->orderby("id")->find_all(); + $items = ORM::factory("item")->order_by("id")->find_all(); $data = $this->_build_tree(); $proc = proc_open("/usr/bin/dot -Tsvg", @@ -192,7 +192,7 @@ class Admin_Developer_Controller extends Admin_Controller { } private function _build_tree() { - $items = ORM::factory("item")->orderby("id")->find_all(); + $items = ORM::factory("item")->order_by("id")->find_all(); $data = "digraph G {\n"; foreach ($items as $item) { $data .= " $item->parent_id -> $item->id\n"; @@ -249,8 +249,8 @@ class Admin_Developer_Controller extends Admin_Controller { $v = new View("admin_developer_test_data.html"); $v->action = "admin/developer/test_data_create"; $v->hidden = array("csrf" => access::csrf_token()); - $album_count = ORM::factory("item")->where("type", "album")->count_all(); - $photo_count = ORM::factory("item")->where("type", "photo")->count_all(); + $album_count = ORM::factory("item")->where("type", "=", "album")->count_all(); + $photo_count = ORM::factory("item")->where("type", "=", "photo")->count_all(); $v->comment_installed = module::is_active("comment"); $comment_count = empty($v->comment_installed) ? 0 : ORM::factory("comment")->count_all(); diff --git a/modules/developer/helpers/developer_task.php b/modules/developer/helpers/developer_task.php index 0b004ece..12d990af 100644 --- a/modules/developer/helpers/developer_task.php +++ b/modules/developer/helpers/developer_task.php @@ -183,7 +183,7 @@ class developer_task_Core { private static function _add_album_or_photo($desired_type=null) { srand(time()); - $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array(); + $parents = ORM::factory("item")->where("type", "=", "album")->find_all()->as_array(); $owner_id = user::active()->id; $test_images = glob(dirname(dirname(__FILE__)) . "/data/*.[Jj][Pp][Gg]"); @@ -209,7 +209,7 @@ class developer_task_Core { private static function _add_comment() { srand(time()); - $photos = ORM::factory("item")->where("type", "photo")->find_all()->as_array(); + $photos = ORM::factory("item")->where("type", "=", "photo")->find_all()->as_array(); $users = ORM::factory("user")->find_all()->as_array(); if (empty($photos)) { diff --git a/modules/developer/views/developer_module.html.php b/modules/developer/views/developer_module.html.php index 54eabfb1..4f72ed7c 100644 --- a/modules/developer/views/developer_module.html.php +++ b/modules/developer/views/developer_module.html.php @@ -44,4 +44,5 @@ - + + diff --git a/modules/displaytags/helpers/displaytags_block.php b/modules/displaytags/helpers/displaytags_block.php index 454ff0b6..18018eb6 100644 --- a/modules/displaytags/helpers/displaytags_block.php +++ b/modules/displaytags/helpers/displaytags_block.php @@ -24,7 +24,7 @@ class displaytags_block_Core { static function get($block_id, $theme) { $block = ""; - + // Make sure the current page belongs to an item. if (!$theme->item()) { return; @@ -34,9 +34,9 @@ class displaytags_block_Core { case "display_tags": // Create an array of all the tags for the current item. $tagsItem = ORM::factory("tag") - ->join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $theme->item->id) - ->find_all(); + ->join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", "=", $theme->item->id) + ->find_all(); // If the current item has at least one tag, display it/them. if (count($tagsItem) > 0) { @@ -47,7 +47,7 @@ class displaytags_block_Core { $block->content->tags = $tagsItem; } - break; + break; } return $block; } diff --git a/modules/dynamic/controllers/dynamic.php b/modules/dynamic/controllers/dynamic.php index 568bd2ac..d0263880 100644 --- a/modules/dynamic/controllers/dynamic.php +++ b/modules/dynamic/controllers/dynamic.php @@ -34,7 +34,7 @@ class Dynamic_Controller extends Controller { if (empty($children_count)) { $children_count = ORM::factory("item") ->viewable() - ->where("type !=", "album") + ->where("type", "!=", "album") ->count_all(); } @@ -51,8 +51,8 @@ class Dynamic_Controller extends Controller { $template->set_global("page_size", $page_size); $template->set_global("children", ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->orderby($album_defn->key_field, "DESC") + ->where("type", "!=", "album") + ->order_by($album_defn->key_field, "DESC") ->find_all($page_size, $offset)); $template->set_global("children_count", $children_count); $template->content = new View("dynamic.html"); diff --git a/modules/itemchecksum/controllers/itemchecksum.php b/modules/itemchecksum/controllers/itemchecksum.php index 045d015b..2d3a2fbd 100644 --- a/modules/itemchecksum/controllers/itemchecksum.php +++ b/modules/itemchecksum/controllers/itemchecksum.php @@ -23,29 +23,29 @@ class itemchecksum_Controller extends Controller { // in the specified album ($album_id). $item = ORM::factory("item") ->viewable() - ->where("parent_id", $album_id) - ->where("type !=", "album") + ->where("parent_id", "=", $album_id) + ->where("type", "!=", "album") ->find_all(); - + print count($item); } - + public function md5($album_id, $file_name) { // Locate an item with $file_name in the album $album_id // and display it's md5 checksum. $item = ORM::factory("item") - ->where("parent_id", $album_id) - ->where("name", $file_name) + ->where("parent_id", "=", $album_id) + ->where("name", "=", $file_name) ->find_all(); - + if (count($item) > 0) { access::required("view_full", $item[0]); - // If the KeepOriginal module is active, check for/use the + // If the KeepOriginal module is active, check for/use the // original image instead of the gallery edited version. if (module::is_active("keeporiginal")) { $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path()); - if ($item[0]->is_photo() && file_exists($original_image)) { + if ($item[0]->is_photo() && file_exists($original_image)) { print md5_file($original_image); } else { print md5_file($item[0]->file_path()); @@ -57,24 +57,24 @@ class itemchecksum_Controller extends Controller { print "0"; } } - + public function sha1($album_id, $file_name) { // Locate an item with $file_name in the album $album_id // and display it's sha-1 checksum. - + $item = ORM::factory("item") - ->where("parent_id", $album_id) - ->where("name", $file_name) + ->where("parent_id", "=", $album_id) + ->where("name", "=", $file_name) ->find_all(); - + if (count($item) > 0) { access::required("view_full", $item[0]); - // If the KeepOriginal module is active, check for/use the + // If the KeepOriginal module is active, check for/use the // original image instead of the gallery edited version. if (module::is_active("keeporiginal")) { $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path()); - if ($item[0]->is_photo() && file_exists($original_image)) { + if ($item[0]->is_photo() && file_exists($original_image)) { print sha1_file($original_image); } else { print sha1_file($item[0]->file_path()); diff --git a/modules/latestalbums/helpers/latestalbums_rss.php b/modules/latestalbums/helpers/latestalbums_rss.php index deaf2a0c..d89aa96f 100644 --- a/modules/latestalbums/helpers/latestalbums_rss.php +++ b/modules/latestalbums/helpers/latestalbums_rss.php @@ -29,14 +29,14 @@ class latestalbums_rss_Core { case "latest": $feed->children = ORM::factory("item") ->viewable() - ->where("type", "album") - ->orderby("created", "DESC") + ->where("type", "=", "album") + ->order_by("created", "DESC") ->find_all($limit, $offset); $all_children = ORM::factory("item") ->viewable() - ->where("type", "album") - ->orderby("created", "DESC"); + ->where("type", "=", "album") + ->order_by("created", "DESC"); $feed->max_pages = ceil($all_children->find_all()->count() / $limit); $feed->title = t("Latest albums"); diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php index 58fcd23f..d49026db 100644 --- a/modules/latestupdates/controllers/latestupdates.php +++ b/modules/latestupdates/controllers/latestupdates.php @@ -18,47 +18,47 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class latestupdates_Controller extends Controller { - + public function albums($id) { // Figure out how many items to display on each page. $itemsPerPage = module::get_var("gallery", "page_size", 9); - - // Figure out which page # the visitor is on and + + // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. $page = $this->input->get("page", 1); if ($page < 1) { url::redirect("latestupdates/albums/{$item->id}"); } - + // First item to display. $offset = ($page - 1) * $itemsPerPage; - + // Determine the total number of items, - // for page numbering purposes. + // for page numbering purposes. $count = ORM::factory("item", $id) ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") + ->where("type", "!=", "album") + ->order_by("created", "DESC") ->descendants() ->count(); - + // Figure out what the highest page number is. - $max_pages = ceil($count / $itemsPerPage); - + $max_pages = ceil($count / $itemsPerPage); + // Don't let the visitor go past the last page. if ($max_pages && $page > $max_pages) { url::redirect("latestupdates/albums/{$item->id}?page=$max_pages"); } - + // Figure out which items to display on this page. $children = ORM::factory("item", $id) ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") + ->where("type", "!=", "album") + ->order_by("created", "DESC") ->limit($itemsPerPage) ->offset($offset) - ->descendants(); - + ->descendants(); + // Set up the previous and next page buttons. if ($page > 1) { $previous_page = $page - 1; @@ -84,39 +84,39 @@ class latestupdates_Controller extends Controller { // Figure out how many items to display on each page. $itemsPerPage = module::get_var("gallery", "page_size", 9); - // Figure out which page # the visitor is on and + // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. $page = $this->input->get("page", 1); if ($page < 1) { url::redirect("latestupdates/updates"); } - + // First item to display. $offset = ($page - 1) * $itemsPerPage; - + // Determine the total number of items, - // for page numbering purposes. + // for page numbering purposes. $count = ORM::factory("item") ->viewable() - ->where("type !=", "album") + ->where("type", "!=", "album") ->find_all() ->count(); - + // Figure out what the highest page number is. $max_pages = ceil($count / $itemsPerPage); - + // Don't let the visitor go past the last page. if ($max_pages && $page > $max_pages) { url::redirect("latestupdates/updates?page=$max_pages"); } - + // Figure out which items to display on this page. $items = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") + ->where("type", "!=", "album") + ->order_by("created", "DESC") ->find_all($itemsPerPage, $offset); - + // Set up the previous and next page buttons. if ($page > 1) { $previous_page = $page - 1; @@ -126,7 +126,7 @@ class latestupdates_Controller extends Controller { $next_page = $page + 1; $view->next_page_link = url::site("latestupdates/updates?page={$next_page}"); } - + // Set up and display the actual page. $template = new Theme_View("page.html", "other", "LatestUpdates"); $template->page_title = t("Gallery :: Latest Updates"); diff --git a/modules/metadescription/helpers/metadescription_theme.php b/modules/metadescription/helpers/metadescription_theme.php index d3b13a9e..7083c5c6 100644 --- a/modules/metadescription/helpers/metadescription_theme.php +++ b/modules/metadescription/helpers/metadescription_theme.php @@ -23,7 +23,7 @@ class metadescription_theme_Core { // If the current page belongs to a tag, look up // the information for that tag. $tagsItem = ORM::factory("tag") - ->where("id", $theme->tag()) + ->where("id", "=", $theme->tag()) ->find_all(); } elseif ($theme->item()) { @@ -31,7 +31,7 @@ class metadescription_theme_Core { // look up any tags that have been applied to that item. $tagsItem = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $theme->item->id) + ->where("items_tags.item_id", "=", $theme->item->id) ->find_all(); } else { diff --git a/modules/minislideshow/helpers/minislideshow_event.php b/modules/minislideshow/helpers/minislideshow_event.php index 067b901f..881500f7 100644 --- a/modules/minislideshow/helpers/minislideshow_event.php +++ b/modules/minislideshow/helpers/minislideshow_event.php @@ -27,7 +27,7 @@ class minislideshow_event_Core { ->label(t("MiniSlide Show settings")) ->url(url::site("admin/minislideshow"))); } - + static function module_change($changes) { // Display a warning message if the RSS module is not installed. if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) { @@ -47,7 +47,7 @@ class minislideshow_event_Core { ->append(Menu::factory("link") ->id("minislideshow") ->label(t("View MiniSlide Show")) - ->url(url::site("minislideshow/showslideshow/" . $theme->item())) + ->url(url::site("minislideshow/showslideshow/" . $theme->item()->id)) ->css_class("g-dialog-link") ->css_id("g-mini-slideshow-link")); } @@ -58,7 +58,7 @@ class minislideshow_event_Core { ->append(Menu::factory("link") ->id("minislideshow") ->label(t("View MiniSlide Show")) - ->url(url::site("minislideshow/showslideshow/" . $theme->item())) + ->url(url::site("minislideshow/showslideshow/" . $theme->item()->id)) ->css_class("g-dialog-link") ->css_id("g-mini-slideshow-link")); } diff --git a/modules/register/controllers/admin_register.php b/modules/register/controllers/admin_register.php index 425baf42..2f123b1a 100755 --- a/modules/register/controllers/admin_register.php +++ b/modules/register/controllers/admin_register.php @@ -19,7 +19,7 @@ class Admin_register_Controller extends Admin_Controller { public function index() { $count = ORM::factory("pending_user") - ->where("state !=", 2) + ->where("state", "!=", 2) ->count_all(); if ($count == 0) { site_status::clear("pending_user_registrations"); @@ -66,7 +66,7 @@ class Admin_register_Controller extends Admin_Controller { } $count = ORM::factory("pending_user") - ->where("state != ", 2) + ->where("state", "!=", 2) ->count_all(); if ($count == 0) { diff --git a/modules/register/controllers/register.php b/modules/register/controllers/register.php index c57ea87d..66d420c6 100755 --- a/modules/register/controllers/register.php +++ b/modules/register/controllers/register.php @@ -67,10 +67,10 @@ class register_Controller extends Controller { public function confirm($hash) { $pending_user = ORM::factory("pending_user") - ->where("hash", $hash) - ->where("state", 0) + ->where("hash", "=", $hash) + ->where("state", "=", 0) ->find(); - if ($pending_user->loaded) { + if ($pending_user->loaded()) { // @todo add a request date to the pending user table and check that it hasn't expired $policy = module::get_var("registration", "policy"); $pending_user->state = 1; @@ -96,10 +96,10 @@ class register_Controller extends Controller { public function first($hash) { $pending_user = ORM::factory("pending_user") - ->where("hash", $hash) - ->where("state", 2) + ->where("hash", "=", $hash) + ->where("state", "=", 2) ->find(); - if ($pending_user->loaded) { + if ($pending_user->loaded()) { // @todo add a request date to the pending user table and check that it hasn't expired $user = identity::lookup_user_by_name($pending_user->name); if (!empty($user)) { diff --git a/modules/register/helpers/register.php b/modules/register/helpers/register.php index 09044c6d..159f3237 100644 --- a/modules/register/helpers/register.php +++ b/modules/register/helpers/register.php @@ -32,9 +32,9 @@ class register_Core { return true; } $user = ORM::factory("pending_user") - ->where("name", $user_name) + ->where("name", "=", $user_name) ->find(); - return $user->loaded; + return $user->loaded(); } static function send_user_created_confirmation($user) { diff --git a/modules/register/views/admin_register.html.php b/modules/register/views/admin_register.html.php index 473e68a6..865a8e56 100644 --- a/modules/register/views/admin_register.html.php +++ b/modules/register/views/admin_register.html.php @@ -14,69 +14,69 @@

"post"), $hidden) ?> - - - - - +
+ +
    + $text): ?> +
  • + + +
  • + +
  • + + +
  • +
  • + + + "group"), $group_list, $form["group"]) ?> + +
  • +
  • + "g-registration-admin", "name" => "save", "class" => "submit", "style" => "clear:both!important"), t("Update")) ?> +
  • +
+
+
"post"), $hidden) ?> - - - - - - - - - - - - - - "> - - - - - - - - -
- -
- state != 2): ?> - id) ?> - -   - - state) ?>name) ?>full_name) ?>email) ?>request_date)) ?>
- "g-registration-activate", "name" => "activate_users", "class" => "submit"), t("Activate selected")) ?> - - +
+ + + + + + + + + + + + + "> + + + + + + + + +
+ +
+ state != 2): ?> + id) ?> + +   + + state) ?>name) ?>full_name) ?>email) ?>request_date)) ?>
+ "g-registration-activate", "name" => "activate_users", "class" => "submit"), t("Activate selected")) ?> +
+
diff --git a/modules/rescue/helpers/rescue_task.php b/modules/rescue/helpers/rescue_task.php index 6191e8c0..172bcee7 100644 --- a/modules/rescue/helpers/rescue_task.php +++ b/modules/rescue/helpers/rescue_task.php @@ -42,7 +42,7 @@ class rescue_task_Core { $total = $task->get("total"); if (empty($total)) { - $task->set("total", $total = Database::instance()->count_records("items")); + $task->set("total", $total = db::build()->count_records("items")); $task->set("stack", "1:" . self::LEFT); $task->set("ptr", 1); $task->set("completed", 0); @@ -92,7 +92,7 @@ class rescue_task_Core { $total = $task->get("total"); if (empty($total)) { - $task->set("total", $total = Database::instance()->count_records("items")); + $task->set("total", $total = db::build()->count_records("items")); $task->set("last_id", 0); $task->set("completed", 0); } @@ -101,7 +101,7 @@ class rescue_task_Core { $completed = $task->get("completed"); foreach (ORM::factory("item") - ->where("id >", $last_id) + ->where("id", ">", $last_id) ->find_all(100) as $item) { $item->slug = item::convert_filename_to_slug($item->slug); $item->save(); @@ -120,8 +120,11 @@ class rescue_task_Core { $task->done = true; $task->state = "success"; $task->percent_complete = 100; - Database::instance() - ->query("UPDATE {items} SET `relative_path_cache` = NULL, `relative_url_cache` = NULL"); + db::build() + ->update("items") + ->set("relative_path_cache", null) + ->set("relative_url_cache", null) + ->execute(); } else { $task->percent_complete = round(100 * $completed / $total); } @@ -130,19 +133,27 @@ class rescue_task_Core { } static function children($parent_id) { - return Database::instance() + return db::build() ->select("id") ->from("items") - ->where("parent_id", $parent_id) - ->orderby("left_ptr", "ASC") - ->get(); + ->where("parent_id", "=", $parent_id) + ->order_by("left_ptr", "ASC") + ->execute(); } static function set_left($id, $value) { - Database::instance()->update("items", array("left_ptr" => $value), array("id" => $id)); + db::build() + ->update("items") + ->set("left_ptr", $value) + ->where("id", "=", $id) + ->execute(); } static function set_right($id, $value) { - Database::instance()->update("items", array("right_ptr" => $value), array("id" => $id)); + db::build() + ->update("items") + ->set("right_ptr", $value) + ->where("id", "=", $id) + ->execute(); } } diff --git a/modules/rwinfo/helpers/rwinfo_theme.php b/modules/rwinfo/helpers/rwinfo_theme.php index b1b6fb6c..6c3574be 100644 --- a/modules/rwinfo/helpers/rwinfo_theme.php +++ b/modules/rwinfo/helpers/rwinfo_theme.php @@ -30,7 +30,7 @@ class rwinfo_theme_Core { if (module::is_active("tag")) { $tagsItem = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $item->id) + ->where("items_tags.item_id", "=", $item->id) ->find_all(); if (count($tagsItem) > 0) { $results .= "
  • "; diff --git a/modules/rwinfo/views/rwinfo_block.html.php b/modules/rwinfo/views/rwinfo_block.html.php index 8e3b36f6..a6aeb19c 100644 --- a/modules/rwinfo/views/rwinfo_block.html.php +++ b/modules/rwinfo/views/rwinfo_block.html.php @@ -35,7 +35,7 @@ join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $item->id) + ->where("items_tags.item_id", "=", $item->id) ->find_all(); ?> 0): ?> diff --git a/modules/tagfaces/controllers/tagfaces.php b/modules/tagfaces/controllers/tagfaces.php index 7fb5e47a..d202350d 100644 --- a/modules/tagfaces/controllers/tagfaces.php +++ b/modules/tagfaces/controllers/tagfaces.php @@ -20,12 +20,12 @@ class tagfaces_Controller extends Controller { public function drawfaces($id) { // Generate the page that allows the user to draw boxes over a photo. - + // Make sure user has access to view and edit the photo. $item = ORM::factory("item", $id); access::required("view", $item); access::required("edit", $item); - + // Create the page. $template = new Theme_View("page.html", "other", "drawfaces"); $template->set_global("item_id", $id); @@ -46,11 +46,11 @@ class tagfaces_Controller extends Controller { // Prevent Cross Site Request Forgery access::verify_csrf(); - + // Convert submitted data to local variables. $tag_data = Input::instance()->post("facesList"); $item_data = Input::instance()->post("item_id"); - + // If the user didn't select a tag, display and error and abort. if (count($tag_data) == 0) { message::error(t("Please select a tag.")); @@ -61,22 +61,22 @@ class tagfaces_Controller extends Controller { // Delete the face(s) from the database. foreach ($tag_data as $one_tag) { ORM::factory("items_face") - ->where("id", $one_tag) + ->where("id", "=", $one_tag) ->delete_all(); } - + // Display a success message. if (count($tag_data) == 1) { message::success(t("One face deleted.")); } else { message::success(count($tag_data) . t(" faces deleted.")); - } + } url::redirect("tagfaces/drawfaces/$item_data"); } - + public function saveface() { // Save the face coordinates to the specified tag. - + // Prevent Cross Site Request Forgery access::verify_csrf(); @@ -89,7 +89,7 @@ class tagfaces_Controller extends Controller { $str_y1 = Input::instance()->post("y"); $str_x2 = Input::instance()->post("x2"); $str_y2 = Input::instance()->post("y2"); - + // If the user didn't select a face, display an error and abort. if (($str_x1 == "") || ($str_x2 == "") || ($str_y1 == "") || ($str_y2 == "")) { message::error(t("Please select a face.")); @@ -105,7 +105,7 @@ class tagfaces_Controller extends Controller { url::redirect("tagfaces/drawfaces/$item_data"); return; } - + // Save a new Note to the database. $newnote = ORM::factory("items_note"); $newnote->item_id = $item_data; @@ -116,12 +116,12 @@ class tagfaces_Controller extends Controller { $newnote->title = $str_face_title; $newnote->description = $str_face_description; $newnote->save(); - + } else { // Check to see if the tag already has a face associated with it. $existingFace = ORM::factory("items_face") - ->where("tag_id", $tag_data) - ->where("item_id", $item_data) + ->where("tag_id", "=", $tag_data) + ->where("item_id", "=", $item_data) ->find_all(); if (count($existingFace) == 0) { @@ -156,7 +156,7 @@ class tagfaces_Controller extends Controller { // Generate the form that allows the user to select a tag to // save the face too. Also displays the coordinates of the face // and the "Save face" button. - + // Make a new Form. $form = new Forge("tagfaces/saveface", "", "post", array("id" => "g-tag-faces-form")); @@ -164,7 +164,7 @@ class tagfaces_Controller extends Controller { // Create an array of all the tags for the current item. $all_tags = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", $id) + ->where("items_tags.item_id", "=", $id) ->find_all(); // Generate an array of tags to use as checkboxes. @@ -177,18 +177,18 @@ class tagfaces_Controller extends Controller { // Make a checklist of tags on the form. $tags_group = $form->group("FaceTag") ->label(t("Select a tag or enter in a title:")); - + $tags_group->dropdown('tagsList') ->label(t("Select a tag:")) ->options($array_tags); $tags_group->input("face_title") ->label(t("Title")); - + $tags_description = $form->group("TagsDescription") ->label(t("Description (optional):")); $tags_description->input("face_description"); - + // Generate input boxes to hold the coordinates of the face. $coordinates_group = $form->group("FaceCoordinates") ->label(t("Coordinates:")); @@ -212,21 +212,21 @@ class tagfaces_Controller extends Controller { private function _get_delfaces_form($id) { // Generate a form to allow the user to remove face data // from a photo. - + // Make a new Form. $form = new Forge("tagfaces/delface", "", "post", array("id" => "g-tag-del-faces-form")); // Create an array of all the tags that already have faces. $existing_faces = ORM::factory("items_face") - ->where("item_id", $id) + ->where("item_id", "=", $id) ->find_all(); // turn the $existing_faces array into an array that can be used // for a checklist. $array_faces = ""; foreach ($existing_faces as $oneFace) { - $array_faces[$oneFace->id] = array(ORM::factory("tag", + $array_faces[$oneFace->id] = array(ORM::factory("tag", $oneFace->tag_id)->name, false); } @@ -238,7 +238,7 @@ class tagfaces_Controller extends Controller { ->options($array_faces) ->label(t("Select the tag(s) that correspond(s) to the face(s) you wish to delete:")); } - + // Add the id# of the photo and a delete button to the form. $form->hidden("item_id")->value($id); $form->submit("DeleteFace")->value(t("Delete face(s)")); diff --git a/modules/tagfaces/helpers/tagfaces_event.php b/modules/tagfaces/helpers/tagfaces_event.php index ed676404..77613304 100644 --- a/modules/tagfaces/helpers/tagfaces_event.php +++ b/modules/tagfaces/helpers/tagfaces_event.php @@ -32,15 +32,15 @@ class tagfaces_event_Core { } } - static function site_menu($menu, $theme) { + static function site_menu($menu, $theme) { // Create a menu option for adding face data. if (!$theme->item()) { return; } - + $item = $theme->item(); - if ($item->is_photo()) { + if ($item->is_photo()) { if ((access::can("view", $item)) && (access::can("edit", $item))) { $menu->get("options_menu") ->append(Menu::factory("link") @@ -55,20 +55,20 @@ class tagfaces_event_Core { static function item_deleted($item) { // Check for and delete existing Faces and Notes. $existingFaces = ORM::factory("items_face") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); if (count($existingFaces) > 0) { ORM::factory("items_face") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->delete_all(); } $existingNotes = ORM::factory("items_note") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); if (count($existingNotes) > 0) { ORM::factory("items_note") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->delete_all(); } } diff --git a/modules/tagfaces/helpers/tagfaces_theme.php b/modules/tagfaces/helpers/tagfaces_theme.php index 23081468..21613891 100644 --- a/modules/tagfaces/helpers/tagfaces_theme.php +++ b/modules/tagfaces/helpers/tagfaces_theme.php @@ -24,12 +24,12 @@ class tagfaces_theme_Core { $item = $theme->item; $existingFaces = ORM::factory("items_face") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); $existingNotes = ORM::factory("items_note") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); - + // If it does, add an image map to the page to display them. if ((count($existingFaces) > 0) || (count($existingNotes) > 0)) { return new View("drawfaces_highlight_block.html"); diff --git a/modules/tagfaces/views/drawfaces_highlight_block.html.php b/modules/tagfaces/views/drawfaces_highlight_block.html.php index af8f9267..c8fc2eb5 100644 --- a/modules/tagfaces/views/drawfaces_highlight_block.html.php +++ b/modules/tagfaces/views/drawfaces_highlight_block.html.php @@ -2,12 +2,12 @@ where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); $existingNotes = ORM::factory("items_note") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find_all(); - + // If it does, then insert some javascript and display an image map // to show where the faces are at. if ((count($existingFaces) > 0) || (count($existingNotes) > 0)) { @@ -15,15 +15,15 @@ @@ -39,7 +39,7 @@ var photodiv = document.getElementById('g-photo'); var photoimg = document.getElementById('id}"?>'); var divface = document.getElementById('divsquare'); - + divface.style.display = 'block'; divface.style.left = (photoimg.offsetLeft + x1) + 'px'; divface.style.top = (photodiv.offsetTop + y1) + 'px'; @@ -50,17 +50,17 @@ } else { divface.onclick = function() {self.location.href = str_url;} } - + divtext.style.display = 'block'; divtext.style.left = divface.style.left; - + if (str_description == '') { divtext.innerText = str_title; divtext.textContent = str_title; } else { divtext.innerHTML = str_title + '
    ' + str_description; } - + divtext.style.top = (parseInt(divface.style.top.split('p')[0]) + parseInt(divface.style.height.split('p')[0]) + 2) + 'px'; } @@ -69,12 +69,12 @@ document.getElementById('divsquare').style.display = 'none'; document.getElementById('divtagtext').style.display = 'none'; } - + // Call setfacemap when the page loads. window.onload = setfacemap(); - + diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index 5e07c68c..d00262b7 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -26,10 +26,10 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Generate a form for Google Maps Settings. $view->content->googlemaps_form = $this->_get_googlemaps_form(); - + // Generate a list of tags to display. $query = ORM::factory("tag"); - $view->content->tags = $query->orderby("name", "ASC")->find_all(); + $view->content->tags = $query->order_by("name", "ASC")->find_all(); // Display the page. print $view; @@ -37,12 +37,12 @@ class Admin_TagsMap_Controller extends Admin_Controller { public function edit_gps($tag_id) { // Generate a new admin page to edit gps data for the tag specified by $tag_id. - + // Determine the name of the tag. $tagName = ORM::factory("tag") - ->where("id", $tag_id) + ->where("id", "=", $tag_id) ->find_all(); - + // Set up the admin page. $view = new Admin_View("admin.html"); $view->content = new View("admin_tagsmap_edit.html"); @@ -54,7 +54,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { public function orphaned_tags() { // Locate and delete any orphaned GPS data. $int_deleted_records = 0; - + // Generate a list of all tags with GPS data. $existingGPS = ORM::factory("tags_gps") ->find_all(); @@ -62,36 +62,36 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Loop through each record and see if a corresponding tag exists. foreach ($existingGPS as $oneGPS) { $oneTag = ORM::factory("tag") - ->where("id", $oneGPS->tag_id) + ->where("id", "=", $oneGPS->tag_id) ->find_all(); - + // If the tag no longer exists then delete the record. if (count($oneTag) == 0) { // Delete the record. ORM::factory("tags_gps") - ->where("tag_id", $oneGPS->tag_id) + ->where("tag_id", "=", $oneGPS->tag_id) ->delete_all(); $int_deleted_records++; } } - + // Redirect back to the main screen and display a "success" message. message::success($int_deleted_records . t(" Orphaned Record(s) have been deleted.")); url::redirect("admin/tagsmap"); } - + public function confirm_delete_gps($tag_id) { // Make sure the user meant to hit the delete button. $view = new Admin_View("admin.html"); $view->content = new View("admin_tagsmap_delete.html"); $view->content->tag_id = $tag_id; - + // Determine the name of the tag. $tagName = ORM::factory("tag") - ->where("id", $tag_id) + ->where("id", "=", $tag_id) ->find_all(); $view->content->tag_name = $tagName[0]->name; - + print $view; } @@ -100,7 +100,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Delete the record. ORM::factory("tags_gps") - ->where("tag_id", $tag_id) + ->where("tag_id", "=", $tag_id) ->delete_all(); // Redirect back to the main screen and display a "success" message. @@ -120,7 +120,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Check and see if this ID already has GPS data, then create // input boxes to either update it or enter in new information. $existingGPS = ORM::factory("tags_gps") - ->where("tag_id", $tag_id) + ->where("tag_id", "=", $tag_id) ->find_all(); if (count($existingGPS) == 0) { $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value(""); @@ -151,11 +151,11 @@ class Admin_TagsMap_Controller extends Admin_Controller { $str_longitude = Input::instance()->post("gps_longitude"); $str_description = Input::instance()->post("gps_description"); - // Save to database. + // Save to database. // Check and see if this ID already has GPS data, // Update it if it does, create a new record if it doesn't. $existingGPS = ORM::factory("tags_gps") - ->where("tag_id", $str_tagid) + ->where("tag_id", "=", $str_tagid) ->find_all(); if (count($existingGPS) == 0) { $newgps = ORM::factory("tags_gps"); @@ -172,7 +172,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { $updatedGPS->description = $str_description; $updatedGPS->save(); } - + // Redirect back to the main screen and display a "success" message. message::success(t("Your Settings Have Been Saved.")); url::redirect("admin/tagsmap"); @@ -203,14 +203,14 @@ class Admin_TagsMap_Controller extends Admin_Controller { $startingmap_group->input("google_default_type") ->label(t("Default Map Type") . " (G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP, G_SATELLITE_3D_MAP)") ->value(module::get_var("tagsmap", "googlemap_type")); - + // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; } - + public function savemapprefs() { // Save information associated with Google Maps to the database. @@ -223,7 +223,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { $str_googlelongitude = Input::instance()->post("google_starting_longitude"); $str_googlezoom = Input::instance()->post("google_default_zoom"); $str_googlemaptype = Input::instance()->post("google_default_type"); - + // Save Settings. module::set_var("tagsmap", "googlemap_api_key", $str_googlekey); module::set_var("tagsmap", "googlemap_latitude", $str_googlelatitude); diff --git a/modules/tagsmap/views/admin_tagsmap.html.php b/modules/tagsmap/views/admin_tagsmap.html.php index f69a4ff8..231a57db 100644 --- a/modules/tagsmap/views/admin_tagsmap.html.php +++ b/modules/tagsmap/views/admin_tagsmap.html.php @@ -50,7 +50,7 @@ where("tag_id", $tag->id) + ->where("tag_id", "=", $tag->id) ->find_all(); if (count($existingGPS) > 0) { ?> @@ -69,7 +69,7 @@ -
    +

    diff --git a/modules/user_homes/helpers/user_homes_event.php b/modules/user_homes/helpers/user_homes_event.php index 68cfa8ce..561666df 100644 --- a/modules/user_homes/helpers/user_homes_event.php +++ b/modules/user_homes/helpers/user_homes_event.php @@ -25,8 +25,8 @@ class user_homes_event_Core { * is refreshed after logging in the direction can occur. */ static function user_login($user) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); - if ($home->loaded && $home->home != 0) { + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); + if ($home->loaded() && $home->home != 0) { Session::instance()->set("redirect_home", $home->home); } } @@ -52,7 +52,7 @@ class user_homes_event_Core { */ static function user_before_delete($user) { ORM::factory("user_home") - ->where("id", $user->id) + ->where("id", "=", $user->id) ->delete_all(); } @@ -70,7 +70,7 @@ class user_homes_event_Core { * Called after a user has been added */ static function user_add_form_admin_completed($user, $form) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); $home->id = $user->id; $home->home = $form->add_user->user_home->value; $home->save(); @@ -80,8 +80,8 @@ class user_homes_event_Core { * Called when admin is editing a user */ static function user_edit_form_admin($user, $form) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); - if ($home->loaded) { + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); + if ($home->loaded()) { $selected = $home->home; } else { $selected = 0; @@ -96,7 +96,7 @@ class user_homes_event_Core { * Called after a user had been edited by the admin */ static function user_edit_form_admin_completed($user, $form) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); $home->id = $user->id; $home->home = $form->edit_user->user_home->value; $home->save(); @@ -107,9 +107,9 @@ class user_homes_event_Core { * Called when user is editing their own form */ static function user_edit_form($user, $form) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); - if ($home->loaded) { + if ($home->loaded()) { $selected = $home->home; } else { $selected = 0; @@ -125,7 +125,7 @@ class user_homes_event_Core { * Called after a user had been edited by the user */ static function user_edit_form_completed($user, $form) { - $home = ORM::factory("user_home")->where("id", $user->id)->find(); + $home = ORM::factory("user_home")->where("id", "=", $user->id)->find(); $home->id = $user->id; $home->home = $form->edit_user->user_home->value; $home->save(); @@ -152,8 +152,9 @@ class user_homes_event_Core { } $albums = ORM::factory("item") - ->where(array("parent_id" => $parent->id, "type" => "album")) - ->orderby(array("title" => "ASC")) + ->where("parent_id", "=", $parent->id) + ->where("type", "=", "album") + ->order_by("title", "ASC") ->find_all(); foreach ($albums as $album) { self::tree($album, "-$dashes", $array); diff --git a/themes/greydragon/helpers/exif_event.php b/themes/greydragon/helpers/exif_event.php index 49e83993..27b617a6 100644 --- a/themes/greydragon/helpers/exif_event.php +++ b/themes/greydragon/helpers/exif_event.php @@ -25,7 +25,10 @@ class exif_event_Core { } static function item_deleted($item) { - Database::instance()->delete("exif_records", array("item_id" => $item->id)); + db::build() + ->delete("exif_records") + ->where("item_id", "=", $item->id) + ->execute(); } static function photo_menu($menu, $theme) { diff --git a/themes/three_nids/controllers/three_nids.php b/themes/three_nids/controllers/three_nids.php index 465b8345..07236556 100644 --- a/themes/three_nids/controllers/three_nids.php +++ b/themes/three_nids/controllers/three_nids.php @@ -23,9 +23,9 @@ class Three_Nids_Controller extends Controller { access::required("view", $item); $comments = ORM::factory("comment") - ->where("item_id", $item->id) - ->where("state", "published") - ->orderby("created", "ASC") + ->where("item_id", "=", $item->id) + ->where("state", "=", "published") + ->order_by("created", "ASC") ->find_all(); $v = new Theme_View("comments.html", "other", "comment-fragment"); diff --git a/themes/three_nids/helpers/three_nids.php b/themes/three_nids/helpers/three_nids.php index 29042ff2..63c4a9f6 100644 --- a/themes/three_nids/helpers/three_nids.php +++ b/themes/three_nids/helpers/three_nids.php @@ -116,9 +116,9 @@ class three_nids_Core { access::required("view", $item); return ORM::factory("comment") - ->where("item_id", $item->id) - ->where("state", "published") - ->orderby("created", "DESC") + ->where("item_id", "=", $item->id) + ->where("state", "=", "published") + ->order_by("created", "DESC") ->count_all(); } } From 5f53465bd14c5d78a9d5d73ac5d0a0bdac1a1d4b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 23 Dec 2009 00:59:15 -0800 Subject: [PATCH 02/25] Update format of $hidden variables for new K24 form::open --- modules/register/controllers/admin_register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/register/controllers/admin_register.php b/modules/register/controllers/admin_register.php index 2f123b1a..866f73a8 100755 --- a/modules/register/controllers/admin_register.php +++ b/modules/register/controllers/admin_register.php @@ -105,7 +105,7 @@ class Admin_register_Controller extends Admin_Controller { $v->content->group_list[$group->id] = $group->name; } } - $hidden = array("csrf" => access::csrf_token()); + $hidden = array("name" => "csrf", "value" => access::csrf_token()); if (count($v->content->group_list)) { $v->content->group_list = array("" => t("Choose the default group")) + $v->content->group_list; From f64442b75c9f69c3a5c24b41254a79fac7ab7023 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 23 Dec 2009 02:24:55 -0800 Subject: [PATCH 03/25] Add a rule for the "activate" param so that it gets validated properly. --- modules/register/controllers/admin_register.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/register/controllers/admin_register.php b/modules/register/controllers/admin_register.php index 866f73a8..d93d9ad1 100755 --- a/modules/register/controllers/admin_register.php +++ b/modules/register/controllers/admin_register.php @@ -54,6 +54,7 @@ class Admin_register_Controller extends Admin_Controller { $post = new Validation($_POST); $post->add_rules("activate_users", "required"); + $post->add_rules("activate", "alpha_numeric"); if ($post->validate()) { $names = array(); if (!empty($post->activate)) { From a711cb10881fbcd988915bd84916d82b414fe5ba Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 23 Dec 2009 12:56:12 -0800 Subject: [PATCH 04/25] Quote name/descriptions in module.info --- modules/dynamic/module.info | 4 ++-- modules/gmaps/module.info | 4 ++-- modules/google_analytics/module.info | 4 ++-- modules/keeporiginal/module.info | 4 ++-- modules/phpmailer/module.info | 4 ++-- modules/polar_rose/module.info | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/dynamic/module.info b/modules/dynamic/module.info index aa5e0432..89778d48 100644 --- a/modules/dynamic/module.info +++ b/modules/dynamic/module.info @@ -1,3 +1,3 @@ -name = Dynamic -description = Adds the Recent Changes and Most Viewed dynamic albums +name = "Dynamic" +description = "Adds the Recent Changes and Most Viewed dynamic albums" version = 1 diff --git a/modules/gmaps/module.info b/modules/gmaps/module.info index 32d7570f..12dd61d4 100644 --- a/modules/gmaps/module.info +++ b/modules/gmaps/module.info @@ -1,3 +1,3 @@ -name = Google Maps -description = Integrate with the Google Maps service +name = "Google Maps" +description = "Integrate with the Google Maps service" version = 1 diff --git a/modules/google_analytics/module.info b/modules/google_analytics/module.info index c1e566d1..6d42bf4b 100644 --- a/modules/google_analytics/module.info +++ b/modules/google_analytics/module.info @@ -1,3 +1,3 @@ -name = Google Analytics -description = Renders the Google Analytics Code at the end of the page. Written by 'mcp'. +name = "Google Analytics" +description = "Renders the Google Analytics Code at the end of the page. Written by 'mcp'." version = 2 diff --git a/modules/keeporiginal/module.info b/modules/keeporiginal/module.info index 855294b9..c665bd69 100644 --- a/modules/keeporiginal/module.info +++ b/modules/keeporiginal/module.info @@ -1,3 +1,3 @@ -name = Keep Original -description = Make a copy of the original photo before rotating it. +name = "Keep Original" +description = "Make a copy of the original photo before rotating it." version = 1 diff --git a/modules/phpmailer/module.info b/modules/phpmailer/module.info index 5c5b5b98..419d85d5 100644 --- a/modules/phpmailer/module.info +++ b/modules/phpmailer/module.info @@ -1,3 +1,3 @@ -name = PHPMailer -description = Use PHPMailer when sending email messages. +name = "PHPMailer" +description = "Use PHPMailer when sending email messages." version = 1 diff --git a/modules/polar_rose/module.info b/modules/polar_rose/module.info index 45d02421..d74bbf6c 100644 --- a/modules/polar_rose/module.info +++ b/modules/polar_rose/module.info @@ -1,3 +1,3 @@ -name = Polar Rose -description = Integrate Gallery with the Polar Rose facial recognition service. +name = "Polar Rose" +description = "Integrate Gallery with the Polar Rose facial recognition service." version = 1 From bcc0a1e8364aa534f7459e41a426bab4d541b12d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 23 Dec 2009 20:52:09 -0800 Subject: [PATCH 05/25] Convert a bunch of left over kohana::show_404 calls to throw Kohana_404_Exception instead. --- modules/basket/controllers/admin_postage_bands.php | 8 ++++---- modules/basket/controllers/admin_product_lines.php | 8 ++++---- modules/contactowner/controllers/contactowner.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/basket/controllers/admin_postage_bands.php b/modules/basket/controllers/admin_postage_bands.php index 8e13a587..22bf4b3d 100644 --- a/modules/basket/controllers/admin_postage_bands.php +++ b/modules/basket/controllers/admin_postage_bands.php @@ -69,7 +69,7 @@ class Admin_Postage_Bands_Controller extends Controller public function delete_postage_band_form($id) { $postage = ORM::factory("postage_band", $id); if (!$postage->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } print postage_band::get_delete_form_admin($postage); } @@ -83,7 +83,7 @@ class Admin_Postage_Bands_Controller extends Controller $postage = ORM::factory("postage_band", $id); if (!$postage->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = postage_band::get_delete_form_admin($postage); @@ -106,7 +106,7 @@ class Admin_Postage_Bands_Controller extends Controller $postage = ORM::factory("postage_band", $id); if (!$postage->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = postage_band::get_edit_form_admin($postage); @@ -143,7 +143,7 @@ class Admin_Postage_Bands_Controller extends Controller public function edit_postage_band_form($id) { $postage = ORM::factory("postage_band", $id); if (!$postage->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = postage_band::get_edit_form_admin($postage); diff --git a/modules/basket/controllers/admin_product_lines.php b/modules/basket/controllers/admin_product_lines.php index def6654e..2ddb1af2 100644 --- a/modules/basket/controllers/admin_product_lines.php +++ b/modules/basket/controllers/admin_product_lines.php @@ -70,7 +70,7 @@ class Admin_Product_Lines_Controller extends Controller public function delete_product_form($id) { $product = ORM::factory("product", $id); if (!$product->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } print product::get_delete_form_admin($product); } @@ -84,7 +84,7 @@ class Admin_Product_Lines_Controller extends Controller $product = ORM::factory("product", $id); if (!$product->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = product::get_delete_form_admin($product); @@ -107,7 +107,7 @@ class Admin_Product_Lines_Controller extends Controller $product = ORM::factory("product", $id); if (!$product->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = product::get_edit_form_admin($product); @@ -145,7 +145,7 @@ class Admin_Product_Lines_Controller extends Controller public function edit_product_form($id) { $product = ORM::factory("product", $id); if (!$product->loaded()) { - kohana::show_404(); + throw new Kohana_404_Exception(); } $form = product::get_edit_form_admin($product); diff --git a/modules/contactowner/controllers/contactowner.php b/modules/contactowner/controllers/contactowner.php index 6894049a..e9684bb0 100644 --- a/modules/contactowner/controllers/contactowner.php +++ b/modules/contactowner/controllers/contactowner.php @@ -23,7 +23,7 @@ class ContactOwner_Controller extends Controller { // If this page is disabled, show a 404 error. if (module::get_var("contactowner", "contact_owner_link") != true) { - kohana::show_404(); + throw new Kohana_404_Exception(); } // Make a new form with a couple of text boxes. @@ -52,7 +52,7 @@ class ContactOwner_Controller extends Controller { // If this page is disabled, show a 404 error. if (module::get_var("contactowner", "contact_user_link") != true) { - kohana::show_404(); + throw new Kohana_404_Exception(); } // Locate the record for the user specified by $user_id, From f522643d7032bdd2f97dc132ac49f201d72e2672 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 01:47:00 -0800 Subject: [PATCH 06/25] Clean up tag display logic. --- modules/rwinfo/helpers/rwinfo_theme.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/rwinfo/helpers/rwinfo_theme.php b/modules/rwinfo/helpers/rwinfo_theme.php index 6c3574be..83c890dd 100644 --- a/modules/rwinfo/helpers/rwinfo_theme.php +++ b/modules/rwinfo/helpers/rwinfo_theme.php @@ -28,21 +28,18 @@ class rwinfo_theme_Core { // rWatcher Edit: Display Tags if (module::is_active("tag")) { - $tagsItem = ORM::factory("tag") + $tags = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") ->where("items_tags.item_id", "=", $item->id) ->find_all(); - if (count($tagsItem) > 0) { + if (count($tags) > 0) { $results .= "
  • "; $results .= t("Tags:") . " "; - for ($counter=0; $counter" . html::clean($tagsItem[$counter]->name) . ", "; - } else { - $results .= "" . html::clean($tagsItem[$counter]->name) . ""; - } + $anchors = array(); + foreach ($tags as $tag) { + $anchors[] = "id}") . ">" . html::clean($tag->name) . ""; } - $results .= "
  • "; + $results .= join(", ", $anchors) . ""; } } // rWatcher End Edit From 2b00e0a4e9344c585666ff890765fa842a62d8f0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 01:47:58 -0800 Subject: [PATCH 07/25] Don't save dimensions unless it's actually a movie. --- modules/videodimensions/helpers/videodimensions_event.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/videodimensions/helpers/videodimensions_event.php b/modules/videodimensions/helpers/videodimensions_event.php index b22ab432..7a490ed7 100644 --- a/modules/videodimensions/helpers/videodimensions_event.php +++ b/modules/videodimensions/helpers/videodimensions_event.php @@ -30,8 +30,10 @@ class videodimensions_event_Core { static function item_edit_form_completed($item, $form) { // Save the new height and width to the database. - $item->height = $form->edit_item->vidheight->value; - $item->width = $form->edit_item->vidwidth->value; - $item->save(); + if ($item->is_movie()) { + $item->height = $form->edit_item->vidheight->value; + $item->width = $form->edit_item->vidwidth->value; + $item->save(); + } } } From 2a596af25b1f42321f722fcab8b816326efbb666 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 01:48:15 -0800 Subject: [PATCH 08/25] Don't treat an object like a string --- modules/metadescription/helpers/metadescription_theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/metadescription/helpers/metadescription_theme.php b/modules/metadescription/helpers/metadescription_theme.php index 7083c5c6..c5dee002 100644 --- a/modules/metadescription/helpers/metadescription_theme.php +++ b/modules/metadescription/helpers/metadescription_theme.php @@ -23,7 +23,7 @@ class metadescription_theme_Core { // If the current page belongs to a tag, look up // the information for that tag. $tagsItem = ORM::factory("tag") - ->where("id", "=", $theme->tag()) + ->where("id", "=", $theme->tag()->id) ->find_all(); } elseif ($theme->item()) { From dde187e88c29845dcf5bcafbca41802b6ef6f42a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 01:48:27 -0800 Subject: [PATCH 09/25] Only trigger for items and tags --- modules/polar_rose/helpers/polar_rose_theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/polar_rose/helpers/polar_rose_theme.php b/modules/polar_rose/helpers/polar_rose_theme.php index ebb7f5a3..32e355f9 100644 --- a/modules/polar_rose/helpers/polar_rose_theme.php +++ b/modules/polar_rose/helpers/polar_rose_theme.php @@ -19,7 +19,7 @@ */ class polar_rose_theme_Core { static function head($theme) { - if (module::is_installed("rss")) { + if (module::is_installed("rss") && ($theme->item() || $theme->tag())) { if ($item = $theme->item()) { $url = rss::feed_link("gallery/album/{$item->id}"); } else if ($tag = $theme->tag()) { From 1a65ded2a6d8630bede106b42e2e15eddd1b4201 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 02:44:13 -0800 Subject: [PATCH 10/25] Don't treat objects like strings --- modules/downloadfullsize/helpers/downloadfullsize_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/downloadfullsize/helpers/downloadfullsize_event.php b/modules/downloadfullsize/helpers/downloadfullsize_event.php index bb4deb70..c3788244 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_event.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_event.php @@ -35,7 +35,7 @@ class downloadfullsize_event_Core { static function movie_menu($menu, $theme) { if (access::can("view_full", $theme->item)) { if (module::get_var("downloadfullsize", "fButton")) { - $downloadLink = url::site("downloadfullsize/send/$theme->item"); + $downloadLink = url::site("downloadfullsize/send/{$theme->item->id}"); $menu ->append(Menu::factory("link") ->id("downloadfullsize") From 7d2297033d0377542dcdc2afbd370d0b62be6502 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 10:56:26 -0800 Subject: [PATCH 11/25] Don't treat objects like strings. --- modules/downloadfullsize/helpers/downloadfullsize_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/downloadfullsize/helpers/downloadfullsize_event.php b/modules/downloadfullsize/helpers/downloadfullsize_event.php index c3788244..b99fe691 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_event.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_event.php @@ -21,7 +21,7 @@ class downloadfullsize_event_Core { static function photo_menu($menu, $theme) { if (access::can("view_full", $theme->item)) { if (module::get_var("downloadfullsize", "fButton")) { - $downloadLink = url::site("downloadfullsize/send/$theme->item"); + $downloadLink = url::site("downloadfullsize/send/{$theme->item->id}"); $menu ->append(Menu::factory("link") ->id("downloadfullsize") From 30ab3e94205597d6b7a76f2779c619e8b052d26c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 10:59:25 -0800 Subject: [PATCH 12/25] Check using empty() instead of a comparison to avoid warnings on unused variables. Clean up the code style. --- .../views/contactowner_block.html.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/contactowner/views/contactowner_block.html.php b/modules/contactowner/views/contactowner_block.html.php index 93ff8594..f593af5b 100644 --- a/modules/contactowner/views/contactowner_block.html.php +++ b/modules/contactowner/views/contactowner_block.html.php @@ -1,15 +1,15 @@
      - -
    • - + +
    • +
    • - - -
    • - -
    • - + + +
    • + +
    • +
    From 9a1fc572117d4f59041b3ded261572d5293cb7a6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:04:25 -0800 Subject: [PATCH 13/25] Don't treat objects like strings. Simplify the code. --- modules/displaytags/views/displaytags_block.html.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/displaytags/views/displaytags_block.html.php b/modules/displaytags/views/displaytags_block.html.php index 509d8acf..21fe8d6e 100644 --- a/modules/displaytags/views/displaytags_block.html.php +++ b/modules/displaytags/views/displaytags_block.html.php @@ -1,10 +1,8 @@
    - - - ">name) ?>, - - ">name) ?> - - + + + + name}") ?>">name) ?> +
    From 1ed3c469973afc1a4488806bbc94803d7547c551 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:07:03 -0800 Subject: [PATCH 14/25] Clean up tag display logic --- modules/rwinfo/views/rwinfo_block.html.php | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/modules/rwinfo/views/rwinfo_block.html.php b/modules/rwinfo/views/rwinfo_block.html.php index a6aeb19c..20f6efa8 100644 --- a/modules/rwinfo/views/rwinfo_block.html.php +++ b/modules/rwinfo/views/rwinfo_block.html.php @@ -32,24 +32,20 @@ - join("items_tags", "tags.id", "items_tags.tag_id") - ->where("items_tags.item_id", "=", $item->id) - ->find_all(); + join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", "=", $item->id) + ->find_all(); ?> - 0): ?> -
  • - - - - ">name) ?>, - - ">name) ?> - - -
  • - + +
  • + + + + + name}") ?>">name) ?> + +
  • + - From 8658a609fde39dcd117da80c6dffaf01810144cd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:09:07 -0800 Subject: [PATCH 15/25] Convert Controller::$input -> Input::instance() --- modules/calendarview/controllers/calendarview.php | 4 ++-- modules/dynamic/controllers/dynamic.php | 2 +- modules/latestupdates/controllers/latestupdates.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/calendarview/controllers/calendarview.php b/modules/calendarview/controllers/calendarview.php index f5502b9b..c17f7ecf 100644 --- a/modules/calendarview/controllers/calendarview.php +++ b/modules/calendarview/controllers/calendarview.php @@ -68,7 +68,7 @@ class CalendarView_Controller extends Controller { // Figure out paging stuff. $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) $this->input->get("page", "1"); + $page = (int) Input::instance()->get("page", "1"); $offset = ($page-1) * $page_size; $max_pages = max(ceil($day_count / $page_size), 1); @@ -144,7 +144,7 @@ class CalendarView_Controller extends Controller { // Figure out paging stuff. $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) $this->input->get("page", "1"); + $page = (int) Input::instance()->get("page", "1"); $offset = ($page-1) * $page_size; $max_pages = max(ceil($day_count / $page_size), 1); diff --git a/modules/dynamic/controllers/dynamic.php b/modules/dynamic/controllers/dynamic.php index d0263880..b15a87a4 100644 --- a/modules/dynamic/controllers/dynamic.php +++ b/modules/dynamic/controllers/dynamic.php @@ -27,7 +27,7 @@ class Dynamic_Controller extends Controller { private function _show($album) { $page_size = module::get_var("gallery", "page_size", 9); - $page = $this->input->get("page", "1"); + $page = Input::instance()->get("page", "1"); $album_defn = unserialize(module::get_var("dynamic", $album)); $children_count = $album_defn->limit; diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php index d49026db..35180bf0 100644 --- a/modules/latestupdates/controllers/latestupdates.php +++ b/modules/latestupdates/controllers/latestupdates.php @@ -25,7 +25,7 @@ class latestupdates_Controller extends Controller { // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. - $page = $this->input->get("page", 1); + $page = Input::instance()->get("page", 1); if ($page < 1) { url::redirect("latestupdates/albums/{$item->id}"); } @@ -86,7 +86,7 @@ class latestupdates_Controller extends Controller { // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. - $page = $this->input->get("page", 1); + $page = Input::instance()->get("page", 1); if ($page < 1) { url::redirect("latestupdates/updates"); } From 0cb6b9e58f38c2b9b9db7efcb70e75c3b726a750 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:45:44 -0800 Subject: [PATCH 16/25] Clean up the code to work with K24 ORM changes, and update it to work with paginator changes. Also fix some minor style issues. --- .../controllers/latestupdates.php | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php index 35180bf0..4b5560b0 100644 --- a/modules/latestupdates/controllers/latestupdates.php +++ b/modules/latestupdates/controllers/latestupdates.php @@ -21,7 +21,7 @@ class latestupdates_Controller extends Controller { public function albums($id) { // Figure out how many items to display on each page. - $itemsPerPage = module::get_var("gallery", "page_size", 9); + $page_size = module::get_var("gallery", "page_size", 9); // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. @@ -31,33 +31,30 @@ class latestupdates_Controller extends Controller { } // First item to display. - $offset = ($page - 1) * $itemsPerPage; + $offset = ($page - 1) * $page_size; + + $item = ORM::factory("item", $id); // Determine the total number of items, // for page numbering purposes. - $count = ORM::factory("item", $id) + $count = $item ->viewable() - ->where("type", "!=", "album") - ->order_by("created", "DESC") - ->descendants() - ->count(); + ->descendants_count(null, null, array(array("type", "!=", "album"))); // Figure out what the highest page number is. - $max_pages = ceil($count / $itemsPerPage); + $max_pages = ceil($count / $page_size); // Don't let the visitor go past the last page. - if ($max_pages && $page > $max_pages) { + if ($max_pages && $page > $max_pages) { url::redirect("latestupdates/albums/{$item->id}?page=$max_pages"); } // Figure out which items to display on this page. - $children = ORM::factory("item", $id) + $children = $item ->viewable() ->where("type", "!=", "album") ->order_by("created", "DESC") - ->limit($itemsPerPage) - ->offset($offset) - ->descendants(); + ->descendants($page_size, $offset); // Set up the previous and next page buttons. if ($page > 1) { @@ -70,9 +67,11 @@ class latestupdates_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "LatestUpdates"); + $template = new Theme_View("page.html", "collection", "LatestUpdates"); $template->page_title = t("Gallery :: Latest Updates"); - $template->set_global("page_size", $itemsPerPage); + $template->set_global("page", $page); + $template->set_global("page_size", $page_size); + $template->set_global("max_pages", $max_pages); $template->set_global("children", $children); $template->set_global("children_count", $count); $template->content = new View("dynamic.html"); @@ -82,7 +81,7 @@ class latestupdates_Controller extends Controller { public function updates() { // Figure out how many items to display on each page. - $itemsPerPage = module::get_var("gallery", "page_size", 9); + $page_size = module::get_var("gallery", "page_size", 9); // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. @@ -92,7 +91,7 @@ class latestupdates_Controller extends Controller { } // First item to display. - $offset = ($page - 1) * $itemsPerPage; + $offset = ($page - 1) * $page_size; // Determine the total number of items, // for page numbering purposes. @@ -103,7 +102,7 @@ class latestupdates_Controller extends Controller { ->count(); // Figure out what the highest page number is. - $max_pages = ceil($count / $itemsPerPage); + $max_pages = ceil($count / $page_size); // Don't let the visitor go past the last page. if ($max_pages && $page > $max_pages) { @@ -115,7 +114,7 @@ class latestupdates_Controller extends Controller { ->viewable() ->where("type", "!=", "album") ->order_by("created", "DESC") - ->find_all($itemsPerPage, $offset); + ->find_all($page_size, $offset); // Set up the previous and next page buttons. if ($page > 1) { @@ -128,9 +127,11 @@ class latestupdates_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "LatestUpdates"); + $template = new Theme_View("page.html", "collection", "LatestUpdates"); $template->page_title = t("Gallery :: Latest Updates"); - $template->set_global("page_size", $itemsPerPage); + $template->set_global("page", $page); + $template->set_global("page_size", $page_size); + $template->set_global("max_pages", $max_pages); $template->set_global("children", $items); $template->set_global("children_count", $count); $template->content = new View ("dynamic.html"); From ace00a891d47632e2c12ef857c78b5be2821975a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:51:21 -0800 Subject: [PATCH 17/25] Updated for the new blocks API. --- .../{dynamic_theme.php => dynamic_block.php} | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) rename modules/dynamic/helpers/{dynamic_theme.php => dynamic_block.php} (56%) diff --git a/modules/dynamic/helpers/dynamic_theme.php b/modules/dynamic/helpers/dynamic_block.php similarity index 56% rename from modules/dynamic/helpers/dynamic_theme.php rename to modules/dynamic/helpers/dynamic_block.php index c3cbc3d0..24decffa 100644 --- a/modules/dynamic/helpers/dynamic_theme.php +++ b/modules/dynamic/helpers/dynamic_block.php @@ -16,22 +16,30 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class dynamic_theme { - static function sidebar_blocks($theme) { - $albums = array(); - foreach (array("updates", "popular") as $album) { - $album_defn = unserialize(module::get_var("dynamic", $album)); - if ($album_defn->enabled) { - $albums[$album] = $album_defn->title; +class dynamic_block_Core { + static function get_site_list() { + return array("dynamic" => t("Dynamic Albums")); + } + + static function get($block_id) { + switch ($block_id) { + case "dynamic": + $albums = array(); + foreach (array("updates", "popular") as $album) { + $album_defn = unserialize(module::get_var("dynamic", $album)); + if ($album_defn->enabled) { + $albums[$album] = $album_defn->title; + } + } + + if (!empty($albums)) { + $block = new Block(); + $block->css_id = "g-dynamic"; + $block->title = t("Dynamic Albums"); + $block->content = new View("dynamic_block.html"); + $block->content->albums = $albums; + return $block; } - } - if (!empty($albums)) { - $block = new Block(); - $block->css_id = "g-dynamic"; - $block->title = t("Dynamic Albums"); - $block->content = new View("dynamic_block.html"); - $block->content->albums = $albums; - return $block; } return ""; } From c7ad42100b6d4d8f564ee8f8725ac07ace2b5b1a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:55:28 -0800 Subject: [PATCH 18/25] Convert Kohana::show_404() to throw a Kohana_404_Exception() --- modules/calendarview/controllers/calendarview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/calendarview/controllers/calendarview.php b/modules/calendarview/controllers/calendarview.php index c17f7ecf..4ca73621 100644 --- a/modules/calendarview/controllers/calendarview.php +++ b/modules/calendarview/controllers/calendarview.php @@ -74,7 +74,7 @@ class CalendarView_Controller extends Controller { // Make sure that the page references a valid offset if (($page < 1) || ($page > $max_pages)) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } // Set up the page. @@ -150,7 +150,7 @@ class CalendarView_Controller extends Controller { // Make sure that the page references a valid offset if (($page < 1) || ($page > $max_pages)) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } // Set up the page. From 2fdada73dce0d8ca4cccf03a7a887fd2c9c782f9 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:56:30 -0800 Subject: [PATCH 19/25] Sentence case the titles. --- modules/dynamic/helpers/dynamic_installer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dynamic/helpers/dynamic_installer.php b/modules/dynamic/helpers/dynamic_installer.php index fd67a8ed..acbc1ec1 100644 --- a/modules/dynamic/helpers/dynamic_installer.php +++ b/modules/dynamic/helpers/dynamic_installer.php @@ -26,14 +26,14 @@ class dynamic_installer { "limit" => null, "description" => "", "key_field" => "view_count", - "title" => t("Most Viewed")))); + "title" => t("Most viewed")))); module::set_var( "dynamic", "updates", serialize((object)array("enabled" => false, "limit" => null, "description" => "", "key_field" => "created", - "title" => t("Recent Changes")))); + "title" => t("Recent changes")))); module::set_version("dynamic", 1); } } From 4c9bcf9ad3e225e4ea65d776338e2af113ce0733 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 11:56:49 -0800 Subject: [PATCH 20/25] Update for paginator changes. --- modules/dynamic/controllers/dynamic.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/dynamic/controllers/dynamic.php b/modules/dynamic/controllers/dynamic.php index b15a87a4..ad661d00 100644 --- a/modules/dynamic/controllers/dynamic.php +++ b/modules/dynamic/controllers/dynamic.php @@ -18,11 +18,11 @@ */ class Dynamic_Controller extends Controller { public function updates() { - print $this->_show("updates"); + print $this->_show("updates", t("Recent changes")); } public function popular() { - print $this->_show("popular"); + print $this->_show("popular", t("Most viewed")); } private function _show($album) { @@ -44,11 +44,13 @@ class Dynamic_Controller extends Controller { // Make sure that the page references a valid offset if ($page < 1 || ($children_count && $page > ceil($children_count / $page_size))) { - Kohana::show_404(); + throw new Kohana_404_Exception(); } - $template = new Theme_View("page.html", "other", "dynamic"); + $template = new Theme_View("page.html", "collection", "dynamic"); + $template->set_global("page", $page); $template->set_global("page_size", $page_size); + $template->set_global("max_pages", $max_pages); $template->set_global("children", ORM::factory("item") ->viewable() ->where("type", "!=", "album") From b9cebd25eb99e90e58c791ee770173cb53aee8ea Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 12:53:35 -0800 Subject: [PATCH 21/25] Add validation for the default settings and api key. Set some defaults there, too so that users don't have to know a lat/long to get started. Use form validation. Bump the version to 2. --- modules/tagsmap/controllers/admin_tagsmap.php | 68 +++++++++++-------- modules/tagsmap/helpers/tagsmap_installer.php | 8 ++- modules/tagsmap/module.info | 2 +- .../tagsmap/views/admin_tagsmap_edit.html.php | 40 +++++------ 4 files changed, 67 insertions(+), 51 deletions(-) diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index d00262b7..d461de37 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -48,6 +48,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { $view->content = new View("admin_tagsmap_edit.html"); $view->content->tagsmapedit_form = $this->_get_tagsgpsedit_form($tag_id); $view->content->tag_name = $tagName[0]->name; + $view->content->zoom = module::get_var("tagsmap", "googlemap_zoom"); print $view; } @@ -123,8 +124,10 @@ class Admin_TagsMap_Controller extends Admin_Controller { ->where("tag_id", "=", $tag_id) ->find_all(); if (count($existingGPS) == 0) { - $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value(""); - $tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value(""); + $tagsgps_group->input("gps_latitude") + ->label(t("Latitude"))->value(module::get_var("tagsmap", "googlemap_latitude")); + $tagsgps_group->input("gps_longitude") + ->label(t("Longitude"))->value(module::get_var("tagsmap", "googlemap_longitude")); $tagsgps_group->textarea("gps_description")->label(t("Description"))->value(""); } else { $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value($existingGPS[0]->latitude); @@ -186,23 +189,29 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Input box for the Maps API Key $googlemap_group = $form->group("GoogleMapsKey"); $googlemap_group->input("google_api_key") - ->label(t("Google Maps API Key")) - ->value(module::get_var("tagsmap", "googlemap_api_key")); + ->label(t("Google Maps API Key")) + ->value(module::get_var("tagsmap", "googlemap_api_key")) + ->rules("required"); // Input boxes for the Maps starting location map type and zoom. $startingmap_group = $form->group("GoogleMapsPos"); $startingmap_group->input("google_starting_latitude") - ->label(t("Starting Latitude")) - ->value(module::get_var("tagsmap", "googlemap_latitude")); + ->label(t("Starting Latitude")) + ->value(module::get_var("tagsmap", "googlemap_latitude")) + ->rules("required"); $startingmap_group->input("google_starting_longitude") - ->label(t("Starting Longitude")) - ->value(module::get_var("tagsmap", "googlemap_longitude")); + ->label(t("Starting Longitude")) + ->value(module::get_var("tagsmap", "googlemap_longitude")) + ->rules("required"); $startingmap_group->input("google_default_zoom") - ->label(t("Default Zoom Level")) - ->value(module::get_var("tagsmap", "googlemap_zoom")); - $startingmap_group->input("google_default_type") - ->label(t("Default Map Type") . " (G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP, G_SATELLITE_3D_MAP)") - ->value(module::get_var("tagsmap", "googlemap_type")); + ->label(t("Default Zoom Level")) + ->value(module::get_var("tagsmap", "googlemap_zoom")) + ->rules("required"); + $startingmap_group->dropdown("google_default_type") + ->label(t("Default Map Type")) + ->options( + array("G_NORMAL_MAP", "G_SATELLITE_MAP", "G_HYBRID_MAP", + "G_PHYSICAL_MAP", "G_SATELLITE_3D_MAP")); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); @@ -217,22 +226,25 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Prevent Cross Site Request Forgery access::verify_csrf(); - // Figure out the values of the text boxes - $str_googlekey = Input::instance()->post("google_api_key"); - $str_googlelatitude = Input::instance()->post("google_starting_latitude"); - $str_googlelongitude = Input::instance()->post("google_starting_longitude"); - $str_googlezoom = Input::instance()->post("google_default_zoom"); - $str_googlemaptype = Input::instance()->post("google_default_type"); + $form = $this->_get_googlemaps_form(); + if ($form->validate()) { + Kohana_Log::add("error",print_r($form,1)); + module::set_var("tagsmap", "googlemap_api_key", $form->GoogleMapsKey->google_api_key->value); + module::set_var("tagsmap", "googlemap_latitude", $form->GoogleMapsPos->google_starting_latitude->value); + module::set_var("tagsmap", "googlemap_longitude", $form->GoogleMapsPos->google_starting_longitude->value); + module::set_var("tagsmap", "googlemap_zoom", $form->GoogleMapsPos->google_default_zoom->value); + module::set_var("tagsmap", "googlemap_type", $form->GoogleMapsPos->google_default_type->value); - // Save Settings. - module::set_var("tagsmap", "googlemap_api_key", $str_googlekey); - module::set_var("tagsmap", "googlemap_latitude", $str_googlelatitude); - module::set_var("tagsmap", "googlemap_longitude", $str_googlelongitude); - module::set_var("tagsmap", "googlemap_zoom", $str_googlezoom); - module::set_var("tagsmap", "googlemap_type", $str_googlemaptype); + // Display a success message and redirect back to the TagsMap admin page. + message::success(t("Your settings have been saved.")); + url::redirect("admin/tagsmap"); + } - // Display a success message and redirect back to the TagsMap admin page. - message::success(t("Your Settings Have Been Saved.")); - url::redirect("admin/tagsmap"); + // Else show the page with errors + $view = new Admin_View("admin.html"); + $view->content = new View("admin_tagsmap.html"); + $view->content->googlemaps_form = $form; + $view->content->tags = ORM::factory("tag")->order_by("name", "ASC")->find_all(); + print $view; } } \ No newline at end of file diff --git a/modules/tagsmap/helpers/tagsmap_installer.php b/modules/tagsmap/helpers/tagsmap_installer.php index a956ef24..26e88fd5 100644 --- a/modules/tagsmap/helpers/tagsmap_installer.php +++ b/modules/tagsmap/helpers/tagsmap_installer.php @@ -31,8 +31,12 @@ class tagsmap_installer { KEY(`tag_id`, `id`)) DEFAULT CHARSET=utf8;"); - // Set the module's version number. - module::set_version("tagsmap", 1); + // Set the default to Australia (homage to rWatcher) + module::set_var("tagsmap", "googlemap_latitude", -26.11); + module::set_var("tagsmap", "googlemap_longitude", 134); + module::set_var("tagsmap", "googlemap_zoom", 5); + module::set_var("tagsmap", "googlemap_type", "G_NORMAL_MAP"); + module::set_version("tagsmap", 2); } static function deactivate() { diff --git a/modules/tagsmap/module.info b/modules/tagsmap/module.info index 973175d0..b916f09d 100644 --- a/modules/tagsmap/module.info +++ b/modules/tagsmap/module.info @@ -1,3 +1,3 @@ name = "TagsMap" description = "Assign GPS coordinates to existing tags and display them on a map." -version = 1 \ No newline at end of file +version = 2 diff --git a/modules/tagsmap/views/admin_tagsmap_edit.html.php b/modules/tagsmap/views/admin_tagsmap_edit.html.php index b9466a62..e01f2b29 100644 --- a/modules/tagsmap/views/admin_tagsmap_edit.html.php +++ b/modules/tagsmap/views/admin_tagsmap_edit.html.php @@ -10,10 +10,10 @@ - From 69baf26b0532388c62ecce8eb50e08c8c58531e2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 18:03:03 -0800 Subject: [PATCH 22/25] Clean up formatting. --- .../basket/views/admin_postage_bands.html.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/basket/views/admin_postage_bands.html.php b/modules/basket/views/admin_postage_bands.html.php index 436c2a83..c13be5bb 100644 --- a/modules/basket/views/admin_postage_bands.html.php +++ b/modules/basket/views/admin_postage_bands.html.php @@ -21,8 +21,8 @@ \ No newline at end of file + From fb36d5454ca02c3940400f2a59238f978e4b605c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 24 Dec 2009 18:05:14 -0800 Subject: [PATCH 23/25] Do enough CSS fixing to get the dialogs to work inline. --- modules/basket/views/admin_postage_bands.html.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/basket/views/admin_postage_bands.html.php b/modules/basket/views/admin_postage_bands.html.php index c13be5bb..ce885e8f 100644 --- a/modules/basket/views/admin_postage_bands.html.php +++ b/modules/basket/views/admin_postage_bands.html.php @@ -21,7 +21,7 @@
    " - class="gDialogLink gButtonLink right ui-icon-left ui-state-default ui-corner-all" + class="g-dialog-link g-button-link right ui-icon-left ui-state-default ui-corner-all" title=""> @@ -54,12 +54,16 @@ id") ?>" open_text="" - class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left"> - + class="g-panel-link g-button-link ui-state-default ui-corner-all ui-icon-left"> + + + id") ?>" - class="gDialogLink gButtonLink ui-state-default ui-corner-all ui-icon-left"> - + class="g-dialog-link g-button-link ui-state-default ui-corner-all ui-icon-left"> + + + From 90ef5daa49a2c9718ac508d74e752dde48153571 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 25 Dec 2009 13:25:36 -0800 Subject: [PATCH 24/25] Update some database calls. --- .../gwtorganise/controllers/json_album.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/gwtorganise/controllers/json_album.php b/modules/gwtorganise/controllers/json_album.php index 70743e3d..85cf1128 100644 --- a/modules/gwtorganise/controllers/json_album.php +++ b/modules/gwtorganise/controllers/json_album.php @@ -102,7 +102,11 @@ class Json_Album_Controller extends Controller { $i = 0; foreach ($album->children() as $child) { // Do this directly in the database to avoid sending notifications - Database::Instance()->update("items", array("weight" => ++$i), array("id" => $child->id)); + db::build() + ->update("items") + ->set("weight", ++$i) + ->where("id", "=", $child->id) + ->execute(); } $album->sort_column = "weight"; $album->sort_order = "ASC"; @@ -118,15 +122,20 @@ class Json_Album_Controller extends Controller { // Make a hole $count = count($source_ids); - Database::Instance()->query( - "UPDATE {items} " . - "SET `weight` = `weight` + $count " . - "WHERE `weight` >= $target_weight AND `parent_id` = {$album->id}"); + db::build() + ->update("items") + ->set("weight", new Database_Expression("`weight` + $count")) + ->where("weight", ">=", $target_weight) + ->where("parent_id", "=", $album->id) + ->execute(); // Insert source items into the hole foreach ($source_ids as $source_id) { - Database::Instance()->update( - "items", array("weight" => $target_weight++), array("id" => $source_id)); + db::build() + ->update("items") + ->set("weight", $target_weight++) + ->where("id", "=", $source_id) + ->execute(); } module::event("album_rearrange", $album); From 500eb7c7445cf2ef166a083196955258625e3085 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 25 Dec 2009 22:45:12 -0800 Subject: [PATCH 25/25] Define $url to avoid warnings. --- themes/greydragon/views/page.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/greydragon/views/page.html.php b/themes/greydragon/views/page.html.php index d6e65b2d..05481c29 100644 --- a/themes/greydragon/views/page.html.php +++ b/themes/greydragon/views/page.html.php @@ -114,6 +114,7 @@
      +
    • '; ?>">Sidebar Left"; ?>