safeCheck = false;
$dsql->SetLongLink();
//获得当前脚本名称,如果你的系统被禁用了$_SERVER变量,请自行更改这个选项
$dedeNowurl = $s_scriptName = '';
$isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();
$dedeNowurls = explode('?', $dedeNowurl);
$s_scriptName = $dedeNowurls[0];
//检验用户登录状态
$cuserLogin = new userLogin();
//增加校验
$cuserLogin->checkUser($userid,$pwd);
if($cuserLogin->getUserID()==-1)
{
//header("location:login.php?gotopage=".urlencode($dedeNowurl));
echo("[err]Invalid username or password[/err]");
exit();
}
if($cfg_dede_log=='Y')
{
$s_nologfile = '_main|_list';
$s_needlogfile = 'sys_|file_';
$s_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
$s_query = isset($dedeNowurls[1]) ? $dedeNowurls[1] : '';
$s_scriptNames = explode('/',$s_scriptName);
$s_scriptNames = $s_scriptNames[count($s_scriptNames)-1];
$s_userip = GetIP();
if( $s_method=='POST' || (!eregi($s_nologfile,$s_scriptNames) && $s_query!='') || eregi($s_needlogfile,$s_scriptNames) )
{
$inquery = "INSERT INTO `#@__log`(adminid,filename,method,query,cip,dtime)
VALUES ('".$cuserLogin->getUserID()."','{$s_scriptNames}','{$s_method}','".addslashes($s_query)."','{$s_userip}','".time()."');";
$dsql->ExecuteNoneQuery($inquery);
}
}
//管理缓存、管理员频道缓存
$cache1 = DEDEDATA.'/cache/inc_catalog_base.inc';
if(!file_exists($cache1)) UpDateCatCache();
$cacheFile = DEDEDATA.'/cache/admincat_'.$cuserLogin->userID.'.inc';
if(file_exists($cacheFile)) require_once($cacheFile);
//更新栏目缓存
function UpDateCatCache()
{
global $dsql, $cfg_multi_site, $cache1, $cacheFile, $cuserLogin;
$cache2 = DEDEDATA.'/cache/channelsonlist.inc';
$cache3 = DEDEDATA.'/cache/channeltoplist.inc';
$dsql->SetQuery("Select id,reid,channeltype,issend From `#@__arctype`");
$dsql->Execute();
$fp1 = fopen($cache1,'w');
$phph = '?';
$fp1Header = "<{$phph}php\r\nglobal \$_Cs;\r\n\$_Cs=array();\r\n";
fwrite($fp1,$fp1Header);
while($row=$dsql->GetObject())
{
fwrite($fp1,"\$_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend});\r\n");
}
fwrite($fp1,"{$phph}>");
fclose($fp1);
$cuserLogin->ReWriteAdminChannel();
@unlink($cache2);
@unlink($cache3);
}
function DedeInclude($filename,$isabs=false)
{
return $isabs ? $filename : DEDEADMIN.'/'.$filename;
}
//config.php结束
//CheckPurview('a_New,a_AccNew');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
/*if(empty($dopost))
{
$dopost = '';
}
if($dopost!='save')
{
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
ClearMyAddon();
$channelid = empty($channelid) ? 0 : intval($channelid);
$cid = empty($cid) ? 0 : intval($cid);
//获得频道模型ID
if($cid > 0 && $channelid == 0)
{
$row = $dsql->GetOne("Select channeltype From `#@__arctype` where id='$cid'; ");
$channelid = $row['channeltype'];
}
else
{
if($channelid==0)
{
ShowMsg("无法识别模型信息,因此无法操作!","-1");
exit();
}
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" Select * From `#@__channeltype` where id='$channelid' ");
$channelid = $cInfos['id'];
include DedeInclude("templets/archives_sg_add.htm");
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
//else if($dopost=='save')
//{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
if(empty($channelid))
{
$channelid=-98; //默认商品模型
// ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
// exit();
}
if($typeid==0)
{
//zzcityadd
// $zztypename=trim($_POST['typename']);
if(!empty($typename)){
$row=$dsql->GetOne("Select id From `#@__arctype` where typename='$typename' and channeltype='$channelid'");
if(!empty($row['id'])){
$typeid=$row['id'];
}
}else{
// ShowMsg("请指定文档的栏目!","-1");
echo("[err]请指定栏目typeid![/err]");
exit();
}
}
//if(!CheckChannel($typeid,$channelid) )
//{
// ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
// echo("[err]你所选择的栏目typeid与当前模型channelid不相符[/err]");
// exit();
//}
// if(!TestPurview('a_New'))
// {
// CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!");
// }
//对保存的内容进行处理
if(empty($writer))$writer=$cuserLogin->getUserName();
if(empty($source))$source='未知';
if(empty($flags)) $flag = '';
else $flag = join(',',$flags);
$senddate = time();
$title = cn_substrR($title,$cfg_title_maxlen);
// if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
// {
// $arcrank = -1;
// }
$adminid = $cuserLogin->getUserID();
$userip = GetIP();
if(empty($ddisremote))
{
$ddisremote = 0;
}
$litpic = GetDDImage('none',$picname,$ddisremote);
//生成文档ID
$arcID = GetIndexKey(0,$typeid,$senddate,$channelid,$senddate,$adminid);
if(empty($arcID))
{
// ShowMsg("无法获得主键,因此无法进行后续操作!","-1");
echo("无法获得主键,因此无法进行后续操作![/err]");
exit();
}
//处理图片文档的自定义属性
if($litpic!='' && !ereg('p',$flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
}
//保存到附加表
//$cts = $dsql->GetOne("Select addtable From `#@__channeltype` where id='$channelid' ");
//$addtable = trim($cts['addtable']);
$addtable = trim('#@__taoke_auction');
if(!empty($addtable))
{
if(empty($sid)) $sid = '';
if(empty($title)) $title = '';
if(empty($nick)) $nick = '';
if(empty($cmoney)) $cmoney = '';
if(empty($cratepercent)) $cratepercent = '';
if(empty($scratepercent)) $scratepercent = '';
if(empty($mmid)) $mmid = '';
if(empty($usernumberid)) $usernumberid = '';
if(empty($litpic)) $litpic = '';
if(empty($totalnum)) $totalnum = '';
if(empty($dbid)) $dbid = '';
if(empty($location)) $location = '';
if(empty($auctionid)) $auctionid = '';
if(empty($shop_url)) $shop_url = '';
if(empty($auction_url)) $auction_url = '';
if(empty($slevel)) $slevel = '';
if(empty($body)) $body = '';
$exturl=preg_replace("/mm_([0-9_]{1,})/", $cfg_taoke_pid, $exturl);
$body = stripslashes($body);
$body = addslashes($body);
$litpic = stripslashes($litpic);
$slevel = trim($slevel);
$cmoney = trim($cmoney);
$litpic = trim($litpic);
$shop_url = trim($shop_url);
$auction_url = trim($auction_url);
$nick = trim($nick);
$query = "INSERT INTO `{$addtable}`(aid,typeid,channel,arcrank,mid,click,title,senddate,flag,litpic,userip,sid,dbid,cmoney,cratepercent,scratepercent,mmid,usernumberid,slevel,nick,location,reservepricemoney,auction_url,auctionid,shop_url,exturl,body)
Values('$arcID','$typeid','$channelid','$arcrank','$adminid','0','$title','$senddate','$flag','$litpic','$userip','$sid','$dbid','$cmoney','$cratepercent','$scratepercent','$mmid','$usernumberid','$slevel','$nick','$location','$reservepricemoney','$auction_url','$auctionid','$shop_url','$exturl','$body')";
if(!$dsql->ExecuteNoneQuery($query))
{
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID'");
//ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCms官方。".str_replace('"','',$gerr),"javascript:;");
echo("[err]把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCms官方。".str_replace('"','',$gerr)."[/err]");
exit();
}
}
//生成HTML
$artUrl = MakeArt($arcID,true,true);
/* if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
//返回成功信息
$msg = "
请选择你的后续操作:
继续发布文档
查看文档
更改文档
已发布文档管理
网站栏目管理
";
$wintitle = "成功发布文档!";
$wecome_info = "文档管理::发布文档";
$win = new OxWindow();
$win->AddTitle("成功发布文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand"," ",false);
$win->Display();
*/
/******************************
//更新主页的任务
******************************/
if($cfg_makeindex=='Y'){
require_once(DEDEINC.'/arc.partview.class.php');
//$envs = $_sys_globals = array();
//$envs['aid'] = 0;
$row = $dsql->GetOne("Select * From #@__homepageset");
$pv = new PartView();
// $homeFile = dirname(__FILE__).'/'.$row['position'];
// $homeFile = str_replace("//", "/", str_replace("\\", "/", $homeFile));
// $fp = fopen($homeFile, 'w') or die("[err]无法更新网站主页到:$homeFile 位置[/err]");
// fclose($fp);
// $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;
//
// if(!file_exists($tpl))
// {
// $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm';
// if(!file_exists($tpl)) exit("[err]无法找到主页模板:$tpl [/err]");
// }
// $pv->SetTemplet($tpl);
// $pv->SaveToHtml($homeFile);
// $pv->Close();
$position=$row['position'];
$templet=$row['templet'];
$homeFile = DEDEADMIN."/".$position;
$homeFile = str_replace("\\","/",$homeFile);
$homeFile = str_replace("//","/",$homeFile);
$fp = fopen($homeFile,"w") or die("[err]你指定的文件名有问题,无法创建文件[/err]");
fclose($fp);
$templet = str_replace("{style}",$cfg_df_style,$templet);
$pv = new PartView();
$GLOBALS['_arclistEnv'] = 'index';
$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
$pv->SaveToHtml($homeFile);
/* if( empty($nextdo) )
{
ShowMsg("完成主页更新任务!完成所有更新任务!", "close::tgtable");
exit();
}
else
{
$jumpurl = GetNextUrl();
ShowMsg("完成主页更新! 现在跳转到其它更新任务...", $jumpurl,0,500);
exit();
}
*/
}
if($cfg_make_andcat=='Y'){
require_once(DEDEROOT."/data/cache/inc_catalog_base.inc");
require_once(DEDEINC.'/arc.listview.class.php');
//$notallowArr = array('dopost', 'f', 'del', 'curpage', 'morejob');
//$jumpurl = GetNextUrl($notallowArr);
if( empty($typeid) )
{
//ShowMsg("完成栏目更新任务!完成所有更新任务!", "close::tgtable");
exit();
}
$topids = explode(',', GetTopids($typeid));
if(empty($curpage)) $curpage = 0;
while($curpage <= count($topids)-1){
$tid = $topids[$curpage];
if(isset($_Cs[$tid]) && $_Cs[$tid][1]>0)
{
require_once(DEDEINC."/arc.listview.class.php");
$lv = new ListView($tid);
$lv->MakeHtml();
$lv->Close();
}
else
{
require_once(DEDEINC."/arc.sglistview.class.php");
$lv = new SgListView($tid);
//exit();
$lv->MakeHtml();
$lv->Close();
}
$curpage++;
}
}
echo("[ok]");
exit();
//}
?>