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 </form> and </fieldset> respectively. 7) Controller::$input is gone. Use Input::instance() instead. I've done very rudimentary testing so far.
This commit is contained in:
parent
4f1538d87b
commit
1a0dc96e77
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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}"));
|
||||
}
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 "<td>";
|
||||
$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)));
|
||||
|
||||
}
|
||||
|
@ -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 <br> tags to the message body where ever there are line breaks.
|
||||
$str_emailbody = str_replace("\n", "\n<br/>", $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<br/><br/>" . $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)
|
||||
|
@ -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 = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " .
|
||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " .
|
||||
$userDetails[0]->name . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Figure out if the contact site owner link should be displayed.
|
||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($displayBlock) {
|
||||
|
@ -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();
|
||||
|
@ -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)) {
|
||||
|
@ -44,4 +44,5 @@
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?= form::close() ?>
|
||||
</form>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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());
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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 {
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)) {
|
||||
|
@ -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) {
|
||||
|
@ -14,69 +14,69 @@
|
||||
<h1><?= t("User registration adminstration") ?></h1>
|
||||
<div id="g-registration-admin" class="g-block-content">
|
||||
<?= form::open($action, array("method" => "post"), $hidden) ?>
|
||||
<?= form::open_fieldset() ?>
|
||||
<legend><?= t("Confirmation policy") ?></legend>
|
||||
<ul>
|
||||
<? foreach ($policy_list as $policy => $text): ?>
|
||||
<li>
|
||||
<?= form::radio("policy", $policy, $policy == $form["policy"]) ?>
|
||||
<?= form::label("policy", $text) ?>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
<li>
|
||||
<?= form::checkbox("email_verification", "true", !empty($form["email_verification"]), $disable_email) ?>
|
||||
<?= form::label("email_verification", t("Require e-mail verification when a visitor creates an account")) ?>
|
||||
</li>
|
||||
<li>
|
||||
<? if (!empty($group_list)): ?>
|
||||
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
|
||||
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= form::submit(array("id" => "g-registration-admin", "name" => "save", "class" => "submit", "style" => "clear:both!important"), t("Update")) ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?= form::close_fieldset() ?>
|
||||
<?= form::close() ?>
|
||||
<fieldset>
|
||||
<legend><?= t("Confirmation policy") ?></legend>
|
||||
<ul>
|
||||
<? foreach ($policy_list as $policy => $text): ?>
|
||||
<li>
|
||||
<?= form::radio("policy", $policy, $policy == $form["policy"]) ?>
|
||||
<?= form::label("policy", $text) ?>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
<li>
|
||||
<?= form::checkbox("email_verification", "true", !empty($form["email_verification"]), $disable_email) ?>
|
||||
<?= form::label("email_verification", t("Require e-mail verification when a visitor creates an account")) ?>
|
||||
</li>
|
||||
<li>
|
||||
<? if (!empty($group_list)): ?>
|
||||
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
|
||||
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= form::submit(array("id" => "g-registration-admin", "name" => "save", "class" => "submit", "style" => "clear:both!important"), t("Update")) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<? if (count($pending)): ?>
|
||||
<div id="g-activate-pending-users">
|
||||
<?= form::open($activate, array("method" => "post"), $hidden) ?>
|
||||
<?= form::open_fieldset() ?>
|
||||
<legend><?= t("Pending registrations") ?></legend>
|
||||
<table>
|
||||
<caption>
|
||||
<?= t("To delete an unconfirmed registration, first activate it, then delete it from Users/Groups.") ?>
|
||||
</caption>
|
||||
<tr>
|
||||
<th><?= t("Activate") ?></th>
|
||||
<th><?= t("State") ?></th>
|
||||
<th><?= t("User name") ?></th>
|
||||
<th><?= t("Full name") ?></th>
|
||||
<th><?= t("Email") ?></th>
|
||||
<th><?= t("Registered") ?></th>
|
||||
</tr>
|
||||
<? foreach ($pending as $user): ?>
|
||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td>
|
||||
<? if ($user->state != 2): ?>
|
||||
<?= form::checkbox("activate[]", $user->id) ?>
|
||||
<? else: ?>
|
||||
|
||||
<? endif ?>
|
||||
</td>
|
||||
<td><?= register::format_registration_state($user->state) ?></td>
|
||||
<td><?= t($user->name) ?></td>
|
||||
<td><?= t($user->full_name) ?></td>
|
||||
<td><a href="mailto:<?= t($user->email) ?>"><?= t($user->email) ?></a></td>
|
||||
<td><?= t(gallery::date_time($user->request_date)) ?></td>
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
</table>
|
||||
<?= form::submit(array("id" => "g-registration-activate", "name" => "activate_users", "class" => "submit"), t("Activate selected")) ?>
|
||||
<?= form::close_fieldset() ?>
|
||||
<?= form::close() ?>
|
||||
<fieldset>
|
||||
<legend><?= t("Pending registrations") ?></legend>
|
||||
<table>
|
||||
<caption>
|
||||
<?= t("To delete an unconfirmed registration, first activate it, then delete it from Users/Groups.") ?>
|
||||
</caption>
|
||||
<tr>
|
||||
<th><?= t("Activate") ?></th>
|
||||
<th><?= t("State") ?></th>
|
||||
<th><?= t("User name") ?></th>
|
||||
<th><?= t("Full name") ?></th>
|
||||
<th><?= t("Email") ?></th>
|
||||
<th><?= t("Registered") ?></th>
|
||||
</tr>
|
||||
<? foreach ($pending as $user): ?>
|
||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td>
|
||||
<? if ($user->state != 2): ?>
|
||||
<?= form::checkbox("activate[]", $user->id) ?>
|
||||
<? else: ?>
|
||||
|
||||
<? endif ?>
|
||||
</td>
|
||||
<td><?= register::format_registration_state($user->state) ?></td>
|
||||
<td><?= t($user->name) ?></td>
|
||||
<td><?= t($user->full_name) ?></td>
|
||||
<td><a href="mailto:<?= t($user->email) ?>"><?= t($user->email) ?></a></td>
|
||||
<td><?= t(gallery::date_time($user->request_date)) ?></td>
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
</table>
|
||||
<?= form::submit(array("id" => "g-registration-activate", "name" => "activate_users", "class" => "submit"), t("Activate selected")) ?>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<? endif ?>
|
||||
</div>
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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 .= "<li>";
|
||||
|
@ -35,7 +35,7 @@
|
||||
<?
|
||||
$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): ?>
|
||||
|
@ -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)"));
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -2,12 +2,12 @@
|
||||
<?
|
||||
// Check and see if the current photo has any faces or notes associated with it.
|
||||
$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, 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 @@
|
||||
<style>
|
||||
.transparent30
|
||||
{
|
||||
filter:alpha(opacity=30);
|
||||
-moz-opacity: 0.3;
|
||||
opacity: 0.3;
|
||||
filter:alpha(opacity=30);
|
||||
-moz-opacity: 0.3;
|
||||
opacity: 0.3;
|
||||
}
|
||||
.transparent80
|
||||
{
|
||||
filter:alpha(opacity=80);
|
||||
-moz-opacity: 0.8;
|
||||
opacity: 0.8;
|
||||
filter:alpha(opacity=80);
|
||||
-moz-opacity: 0.8;
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
var photodiv = document.getElementById('g-photo');
|
||||
var photoimg = document.getElementById('<?="g-photo-id-{$item->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 + '<br/>' + 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();
|
||||
</script>
|
||||
|
||||
<div id="divtagtext" class="transparent80" style="position:absolute;display:none;border:2px #000000 outset;background-color:#ffffff;font-weight:bold;"></div>
|
||||
<div id="divtagtext" class="transparent80" style="position:absolute;display:none;border:2px #000000 outset;background-color:#ffffff;font-weight:bold;"></div>
|
||||
<div id="divsquare" class="transparent30" onMouseOut="hidebox()" style="position:absolute;display:none;border:2px solid #000000;background-color:#ffffff;" onclick="self.location.href = '';"></div>
|
||||
|
||||
<map name="faces">
|
||||
|
@ -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);
|
||||
|
@ -50,7 +50,7 @@
|
||||
<?
|
||||
// Check and see if this ID already has GPS data, display a delete button if it does.
|
||||
$existingGPS = ORM::factory("tags_gps")
|
||||
->where("tag_id", $tag->id)
|
||||
->where("tag_id", "=", $tag->id)
|
||||
->find_all();
|
||||
if (count($existingGPS) > 0) {
|
||||
?>
|
||||
@ -69,7 +69,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="g-block">
|
||||
<div class="g-block">
|
||||
<h3>
|
||||
<?= t("Remove Orphaned GPS Data") ?>
|
||||
</h3>
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user