diff options
Diffstat (limited to 'core/controllers')
-rw-r--r-- | core/controllers/welcome.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 8bf5138a..b411e314 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -91,15 +91,22 @@ class Welcome_Controller extends Template_Controller { function add($count) { srand(time()); $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array(); + $user_module = ORM::factory("module")->where("name", "user")->find(); + + if ($user_module->loaded) { + $user_id = ORM::factory("user")->find()->id; + } else { + $user_id = null; + } for ($i = 0; $i < $count; $i++) { $parent = $parents[array_rand($parents)]; if (!rand(0, 10)) { - $parents[] = album::create($parent->id, "rnd_" . rand(), "Rnd $i", "rnd $i") + $parents[] = album::create($parent->id, "rnd_" . rand(), "Rnd $i", "rnd $i", "random album $i", $user_id) ->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150) ->save(); } else { photo::create($parent->id, DOCROOT . "themes/default/images/thumbnail.jpg", - "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail"); + "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $user_id); } if (!($i % 100)) { |