diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-19 00:48:45 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-19 00:48:45 +0000 |
commit | 5ca17fd273c19a2d9fbff11d3c4bcf426d2cc6a9 (patch) | |
tree | 0168a413111b445342469f28e20d0ff21689fc15 /core | |
parent | 77c97daa3725bb92690e38d52b0619843fede3ef (diff) |
Allow server-side adding of images to other albums than the root
Diffstat (limited to 'core')
-rw-r--r-- | core/controllers/welcome.php | 8 | ||||
-rw-r--r-- | core/views/welcome.html.php | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 9ac22318..55ec9164 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -190,11 +190,17 @@ class Welcome_Controller extends Template_Controller { function add_photos() { $path = $this->input->post("path"); + $parent_id = (int)$this->input->post("parent_id"); + $parent = ORM::factory("item", $parent_id); + if (!$parent->loaded) { + throw new Exception("@todo BAD_ALBUM"); + } + cookie::set("add_photos_path", $path); foreach (glob("$path/*.[Jj][Pp][Gg]") as $file) { set_time_limit(30); - photo::create(1, $file, basename($file), basename($file)); + photo::create($parent->id, $file, basename($file), basename($file)); } url::redirect("welcome"); } diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index 7f3d27a9..82043499 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -268,6 +268,8 @@ <input type="submit" value="upload"/> <input type="text" name="path" size="70" value="<?= cookie::get("add_photos_path") ?>" /> + <br> + Album id: <input name="parent_id" type="text" size="3" value="1"/> </form> </fieldset> <fieldset> |