[pLog-svn] r2089 - plog/branches/plog-1.1-ben

ork at devel.plogworld.net ork at devel.plogworld.net
Sun May 29 13:10:44 GMT 2005


Author: ork
Date: 2005-05-29 13:10:43 +0000 (Sun, 29 May 2005)
New Revision: 2089

Removed:
   plog/branches/plog-1.1-ben/generateRandomData.php
Log:
generateData.php is better :)


Deleted: plog/branches/plog-1.1-ben/generateRandomData.php
===================================================================
--- plog/branches/plog-1.1-ben/generateRandomData.php	2005-05-28 22:19:09 UTC (rev 2088)
+++ plog/branches/plog-1.1-ben/generateRandomData.php	2005-05-29 13:10:43 UTC (rev 2089)
@@ -1,96 +0,0 @@
-<?
-
-function generateRandomWord($lenght, $uppercase = false, $html = true) {
-    $newcode_length = 1;
-    while($newcode_length < $lenght) {
-        $a=97;
-        $b=122;
-        if ($newcode_length == 1) {
-            if (rand(1,4) == 1 || $uppercase) {
-                $a=65;
-                $b=90;
-            }
-        }
-        $code_part=chr(rand($a,$b));
-        $newcode_length++;
-        $newcode = $newcode.$code_part;
-    }
-    if ($html && rand(1, 50) == 1) {
-        return "<a href=\"http://www.plogworld.net\">$newcode</a>";
-    }
-    return $newcode;
-}
-
-function generateRandomWords( $count, $uppercase = false, $html = true) {
-    $words = generateRandomWord( rand( 3, 12), $uppercase );
-    for ($i = 1; $i < $count; $i++) {
-        $rand = rand(3, 12);
-        $words .= ' ' . generateRandomWord( $rand );
-    }
-    return $words;
-}
-
-function generateRandomParagraph() {
-    $length = rand( 3, 20 );
-    $counter = 0;
-    $text = '<p>' . generateRandomWord( rand( 3, 12 ), true );
-    while ($counter < $length) {
-        $word = generateRandomWords( rand(3, 12) );
-        $text = $text . ' ' . $word;
-        $counter++;
-    }
-    $text .= "</p>";
-    return $text;
-}
-
-function generateRandomParagraphs( $count ) {
-    $text = '';
-    for ($i = 1; $i < $count; $i++) {
-        $text .= generateRandomParagraph();
-    }
-    return $text;
-}
-
-function generateRandomDate() {
-    // generate random date between 2000-01-01 and now
-    $time = rand(strtotime('01 January 2005'), time());
-    return date("Y-m-d H:i:s", $time);
-}
-
-define( "PLOG_CLASS_PATH", "./" );
-
-require_once( "class/dao/article.class.php" );
-require_once( "class/dao/articles.class.php" );
-require_once( "class/dao/usercomment.class.php" );
-require_once( "class/dao/articlecomments.class.php" );
-require_once( "class/dao/articlecommentstatus.class.php" );
-
-$articles = new Articles();
-$comments = new ArticleComments();
-for ($i=0; $i < 10; $i++) {
-    $articleText = generateRandomParagraph( );
-    $article = new Article(generateRandomWords( rand(2, 5), true, false ),
-                           generateRandomParagraphs( rand(1, 4) ),
-                           array( 1 ),
-                           1,
-                           1,
-                           POST_STATUS_PUBLISHED,
-                           1);
-    $article->setDate( generateRandomDate() );
-    $article->setCommentsEnabled( true );
-    $postId = $articles->addArticle( $article );
-    for( $i = rand(0, 9); $i < 10; $i++) {
-        $comment = new UserComment( $postId,
-                                    0,
-                                    generateRandomWords( rand(2, 5), true ),
-                                    generateRandomParagraphs( rand(1 ,2) ),
-                                    generateRandomDate(),
-                                    generateRandomWord( rand(3, 8) ));
-        $comment->setClientIp( '192.168.1.1' );
-        $comment->setStatus( COMMENT_STATUS_NONSPAM );
-        $comments->addComment( $comment );
-    }
-}
-
-
-?>




More information about the pLog-svn mailing list