Ejemplo n.º 1
0
 /**
  * 记录错误信息
  */
 function writeLog($method = 'rb+')
 {
     $logFile = D_P . 'data/error.log';
     if (!$this->_logs) {
         return false;
     }
     $temp = pw_var_export($this->_logs);
     pwCache::writeover($logFile, $temp, 'rb+');
 }
Ejemplo n.º 2
0
function updatecache_bg()
{
    global $db;
    $query = $db->query("SELECT * FROM pw_hack WHERE hk_name LIKE 'bg_%'");
    $blogdb = "<?php\r\n";
    while (@extract($db->fetch_array($query))) {
        $hk_name = key_cv($hk_name);
        $blogdb .= "\${$hk_name}=" . pw_var_export($hk_value) . ";\r\n";
    }
    $blogdb .= "\n?>";
    writeover(D_P . 'data/bbscache/bg_config.php', $blogdb);
}
Ejemplo n.º 3
0
 function exportThemeConfig($theme)
 {
     $invokeDB = $this->_getInvokeDB();
     $invokePieceDB = $this->_getInvokePieceDB();
     $invokes = $this->_getThemeInvokes($theme);
     $defaultInvokes = $invokeDB->getDatesByNames_2($invokes);
     $defaultInvokePieces = $invokePieceDB->getDatasByInvokeNames($invokes);
     $temp_str = "<?php\r\n!defined('P_W') && exit('Forbidden');\r\n";
     $temp_str .= '$defaultInvokes=' . pw_var_export($defaultInvokes) . ";\r\n";
     $temp_str .= '$defaultInvokePieces=' . pw_var_export($defaultInvokePieces) . ";\r\n?>";
     $this->_exportHeader($temp_str);
 }
Ejemplo n.º 4
0
function updatecache_sm()
{
    global $db;
    $hk_name = $hk_value = '';
    $query = $db->query("SELECT * FROM pw_hack WHERE hk_name LIKE 'sm_%'");
    $configdb = "<?php\r\n";
    while (@extract($db->fetch_array($query))) {
        $hk_name = key_cv($hk_name);
        $configdb .= "\${$hk_name}=" . pw_var_export($hk_value) . ";\r\n";
    }
    $configdb .= "?>";
    pwCache::setData(D_P . 'data/bbscache/sm_config.php', $configdb);
}
Ejemplo n.º 5
0
 function appsUpdateCache($apps)
 {
     $filename = "data/bbscache/apps_list_cache.php";
     if ($apps && is_array($apps)) {
         $cache = "<?php\r\n\$appsdb=";
         $cache .= pw_var_export($apps);
         $cache .= ";\r\n?>";
         writeover(D_P . $filename, $cache);
         return new ApiResponse(true);
     } else {
         return new ApiResponse(false);
     }
 }
Ejemplo n.º 6
0
function update_index_forum($config)
{
    global $m;
    @(include_once D_P . 'data/bbscache/mode_' . $m . '_index_forum.php');
    foreach ($index_forum as $key => $value) {
        $config_fids = array_keys($config);
        if (!in_array($key, $config_fids)) {
            unset($index_forum[$key]);
            continue;
        }
        foreach ($value as $k => $v) {
            if (!in_array($k, $config[$key])) {
                unset($index_forum[$key][$k]);
            }
        }
    }
    writeover(Pcv(D_P . 'data/bbscache/mode_' . $m . '_index_forum.php'), "<?php\r\n\$index_forum=" . pw_var_export($index_forum) . ";\r\n?>");
}
Ejemplo n.º 7
0
 function mailmx($email, $retrys = 3)
 {
     global $timestamp;
     $domain = substr($email, strpos($email, '@') + 1);
     @(include D_P . 'data/bbscache/mx_config.php');
     if (!$_MX[$domain] || $timestamp - pwFilemtime(D_P . 'data/bbscache/mx_config.php') > 3600 * 24 * 10) {
         for ($i = 0; $i < $retrys; $i++) {
             $result = $this->GetMax($domain);
             if ($result !== false) {
                 $_MX[$domain] = $result;
                 pwCache::writeover(D_P . 'data/bbscache/mx_config.php', "<?php\r\n\$_MX=" . pw_var_export($_MX) . ";\r\n?>");
                 $this->smtp['tomx'] = $result;
                 return true;
             }
         }
         return false;
     } else {
         $this->smtp['tomx'] = $_MX[$domain];
         return true;
     }
 }
Ejemplo n.º 8
0
function write_config($newconfig = array())
{
    global $tplpath;
    if (!empty($newconfig) && is_array($newconfig)) {
        foreach ($newconfig as $key => $value) {
            ${$key} = $value;
        }
    } else {
        include D_P . 'data/sql_config.php';
        //* extract(pwCache::getData(D_P.'data/sql_config.php', false));
    }
    $db_hostweb != 0 && ($db_hostweb = 1);
    !$pconnect && ($pconnect = 0);
    $att_url = $mg_a = $mg_p = '';
    foreach ($manager as $value) {
        $mg_a .= ",'{$value}'";
    }
    foreach ($manager_pwd as $value) {
        $mg_p .= ",'{$value}'";
    }
    foreach ($attach_url as $value) {
        $att_url .= ",'{$value}'";
    }
    $mg_a = substr($mg_a, 1);
    $mg_p = substr($mg_p, 1);
    $att_url = substr($att_url, 1);
    if (file_exists(R_P . "template/admin_{$tplpath}")) {
        include S::escapePath(R_P . "template/admin_{$tplpath}/cp_lang_all.php");
    } else {
        include R_P . "template/admin/cp_lang_all.php";
    }
    foreach (array('sqlinfo', 'dbhost', 'dbuser', 'dbname', 'database', 'PW', 'pconnect', 'charset', 'managerinfo', 'managername', 'hostweb', 'attach_url', 'slaveConfig') as $I) {
        eval('$lang[\'all\'][' . $I . ']="' . addcslashes($lang['all'][$I], '"') . '";');
    }
    $writetofile = "<?php\r\n/**\r\n{$lang[all][sqlinfo]}\r\n*/\r\n\t{$lang[all][dbhost]}\r\n\$dbhost = '{$dbhost}';\r\n\r\n\t{$lang[all][dbuser]}\r\n\$dbuser = '******';\r\n\$dbpw = '{$dbpw}';\r\n\r\n\t{$lang[all][dbname]}\r\n\$dbname = '{$dbname}';\r\n\r\n\t{$lang[all][database]}\r\n\$database = '{$database}';\r\n\r\n\t{$lang[all][PW]}\r\n\$PW = '{$PW}';\r\n\r\n\t{$lang[all][pconnect]}\r\n\$pconnect = '{$pconnect}';\r\n\r\n/**\r\n{$lang[all][charset]}\r\n*/\r\n\$charset = '{$charset}';\r\n\r\n/**\r\n{$lang[all][managerinfo]}\r\n*/\r\n\t{$lang[all][managername]}\r\n\$manager = array({$mg_a});\r\n\r\n\t{$lang[all][managerpwd]}\r\n\$manager_pwd = array({$mg_p});\r\n\r\n/**\r\n{$lang[all][hostweb]}\r\n*/\r\n\$db_hostweb = '{$db_hostweb}';\r\n\r\n/**\r\n{$lang[all][distribute]}\r\n*/\r\n\$db_distribute = '{$db_distribute}';\r\n\r\n/**\r\n{$lang[all][attach_url]}\r\n*/\r\n\$attach_url = array({$att_url});\r\n\r\n/**\r\n{$lang[all][slaveConfig]}\r\n*/\r\n\$slaveConfigs = ";
    pwCache::writeover(D_P . 'data/sql_config.php', $writetofile . pw_var_export($slaveConfigs) . ";\r\n?>");
}
Ejemplo n.º 9
0
         $mark = $sorttype[$step];
         $db->update("DELETE FROM pw_elements WHERE type='usersort' AND mark=" . S::sqlEscape($mark));
         $step++;
         $_usersort = $getinfo->userSort($mark, $db_sortnum, false);
         $_usersort = arr_unique($_usersort);
         if (is_array($_usersort) && count($_usersort) == $db_sortnum) {
             $tmpdate = end($_usersort);
             $usersort_judge[$mark] = $tmpdate['value'];
         } else {
             $usersort_judge[$mark] = 0;
         }
         if ($_usersort) {
             $sql = "REPLACE INTO pw_elements(id,value,addition,type,mark) VALUES" . S::sqlMulti($_usersort, false);
             $db->update($sql);
         }
         pwCache::setData(D_P . 'data/bbscache/usersort_judge.php', "<?php\r\n\$usersort_judge=" . pw_var_export($usersort_judge) . ";\r\n?>");
         adminmsg('updatecache_total_step', "{$basename}&action=update&type=usersort&step={$step}");
     }
 } elseif ($type == 'newsubject') {
     $step = intval(S::getGP('step'));
     //* require_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
     pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
     $arr_forumkeys = array_keys($forum);
     if (!$step) {
         $step = 0;
         $db->query("DELETE FROM pw_elements WHERE type='newsubject'");
     }
     $total = count($arr_forumkeys);
     for ($i = 0; $i < 5; $i++) {
         if ($step < $total) {
             $fourmid = $arr_forumkeys[$step];
Ejemplo n.º 10
0
                $nf_newinfodb[$key][$k] = array('id' => $v['addition']['uid'], 'name' => $v['title'], 'value' => $v['value']);
            }
        } elseif (in_array($val['type'], array('todaypost', 'rvrc', 'postnum', 'onlinetime', 'monthpost', 'monoltime', 'money', 'digests', 'currency', 'credit')) || array_key_exists($val['type'], $_CREDITDB)) {
            $nf_newinfodb[$key] = $element->userSort($val['type']);
            foreach ($nf_newinfodb[$key] as $k => $v) {
                $nf_newinfodb[$key][$k] = array('id' => $v['addition']['uid'], 'name' => $v['title'], 'value' => $v['value']);
            }
        } elseif (in_array($val['type'], array('topic', 'article', 'tpost'))) {
            $nf_newinfodb[$key] = $element->forumSort($val['type']);
            foreach ($nf_newinfodb[$key] as $k => $v) {
                $nf_newinfodb[$key][$k] = array('id' => $v['addition']['fid'], 'name' => $v['title'], 'value' => $v['value']);
            }
        }
        $nf_order[$key]['cachetime'] = $timestamp;
        uasort($nf_order, 'cacheTimeCmp');
        pwCache::setData(D_P . 'data/bbscache/newinfo_config.php', "<?php\r\n\$nf_config=" . pw_var_export($nf_config) . ";\r\n\$nf_newinfodb=" . pw_var_export($nf_newinfodb) . ";\r\n\$nf_order=" . pw_var_export($nf_order) . ";\r\n?>");
        break;
    }
}
uasort($nf_order, 'orderCmp');
function cacheTimeCmp($row1, $row2)
{
    $first = strcmp($row1['cachetime'], $row2['cachetime']);
    if ($first) {
        return $first;
    } elseif ($row2['order'] > $row1['order']) {
        return 1;
    } elseif ($row2['order'] < $row1['order']) {
        return -1;
    } else {
        return 0;
Ejemplo n.º 11
0
function setTidsCache($type)
{
    global $db, $fid, $timestamp, $_filename, $t;
    $useIndex = "";
    $orderby = '';
    $where = "WHERE " . ($fid ? " fid= " . pwEscape($fid) : "fid IN (" . getFidsForWap() . ")") . " AND specialsort=0 AND ifcheck=1";
    if ($type == 'digest') {
        $where .= " AND digest>0";
        $orderby = "ORDER BY topped DESC,lastpost DESC";
    } elseif ($type == 'hot') {
        $time = (int) 3600 * 24 * 30;
        if ($t == '1') {
            $time = (int) 3600 * 24;
        } elseif ($t == '2') {
            $time = (int) 3600 * 24 * 3;
        } elseif ($t == '3') {
            $time = (int) 3600 * 24 * 7;
        } elseif ($t == '4') {
            $time = (int) 3600 * 24 * 30;
        }
        $where .= " AND postdate>" . (int) ($timestamp - $time);
        $orderby = "ORDER BY replies DESC";
    } elseif ($type == 'new') {
        $useIndex = 'USE INDEX (' . getForceIndex('idx_postdate') . ')';
        $orderby = "ORDER BY postdate DESC";
    } else {
        $orderby = "ORDER BY specialsort DESC,lastpost DESC";
    }
    $limit = "LIMIT 0,500";
    $query = $db->query("SELECT tid FROM pw_threads {$useIndex} {$where} {$orderby} {$limit}");
    $result = array();
    $result['uptime'] = $timestamp;
    while ($rt = $db->fetch_array($query)) {
        $result['tids'] .= $rt['tid'] . ',';
    }
    if (is_file($_filename)) {
        include $_filename;
    }
    $tidsCache[$type] = $result;
    writeover($_filename, "<?php\r\n\$tidsCache=" . pw_var_export($tidsCache) . "\r\n?>");
    return $result['tids'];
}
Ejemplo n.º 12
0
        }
    }
    if ($postcatepcids) {
        //团购活动
        $pcvaluetable = GetPcatetable($pcid);
        $query = $db->query("SELECT * FROM {$pcvaluetable} WHERE tid IN (" . pwImplode($postcatepcids) . ")");
        while ($rt = $db->fetch_array($query)) {
            $threaddb[$rt['tid']]['topic'] = $rt;
        }
    }
    if ($updatetop) {
        require_once R_P . 'require/updateforum.php';
        updatetop();
    }
    if ($fcache == 1) {
        writeover(D_P . "data/bbscache/fcache_{$fid}_{$page}.php", "<?php\r\n\$threaddb=" . pw_var_export($threaddb) . ";\r\n?>");
    }
    unset($tpcdb, $query, $topadd, $searchadd, $sql, $limit2, $R, $p_status, $updatetop, $rewids, $arrStatus);
} else {
    include_once D_P . "data/bbscache/fcache_{$fid}_{$page}.php";
    if ($page == 1 && !$ifsort) {
        foreach ($threaddb as $key => $value) {
            $value['topped'] && ($ifsort = 1);
            break;
        }
    }
}
$db_threadshowpost == 1 && $groupid != 'guest' && ($fastpost = 'fastpost');
$psot_sta = $titletop1 = '';
$t_exits = 0;
$t_typedb = $t_subtypedb = array();
Ejemplo n.º 13
0
 function setFileCache()
 {
     $jobDao = $this->_getJobDao();
     $jobs = $jobDao->getAll();
     $jobLists = "\$jobLists=" . pw_var_export($jobs) . ";";
     pwCache::setData($this->getCacheFileName(), "<?php\r\n" . $jobLists . "\r\n?>");
     return $jobs;
 }
Ejemplo n.º 14
0
<?php

!function_exists('readover') && exit('Forbidden');
$cachefile = D_P . 'data/bbscache/brith_cache.php';
if ((!file_exists($cachefile) || pwFilemtime($cachefile) <= $tdtime) && procLock('birth')) {
    list($nyear, $nmonth, $nday) = explode('-', get_date($timestamp, 'Y-n-j'));
    $birthnum = 0;
    $query = $db->query("SELECT username,bday,gender FROM pw_members WHERE MONTH(bday)=" . S::sqlEscape($nmonth) . " AND DAYOFMONTH(bday)=" . S::sqlEscape($nday) . " LIMIT 200");
    while ($rt = $db->fetch_array($query)) {
        $birthnum++;
        if ($rt['gender'] == 1) {
            $rt['gender'] = getLangInfo('other', 'men');
        } elseif ($rt['gender'] == 2) {
            $rt['gender'] = getLangInfo('other', 'women');
        } else {
            $rt['gender'] = '';
        }
        $rt['username'] = S::escapeChar($rt['username']);
        $rt['age'] = $nyear - substr($rt['bday'], 0, strpos($rt['bday'], '-'));
        $brithcache .= ' <span><a  target="_blank" class=" _cardshow" data-card-url="pw_ajax.php?action=smallcard&type=showcard&username='******'" data-card-key=' . $rt[username] . ' href="u.php?username='******'username']) . "\" title=\"{$rt['username']}{$rt['gender']}" . getLangInfo('other', 'indexbirth', array('age' => $rt['age'])) . "\">{$rt['username']}</a></span>";
    }
    pwCache::writeover($cachefile, "<?php\r\n\$birthnum=" . pw_var_export($birthnum) . ";\r\n\$brithcache=" . pw_var_export($brithcache) . ";\r\n?>");
    procUnLock('birth');
} else {
    include_once $cachefile;
}
$db_bdayautohide && !$brithcache && ($brithcache = 'empty');
Ejemplo n.º 15
0
    if ($db_ifpwcache & 1024) {
        $elementupdate->hotfavorUpdate($tid, $fid);
    }
    updateDatanalyse($tid, 'threadFav', 1);
    //End Here
    Showmsg('job_favor_success');
} elseif ($action == 'tag') {
    $cachetime = pwFilemtime(D_P . "data/bbscache/tagdb.php");
    if (!file_exists(D_P . "data/bbscache/tagdb.php") || $timestamp - $cachetime > 3600) {
        $tagnum = max($db_tagindex, 200);
        $tagdb = array();
        $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . pwLimit($tagnum));
        while ($rs = $db->fetch_array($query)) {
            $tagdb[$rs['tagname']] = $rs['num'];
        }
        writeover(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>");
    } else {
        include_once D_P . "data/bbscache/tagdb.php";
    }
    foreach ($tagdb as $key => $num) {
        echo $key . ',' . $num . "\t";
    }
    ajax_footer();
} elseif ($action == 'relatetag') {
    InitGP(array('tagname'));
    $rs = $db->get_one("SELECT tagid,num FROM pw_tags WHERE tagname=" . pwEscape($tagname));
    if (!$rs || $rs['num'] < 1) {
        Showmsg('tag_limit');
    }
    $query = $db->query("SELECT tg.tid,t.subject FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) WHERE tg.tagid=" . pwEscape($rs['tagid']) . " LIMIT 5");
    $readdb = array();
Ejemplo n.º 16
0
        uasort($admindb, "cmp");
        $sort_a[$type] = "class='link_down'";
    }
    require PrintEot('sort');
    footer();
} elseif ($action == 'delsort') {
    PostCheck();
    S::gp(array('month'));
    (!$month || !is_numeric($month) || $groupid != '3') && Showmsg('undefined_action');
    if (file_exists(D_P . 'data/bbscache/admin_sort_' . $month . '.php')) {
        //* P_unlink(D_P.'data/bbscache/admin_sort_'.$month.'.php');
        pwCache::deleteData(D_P . 'data/bbscache/admin_sort_' . $month . '.php');
    }
    refreshto("sort.php?action=admin", 'operate_success');
} elseif ($action == 'favor') {
    $cachetime = pwFilemtime(D_P . "data/bbscache/favor_sort.php");
    if (!$per || !file_exists(D_P . "data/bbscache/favor_sort.php") || $timestamp - $cachetime > $per * 3600) {
        $element = L::loadClass('element');
        $element->setDefaultNum(50);
        $_sort = array();
        $_SORTDB = $element->hotFavorsort();
        pwCache::writeover(D_P . 'data/bbscache/favor_sort.php', "<?php\r\n\$_FAVORS=" . pw_var_export($_SORTDB) . ";\r\n?>");
    } else {
        include pwCache::getPath(D_P . "data/bbscache/favor_sort.php");
        $_SORTDB = $_FAVORS;
        unset($_FAVORS);
    }
    $cachetime = get_date($cachetime + $per * 3600);
    require PrintEot('sort');
    footer();
}
Ejemplo n.º 17
0
<?php

!defined('P_W') && exit('Forbidden');
$cachetime = pwFilemtime(D_P . "data/bbscache/tagdb.php");
if (!file_exists(D_P . "data/bbscache/tagdb.php") || $timestamp - $cachetime > 3600) {
    $tagnum = max($db_tagindex, 200);
    $tagdb = array();
    $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . S::sqlLimit($tagnum));
    while ($rs = $db->fetch_array($query)) {
        $tagdb[$rs['tagname']] = $rs['num'];
    }
    /** writeover(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>"); **/
    pwCache::setData(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>");
    touch(D_P . "data/bbscache/tagdb.php");
} else {
    //* include_once (D_P . "data/bbscache/tagdb.php");
    extract(pwCache::getData(D_P . "data/bbscache/tagdb.php", false));
}
foreach ($tagdb as $key => $num) {
    echo $key . ',' . $num . "\t";
}
ajax_footer();
Ejemplo n.º 18
0
        if ($o_browse & 4) {
            $newWrite = browseWrite(6);
        }
        if ($db_share_open && $o_browse & 8) {
            $newShares = browseShare(5);
        }
        if ($db_groups_open && $o_browse & 32) {
            $reGroups = browseGroup(5);
        }
        if ($db_phopen && $o_browse & 16) {
            $albumdb = browseAlbum(5);
        }
        if ($db_dopen && $o_browse & 64) {
            list($newDiarys, $diarytype) = browseDiary(6);
        }
        writeover($pwCacheFile, "<?php\r\n\$newPics=" . pw_var_export($newPics) . ";\r\n\$newThreads=" . pw_var_export($newThreads) . ";\r\n\$members=" . pw_var_export($reGroups) . ";\r\n\$members=" . pw_var_export($members) . ";\r\n\$reGroups=" . pw_var_export($reGroups) . ";\r\n\$newsubject=" . pw_var_export($newsubject) . ";\r\n\$newreply=" . pw_var_export($newreply) . ";\r\n\$newShares=" . pw_var_export($newShares) . ";\r\n\$newDiarys=" . pw_var_export($newDiarys) . ";\r\n\$diarytype=" . pw_var_export($diarytype) . ";\r\n\$newWrite=" . pw_var_export($newWrite) . ";\r\n\$albumdb=" . pw_var_export($albumdb) . ";\r\n\$smphoto=" . pw_var_export($smphoto) . ";\r\n?>");
    } else {
        include_once $pwCacheFile;
    }
}
require_once M_P . 'require/header.php';
require_once PrintEot('m_browse');
footer();
function browseNewSubject($num)
{
    global $db, $forum;
    require_once D_P . "data/bbscache/forum_cache.php";
    $element = L::loadClass('element');
    $article = array();
    $result = $element->newSubject(0, $num);
    foreach ($result as $val) {
Ejemplo n.º 19
0
function updateoptimize($config = array(), $type = 1, $o = '')
{
    foreach ($config as $key => $value) {
        if (strpos($key, 'db_') !== false) {
            $optimize = $config;
        } else {
            if (!in_array($key, array('imgsize', 'imgwidth', 'imglen'))) {
                $optimize['db_' . $key] = $value;
            }
        }
    }
    $configcache = "<?php\r\n\$optimize_conf=array(\r\n'{$o}'=>array(\r\n";
    $configcache .= "'{$type}'=>" . pw_var_export($optimize) . ",\r\n\r\n";
    $configcache .= "),\r\n);\r\n?>";
    writeover(D_P . "data/bbscache/optimize_{$o}.php", $configcache);
}
Ejemplo n.º 20
0
         $mark = $sorttype[$step];
         $db->update("DELETE FROM pw_elements WHERE type='usersort' AND mark=" . pwEscape($mark));
         $step++;
         $_usersort = $getinfo->userSort($mark, $db_sortnum, false);
         $_usersort = arr_unique($_usersort);
         if (is_array($_usersort) && count($_usersort) == $db_sortnum) {
             $tmpdate = end($_usersort);
             $usersort_judge[$mark] = $tmpdate['value'];
         } else {
             $usersort_judge[$mark] = 0;
         }
         if ($_usersort) {
             $sql = "INSERT INTO pw_elements(id,value,addition,type,mark) VALUES" . pwSqlMulti($_usersort, false);
             $db->update($sql);
         }
         writeover(D_P . 'data/bbscache/usersort_judge.php', "<?php\r\n\$usersort_judge=" . pw_var_export($usersort_judge) . ";\r\n?>");
         adminmsg('updatecache_total_step', "{$basename}&action=update&type=usersort&step={$step}");
     }
 } elseif ($type == 'newsubject') {
     $step = intval(GetGP('step'));
     require_once D_P . 'data/bbscache/forum_cache.php';
     $arr_forumkeys = array_keys($forum);
     if (!$step) {
         $step = 0;
         $db->query("DELETE FROM pw_elements WHERE type='newsubject'");
     }
     $total = count($arr_forumkeys);
     for ($i = 0; $i < 5; $i++) {
         if ($step < $total) {
             $fourmid = $arr_forumkeys[$step];
             !$forum[$fourmid] && adminmsg('undefined_action');
Ejemplo n.º 21
0
 /**
  * update list
  *
  * @return
  */
 function updateSQL()
 {
     global $timestamp;
     if (!$this->updatelist || !$this->updatetype || !$this->mark) {
         return false;
     }
     $special = (int) $this->special;
     $judges = array();
     $todaytime = $weektime = '';
     foreach ($this->updatetype as $key => $val) {
         if (in_array($key, array('replysort', 'replysortday', 'replysortweek')) && $this->judge['replysort']) {
             $judges['replysort'] = $this->judge['replysort'];
         }
         if (in_array($key, array('hitsort', 'hitsortday', 'hitsortweek')) && $this->judge['hitsort']) {
             $judges['hitsort'] = $this->judge['hitsort'];
         }
         if (strpos($key, 'day') && !$todaytime) {
             $todaytime = $timestamp - 24 * 3600;
         } elseif (strpos($key, 'week') && !$weektime) {
             $weektime = $timestamp - 7 * 24 * 3600;
         }
     }
     $this->db->update("REPLACE INTO pw_elements (type,mark,id,value,addition,special) VALUES " . S::sqlMulti($this->updatelist, false));
     $sortlist = array();
     $dellis = array();
     $orderIds = array();
     $query = $this->db->query("SELECT eid,type,id,value,addition FROM pw_elements WHERE type IN (" . S::sqlImplode(array_keys($this->updatetype)) . ") AND mark=" . S::sqlEscape($this->mark) . " AND special=" . S::sqlEscape($special) . " ORDER BY type,value DESC");
     while ($rt = $this->db->fetch_array($query)) {
         if (strpos($rt['type'], 'day') && $rt['addition'] && $rt['addition'] < $todaytime) {
             $dellist[] = $rt['eid'];
         } elseif (strpos($rt['type'], 'week') && $rt['addition'] && $rt['addition'] < $weektime) {
             $dellist[] = $rt['eid'];
         } else {
             $sortlist[$rt['type']][] = $rt;
         }
         if ($rt['type'] == 'todayfans') {
             /*记录删除前的排序*/
             $orderIds[] = $rt['id'];
         }
     }
     foreach ($sortlist as $key => $value) {
         if (count($value) > $this->cachenum) {
             $tem = array_slice($value, $this->cachenum);
             foreach ($tem as $val) {
                 $dellist[] = $val['eid'];
             }
         }
         if (in_array($key, array('replysort', 'replysortday', 'replysortweek'))) {
             $judgetype = 'replysort';
             array_splice($value, $this->cachenum);
         } elseif (in_array($key, array('hitsort', 'hitsortday', 'hitsortweek'))) {
             $judgetype = 'hitsort';
             array_splice($value, $this->cachenum);
         } else {
             $judgetype = '';
         }
         if ($judgetype && count($value) == $this->cachenum) {
             $tem = end($value);
             $judges[$judgetype][$key][$this->mark] = $tem['value'];
         } else {
             $judges[$judgetype][$key][$this->mark] = '0';
         }
     }
     if ($dellist) {
         if (in_array('todayfans', array_keys($this->updatetype))) {
             pwCache::setData(D_P . 'data/bbscache/yesterday_fans_brand.php', "<?php\r\n\$yesterdayfansbrand=" . pw_var_export($orderIds) . ";\r\n?>");
         }
         $this->db->update("DELETE FROM pw_elements WHERE eid IN (" . S::sqlImplode($dellist) . ")");
     }
     if ($judges) {
         foreach ($judges as $key => $value) {
             if ($key == 'replysort') {
                 if ($value != $this->judge['replysort']) {
                     pwCache::setData(D_P . 'data/bbscache/replysort_judge_' . $special . '.php', "<?php\r\n\$replysort_judge=" . pw_var_export($value) . ";\r\n?>");
                 }
             } elseif ($key == 'hitsort') {
                 pwCache::setData(D_P . 'data/bbscache/hitsort_judge.php', "<?php\r\n\$hitsort_judge=" . pw_var_export($value) . ";\r\n?>");
                 touch(D_P . 'data/bbscache/hitsort_judge.php');
             }
         }
     }
     return true;
 }
Ejemplo n.º 22
0
 /**
  * 设置文件缓存
  */
 function setFileCache()
 {
     if (!$this->_cache) {
         return;
     }
     $overPrintDao = $this->_getOverPrintDao();
     $overPrints = $overPrintDao->getAll();
     $tmp_overPrints = "\$overPrints=" . pw_var_export($overPrints) . ";";
     pwCache::setData($this->getCacheFileName(), "<?php\r\n" . $tmp_overPrints . "\r\n?>");
     return $overPrints;
 }
Ejemplo n.º 23
0
function UpdateClassCache($classdb = array(), $flag = false)
{
    global $info_class;
    $classcache = "<?php\r\n\$info_class=array(\r\n";
    foreach ($classdb as $key => $class) {
        !$class['ifshow'] && ($class['ifshow'] = '0');
        $flag && $info_class[$class['cid']]['ifshow'] && ($class['ifshow'] = '1');
        $class['name'] = str_replace(array('"', "'"), array("&quot;", "&#39;"), $class['name']);
        $classcache .= "'{$class['cid']}'=>" . pw_var_export($class) . ",\r\n\r\n";
    }
    $classcache .= ");\r\n?>";
    writeover(D_P . "data/bbscache/info_class.php", $classcache);
}
Ejemplo n.º 24
0
 function setData($filePath, $data, $isBuild = false, $method = 'rb+', $ifLock = true)
 {
     if ($isBuild && is_array($data)) {
         $_tmp = '';
         foreach ($data as $key => $value) {
             if (!preg_match('/^\\w+$/', $key)) {
                 continue;
             }
             if (is_numeric($key)) {
                 $key = '_' . $key;
             }
             $_tmp .= "\$" . $key . " = " . pw_var_export($value) . ";\r\n";
         }
         $data = "<?php\r\n" . $_tmp . "\r\n?>";
     }
     if ($GLOBALS['db_filecache_to_memcache'] && Perf::checkMemcache()) {
         $this->_clearDataFromMemcache($filePath);
     }
     if ($GLOBALS['db_cachefile_compress']) {
         $_packService = pwPack::getPackService();
         $_packService->flushCacheFile($filePath);
     }
     return writeover($filePath, $data, $method, $ifLock);
 }
Ejemplo n.º 25
0
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);
}
Ejemplo n.º 26
0
 /**
  * @desc 更新扫描进度
  */
 function updateProgress()
 {
     if ($this->progress > $this->count) {
         $this->progress = $this->count;
     }
     if ($this->objid) {
         foreach ($this->threaddb as $key => $forums) {
             foreach ($forums as $key2 => $value) {
                 if ($this->fid == $key2) {
                     $this->threaddb[$key][$key2]['progress'] = $this->progress;
                     $this->threaddb[$key][$key2]['result'] = $this->result;
                     $this->threaddb[$key][$key2]['table_progress'][$this->table] = $this->objid;
                 }
             }
         }
         $threaddb = serialize($this->threaddb);
         $catedb = serialize($this->catedb);
         # 写入文件
         $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);
     }
 }
Ejemplo n.º 27
0
 function threadscateGory($classdb)
 {
     //生成帖子交换分类
     $classcache = "<?php\r\n\$info_class=array(\r\n";
     foreach ($classdb as $key => $class) {
         !$class['ifshow'] && ($class['ifshow'] = '0');
         $class['cid'] = (int) $class['cid'];
         $flag && $info_class[$class['cid']]['ifshow'] && ($class['ifshow'] = '1');
         $class['name'] = str_replace(array('"', "'"), array("&quot;", "&#39;"), $class['name']);
         $classcache .= "'{$class['cid']}'=>" . pw_var_export($class) . ",\r\n\r\n";
     }
     $classcache .= ");\r\n?>";
     pwCache::setData(D_P . "data/bbscache/info_class.php", $classcache);
 }
Ejemplo n.º 28
0
function updatetags()
{
    global $db, $db_tagindex;
    $tagnum = max($db_tagindex, 200);
    $tagdb = array();
    $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . S::sqlLimit($tagnum));
    while ($rs = $db->fetch_array($query)) {
        $tagdb[$rs['tagname']] = $rs['num'];
    }
    /** pwCache::writeover(D_P."data/bbscache/tagdb.php","<?php\r\n\$tagdb=".pw_var_export($tagdb).";\r\n?>"); **/
    pwCache::setData(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>");
    touch(D_P . "data/bbscache/tagdb.php");
}
Ejemplo n.º 29
0
     @(include_once D_P . 'data/bbscache/mode_o_mosort.php');
     if (!$mosort || $mosort['time'] < $timestamp - 86400) {
         $mosort = array();
         if ($db_ifpwcache & 1) {
             $sql = "SELECT m.uid,m.username,m.icon as face FROM pw_elements e LEFT JOIN pw_members m ON e.id=m.uid WHERE e.type='usersort' AND e.mark='monthpost' ORDER BY e.value DESC " . pwLimit(6);
         } else {
             $montime = PwStrtoTime(get_date($timestamp, 'Y-m') . '-1');
             $sql = "SELECT m.uid,m.username,m.icon as face FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . pwEscape($montime) . " AND md.postnum>0 ORDER BY md.monthpost DESC " . pwLimit(6);
         }
         $query = $db->query($sql);
         while ($rt = $db->fetch_array($query)) {
             list($rt['face']) = showfacedesign($rt['face'], '1', 'm');
             $mosort[] = $rt;
         }
         $mosort['time'] = $timestamp;
         writeover(D_P . 'data/bbscache/mode_o_mosort.php', "<?php\r\n\$mosort=" . pw_var_export($mosort) . ";\r\n?>");
     }
     $ifmosortcache = 1;
     unset($mosort['time']);
 }
 $lastposttable = GetPtable($db_ptable);
 #'pw_posts'.$db_ptable;
 //经常回复我帖子的用户
 $query = $db->query("SELECT tid FROM pw_threads WHERE authorid=" . pwEscape($winduid) . " ORDER BY RAND() LIMIT 10");
 while ($rt = $db->fetch_array($query)) {
     $tiddb[] = $rt['tid'];
 }
 if (isset($tiddb) && count($tiddb) > 0) {
     $query = $db->query("SELECT COUNT(*) AS count,p.authorid as uid,m.username,m.icon as face FROM {$lastposttable} p LEFT JOIN pw_members m ON p.authorid=m.uid WHERE p.tid IN(" . pwImplode($tiddb) . ") AND p.authorid!=" . pwEscape($winduid) . " GROUP BY p.authorid ORDER BY count DESC LIMIT 9");
     while ($rt = $db->fetch_array($query)) {
         if (in_array($rt['uid'], $friendkeys)) {
Ejemplo n.º 30
0
    if ($o_indexset & 32) {
        $newWrite = browseWrite(5);
    }
    if ($db_share_open && $o_indexset & 64) {
        $newShares = browseShare(6);
    }
    if ($db_phopen && $o_indexset & 128) {
        $albumdb = browseAlbum(3);
    }
    if ($db_groups_open && $o_indexset & 256) {
        $reGroups = browseGroup(5);
    }
    if ($db_dopen && $o_indexset & 512) {
        list($newDiarys, $diarytype) = browseDiary(8);
    }
    writeover($pwCacheFile, "<?php\r\n\$reGroups=" . pw_var_export($reGroups) . ";\r\n\$newShares=" . pw_var_export($newShares) . ";\r\n\$hotsubject=" . pw_var_export($hotsubject) . ";\r\n\$hotforum=" . pw_var_export($hotforum) . ";\r\n\$hotuser="******";\r\n\$newDiarys=" . pw_var_export($newDiarys) . ";\r\n\$diarytype=" . pw_var_export($diarytype) . ";\r\n\$newWrite=" . pw_var_export($newWrite) . ";\r\n\$albumdb=" . pw_var_export($albumdb) . ";\r\n\$smphoto=" . pw_var_export($smphoto) . ";\r\n\$newuser="******";\r\n\$feeds=" . pw_var_export($feeds) . ";\r\n?>");
} else {
    include_once $pwCacheFile;
}
function browseNewuser($num)
{
    global $db, $tdtime;
    $newuser = array();
    $query = $db->query("SELECT username,uid,regdate FROM pw_members ORDER BY uid DESC LIMIT {$num}");
    while ($rt = $db->fetch_array($query)) {
        if ($rt['regdate'] >= $tdtime) {
            $newuser[] = $rt;
        }
    }
    /*
    $query = $db->query("SELECT username,uid FROM pw_members FORCE INDEX(PRIMARY) WHERE regdate>=" .pwEscape($tdtime)." AND regdate<=".pwEscape($tdtime+86400)." LIMIT $num");