summaryrefslogtreecommitdiff
path: root/core/controllers/items.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-21 04:43:47 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-21 04:43:47 +0000
commit0573698155f04d6ccb6a68cf63fdeb8c73501576 (patch)
tree53c29ba805dfbb9882ae5408b4c2d12b5f724b0c /core/controllers/items.php
parent4c2ddfb8681392b98f0c10ef7f40937c77e5f20f (diff)
Add some more logging code. Now the site admin has some log entries to look at.
Diffstat (limited to 'core/controllers/items.php')
-rw-r--r--core/controllers/items.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/controllers/items.php b/core/controllers/items.php
index efbfa8d9..36d88084 100644
--- a/core/controllers/items.php
+++ b/core/controllers/items.php
@@ -61,12 +61,15 @@ class Items_Controller extends REST_Controller {
$this->input->post("title", $this->input->post("name")),
$this->input->post("description"),
$owner_id);
- url::redirect("albums/{$album->id}");
+ log::add("content", "Created an album", log::INFO,
+ html::anchor("albums/$album->id", "view album"));
+ url::redirect("albums/$album->id");
break;
case "photo":
if (is_array($_FILES["file"]["name"])) {
- for ($i = 0; $i < count($_FILES["file"]["name"]) - 1; $i++) {
+ $count = count($_FILES["file"]["name"]);
+ for ($i = 0; $i < $count - 1; $i++) {
if ($_FILES["file"]["error"][$i] == 0) {
$photo = photo::create(
$item->id,
@@ -78,7 +81,9 @@ class Items_Controller extends REST_Controller {
throw new Exception("@todo ERROR_IN_UPLOAD_FILE");
}
}
- url::redirect("albums/{$item->id}");
+ log::add("content", "Added $count photos", log::INFO,
+ html::anchor("albums/$item->id", "view album"));
+ url::redirect("albums/$item->id");
} else {
$photo = photo::create(
$item->id,
@@ -87,7 +92,9 @@ class Items_Controller extends REST_Controller {
$this->input->post("title", $this->input->post("name")),
$this->input->post("description"),
$owner_id);
- url::redirect("photos/{$photo->id}");
+ log::add("content", "Added a photo", log::INFO,
+ html::anchor("photos/$photo->id", "view photo"));
+ url::redirect("photos/$photo->id");
}
break;
}