Ejemplo n.º 1
0
function cn_blank($cnstr, $sid, $addnos = array(), $force = 0)
{
    //force:强行覆盖第一个文件,为0时为修复链接
    global $enablestatic;
    $suffix = $sid ? ($cnstr ? '&' : '') . "sid={$sid}" : '';
    if ($cnstr) {
        if (!($cnode = read_cnode($cnstr, $sid))) {
            return;
        }
        if (!is_array($addnos)) {
            $addnos = array($addnos);
        }
        if (!$addnos) {
            return;
        }
        $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']);
        for ($i = 0; $i <= $cnode['addnum']; $i++) {
            if (in_array($i, $addnos)) {
                if (empty($statics[$i]) ? $enablestatic : ($statics[$i] == 1 ? 0 : 1)) {
                    $cnfile = M_ROOT . m_parseurl(cn_format($cnstr, $i, $cnode), array('page' => 1));
                    if ($force || !is_file($cnfile)) {
                        @str2file(direct_html("index.php?{$cnstr}{$suffix}" . ($i ? "&&addno={$i}" : '')), $cnfile);
                    }
                }
            }
        }
    } elseif ($sid) {
        $cnfile = M_ROOT . m_parseurl(idx_format($sid), array('page' => 1));
        if ($force || !is_file($cnfile)) {
            @str2file(direct_html("index.php?{$suffix}"), $cnfile);
        }
    }
}
Ejemplo n.º 2
0
function index_unstatic($cnstr = '', $addno, $needwri = 1)
{
    global $sid;
    if ($cnstr) {
        if (!($cnode = read_cnode($cnstr, $sid))) {
            return;
        }
        $cnformat = cn_format($cnstr, $addno, $cnode);
    } else {
        $cnformat = idx_format($sid);
    }
    m_unlink($cnformat);
    if ($cnstr || $sid) {
        cn_blank($cnstr, $sid, $addno, 1);
    }
    $needwri && cn_update_needstatic($cnstr, $sid, $addno, 1);
    return true;
}