diff options
Diffstat (limited to 'modules/exif')
-rw-r--r-- | modules/exif/helpers/exif.php | 28 | ||||
-rw-r--r-- | modules/exif/helpers/exif_task.php | 19 | ||||
-rw-r--r-- | modules/exif/helpers/exif_theme.php | 6 |
3 files changed, 27 insertions, 26 deletions
diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php index 5ddd09d4..3baed177 100644 --- a/modules/exif/helpers/exif.php +++ b/modules/exif/helpers/exif.php @@ -39,7 +39,7 @@ class exif_Core { if (function_exists("mb_detect_encoding") && mb_detect_encoding($value) != "UTF-8") { $value = utf8_encode($value); } - $keys[$field] = utf8::clean($value); + $keys[$field] = Input::clean($value); if ($field == "DateTime") { $time = strtotime($value); @@ -62,7 +62,7 @@ class exif_Core { if (function_exists("mb_detect_encoding") && mb_detect_encoding($value) != "UTF-8") { $value = utf8_encode($value); } - $keys[$keyword] = utf8::clean($value); + $keys[$keyword] = Input::clean($value); if ($keyword == "Caption" && !$item->description) { $item->description = $value; @@ -73,8 +73,8 @@ class exif_Core { } $item->save(); - $record = ORM::factory("exif_record")->where("item_id", $item->id)->find(); - if (!$record->loaded) { + $record = ORM::factory("exif_record")->where("item_id", "=", $item->id)->find(); + if (!$record->loaded()) { $record->item_id = $item->id; } $record->data = serialize($keys); @@ -86,9 +86,9 @@ class exif_Core { static function get($item) { $exif = array(); $record = ORM::factory("exif_record") - ->where("item_id", $item->id) + ->where("item_id", "=", $item->id) ->find(); - if (!$record->loaded) { + if (!$record->loaded()) { return array(); } @@ -139,19 +139,19 @@ class exif_Core { } static function stats() { - $missing_exif = Database::instance() + $missing_exif = db::build() ->select("items.id") ->from("items") ->join("exif_records", "items.id", "exif_records.item_id", "left") - ->where("type", "photo") - ->open_paren() - ->where("exif_records.item_id", null) - ->orwhere("exif_records.dirty", 1) - ->close_paren() - ->get() + ->where("type", "=", "photo") + ->and_open() + ->where("exif_records.item_id", "IS", null) + ->or_where("exif_records.dirty", "=", 1) + ->close() + ->execute() ->count(); - $total_items = ORM::factory("item")->where("type", "photo")->count_all(); + $total_items = ORM::factory("item")->where("type", "=", "photo")->count_all(); if (!$total_items) { return array(0, 0, 0); } diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php index 7c4c97c4..27352643 100644 --- a/modules/exif/helpers/exif_task.php +++ b/modules/exif/helpers/exif_task.php @@ -20,10 +20,11 @@ class exif_task_Core { static function available_tasks() { // Delete extra exif_records - Database::instance()->query( - "DELETE FROM {exif_records} " . - "WHERE {exif_records}.`item_id` NOT IN " . - "(SELECT `id` FROM {items} WHERE {items}.`type` = 'photo')"); + db::build() + ->delete("exif_records") + ->where("item_id", "NOT IN", + db::build()->select("id")->from("items")->where("type", "=", "photo")) + ->execute(); list ($remaining, $total, $percent) = exif::stats(); return array(Task_Definition::factory() @@ -44,11 +45,11 @@ class exif_task_Core { $start = microtime(true); foreach (ORM::factory("item") ->join("exif_records", "items.id", "exif_records.item_id", "left") - ->where("type", "photo") - ->open_paren() - ->where("exif_records.item_id", null) - ->orwhere("exif_records.dirty", 1) - ->close_paren() + ->where("type", "=", "photo") + ->and_open() + ->where("exif_records.item_id", "IS", null) + ->or_where("exif_records.dirty", "=", 1) + ->close() ->find_all() as $item) { // The query above can take a long time, so start the timer after its done // to give ourselves a little time to actually process rows. diff --git a/modules/exif/helpers/exif_theme.php b/modules/exif/helpers/exif_theme.php index bb6926d3..23dc95c2 100644 --- a/modules/exif/helpers/exif_theme.php +++ b/modules/exif/helpers/exif_theme.php @@ -21,11 +21,11 @@ class exif_theme_Core { static function sidebar_bottom($theme) { $item = $theme->item(); if ($item && $item->is_photo()) { - $record = Database::instance() + $record = db::build() ->select("key_count") ->from("exif_records") - ->where("item_id", $item->id) - ->get() + ->where("item_id", "=", $item->id) + ->execute() ->current(); if ($record && $record->key_count) { $view = new View("exif_sidebar.html"); |