Esempio n. 1
0
function fillCache($cache_path = "./cache/", $cache_prefix = "", $cache_hash = "", $cache_content)
{
    global $errors;
    if (substr($cache_path, -1) != "/") {
        $cache_path .= "/";
    }
    $cache_path_cmp = $cache_path . substr($cache_hash, 0, 1) . "/";
    $cache_file = $cache_path_cmp . $cache_prefix . "_" . $cache_hash;
    if (!is_dir($cache_path_cmp)) {
        if (mkdir($cache_path_cmp, 0755, true) === false) {
            lpsf_log(Bnumber(), "{$cache_file} => status: *error* can't create path (mkdir error)");
            return false;
        }
    }
    //clearstatcache();
    if (is_file($cache_file)) {
        unlink($cache_file);
    }
    if (($fp = fopen($cache_file, "w")) !== false) {
        if (fwrite($fp, serialize($cache_content)) === false) {
            fclose($fp);
            unlink($cache_file);
            lpsf_log(Bnumber(), "{$cache_file} => status: *error* can't write cache file (fwrite error)");
            return false;
        }
        fclose($fp);
    }
    return true;
}
Esempio n. 2
0
function lpsf_log($where, $str)
{
    global $lpsf;
    if (is_null($where) || is_null($str) || $str == "") {
        die(Bnumber());
    }
    insert_at_top($lpsf['errors'], $str, $lpsf['config']['errors_count']);
    return;
}
Esempio n. 3
0
function updateRuidos($link, $valoracion, $fabricante, $db_query)
{
    $stmt = "UPDATE ruidos SET valoracion={$valoracion}, is_alerta='1', fabricante={$fabricante} WHERE link={$link}";
    executeNonQuery(Bnumber(), $db_query, $stmt);
}