예제 #1
0
        updatecache_search();
        adminmsg('operate_success', "{$basename}&action={$action}");
    }
} elseif ($action == 'forum') {
    pwCache::getData(D_P . 'data/bbscache/forumcache.php');
    require_once R_P . 'require/updateforum.php';
    $catedb = $forumdb = $subdb1 = $subdb2 = $searchforum = array();
    $space = '<i class="lower lower_a"></i>';
    $query = $db->query("SELECT fid,vieworder FROM pw_searchforum");
    while ($rt = $db->fetch_array($query)) {
        $searchforum[$rt['fid']] = $rt;
    }
    $db->free_result($query);
    $query = $db->query("SELECT fid,fup,type,name,f_type FROM pw_forums WHERE cms!='1' ORDER BY vieworder");
    while ($forums = $db->fetch_array($query)) {
        $forums['name'] = Quot_cv(strip_tags($forums['name']));
        $forums['vieworder'] = (int) $searchforum[$forums['fid']]['vieworder'];
        $forums['isrecommend'] = $searchforum[$forums['fid']] ? 'checked' : '';
        if ($forums['type'] == 'category') {
            $catedb[$forums['fid']] = $forums;
        } elseif ($forums['type'] == 'forum') {
            $forumdb[$forums['fid']] = $forums;
        } elseif ($forums['type'] == 'sub') {
            $subdb1[$forums['fid']] = $forums;
        } else {
            $subdb2[$forums['fid']] = $forums;
        }
    }
    //$fup_forumcache = $forumcache;
    $fup_forumcache = getForumSelectHtml();
    foreach ($subdb2 as $value) {
예제 #2
0
파일: setbwd.php 프로젝트: jechiy/PHPWind
function setScanCache()
{
    global $db, $timestamp, $db_plist;
    # 获取回复表
    if ($db_plist && is_array($db_plist)) {
        foreach ($db_plist as $key => $value) {
            if ($key > 0) {
                $postslist[] = 'pw_posts' . (int) $key;
            } else {
                $postslist[] = 'pw_posts';
            }
        }
    } else {
        $postslist[] = 'pw_posts';
    }
    if (file_exists(D_P . 'data/bbscache/wordsfb_progress.php')) {
        # 读取缓存
        //* require_once pwCache::getPath(D_P.'data/bbscache/wordsfb_progress.php');
        pwCache::getData(D_P . 'data/bbscache/wordsfb_progress.php');
        $temp_threaddb = unserialize($threaddb);
    } else {
        $temp_threaddb = array();
    }
    $forum = $catedb = $forumdb = $subdb1 = $subdb2 = $threaddb = array();
    # 获取版块列表
    $query = $db->query("SELECT fid,name,fup,type FROM pw_forums WHERE cms!='1' ORDER BY vieworder");
    while ($forums = $db->fetch_array($query)) {
        $forums['name'] = Quot_cv(strip_tags($forums['name']));
        if ($forums['type'] == 'category') {
            $catedb[] = $forums;
        } elseif ($forums['type'] == 'forum') {
            $forumdb[] = $forums;
        } elseif ($forums['type'] == 'sub') {
            $subdb1[] = $forums;
        } else {
            $subdb2[] = $forums;
        }
    }
    foreach ($catedb as $cate) {
        $threaddb[$cate['fid']] = array();
        foreach ($forumdb as $key2 => $forumss) {
            if ($forumss['fup'] == $cate['fid']) {
                if (!array_key_exists($forumss['fid'], $temp_threaddb[$cate['fid']])) {
                    # 读取版块帖子总数和表进度
                    $forumss['count'] = 0;
                    $forumss['progress'] = 0;
                    $forumss['result'] = 0;
                    $forumss['table_progress']['pw_threads'] = 0;
                    foreach ($postslist as $pw_posts) {
                        $forumss['table_progress'][$pw_posts] = 0;
                    }
                    $threaddb[$cate['fid']][$forumss['fid']] = $forumss;
                } else {
                    $threaddb[$cate['fid']][$forumss['fid']] = $temp_threaddb[$cate['fid']][$forumss['fid']];
                    unset($threaddb[$cate['fid']][$forumss['fid']]['table_progress']);
                    $threaddb[$cate['fid']][$forumss['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$forumss['fid']]['table_progress']['pw_threads'];
                    foreach ($postslist as $pw_posts) {
                        $threaddb[$cate['fid']][$forumss['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$forumss['fid']]['table_progress'][$pw_posts];
                    }
                }
                unset($forumdb[$key2]);
                foreach ($subdb1 as $key3 => $sub1) {
                    if ($sub1['fup'] == $forumss['fid']) {
                        if (!array_key_exists($sub1['fid'], $temp_threaddb[$cate['fid']])) {
                            # 读取版块帖子总数和表进度
                            $sub1['count'] = 0;
                            $sub1['progress'] = 0;
                            $sub1['result'] = 0;
                            $sub1['table_progress']['pw_threads'] = 0;
                            foreach ($postslist as $pw_posts) {
                                $sub1['table_progress'][$pw_posts] = 0;
                            }
                            $threaddb[$cate['fid']][$sub1['fid']] = $sub1;
                        } else {
                            $threaddb[$cate['fid']][$sub1['fid']] = $temp_threaddb[$cate['fid']][$sub1['fid']];
                            unset($threaddb[$cate['fid']][$sub1['fid']]['table_progress']);
                            $threaddb[$cate['fid']][$sub1['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$sub1['fid']]['table_progress']['pw_threads'];
                            foreach ($postslist as $pw_posts) {
                                $threaddb[$cate['fid']][$sub1['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$sub1['fid']]['table_progress'][$pw_posts];
                            }
                        }
                        unset($subdb1[$key3]);
                        foreach ($subdb2 as $key4 => $sub2) {
                            if ($sub2['fup'] == $sub1['fid']) {
                                if (!array_key_exists($sub2['fid'], $temp_threaddb[$cate['fid']])) {
                                    # 读取版块帖子总数和表进度
                                    $sub2['count'] = 0;
                                    $sub2['progress'] = 0;
                                    $sub2['result'] = 0;
                                    $sub2['table_progress']['pw_threads'] = 0;
                                    foreach ($postslist as $pw_posts) {
                                        $sub2['table_progress'][$pw_posts] = 0;
                                    }
                                    $threaddb[$cate['fid']][$sub2['fid']] = $sub2;
                                } else {
                                    $threaddb[$cate['fid']][$sub2['fid']] = $temp_threaddb[$cate['fid']][$sub2['fid']];
                                    unset($threaddb[$cate['fid']][$sub2['fid']]['table_progress']);
                                    $threaddb[$cate['fid']][$sub2['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$sub2['fid']]['table_progress']['pw_threads'];
                                    foreach ($postslist as $pw_posts) {
                                        $threaddb[$cate['fid']][$sub2['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$sub2['fid']]['table_progress'][$pw_posts];
                                    }
                                }
                                unset($subdb2[$key4]);
                            }
                        }
                    }
                }
            }
        }
    }
    $catedb = serialize($catedb);
    $threaddb = serialize($threaddb);
    # 写入文件
    $filecontent = "<?php\r\n";
    $filecontent .= "\$catedb=" . pw_var_export($catedb) . ";\r\n";
    $filecontent .= "\$threaddb=" . pw_var_export($threaddb) . ";\r\n";
    $filecontent .= "?>";
    $cahce_file = D_P . 'data/bbscache/wordsfb_progress.php';
    pwCache::setData($cahce_file, $filecontent);
    setConfig('db_wordsfb_cachetime', $timestamp);
    updatecache_c();
    return array('catedb' => $catedb, 'threaddb' => $threaddb);
}
예제 #3
0
             $nf_newinfodb[$orderid] = $pic;
             setConfig('nf_newinfodb', $nf_newinfodb);
         }
     } else {
         if (!$nf_order[$orderid]['mode']) {
             $picmode_1 = 'checked';
         } else {
             $picmode_2 = 'checked';
         }
         include PrintEot('rebang');
         exit;
     }
 } elseif ($type == 'custom') {
     if (!$_POST['step']) {
         foreach ($nf_newinfodb[$orderid] as $key => $value) {
             $nf_newinfodb[$orderid][$key]['name'] = Quot_cv($value['name']);
         }
         include PrintEot('rebang');
         exit;
     } else {
         InitGP(array('titles'), 'P', 0);
         InitGP(array('links'), 'P');
         if (is_array($titles)) {
             $custom = array();
             foreach ($titles as $key => $value) {
                 if ($value) {
                     $custom[] = array('name' => stripslashes($value), 'id' => $links[$key]);
                 }
             }
             $nf_newinfodb[$orderid] = $custom;
             setConfig('nf_newinfodb', $nf_newinfodb);
예제 #4
0
} else {
    if (!file_exists(D_P . 'data/bbscache/config.php') || !isset($db_bbstitle) || !isset($db_metadescrip) || !isset($db_metakeyword)) {
        $sql = "SELECT * FROM pw_config WHERE db_name IN ( " . pwImplode($db_names) . " ) ";
        $query = $db->query($sql);
        while ($rt = $db->fetch_array($query)) {
            ${$rt['db_name']} = unserialize($rt['db_value']);
        }
    }
    $config['title'] = is_array(${$db_names[0]}) ? ${$db_names[0]} : array('index' => ${$db_names[0]}, 'thread' => ${$db_names[0]}, 'read' => ${$db_names[0]});
    $config['metadescrip'] = is_array(${$db_names[1]}) ? ${$db_names[1]} : array('index' => ${$db_names[1]}, 'thread' => ${$db_names[1]}, 'read' => ${$db_names[1]});
    $config['metakeyword'] = is_array(${$db_names[2]}) ? ${$db_names[2]} : array('index' => ${$db_names[2]}, 'thread' => ${$db_names[2]}, 'read' => ${$db_names[2]});
    #get forums
    $sql = "SELECT fid,fup,name,type,title,metadescrip,keywords FROM pw_forums ORDER BY vieworder";
    $query = $db->query($sql);
    while ($rt = $db->fetch_array($query)) {
        $rt['name'] = Quot_cv(strip_tags($rt['name']));
        if ($rt['type'] == 'category') {
            $categorys[] = $rt;
        } elseif ($rt['type'] == 'forum') {
            $forums[] = $rt;
        } elseif ($rt['type'] == 'sub') {
            $subForums1[] = $rt;
        } else {
            $subForums2[] = $rt;
        }
    }
    if (empty($mode) || $mode == 'bbs') {
        $forumList = array();
        foreach ($categorys as $k1 => $category) {
            foreach ($forums as $k2 => $forum) {
                if ($forum['fup'] == $category['fid']) {
예제 #5
0
/**
 * 取得所有分类与版块
 * @return array
 */
function getAllThreads()
{
    global $db;
    $catedb = $forumdb = $subdb1 = $subdb2 = array();
    $query = $db->query("SELECT f.fid,f.fup,f.type,f.name,fe.forumset FROM pw_forums f LEFT JOIN pw_forumsextra fe ON f.fid=fe.fid WHERE f.cms!='1' ORDER BY f.vieworder");
    while ($forums = $db->fetch_array($query)) {
        $forums['name'] = Quot_cv(strip_tags($forums['name']));
        if ($forums['type'] == 'category') {
            $catedb[$forums['fid']] = $forums;
        } elseif ($forums['type'] == 'forum') {
            $forumdb[$forums['fid']] = $forums;
        } elseif ($forums['type'] == 'sub') {
            $subdb1[$forums['fid']] = $forums;
        } else {
            $subdb2[$forums['fid']] = $forums;
        }
    }
    $threaddb = array();
    foreach ($catedb as $cate) {
        $threaddb[$cate['fid']] = array();
        foreach ($forumdb as $key2 => $forumss) {
            if ($forumss['fup'] == $cate['fid']) {
                $threaddb[$cate['fid']][] = $forumss;
                unset($forumdb[$key2]);
                foreach ($subdb1 as $key3 => $sub1) {
                    if ($sub1['fup'] == $forumss['fid']) {
                        $threaddb[$cate['fid']][] = $sub1;
                        unset($subdb1[$key3]);
                        foreach ($subdb2 as $key4 => $sub2) {
                            if ($sub2['fup'] == $sub1['fid']) {
                                $threaddb[$cate['fid']][] = $sub2;
                                unset($subdb2[$key4]);
                            }
                        }
                    }
                }
            }
        }
    }
    return array($catedb, $threaddb);
}