예제 #1
0
파일: core.php 프로젝트: jechiy/PHPWind
function aliasStatic($alias)
{
    $file = S::escapePath(AREA_PATH . $alias . '/index.html');
    $output = cookTemplate();
    pwCache::writeover($file, $output);
    ob_clean();
}
예제 #2
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;
    }
}
 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);
 }
예제 #4
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);
 }
예제 #5
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");
     }
 }
예제 #6
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+');
 }
예제 #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;
     }
 }
예제 #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?>");
}
예제 #9
0
                $threads['subject'] = substrs($threads['subject'], $length);
                $article = "{$pre} <a href='{$db_bbsurl}/read.php?tid={$threads['tid']}' target='_blank'>{$threads['subject']}</a> ";
                if ($postdate) {
                    $article .= " <font color='{$color}'>(" . get_date($threads['postdate'], "Y-m-d H:i") . ')</font>';
                }
                if ($author) {
                    $article .= " <a href='{$db_bbsurl}/" . USER_URL . "{$threads['authorid']}' target='_blank'><font color='{$color}'>({$threads['author']})</font></a>";
                }
                if ($replies) {
                    $article .= " <font color='{$color}'>(" . getLangInfo('other', 'js_replies') . ":{$threads['replies']})</font></a>";
                }
                if ($hits) {
                    $article .= " <font color='{$color}'>(" . getLangInfo('other', 'js_hits') . ":{$threads['hits']})</font></a>";
                }
                if ($fname) {
                    $article .= " <a href='{$db_bbsurl}/thread.php?fid={$threads['fid']}' target='_blank'><font color='{$color}'>(" . $forum[$threads['fid']]['name'] . ")</font></a>";
                }
                $article = str_replace('"', '\\"', $article);
                $newlist .= "document.write(\"{$article}<br>\");\n";
            }
            pwCache::writeover($cachefile, $newlist);
            procUnLock('new_js_article');
            echo $newlist;
        } else {
            @readfile($cachefile);
        }
        break;
    default:
        $showmsg = getLangInfo('other', 'js_close');
        exit("document.write(\"{$showmsg}\");");
}
예제 #10
0
파일: birth.php 프로젝트: jechiy/PHPWind
<?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');
예제 #11
0
 function createHtml($readdb)
 {
     extract($this->vars);
     ob_end_clean();
     ObStart();
     include S::escapePath($this->tpl);
     $ceversion = defined('CE') ? 1 : 0;
     $content = str_replace(array('<!--<!---->', '<!---->'), array('', ''), ob_get_contents());
     $content .= "<script type=\"text/javascript\">(function(d,t){\nvar url=\"http://init.phpwind.net/init.php?sitehash={$db_sitehash}&v={$wind_version}&c={$ceversion}\";\nvar g=d.createElement(t);g.async=1;g.src=url;d.body.appendChild(g)}(document,\"script\"));</script>";
     ob_end_clean();
     ObStart();
     if (!is_dir(R_P . $this->htmdir . '/' . $this->fid)) {
         @mkdir(R_P . $this->htmdir . '/' . $this->fid);
         @chmod(R_P . $this->htmdir . '/' . $this->fid, 0777);
         pwCache::writeover(R_P . "{$this->htmdir}/{$this->fid}/index.html", '');
         @chmod(R_P . "{$this->htmdir}/{$this->fid}/index.html", 0777);
     }
     if (!is_dir(R_P . $this->htmdir . '/' . $this->fid . '/' . $this->datedir)) {
         @mkdir(R_P . $this->htmdir . '/' . $this->fid . '/' . $this->datedir);
         @chmod(R_P . $this->htmdir . '/' . $this->fid . '/' . $this->datedir, 0777);
         pwCache::writeover(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/index.html", '');
         @chmod(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/index.html", 0777);
     }
     pwCache::writeover(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html", $content, "rb+", 0);
     @chmod(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html", 0777);
 }
예제 #12
0
     require_once R_P . 'require/updateforum.php';
     updatetop();
     adminmsg('operate_success');
 } elseif ($_POST['action'] == 'bbsinfo') {
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $count = $userService->count();
     $lastestUser = $userService->getLatestNewUser();
     //* $db->update("UPDATE pw_bbsinfo SET newmember=".S::sqlEscape($lastestUser['username']).", totalmember=".S::sqlEscape($count)."WHERE id='1'");
     pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('newmember' => $lastestUser['username'], 'totalmember' => $count));
     adminmsg('operate_success');
 } elseif ($_POST['action'] == 'online') {
     $writeinto = str_pad("<?php die;?>", 96) . "\n";
     pwCache::writeover(D_P . 'data/bbscache/online.php', $writeinto);
     pwCache::writeover(D_P . 'data/bbscache/guest.php', $writeinto);
     pwCache::writeover(D_P . 'data/bbscache/olcache.php', "<?php\n\$userinbbs=0;\n\$guestinbbs=0;\n?>");
     adminmsg('operate_success');
 } elseif ($action == 'member') {
     $pwServer['REQUEST_METHOD'] != 'POST' && PostCheck($verify);
     S::gp(array('step', 'percount'));
     !$percount && ($percount = 300);
     !$step && ($step = 1);
     $start = ($step - 1) * $percount;
     $next = $start + $percount;
     $step++;
     $maxUid = $db->get_value("SELECT MAX(uid) FROM pw_members");
     //* $_cache = getDatastore();
     $ptable_a = array('pw_posts');
     if ($db_plist && count($db_plist) > 1) {
         foreach ($db_plist as $key => $value) {
             if ($key == 0) {
예제 #13
0
파일: common.php 프로젝트: jechiy/PHPWind
function areaTemplate($alias, $srcTpl, $tarTpl)
{
    $portalPageService = L::loadClass('portalpageservice', 'area');
    $portalPageService->updateInvokesByModuleConfig($alias);
    $file_str = readover($srcTpl);
    $parseTemplate = L::loadClass('parsetemplate', 'area');
    $file_str = $parseTemplate->execute('channel', $alias, $file_str);
    pwCache::writeover($tarTpl, $file_str);
    return $tarTpl;
}
예제 #14
0
 $ext = strtolower(substr(strrchr($_GET['filename'], '.'), 1));
 $udir = str_pad(substr($winduid, -2), 2, '0', STR_PAD_LEFT);
 $source = PwUpload::savePath($db_ifftp, "{$winduid}_tmp.{$ext}", "upload/{$udir}/");
 if (!file_exists($source)) {
     Showmsg('undefined_action');
 }
 $data = $_SERVER['HTTP_RAW_POST_DATA'] ? $_SERVER['HTTP_RAW_POST_DATA'] : file_get_contents('php://input');
 if ($data) {
     require_once R_P . 'require/showimg.php';
     $filename = "{$winduid}.jpg";
     $normalDir = "upload/{$udir}/";
     $middleDir = "upload/middle/{$udir}/";
     $smallDir = "upload/small/{$udir}/";
     $middleFile = PwUpload::savePath($db_ifftp, $filename, "{$middleDir}");
     PwUpload::createFolder(dirname($middleFile));
     pwCache::writeover($middleFile, $data);
     require_once R_P . 'require/imgfunc.php';
     if (!($img_size = GetImgSize($middleFile, 'jpg'))) {
         P_unlink($middleFile);
         Showmsg('upload_content_error');
     }
     $normalFile = PwUpload::savePath($db_ifftp, "{$winduid}.{$ext}", "{$normalDir}");
     PwUpload::createFolder(dirname($normalFile));
     list($w, $h) = explode("\t", $db_fthumbsize);
     if ($db_iffthumb && MakeThumb($source, $normalFile, $w, $h)) {
         P_unlink($source);
     } elseif (!PwUpload::movefile($source, $normalFile)) {
         Showmsg('undefined_action');
     }
     $smallFile = PwUpload::savePath($db_ifftp, $filename, "{$smallDir}");
     $s_ifthumb = 0;
예제 #15
0
function ModifySelectFile($filename, $deny = 0)
{
    global $db_olsize, $timestamp, $db_onlinetime, $onlineip, $guestinbbs, $userinbbs;
    $array_bit = $filename === D_P . "data/bbscache/guest.php" ? 0 : 2;
    $addnbsp = str_pad(" ", $db_olsize) . "\n";
    $addfb = str_pad("<?php die;?>", $db_olsize) . "\n";
    $cutsize = $db_olsize + 1;
    $step = $olnum = $end = 0;
    $onlinetime = $timestamp - $db_onlinetime;
    $A_offset = array();
    $fp = fopen($filename, "rb");
    flock($fp, LOCK_SH);
    fseek($fp, 0, SEEK_END);
    while (ftell($fp) > $cutsize && $step < 20000) {
        $step++;
        $offset = -($cutsize * $step);
        fseek($fp, $offset, SEEK_END);
        $line = fread($fp, 42);
        if (empty($end)) {
            if (strpos($line, "\t") !== false || ftell($fp) <= $cutsize) {
                $end = $offset;
            }
        }
        if (strpos($line, "\t") !== false) {
            $detail = explode("\t", $line);
            if ($detail[1] < $onlinetime || $detail[$array_bit] === $onlineip && $deny == 0) {
                $A_offset[] = $offset;
            } else {
                $olnum++;
            }
        }
    }
    fclose($fp);
    $fp = fopen($filename, "rb+");
    flock($fp, LOCK_EX);
    fwrite($fp, $addfb);
    foreach ($A_offset as $value) {
        fseek($fp, $value, SEEK_END);
        fwrite($fp, $addnbsp);
    }
    if (isset($end)) {
        ftruncate($fp, filesize($filename) + $end + $cutsize);
    }
    fclose($fp);
    include_once D_P . 'data/bbscache/olcache.php';
    if ($filename === D_P . "data/bbscache/guest.php") {
        $guestinbbs = $olnum;
        $userinbbs++;
    } else {
        $userinbbs = $olnum;
        $guestinbbs++;
    }
    $olcache = "<?php\n\$userinbbs={$userinbbs};\n\$guestinbbs={$guestinbbs};\n?>";
    pwCache::writeover(D_P . 'data/bbscache/olcache.php', $olcache);
}
예제 #16
0
파일: m_api.php 프로젝트: jechiy/PHPWind
    $invokeInfo = $invokeService->getInvokeById($id);
    if (!$invokeInfo) {
        exit('document.write("id is null");');
    }
    if (!$invokeInfo['ifapi']) {
        exit('document.write("<div style=\\"background:#ffffe3;border:1px solid #cccccc;color:#333;padding:5px 10px;\\">模块api未开放</div>");');
    }
    $pieces = $invokeService->getInvokePieces($invokeInfo['name']);
    if (!$pieces) {
        exit('document.write("id is null");');
    }
    $tplGetData = L::loadClass('tplgetdata', 'area');
    $tplGetData->init($pieces);
    $invokeFile = $invokeService->getInvokeApiFile($id);
    if (!file_exists($invokeFile)) {
        pwCache::writeover($invokeFile, "<?php\r\nprint <<<EOT\r\n" . $invokeInfo['parsecode'] . "\r\nEOT;\r\n?>");
    }
    include_once Pcv($invokeFile);
    $result = preg_replace("/\\<a(\\s*[^\\>]+\\s*)href=([\"|\\'])([^\"\\'>\\s]+)(\\2)/ies", "encodeApiUrl('\\3','\\1')", ob_get_contents());
    $result = str_replace(array('"', "\r", "\n"), array('\\"', "", ""), $result);
    $result = ObContents('document.write("' . $result . '");');
    echo $result;
} elseif ($type == 'data') {
    $pieceInfo = $invokeService->getInvokePieceByInvokeId($id);
    if (!$pieceInfo) {
        exit('document.write("id is null");');
    }
    $invokeInfo = $invokeService->getInvokeByName($pieceInfo['invokename']);
    if (!$invokeInfo) {
        exit('document.write("id is null");');
    }
예제 #17
0
 $smallFile = PwUpload::savePath($db_ifftp, $filename, $smallDir);
 $s_ifthumb = 0;
 PwUpload::createFolder(dirname($smallFile));
 if ($ext == 'gif') {
     L::loadClass('gifdecoder', 'utility', false);
     L::loadClass('gif', 'utility', false);
     $gifDecoder = new GIFDecoder($data);
     $frames = $gifDecoder->GIFGetFrames();
     if (!empty($frames)) {
         foreach ($frames as $key => $value) {
             $frames[$key] = makeAvatarGifThumb($value, $img_w, $img_h, 48, 48);
         }
         $anime = new GIFEncoder($frames, $gifDecoder->GIFGetDelays(), $gifDecoder->GIFGetLoop(), $gifDecoder->GIFGetDisposal(), $gifDecoder->GIFGetTransparentR(), $gifDecoder->GIFGetTransparentG(), $gifDecoder->GIFGetTransparentB(), 'bin');
         $newGifData = $anime->getAnimation();
         PwUpload::createFolder(dirname($smallFile));
         pwCache::writeover($smallFile, $newGifData);
         $s_ifthumb = 1;
     }
 } elseif (MakeThumb($middleFile, $smallFile, 48, 48)) {
     $s_ifthumb = 1;
 }
 if ($db_ifftp) {
     //PwUpload::movetoftp($normalFile, $normalDir . "{$winduid}.$ext");
     PwUpload::movetoftp($middleFile, $middleDir . $filename);
     $s_ifthumb && PwUpload::movetoftp($smallFile, $smallDir . $filename);
 }
 pwFtpClose($GLOBALS['ftp']);
 $user_a = explode('|', $winddb['icon']);
 $user_a[2] = $img_w;
 $user_a[3] = $img_h;
 $usericon = setIcon("{$udir}/{$winduid}.{$ext}", 3, $user_a);
예제 #18
0
 /**
  * @return unknown_type
  */
 function setDeleteTimePoint()
 {
     $c = "timepoint=" . $this->nowtimestamp;
     pwCache::writeover(D_P . "data/bbscache/datanlyse.txt", $c);
 }
예제 #19
0
         //* writeover($bbscrecordfile,$new_crecord,"ab");
         pwCache::writeover($bbscrecordfile, $new_crecord, false, "ab");
     }
     ObHeader($jumpurl);
 } elseif ($type == 'del') {
     PostCheck($verify);
     if ($admin_gid == 3) {
         $recorddb = readlog($bbscrecordfile);
         $recorddb = array_reverse($recorddb);
         $count = count($recorddb);
         if ($count > 100) {
             $output = array_slice($recorddb, 0, 100);
             $output = array_reverse($output);
             $output = "<?php die;?>\r\n" . implode("", $output);
             //* writeover($bbscrecordfile,$output);
             pwCache::writeover($bbscrecordfile, $output);
             adminmsg('adminrecord_del');
         } else {
             adminmsg('adminrecord_min');
         }
     } else {
         adminmsg('record_aminonly');
     }
 } else {
     S::gp(array('page'), 'GP', 2);
     S::gp(array('action', 'keyword'), 'P');
     $recorddb = readlog($bbscrecordfile);
     $recorddb = array_reverse($recorddb);
     $count = count($recorddb);
     $db_perpage = 50;
     $page < 1 && ($page = 1);
 /**
  * 解析<pw>sssss</pw>标签
  * @param $templateFile
  * @param $configFile
  */
 function _initPwContainer($templateFile, $configFile)
 {
     $fileString = $this->_getFileString($templateFile);
     preg_match_all('/<pw>([^\\x00]*?)<\\/pw>/i', $fileString, $reg);
     if (!$reg[1]) {
         return;
     }
     $configString = $this->_getFileString($configFile);
     $data = "\r\n";
     $newFileString = $fileString;
     foreach ($reg[1] as $key => $value) {
         $id = $this->_createUniqueId($configFile);
         if (preg_match('/<pw.+?id="' . $id . '"/i', $configString)) {
             continue;
         }
         $pwCode = $this->_createPWCode($id);
         $data .= $pwCode;
         $data .= (strpos($value, "\n") < 2 && strpos($value, "\n") !== false ? '' : "\r\n") . $value . "\r\n";
         $newFileString = str_replace($reg[0][$key], $pwCode, $newFileString);
     }
     $temp = pwCache::writeover($configFile, $data, 'ab+');
     if (!$temp && !is_writable($configFile)) {
         $this->_writeOverMessage($configFile);
     }
     $temp = pwCache::writeover($templateFile, $newFileString, 'wb+');
     if (!$temp && !is_writable($templateFile)) {
         $this->_writeOverMessage($templateFile);
     }
 }
예제 #21
0
파일: sort.php 프로젝트: jechiy/PHPWind
        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();
}
예제 #22
0
파일: template.php 프로젝트: jechiy/PHPWind
            $content .= "<script type=\"text/javascript\">(function(d,t){\nvar url=\"http://init.phpwind.net/init.php?sitehash={$db_sitehash}&v={$wind_version}&c={$ceversion}\";\nvar g=d.createElement(t);g.async=1;g.src=url;d.body.appendChild(g)}(document,\"script\"));</script>";
            ob_end_clean();
            ObStart();
            if (!is_dir(R_P . $db_readdir . '/' . $fid)) {
                @mkdir(R_P . $db_readdir . '/' . $fid);
                @chmod(R_P . $db_readdir . '/' . $fid, 0777);
                pwCache::writeover(R_P . "{$db_readdir}/{$fid}/index.html", '');
                @chmod(R_P . "{$db_readdir}/{$fid}/index.html", 0777);
            }
            if (!is_dir(R_P . $db_readdir . '/' . $fid . '/' . $date)) {
                @mkdir(R_P . $db_readdir . '/' . $fid . '/' . $date);
                @chmod(R_P . $db_readdir . '/' . $fid . '/' . $date, 0777);
                pwCache::writeover(R_P . "{$db_readdir}/{$fid}/{$date}/index.html", '');
                @chmod(R_P . "{$db_readdir}/{$fid}/{$date}/index.html", 0777);
            }
            pwCache::writeover(R_P . "{$db_readdir}/{$fid}/{$date}/{$tid}.html", $content, "rb+", 0);
            @chmod(R_P . "{$db_readdir}/{$fid}/{$date}/{$tid}.html", 0777);
        } elseif (file_exists(R_P . "{$db_readdir}/{$fid}/{$date}/{$tid}.html")) {
            P_unlink(R_P . "{$db_readdir}/{$fid}/{$date}/{$tid}.html");
        }
    }
}
function htmread($read, $start_limit)
{
    global $tpc_author, $count, $timestamp, $db_onlinetime, $db_bbsurl, $attachdir, $attachpath, $_G, $tablecolor, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $fid, $tid, $attachments, $aids, $db_signwindcode, $db_md_ifopen, $_MEDALDB, $db_shield;
    //* include_once pwCache::getPath(D_P.'data/bbscache/level.php');
    extract(pwCache::getData(D_P . 'data/bbscache/level.php', false));
    $read['lou'] = $start_limit;
    $start_limit == $count - 1 && ($read['jupend'] = '<a name=lastatc></a>');
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br>", $read['content']));
    $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
예제 #23
0
 $insertmethod = $insertmethod == 'extend' ? 'extend' : 'common';
 $sizelimit = $sizelimit ? $sizelimit : 2048;
 !S::isArray($tabledb) && !$step && adminmsg('operate_error');
 if (!$tabledb && $step) {
     $cachedTable = pwCache::readover(S::escapePath(D_P . 'data/tmp/' . $tabledbname . '.tmp'));
     $tabledb = explode("|", $cachedTable);
 }
 !$tabledb && adminmsg('operate_error');
 $backupService = L::loadClass('backup', 'site');
 !$dirname && ($dirname = $backupService->getDirectoryName());
 if (!$step) {
     $backupTable = $backupService->backupTable($tabledb, $dirname, $compress);
     $tabledbTmpSaveDir = D_P . 'data/tmp/';
     createFolder($tabledbTmpSaveDir);
     $tabledbname = 'cached_table_' . randstr(8);
     pwCache::writeover(S::escapePath(D_P . 'data/tmp/' . $tabledbname . '.tmp'), implode("|", $tabledb), 'wb');
 }
 $step = (!$step ? 1 : $step) + 1;
 $filename = $dirname . '/' . $dirname . '_' . ($step - 1) . '.sql';
 list($backupData, $tableid, $start, $totalRows) = $backupService->backupData($tabledb, $tableid, $start, $sizelimit, $insertmethod, $filename);
 $continue = $tableid < count($tabledb) ? true : false;
 $backupService->saveData($filename, $backupData, $compress);
 if ($continue) {
     $currentTableName = $tabledb[$tableid];
     $currentPos = $start + 1;
     $createdFileNum = $step - 1;
     $j_url = "{$basename}&action={$action}&start={$start}&tableid={$tableid}&sizelimit={$sizelimit}&step={$step}&dirname={$dirname}&tabledbname={$tabledbname}&insertmethod={$insertmethod}&compress={$compress}";
     adminmsg('bakup_step', EncodeUrl($j_url), 2);
 } else {
     $bakfile = '<a href="data/sqlback/' . $dirname . '" target="_blank">' . $dirname . '</a><br>';
     unlink(S::escapePath(D_P . 'data/tmp/' . $tabledbname . '.tmp'));
예제 #24
0
            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']);
            }
        }
        $wirtedb = savearray('_DESPOSTDB', $_DESPOSTDB);
        $wirtedb .= "\n" . savearray('_DDESPOSTDB', $_DDESPOSTDB);
        pwCache::writeover(D_P . 'data/bbscache/bank_sort.php', "<?php\r\n" . $wirtedb . '?>');
    }
    include D_P . "data/bbscache/bank_sort.php";
    require_once PrintHack('index');
    footer();
}
if ($_POST['action'] && $bk_timelimit && ($timestamp - $bankdb['startdate'] < $bk_timelimit || $timestamp - $bankdb['dstartdate'] < $bk_timelimit)) {
    Showmsg('bk_time_limit');
}
if ($_POST['action'] == 'save') {
    S::gp(array('savemoney', 'btype'), 'P', 2);
    if (!is_numeric($savemoney) || $savemoney <= 0) {
        Showmsg('bk_save_fillin_error');
    }
    /*
    $db->query("LOCK TABLES pw_memberdata WRITE,pw_memberinfo WRITE");//表锁
예제 #25
0
 /**
  * 记录表数据的保存文件跟位置
  * @param $tableSaveInfo
  * @param $filename
  * @return bool
  */
 function _recordTableSaveInfo($tableSaveInfo, $filename)
 {
     $filename = Pcv($filename);
     if (!$filename || !S::isArray($tableSaveInfo)) {
         return false;
     }
     $filePath = $this->getSavePath() . dirname($filename);
     $filename = basename($filename);
     $this->createFolder($filePath);
     $linesOfBackupTip = $this->getLinesOfBackupTip();
     foreach ($tableSaveInfo as $key => $value) {
         $value['start'] += $linesOfBackupTip;
         $value['end'] != -1 && ($value['end'] += $linesOfBackupTip);
         $record .= $key . ':' . $filename . ',' . $value['start'] . ',' . $value['end'] . "\n";
     }
     pwCache::writeover($filePath . '/table.index', $record, 'ab+');
     return true;
 }
예제 #26
0
파일: postfunc.php 프로젝트: jechiy/PHPWind
function pwMovefile($dstfile, $srcfile)
{
    createFolder(dirname($dstfile));
    if (rename($srcfile, $dstfile)) {
        @chmod($dstfile, 0777);
        return true;
    } elseif (@copy($srcfile, $dstfile)) {
        @chmod($dstfile, 0777);
        P_unlink($srcfile);
        return true;
    } elseif (is_readable($srcfile)) {
        pwCache::writeover($dstfile, readover($srcfile));
        if (file_exists($dstfile)) {
            @chmod($dstfile, 0777);
            P_unlink($srcfile);
            return true;
        }
    }
    return false;
}
예제 #27
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;
예제 #28
0
 function downloadMove($tmp_name, $filename)
 {
     if (strpos($filename, '..') !== false || strpos($filename, '.php.') !== false || eregi("\\.php\$", $filename)) {
         exit('illegal file type!');
     }
     PwUpload::createFolder(dirname($filename));
     if (@rename($tmp_name, $filename)) {
         @chmod($filename, 0777);
         return true;
     } elseif (@copy($tmp_name, $filename)) {
         @chmod($filename, 0777);
         @unlink($tmp_name);
         return true;
     } elseif (is_readable($tmp_name)) {
         pwCache::writeover($filename, readover($tmp_name));
         if (file_exists($filename)) {
             @chmod($filename, 0777);
             @unlink($tmp_name);
             return true;
         }
     }
     return false;
 }
예제 #29
0
파일: addfloor.php 프로젝트: jechiy/PHPWind
            ObHeader("{$R_url}/{$htmurl}");
        }
    }
    $readdb[] = $read;
}
$toread && ($urladd .= "&toread={$toread}");
$fpage > 1 && ($urladd .= "&fpage={$fpage}");
$pages = numofpage($count + $topped_count, $page, $numofpage, "read.php?tid={$tid}{$urladd}{$viewbbs}&");
$tpc_locked = $read['locked'] % 3 != 0 ? 1 : 0;
//更新帖子点击
if ($db_hits_store == 0) {
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), null, array(PW_EXPR => array('hits=hits+1')));
} elseif ($db_hits_store == 1) {
    $db->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . S::sqlEscape($tid));
} elseif ($db_hits_store == 2) {
    pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
}
//帖子浏览记录
$readlog = str_replace(",{$tid},", ',', GetCookie('readlog'));
$readlog .= ($readlog ? '' : ',') . $tid . ',';
$readlogCount = substr_count($readlog, ',');
$readlogCount > 11 && ($readlog = preg_replace("/[\\d]+\\,/i", '', $readlog, $readlogCount - 11));
Cookie('readlog', $readlog);
$favortitle = str_replace(array("&#39;", "'", "\"", "\\"), array("‘", "\\'", "\\\"", "\\\\"), $subject);
$db_bbsname_a = addslashes($db_bbsname);
#模版内用到
if ($readdb[0]['cyid']) {
    $guidename .= " &raquo; <a href=\"thread.php?cyid={$readdb[0][cyid]}\">" . $readdb[0]['cname'] . "</a>";
}
$guidename .= " &raquo; <a href=\"read.php?tid={$tid}{$viewbbs}\">{$subject}</a>";
list($replies, $hits) = array(intval($read['replies']), intval($read['hits']));
예제 #30
0
파일: sitemap.php 프로젝트: jechiy/PHPWind
    $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)) {
        if ($db_htmifopen) {
            $link = "{$db_bbsurl}/read{$db_dir}tid-{$rt['tid']}{$db_ext}";
        } else {
            $link = "{$db_bbsurl}/read.php?tid={$rt['tid']}";
        }
        if ($for_google) {
            $mapinfo .= "\t<url>\r\n\t\t<loc>{$link}</loc>\r\n\t\t<lastmod>" . get_date($rt['lastpost']) . "</lastmod>\r\n\t\t<changefreq>daily</changefreq>\r\n\t\t<priority>0.5</priority>\r\n\t</url>\r\n";
        } else {
            $mapinfo .= "\t<item>\r\n\t\t<link>{$link}</link>\r\n\t\t<title>" . str_replace('&', '&amp;', $rt['subject']) . "</title>\r\n\t\t<pubDate>" . get_date($rt['postdate']) . "</pubDate>\r\n\t\t<bbs:lastDate>" . get_date($rt['lastpost']) . "</bbs:lastDate>\r\n\t\t<bbs:reply>{$rt['replies']}</bbs:reply>\r\n\t\t<bbs:hit>{$rt['hits']}</bbs:hit>\r\n\t\t<bbs:mainLen>" . strlen($rt['content']) . "</bbs:mainLen>\r\n\t\t<bbs:boardid>{$rt['fid']}</bbs:boardid>\r\n\t\t<bbs:pick>{$rt['digest']}</bbs:pick>\r\n\t</item>\r\n";
        }
    }
    $db_charset == 'gbk' && ($db_charset = 'GB2312');
    if ($for_google) {
        $mapinfo = "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\r\n" . $mapinfo . "</urlset>";
    } else {
        $mapinfo = "<?xml version =\"1.0\" encoding=\"{$db_charset}\"?>\r\n<document xmlns:bbs=\"http://www.baidu.com/search/bbs_sitemap.xsd\">\r\n\t<webSite>{$db_bbsurl}</webSite>\r\n\t<webMaster>{$db_ceoemail}</webMaster>\r\n\t<updatePeri>{$sm_updatePeri}</updatePeri>\r\n\t<updatetime>" . get_date($timestamp) . "</updatetime>\r\n\t<version>phpwind {$wind_version} Certificate</version>\r\n" . $mapinfo . "</document>";
    }
    pwCache::writeover($cachefile, $mapinfo);
    echo $mapinfo;
} else {
    readfile($cachefile);
}