pluginLang = include 'data/lang_gbk.php'; } else { $scj2cms->pluginLang = include 'data/lang_utf8.php'; } $scjConfig = ECMS_PATH . 'd/file/skycaijidg_config.php'; $pluginConfig = null; if (file_exists($scjConfig)) { $pluginConfig = include $scjConfig; $pluginConfig = unserialize(base64_decode($pluginConfig)); } $scj2cms->pluginConfig = is_array($pluginConfig) ? $pluginConfig : array(); $scj2cms->funcApiPost = '_scjFuncApiPost'; //载入文章模块 $ecms_config['esafe']['ckhash'] = 2;//关闭HASH模式 chdir(ECMS_PATH . 'e/admin'); require LoadLang("pub/fun.php"); require("../class/delpath.php"); require("../class/copypath.php"); require("../class/t_functions.php"); require("../data/dbcache/class.php"); require("../data/dbcache/MemberLevel.php"); require("../member/class/user.php"); require("../class/hinfofun.php"); ob_clean(); ob_start(); register_shutdown_function('_scjExit'); $scj2cms->apiPost();//发布 function _scjFuncApiPost() { global $scj2cms; global $empire, $class_r, $class_zr, $bclassid, $public_r, $dbtbpre, $emod_r, $lur; if (empty($_POST['title'])) { $scj2cms->returnJson(0, $scj2cms->pluginLang['dg_error_title']); } if (empty($_POST['newstext'])) { $scj2cms->returnJson(0, $scj2cms->pluginLang['dg_error_newstext']); } //栏目 $classid = $_POST['classid']; if (empty($classid)) { $scj2cms->returnJson(0, $scj2cms->pluginLang['dg_error_classid']); } $classData = null; if (is_numeric($classid)) { $classid = intval($classid); $classData = $empire->fetch1("select * from {$dbtbpre}enewsclass where classid='{$classid}'"); } else { $classid = addslashes($classid); $classData = $empire->fetch1("select * from {$dbtbpre}enewsclass where classname='{$classid}'"); } if (empty($classData)) { $scj2cms->returnJson(0, $scj2cms->pluginLang['dg_error_class'] . $classid); } $_POST['classid'] = $classid = $classData['classid']; $_POST['bclassid'] = $classData['bclassid']; //作者 $author = $scj2cms->randLine($scj2cms->pluginConfig['author']); $userData = null; if (is_numeric($author)) { $author = intval($author); $userData = $empire->fetch1("select * from {$dbtbpre}enewsuser where userid='{$author}'"); } else { $author = addslashes($author); $userData = $empire->fetch1("select * from {$dbtbpre}enewsuser where username='{$author}'"); } if (empty($userData)) { $scj2cms->returnJson(0, $scj2cms->pluginLang['dg_error_user'] . $author); } //发布到多个栏目 $copyclassid = $_POST['copyclassid']; if (isset($copyclassid)) { $copyclassid = explode(',', $copyclassid); foreach ($copyclassid as $k => $v) { $classData = null; if (is_numeric($v)) { $v = intval($v); $classData = $empire->fetch1("select * from {$dbtbpre}enewsclass where classid='{$v}'"); } else { $v = addslashes($v); $classData = $empire->fetch1("select * from {$dbtbpre}enewsclass where classname='{$v}'"); } if (empty($classData)) { unset($copyclassid[$k]); } else { $copyclassid[$k] = $classData['classid']; } } $copyclassid = array_unique($copyclassid); $copyclassid = array_values($copyclassid); $_POST['copyclassid'] = $copyclassid; } //标题属性 $titlefont = $_POST['titlefont']; if (isset($titlefont)) { $titlefont = explode(',', $titlefont); foreach ($titlefont as $k => $v) { unset($titlefont[$v]); $titlefont[$v] = $v; } $_POST['titlefont'] = $titlefont; } //默认参数 $defaParams = array('checked' => 1, 'isgood' => 0, 'firsttitle' => 0, 'newstime' => date('Y-m-d H:i:s'), 'dokey' => 1, 'autosize' => 5000, 'getfirsttitlespicw' => 105, 'getfirsttitlespich' => 118, 'istop' => 0, 'groupid' => 0, 'info_diyotherlink' => 0, 'newspath' => date('Y-m-d')); foreach ($defaParams as $k => $v) { if (!isset($_POST[$k])) { $_POST[$k] = $v; } } $GLOBALS['_empire'] = $empire; $GLOBALS['_return_url'] = ($scj2cms->isSsl() ? 'https' : 'http') . '://' . $scj2cms->getHost() . $public_r['newsurl'] . 'e/action/ShowInfo.php?classid=' . $_POST['classid'] . '&id='; $ecms_config['esafe']['thedolog'] = 1;//关闭日志 AddNews($_POST, $userData['userid'], $userData['username']); } function urlxx() { $url = ''; if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { $url = $_SERVER['HTTP_X_REWRITE_URL']; } elseif (isset($_SERVER['REQUEST_URI'])) { $url = $_SERVER['REQUEST_URI']; } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { $url = $_SERVER['ORIG_PATH_INFO'] . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''); } else { $url = ''; } return $url; } function _scjExit() { global $scj2cms; $html = ob_get_contents(); ob_clean(); if (strpos($html, '{') === 0) { //json exit($html); } else { $return = array('id' => 0, 'target' => '', 'desc' => '', 'error' => ''); if (stripos($html, 'AddNews.php?enews=AddNews') !== false) { //添加成功 $return['id'] = $GLOBALS['_empire']->id; $return['target'] = $GLOBALS['_return_url'] . $return['id']; } elseif (preg_match('/
\s*
\s*([\s\S]*?)<\/b>\s*
/i', $html, $error)) { //失败信息 $return['error'] = $error[1]; } $scj2cms->returnJson($return['id'], $return['error'], $return['target'], $return['desc']); } }