Exemplo n.º 1
0
 private static function _add_comment()
 {
     srand(time());
     $photos = ORM::factory("item")->where("type", "photo")->find_all()->as_array();
     $users = ORM::factory("user")->find_all()->as_array();
     if (empty($photos)) {
         return;
     }
     if (module::is_active("akismet")) {
         akismet::$test_mode = 1;
     }
     $photo = $photos[array_rand($photos)];
     $author = $users[array_rand($users)];
     $guest_name = ucfirst(self::_random_phrase(rand(1, 3)));
     $guest_email = sprintf("%s@%s.com", self::_random_phrase(1), self::_random_phrase(1));
     $guest_url = sprintf("http://www.%s.com", self::_random_phrase(1));
     comment::create($photo, $author, self::_random_phrase(rand(8, 500)), $guest_name, $guest_email, $guest_url);
 }
Exemplo n.º 2
0
 function add_comments($count)
 {
     srand(time());
     $photos = ORM::factory("item")->where("type", "photo")->find_all()->as_array();
     $users = ORM::factory("user")->find_all()->as_array();
     if (empty($photos)) {
         url::redirect("scaffold");
     }
     if (module::is_active("akismet")) {
         akismet::$test_mode = 1;
     }
     for ($i = 0; $i < $count; $i++) {
         $photo = $photos[array_rand($photos)];
         $author = $users[array_rand($users)];
         $guest_name = ucfirst($this->random_phrase(rand(1, 3)));
         $guest_email = sprintf("%s@%s.com", $this->random_phrase(1), $this->random_phrase(1));
         $guest_url = sprintf("http://www.%s.com", $this->random_phrase(1));
         comment::create($photo, $author, $this->random_phrase(rand(8, 500)), $guest_name, $guest_email, $guest_url);
     }
     url::redirect("scaffold");
 }