function aliasStatic($alias) { $file = S::escapePath(AREA_PATH . $alias . '/index.html'); $output = cookTemplate(); pwCache::writeover($file, $output); ob_clean(); }
/** * 获取扩展搜索的HTML模板路径 * @param $direcotry 扩展服务的目录,正常当前为 dirname(__FILE__)或其它自定义目录 * @param $htmlname 扩展搜索服务HTML模板名称 */ function _getHtmlFile($direcotry, $htmlname) { $filePath = S::escapePath($direcotry . '/template/' . $htmlname); if (!is_file($filePath)) { return ''; } return $filePath; }
function getThemeConfigFile($theme) { $filedir = S::escapePath($this->config['dir'] . '/' . $theme . '/' . $this->config['configfile']); if (file_exists($filedir)) { return $filedir; } return false; }
/** * 设置语音文件路径 * @param $audioPath 路径 * @return bool true-成功, false-失败 */ function setAudioPath($audioPath) { if (empty($audioPath)) { return false; } $this->_audioPath = S::escapePath($audioPath); return true; }
function init($db_modes, $group = array(), $system = array()) { foreach ($db_modes as $key => $value) { $levelFile = S::escapePath(R_P . 'mode/' . $key . '/config/level.php'); if (!file_exists($levelFile)) { continue; } $level = (include $levelFile); $this->_cookLevel($key, $level, $group, $system); } }
/** * 设置$errorMessage初始值 * @param array $errorMessage * @access protected * @return bool|FieldCheck 遇错返回false */ function _presetErrorMessage() { require_once S::escapePath(GetLang('fielderror')); $errorMessage = $lang['fielderror']; if ($errorMessage) { $this->_setErrorMessage($errorMessage); return $this; } else { return false; } }
function findByTypeId($typeId) { $data = array(); if (file_exists($this->_getCacheKey())) { include S::escapePath($this->_getCacheKey()); } else { $data = $this->findByTypeIdWithoutCache($typeId); pwCache::setData($this->_getCacheKey(), '<?php $data = ' . var_export($data, true) . ';'); } return $data; }
function getDelfileFactory($type) { if ($type == 'active') { return new activeMutiDelfile(); } if ($type && file_exists(R_P . "require/extents/attach/{$type}MutiDelfile.class.php")) { $class = $type . 'MutiDelfile'; require_once S::escapePath(R_P . "require/extents/attach/{$type}MutiDelfile.class.php"); return new $class(); } return new threadMutiDelfile(); }
/** * 获取布局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]; }
function FileArray($hackdir, $base = 'hack') { if (!in_array($base, array('hack', 'mode'))) { $base = 'hack'; } if (function_exists('file_get_contents')) { $filedata = @file_get_contents(S::escapePath(R_P . "{$base}/{$hackdir}/sql.txt")); } else { $filedata = readover(R_P . "{$base}/{$hackdir}/sql.txt"); } $filedata = preg_replace("/;(\r\n|\n)/is", ";[pw]", $filedata); $filedata = trim(str_replace(array("\t", "\r", "\n"), array('', '', ''), $filedata)); $sqlarray = $filedata ? explode("[pw]", $filedata) : array(); return $sqlarray; }
function initRight() { global $gp_gptype, $SYSTEM; if (!is_null($this->_G)) { return; } if ($this->groupid == 'guest') { require D_P . 'data/groupdb/group_2.php'; } elseif (file_exists(D_P . "data/groupdb/group_{$this->groupid}.php")) { require S::escapePath(D_P . "data/groupdb/group_{$this->groupid}.php"); } else { require D_P . 'data/groupdb/group_1.php'; } $this->_G = $_G; $this->_SYSTEM = $SYSTEM; $this->_gp_gptype = $gp_gptype; }
/** * 以某个用户的身份给另一个用户发送短消息 * @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); }
function getAttModifyFactory($type, $aid) { if ($type == 'active') { L::loadClass('activeupload', 'upload', false); return new ActiveModify($aid); } if ($type == 'cms') { require_once R_P . 'mode/cms/lib/upload/articleupload.class.php'; return new ArticleModify($aid); } if ($type && file_exists(R_P . "require/extents/attach/{$type}modify.class.php")) { $class = $type . 'Modify'; require_once S::escapePath(R_P . "require/extents/attach/{$type}modify.class.php"); return new $class($aid); } L::loadClass('AttModify', 'upload', false); return new AttModify($aid); }
function run($configs) { list($controller, $action, $viewerPath, $className, $actionName, $path) = $this->init($configs); if (!is_file($path)) { Error::showError("路径不存在" . $path); } require_once S::escapePath($path); if (!class_exists($className, true)) { Error::showError("类名不存在" . $className); } $obj = new $className(); if ($action && !is_callable(array($obj, $action))) { Error::showError("方法名不存在" . $action); } if (in_array($action, array($className, "execute", "__construct", "init", "before", "after"))) { Error::showError("方法调用有误" . $className); } $obj->execute($controller, $action, $viewerPath); }
function deleteDir($dir) { $dir = S::escapePath($dir); while (!rmdir($dir)) { if (is_dir($dir)) { if ($dp = opendir($dir)) { while (($file = readdir($dp)) != false) { if (is_dir($dir . '/' . $file) && $file != '.' && $file != '..') { PW_FileOperate::deleteDir($dir . '/' . $file); } else { if ($file != '.' && $file != '..') { P_unlink($dir . '/' . $file); } } } closedir($dp); } else { return false; } } } }
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?>"); }
function isUserBanned($uid) { $uid = intval($uid); if ($uid < 1) { return $this->buildResponse(PERMISSIONS_INVALID_PARAMS); } $userService = L::loadClass('UserService', 'user'); $userInfo = $userService->get($uid); if (!S::isArray($userInfo)) { return $this->buildResponse(PERMISSIONS_USER_NOT_EXISTS); } $groupId = $userInfo['groupid'] == -1 ? $userInfo['memberid'] : $userInfo['groupid']; $_G = array(); if (file_exists(D_P . "data/groupdb/group_{$groupId}.php")) { require S::escapePath(D_P . "data/groupdb/group_{$groupId}.php"); } else { require D_P . 'data/groupdb/group_1.php'; } $code = 0; if ($groupId == 6 || getstatus($userInfo['userstatus'], PW_USERSTATUS_BANUSER) || !$_G['allowpost']) { $code = 500; } return $this->buildResponse($code); }
<?php !defined('P_W') && exit('Forbidden'); define("H_R", R_P . "hack/rate/"); define("L_R", R_P . "lib/rate/"); S::gp(array('ajax')); $action = strtolower($job ? $job : "admin"); $filepath = H_R . "action/" . $action . "Action.php"; !file_exists($filepath) && exit; if ($job != "ajax") { require H_R . '/template/layout.php'; } else { require_once S::escapePath($filepath); }
} if (!$tooldb) { Showmsg('no_tool'); } require_once uTemplate::PrintEot('profile_toolcenter'); pwOutPut(); } $tooldb = $db->get_one("SELECT u.nums,t.name,t.filename,t.state,t.type,t.conditions FROM pw_usertool u LEFT JOIN pw_tools t ON t.id=u.toolid WHERE u.uid=" . S::sqlEscape($winduid) . "AND u.toolid=" . S::sqlEscape($toolid)); !$db_toolifopen && Showmsg('toolcenter_close'); if (!$tooldb || $tooldb['nums'] <= 0) { Showmsg('nothistool'); } if ($tooldb['type'] == 1) { !$tid && Showmsg('illegal_tid'); $condition = unserialize($tooldb['conditions']); $tpcdb = $db->get_one("SELECT fid,subject,authorid,topped,toolfield FROM pw_threads WHERE tid=" . S::sqlEscape($tid)); if (!$tpcdb) { Showmsg('illegal_tid'); } if ($condition['forum'] && strpos($condition['forum'], ",{$tpcdb['fid']},") === false) { Showmsg('tool_forumlimit'); } } require_once R_P . 'require/tool.php'; CheckUserTool($winduid, $tooldb); if (file_exists(R_P . 'u/require/profile/toolcenter/' . $tooldb['filename'] . '.php')) { require_once S::escapePath(R_P . 'u/require/profile/toolcenter/' . $tooldb['filename'] . '.php'); } else { Showmsg('tooluse_not_finished'); } }
<?php define('PRO', '1'); define('SCR', 'profile'); require_once 'global.php'; !$winduid && Showmsg('not_login'); S::gp(array('action')); require_once R_P . 'require/showimg.php'; //list($faceurl) = showfacedesign($winddb['icon'],1,'s'); //导航 $homenavigation = array(); $navConfigService = L::loadClass('navconfig', 'site'); $homenavigation = $navConfigService->userHomeNavigation(PW_NAV_TYPE_MAIN, 'o'); empty($action) && ($action = 'modify'); $pro_tab = $action; $USCR = 'set_profile'; $db_menuinit .= ",'td_userinfomore' : 'menu_userinfomore'"; if (file_exists(R_P . "u/require/profile/{$action}.php")) { require_once R_P . 'u/require/core.php'; require_once R_P . 'u/lib/space.class.php'; $newSpace = new PwSpace($winduid); $space =& $newSpace->getInfo(); //* include_once pwCache::getPath(D_P . 'data/bbscache/o_config.php'); pwCache::getData(D_P . 'data/bbscache/o_config.php'); require_once S::escapePath(R_P . "u/require/profile/{$action}.php"); } else { Showmsg('undefined_action'); } exit;
function getPath($alias) { return S::escapePath(PORTAL_PATH . $alias); }
function loadJob($name) { static $classes = array(); $name = strtolower($name); $filename = R_P . "lib/job/job/" . $name . ".job.php"; if (!is_file($filename)) { return null; } $class = 'JOB_' . ucfirst($name); if (isset($classes[$class])) { return $classes[$class]; } include S::escapePath($filename); $classes[$class] = new $class(); return $classes[$class]; }
$stasticsService = L::loadClass('Statistics', 'datanalyse'); $stasticsService->updateOnlineInfo(); } $usertotal = $guestinbbs + $userinbbs; if ($db_indexonline) { S::gp(array('online')); empty($online) && ($online = GetCookie('online')); if ($online == 'yes') { if ($usertotal > 2000 && !S::inArray($windid, $manager)) { //$online = 'no'; Cookie('online', 'no'); } else { $index_whosonline = ''; $db_online = intval($db_online); Cookie('online', $online); include_once S::escapePath(R_P . "require/online_{$db_online}.php"); } } if ($online == 'no') { Cookie('online', 'no'); } } $showgroup = $db_showgroup ? explode(',', $db_showgroup) : array(); // Share union if ($db_indexmqshare && $sharelink[1]) { $sharelink[1] = "<marquee scrolldelay=\"100\" scrollamount=\"4\" onmouseout=\"if (document.all!=null){this.start()}\" onmouseover=\"if (document.all!=null){this.stop()}\" behavior=\"alternate\">{$sharelink['1']}</marquee>"; } if ($db_hostweb == 1 && $updateDaily && $tdtcontrol < $tdtime && !defined('M_P')) { require_once R_P . 'require/updateforum.php'; updateshortcut(); pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('yposts' => $tposts, 'tdtcontrol' => $tdtime, 'o_tpost' => 0));
function getChannelPath($alias) { return S::escapePath(AREA_PATH . $alias); }
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); }
<?php define('SCR', 'jobcenter'); require_once 'global.php'; !$winduid && Showmsg('not_login'); S::gp(array("action")); if (!$db_job_isopen && $action != 'punch') { Showmsg('抱歉,用户任务系统还没有开启'); } $USCR = 'set_jobcenter'; //导航 $homenavigation = array(); $navConfigService = L::loadClass('navconfig', 'site'); $homenavigation = $navConfigService->userHomeNavigation(PW_NAV_TYPE_MAIN, 'o'); if (file_exists(R_P . "u/require/jobcenter/jobcenter.php")) { require_once R_P . 'u/require/core.php'; require_once R_P . 'u/lib/space.class.php'; $newSpace = new PwSpace($winduid); $space =& $newSpace->getInfo(); //* include_once pwCache::getPath(D_P . 'data/bbscache/o_config.php'); pwCache::getData(D_P . 'data/bbscache/o_config.php'); require_once S::escapePath(R_P . "u/require/jobcenter/jobcenter.php"); } else { Showmsg('undefined_action'); } exit;
function getFileCache() { if (!$this->_cache) { return array(); } //* @include_once pwCache::getPath ( S::escapePath ( $this->getCacheFileName () ), true ); extract(pwCache::getData(S::escapePath($this->getCacheFileName()), false)); $jobLists = $jobLists ? $jobLists : $GLOBALS['jobLists']; if ($jobLists) { return $jobLists; } return $this->setFileCache(); }
<base id="headbase" href="{$db_bbsurl}/" /> <!-- EOT; if (SCR == 'read' && $link_ref_canonical) { print <<<EOT --> <link rel="canonical" href="{$link_ref_canonical}" /> <!-- EOT; } print <<<EOT --> <link rel="stylesheet" type="text/css" href="{$imgpath}/wind-reset.css" /> <!-- EOT; @(include S::escapePath($css_path)); if ($pwModeCss) { print <<<EOT --> <style> #html{background:#fff;} body{background:#fff;} </style> <link rel="stylesheet" type="text/css" href="{$pwModeCss}" /> <!-- EOT; } print <<<EOT --> <script type="text/javascript" src="js/core/core.js"></script> <script type="text/javascript" src="js/pw_ajax.js"></script>
function getVarsByFilePath($filePath) { include S::escapePath($filePath); unset($filePath); return get_defined_vars(); }
function _getBaseDB() { require_once S::escapePath(dirname(__FILE__) . "/base/basedb.php"); return new BaseDB(); }