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;
}
Exemple #2
0
     if (!$sid && empty($ptypes)) {
         amessage('pchoidxtp', "?entry={$entry}&action={$action}{$param_suffix}");
     }
     if ($sid) {
         $ptypes = array('i');
     }
     if (in_array('i', $ptypes)) {
         include_once M_ROOT . "./include/cn_static.fun.php";
         if (empty($staticmode)) {
             cn_update_needstatic('', $sid, 0);
         } elseif ($staticmode == 1) {
             index_static('', 0, 1);
         } elseif ($staticmode == 2) {
             index_unstatic('', 0, 1);
         } elseif ($staticmode == 3) {
             $sid && cn_blank('', $sid, 0);
         }
     }
     if (in_array('m', $ptypes)) {
         include_once M_ROOT . "./include/mcn_static.fun.php";
         if (empty($staticmode)) {
             $db->query("UPDATE {$tblprefix}mconfigs SET value='{$timestamp}' WHERE varname='mcnneedstatic'");
         } elseif ($staticmode == 1) {
             mindex_static('', 0, 1);
         } elseif ($staticmode == 2) {
             mindex_unstatic('', 0, 1);
         }
     }
     adminlog(lang('indstaadm'));
     amessage('inddeafin', "?entry={$entry}&action={$action}{$param_suffix}");
 }
     amessage('subdatamiss', M_REFERER);
 }
 if (preg_match("/[^a-zA-Z_0-9]+/", $subsitenew['dirname'])) {
     amessage('substadirill', M_REFERER);
 }
 $subsitenew['dirname'] = strtolower($subsitenew['dirname']);
 if (!mmkdir(M_ROOT . $subsitenew['dirname'], 0)) {
     anmessage('nowcresubstadir', M_REFERER);
 }
 $db->query("INSERT INTO {$tblprefix}subsites SET \n\t\t\t\t\tsitename='{$subsitenew['sitename']}',\n\t\t\t\t\tdirname='{$subsitenew['dirname']}',\n\t\t\t\t\ttemplatedir='{$templatedir}',\n\t\t\t\t\tineedstatic='{$timestamp}'\n\t\t\t\t\t");
 if ($nsid = $db->insert_id()) {
     updatecache('subsites');
     //需要先将模板目录放入子站内存之中,才能进行模板的转换
     $subsites = reload_cache('subsites');
     include_once M_ROOT . "./include/cparse.fun.php";
     cn_blank('', $nsid, 0);
     foreach (array('catalogs', 'cnconfigs', 'cnodes', 'archives', 'freeinfos', 'gmissions', 'gmodels', 'gurls') as $dbtable) {
         $db->query("UPDATE {$tblprefix}{$dbtable} SET sid='{$nsid}' WHERE sid='0'");
     }
     //将在子站记录中要保留的记录存下来
     $s_config = array();
     load_cache('channels');
     foreach ($channels as $k => $v) {
         $v = read_cache('channel', $k, '', $sid);
         $s_config[$k]['available'] = $v['available'];
         $s_config[$k]['arctpls'] = $v['arctpls'];
         $s_config[$k]['pretpl'] = $v['pretpl'];
         $s_config[$k]['srhtpl'] = $v['srhtpl'];
     }
     $s_config = addslashes(serialize($s_config));
     $db->query("UPDATE {$tblprefix}subsites SET channels='{$s_config}' WHERE sid='{$nsid}'");
         amessage('subtemdirill');
     }
     $subsitenew['dirname'] = strtolower($subsitenew['dirname']);
     $subsitenew['templatedir'] = strtolower($subsitenew['templatedir']);
     if (!mmkdir(M_ROOT . $subsitenew['dirname'], 0)) {
         anmessage('nowcresubstadir');
     }
     if (!mmkdir(M_ROOT . 'template/' . $subsitenew['templatedir'], 0)) {
         amessage('nowcresubtemdir');
     }
     $db->query("INSERT INTO {$tblprefix}subsites SET \n\t\t\t\t\tsitename='{$subsitenew['sitename']}',\n\t\t\t\t\tdirname='{$subsitenew['dirname']}',\n\t\t\t\t\ttemplatedir='{$subsitenew['templatedir']}',\n\t\t\t\t\tineedstatic='{$timestamp}'\n\t\t\t\t\t");
     if ($nsid = $db->insert_id()) {
         updatecache('subsites');
         $subsites = reload_cache('subsites');
         include_once M_ROOT . "./include/cparse.fun.php";
         cn_blank('', 'i', $nsid);
         $setupsids['nsid'] = $nsid;
         ocache2file($setupsids, 'setupsids');
         $stepeds['subsites'] = 1;
         ocache2file($stepeds, 'stepeds');
         amessage('operatesuc', '?entry=subsetup&action=currencys');
     } else {
         amessage('subaddfai');
     }
 } elseif (submitcheck('bundo')) {
     if (!$undo_enable) {
         amessage('invoperate');
     }
     clear_dir(M_ROOT . 'template/' . $subsites[$nsid]['templatedir'], true);
     clear_dir(M_ROOT . $subsites[$nsid]['dirname'], true);
     $db->query("DELETE FROM {$tblprefix}subsites WHERE sid='{$nsid}'", 'SILENT');