<?php
 /*
 * 74cms 添加到人才库
 * ============================================================================
 * 版权所有: 骑士网络，并保留所有权利。
 * 网站地址: http://www.74cms.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once(dirname(__FILE__).'/../include/common.inc.php');
$act = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : 'add';
require_once(QISHI_ROOT_PATH.'include/mysql.class.php');
require_once(QISHI_ROOT_PATH.'include/fun_user.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);
if ($_SESSION['uid']=='' || $_SESSION['username']=='')
{
	$captcha=get_cache('captcha');
	$smarty->assign('verify_userlogin',$captcha['verify_userlogin']);
	$smarty->display('plus/ajax_login.htm');
	exit();
}
if ($_SESSION['utype']!='1' && $_SESSION['utype']!='3')
{
	exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>必须是企业会员/猎头会员才可以收藏简历！</div>
				</div> 
			</div>
		</div>');
}
if($_SESSION['utype']=="1"){
	require_once(QISHI_ROOT_PATH.'include/fun_company.php');
	$favorites_list = get_member_url(1,true)."company_recruitment.php?act=favorites_list";
	$user=get_user_info($_SESSION['parentuid']);
}elseif($_SESSION['utype']=="3"){
	require_once(QISHI_ROOT_PATH.'include/fun_hunter.php');
	$favorites_list = get_member_url(3,true)."hunter_recruitment.php?act=favorites_list";
	$user=get_user_info($_SESSION['uid']);
}

if ($user['status']=="2") 
{
	exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>您的账号处于暂停状态，请先联系网站管理员设为正常后进行操作！</div>
				</div> 
			</div>
		</div>');
}
if ($act=="add")
{
	$id=isset($_GET['id'])?$_GET['id']:exit("出错了"); 
	$add_return=$_SESSION['utype']=="1"?add_favorites($id,$_SESSION['parentuid'],$_SESSION['uid']):add_favorites($id,$_SESSION['uid']);
	if ($add_return==="full")
	{
	exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>添加失败，人才库容量已经超出最大限制</div>
				</div> 
			</div>
		</div>');
	}
	elseif ($add_return=="0")
	{
		exit('<div class="floatContent">
			<div class="float_common_box">
				<div class="float_tips">
					<div>添加失败，人才库中已经存在！</div>
				</div> 
			</div>
		</div>');
	}
	else
	{
?> 
<div class="floatContent" id="download_ok" >
	<div class="float_common_box" >
		<div class="float_auth_success">收藏成功！共收藏 <?php echo $add_return?>份简历<a href="<?php echo $favorites_list;?>" ></div>
	</div>
</div>
<?php
}
}
?>