ini_set("display_errors","1");
error_reporting(1);

require_once(dirname(__FILE__)."/../classes/Article.php");
require_once(dirname(__FILE__)."/../classes/Shelf.php");
require_once(dirname(__FILE__)."/../users/langs.php");
require_once(dirname(__FILE__)."/../classes/services/ArticleServices.php");
$scielodef = parse_ini_file(dirname(__FILE__) . '/../scielo.def', true);

$_data['PID'] = $_REQUEST['pid'];

$shelf = new Shelf();

$shelf->setUserID($_COOKIE['userID']);
$shelf->setPID($_data['PID']);
$shelf->getShelfItem();

$cited_stat = intval($shelf->getCitedStat());

$access_stat = intval($shelf->getAccessStat());

$visible = $shelf->getVisible();

if($visible || $access_stat)
{
	$shelf->setCitedStat(0);
	$shelf->UpdateArticleInShelf();

}else{
	$shelf->removeArticleFromShelf();
}