//
//
Pubblicazione già approvata da $apprveto2ins[1] !
//
// ';
//echo $html;
echo "";
echo "";
exit();
} else {
if ( $apprveto2ins[2] == '1'){
//$html = '
//
//
Pubblicazione già sottoposta a veto da $apprveto2ins[3] !
//
//
';
//echo $html;
echo "";
echo "";
exit();
}
}
$query2 = "UPDATE IZU92ap5P_articoli SET appr = 1, IZU92ap5P_articoli.emailAppr = '$email'
WHERE IZU92ap5P_articoli.doi = '$doi'";
$res3 = mysqli_query($dbhandle,$query2);
$queryPost = "SELECT IZU92ap5P_articoli.authors,IZU92ap5P_articoli.published,IZU92ap5P_articoli.title,IZU92ap5P_articoli.ajournal,IZU92ap5P_articoli.doi,IZU92ap5P_articoli.summary FROM IZU92ap5P_articoli WHERE IZU92ap5P_articoli.doi = '$doi'";
$post2ins = mysqli_query($dbhandle,$queryPost);
$post2insarr = mysqli_fetch_array($post2ins);
$year = strtok($post2insarr[1], '-');
//echo $year;
$year2ins = array($year);
$post2 = array(
'post_author' => 1,
'post_content' => $post2insarr[5],
'post_title' => $post2insarr[2],
'post_name' => 'my-page',
//'tax_input' => $year2ins[0],
'post_category' => $year2ins,
'tags_input' => array($post2insarr[0]),
'meta_input' => array(
'rivista' => $post2insarr[3],
'arxivdoi' => $post2insarr[4]
),
'post_excerpt' => '',
'post_status' => 'publish',
'comment_status' => 'close',
'ping_status' => 'open',
'post_type' => 'post',
'comment_count' => 0
);
$postid = wp_insert_post($post2);
$query = " SELECT name FROM IZU92ap5P_terms";
//echo $query;
$res4 = mysqli_query($dbhandle,$query);
$rows = array();
while(($row = mysqli_fetch_array($res4))) {
$rows[] = $row;
}
//$res4arr = mysqli_fetch_array($res4);
if (in_array($year, $rows)) {
$cat2ins = get_cat_ID( $year );
} else {
wp_create_category( $year);
$cat2ins = get_cat_ID( $year );
}
//$test = array('8');
//wp_set_post_terms( $postid, $year2ins, 'category');
wp_set_post_categories( $postid, $cat2ins );
$html = '
Pubblicazione inserita correttamete !
';
echo $html;
echo "";
echo "";
mysqli_close($dbhandle);
} else {
$query = "SELECT appr,emailAppr,veto,emailVeto FROM IZU92ap5P_articoli WHERE IZU92ap5P_articoli.doi = '$doi'";
$apprveto = mysqli_query($dbhandle,$query);
$apprveto2ins = mysqli_fetch_array($apprveto);
if ( $apprveto2ins[2] == '1'){
//$html = '
//
//
Pubblicazione già sottoposta a veto da $apprveto2ins[3] !
//
//
';
//echo $html;
echo "";
echo "";
exit();
} else {
if ( $apprveto2ins[0] == '1'){
//$html = '
//
//
Pubblicazione già approvata da $apprveto2ins[1] !
//
//
';
//echo $html;
echo "";
echo "";
exit();
}
}
$query3 = "UPDATE IZU92ap5P_articoli SET veto = 1, IZU92ap5P_articoli.emailVeto = '$email'
WHERE IZU92ap5P_articoli.doi = '$doi'";
$res5 = mysqli_query($dbhandle,$query3);
$html = '
Pubblicazione sottoposta a veto correttamete !
';
echo $html;
echo "";
}
} else {
//echo "App is empty";
;
}
}
add_action('init', 'insertpub');
?>