<?php
// +----------------------------------------------------------------------
// | mobanbox [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://mobanbox.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@mobanbox.net
// +----------------------------------------------------------------------

_setView(__FILE__);
_setTitle($langArray['book_marks']);

if(!check_login_bool()) {
		$_SESSION['temp']['golink'] = '/'.$languageURL.'user/bookmarks/';
		refresh('/'.$languageURL.'sign_in/');
}

	require_once ROOT_PATH.'/apps/collections/models/collections.class.php';
	$collectionsClass = new collections();
	
	if(isset($_POST['add'])) {
		$collectionsClass->add();
		refresh('/'.$languageURL.'user/bookmarks/', $langArray['complete_add_collection'], 'complete');
	}	
	
	$collections = $collectionsClass->getAll(0, 0, " `user_id` = '".intval($_SESSION['user']['user_id'])."' ", true);
	abr('collections', $collections);
	
	$usersClass = new users();

	$users = $usersClass->getAll(0, 0, $collectionsClass->usersWhere);
	abr('users', $users);



if(check_login_bool() && $_SESSION['user']['user_id'] != $users['user_id']) {
		$users['is_follow'] = $usersClass->isFollow($users['user_id']);
	}

	$users['profile_desc'] = replaceEmoticons($users['profile_desc']);

	abr('user', $users);

	abr('checkItemsType', 'yes');

	if(check_login_bool() && ($username == '' || $username == $_SESSION['user']['username'])) {
		$username = $_SESSION['user']['username'];
		$whereQuery = " AND (`status` = 'active' OR `status` = 'unapproved' ) ";
	}
	else {
		$whereQuery = " AND `status` = 'active' ";
	}
	$user = $usersClass->getByUsername($username);

	abr('user', $user);


#面包屑	
	abr('breadcrumb', '<a href="/'.$languageURL.'" title="">'.$langArray['home'].'</a> \ <a href="/'.$languageURL.'users/bookmarks/" title="">'.$langArray['collections'].'</a>');		
	
	
?>