Пример #1
0
function testDateTimeParser()
{
    $lines = array("seeking: slo to oakland thursday 11/10 7pm", "seeking: slo ---> sacramento / davis november 10 thursday after 9am will provide gas \$\$\$", "seeking: slo to oakland 11/10 thursday around 7pm", "seeking: slo to oakland 11/10/2016 around 7 or 8pm", "seeking: SLO to Berkeley friday 11/11 anytime or slo to sac 11/11 arriving in sac before 11 am and Berkeley to SLO 11/13", "seeking: SLO to bay area tuesday nov 22 afternoon/evening", "offering from bayarea san mateo area to slo departing friday 8/7 between 6 to 7pm message me if interested", "offering sac to slo this saturday august 8 can pick up along the way", "offering north oc sgv la to slo sunday evening 8/9 around 6 or 7 returning tue 8/11 late afternoon can pickup or dropoff anywhere along the way", "offering tahoe to slo 8/5/15 will leave around 4 pm from tahoe will take hwy 50 through sac and take int 5 can pick up along the way down asking for for gas ", "offering west hills calabasas area to slo august 6 thursday morning around 9am", "offering ride to slo petaluma northbay to slo august 7 8/7 at 6 pm can pick up anywhere along on the way slo to petaluma on sunday august 9 8/9 in the evening can drop off anywhere along my route", "offering slo to bayarea menlo park / on the way to sfo thursday around 5pm", "offering carpinteria right by sb up to sj friday night can pick up along the way", "offering sj to la burbank area friday aug 7 super early am like 4 or 5 la anaheim to sj sunday august 9 2pm", "offering slo to bayarea thursday afternoon", "offering nc sd to slo wednesday 8/5 in the evening", "offering slo to to eastbay oakland alameda thursday around 5pm eastbay to to slo next monday around 10am gas money appreciated", "offering slo to bayarea august 7");
    foreach ($lines as $line) {
        removeDatesDaysAndTime($line);
    }
}
Пример #2
0
function insertPostIntoCleanDateTable($mysqli, $debugFlag)
{
    // Get 'dirty' posts
    $query_string = "select pid,post from " . CLEAN_POSTS_TABLE;
    $i = 0;
    // Attempt select query execution
    if ($result = mysqli_query($mysqli, $query_string)) {
        if (mysqli_num_rows($result) > 0) {
            while ($row = mysqli_fetch_array($result)) {
                if (!helpInsertPostIntoClean($mysqli, $row["pid"], removeDatesDaysAndTime($row["post"]), "clean_date_posts", $debugFlag)) {
                    echo "<p>Error: with " . $i . " record.</p>";
                    break;
                }
                $i++;
            }
            // Close result set
            mysqli_free_result($result);
        } else {
            echo "<p>Error: No records matching your query were found.</p>";
            return false;
        }
    } else {
        echo "<p>Error: Not able to execute " . $query_string . mysqli_error($mysqli) . "</p>";
        return false;
    }
    echo "Successfully inserted " . $i . " posts. <br>";
    // Close connection
    mysqli_close($mysqli);
    return true;
}