diff options
| author | Felix Rabinovich <virshu@users.sourceforge.net> | 2008-11-16 05:46:42 +0000 | 
|---|---|---|
| committer | Felix Rabinovich <virshu@users.sourceforge.net> | 2008-11-16 05:46:42 +0000 | 
| commit | f27929e1266194eb9b4b3de9b4926e0494290017 (patch) | |
| tree | 4d9cb824b747a29ad95205b81c77b7b2de2ede58 /core/controllers/welcome.php | |
| parent | 2d463c5531004b868ba12a577d6ea1b47d7b4b73 (diff) | |
create a regular user and make scaffolding assign owner to logged in user
Diffstat (limited to 'core/controllers/welcome.php')
| -rw-r--r-- | core/controllers/welcome.php | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 40b8390a..523cccb8 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -142,7 +142,8 @@ class Welcome_Controller extends Template_Controller {      $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array();      try { -      $user_id = ORM::factory("user")->find()->id; +      $user = Session::instance()->get("user"); +      $owner_id = $user ? $user->id : ORM::factory("user")->find()->id;      } catch (Exception $e) {        $user_id = null;      } @@ -151,12 +152,12 @@ class Welcome_Controller extends Template_Controller {        $parent = $parents[array_rand($parents)];        if (!rand(0, 10)) {          $parents[] = album::create( -          $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $user_id) +          $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $owner_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", $user_id); +                      "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $owner_id);        }        if (!($i % 100)) { | 
