include_once JIEQI_ROOT_PATH . '/include/checker.php'; $checker = new JieqiChecker(); $matchwords1 = $checker->deny_words($_POST['chaptername'], $jieqiConfigs['system']['postdenywords'], true); $matchwords2 = $checker->deny_words($_POST['chaptercontent'], $jieqiConfigs['system']['postdenywords'], true); if (is_array($matchwords1) || is_array($matchwords2)) { if (!isset($jieqiLang['system']['post'])) { jieqi_loadlang('post', 'system'); } $matchwords = array(); if (is_array($matchwords1)) { $matchwords = array_merge($matchwords, $matchwords1); } if (is_array($matchwords2)) { $matchwords = array_merge($matchwords, $matchwords2); } $errtext .= sprintf($jieqiLang['system']['post_words_deny'], implode(' ', jieqi_funtoarray('htmlspecialchars', $matchwords))); } } //检查附件 $attachary = array(); $infoary = array(); $attachnum = 0; $attachinfo = ''; //检查上传文件 if ($canupload && is_numeric($jieqiConfigs['article']['maxattachnum']) && $jieqiConfigs['article']['maxattachnum'] > 0 && isset($_FILES['attachfile'])) { $maxfilenum = intval($jieqiConfigs['article']['maxattachnum']); $typeary = explode(' ', trim($jieqiConfigs['article']['attachtype'])); foreach ($_FILES['attachfile']['name'] as $k => $v) { if (!empty($v)) { $tmpary = explode('.', $v); $tmpint = count($tmpary) - 1;
/** * 发帖提交后的内容校验 * * $post_set 相关参数: * 'module' - 程序所属模块名 * 'ownerid' - 论坛或所有者ID * 'topicid' - 主题ID * 'postid' - 帖子ID * 'posttime' - 发帖时间 * 'title' - 标题在$_POST里面的键名 * 'content' - 内容在$_POST里面的键名 * 'checkcode' - 验证码 * 'attachment' - 附件信息,附件数组serialize后的字符串 * 'emptytitle' - bool类型,主题贴是都允许不填主题,false-不允许,true-允许 * 'isnew' - bool类型,true表示发新帖,false表示编辑帖子 * 'istopic' - bool类型,true表示主题帖子,false表示回复帖子 * 'istop' - bool类型,是否全区置顶帖子 * 'sname' - string类型,发帖时间在session里面保存的变量名 * 'attachfile' - array类型,附件上传信息变量 * 'oldattach' - array类型,老的附件是否保留信息 * * $configs 相关参数: * 'minposttime' - int类型,发帖最少时间间隔,单位是秒 * 'badpostwords' - string类型,禁止发表的词语,每个一行 * 'checkpostrubbish' - bool类型,是否检查灌水贴 * 'minpostsize' - int类型,帖子内容最少几个字节 * 'maxpostsize' - int类型,帖子内容最多几个字节 * 'hidepostwords' - string类型,发表后隐藏的词语,每个一行 * * @param array $post_set 发帖信息设置 * @param array $configs 检查相关参数设置 * @param array $check_errors 错误信息数组 * @access public * @return bool */ function jieqi_post_checkvar(&$post_set, $configs, &$check_errors) { global $jieqiLang; global $jieqiConfigs; if (!isset($jieqiLang['system']['post'])) { jieqi_loadlang('post', 'system'); } if (!isset($jieqiConfigs['system'])) { jieqi_getconfigs('system', 'configs'); } if (!is_array($check_errors)) { $check_errors = array(); } $num_errors = count($check_errors); include_once JIEQI_ROOT_PATH . '/include/checker.php'; $checker = new JieqiChecker(); //提交处理 if (isset($jieqiConfigs['system']['posttitlemax'])) { $jieqiConfigs['system']['posttitlemax'] = intval($jieqiConfigs['system']['posttitlemax']); } if (empty($jieqiConfigs['system']['posttitlemax']) || $jieqiConfigs['system']['posttitlemax'] <= 10) { $jieqiConfigs['system']['posttitlemax'] = 60; } $post_set['topictitle'] = jieqi_substr(trim($post_set['topictitle']), 0, $jieqiConfigs['system']['posttitlemax'], '...'); //检查禁止发帖时间段 if (!empty($jieqiConfigs['system']['postdenytimes'])) { if (!$checker->deny_time($jieqiConfigs['system']['postdenytimes'])) { $check_errors[] = sprintf($jieqiLang['system']['post_deny_times'], jieqi_htmlstr($jieqiConfigs['system']['postdenytimes'])); } } //检查时间间隔,是否允许发贴 if (!empty($jieqiConfigs['system']['postintervaltime']) && !empty($post_set['isnew'])) { if (!$checker->interval_time($jieqiConfigs['system']['postintervaltime'], $post_set['sname'], 'jieqiVisitTime')) { $check_errors[] = sprintf($jieqiLang['system']['post_time_limit'], $jieqiConfigs['system']['postintervaltime']); } } //验证码 if ($jieqiConfigs['system']['postcheckcode'] > 0) { if ($post_set['checkcode'] != $_SESSION['jieqiCheckCode']) { $check_errors[] = $jieqiLang['system']['post_checkcode_error']; } } //检查禁用单词 if (!empty($jieqiConfigs['system']['postdenywords'])) { $matchwords1 = $checker->deny_words($post_set['topictitle'], $jieqiConfigs['system']['postdenywords'], true); $matchwords2 = $checker->deny_words($post_set['posttext'], $jieqiConfigs['system']['postdenywords'], true); if (is_array($matchwords1) || is_array($matchwords2)) { $matchwords = array(); if (is_array($matchwords1)) { $matchwords = array_merge($matchwords, $matchwords1); } if (is_array($matchwords2)) { $matchwords = array_merge($matchwords, $matchwords2); } $check_errors[] = sprintf($jieqiLang['system']['post_words_deny'], implode(' ', jieqi_funtoarray('htmlspecialchars', $matchwords))); } } //检查灌水 if (!empty($jieqiConfigs['system']['postdenyrubbish'])) { if (!$checker->deny_rubbish($post_set['posttext'], $jieqiConfigs['system']['postdenyrubbish'])) { $check_errors[] = $jieqiLang['system']['post_words_water']; } } //检查标题 if (!empty($post_set['istopic']) && $checker->is_required($post_set['topictitle']) == false) { if ($post_set['emptytitle']) { $post_set['topictitle'] = jieqi_substr(str_replace(array("\r", "\n", "\t", " "), '', preg_replace('/\\[[^\\[\\]]+\\]([^\\[\\]]*)\\[\\/[^\\[\\]]+\\]/isU', '\\1', $post_set['posttext'])), 0, 60); if (strlen($post_set['emptytitle']) == 0) { $post_set['emptytitle'] = '--'; } } else { $check_errors[] = $jieqiLang['system']['post_need_title']; } } //检查内容 if (!$checker->is_required($post_set['posttext'])) { $check_errors[] = $jieqiLang['system']['post_need_content']; } //检查最少字数 if (!empty($jieqiConfigs['system']['postminsize']) && !$checker->str_min($post_set['posttext'], $jieqiConfigs['system']['postminsize'])) { $check_errors[] = sprintf($jieqiLang['system']['post_min_content'], $jieqiConfigs['system']['postminsize']); } //检查最多字数 if (!empty($jieqiConfigs['system']['postmaxsize']) && !$checker->str_max($post_set['posttext'], $jieqiConfigs['system']['postmaxsize'])) { $check_errors[] = sprintf($jieqiLang['system']['post_max_content'], $jieqiConfigs['system']['postmaxsize']); } //替换单词 if (isset($jieqiConfigs['system']['postreplacewords']) && !empty($jieqiConfigs['system']['postreplacewords'])) { $checker->replace_words($post_set['topictitle'], $jieqiConfigs['system']['postreplacewords']); $checker->replace_words($post_set['posttext'], $jieqiConfigs['system']['postreplacewords']); } return count($check_errors) > $num_errors ? false : true; }
/** * 将字符串的函数应用到整个数组,即把数组里面所有字符串用某个函数处理一遍 * * @param string $funname 函数名 * @param array $ary 字符串数组 * @access public * @return array */ function jieqi_funtoarray($funname, $ary) { if (is_array($ary)) { foreach ($ary as $k => $v) { if (is_string($v)) { $ary[$k] = $funname($v); } elseif (is_array($v)) { $ary[$k] = jieqi_funtoarray($funname, $v); } } } else { $ary = $funname($ary); } return $ary; }
$sql = "SHOW TABLE STATUS LIKE '" . JIEQI_DB_PREFIX . "%'"; $res = $db_query->execute($sql); $tablerows = array(); $k = 0; $totaltable = 0; //表数 $totalsize = 0; //数据长度 $totalrows = 0; //记录数 $totalindex = 0; //索引程度 $totalfree = 0; //碎片长度 while ($row = $db_query->getRow($res)) { $tablerows[$k] = jieqi_funtoarray('jieqi_htmlstr', $row); $tablerows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . jieqi_htmlstr($row['Name']) . '">'; $totaltable++; $totalrows += $row['Rows']; $totalsize += $row['Data_length']; $totalindex += $row['Index_length']; $totalfree += $row['Data_free']; $k++; } $jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].type == \'checkbox\' && this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">'); $jieqiTpl->assign_by_ref('tablerows', $tablerows); if ($totalsize) { $jieqiTpl->assign('totaltable', $totaltable); } $jieqiTpl->assign('totalrows', $totalrows); if ($totalsize > 1048576) {
*/ define('JIEQI_MODULE_NAME', 'system'); require_once '../global.php'; include_once JIEQI_ROOT_PATH . '/class/power.php'; $power_handler =& JieqiPowerHandler::getInstance('JieqiPowerHandler'); $power_handler->getSavedVars('system'); jieqi_checkpower($jieqiPower['system']['adminpanel'], $jieqiUsersStatus, $jieqiUsersGroup, false, true); //包含页头页尾 include_once JIEQI_ROOT_PATH . '/admin/header.php'; $siteurl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $siteurl = dirname(dirname($siteurl)); $siteip = @gethostbyname($_SERVER['SERVER_NAME']); $jieqi_license_domain = ''; $matchs = array(); if (floatval(JIEQI_VERSION) >= 1.6) { $jieqi_license_ary = jieqi_funtoarray('base64_decode', explode('@', JIEQI_LICENSE_KEY)); } else { $jieqi_license_ary = explode('@', base64_decode(JIEQI_LICENSE_KEY)); } if (!empty($jieqi_license_ary[1]) && preg_match('/^(http:\\/\\/|https:\\/\\/)?[^\\/\\?]*(' . $jieqi_license_ary[1] . ')/i', JIEQI_LOCAL_HOST, $matchs)) { $jieqi_license_domain = $jieqi_license_ary[1]; } $jieqiTpl->assign('jieqi_customerurl', 'http://www.jieqi.com/modules/customer/siteback.php?sitename=' . urlencode(JIEQI_SITE_NAME) . '&siteurl=' . urlencode($siteurl) . '&jieqiversion=' . urlencode(JIEQI_VERSION) . '&versiontype=' . urlencode(JIEQI_VERSION_TYPE) . '&licensedomain=' . urlencode($jieqi_license_domain) . '&siteip=' . $siteip . '&userip=' . urlencode(jieqi_userip()) . '&jieqicharset=' . urlencode(JIEQI_CHAR_SET) . '&phpversion=' . urlencode(PHP_VERSION) . '&system=' . urlencode(PHP_OS) . '&freespace=' . intval(@disk_free_space($_SERVER['DOCUMENT_ROOT']) / 1048576) . '&zendoptimizer=' . urlencode(jieqi_zendoptimizerver())); $jieqiTpl->display(JIEQI_ROOT_PATH . '/templates/admin/default.html'); function jieqi_zendoptimizerver() { ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); preg_match('/Zend(\\s| )Optimizer(\\s| )v([\\.\\d]*),/is', $phpinfo, $matches);