/**
 * Xoops Write Index File
 *
 * @param string $path
 * @return bool
 */
function xoops_write_index_file($path = '')
{
    if (empty($path)) {
        return false;
    }
    if (!xoopsfwrite()) {
        return false;
    }
    $path = substr($path, -1) == '/' ? substr($path, 0, -1) : $path;
    $filename = $path . '/index.html';
    if (file_exists($filename)) {
        return true;
    }
    if (!($file = fopen($filename, 'w'))) {
        echo 'failed open file';
        return false;
    }
    if (fwrite($file, '<script>history.go(-1);</script>') == -1) {
        echo 'failed write file';
        return false;
    }
    fclose($file);
    return true;
}
Exemple #2
0
function xoops_module_write_admin_menu($content)
{
    if (!xoopsfwrite()) {
        return false;
    }
    $filename = XOOPS_CACHE_PATH . '/adminmenu.php';
    if (!($file = fopen($filename, "w"))) {
        echo 'failed open file';
        return false;
    }
    if (fwrite($file, $content) == -1) {
        echo 'failed write file';
        return false;
    }
    fclose($file);
    return true;
}