<?php
/****************优客365网址导航系统 商业版********************/
/*                                                            */
/*  Youke365.com (C)2017 Youke365 Inc.                        */
/*  This is NOT a freeware, use is subject to license terms   */
/*  优客365网址导航系统是商业软件,使用于商业用途请购买授权    */
/*  V1.0 2017                                                 */
/*  技术支持：1513773524@qq.com                               */
/*  官方网址：http://www.youke365.com                         */
/*  官方论坛：http://bbs.youke365.com                         */                           
/**************************************************************/

define('APP_DEBUG',false); //调试模式
define('ROOT_PATH', str_replace("\\", '/', substr(__FILE__, 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR))).'/');







define('YOUKE365_MEMBER',true); 
define('YOUKE365_PATH', ROOT_PATH.'source/');
define('MOD_PATH', ROOT_PATH.'member/module/');

require(YOUKE365_PATH.'init.php');

require(YOUKE365_PATH.'common/rewrite.php');
require(YOUKE365_PATH.'common/siteurl.php');
require(YOUKE365_PATH.'common/category.php');
require(YOUKE365_PATH.'common/website.php');
require(YOUKE365_PATH.'common/article.php');
require(YOUKE365_PATH.'common/weblink.php');
require(YOUKE365_PATH.'extend/connect/oauth_qq.php');
require(YOUKE365_PATH.'common/user.php');
$table = $DB->table('website');
$module = $_GET['mod'] ? $_GET['mod'] : $_POST['mod'];
if (!isset($module)) $module = 'home';

require(MOD_PATH.'common.php');

/** navitem */
/** navitem */
$navitem = array('home' => '会员中心', 'website' => '网站管理', 'addurl' => '网站提交', 'claim' => '网站认领', 'article' => '文章管理', 'profile' => '个人资料', 'editpwd' => '修改密码', 'logout' => '安全退出');
$smarty->assign('navitem', $navitem);

$modarr = array('home', 'register', 'login', 'connect', 'logout', 'activate', 'getpwd', 'reset', 'verify', 'connect', 'index', 'website', 'claim', 'article', 'weblink', 'favorite', 'profile', 'editpwd', 'upload');
$authmod = array('home', 'verify', 'website', 'claim', 'article', 'weblink', 'favorite', 'profile', 'editpwd', 'upload');
$verify = array('home', 'website', 'claim', 'article', 'weblink', 'favorite', 'profile', 'editpwd');

if (in_array($module, $modarr)) {
	
	if (in_array($module, $authmod)) {
		/** check login  */
		$auth_cookie = $_COOKIE['auth_cookie'];
		$myself = check_user_login($auth_cookie);
		if (empty($myself)) {
			msgbox('您还未登录或无权限！', '?mod=login');
		}
		$where = "w.user_id=".$myself['user_id'];
		$total = $DB->get_count($table.' w', $where);

		$smarty->assign('myself', $myself);
		$smarty->assign('total',$total);
	
		if (in_array($module, $verify)) {
			if ($myself['user_status'] == -1) {
				$msg = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提示信息 - $options[site_name]</title>
<style type="text/css">
body {background: #f5f5f5;}
#msgbox {background: #fff; border: solid 3px #f1f1f1; font: normal 16px/30px normal; margin: 100px auto; padding: 100px 0; text-align: center; width: 500px;}
</style>
</head>

<body>
<div id="msgbox">你还未通过E-mail验证！<br /><a href="?mod=verify">[点击发送验证邮件]</a></div>
</body>
</html>
EOT;
				exit($msg);
			}
		}
	}

	$modpath = MOD_PATH.$module.'.php';
	if (is_file($modpath)) {
		
		require($modpath);
	} else {
		exit('“'.$module.'.php” 模块文件不存在！');
	}
}
?>
