Exemplo n.º 1
0
function getguestcache()
{
    global $fid, $tid, $timestamp, $db_guestdir, $db_guestindex, $db_guestthread, $db_guestread;
    $page = (int) $_GET['page'];
    switch (SCR) {
        case 'thread':
            empty($page) && ($page = 1);
            if (file_exists(D_P . "{$db_guestdir}/T_{$fid}/{$fid}_{$page}.html") && $timestamp - pwFilemtime(D_P . "{$db_guestdir}/T_{$fid}/{$fid}_{$page}.html") < $db_guestthread) {
                readfile(D_P . "{$db_guestdir}/T_{$fid}/{$fid}_{$page}.html");
                guestfooter();
            }
            break;
        case 'index':
            if (file_exists(D_P . "{$db_guestdir}/index.html") && $timestamp - pwFilemtime(D_P . "{$db_guestdir}/index.html") < $db_guestindex) {
                readfile(D_P . "{$db_guestdir}/index.html");
                guestfooter();
            }
            break;
        case 'read':
            $tmp = 'R_' . intval($tid / 500);
            !$page && ($page = 1);
            if (file_exists(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$page}.html") && $timestamp - pwFilemtime(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$page}.html") < $db_guestread) {
                readfile(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$page}.html");
                echo "<script src=\"hitcache.php?tid={$tid}\"></script>";
                guestfooter();
            }
            break;
    }
}
Exemplo n.º 2
0
 /**
  * @param $tag
  * @param $result
  * @return unknown_type
  */
 function ifUpdateCache()
 {
     if (is_file($this->filepath) && pwFilemtime($this->filepath) + 60 * 10 >= $this->timestamp) {
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 3
0
 /**
  * 检查用户搜索间隔时间
  * @return unknown_type
  */
 function _checkWaitSegment()
 {
     if (!$this->_waitSegment) {
         return true;
     }
     if (file_exists(D_P . 'data/bbscache/schwait_cache.php')) {
         if ($this->_timestamp - pwFilemtime(D_P . 'data/bbscache/schwait_cache.php') > $this->_waitSegment) {
             P_unlink(D_P . 'data/bbscache/schwait_cache.php');
         } else {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
0
 $schline = md5($schline . '|search');
 $orderway != 'replies' && $orderway != 'hits' && $orderway != 'favors' && ($orderway = 'lastpost');
 $asc != 'ASC' && ($asc = 'DESC');
 $sorderby = $orderway . '|' . $asc;
 $orderby = "ORDER BY t.{$orderway} {$asc}";
 if (!$authorid) {
     @extract($db->get_one("SELECT sid,schtime,total,schedid FROM pw_schcache WHERE schline=" . pwEscape($schline) . ' LIMIT 1'));
     if ($newatc && $timestamp - $schtime > 1800) {
         $db->update("DELETE FROM pw_schcache WHERE sid=" . pwEscape($sid));
         $schedid = '';
     }
 }
 if (!$schedid) {
     $db_schwait = (int) $db_schwait;
     if (file_exists(D_P . 'data/bbscache/schwait_cache.php')) {
         if ($timestamp - pwFilemtime(D_P . 'data/bbscache/schwait_cache.php') > $db_schwait) {
             P_unlink(D_P . 'data/bbscache/schwait_cache.php');
         } else {
             Showmsg('search_wait');
         }
     }
     $db->update("DELETE FROM pw_schcache WHERE schtime<" . pwEscape($timestamp - 3600));
     if (($keyword || $pwuser || !is_numeric($authorid)) && $_G['searchtime'] != 0) {
         @extract($db->get_one("SELECT lasttime FROM pw_memberinfo WHERE uid=" . pwEscape($winduid)));
         if ($timestamp - $lasttime < $_G['searchtime']) {
             Showmsg('search_limit');
         }
         $db->update("UPDATE pw_memberinfo SET lasttime=" . pwEscape($timestamp) . ' WHERE uid=' . pwEscape($winduid));
     }
     $sqlwhere = "t.ifcheck='1' ";
     if ($seekfid != 'all') {
Exemplo n.º 6
0
            $right .= '_' . $match[4][$key];
        }
        $PHPWind_StatAdmin[$right] = $PHPWind_StatAdmin[$right] ? $PHPWind_StatAdmin[$right] + 1 : 1;
    }
    $statadmin = serialize($PHPWind_StatAdmin);
    $statadmin = base64_encode($statadmin);
    $s_url = rawurlencode($pwServer['HTTP_HOST']);
    $rawbbsname = rawurlencode($db_bbsname);
    PostHost('http://nt.phpwind.net/pwstat.php', "bbsname={$rawbbsname}&url={$s_url}&type=admin&data={$statadmin}", 'POST');
    writeover(D_P . 'data/bbscache/file_lock1.txt', '');
} elseif (pwFilemtime(D_P . 'data/bbscache/info.txt') < $cachetime) {
    require_once R_P . 'require/posthost.php';
    $wget = PostHost('http://nt.phpwind.net/src/pw7/info1.php', "charset={$db_charset}&ce={$ceversion}");
    $wget = str_replace(array('<pwret>', '</pwret>'), '', $wget);
    writeover(D_P . 'data/bbscache/info.txt', $wget);
} elseif (pwFilemtime(D_P . "data/bbscache/myshow_default.php") < $cachetime) {
    require_once R_P . 'require/posthost.php';
    $url = "http://dm.phpwind.net/misc/custom/recommend_2.xml?{$timestamp}";
    $data = PostHost($url);
    if ($data && strpos($data, '<?xml') !== false) {
        $name = array();
        $id = array();
        $T = '';
        $maxnum = 8;
        $xml_parser = xml_parser_create();
        xml_parse_into_struct($xml_parser, $data, $arr_vals);
        xml_parser_free($xml_parser);
        foreach ($arr_vals as $v) {
            if ($v['tag'] == 'ITEM' && $v['attributes']) {
                $name[] = $v['attributes']['NAME'];
            } elseif ($v['tag'] == 'CODE') {
Exemplo n.º 7
0
                 $tpcdb[] = $thread;
             }
             $db->free_result($query);
         }
     } else {
         $topadd && ($topadd .= $R ? ' ASC,' : ' DESC,');
         $query = $db->query("SELECT * FROM pw_threads WHERE {$sql} {$searchadd} ORDER BY {$topadd} {$orderway} {$asc} {$limit2}");
         while ($thread = $db->fetch_array($query)) {
             $tpcdb[] = $thread;
         }
         $db->free_result($query);
     }
 }
 $R && ($tpcdb = array_reverse($tpcdb));
 //Start Here pwcache
 if ($db_ifpwcache & 112 && pwFilemtime(D_P . 'data/bbscache/hitsort_judge.php') < $timestamp - 600) {
     extract(pwCache::getData(D_P . 'data/bbscache/hitsort_judge.php', false));
     $updatelist = $updatetype = array();
     foreach ($tpcdb as $thread) {
         if ($db_ifpwcache & 16) {
             if ($thread['hits'] > $hitsort_judge['hitsort'][$fid] && $thread['fid'] == $fid) {
                 $updatelist[] = array('hitsort', $fid, $thread['tid'], $thread['hits'], '', 0);
                 $updatetype['hitsort'] = 1;
             }
         }
         if ($db_ifpwcache & 32 && $thread['postdate'] > $timestamp - 24 * 3600) {
             if ($thread['hits'] > $hitsort_judge['hitsortday'][$fid] && $thread['fid'] == $fid) {
                 $updatelist[] = array('hitsortday', $fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0);
                 $updatetype['hitsortday'] = 1;
             }
         }
Exemplo n.º 8
0
            }
            unset($threaddbs);
        }
        $channel['pubDate'] = date('r', $forumLastPostTime);
        $Rss->channel($channel);
        $Rss->generate($cache_path);
    }
    header("Content-type: application/xml");
    if (file_exists($cache_path)) {
        $etag = '"' . md5_file($cache_path) . '"';
        if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $etag == $_SERVER['HTTP_IF_NONE_MATCH']) {
            $statusCode = 304;
        } else {
            header('Etag:' . $etag);
        }
        $fileModifiedTime = pwFilemtime($cache_path);
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $fileModifiedTime == $_SERVER['HTTP_IF_MODIFIED_SINCE']) {
            $statusCode = 304;
        } else {
            $lastModifiedTime = date('D, d M Y H:i:s', $fileModifiedTime) . ' GMT';
            header("Last-Modified: {$lastModifiedTime}");
        }
        if ($statusCode === 304) {
            header("HTTP/1.0 304 Not Modified");
            exit;
        }
    }
    @readfile($cache_path);
    exit;
}
function decodeRssHtml($str)
Exemplo n.º 9
0
function getSpecialFid()
{
    static $fids = null;
    if (!isset($fids)) {
        if (pwFilemtime(D_P . 'data/bbscache/specialforum.php') < pwFilemtime(D_P . 'data/bbscache/forum_cache.php')) {
            global $db;
            $query = $db->query("SELECT fid FROM pw_forums WHERE type<>'category' AND (cms=1 OR password!='' OR forumsell!='' OR f_type='hidden' OR allowvisit!='')");
            while ($rt = $db->fetch_array($query)) {
                $fids .= ",'{$rt['fid']}'";
            }
            $fids && ($fids = substr($fids, 1));
            pwCache::setData(D_P . 'data/bbscache/specialforum.php', "<?php\r\n\$fids = \"{$fids}\";\r\n?>");
        } else {
            //* include pwCache::getPath(D_P.'data/bbscache/specialforum.php');
            extract(pwCache::getData(D_P . 'data/bbscache/specialforum.php', false));
        }
    }
    return $fids;
}
Exemplo n.º 10
0
            }
        }
    }
    include PrintEot('safecheck');
    exit;
} elseif ($action == 'cache') {
    $check = $dirlist = array();
    $cklog = array('1' => 0, '2' => 0, '3' => 0);
    cachefile(D_P . 'data/');
    if (empty($check)) {
        adminmsg('all_file_ok');
    }
    foreach ($check as $file => $value) {
        $dir = dirname($file);
        $filename = basename($file);
        $filemtime = get_date(pwFilemtime($file));
        $filesize = filesize($file);
        $dirlist[$dir][] = array($filename, $filesize, $filemtime, $value);
    }
    include PrintEot('safecheck');
    exit;
}
function checkfile($keyword, $dir, $sub)
{
    global $check;
    $fp = opendir($dir);
    while ($filename = readdir($fp)) {
        $path = $dir . $filename;
        if ($filename != '.' && $filename != '..') {
            if (is_dir($path)) {
                $sub && checkfile($keyword, $path . '/', $sub);
Exemplo n.º 11
0
        $rt['anonymous'] && ($rt['author'] = $db_anonymousname);
        $link = "{$db_bbsurl}/job.php?action=topost&tid={$rt['tid']}&pid={$rt['pid']}";
        $item = array('title' => $rt['subject'], 'description' => $rt['content'], 'link' => $link, 'author' => $rt['author'], 'category' => strip_tags($rs['name']), 'pubdate' => date('r', $rt['postdate']));
        $Rss->item($item);
    }
    $all = $Rss->rssHeader;
    $all .= $Rss->rssChannel;
    $all .= $Rss->rssImage;
    $all .= $Rss->rssItem;
    $all .= "</channel></rss>";
    header("Content-type: application/xml");
    echo $all;
    exit;
} else {
    $cache_path = D_P . 'data/bbscache/rss_' . $fid . '_cache.xml';
    if ($timestamp - pwFilemtime($cache_path) > $Rss_updatetime * 60) {
        require_once R_P . 'lib/rss.class.php';
        require_once D_P . 'data/bbscache/forum_cache.php';
        if ($db_tlist) {
            @extract($db->get_one("SELECT MAX(tid) AS tid FROM pw_threads"));
            $pw_tmsgs = GetTtable($tid);
        } else {
            $pw_tmsgs = 'pw_tmsgs';
        }
        if ($fid) {
            $rt = $db->get_one("SELECT allowvisit,f_type FROM pw_forums WHERE fid=" . pwEscape($fid));
            if (!$rt || $rt['allowvisit'] != '' || $rt['f_type'] == 'hidden') {
                echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=rss.php'>";
                exit;
            }
        }
Exemplo n.º 12
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();
Exemplo n.º 13
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();
}
Exemplo n.º 14
0
 function getLastUpdateTime()
 {
     if (!file_exists($this->_filePath)) {
         return $this->_timestamp;
     }
     $time = pwFilemtime($this->_filePath);
     return PwStrtoTime(get_date($time, 'Y-m-d'));
 }
Exemplo n.º 15
0
} elseif ($tab == 'g' && $db_groups_open && $o_browse & 32) {
    $reGroups = browseGroup(15);
    $cMembers = array();
    $colonyids = pwImplode(array_keys($reGroups));
    if ($colonyids) {
        $query = $db->query("SELECT id,ifadmin,colonyid FROM pw_cmembers WHERE colonyid IN ({$colonyids}) AND uid=" . pwEscape($winduid, false));
        while ($rt = $db->fetch_array($query)) {
            $cMembers[$rt['colonyid']] = 1;
        }
    }
} elseif ($tab == 'r' && $o_browse & 256) {
    $newreply = browseNewreply(30);
} else {
    $tab = 'h';
    $pwCacheFile = D_P . 'data/bbscache/o_browse_cache.php';
    if (pwFilemtime($pwCacheFile) + 60 < $timestamp) {
        $element = L::loadClass('element');
        if ($o_browse & 128) {
            $newsubject = browseNewSubject(10);
        }
        if ($o_browse & 256) {
            $newreply = browseNewreply(10);
        }
        if ($o_browse & 1) {
            $newPics = array();
            $result = $element->newPic(0, 5);
            foreach ($result as $val) {
                $newPics[] = array('url' => $val['url'], 'title' => substrs($val['title'], 30), 'image' => $val['image']);
            }
            $newThreads = array();
            $result = $element->replySortWeek(0, 9);
Exemplo n.º 16
0
 function getThreadMethod()
 {
     global $page, $db_fcachenum, $fid, $foruminfo, $timestamp, $db_fcachetime;
     $fcache = 0;
     if ($db_fcachenum && $page <= $db_fcachenum && empty($this->threadSearch->urladd)) {
         $fcachetime = pwFilemtime(D_P . "data/bbscache/fcache_{$fid}_{$page}.php");
         $lastpost = explode("\t", $foruminfo['lastpost']);
         if (!file_exists(D_P . "data/bbscache/fcache_{$fid}_{$page}.php") || $lastpost[2] > $fcachetime && $timestamp - $fcachetime > $db_fcachetime) {
             $fcache = 1;
         } else {
             $fcache = 2;
         }
     }
     return $fcache;
 }
Exemplo n.º 17
0
     $bankdb['savetime'] = get_date($bankdb['startdate']);
 }
 if (!$bankdb['ddeposit'] || !$bankdb['dstartdate']) {
     $bankdb['dsavetime'] = "--";
 } else {
     $bankdb['dsavetime'] = get_date($bankdb['dstartdate'], 'Y-m-d');
     $endtime = get_date($bankdb['dstartdate'] + $bk_ddate * 30 * 86400, 'Y-m-d');
 }
 foreach ($_CREDITDB as $key => $value) {
     if (!$showdb[$key]) {
         $showdb[$key][0] = $value[0];
         $showdb[$key][1] = 0;
     }
 }
 !$bk_num && ($bk_num = 10);
 if (!$bk_per || $timestamp - pwFilemtime(D_P . "data/bbscache/bank_sort.php") > $bk_per * 3600) {
     $_DESPOSTDB = array();
     $query = $db->query("SELECT i.uid,m.username,i.deposit,i.startdate FROM pw_memberinfo i LEFT JOIN pw_members m ON m.uid=i.uid ORDER BY i.deposit DESC " . S::sqlLimit($bk_num));
     while ($deposit = $db->fetch_array($query)) {
         if ($deposit['deposit']) {
             $deposit['startdate'] = $deposit['startdate'] ? get_date($deposit['startdate']) : '';
             $_DESPOSTDB[] = array($deposit['uid'], $deposit['username'], $deposit['deposit'], $deposit['startdate']);
         }
     }
     $_DDESPOSTDB = array();
     $query = $db->query("SELECT i.uid,username,ddeposit,dstartdate FROM pw_memberinfo i LEFT JOIN pw_members m ON m.uid=i.uid ORDER BY ddeposit DESC " . S::sqlLimit($bk_num));
     while ($deposit = $db->fetch_array($query)) {
         if ($deposit['ddeposit']) {
             $deposit['dstartdate'] = $deposit['dstartdate'] ? get_date($deposit['dstartdate']) : '';
             $_DDESPOSTDB[] = array($deposit['uid'], $deposit['username'], $deposit['ddeposit'], $deposit['dstartdate']);
         }
Exemplo n.º 18
0
function modeEot($template, $EXT = 'htm')
{
    global $db_mode, $db_tplpath;
    if ($db_mode == 'area') {
        $srcTpl = getAreaSrcTpl($template, $EXT);
        $tarTpl = D_P . "data/tplcache/" . $db_tplpath . $template . '.' . $EXT;
    } else {
        $srcTpl = M_P . "template/{$template}.{$EXT}";
        $tarTpl = D_P . "data/tplcache/" . $db_mode . '_' . $template . '.' . $EXT;
    }
    if (!file_exists($srcTpl)) {
        return false;
    }
    if (pwFilemtime($tarTpl) > pwFilemtime($srcTpl)) {
        return $tarTpl;
    } else {
        return modeTemplate($template, $srcTpl, $tarTpl);
    }
}
Exemplo n.º 19
0
function adminmsg($msg, $jumpurl = '', $t = 2, $langtype = 'admin')
{
    @extract($GLOBALS, EXTR_SKIP);
    if ($langtype == 'admin') {
        $msg = getLangInfo('cpmsg', $msg);
    } else {
        $msg = getLangInfo('msg', $msg);
    }
    if (defined('AJAX')) {
        echo $msg;
        ajax_footer();
    }
    if ($jumpurl != '') {
        $basename = $jumpurl;
        $ifjump = "<meta http-equiv='Refresh' content='{$t}; url={$jumpurl}'>";
    } elseif (!$basename) {
        $basename = $REQUEST_URI;
    }
    if ($db_adminrecord == 1 && $basename != 'javascript:history.go(-1);') {
        $adminmsg = 2;
    } else {
        $adminmsg = 1;
    }
    include PrintEot('message');
    $cachetime = $timestamp - 3600 * 24;
    if (readover(D_P . 'data/bbscache/none.txt') != '' || pwFilemtime(D_P . 'data/bbscache/file_lock.txt') < $cachetime || pwFilemtime(D_P . 'data/bbscache/info.txt') < $cachetime || pwFilemtime(D_P . 'data/bbscache/userpay.txt') < $cachetime) {
        echo '<script language="JavaScript">if (parent.notice) {parent.notice.location.href = "' . $admin_file . '?adminjob=notice";}</script>';
    }
    afooter();
}
Exemplo n.º 20
0
             }
             $userdb = "{$pre} <a href='{$db_bbsurl}/{$value['url']}' target='_blank'>{$value['title']}</a> {$useradd}";
             $userdb = str_replace('"', '\\"', $userdb);
             $newlist .= "document.write(\"{$userdb}<br>\");\n";
         }
         pwCache::writeover($cachefile, $newlist);
         procUnLock('new_js_member');
         echo $newlist;
     } else {
         @readfile($cachefile);
     }
     break;
 case 'article':
     S::gp(array('num', 'length', 'fidin', 'fidout', 'postdate', 'author', 'fname', 'hits', 'replies', 'pre', 'digest', 'order'));
     $cachefile = D_P . "data/bbscache/new_{$action}_" . md5($action . (int) $num . (int) $length . $fidin . $fidout . (int) $postdate . (int) $author . (int) $fname . (int) $hits . (int) $replies . (int) $pre . (int) $digest . (int) $order);
     if ($timestamp - $per >= pwFilemtime($cachefile) && procLock('new_js_article')) {
         $num = is_numeric($num) ? $num : 10;
         $length = is_numeric($length) ? $length : 35;
         $pre = is_numeric($pre) ? $prefix[$pre] : $prefix[0];
         //* $fname && include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
         $fname && pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
         $orderway = array('1' => 'lastpost', '2' => 'postdate', '3' => 'replies', '4' => 'hits');
         $orderby = is_numeric($order) ? $orderway[$order] : $orderway[1];
         !$orderby && ($orderby = $orderway[1]);
         $sqladd = "ifcheck=1";
         $fidoff = $ext = '';
         $query = $db->query("SELECT fid FROM pw_forums WHERE password!='' OR allowvisit!='' OR f_type='hidden'");
         while ($rt = $db->fetch_array($query)) {
             $fidoff .= $ext . $rt['fid'];
             !$ext && ($ext = ',');
         }
Exemplo n.º 21
0
 function getpath($template, $EXT = 'htm')
 {
     $srcTpl = $this->dir . 'default/' . "{$template}.{$EXT}";
     $tarTpl = D_P . "data/tplcache/cms_" . $template . '.' . $EXT;
     if (!file_exists($srcTpl)) {
         return false;
     }
     if (pwFilemtime($tarTpl) > pwFilemtime($srcTpl)) {
         return $tarTpl;
     }
     return modeTemplate($srcTpl, $tarTpl);
 }
 /**
  * 缓存100个热门标签
  * 
  * @param int $num 
  * @param int $updatas  强制更新
  */
 function setTopCache($num = 100, $updates = null)
 {
     $tmpnum = intval($num);
     $num = min($tmpnum, 100);
     $cachetime = pwFilemtime($this->_memberTagDbFile);
     if (!file_exists($this->_memberTagDbFile) || $this->_timestamp - $cachetime > $this->_hour || $updates) {
         $memberTagsDb = $this->_getMemberTagsDB();
         $memberTagsData = $memberTagsDb->getTagsByNum($num);
         pwCache::setData($this->_memberTagDbFile, array('memberTagsData' => $memberTagsData), true);
         touch($this->_memberTagDbFile);
     }
 }
Exemplo n.º 23
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');
Exemplo n.º 24
0
             } else {
                 $useradd = '';
             }
             $userdb = "{$pre} <a href='{$db_bbsurl}/{$value['url']}' target='_blank'>{$value['title']}</a> {$useradd}";
             $newlist .= "document.write(\"{$userdb}<br>\");\n";
         }
         echo $newlist;
         writeover($cachefile, $newlist);
     } else {
         @readfile($cachefile);
     }
     break;
 case 'article':
     InitGP(array('num', 'length', 'fidin', 'fidout', 'postdate', 'author', 'fname', 'hits', 'replies', 'pre', 'digest', 'order'));
     $cachefile = D_P . "data/bbscache/new_{$action}_" . md5($action . (int) $num . (int) $length . $fidin . $fidout . (int) $postdate . (int) $author . (int) $fname . (int) $hits . (int) $replies . (int) $pre . (int) $digest . (int) $order);
     if ($timestamp - $per >= pwFilemtime($cachefile)) {
         $num = is_numeric($num) ? $num : 10;
         $length = is_numeric($length) ? $length : 35;
         $pre = is_numeric($pre) ? $prefix[$pre] : $prefix[0];
         $fname && (include_once D_P . 'data/bbscache/forum_cache.php');
         $orderway = array('1' => 'lastpost', '2' => 'postdate', '3' => 'replies', '4' => 'hits');
         $orderby = is_numeric($order) ? $orderway[$order] : $orderway[1];
         !$orderby && ($orderby = $orderway[1]);
         $sqladd = "ifcheck=1";
         $fidoff = $ext = '';
         $query = $db->query("SELECT fid FROM pw_forums WHERE password!='' OR allowvisit!='' OR f_type='hidden'");
         while ($rt = $db->fetch_array($query)) {
             $fidoff .= $ext . $rt['fid'];
             !$ext && ($ext = ',');
         }
         $fidoff && ($sqladd .= " AND fid NOT IN({$fidoff})");
Exemplo n.º 25
0
function expireguestcache($expireSeconds = 86400)
{
    global $timestamp, $db_guestdir;
    $dir = D_P . "{$db_guestdir}/";
    if ($dirHandler = opendir($dir)) {
        while (($file = readdir($dirHandler)) !== false) {
            $filePath = $dir . $file;
            if (is_file($filePath)) {
                if ($timestamp - pwFilemtime($filePath) > $expireSeconds) {
                    P_unlink($filePath);
                }
            } elseif (is_dir($filePath) && false === strpos($filePath, ".")) {
                $subDir = $filePath . "/";
                $subDirHandler = opendir($subDir);
                while (($file = readdir($subDirHandler)) !== false) {
                    $filePath = $subDir . $file;
                    if (is_file($filePath)) {
                        if ($timestamp - pwFilemtime($filePath) > $expireSeconds) {
                            P_unlink($filePath);
                        }
                    }
                }
                closedir($subDirHandler);
            }
        }
        closedir($dirHandler);
    }
}
Exemplo n.º 26
0
    $pwSendmail['sent'] = 0;
    $pwSendmail['step'] = 0;
    pwCache::setData($tmpCachefile, "<?php\r\ndie();\r\n?>\r\n" . serialize($pwSendmail));
    touch($tmpCachefile);
    include PrintEot('sendmail');
    exit;
} elseif ($action == 'confirm') {
    //* $pwSendmail = readover($tmpCachefile);
    $pwSendmail = pwCache::getData($tmpCachefile, false, true);
    $pwSendmail = trim(substr($pwSendmail, 19));
    $pwSendmail = @unserialize($pwSendmail);
    if (empty($pwSendmail)) {
        pwCache::deleteData($tmpCachefile);
        adminmsg('operate_fail');
    }
    $pwSendmail['lasttime'] = get_date(pwFilemtime($tmpCachefile));
    include PrintEot('sendmail');
    exit;
} elseif ($action == 'groupsend') {
    require_once R_P . 'require/sendemail.php';
    //* $pwSendmail = readover($tmpCachefile);
    $pwSendmail = pwCache::getData($tmpCachefile, false, true);
    $pwSendmail = trim(substr($pwSendmail, 19));
    $pwSendmail = @unserialize($pwSendmail);
    if (empty($pwSendmail)) {
        pwCache::deleteData($tmpCachefile);
        adminmsg('sendmsg_nolog');
    }
    if ($pwSendmail['by'] == 0) {
        $pwSQL = "WHERE groupid IN(" . S::sqlImplode($pwSendmail['info']) . ")";
    } elseif ($pwSendmail['by'] == 1) {
Exemplo n.º 27
0
<?php

require_once 'global.php';
@header("Content-type: application/xml");
$for_google = S::getGP('g');
if ($for_google) {
    $cachefile = D_P . "data/bbscache/sitemap_google.xml";
} else {
    $cachefile = D_P . "sitemap.xml";
}
//* @include_once pwCache::getPath(D_P.'data/bbscache/sm_config.php');
pwCache::getData(D_P . 'data/bbscache/sm_config.php');
!$sm_updatePeri && ($sm_updatePeri = 12);
if ($timestamp - pwFilemtime($cachefile) >= $sm_updatePeri * 3600) {
    $sm_num < 1 && ($sm_num = 1000);
    if ($db_tlist) {
        $rt = $db->get_one("SELECT MAX(tid) AS mtid FROM pw_threads");
        $pw_tmsgs = GetTtable($rt['mtid']);
    } else {
        $pw_tmsgs = 'pw_tmsgs';
    }
    $fidoff = array('0');
    $query = $db->query("SELECT fid,allowvisit,password,f_type,forumsell FROM pw_forums WHERE type<>'category'");
    while ($rt = $db->fetch_array($query)) {
        if ($rt['f_type'] == 'hidden' || $rt['password'] || $rt['forumsell'] || $rt['allowvisit']) {
            $fidoff[] = $rt['fid'];
        }
    }
    $sql = $fidoff ? ' fid NOT IN(' . S::sqlImplode($fidoff) . ')' : '1';
    $query = $db->query("SELECT t.tid,t.fid,t.subject,t.postdate,t.lastpost,t.hits,t.replies,t.digest,tm.content FROM pw_threads t FORCE INDEX (" . getForceIndex('idx_postdate') . ") LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid WHERE {$sql} ORDER BY t.postdate DESC LIMIT {$sm_num}");
    while ($rt = $db->fetch_array($query)) {
Exemplo n.º 28
0
function portalEcho($sign, $_viewer = '', $name = '')
{
    $GLOBALS['__pwPortalEot'] = 1;
    global $timestamp;
    extract(pwCache::getData(D_P . 'data/bbscache/portal_config.php', false));
    extract(pwCache::getData(D_P . 'data/bbscache/portalhtml_config.php', false));
    $staticPath = S::escapePath(PORTAL_PATH . $sign . '/index.html');
    $mainFile = S::escapePath(PORTAL_PATH . $sign . '/' . PW_PORTAL_MAIN);
    $configFile = S::escapePath(PORTAL_PATH . $sign . '/' . PW_PORTAL_CONFIG);
    //$staticFileMTime = pwFilemtime($staticPath);
    $staticFileMTime = isset($portalhtml_times[$sign]) ? $portalhtml_times[$sign] : 0;
    $tplFileMTime = max(pwFilemtime($mainFile), pwFilemtime($configFile));
    if ($tplFileMTime > $staticFileMTime || $GLOBALS['db_portalstatictime'] && $staticFileMTime < $timestamp - $GLOBALS['db_portalstatictime'] * 60 || !filesize($staticPath) || $portal_staticstate[$sign]) {
        portalStatic($sign, $_viewer, $name);
    }
    $output .= pwCache::getData($staticPath, false, true);
    echo '-->' . $output . '<!--';
}
Exemplo n.º 29
0
<?php

!defined('P_W') && exit('Forbidden');
S::gp(array('subjectid', 'page', 'type'));
$u = "http://dm.phpwind.net/misc";
$subjectid = (int) $subjectid;
(!is_numeric($page) || $page < 1) && ($page = 1);
$s = '300.xml';
if ($type == 'general') {
    $s = $subjectid ? $subjectid . '_' . $page . '.xml' : '300.xml';
} elseif ($type == 'magic') {
    $s = $subjectid ? $subjectid . '_' . $page . '.xml' : '200.xml';
}
$cachefile = D_P . "data/bbscache/myshow_{$s}";
if (!file_exists($cachefile) || $timestamp - pwFilemtime($cachefile) > 43200) {
    $data = '';
    if ($subjectid) {
        $url = "{$u}/list/{$s}?{$timestamp}";
    } else {
        $url = "{$u}/menu/{$s}?{$timestamp}";
    }
    require_once R_P . 'require/posthost.php';
    $data = PostHost($url);
    if ($data && strpos($data, '<?xml') !== false) {
        //* writeover($cachefile, $data);
        pwCache::writeover($cachefile, $data);
    }
}
header("Content-Type: text/xml; charset=UTF-8");
$data = pwCache::readover($cachefile);
echo $data;
Exemplo n.º 30
0
} elseif ($type == 'autostatic') {
    S::gp(array('alias'));
    //* include_once pwCache::getPath(D_P.'data/bbscache/area_config.php');
    pwCache::getData(D_P . 'data/bbscache/area_config.php');
    if (!$alias || !$area_channels[$alias]) {
        exit;
    }
    //频道不存在
    if (!$area_statictime) {
        exit;
    }
    //未设置更新时间
    $channelInfo = $area_channels[$alias];
    if ($db_distribute) {
        $file = S::escapePath(AREA_PATH . $alias . '/index.html');
        if ($channelInfo['statictime'] && pwFilemtime($file) < $channelInfo['statictime']) {
            require M_P . 'index.php';
            aliasStatic($channelInfo['alias']);
            touch($file, $channelInfo['statictime']);
            exit;
        }
    }
    if ($channelInfo['statictime'] && $channelInfo['statictime'] + $area_statictime * 60 > $timestamp) {
        exit;
    }
    require M_P . 'index.php';
    aliasStatic($channelInfo['alias']);
    $chanelService->updateChannelStaticTime($alias, $timestamp);
} elseif ($type == 'read') {
    S::gp(array('id'));
    $areaLevelService = L::loadClass('arealevel', 'area');