Пример #1
0
 function getTopicCache()
 {
     //* @include pwCache::getPath(D_P.'data/bbscache/topic_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/topic_config.php', false));
     $this->topiccatedb =& $topiccatedb;
     $this->topicmodeldb =& $topicmodeldb;
 }
Пример #2
0
function aliasStatic($alias)
{
    $file = S::escapePath(AREA_PATH . $alias . '/index.html');
    $output = cookTemplate();
    pwCache::writeover($file, $output);
    ob_clean();
}
Пример #3
0
/**
 * 组装小名片数据
 *
 * @param int $uid 用户ID
 * @param int $winduid 当前用户id
 * @param bool $username 用户名
 * @return array
 */
function getCardData($uid, $winduid, $username)
{
    extract(pwCache::getData(R_P . "data/bbscache/level.php", false));
    if ($uid < 1 && !trim($username) || $username == '游客' || $username == '匿名') {
        return array('username' => '游客', 'memtitle' => $ltitle[2]);
    }
    $userService = L::loadClass('UserService', 'user');
    if ($uid) {
        $userInfo = $userService->get($uid, true, true);
    } elseif ($username) {
        $userInfo = $userService->getByUserName($username, true, true);
    }
    if (!S::isArray($userInfo)) {
        return array();
    }
    require_once R_P . 'require/showimg.php';
    list($faceimage) = showfacedesign($userInfo['icon'], 1, 's');
    $userInfo['groupid'] == '-1' && ($userInfo['groupid'] = $userInfo['memberid']);
    !array_key_exists($userInfo['groupid'], (array) $lpic) && ($userInfo['groupid'] = 8);
    $online = checkOnline($userInfo['thisvisit']);
    $onlineRead = $online ? getOnlineViewing($userInfo['uid'], $userInfo['username']) : array();
    $user = array('mine' => $userInfo['uid'] == $winduid || !$winduid ? 0 : 1, 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'icon' => $faceimage, 'memtitle' => $ltitle[$userInfo['groupid']], 'genderClass' => $userInfo['gender'], 'viewTid' => isset($onlineRead['tid']) && $onlineRead['tid'] ? $onlineRead['tid'] : '', 'viewFid' => isset($onlineRead['fid']) && $onlineRead['fid'] ? $onlineRead['fid'] : '', 'online' => $online ? 1 : 0);
    $user['medals'] = getMedalsByUid($userInfo['uid']);
    // 勋章
    $memberTagsService = L::loadClass('memberTagsService', 'user');
    $user['memberTags'] = $memberTagsService->makeClassTags($memberTagsService->getMemberTagsByUid($userInfo['uid']));
    //标签
    $attentionSerivce = L::loadClass('Attention', 'friend');
    /* @var $attentionSerivce PW_Attention */
    $user['attention'] = $attentionSerivce->isFollow($winduid, $userInfo['uid']) ? 1 : 0;
    //关注
    return $user;
}
Пример #4
0
function creatguestcache($output)
{
    global $fid, $tid, $timestamp, $db_guestdir, $page;
    switch (SCR) {
        case 'thread':
            if (!is_dir(D_P . "{$db_guestdir}/T_{$fid}")) {
                @mkdir(D_P . "{$db_guestdir}/T_{$fid}");
                @chmod(D_P . "{$db_guestdir}/T_{$fid}", 0777);
            }
            pwCache::writeover(D_P . "{$db_guestdir}/T_{$fid}/{$fid}_{$page}.html", $output);
            break;
        case 'read':
            $tmp = 'R_' . intval($tid / 500);
            if (!is_dir(D_P . "{$db_guestdir}/{$tmp}")) {
                @mkdir(D_P . "{$db_guestdir}/{$tmp}");
                @chmod(D_P . "{$db_guestdir}/{$tmp}", 0777);
            }
            pwCache::writeover(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$page}.html", $output);
            break;
        case 'index':
            $indexpath = getguestIndexpath();
            pwCache::writeover($indexpath, $output);
            break;
    }
}
Пример #5
0
 function setActCache()
 {
     //* include pwCache::getPath(D_P.'data/bbscache/activity_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/activity_config.php', false));
     $this->activitycatedb = $activity_catedb;
     $this->activitymodeldb = $activity_modeldb;
 }
 function getByTid($tid)
 {
     global $attachpath, $db_windpost, $foruminfo, $fid, $forumset, $pwforum, $db_hits_store;
     $tid = intval($tid);
     if ($tid <= 0) {
         return $this->buildResponse(THREAD_INVALID_PARAMS);
     }
     $GLOBALS['tid'] = $tid;
     $threadData = $this->_getThread($tid, true);
     if (empty($threadData)) {
         return $this->buildResponse(0);
     }
     $fid = $threadData['fid'];
     $user = $this->getCurrentUser();
     $user->initRight();
     $this->getCustomizedCommonService()->getReadRight($user);
     $GLOBALS['tpc_buy'] = $threadData['buy'];
     $GLOBALS['tpc_author'] = $threadData['author'];
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($fid);
     $foruminfo = $pwforum->foruminfo;
     $forumset = $pwforum->forumset;
     list($windVersion) = explode(',', WIND_VERSION);
     if ($windVersion == '8.0') {
         $threadData = $this->_isMyFavoredForEarly($tid, $threadData);
     } else {
         $threadData = $this->_isMyFavoredForAfter($tid, $threadData);
     }
     $udb = $this->_getUDb($threadData);
     $bandb = $pwforum->forumBan($udb);
     isset($bandb[$threadData['uid']]) && ($threadData['groupid'] = 6);
     $_attachList = array();
     if ($threadData['aid']) {
         $query = $GLOBALS['db']->query('SELECT * FROM pw_attachs WHERE tid=' . pwEscape($tid) . ' AND pid=0');
         while ($rt = $GLOBALS['db']->fetch_array($query)) {
             $_attachList[] = $rt;
         }
     }
     $imgsInContent = $this->getCustomizedCommonService()->parseImgInContent($threadData);
     $threadData['content'] = $this->getCustomizedCommonService()->parsePostContent($threadData);
     $threadData['content'] = $this->getCustomizedCommonService()->clearHtmlTag($threadData['content'], '<br>');
     $threadData['content'] = $this->getCustomizedCommonService()->parseEmotionInContent($threadData['content']);
     $threadData['attachlist'] = $this->getCustomizedCommonService()->getAttachWithThumblist($_attachList);
     $threadData['attachlist'] = array_merge($imgsInContent, $threadData['attachlist']);
     $this->getCustomizedCommonService()->clearAttachSign($_attachList, &$threadData['content']);
     $threadData['icon'] = $this->getCustomizedCommonService()->getUserIcon($threadData['icon']);
     if ($db_hits_store == 0) {
         $GLOBALS['db']->update('UPDATE pw_threads SET hits=hits+1 WHERE tid=' . pwEscape($tid));
     } elseif ($db_hits_store == 1) {
         $GLOBALS['db']->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . pwEscape($tid));
     } elseif ($db_hits_store == 2) {
         if (class_exists("pwCache") && method_exists("pwCache", "writeover")) {
             pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
         } else {
             writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
         }
     }
     return $this->buildResponse(0, $threadData);
 }
Пример #7
0
 /**
  * @param $tag
  * @param $result
  * @return unknown_type
  */
 function writeCache($result)
 {
     $cache = '';
     $cache .= "<?php\r\n";
     $cache .= "\$_result=" . var_export($result, TRUE) . ";\r\n";
     $cache .= "?>\r\n";
     pwCache::setData($this->filepath, $cache);
 }
Пример #8
0
 function _initFileModuleIds($file, $name)
 {
     @chmod($file, 0777);
     $fileString = pwCache::readover($file);
     $moduleConfigService = L::loadClass('moduleconfigservice', 'area');
     $newString = $moduleConfigService->cookModuleIds($fileString, $name);
     pwCache::writeover($file, $newString);
 }
function includefile($file)
{
    list($windVersion) = explode(',', WIND_VERSION);
    if ($windVersion && $windVersion < '8.5') {
        include_once $file;
    } else {
        pwCache::getData($file);
    }
}
Пример #10
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+');
 }
Пример #11
0
 function dblog($msg)
 {
     $msg = str_replace(array("\n", "\r", "<"), array('', '', '&lt;'), $msg);
     if (file_exists(D_P . 'data/bbscache/dblog.php')) {
         pwCache::writeover(D_P . 'data/bbscache/dblog.php', "{$msg}\n", 'ab');
     } else {
         pwCache::writeover(D_P . 'data/bbscache/dblog.php', "<?php die;?>\n{$msg}\n");
     }
 }
Пример #12
0
 function getGroupsCreditset($type)
 {
     global $o_groups_creditset;
     //* include_once pwCache::getPath(D_P.'data/bbscache/o_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/o_config.php', false));
     $creditset = array_filter($creditset[$type], "group_filter");
     $creditset = is_array($creditset) ? $creditset : array();
     return $creditset;
 }
Пример #13
0
 /**
  * 
  * 获取查询结果
  * @param unknown $query 查询结果
  * @return array
  */
 function _cookData($query)
 {
     //* include pwCache::getPath(D_P . 'data/bbscache/topic_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/topic_config.php', false));
     while ($row = $this->_db->fetch_array($query)) {
         $row['modelname'] = $topicmodeldb[$row['modelid']]['name'];
         $posts[] = $row;
     }
     return $posts;
 }
Пример #14
0
 function loadWords()
 {
     if (!is_array($this->fbwords)) {
         //* include pwCache::getPath(D_P."data/bbscache/wordsfb.php");
         extract(pwCache::getData(D_P . "data/bbscache/wordsfb.php", false));
         $this->fbwords = (array) $wordsfb;
         $this->replace = (array) $replace;
         $this->alarm = (array) $alarm;
     }
 }
Пример #15
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?>";
    pwCache::setData(D_P . 'data/bbscache/bg_config.php', $blogdb);
}
Пример #16
0
 /**
  * 获取布局html
  * 
  * @param string $layout 布局名
  * @return string
  */
 function getLayoutString($layout)
 {
     if (!isset($this->layoutStrings[$layout])) {
         if ($layout && file_exists(S::escapePath(A_P . 'data/layout/' . $layout . '/layout.htm'))) {
             //* $this->layoutStrings[$layout] = readover(S::escapePath(A_P.'data/layout/'.$layout.'/layout.htm'));
             $this->layoutStrings[$layout] = pwCache::readover(S::escapePath(A_P . 'data/layout/' . $layout . '/layout.htm'));
         } else {
             $this->layoutStrings[$layout] = '';
         }
     }
     return $this->layoutStrings[$layout];
 }
Пример #17
0
 function generate($rss_path)
 {
     /*modded for YunLiao 1.2: start*/
     /* original -- start*/
     /*
     $all = $this->rssHeader;
     $all .= $this->rssChannel;
     $all .= $this->rssImage;
     $all .= $this->rssItem;
     $all .= "</channel></rss>";
     */
     /* original -- end*/
     $all = $this->getRss();
     /*modded for YunLiao 1.2: end*/
     pwCache::setData($rss_path, $all);
 }
Пример #18
0
 function _getCreditAdd($type)
 {
     if ($type != 'credit') {
         return '';
     }
     //* include pwCache::getPath(D_P . 'data/bbscache/o_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/o_config.php', false));
     $tnum = $o_groups_upgrade['tnum'] ? $o_groups_upgrade['tnum'] : 0;
     $pnum = $o_groups_upgrade['pnum'] ? $o_groups_upgrade['pnum'] : 0;
     $members = $o_groups_upgrade['members'] ? $o_groups_upgrade['members'] : 0;
     $albumnum = $o_groups_upgrade['albumnum'] ? $o_groups_upgrade['albumnum'] : 0;
     $photonum = $o_groups_upgrade['photonum'] ? $o_groups_upgrade['photonum'] : 0;
     $writenum = $o_groups_upgrade['writenum'] ? $o_groups_upgrade['writenum'] : 0;
     $activitynum = $o_groups_upgrade['activitynum'] ? $o_groups_upgrade['activitynum'] : 0;
     return ",(tnum*{$tnum}+pnum*{$pnum}-tnum*{$pnum}+members*{$members}+albumnum*{$albumnum}+photonum*{$photonum}+writenum*{$writenum}+activitynum*{$activitynum}) AS credit";
 }
Пример #19
0
 /**
  * 以某个用户的身份给另一个用户发送短消息
  * @param int $userId 发送者uid
  * @param string $receiver 接受者用户名
  * @param string $subject 标题
  * @param string $content 内容
  * return bool
  */
 function sendMessage($userId, $receiver, $subject, $content)
 {
     global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM;
     $userService = $this->_getUserService();
     $winddb = $userService->get($userId, true, true);
     $winduid = $winddb['uid'];
     $groupid = $winddb['groupid'];
     $windid = $winddb['username'];
     $groupid == '-1' && ($groupid = $winddb['memberid']);
     if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) {
         extract(pwCache::getData(S::escapePath(D_P . "data/groupdb/group_{$groupid}.php", false)));
     } else {
         extract(pwCache::getData(D_P . 'data/groupdb/group_1.php', false));
     }
     M::sendMessage($userId, array($receiver), array('create_uid' => $winduid, 'create_username' => $windid, 'title' => S::escapeChar(stripslashes($subject)), 'content' => S::escapeChar(stripslashes($content))));
     return new ApiResponse(true);
 }
Пример #20
0
 function PwSpace($uid)
 {
     global $db, $winduid, $db_phopen, $db_dopen, $db_groups_open;
     $this->_db =& $db;
     $this->uid = $uid;
     $userService = L::loadClass('UserService', 'user');
     if ($winduid && $winduid == $uid) {
         $this->info = $GLOBALS['winddb'];
         $this->info['isMe'] = 1;
     } elseif ($userdb = $userService->get($this->uid, true, true, true)) {
         //$userdb['rvrc'] /= 10;
         $this->info = $userdb;
     }
     if ($this->info) {
         if (perf::checkMemcache()) {
             $_cacheService = Perf::gatherCache('pw_space');
             $space = $_cacheService->getSpaceByUid($this->uid);
         } else {
             $space = $this->_db->get_one("SELECT * FROM pw_space WHERE uid=" . S::sqlEscape($this->uid));
         }
         if ($space) {
             $this->info = array_merge($this->info, $space);
             if ($this->info['banner']) {
                 list($this->info['banner_s']) = geturl($this->info['banner'], 'lf');
             }
         } else {
             $this->default = true;
         }
         $spaceGroupid = $this->info['groupid'] == -1 ? $this->info['memberid'] : $this->info['groupid'];
         include pwCache::getPath(D_P . "data/groupdb/group_{$spaceGroupid}.php");
         $this->info['generalRight'] = $_G;
         !$this->info['name'] && ($this->info['name'] = $this->info['username'] . '的个人主页');
         !$this->info['skin'] && ($this->info['skin'] = 'default85');
         $GLOBALS['uskin'] =& $this->info['skin'];
     }
     if ($db_dopen) {
         $this->models[] = 'diary';
     }
     if ($db_phopen) {
         $this->models[] = 'photos';
     }
     if ($db_groups_open) {
         $this->models[] = 'colony';
     }
 }
Пример #21
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;
     }
 }
Пример #22
0
 function PW_Appclient()
 {
     global $db_siteappkey, $timestamp, $db_sitehash, $db_siteownerid, $db_siteid, $db_charset, $db_appifopen, $pwServer, $db_server_url, $db_bbsname;
     $db_bbsurl = S::escapeChar("http://" . $pwServer['HTTP_HOST'] . substr($pwServer['PHP_SELF'], 0, strrpos($pwServer['PHP_SELF'], '/')));
     if (!file_exists(D_P . "data/bbscache/forum_appinfo.php")) {
         require_once R_P . "admin/cache.php";
         updatecache_f();
     }
     //* @include_once pwCache::getPath(D_P . "data/bbscache/forum_appinfo.php");
     extract(pwCache::getData(D_P . "data/bbscache/forum_appinfo.php", false));
     $this->_db = $GLOBALS['db'];
     $this->appkey = $db_siteappkey;
     $this->timestamp = $timestamp;
     $this->siteid = $db_siteid;
     $this->siteownerid = $db_siteownerid;
     $this->sitehash = $db_sitehash;
     $this->bbsname = $db_bbsname;
     $this->bbsurl = $db_bbsurl;
     $this->charset = $db_charset;
     $this->appifopen = $db_appifopen;
     $this->server_url = $db_server_url;
     $this->appinfo = $forum_appinfo;
 }
Пример #23
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?>");
}
Пример #24
0
function wap_footer()
{
    global $wind_version, $db_obstart, $windid, $db_charset, $db_wapcharset, $chs, $timestamp, $db_online, $db, $db_wapregist, $rg_allowregister, $online_info, $db_bbsurl;
    Update_ol();
    $userinbbs = $guestinbbs = 0;
    if (empty($db_online)) {
        extract(pwCache::getData(D_P . 'data/bbscache/olcache.php', false));
    } else {
        if (count($online_info = explode("\t", GetCookie('online_info'))) == 3 && $timestamp - $online_info[0] < 60) {
            list(, $userinbbs, $guestinbbs) = $online_info;
        } else {
            $onlineService = L::loadClass('OnlineService', 'user');
            $userinbbs = $onlineService->countOnlineUser();
            $guestinbbs = $onlineService->countOnlineGuest();
            Cookie('online_info', $timestamp . "\t" . $userinbbs . "\t" . $guestinbbs);
        }
    }
    $usertotal = $guestinbbs + $userinbbs;
    $ft_time = get_date($timestamp);
    require_once PrintWAP('footer');
    $output = ob_get_contents();
    ob_end_clean();
    $db_obstart && function_exists('ob_gzhandler') ? ob_start('ob_gzhandler') : ob_start();
    if ($db_charset != 'utf8') {
        L::loadClass('Chinese', 'utility/lang', false);
        $chs = new Chinese();
        $output = $chs->Convert($output, $db_charset, $db_wapcharset ? 'UTF8' : 'UNICODE');
    }
    $output = str_replace(array('<!--<!---->', '<!---->-->', '<!---->', "\r\n\r\n"), '', $output);
    $wap_view = S::getGP('wap_view');
    if ($wap_view) {
        $output = preg_replace('/<a[^>]*>([^<]+|.*?)?<\\/a>/i', "\\1", $output);
    }
    echo $output;
    ob_flush();
    exit;
}
Пример #25
0
function updatecache_i_i($fid, $aidin = null)
{
    global $db, $db_windpost, $timestamp, $forum;
    require_once R_P . 'require/bbscode.php';
    //* include pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
    extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false));
    $sql_where = empty($aidin) ? "fid=" . S::sqlEscape($fid) : "aid IN ({$aidin})";
    $F_ffid = false;
    $aid = $aidcache = 0;
    $aids = '';
    $query = $db->query("SELECT aid,startdate,enddate,content FROM pw_announce WHERE {$sql_where} AND ifopen='1' AND (enddate=0 OR enddate>=" . S::sqlEscape($timestamp) . ") ORDER BY vieworder,startdate DESC");
    while ($rt = $db->fetch_array($query)) {
        if ($rt['startdate'] <= $timestamp) {
            if ($F_ffid) {
                continue;
            } elseif (!$rt['enddate']) {
                $F_ffid = true;
            }
        }
        if (!$aid && $rt['startdate'] <= $timestamp && (!$rt['enddate'] || $rt['enddate'] >= $timestamp)) {
            $aid = $rt['aid'];
            if ($rt['content'] != convert($rt['content'], $db_windpost, 2)) {
                //* $db->update("UPDATE pw_announce SET ifconvert='1' WHERE aid=".S::sqlEscape($aid));
                pwQuery::update('pw_announce', 'aid=:aid', array($aid), array('ifconvert' => 1));
            }
        } else {
            $aids .= ",{$rt['aid']}";
        }
    }
    if ($aids) {
        $aids = substr($aids, 1);
        $aidcache = $timestamp;
    }
    //* $db->update("UPDATE pw_forumdata SET ".S::sqlSingle(array('aid'=>$aid,'aids'=>$aids,'aidcache'=>$aidcache))."WHERE fid=".S::sqlEscape($fid));
    pwQuery::update('pw_forumdata', 'fid=:fid', array($fid), array('aid' => $aid, 'aids' => $aids, 'aidcache' => $aidcache));
}
Пример #26
0
<?php

!function_exists('adminmsg') && exit('Forbidden');
$basename = "{$admin_file}?adminjob=forumsell";
if (empty($action)) {
    require_once R_P . 'require/credit.php';
    //* include_once pwCache::getPath(D_P.'data/bbscache/forumcache.php');
    pwCache::getData(D_P . 'data/bbscache/forumcache.php');
    S::gp(array('username'));
    S::gp(array('page', 'uid', 'fid'), 'GP', 2);
    $sql = "WHERE 1";
    if ($username) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $userdb = $userService->getByUserName($username);
        if (!$userdb) {
            $errorname = $username;
            adminmsg('user_not_exists');
        }
        $uid = $userdb['uid'];
    }
    if ($uid) {
        $sql .= " AND fs.uid=" . S::sqlEscape($uid);
    }
    if ($fid) {
        $sql .= " AND fs.fid=" . S::sqlEscape($fid);
    }
    $page < 1 && ($page = 1);
    $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage);
    $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_forumsell fs {$sql}");
    $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_perpage), "{$basename}&uid={$uid}&fid={$fid}&");
Пример #27
0
function threadrelated($relatedcon)
{
    global $db, $db_iftag, $db_threadrelated, $forumset, $fid, $read, $tid, $db_modes, $db_dopen, $db_phopen, $db_share_open, $db_groups_open, $groupid, $timestamp;
    $relatedb = array();
    if (in_array($relatedcon, array('allpost', 'alldigest', 'allhits', 'allreply', 'forumpost', 'forumdigest', 'forumhits', 'forumreply'))) {
        //require_once(R_P.'require/element.class.php');
        //$element = new Element($forumset['relatednums']);
        $element = L::loadClass('element');
        $element->setDefaultNum($forumset['relatednums']);
        switch ($relatedcon) {
            case 'allpost':
                $relatedb = $element->newSubject();
                break;
            case 'alldigest':
                $relatedb = $element->digestSubject();
                break;
            case 'allhits':
                $relatedb = $element->hitSort();
                break;
            case 'allreply':
                $relatedb = $element->replySort();
                break;
            case 'forumpost':
                $relatedb = $element->newSubject($fid);
                break;
            case 'forumdigest':
                $relatedb = $element->digestSubject($fid);
                break;
            case 'forumhits':
                $relatedb = $element->hitSort($fid);
                break;
            case 'forumreply':
                $relatedb = $element->replySort($fid);
                break;
        }
    } elseif ($relatedcon == 'oinfo') {
        //继续改进
        if ($db_modes['o']['ifopen']) {
            require_once "require/app_core.php";
            $addwhere = '';
            if (!$db_dopen) {
                $addwhere .= " AND type!='diary'";
            }
            if (!$db_phopen) {
                $addwhere .= " AND type!='photo'";
            }
            if (!$db_share_open) {
                $addwhere .= " AND type!='share'";
            }
            if (!$db_groups_open) {
                $addwhere .= " AND type!='colony'";
            }
            $query = $db->query("SELECT type,descrip FROM pw_feed WHERE uid=" . S::sqlEscape($read['authorid']) . $addwhere . " ORDER BY timestamp DESC  " . S::sqlLimit(0, $forumset['relatednums']));
            while ($rt = $db->fetch_array($query)) {
                $rt['title'] = parseFeedRead($rt['descrip']);
                $rt['url'] = USER_URL . "{$read['authorid']}";
                unset($rt['type']);
                $relatedb[] = $rt;
            }
        }
    } elseif (in_array($relatedcon, array('pictags', 'hottags'))) {
        $tagid = $tagdbs = array();
        $endtime = $timestamp - 30 * 24 * 3600;
        $sql = 'WHERE t.ifcheck=1 AND t.tid !=' . S::sqlEscape($tid) . ' AND t.postdate >=' . S::sqlEscape($endtime);
        $fidout = array('0');
        $query = $db->query("SELECT fid,allowvisit,password FROM pw_forums WHERE type<>'category'");
        while ($rt = $db->fetch_array($query)) {
            $allowvisit = !$rt['allowvisit'] || $rt['allowvisit'] != str_replace(",{$groupid},", '', $rt['allowvisit']) ? true : false;
            if ($rt['password'] || !$allowvisit) {
                $fidout[] = $rt['fid'];
            }
        }
        $fidout = S::sqlImplode($fidout);
        $fidout && ($sql .= " AND fid NOT IN ({$fidout})");
        if ($db_iftag) {
            if ($read['tags'] && $relatedcon == 'pictags') {
                list($tagdb, $tpc_tag) = explode("\t", $read['tags']);
                $tagdbs = explode(' ', $tagdb);
            } elseif ($relatedcon == 'hottags') {
                //* @include_once (D_P.'data/bbscache/tagdb.php');
                extract(pwCache::getData(D_P . "data/bbscache/tagdb.php", false));
                $j = 0;
                foreach ($tagdb as $key => $val) {
                    $j++;
                    if ($j > 5) {
                        break;
                    }
                    $tagdbs[] = $key;
                }
                unset($tagdb);
            }
            if ($tagdbs) {
                $query = $db->query("SELECT tagid FROM pw_tags WHERE tagname IN(" . S::sqlImplode($tagdbs) . ')');
                while ($rt = $db->fetch_array($query)) {
                    $tagid[] = $rt['tagid'];
                }
            }
            if ($tagid) {
                $query = $db->query("SELECT t.tid,t.subject FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) {$sql} AND tg.tagid IN(" . S::sqlImplode($tagid) . ") GROUP BY tid ORDER BY postdate DESC " . S::sqlLimit(0, $forumset['relatednums']));
                while ($rt = $db->fetch_array($query)) {
                    $rt['title'] = $rt['subject'];
                    $rt['url'] = "read.php?tid=" . $rt['tid'];
                    unset($rt['subject']);
                    unset($rt['tid']);
                    $relatedb[] = $rt;
                }
            }
        }
    } elseif (in_array($relatedcon, array('ownpost', 'owndigest', 'ownhits', 'ownreply'))) {
        $endtime = $timestamp - 15 * 24 * 3600;
        $sql = "WHERE ifcheck=1 AND tid !=" . S::sqlEscape($tid) . "AND postdate >=" . S::sqlEscape($endtime) . " AND authorid=" . S::sqlEscape($read['authorid']) . " AND fid>0 ";
        $orderby = '';
        switch ($relatedcon) {
            case 'ownpost':
                $orderby .= " ORDER BY postdate DESC";
                break;
            case 'owndigest':
                $sql .= " AND digest>0";
                $orderby .= " ORDER BY postdate DESC";
                break;
            case 'ownhits':
                $orderby .= " ORDER BY hits DESC";
                break;
            case 'ownreply':
                $orderby .= " ORDER BY replies DESC";
                break;
        }
        $query = $db->query("SELECT tid,subject FROM pw_threads FORCE INDEX(" . getForceIndex('idx_postdate') . ") {$sql} {$orderby}" . S::sqlLimit(0, $forumset['relatednums']));
        while ($rt = $db->fetch_array($query)) {
            $rt['title'] = $rt['subject'];
            $rt['url'] = "read.php?tid=" . $rt['tid'];
            unset($rt['subject']);
            unset($rt['tid']);
            $relatedb[] = $rt;
        }
    }
    return $relatedb;
}
Пример #28
0
!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;
exit;
 function countHotTagsNum()
 {
     if (!file_exists($this->_memberTagDbFile)) {
         $this->setTopCache();
     }
     extract(pwCache::getData($this->_memberTagDbFile, false));
     if (!S::isArray($memberTagsData)) {
         return 0;
     }
     return count($memberTagsData);
 }
Пример #30
0
 }
 if ($days < $rt['sright']['selllimit']) {
     Showmsg('special_selllimit');
 }
 $userService = L::loadClass('UserService', 'user');
 /* @var $userService PW_UserService */
 $mb = $userService->get($winduid);
 if ($gid == $groupid || strpos($mb['groups'], ",{$gid},") !== false) {
     Showmsg('specialgroup_noneed');
 }
 if ($buymethod) {
     if ($rt['sright']['rmbprice'] <= 0) {
         Showmsg('undefined_action');
     }
     //* include_once pwCache::getPath(D_P.'data/bbscache/ol_config.php');
     pwCache::getData(D_P . 'data/bbscache/ol_config.php');
     if (!$ol_onlinepay) {
         Showmsg($ol_whycolse);
     }
     $grouptitle = $rt['grouptitle'];
     $order_no = '1' . str_pad($winduid, 10, "0", STR_PAD_LEFT) . get_date($timestamp, 'YmdHis') . num_rand(5);
     $db->update("INSERT INTO pw_clientorder SET " . S::sqlSingle(array('order_no' => $order_no, 'type' => 3, 'uid' => $winduid, 'paycredit' => $gid, 'price' => $rt['sright']['rmbprice'], 'number' => $days, 'date' => $timestamp, 'state' => 0, 'extra_1' => $options)));
     if (!$ol_payto) {
         Showmsg('olpay_alipayerror');
     }
     require_once R_P . 'require/onlinepay.php';
     $olpay = new OnlinePay($ol_payto);
     ObHeader($olpay->alipayurl($order_no, round($rt['sright']['rmbprice'] * $days, 2), 3));
 }
 if (md5($pwpwd) != $mb['password']) {
     Showmsg('password_error');