main.php
程序员文章站
2022-09-20 12:42:30
<?php
/**
* site main page
*
* @author avenger <avenger@php.net>
* @version $id 2003-04-11 18:06:20 $
*/
require_once 'header.inc.php';
tpl_load("index.html",'','keep');
// get u language
$g_lang = explode(',',$_server['http_accept_language']);
switch ($g_lang[0]) {
case 'zh-hk':
case 'zh-tw':
case 'zh-mo':
case 'zh-cn':
include('lang.zh.inc.php');
$indexfile = 'main_zh.htm';
break;
default:
include('lang.en.inc.php');
$indexfile = 'main_en.htm';
}
$filedate = (int)date(time()-@filemtime($indexfile));
// if lastupdate less than five hours then update
if ($filedate<18000 && filesize($indexfile)<>0 && empty($_get['update'])) {
require($indexfile);
exit();
} else {
// rand title
require_once 'titles.inc.php';
$currdate = date('md');
if ($title_h[$currdate]) {
$title_more = $title_h[$currdate];
} else {
$title_more = $title_o[array_rand($title_o)];
}
// import template
$tpl->setvar("filehead",file_head());
/*
$tpl->setvar("filepic",file_pic('phptshirt.gif','国内首款 php t-shirt 火热预定中……','http://www.phpe.net/t-shirt'));
$tpl->setvar("filepic",file_pic('phpandmore.gif','《php&more》创刊号发布','http://www.phpe.net/news/34.shtml'));
$tpl->setvar("filepic",file_pic('3.jpg','超越php欢迎您',''));
$tpl->setvar("filepic",file_pic('show.gif','show出你的热情活动 -- 点击查看详情','http://www.phpe.net/club/index.php?act=st&f=2&t=1416'));
$tpl->setvar("filepic",file_pic('1year.gif','超越php一岁了','http://www.phpe.net/club/index.php?s=&act=st&f=7&t=2419'));
*/
$tpl->setvar("create",date('y-m-d h:i:s'));
$tpl->setvar("desc",$lang['sitedesc']);
$tpl->setvar("keywords",$lang['sitekeywork']);
$tpl->setvar("title",$lang['sitetitle'].$title_more);
/*
dbinit();
extract($dbinfo,extr_overwrite);
$rs = $dbconn->execute('show tables');
while ($result = $rs->fetchrow()) $tables .= $result["tables_in_$dbname"].",";
$sql = 'optimize table '.substr($tables,0,-1);
$dbconn->execute($sql);
*/
$indexlogin = '<script type="text/javascript" language="javascript" src="user_login.php"></script>';
$tpl->setvar("indexlogin",$indexlogin);
$space = '<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><img src="images/spacer.gif" width="1" height="10" alt=""></td></tr></table>';
ob_start();
//echo item_title($lang['stat'],'98%');
include("index_stat.inc.php");
$tpl->setvar("indexcount",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['vote'],'98%');
include("index_vote.inc.php");
$tpl->setvar("indexvote",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['links'],'98%');
include("index_links.inc.php");
$tpl->setvar("indexlink",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['intro'],'98%');
include("index_intro.inc.php");
$tpl->setvar("indexintro",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['news'].' '.make_link('/?n=rss&t=news', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_news.inc.php");
$tpl->setvar("indexnew",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['articles'].' '.make_link('/?n=rss&t=articles', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_article.inc.php");
$tpl->setvar("indexarticle",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['recommendtopic'],'98%');
echo '
<table width="98%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'recommend_topic.php?cid=2,6,15,16,18"></script>
</td></tr>
<tr><td bgcolor="#dddddd" align="right"><a href="'. $global['bbs'] .'" title="more...">更多推荐话题 ...</a> </td></tr>
</table>
';
$tpl->setvar("recommendtopic", ob_get_contents());
ob_end_clean();
ob_start();
echo '
<table width="98%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'recommend_topic.php?cid=13"></script>
</td></tr>
<tr><td bgcolor="#dddddd" align="right"><a href="'. $global['bbs'] .'index.php?s=&act=sf&f=13" title="more...">更多招聘信息 ...</a> </td></tr>
</table>
';
$tpl->setvar("hrtopic", ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['faqs'].' '.make_link('/?n=rss&t=faqs', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_faq.inc.php");
$tpl->setvar("indexfaq",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['nav'],'98%');
include("index_sitenav.inc.php");
$tpl->setvar("indexnav",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['tips'],'98%');
include("index_tips.inc.php");
$tpl->setvar("indextips",ob_get_contents());
ob_end_clean();
/*
ob_start();
echo item_title($lang['events'],'98%');
$tpl->setvar("indexevents",ob_get_contents());
ob_end_clean();
*/
ob_start();
//echo item_title($lang['resouce'],'98%');
include("index_resource.inc.php");
$tpl->setvar("indexresource",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['souwang'],'98%');
echo '
<form action="/search.html" method="get" target="_blank">
互联网上的 php 资源<br>
<input style="width:100px" type="text" class="small" size="20" value="php" name="q">
<input type="submit" value="souwang" class="en1">
</form>
';
$tpl->setvar("indexsouwang",ob_get_contents());
ob_end_clean();
//$tpl->setvar("indexpartners",item_title($lang['partners'],'98%'));
ob_start();
//echo item_title($lang['calendar'],'98%');
include_once "calendar.inc.php";
$c = new calendar;
echo $c->getcurrentmonthview();
$tpl->setvar("indexcalendar",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['newtopic'],'98%');
echo '
<table width="95%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'new_topic.php?cid=2,6,15,16,18"></script>
</td></tr>
</table>
';
$tpl->setvar("indexforum", ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['maillist'],'98%');
echo '
<table>
<tr>
<td align="center">
<form method="post" action="/?n=maillist">
<font class="en1">join the mail list:</font>
<input style="width:100px" name="m" type="text" class="small" size="20" maxlength="100" title="加入邮件列表" value="enter your mail" onfocus="if(this.value==\'enter your mail\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'enter your mail\';"><br>
<input type="submit" value="submit" class="en1">
</form>
</td>
</tr>
</table>
';
$tpl->setvar("indexmail",ob_get_contents());
ob_end_clean();
// my name :)
$s_name='index.php';
$tpl->setvar("space",$space);
$tpl->setvar("filefoot",file_foot());
$tpl->parse('output','main');
$output = $tpl->get("output");
// rwrite to file
wfile($indexfile,$output);
require($indexfile);
}
?>
/**
* site main page
*
* @author avenger <avenger@php.net>
* @version $id 2003-04-11 18:06:20 $
*/
require_once 'header.inc.php';
tpl_load("index.html",'','keep');
// get u language
$g_lang = explode(',',$_server['http_accept_language']);
switch ($g_lang[0]) {
case 'zh-hk':
case 'zh-tw':
case 'zh-mo':
case 'zh-cn':
include('lang.zh.inc.php');
$indexfile = 'main_zh.htm';
break;
default:
include('lang.en.inc.php');
$indexfile = 'main_en.htm';
}
$filedate = (int)date(time()-@filemtime($indexfile));
// if lastupdate less than five hours then update
if ($filedate<18000 && filesize($indexfile)<>0 && empty($_get['update'])) {
require($indexfile);
exit();
} else {
// rand title
require_once 'titles.inc.php';
$currdate = date('md');
if ($title_h[$currdate]) {
$title_more = $title_h[$currdate];
} else {
$title_more = $title_o[array_rand($title_o)];
}
// import template
$tpl->setvar("filehead",file_head());
/*
$tpl->setvar("filepic",file_pic('phptshirt.gif','国内首款 php t-shirt 火热预定中……','http://www.phpe.net/t-shirt'));
$tpl->setvar("filepic",file_pic('phpandmore.gif','《php&more》创刊号发布','http://www.phpe.net/news/34.shtml'));
$tpl->setvar("filepic",file_pic('3.jpg','超越php欢迎您',''));
$tpl->setvar("filepic",file_pic('show.gif','show出你的热情活动 -- 点击查看详情','http://www.phpe.net/club/index.php?act=st&f=2&t=1416'));
$tpl->setvar("filepic",file_pic('1year.gif','超越php一岁了','http://www.phpe.net/club/index.php?s=&act=st&f=7&t=2419'));
*/
$tpl->setvar("create",date('y-m-d h:i:s'));
$tpl->setvar("desc",$lang['sitedesc']);
$tpl->setvar("keywords",$lang['sitekeywork']);
$tpl->setvar("title",$lang['sitetitle'].$title_more);
/*
dbinit();
extract($dbinfo,extr_overwrite);
$rs = $dbconn->execute('show tables');
while ($result = $rs->fetchrow()) $tables .= $result["tables_in_$dbname"].",";
$sql = 'optimize table '.substr($tables,0,-1);
$dbconn->execute($sql);
*/
$indexlogin = '<script type="text/javascript" language="javascript" src="user_login.php"></script>';
$tpl->setvar("indexlogin",$indexlogin);
$space = '<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><img src="images/spacer.gif" width="1" height="10" alt=""></td></tr></table>';
ob_start();
//echo item_title($lang['stat'],'98%');
include("index_stat.inc.php");
$tpl->setvar("indexcount",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['vote'],'98%');
include("index_vote.inc.php");
$tpl->setvar("indexvote",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['links'],'98%');
include("index_links.inc.php");
$tpl->setvar("indexlink",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['intro'],'98%');
include("index_intro.inc.php");
$tpl->setvar("indexintro",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['news'].' '.make_link('/?n=rss&t=news', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_news.inc.php");
$tpl->setvar("indexnew",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['articles'].' '.make_link('/?n=rss&t=articles', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_article.inc.php");
$tpl->setvar("indexarticle",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['recommendtopic'],'98%');
echo '
<table width="98%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'recommend_topic.php?cid=2,6,15,16,18"></script>
</td></tr>
<tr><td bgcolor="#dddddd" align="right"><a href="'. $global['bbs'] .'" title="more...">更多推荐话题 ...</a> </td></tr>
</table>
';
$tpl->setvar("recommendtopic", ob_get_contents());
ob_end_clean();
ob_start();
echo '
<table width="98%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'recommend_topic.php?cid=13"></script>
</td></tr>
<tr><td bgcolor="#dddddd" align="right"><a href="'. $global['bbs'] .'index.php?s=&act=sf&f=13" title="more...">更多招聘信息 ...</a> </td></tr>
</table>
';
$tpl->setvar("hrtopic", ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['faqs'].' '.make_link('/?n=rss&t=faqs', '(rss)', '_blank', 'class="en2"'),'98%');
include("index_faq.inc.php");
$tpl->setvar("indexfaq",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['nav'],'98%');
include("index_sitenav.inc.php");
$tpl->setvar("indexnav",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['tips'],'98%');
include("index_tips.inc.php");
$tpl->setvar("indextips",ob_get_contents());
ob_end_clean();
/*
ob_start();
echo item_title($lang['events'],'98%');
$tpl->setvar("indexevents",ob_get_contents());
ob_end_clean();
*/
ob_start();
//echo item_title($lang['resouce'],'98%');
include("index_resource.inc.php");
$tpl->setvar("indexresource",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['souwang'],'98%');
echo '
<form action="/search.html" method="get" target="_blank">
互联网上的 php 资源<br>
<input style="width:100px" type="text" class="small" size="20" value="php" name="q">
<input type="submit" value="souwang" class="en1">
</form>
';
$tpl->setvar("indexsouwang",ob_get_contents());
ob_end_clean();
//$tpl->setvar("indexpartners",item_title($lang['partners'],'98%'));
ob_start();
//echo item_title($lang['calendar'],'98%');
include_once "calendar.inc.php";
$c = new calendar;
echo $c->getcurrentmonthview();
$tpl->setvar("indexcalendar",ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['newtopic'],'98%');
echo '
<table width="95%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<script language="javascript" type="text/javascript" src="'. $global['bbs'] .'new_topic.php?cid=2,6,15,16,18"></script>
</td></tr>
</table>
';
$tpl->setvar("indexforum", ob_get_contents());
ob_end_clean();
ob_start();
//echo item_title($lang['maillist'],'98%');
echo '
<table>
<tr>
<td align="center">
<form method="post" action="/?n=maillist">
<font class="en1">join the mail list:</font>
<input style="width:100px" name="m" type="text" class="small" size="20" maxlength="100" title="加入邮件列表" value="enter your mail" onfocus="if(this.value==\'enter your mail\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'enter your mail\';"><br>
<input type="submit" value="submit" class="en1">
</form>
</td>
</tr>
</table>
';
$tpl->setvar("indexmail",ob_get_contents());
ob_end_clean();
// my name :)
$s_name='index.php';
$tpl->setvar("space",$space);
$tpl->setvar("filefoot",file_foot());
$tpl->parse('output','main');
$output = $tpl->get("output");
// rwrite to file
wfile($indexfile,$output);
require($indexfile);
}
?>