<?php if(!defined('DEDEMEMBER')) exit('dedecms');
/**
* 空间操作
*
* @version $Id: space_action.php 1 15:18 2010年7月9日Z tianya $
* @package DedeCMS.Member
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
//是否允许用户空间显示未审核文档
$addqSql = '';
if($cfg_mb_allowncarc=='N') $addqSql .= " And arc.arcrank > -1 ";
if(isset($mtype)) $mtype = intval($mtype);
if(!empty($mtype)) $addqSql .= " And arc.mtype = '$mtype' ";
/*---------------------------------
文章列表
function list_article(){ }
-------------------------------------*/
if($action=='article')
{
if(empty($mtype)) $mtype = 0;
include_once(DEDEINC.'/arc.memberlistview.class.php');
include_once(DEDEINC.'/channelunit.func.php');
$query = "SELECT arc.*,mt.mtypename,addt.body,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `#@__archives` arc
LEFT JOIN `#@__addonarticle` addt ON addt.aid=arc.id
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__mtypes` mt ON mt.mtypeid=arc.mtype
WHERE arc.mid='{$_vars['mid']}' $addqSql AND arc.channel=1 ORDER BY arc.id DESC";
$dlist = new MemberListview();
$dlist->pageSize = $_vars['pagesize'];
$dlist->SetParameter("mtype",$mtype);
$dlist->SetParameter("uid",$_vars['userid']);
$dlist->SetParameter("action",$action);
$dlist->SetTemplate(DEDEMEMBER."/space/{$_vars['spacestyle']}/listarticle.htm");
$dlist->SetSource($query);
$dlist->Display();
exit();
}
/*---------------------------------
单篇文章显示
function view_archives(){ }
-------------------------------------*/
else if($action=='viewarchives' && !empty($aid) && is_numeric($aid))
{
if(empty($mtype)) $mtype = 0;
include_once(DEDEINC.'/arc.memberlistview.class.php');
include_once(DEDEINC.'/channelunit.func.php');
//读取文章的评论
$sql = "SELECT fb.*,mb.userid,mb.face as mface,mb.spacesta,mb.scores FROM `#@__feedback` fb
LEFT JOIN `#@__member` mb ON mb.mid = fb.mid
WHERE fb.aid='$aid' and fb.ischeck='1' ORDER BY fb.id DESC LIMIT 0, 50";
$msgs = array();
$dsql->Execute('fb', $sql);
while ($row = $dsql->GetArray('fb'))
{
$msgs[] = $row;
}
//读取文章内容
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,
tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,ar.body FROM `#@__archives` arc
LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
LEFT JOIN `#@__addonarticle` ar ON ar.aid=arc.id
WHERE arc.mid='{$_vars['mid']}' AND arc.channel=1 AND ar.typeid=tp.id AND ar.aid='$aid' ";
$arcrow = $dsql->GetOne($query);
if( !is_array($arcrow) )
{
ShowMsg(' 读取文档时发生未知错误! ', '-1');
exit();
}
//解析模板
$dlist = new MemberListview();
$dlist->SetTemplate(DEDEMEMBER."/space/{$_vars['spacestyle']}/blog.htm");
$dlist->Display();
exit();
}
/*---------------------------------
所有文档列表
function list_archives(){ }
-------------------------------------*/
else if($action=='archives')
{
if(empty($mtype)) $mtype = 0;
include_once(DEDEINC.'/arc.memberlistview.class.php');
include_once(DEDEINC.'/channelunit.func.php');
//如果没指定频道ID的情况下,列出所有非单表模型文档
if($cfg_mb_spaceallarc > 0 && empty($channelid)) $channelid = intval($cfg_mb_spaceallarc);
if(empty($channelid))
{
$channelid = 0;
$query = "SELECT arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `#@__archives` arc
LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
LEFT JOIN `#@__mtypes` mt ON mt.mtypeid=arc.mtype
WHERE arc.mid='{$_vars['mid']}' $addqSql ORDER BY arc.id DESC";
}
else
{
$channelid = intval($channelid);
$chRow = $dsql->GetOne("SELECT issystem,addtable,listfields From `#@__channeltype` WHERE id='$channelid' ");
if(!is_array($chRow)) die(' Channel Error! ');
if($chRow['issystem']==-1)
{
$addtable = trim($chRow['addtable']);
$listfields = explode(',', $chRow['listfields']);
$listfields_str = 'arc.'.join(',arc.', $listfields);
if($listfields_str!='arc.')
{
$listfields_str = $listfields_str.',';
}
else {
$listfields_str = '';
}
$query = "SELECT arc.aid,arc.aid as id,arc.typeid,'' as mtypename,1 as ismake,0 as money,'' as filename,{$listfields_str}
tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `{$addtable}` arc
LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
WHERE arc.mid='{$_vars['mid']}' And arc.channel='$channelid' $addqSql ORDER BY arc.aid DESC";
}
else
{
$query = "SELECT arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
from `#@__archives` arc
LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id
LEFT JOIN `#@__mtypes` mt on mt.mtypeid=arc.mtype
WHERE arc.mid='{$_vars['mid']}' And arc.channel='$channelid' $addqSql order by arc.id desc";
}
}
$dlist = new MemberListview();
$dlist->pageSize = $_vars['pagesize'];
$dlist->SetParameter("mtype", $mtype);
$dlist->SetParameter("uid", $_vars['userid']);
$dlist->SetParameter("channelid", $channelid);
$dlist->SetParameter("action", $action);
$dlist->SetTemplate(DEDEMEMBER."/space/{$_vars['spacestyle']}/listarchives.htm");
$dlist->SetSource($query);
$dlist->Display();
exit();
}
/*---------------------------------
所有文档列表
function list_album(){ }
-------------------------------------*/
else if($action=='album')
{
if(empty($mtype)) {
$mtype = 0;
}
include_once(DEDEINC.'/arc.memberlistview.class.php');
include_once(DEDEINC.'/channelunit.func.php');
$query = "SELECT arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
from `#@__archives` arc
left join `#@__arctype` tp on arc.typeid=tp.id
left join `#@__mtypes` mt on mt.mtypeid=arc.mtype
where arc.mid='{$_vars['mid']}' And arc.channel=2 $addqSql order by arc.id desc";
$dlist = new MemberListview();
$dlist->pageSize = $_vars['pagesize'];
$dlist->SetParameter("mtype",$mtype);
$dlist->SetParameter("uid",$_vars['userid']);
$dlist->SetParameter("action",$action);
$dlist->SetTemplate(DEDEMEMBER."/space/{$_vars['spacestyle']}/listalbum.htm");
$dlist->SetSource($query);
$dlist->Display();
exit();
}
/*---------------------------------
留言本
function guestbook(){ }
-------------------------------------*/
else if($action=='guestbook')
{
if(empty($mtype)) {
$mtype = 0;
}
include_once(DEDEINC.'/datalistcp.class.php');
$query = "SELECT mg.*,mb.face,mb.userid,mb.sex From `#@__member_guestbook` mg
left join `#@__member` mb on mb.userid=mg.gid
where mg.mid='{$_vars['mid']}' order by mg.aid desc";
$dlist = new DataListCP();
$