diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-29 22:47:15 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-29 22:47:15 +0000 |
commit | 4271f7702a2754d8470949209f2db82990eb2d1a (patch) | |
tree | 6c7bc6933f58a0462373f550d219ab07308d51f4 /core/controllers | |
parent | 6c2869f8227944e56b6bb73da0d72b4c52f87da9 (diff) |
Add access model (not fully baked yet).
Update scaffolding to allow addition of just albums (helpful for testing permissions)
Diffstat (limited to 'core/controllers')
-rw-r--r-- | core/controllers/welcome.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 5cf6d7bf..b6c4f381 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -162,7 +162,7 @@ class Welcome_Controller extends Template_Controller { url::redirect("welcome"); } - function add_albums_and_photos($count) { + function add_albums_and_photos($count, $desired_type=null) { srand(time()); $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array(); @@ -174,8 +174,14 @@ class Welcome_Controller extends Template_Controller { } for ($i = 0; $i < $count; $i++) { + set_time_limit(30); + $parent = $parents[array_rand($parents)]; - if (!rand(0, 10)) { + $type = $desired_type; + if (!$type) { + $type = rand(0, 10) ? "photo" : "album"; + } + if ($type == "album") { $parents[] = album::create( $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $owner_id) ->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150) @@ -184,10 +190,6 @@ class Welcome_Controller extends Template_Controller { photo::create($parent->id, DOCROOT . "themes/default/images/thumbnail.jpg", "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $owner_id); } - - if (!($i % 100)) { - set_time_limit(30); - } } url::redirect("welcome"); } |