include('include/common.inc.php');
include('nb_specific/common.inc.php');
include('nb_specific/security.inc.php');
include('include/text_processing.php');
include('include/library/common.inc.php');
include('modules/article/article.class.php');
include('include/filters/newlinefilter.class.php');
include('include/filters/doifilter.class.php');
CheckNumericID();
$id = intval($_GET['id']);
$isAurora = ($host == 'aurora-group') ? 1 : 0;
if ($id < 0)
{
EDBConnect();
$id_article = GetSQLValue("emag_articles", "id_article", "nb_itemid=".-$id);
if ($id_article > 0)
$id = $id_article ;
}
if ($id > 0)
{
EDBConnect();
$magID = GetSQLValue("emag_articles", "id_mag", "id_article=".$id);
$nb_itemid = GetSQLValue("emag_articles", "nb_itemid", "id_article=".$id);
$strID = GetSQLValue("emag_mags", "str_id", "id_mag=".$magID);
$eprinted = GetSQLValue("emag_mags", "eprinted", "id_mag=".$magID);
$articleInfo = GetRecordSet("emag_articles", array( "month", "year", "uploaded"), "id_article=".$id);
$articleInfo = $articleInfo[0];
$printed = IsPrintedMag($magID, $articleInfo['year'], $articleInfo['month']);
$uploaded = $articleInfo["uploaded"];
EDBDisconnect();
$content = "";
if ($nb_itemid > 0 || $printed == 0 || (($uploaded == 0) && ($eprinted == 1)) || (!$articleInfo['year'] && !$articleInfo['month']))
{
global $lang;
$langStr = (GetLanguage() == 1 || GetLanguage() == 3) ? "www" : "en";
$domain = /*($host == 'aurora-group') ? 'e.aurora-journals.com' :*/ 'e-notabene.ru';
$isLogged = IsLibraryUser() ? 1 : 0;
$id_user = IsLibraryUser() ? $_SESSION['library_id_user'] : 0;
if ($id_user < 0)
$id_user = -$id_user;
EDBConnect();
$sideMenuHTML = GetSideMenuHTML(-3);
$keywords_eng = GetRecordSet("enotabene.emag_keywords_eng", array("keyword"), "id_article=".$id);
$keywords = GetRecordSet("enotabene.emag_keywords", array("keyword"), "id_article=".$id);
$links = GetRecordSet("enotabene.emag_bibliolinks", array("link"), 'id_article='.$id.' ORDER BY id_link ASC');
$annotation_eng = GetSQLValue("emag_articles", "annotation_eng", "id_article=".$id);
$annotation = GetSQLValue("emag_articles", "annotation", "id_article=".$id);
$title_eng = GetSQLValue("emag_articles", "title_eng", "id_article=".$id);
$title = GetSQLValue("emag_articles", "title", "id_article=".$id);
$status = GetSQLValue("emag_articles", "status", "id_article=".$id);
$id_order_payed_subscribe = GetSQLValue("emag_orders", "id_order", "id_article=".$id.' AND order_type=22 AND id_user='.$id_user.' AND is_payed=1');
$free = GetSQLValue("emag_articles", "free", "id_article=".$id);
EDBDisconnect();
$subscribtionUser = GetESubscribtionUser($magID, $articleInfo['year'], $articleInfo['month'], -$id);
//echo '$subscribtionUser =' .$subscribtionUser;
if ($id_order_payed_subscribe!="" || $subscribtionUser !=0)
$free = 2;
//if ( ($isLogged && $free == 1) || $free == 2)
{
$start_url = $langStr.".".$domain;
if ($_SERVER['HTTP_HOST'] == 'dev.nbpublish.com' || $_SERVER['HTTP_HOST'] == 'devcn.nbpublish.com')
{
if (GetLanguage() == 1 || GetLanguage() == 3)
{
$start_url = "dev.e-notabene.ru";
}
else
{
$start_url = "en.e-notabene.ru";
}
}
else if ($_SERVER['HTTP_HOST'] == 'deven.nbpublish.com')
{
$start_url = "deven.e-notabene.ru";
}
$url = "http://".$start_url."/view_article.php?id_article=".$id."&nb=1&logged=".$isLogged."&aurora=".$isAurora;
if (GetLanguage() == 3)
$url .="&lang=3";
//print($url);
$content="";
if ($status <> 7)
$content = "
Статья еще не опубликована";
else
{
$lang = GetLanguage();
$post_fix = "ru";
if ($lang == 2)
$post_fix = "en";
elseif ($lang == 3)
$post_fix = "cn";
EDBConnect();
$cached_content = GetSQLValue("enotabene.emag_articles", "nb_cached_content_".$post_fix, "id_article = ".$id);
if ($isAurora == 1)
{
$cached_content = GetSQLValue("enotabene.emag_articles", "au_cached_content_".$post_fix, "id_article = ".$id);
}
EDBDisconnect();
if (strlen($cached_content) > 5)
{
$content = $cached_content;
}
else
{
$content = file_get_contents($url);
}
}
if (preg_match_all('/]+>/i',$content, $imgTags))
{
for ($i = 0; $i < count($imgTags[0]); $i++)
{
if (preg_match('/src="\/img([^"]+)/i',$imgTags[0][$i], $imgage))
{
$content = str_replace($imgage[0], 'src="https://www.e-notabene.ru'.str_ireplace( 'src="', '', $imgage[0]), $content);
}
}
}
}
$links_ar = array();
$keywords_ar = array();
foreach($links as $links_rl) $links_ar[] = $links_rl['link'];
$link_str = join("
", $links_ar);
ShowTopPart(' ', $id);
$article = new CArticle('enotabene.emag_articles', 'id_article='.$id, array('id_article','authors','page_start', 'page_end', 'year','id_mag','month','grants_info','printed'), 'library_protected_article/');
if (GetLanguage() == 2)
{
$article->AddHelperQuery("SELECT title_eng as rubric FROM enotabene.emag_rubrics WHERE id_rubric={rubricid_e}");
foreach($keywords_eng as $keywords_rl) $keywords_ar[] = $keywords_rl['keyword'];
$article->AddConst('resume' , $annotation_eng);
$article->AddConst('title' , $title_eng);
}
else
{
$article->AddHelperQuery("SELECT title as rubric FROM enotabene.emag_rubrics WHERE id_rubric={rubricid_e}");
foreach($keywords as $keywords_rl) $keywords_ar[] = $keywords_rl['keyword'];
$article->AddConst('resume' , $annotation);
$article->AddConst('title' , $title);
}
$keywords_str = join(", ", $keywords_ar);
$article->AddConst('keywords' , $keywords_str);
$article->AddConst('bibliography' , $link_str);
$article->AddFieldFilter("bibliography", new CNewlineFilter());
$article->AddFieldFilter("doi", new CDoiFilter());
$article->AddHelperQuery("SELECT title as human_name, id_mag as id_secondary FROM enotabene.emag_mags WHERE id_mag='{id_mag}'");
$article->AddHelperQuery('SELECT issn FROM enotabene.emag_mags WHERE id_mag={id_mag}');
$article->AddConst('logged', $isLogged);
$article->AddConst('free', $free);
$article->AddConst('content', $content);
//$article->AddConst('printed', $printed);
$article->AddConst('id_from_get', $id);
$article->AddConst('id_source', 0);
$article->AddConst('article_cost', $article_price);
$article->AddConst('mag_cost', $mag_price);
$article->AddConst('itemid', -$id);
$article->AddConst('strID', $strID);
$article->AddConst('is_aurora', $isAurora);
SetVarsForArticle($article, 1, -1);
$article->Show();
ShowBottomPart();
die();
}
else
{
$id = -$id;
}
}
?>