示例#1
0
function generateRandomPerson()
{
    $randomDate = new DateTime();
    $start = new DateTime("1970-1-1");
    $end = new DateTime("2000-12-31");
    $randomSecond = rand($start->getTimestamp(), $end->getTimestamp());
    $randomDate = $randomDate->setTimestamp($randomSecond);
    return new Student(array("firstName" => randomWord(), 'lastName' => randomWord(), "birthdate" => $randomDate));
}
示例#2
0
define('DIR_TEMPLATE', DIR_APP_SECTION . 'view/template/');
define('INSTALL', 'true');
// Relative paths and directories
define('RDIR_TEMPLATE', 'view/');
// Startup with local init
require_once 'init.php';
//Check if cart is already installed
if (file_exists(DIR_SYSTEM . 'config.php')) {
    require_once DIR_SYSTEM . 'config.php';
}
if (isset($_SESSION['SALT']) && strlen($_SESSION['SALT']) == 4) {
    define('SALT', $_SESSION['SALT']);
}
//generate salt
if (!defined('SALT')) {
    DEFINE('SALT', randomWord(4));
    $_SESSION['SALT'] = SALT;
}
$data_exist = false;
if (defined('DB_HOSTNAME') && DB_HOSTNAME) {
    $db = new ADB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
    $r = $db->query("SELECT product_id FROM " . DB_PREFIX . "products");
    $data_exist = $r->num_rows;
} else {
    unset($session->data['finish']);
}
if ($data_exist && empty($session->data['finish'])) {
    header('Location: ../');
}
if (!empty($session->data['finish']) && $session->data['finish'] == 'true') {
    $request->get['rt'] = 'finish';
示例#3
0
 private function _configure()
 {
     define('DB_PREFIX', $this->session->data['install_step_data']['db_prefix']);
     $content = "<?php\n";
     $content .= "/**\n";
     $content .= "\tAbanteCart, Ideal OpenSource Ecommerce Solution\n";
     $content .= "\thttp://www.AbanteCart.com\n";
     $content .= "\tCopyright © 2011-'.date('Y').' Belavier Commerce LLC\n\n";
     $content .= "\tReleased under the Open Software License (OSL 3.0)\n";
     $content .= "*/\n";
     $content .= "// Admin Section Configuration. You can change this value to any name. Will use ?s=name to access the admin\n";
     $content .= "define('ADMIN_PATH', '" . $this->session->data['install_step_data']['admin_path'] . "');\n\n";
     $content .= "// Database Configuration\n";
     $content .= "define('DB_DRIVER', '" . $this->session->data['install_step_data']['db_driver'] . "');\n";
     $content .= "define('DB_HOSTNAME', '" . $this->session->data['install_step_data']['db_host'] . "');\n";
     $content .= "define('DB_USERNAME', '" . $this->session->data['install_step_data']['db_user'] . "');\n";
     $content .= "define('DB_PASSWORD', '" . $this->session->data['install_step_data']['db_password'] . "');\n";
     $content .= "define('DB_DATABASE', '" . $this->session->data['install_step_data']['db_name'] . "');\n";
     $content .= "define('DB_PREFIX', '" . DB_PREFIX . "');\n";
     $content .= "// Unique AbanteCart store ID\n";
     $content .= "define('UNIQUE_ID', '" . md5(time()) . "');\n";
     $content .= "// Salt key for oneway encryption of passwords. NOTE: Change of SALT key will cause a loss of all existing users' and customers' passwords!\n";
     $content .= "define('SALT', '" . SALT . "');\n";
     $content .= "// Encryption key for protecting sensitive information. NOTE: Change of this key will cause a loss of all existing encrypted information!\n";
     $content .= "define('ENCRYPTION_KEY', '" . randomWord(6) . "');\n";
     $file = fopen(DIR_ABANTECART . 'system/config.php', 'w');
     fwrite($file, $content);
     fclose($file);
     return null;
 }
示例#4
0
function phpsum($minWords = 100, $maxWords = null, $minNumParagraphs = -1, $maxNumParagraphs = null, $options = null)
{
    if (is_array($maxWords)) {
        $options = $maxWords;
        $maxWords = null;
    } elseif (is_array($minNumParagraphs)) {
        $options = $minNumParagraphs;
        $minNumParagraphs = -1;
    } elseif (is_array($maxNumParagraphs)) {
        $options = $maxNumParagraphs;
        $maxNumParagraphs = null;
    }
    // if options array is placed last
    if (is_array($minWords)) {
        // if options array is placed first
        $tempOptions = $options;
        $options = $minWords;
        $minWords = $maxWords === null ? 100 : $maxWords;
        $maxWords = $minNumParagraphs == -1 ? null : $minNumParagraphs;
        $minNumParagraphs = $maxNumParagraphs === null ? -1 : $maxNumParagraphs;
        $maxNumParagraphs = $tempOptions === null ? null : $tempOptions;
    }
    if ($minNumParagraphs < 0) {
        $pTags = false;
        $minNumParagraphs = 1;
    } else {
        $pTags = true;
    }
    $duplicateParagraphs = isset($options['duplicateParagraphs']) ? $options['duplicateParagraphs'] == "true" ? true : false : false;
    $nums = isset($options['nums']) ? $options['nums'] == "true" ? true : false : false;
    $specialChars = isset($options['specialChars']) ? $options['specialChars'] == "true" ? true : false : false;
    $doubleSpace = isset($options['doubleSpace']) ? $options['doubleSpace'] == "true" ? true : false : false;
    $lorem = isset($options['lorem']) ? $options['lorem'] == "false" ? false : true : true;
    $periods = isset($options['periods']) ? $options['periods'] == "false" ? false : true : true;
    $caps = isset($options['caps']) ? $options['caps'] == "false" ? false : true : true;
    $html = isset($options['html']) ? $options['html'] == "false" ? false : true : true;
    $vowelSense = isset($options['vowelSense']) ? $options['vowelSense'] == "false" ? false : true : true;
    $minCharsInWords = isset($options['minCharsInWords']) ? $options['minCharsInWords'] : 2;
    $maxCharsInWords = isset($options['maxCharsInWords']) ? $options['maxCharsInWords'] : 8;
    $minWordsInSentences = isset($options['minWordsInSentences']) ? $options['minWordsInSentences'] : 4;
    $maxWordsInSentences = isset($options['maxWordsInSentences']) ? $options['maxWordsInSentences'] : 12;
    if (!is_int($minCharsInWords) || !is_int($maxCharsInWords) || !is_int($minWordsInSentences) || !is_int($maxWordsInSentences)) {
        return "Must be an integer.";
    }
    if ($minCharsInWords > $maxCharsInWords || $minWordsInSentences > $maxWordsInSentences) {
        return "Min cannot be larger than max.";
    }
    if ($minCharsInWords <= 0 || $maxCharsInWords <= 0 || $minNumParagraphs <= 0 || $minWordsInSentences <= 0 || $maxWordsInSentences <= 0 || $minWords <= 0) {
        return "Must be greater than 0.";
    }
    if ($lorem == true && $minWordsInSentences < 2 || $minWordsInSentences <= 0) {
        return "Sentences are too short." . ($lorem == true && $minWordsInSentences < 2 ? " Set lorem='false' or minWordsInSentences to 2 or above." : "");
    }
    $myString = "";
    if ($maxNumParagraphs !== null && is_int($maxNumParagraphs)) {
        $numParagraphs = mt_rand($minNumParagraphs, $maxNumParagraphs);
    } else {
        $numParagraphs = $minNumParagraphs;
    }
    for ($i = 0; $i < $numParagraphs; $i++) {
        if ($maxWords !== null) {
            $numWords = mt_rand($minWords, $maxWords);
        } else {
            $numWords = $minWords;
        }
        if ($lorem && $i == 0) {
            if ($lorem && $i == 0 && $numWords > 2) {
                $myString = "Lorem ipsum ";
            } elseif ($lorem && $i == 0 && $numWords > 1) {
                $myString = "Lorem ipsum.";
            } elseif ($lorem && $i == 0 && $numWords > 0) {
                $myString = "Lorem.";
            }
            $numWords = $numWords - 2;
        }
        $j = 0;
        while ($j < $numWords) {
            $thisSentenceLength = mt_rand($minWordsInSentences, $maxWordsInSentences);
            if ($i > 0 && $j == 0 && $html == false) {
                $thisSentence = "\r\t";
            } else {
                $thisSentence = "";
            }
            if ($numWords == 0) {
                break;
            }
            if ($i == 0 && $j == 0 && $lorem == true && $thisSentenceLength <= $minWordsInSentences + 1) {
                $thisSentenceLength = $maxWordsInSentences - 2;
            }
            for ($k = 0; $k < $thisSentenceLength; $k++) {
                $thisWordLength = mt_rand($minCharsInWords, $maxCharsInWords);
                $thisSentence .= randomWord($thisWordLength, $k == 0 && !($i == 0 && $j == 0 && $lorem == true) ? true : false, $vowelSense, $nums, $specialChars) . " ";
                $j++;
                if ($j == $numWords) {
                    break;
                }
            }
            $myString .= htmlspecialchars(rtrim($thisSentence)) . ". " . ($doubleSpace ? " " : "");
        }
        if ($numParagraphs > 1 && $numParagraphs - 1 !== $i) {
            $myString = rtrim($myString) . "</p>" . PHP_EOL . PHP_EOL . "<p>";
        }
        if ($duplicateParagraphs) {
            $initialParagraph = $myString;
            for ($l = 0; $l < $numParagraphs - 1; $l++) {
                $myString = $myString . $initialParagraph;
            }
            break;
        }
    }
    if ($caps == false) {
        $myString = strtolower($myString);
    }
    if ($periods == false) {
        $myString = str_replace(".", "", $myString);
    }
    if ($html) {
        return ($pTags ? "<p>" : "") . rtrim($myString) . ($pTags ? "</p>" : "");
    } else {
        return "\t" . str_replace(array("<p>", "</p>"), "", rtrim($myString));
    }
}
示例#5
0
echo "<script src=\"http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js\"></script>\n";
echo "<section id = \"Random\" data-role = \"page\">\n";
echo "\t<header data-role = \"header\">\n";
echo "\t\t<h1>Random</h1>\n";
echo "\t</header>\n";
echo "\t\t<div class = \"ui-btn-active\" data-role = \"navbar\">\n";
echo "\t\t\t<ul data-role = \"navbar\">\n";
echo "\t\t\t\t<li><a href = \"index.php#NewSearch\" data-transition=\"fade\">NEW SEARCH</a></li>\n";
echo "\t\t\t\t<li><a href = \"index.php#TopRated\" data-transition=\"fade\">TOP RATED</a></li>\n";
echo "\t\t\t\t<li><a href = \"random.php\" data-transition=\"fade\">RANDOM</a></li>\n";
echo "\t\t\t</ul>\n";
echo "\t\t</div> \n";
echo "\t\t</br>\n";
echo "\t\n";
echo "<form method=\"post\" action=\"jargon.php\">\n";
echo "<input type=\"hidden\" name=\"result\" value=\"" . randomWord() . "\" />";
echo "\t\t<input type=\"submit\" value=\"Randomize\"/></br>\n";
echo "</form>";
echo "\t\n";
echo "  <footer data-role = \"footer\" data-position=\"fixed\">\n";
echo "      \n";
echo "\t\t<div class = \"ui-btn-active\" data-role = \"navbar\">\n";
echo "\t\t\t<ul data-role = \"navbar\">\n";
echo "\t\t\t\t<li><a href=\"index.php#MainPage\" data-role=\"navbar\" data-transition=\"fade\">Back to Main Page</a></li>\n";
echo "\t\t\t</ul>\n";
echo "\t\t</div>\n";
echo "  \n";
echo "  </footer>\n";
echo "</section>\n";
echo "</body>\n";
echo "</html>\n";
示例#6
0
/*foreach($a_lexiList as $item)
  getJargon($item);*/
// gen ratings
/*foreach($a_lexiList as $item)
  getRating($item);*/
/*$myLexiSearch = lexiSearch('hac');
  if(gettype($myLexiSearch) == "array")
      foreach($myLexiSearch as $i => $item)
          echo '<br> possiblity ' . $i . ' ' . $a_lexiList['name'][$item];
  else
      echo '<br> lexiSearch: ' . $a_lexiList['name'][$myLexiSearch]; */
$searchJargon = new JarSearch();
$searchJargon->search(1337);
//$a_lexiList = $searchJargon->getLexiList();
echo '<br>';
print_r($searchJargon->getNames());
foreach ($searchJargon->getNames() as $i => $item) {
    echo '<br> $item[' . $i . ']: ' . $item;
}
$word = randomWord();
echo '<br>';
print_r($word);
echo '<br>';
$a_top = getTopRate();
echo '<br>';
print_r($a_top);
/*$a_ratJar = getRating('hack');
  
  $a_ratJar = setRating(true, 'hack', $a_ratJar);
  echo '<br>';
  print_r($a_ratJar);*/