Example #1
0
function list_centers()
{
    //HTML flow
    $html = "";
    //Get centers from DWBN or cache
    if (@$_GET['source'] == 'cache') {
        //Get from cache
        $members = get_cache();
        //Be beware! It's cache
        $html .= "<span class='warning'>Pay attention! This is from cache!</span><br/><br/>";
    } else {
        //Collect information from DWBN
        $members = dwbn_collect();
    }
    //Show collected information{
    //Number of centers
    $html .= "Number of centers: " . count($members) . "<br/><br/>";
    //Example of center{
    $html .= "<pre>" . print_r($members[0], true) . "</pre><br/>";
    //}
    //Centers info
    foreach ($members as $center) {
        $html .= $center['email'] . "<br/>";
    }
    //}
    //Return
    return $html;
}
Example #2
0
function update_cache()
{
    //Bind global veriables
    global $cache_path;
    //Collect information from DWBN
    $members = dwbn_collect();
    //Try to update cache
    if (file_easy_write(correct_path($cache_path) . "dwbn.cache", json_encode($members))) {
        $html = "Cache updated successfully";
    } else {
        $html = "Error. Cache wasn't updated";
    }
    //Return HTML flow
    return $html;
}