<!--<?php
$styleStr=$s?"<style>html,body{background:#FFF}</style>":"";
print <<<EOT
-->
$styleStr
	<div id="content" class="w800 fr cc">
	<div class="y-bg"></div>
	<div class="y-bg2"></div>
	<div class="y-bg-content" style="padding:0 10px 50px 10px;">
		<div class="app-title cc">
			<a href="{$basename}space=1&q=diary" class="gray fr">进入个人空间浏览&raquo;</a><img src="$pwModeImg/applied/log.png" class="fl" /><span>日志</span>
		</div>
		<div class="tabB cc">
			<ul>
<!--
EOT;
$b = $a;
$u && $u != $winduid && $b = 'friend';
$a == 'edit' && $b = 'write';
print <<<EOT
-->
				<li id="a_friend"><a href="{$basename}q=diary&a=friend">好友日志</a></li>
				<li id="a_my"><a href="{$basename}q=diary">我的日志</a></li>
<script language="JavaScript">
setCurrent('a_$b','a_my','current');
</script>
			</ul>
				<a href="{$basename}q=diary&a=write" class="app-post">写新日志</a>
		</div>
<!--
EOT;
if (empty($a) || $a == 'privacy' || $a == 'friend') {print <<<EOT
-->
		<div class="cc">
			<div class="w500 fl">
<!--
EOT;
$privacy = array('全站可见','仅好友可见','仅自己可见');
if(!$did){
if($sum){print <<<EOT
-->
				<h3>&nbsp;共&nbsp;{$sum}&nbsp;条日志</h3>
				<table cellpadding="0" cellspacing="0" width="100%" style=" table-layout:fixed;">
<!--
EOT;
foreach($diarydb as $value){
$typename = !$value[dtid] ?  '默认分类' : $diarytype[$value[dtid]][name];
$title = '所属:'.$value[username].'&nbsp;'.$value[title];
$descrip = $value[subject];
if($value[uid]==$winduid){
	$author = '';
}else{
	$author = "<a href=\"u.php?uid=$value[uid]\" class=\"b blue\">$value[username]</a> ";
}
print <<<EOT
-->
					<tr id="diary_{$value[did]}" class="tr3 vt">
<!--
EOT;
if($value[icon]){print <<<EOT
-->
					<td width="55"><img src="$value[icon]" class="img-50" /></td>
<!--
EOT;
}print <<<EOT
-->
					<td>			
<!--
EOT;
if($db_share_open && !$shareGM){print<<<EOT
-->
					<span class="fr"><a class="a-reply" href="javascript:;" onclick="sendmsg('operate.php?action=share&ajax=1&type=diary&id=$value[did]','',this.id);">分享<span>+</span></a></span>
                   
<!--
EOT;
}print <<<EOT
-->
					<a href="{$basename}q=diary&did=$value[did]&u=$value[uid]" class="b red f14">{$value[subject]}</a>
						<p style="padding:6px 0;"><span class="mr10">$author 发表于：$value[postdate]</span><span class="mr10">评论：$value[c_num]</span><span class="mr10">浏览：$value[r_num]</span></p>
						<p id="img-width" class="gray">
						$value[content]
<!--
EOT;
if($value['pic']){
foreach($value['pic'] as $pic){
if($pic){print <<<EOT
-->
						<div class="f12" id="att_$pic[aid]" style="width:450px;overflow:hidden;margin:0;">
<!--
EOT;
if($pic['desc']){print <<<EOT
-->
							描述:$pic[desc]<br />
<!--
EOT;
}print <<<EOT
-->
							图片: $pic[img]
						</div>
<!--
EOT;
}}}print <<<EOT
-->
						</p>
						<div style="padding:6px 0 0;">
<!--
EOT;
if(($a!='friend' && $u==$winduid) || $groupid==3){print <<<EOT
-->
						<span class="del fr" style="cursor:pointer;" onclick="pwConfirm('是否确认删除',this,function(){delDiary('$value[did]','$u')})">删除</span>
<!--
EOT;
}if($u==$winduid && $a!='friend'){print <<<EOT
-->
					 <a style="cursor: pointer;" class="fr mr10" title="编辑" href="{$basename}q=diary&a=edit&did=$value[did]">编辑</a>
<!--
EOT;
}print <<<EOT
-->

<!--
EOT;
!$value[dtid] && $value[dtid] = '-1';
print <<<EOT
-->
						<br /><span class="mr10">分类：<a href="{$basename}q=diary&dtid=$value[dtid]&u=$value[uid]">{$typename}</a></span>
<!--
EOT;
if($u==$winduid && $a!='friend'){
print <<<EOT
-->
						<span>{$privacy[$value[privacy]]}</span>
<!--
EOT;
}print <<<EOT
-->						
						</div>
					</td>
					</tr>
<!--
EOT;
}print <<<EOT
-->	
				</table>
				<div class="mt10 cc">$pages</div>
<!--
EOT;
}else{
if($a == 'friend'){print <<<EOT
-->
				<div class="p10">好友最近没有日志</div>
<!--
EOT;
}else{print<<<EOT
-->
				<div class="p10">您最近没有日志</div>	
<!--
EOT;
}}}elseif(is_numeric($did)){
$typename = !$rt[dtid] ?  '默认分类' : $diarytype[$diary[dtid]][name];
$copy = $diary[copyurl] ? '转载于' : '发表于';
if($diary[uid]==$winduid){
	$author = '';
}else{
	$author = "<a href=\"u.php?uid=$diary[uid]\" class=\"b blue\">$diary[username]</a> ";
}
$title = '所属:'.$diary[username].'&nbsp;'.$diary[title];
$descrip = $diary[subject];
print <<<EOT
-->
						<h1 class="b red f24 mt10">{$diary[subject]}</h1>
						<p class="cc p10 mt10" style="background:#f9f9f9;line-height:1.8;">
<!--
EOT;
if($db_share_open && !$shareGM){print<<<EOT
-->
						<span class="fr"><a class="a-reply" href="javascript:;" onclick="sendmsg('operate.php?action=share&ajax=1&type=diary&id=$did','',this.id);">分享<span>+</span></a></span>
<!--
EOT;
}print <<<EOT
-->
						<span class="gray"><span class="f10 mr10">{$author}{$copy}$diary[postdate]</span> <span class="mr10">评论：$rt[c_num]</span><span class="mr10">浏览：$rt[r_num]</span></span><br />
<!--
EOT;
if($winduid==$u || $groupid==3){print <<<EOT
-->

					 <a class="del fr" style="cursor:pointer;" onclick="pwConfirm('确认删除？',this,function(){delDiary('$diary[did]','$u','read')})">删除</a>
<!--
EOT;
}if($diary[ifcopy] && $u != $winduid){print <<<EOT
-->
				<span class="fr mr10"><a style="cursor: pointer;" title="转载" href="{$basename}q=diary&a=copydiary&did=$diary[did]" onclick="return ajaxurl(this);">转载</a></span>
<script language="JavaScript">
function ajaxurl(o) {
	read.obj = o;
	ajax.send(o.href,'',ajax.get);
	return false;
}
</script>
<!--
EOT;
}if($winduid==$u){print <<<EOT
-->
				<span class="fr mr10"><a style="cursor: pointer;" title="编辑" href="{$basename}q=diary&a=edit&did=$diary[did]">编辑</a></span>
<!--
EOT;
}if($_G['allowreport']){print <<<EOT
-->
    		<a style="cursor: pointer;" class="fr mr10" onclick="sendmsg('pw_ajax.php?action=report&type=diary&tid=$did&pid=$u','',this.id);" id="report_diary">举报</a>
<!--
EOT;
}
!$rt[dtid] && $diary[dtid] = '-1';
print <<<EOT
-->
					<span>分类：<a href="{$basename}q=diary&dtid=$diary[dtid]&u=$diary[uid]">{$typename}</a></span>
<!--
EOT;
if($u==$winduid){
print <<<EOT
-->
					<span>{$privacy[$diary[privacy]]}</span>
<!--
EOT;
}print <<<EOT
-->
</p>
				<table cellpadding="0" cellspacing="0" width="100%" style=" table-layout:fixed;overflow:hidden;">
					<tr id="diary_{$diary[did]}">
						<td>
						<p style="line-height:2;font-size:14px;padding:10px 0;" id="img-width">										
<!--
EOT;
if($diary[copyurl]){print <<<EOT
-->
						<div style="margin-left:15px;">转载自:<a href="u.php?uid=$diary[copyuid]" target="_blank" style="color:#2484C7">$diary[copyer]</a> <a href="$diary[url]" target="_blank">$diary[url]</a></div><br />
<!--
EOT;
}print <<<EOT
-->
						$diary[content]
<!--
EOT;
if($diary['pic']){
foreach($diary['pic'] as $pic){
if($pic){print <<<EOT
-->
						<div class="f12" id="att_$pic[aid]" style="width:450px;overflow:hidden;margin:5px 0px 5px 0;">
<!--
EOT;
if($pic['desc']){print <<<EOT
-->
							描述:$pic[desc]<br />
<!--
EOT;
}print <<<EOT
-->
							图片:$pic[img]
<!--
EOT;
if($pic['dfadmin']){print <<<EOT
-->
							[<a style="cursor:pointer" onclick="delatt('$diary[pid]','$pic[aid]');">删除</a>]
<!--
EOT;
}print <<<EOT
-->
						</div>
<!--
EOT;
}}}print <<<EOT
-->
						</p>
						<div class="c"></div>
					</td>
				</tr>
				</table>
<div class="cc mt10">
						<a style="cursor: pointer;" class="fl" title="下一篇" href="{$thisbase}a=next&did=$diary[did]" onclick="return ajaxpage(this.href,'next','$u','$space');">下一篇</a>
						<a style="cursor: pointer;" class="fr" title="上一篇"href="{$thisbase}a=pre&did=$diary[did]" onclick="return ajaxpage(this.href,'pre','$u','$space');">上一篇</a></div>
<!--
EOT;
require_once PrintEot('m_comment');print <<<EOT
-->
<!--
EOT;
}print <<<EOT
-->
			</div>
<!--
EOT;
if($a != 'friend'){print <<<EOT
-->
			<div class="w230 fr">
				<h2>
<!--
EOT;
if($u==$winduid || $groupid==3){
print <<<EOT
-->
				<span class="fr gray"><a style="cursor: pointer;" onclick="addType('dt_ul','$u')">+添加分类</a></span>
<!--
EOT;
}print <<<EOT
-->
				日志分类</h2>
				<h2><a href="{$thisbase}" id="dtype_all">全部日志</a> <span class="fn">({$count})</span></h2>
				<ul id="dt_ul">

<!--
EOT;
foreach($diarytype as $value){
print <<<EOT
-->
					<li id="dt_{$value[dtid]}" onmouseover="changSpanDisplay(this);" onmouseout="changSpanDisplay(this);"> 
<!--
EOT;
if($u==$winduid || $groupid==3){
print <<<EOT
-->
					<span class="fr del" style="cursor: pointer;display:none" onclick="pwConfirm('确认删除？',this,function(){delDiaryType('$value[dtid]','$u')})">删除</span><span class="fr gray mr10" style="cursor: pointer;display:none;" onclick="showEidt('$value[dtid]','$u');">编辑</span> 
<!--
EOT;
}print <<<EOT
-->
					<a href="{$thisbase}dtid={$value[dtid]}" id="dtype_{$value[dtid]}">$value[name]</a> <b class="fn" id="dnum_{$value[dtid]}">({$value[num]})</b></li>
<!--
EOT;
}print <<<EOT
-->
					<li id="dt_null"><a href="{$thisbase}dtid=-1" id="dtype_null">默认分类</a> <b class="fn">({$other})</b></li>
				</ul>
<!--
EOT;
if($u==$winduid){print <<<EOT
-->
				<div class="private"><img src="$pwModeImg/icon/key.png" align="absmiddle" /> <a href="{$basename}q=diary&a=privacy">私密日志</a> <b class="fn">$dnum</b> </div>
<!--
EOT;
}print <<<EOT
-->
			</div>
<!--
EOT;
}print <<<EOT
-->
<script language="javascript">
setCurrent('dtype_$dtype','dtype_all','current');
</script>
		</div>
<!--
EOT;
} elseif ($a == 'write' || $a == 'edit') {print <<<EOT
-->
		<div class="cc">
			<p class="m10">
<!--
EOT;
if ($a == 'write') {print <<<EOT
-->
				写新日志
<!--
EOT;
} else {print <<<EOT
-->
				编辑日志
<!--
EOT;
}
$shortcut=$_GET['s']?'target=formTarget':'';
$formiframe=$shortcut?"<iframe width=0 height=0 name=formTarget src='javascript:;' onload=\"this.contentWindow.document.body.innerHTML.indexOf('操作完成')==-1?showDialog('fail',this.contentWindow.document.getElementById('main').innerHTML.replace(/<.+?>/g,'').replace('提示消息','').replace('返 回 继 续 操 作',''))&(read.menu.style.top='400px')&(document.FORM.Submit.disabled=false):showDialog('success','日志发表成功！')&(parent.location.href='mode.php?m=o&space=1&q=diary')&setEditorContent()&(read.menu.style.top='350px')&getObj('FORM').reset()\"></iframe>":"";
print <<<EOT
-->
				| <a href="{$basename}q=$q">返回我的日志</a>
			</p>
			$formiframe
			<form action="{$basename}q=$q&a=$a" method="post" enctype="multipart/form-data" onsubmit="return checkpost(document.FORM);" name="FORM" id="FORM" $shortcut />
			<input type="hidden" name="did" value="$did" />
			<input type="hidden" name="dtided" value="$diary[dtid]" />
			<input type="hidden" name="privacyed" value="$diary[privacy]" />
			<input type="hidden" name="atc_autourl" value="1" />
			<input type="hidden" name="step" value="2" />
			<input type="hidden" name="verify" value="$verifyhash" />
			<div>
			<div style="padding:10px 0 0 10px;">
						标题 <input type="text" class="input" name="atc_title" id="atc_title" value="$diary[subject]" size="70"/>&nbsp;<span id="atc_title_warn" class="gray">限 $db_titlemax 字节</span>
			</div>
						<div id="menu_face" class="menu" style="display:none;"></div>
						<div style="padding-top:10px;width:98%;">
						<script language="javascript"> 
	var imgpath   = 'images';
	var stylepath = 'wind';
	function addsmile(NewCode){
	    document.FORM.atc_content.value += ' [s:'+NewCode+'] ';
	}
	window.onerror=function()
	{
	return true;
	};
</script> 
<script language="JavaScript" src="data/bbscache/face.js"></script> 
 						<script language="JavaScript" src="js/global.js"></script> 
						<script language="JavaScript" src="js/app_global.js"></script> 
					<div id="menu_show" style="display:none;"></div> 
					<div id="menu_face" class="menu" style="display:none;"></div> 
					<script language="JavaScript" src="js/post.js"></script> 
							<div id="linkbox" style="display:none;"></div>
							<div class="o-editor mb10" style="width:600px;height:150px;overflow:hidden;"> 
                                <div class="o-operation cc f12"> 
                                     <span class="createlink" title="插入url链接" onClick="createLinkBox();" id="createlinkid">插入url链接</span><span class="o-face" id="td_face" style="cursor:pointer;" onClick="showDefault();" align="absmiddle" unselectable="on">添加表情</span> 
                                </div> 
                               <div class="fl" width="100%"><textarea maxlength="200" id="comm_input_diary_5294_0" name="atc_content" /></textarea></div> 
                            </div> 
<!--
EOT;
//require_once PrintEot('wysiwyg_editor');
print <<<EOT
-->
						</div>
				<table cellpadding="0" cellspacing="0">
					<tr class="tr3">
						<td style="font-size:12px">日志分类</td>
						<td>
							<select name="dtid" id="dtid_add">
								<option value="0" $dtid_0>默认分类</option>
								$dtsel
							</select>
						</td><td style="font-size:12px">隐私设置</td>
						<td>
							<select name="privacy" onchange="optionsel(this.value)">
								<option value="0" $privacy_0>全站可见</option>
								<option value="1" $privacy_1>仅好友可见</option>
								<option value="2" $privacy_2>仅自己可见</option>
							</select> 
							<span style="display:none;">
							<input id="if_copy" type="checkbox" name="ifcopy" value="1" $checked $disabled>允许好友转载
							<input type="checkbox" name="atc_convert" id="atc_convert" value="1" checked/>Wind Code自动转换
							</span>
						</td>
					</tr>
<!--
EOT;
if ($db_allowupload && $_G['allowupload'] || $attach) {print <<<EOT
-->
					<tr><td colspan="2">
						<table cellPadding="0" cellSpacing="0" style="display:none" width="100%">
						<tbody id="att_mode"><tr><td><input class="input" type="text" name="atc_desc" size="20" /></td>
							<td><input class="input" type="file" name="attachment_" size="20" /></td>
							<td><select style="display:none"></select></td>
							<td><select style="display:none"></select></td>
							<td><input class="input" type="hidden" name="atc_needrvrc" value="0" size="1" /></td>
							<td></td></tr>
						</tbody>
						</table>
					</td></tr>
<script language="JavaScript">
var allow_ext = '$uploadfiletype';
var attachnum = parseInt('$db_attachnum');
var charset = '$db_charset';
var titlemax = '$db_titlemax';
var postmax = '$db_postmax';
initCheckTextNum('atc_title','atc_title_warn',titlemax);
initCheckTextNum('textarea','textarea_warn',postmax);
</script>
<script type="text/javascript" language="JavaScript" src="js/upload.js"></script>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if($attach){print <<<EOT
-->
	<tr class="tr3">
		<th colspan="2">
			<div class="editor-mwidth">
				<div style="margin-left:200px">该帖包含附件<span class="gray">(不想保留的附件去掉√)</span> :
					<table style="margin-top:10px;">
						<tr>
							<td width="3%"></td>
							<td width="25%">描述</td>
							<td>附件</td>
						</tr>
						<tbody id="ajaxtable"></tbody>
					</table>
<script language="JavaScript">
var attachs = {{$attach}};
oldAtt.init();
</script>
				</div>
			</div>
		</th>
	</tr>
<!--
EOT;
}
$shortcut=$_GET['s']?'':'tr3';

if($db_allowupload && $_G['allowupload']){print <<<EOT
-->
	<tr class="$shortcut">
		<td>&nbsp;</td>
		<td style="padding-top:0;">
<!--
EOT;
if ($mutiupload > 0) {print <<<EOT
-->
					<span id="mutiinfo">您现在有 <b>{$mutiupload}</b> 个已经上传的附件 <a href="javascript:void(0);" class="bta" onclick="flashAtt.use();">使用</a> <a href="javascript:void(0);" class="bta" onclick="flashAtt.clear();" title="删除所有已经上传的附件">清空</a></span>
<!--
EOT;
}
$shortcut=$_GET['s']?' style="display:none"':'';
print <<<EOT
-->
					<table $shortcut >
						<tr>
							<td width="25%">描述</td>
							<td>附件</td>
						</tr>
						<tbody id="attach"></tbody>
					</table>
					<div id="viewimg" class="menu" style="display:none;"></div>
					<div id="attsize" $shortcut style="margin-top:10px">有效文件类型:$uploadfilesize</div>
		</td>
	</tr>
<script language="JavaScript">
var mutiupload = '$mutiupload';
newAtt.create();
</script>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if ($o_diary_gdcheck) {print <<<EOT
-->
					<tr class="tr3">
						<td class="tar">认证码:</td>
						<td>
							<img id="ckcode" style="cursor:pointer;position:absolute;display:none;margin-top:-63px;border:1px solid #ccc;" onclick="this.src='ck.php?nowtime='+new Date().getTime();" alt="看不清楚，换一张" />
							<input class="input" onfocus="showCK();" type="text" name="gdcode" id="gdcode" size="5" tabindex="3"  />
						</td>
					</tr>
<script language="JavaScript">
function showCK(){
	getObj('ckcode').style.display="";
	if (getObj('ckcode').src.indexOf('ck.php') == -1) {
		getObj('ckcode').src = 'ck.php?nowtime=' + new Date().getTime();
	}
}
</script>
<!--
EOT;
}if($o_diary_qcheck){print <<<EOT
-->
					<tr class="tr3">
						<td class="tar">验证问答:</td>
						<td>
						{$db_question[$qkey]} （正确答案:{$db_answer[$qkey]}）
						<input class="input" name="qanswer" id="qanswer" size="25" tabindex="7" />
						<input type="hidden" name="qkey" id="qkey" value="$qkey" />
						</td>
					</tr>
<!--
EOT;
}print <<<EOT
-->
					<tr>
						<td>&nbsp;</td>
						<td>
						<div class="mt10"><span class="button"><span><button name="Submit" type="submit">提 交</button></span></span></div>
						</td>
					</tr>
				</table>
			</div>
			</form>
	</div>
<!--
EOT;
if($a == 'edit'){print <<<EOT
-->
<script language="JavaScript">setTimeout("editor.gotoEnd();",50);</script>
<!--
EOT;
}else{print <<<EOT
-->
<script language="JavaScript">setTimeout("document.FORM.atc_title.focus()",50);</script>
<!--
EOT;
}print <<<EOT
-->
<script language="JavaScript">var stylepath = 'wind';</script>
<!--
EOT;
if(R_P!=D_P){
$facedb = readover(D_P.'data/bbscache/face.js');
print <<<EOT
-->
<script language="javascript">
{$facedb}
</script>
<!--
EOT;
}else{print <<<EOT
-->
<script language="JavaScript" src="data/bbscache/face.js"></script>
<!--
EOT;
}print <<<EOT
-->
<script language="JavaScript">
//editor.init();
var cnt  = 0;
document.FORM.Submit.disabled = false;
function checkpost(obj) {
	var setTop=function()
	{
	read.menu.style.top='400px';
	};
	if (obj.atc_title.value == "") {
		showDialog("error","标题不能为空",2);
		setTop();
		obj.atc_title.focus();
		return false;
	} else if (strlen(obj.atc_title.value) > $db_titlemax) {
		showDialog("error","标题超过最大长度 $db_titlemax 个字节",2);
		obj.atc_title.focus();
		setTop();
		return false;
	}
	if (strlen(obj.atc_content.value) < $db_postmin) {
		showDialog("error","文章内容少于 $db_postmin 个字节",2);
		editor.focusEditor();
		setTop();
		return false;
	} else if (strlen(obj.atc_content.value) > $db_postmax) {
		showDialog("error","文章内容大于 $db_postmax 个字节",2);
		editor.focusEditor();
		setTop();
		return false;
	}
	document.FORM.Submit.disabled = true;
	cnt++;
	if (cnt != 1) {
		showDialog("warning","Submission Processing. Please Wait");
		setTop();
		return false;
	}
	
	return true;
}
</script>
<script language="JavaScript" src="js/post.js"></script>
<!--
EOT;
}print <<<EOT
-->
<script language="JavaScript" src="apps/$appdir/js/diarytype.js"></script>
<script language="JavaScript" src="js/app_comment.js"></script>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript" src="js/core/friendlist.js"></SCRIPT>	

<!--
EOT;
if((empty($a) || $a == 'privacy' || $a == 'friend') && !empty($sum)) {print <<<EOT
-->
<script language="javascript">
// JavaScript Document
var imgMaxWidth=450; //控制内容中图片大小
var content = document.getElementById("img-width");
var M_DIARY_CTRL="ctrl+鼠标滚轮缩放";

</script>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript" src="js/core/space.js"></SCRIPT>	

<!--
EOT;
}print <<<EOT
-->
</div>
<div class="y-bg2"></div>
<div class="y-bg"></div>
</div>
<!--
EOT;
?>-->