<?php
require_once('ppframe.php');

$__seo -> ParseValueWithoutKey();

$un = $un ? $un : $__seo -> GetParams();
$_GET['un'] = $un;
$tmpploguser = new PpLog_User();
$tmpploguser -> ReSet();
if(empty($uid)) {
	$tmpploguser -> LoadFromDBuseUniqID($un);
	$uid = $tmpploguser -> U_ID;
	$un = $tmpploguser->U[$tmpploguser->U_UniqueID];
}else {
	$tmpploguser -> LoadFromDBUsePriID($uid);
}

Bloger_check();

$blogerinfo = $tmpploguser -> U;

if (!GetCookie('pplog_visited'.$uid)) {
	$tmpploguser -> SetUpdateInfo(array('visit'=>'visit+1'));
	$tmpploguser -> DoReRecord(array(),array('visit'));
	PutCookie('pplog_visited'.$uid,1,3600*24);
}

//
Iimport('EasyCache');
$easycache = new EasyCache();
$easycache -> UseCache();
//ҵķ
Iimport('Lister_Pplog_MyClass');
$lister_myclass = new Lister_Pplog_MyClass();
$lister_myclass -> CreateWhere(array("`author`='$uid'"));
$lister_myclass = $lister_myclass -> GetList();
//
Iimport('Lister_Pplog_Article');
$new_lister_article = new Lister_Pplog_Article();
$new_lister_article -> SetWhere("`author`='$uid'");
$new_lister_article -> SetBox(0);
$new_lister_article -> CreateWhere();
$new_lister_article -> SetLimit('0,10');
$new_lister_article = $new_lister_article -> GetList();

$date_lister_article = new Lister_Pplog_Article();
$date_lister_article -> SetWhere("`author`='$uid'");
$date_lister_article -> SetBox(0);
if($date) {
	$d = substr($date,0,6);
	$date_lister_article -> SetWhere("`postdate` like '$d%'");
}
$date_lister_article -> CreateWhere();
$date_lister_article -> SetLimit('0,20');
$date_lister_article -> SetConfig(array(
	'groupby' => '`postdate` desc',
	'orderby' => '',
	'els' => array('count(*) as num,`postdate`')
));
$date_lister_article = $date_lister_article ->GetList();

//
foreach ($date_lister_article as $k => $v) {
	$date_article[$v['postdate']] = $v['num'];
}
if ($date) {
	$year = substr($date,0,4);
	$month = substr($date,4,2);
} else {
	list($year,$month) = explode(',',GetMyDate('Y,m',$timestamp));
}

$premonth = $month -1 > 0 ? ( $year . (strlen($month -1) ==2 ? $month -1 : '0'. ($month - 1) ) ) : ($year -1) .'12';
$latermonth = $month +1 > 12 ? (($year+1) . '01') : ($year . (strlen($month+1) == 2 ? ($month+1) : '0'.($month+1)) );
$day = GetMyDate('d',$timestamp);

$j = 0;
for ($i = gmmktime(1,0,0,intval($month),1,$year);$month == GetMyDate('m',$i);$i += 3600*24) {
	list($d,$w) = explode(',',GetMyDate('d,w',$i));
	$data = array(
		'd' => $d,
		'w' => $w,
		'p' => $date_article[$year.$month.$d] ? $date_article[$year.$month.$d] : 0,
	);
	if ($w == 0) {
		$j ++;
	}
	$datedata[$j][$w] = $data;
}


//б
$lister_article = new Lister_Pplog_Article();
$lister_article -> SetWhere("`author`='$uid'");
$lister_article -> SetBox(0);
$myclass = intval($myclass);
if($myclass) $lister_article -> SetWhere("`myclass`='$myclass'");
if($date) $lister_article -> SetWhere("`postdate` like '$date%'");
$lister_article -> CreateWhere();
$total_num = $lister_article -> ExecTotalRecord();

Iimport('page');
$p = new Page($total_num,$page,10);
$p -> SetDpages();
$pagelink = $p -> GetPageLink(true);
$lister_article -> SetConfig(array('limit' => $p -> Limit));
$lister_article = $lister_article -> GetList('listfun');

function listfun(&$row) {
	$row['body'] = substr(strip_tags($row['body'],'<p><br>'),0,1000);
	return $row;
}
//
Iimport('Lister_Pplog_Reply');
$lister_reply = new Lister_Pplog_Reply();
$lister_reply -> CreateWhere(array("`articleauthor`='$uid'"));
$lister_reply -> SetLimit('0,10');
$lister_reply = $lister_reply -> GetList('listreplyfun');

function listreplyfun(&$row) {
	return $row;
}

//
Iimport('Lister_Pplog_Liuyan');
$lister_liuyan = new Lister_Pplog_Liuyan();
$lister_liuyan -> CreateWhere(array("`pploger`='$uid'"));
$lister_liuyan -> SetLimit('0,10');
$lister_liuyan = $lister_liuyan -> GetList();

//ӵԪ.
Iimport('Lister_Pplog_Fdlink');
$lister_fdlink = new Lister_Pplog_Fdlink();
$lister_fdlink -> CreateWhere(array("`author`='$uid'"));
$lister_fdlink = $lister_fdlink->GetList();

Iimport('template');
$tpl = new Template();
$tpl -> Assign('title',$blogerinfo['pplogtitle']);
$tpl -> DisPlay('u');

SeoOver();
$easycache -> StoreCache();
?>