One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
vo
/
nosc
/
Edit File:
getit-issues
#!/usr/bin/php <?php $startvolume = "28"; $endvolume = "28"; $startissue = "2"; // issue and year are independent $endissue = "2"; $outFile = $startvolume . '-' . $endvolume . '_' . $startissue . '-' . $endissue . '.xml'; $m = mysqli_connect('localhost','nosc','osciLLation','nosc'); mysqli_query($m, "set character_set_results='utf8'"); mysqli_query($m, "SET NAMES 'utf8'"); mysqli_query($m, "SET CHARACTER SET utf8"); mysqli_query($m, "SET SESSION collation_connection = 'utf8_unicode_ci'"); $sql = "select distinct published_volume, published_number from Articles"; $sql = $sql . " where status=2 and published_volume >= $startvolume and published_volume <= $endvolume"; $sql = $sql . " and published_number >= $startissue and published_number <= $endissue"; $sql = $sql . " order by published_volume, published_number"; // echo $sql; $res = mysqli_query($m, $sql); // print_r($res); $out = new DOMDocument('1.0'); $out->preserveWhiteSpace = false; $out->formatOutput = true; $lang = [ 1 => "uk", 2 => "ru", 3 => "en"]; $issueId = 0; $articleId = 0; $authId = 0; $rootNode = $out->createElementNS('http://pkp.sfu.ca', "issues"); // for each year and issue while ($row = mysqli_fetch_assoc($res)) { $volume = $row['published_volume']; $issue = $row['published_number']; $year = $volume + 1997; echo "\n\n New issue" . $volume . "-" . $issue . "\n\n"; $month = 3 * $issue; if ($volume == 1) $month = 12; if ($month<10) $month="0" . $month; $datePublished = $year . "-" . $month . "-29"; $dateModified = date("Y-m-d"); // $dateSubmitted = $datePublished; $issueId++; // Issue $issueNode = $out->createElementNS('http://pkp.sfu.ca', "issue"); $issueNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $issueNode->setAttribute("published", "1"); $issueNode->setAttribute("current", "0"); $issueNode->setAttribute("access_status", "1"); // Issue Id $issueIdNode = $out->createElement("id", $issueId); $issueIdNode->setAttribute("type", "internal"); $issueIdNode->setAttribute("advice", "ignore"); $issueNode->appendChild($issueIdNode); // Issue identification $issueIdentificationNode = $out->createElement("issue_identification"); $volumeNode = $out->createElement("volume", $volume); $numberNode = $out->createElement("number", $issue); $yearNode = $out->createElement("year", $year); $issueIdentificationNode->appendChild($volumeNode); $issueIdentificationNode->appendChild($numberNode); $issueIdentificationNode->appendChild($yearNode); $issueNode->appendChild($issueIdentificationNode); // Dates $dateNode = $out->createElement("date_published", $datePublished); $issueNode->appendChild($dateNode); $lastModifiedNode = $out->createElement("last_modified", $dateModified); $issueNode->appendChild($lastModifiedNode); // Sections $sectionsNode = $out->createElement("sections"); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "ART"); $sectionNode->setAttribute("seq", "1"); $sectionNode->setAttribute("editor_restricted", "0"); $sectionNode->setAttribute("meta_indexed", "1"); $sectionNode->setAttribute("meta_reviewed", "1"); $sectionNode->setAttribute("abstracts_not_required", "0"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "1"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ART"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ART"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Articles"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Статті"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "SHT"); $sectionNode->setAttribute("seq", "2"); $sectionNode->setAttribute("editor_restricted", "0"); $sectionNode->setAttribute("meta_indexed", "1"); $sectionNode->setAttribute("meta_reviewed", "1"); $sectionNode->setAttribute("abstracts_not_required", "0"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "2"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "SHT"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "SHT"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Short communications"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Короткі повідомлення"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "IND"); $sectionNode->setAttribute("seq", "3"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "1"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "8"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "IND"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "IND"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Index"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Алфавітний покажчик"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "CHR"); $sectionNode->setAttribute("seq", "4"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "1"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "9"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "CHR"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "CHR"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Chronicles"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Хроніка"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "JUB"); $sectionNode->setAttribute("seq", "5"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "1"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "3"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "JUB"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "JUB"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Anniversaries"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Ювілеї"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "REV"); $sectionNode->setAttribute("seq", "6"); $sectionNode->setAttribute("editor_restricted", "0"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "10"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "REV"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "REV"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "BookReview"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Критика та бібліографія"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "LTR"); $sectionNode->setAttribute("seq", "7"); $sectionNode->setAttribute("editor_restricted", "0"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "11"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "LTR"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "LTR"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Letter"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Лист до редакції"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "ERR"); $sectionNode->setAttribute("seq", "8"); $sectionNode->setAttribute("editor_restricted", "0"); $sectionNode->setAttribute("meta_indexed", "1"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "12"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ERR"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ERR"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Modifications"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Поправки"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "OBT"); $sectionNode->setAttribute("seq", "9"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "4"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "OBT"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "OBT"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Obituaries"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Некрологи"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "ABS"); $sectionNode->setAttribute("seq", "10"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "0"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "13"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ABS"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ABS"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Abstracts"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Реферати"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $sectionNode = $out->createElement("section"); $sectionNode->setAttribute("ref", "ANN"); $sectionNode->setAttribute("seq", "11"); $sectionNode->setAttribute("editor_restricted", "1"); $sectionNode->setAttribute("meta_indexed", "0"); $sectionNode->setAttribute("meta_reviewed", "0"); $sectionNode->setAttribute("abstracts_not_required", "1"); $sectionNode->setAttribute("hide_title", "0"); $sectionNode->setAttribute("hide_author", "1"); $sectionNode->setAttribute("abstract_word_count", "0"); $sectionSubNode = $out->createElement("id", "14"); $sectionSubNode->setAttribute("type", "internal"); $sectionSubNode->setAttribute("advice", "ignore"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ANN"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("abbrev", "ANN"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Announcement"); $sectionSubNode->setAttribute("locale", "en"); $sectionNode->appendChild($sectionSubNode); $sectionSubNode = $out->createElement("title", "Повідомлення"); $sectionSubNode->setAttribute("locale", "uk"); $sectionNode->appendChild($sectionSubNode); $sectionsNode->appendChild($sectionNode); $issueNode->appendChild($sectionsNode); // Issue coverpage // Issue galleys $issueGalleysNode = $out->createElementNS('http://pkp.sfu.ca', "issue_galleys"); $issueGalleysNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $issueGalleysNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $issueNode->appendChild($issueGalleysNode); // Articles $articlesNode = $out->createElementNS('http://pkp.sfu.ca', "articles"); $articlesNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $articlesNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $sql = "SELECT * FROM Articles"; $sql = $sql . " WHERE status=2 AND published_volume = " . $row['published_volume'] ; $sql = $sql . " AND published_number = " . $row['published_number']; $sql = $sql . " ORDER BY published_page_start"; // Article $resArt = mysqli_query($m, $sql); $artSeq = 0; while ($rowArt = mysqli_fetch_assoc($resArt)) { // print_r($rowArt); echo $rowArt['id'] .' '; $artSeq++; $articleLocale = "uk"; if ($rowArt['language'] == 'en') $articleLocale = "en"; if ($rowArt['language'] == 'ru') $articleLocale = "ru"; $isRu = 0; if ($rowArt['language'] == 'ru') $isRu = 1; $dateSubmitted = $rowArt['received']; if (!$dateSubmitted or $dateSubmitted == '0000-00-00') $dateSubmitted = $datePublished; // Create article $articleNode = $out->createElementNS('http://pkp.sfu.ca', "article"); $articleNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $articleNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $articleNode->setAttribute("date_submitted", $dateSubmitted); $articleNode->setAttribute("status", "3"); $articleNode->setAttribute("submission_progress", "0"); $articleNode->setAttribute("current_publication_id", $rowArt['id']); $articleNode->setAttribute("stage", "production"); // Article id $articleIdNode = $out->createElement('id', $rowArt['id']); $articleIdNode->setAttribute("type", "internal"); $articleIdNode->setAttribute("advice", "ignore"); $articleNode->appendChild($articleIdNode); // Submission files $basepath = '/home/nosc/public_html/admin/private/'; $publishedFiles = $basepath . 'published_files/'; $subdir = $rowArt['id']; $dirpath = $publishedFiles . $subdir . '/'; // echo "\n article files path ". $dirpath . "\n"; $files = array_slice(scandir($dirpath), 2); // echo "total files " . count($files) . "\n"; $filename = ""; $path = ""; $amsFilename = ""; if (count($files)) { $filename = array_pop($files); $path = $dirpath . $filename; // echo "\nfile " . $filename . " at " . $path . "\n"; } // for recent articles look for secret place if ($volume > 25) { $amsDir = "/home/nosc/public_html/ams/" . $year . "-" . $issue . "/"; $amsFiles = array_slice(scandir($amsDir), 4); $amsFilename = $amsFiles[$artSeq-1]; // echo "\nAMS file " . $amsFilename ."\n"; if ($filename == "") { $filename = $amsFilename; $path = $amsDir . $filename; } } // echo $path ."\n"; if ($filename == "") echo "\nNo file for article " . $rowArt['id'] . "\n"; /* // find revisions $q = "SELECT * FROM Revisions WHERE article_id='".$rowArt['id']."' ORDER BY created DESC,id DESC,revision_received DESC"; $resRev= mysqli_query($m, $q); $lastRev = mysqli_fetch_assoc($resRev)['id']; //$q = "SELECT * FROM Revisions WHERE article_id='" . $rowArt['id'] . "' ORDER BY created,id,revision_received"; //$resSub = mysqli_query($m, $q); //$num=0; //while ($r= mysqli_fetch_assoc($resSub)){ // $num++; // if ($r["id"]==$lastRev) break; //} $revisionFiles = $basepath . "manuscripts/" . $lastRev . "/"; echo $revisionFiles . "\n"; if ($volume>25) { $files = array_slice(scandir($revisionFiles), 2); echo "total files " . count($files) . "\n"; while ($f = array_pop($files)) { $revFilename = $f; $revPath = $dirpath . $revFilename; echo "\nfile " . $revFilename . " at " . $revPath . "\n"; } } $revNumber = $rowArt['id'] . "-" . $num . "-" . $lastRev; // echo "\n Revision " . $revNumber . "\n"; */ if($filename){ // $path = $dirpath . $rowArt['article_pdf']; // $filename = basename($path); $size = filesize($path); // echo $size; if($size){ $contents = file_get_contents($path); $submissionNode = $out->createElementNS('http://pkp.sfu.ca', 'submission_file'); $submissionNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $submissionNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $submissionNode->setAttribute('stage', 'proof'); $submissionNode->setAttribute('id', $rowArt['id']); $submissionNode->setAttribute('file_id', $rowArt['id']); $submissionNode->setAttribute('genre', 'Article text (PDF)'); $submissionNode->setAttribute('viewable', 'true'); $submissionNode->setAttribute('created_at', date("Y-m-d")); $submissionNode->setAttribute('updated_at', date("Y-m-d")); $submissionNode->setAttribute('uploader', 'admin'); $nameNode = $out->createElement('name', 'Imported: ' . $filename); $nameNode->setAttribute('locale', 'en'); $submissionNode->appendChild($nameNode); $nameNode = $out->createElement('name', 'Імпортовано: ' . $filename); $nameNode->setAttribute('locale', 'uk'); $submissionNode->appendChild($nameNode); $fileNode =$out->createElement('file'); $fileNode->setAttribute('id', $rowArt['id']); //$fileNode->setAttribute('filename', $rowArt['article_pdf']); $fileNode->setAttribute('filesize', $size); $fileNode->setAttribute('extension', 'pdf'); $embedNode = $out->createElement('embed'); $embedNode->setAttribute('encoding', 'base64'); $embedNode->nodeValue = base64_encode($contents); $fileNode->appendChild($embedNode); $submissionNode->appendChild($fileNode); $articleNode->appendChild($submissionNode); } } // Create publication $publicationNode = $out->createElementNS('http://pkp.sfu.ca', "publication"); $publicationNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $publicationNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); // $publicationNode->setAttribute("locale", $articleLocale); $publicationNode->setAttribute("version", "1"); $publicationNode->setAttribute("status", "3"); $publicationNode->setAttribute("primary_contact_id", 1); $publicationNode->setAttribute("seq", $artSeq); $publicationNode->setAttribute("date_submitted", $dateSubmitted); $publicationNode->setAttribute("date_published", $datePublished); $publicationNode->setAttribute("section_ref", 'ART'); $publicationNode->setAttribute("access_status", "0"); // Publication id $publicationIdNode = $out->createElement('id', $rowArt['id']); $publicationIdNode->setAttribute("type", "internal"); $publicationIdNode->setAttribute("advice", "ignore"); $publicationNode->appendChild($publicationIdNode); // Publication doi $doi = ""; if ($filename and $volume>25) { $doiCommand = '/usr/bin/pdftotext "' . $path . '" - |head -n1 |grep ^DOI |cut -d" " -f2'; // echo $doiCommand; $doi = shell_exec($doiCommand); echo $doi; } $publicationDOINode = $out->createElement('id', $doi); $publicationDOINode->setAttribute("type", "doi"); $publicationDOINode->setAttribute("advice", "update"); if ($doi) $publicationNode->appendChild($publicationDOINode); // Title $pattern[0] = '/\[tex\]\s*\$*/'; $pattern[1] = '/\$*\s*\[\/tex\]/'; $replacement = '$'; $data = preg_replace($pattern,$replacement,$rowArt['title_ua']); $articleTitleNode = $out->createElement('title'); $cdata = $out->createCDATASection($data); $articleTitleNode->appendChild($cdata); $articleTitleNode->setAttribute("locale", "uk"); $publicationNode->appendChild($articleTitleNode); $data = preg_replace($pattern,$replacement,$rowArt['title_en']); $articleTitleNode = $out->createElement('title'); $cdata = $out->createCDATASection($data); $articleTitleNode->appendChild($cdata); $articleTitleNode->setAttribute("locale", "en"); $publicationNode->appendChild($articleTitleNode); $data = preg_replace($pattern,$replacement,$rowArt['title_ru']); $articleTitleNode = $out->createElement('title'); $cdata = $out->createCDATASection($data); $articleTitleNode->appendChild($cdata); $articleTitleNode->setAttribute("locale", "ru"); $publicationNode->appendChild($articleTitleNode); // Abstract $data = $rowArt['abstract']; $data = preg_replace('/<[\/]*a[^>]*>/i', '', $data); $articleAbstractNode = $out->createElement('abstract'); $cdata = $out->createCDATASection($data); $articleAbstractNode->appendChild($cdata); $articleAbstractNode->setAttribute("locale", "en"); $publicationNode->appendChild($articleAbstractNode); $articleAbstractNode = $out->createElement('abstract'); $cdata = $out->createCDATASection($data); $articleAbstractNode->appendChild($cdata); $articleAbstractNode->setAttribute("locale", "uk"); $publicationNode->appendChild($articleAbstractNode); // Copyright $articleCopyrightHolderEnNode = $out->createElement('copyrightHolder'); $articleCopyrightHolderEnNode->setAttribute("locale", "en"); $publicationNode->appendChild($articleCopyrightHolderEnNode); $articleCopyrightHolderUkNode = $out->createElement('copyrightHolder'); $articleCopyrightHolderUkNode->setAttribute("locale", "uk"); $publicationNode->appendChild($articleCopyrightHolderUkNode); $articleCopyrightYearNode = $out->createElement('copyrightYear', $year); $publicationNode->appendChild($articleCopyrightYearNode); // Keywords (not present) $data = ''; $keyWordsEn = preg_split('/,/', $data); // print_r($keyWords); $keywordsNode = $out->createElement("keywords"); $keywordsNode->setAttribute("locale", "en"); foreach($keyWordsEn as $keyword){ $keyword = trim($keyword, " .,"); $keywordNode = $out->createElement("keyword", $keyword); $keywordsNode->appendChild($keywordNode); } // $publicationNode->appendChild($keywordsNode); $keyWordsUk = preg_split('/,/', $data); $keywordsNode = $out->createElement("keywords"); $keywordsNode->setAttribute("locale", "uk"); foreach($keyWordsUk as $keyword){ $keyword = trim($keyword, " .,"); $keywordNode = $out->createElement("keyword", $keyword); $keywordsNode->appendChild($keywordNode); } // $publicationNode->appendChild($keywordsNode); // Authors $authorsNode = $out->createElementNS('http://pkp.sfu.ca', "authors"); $authorsNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $authorsNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); // $authSeq = 0; $sql = "SELECT * FROM AA LEFT JOIN Authors ON AA.author_id=Authors.id WHERE AA.article_id=" . $rowArt['id'] . " ORDER BY AA.author_ambition"; $resAuth = mysqli_query($m, $sql); if (mysqli_num_rows($resAuth) == 0) { echo "\nNo authors for " . $rowArt["id"] . "!\n"; if ($rowArt['id'] == 911 or $rowArt['id'] == 968 or $rowArt['id'] == 1334){ //Mitropolsky died //Samoilenko 75 //Samoilenko died $authorNode = $out->createElement('author'); $authorNode->setAttribute('include_in_browse', 'true'); $authorNode->setAttribute('user_group_ref', 'Author'); $authorNode->setAttribute('seq', 1); $authorNode->setAttribute('id', 0); $givenNameNode = $out->createElement('givenname', 'Editorial Board'); $givenNameNode->setAttribute('locale','en'); $authorNode->appendChild($givenNameNode); $givenNameNode = $out->createElement('givenname', 'Редколегія'); $givenNameNode->setAttribute('locale','uk'); $authorNode->appendChild($givenNameNode); $givenNameNode = $out->createElement('givenname', 'Editorial Board'); $givenNameNode->setAttribute('locale','ru'); $authorNode->appendChild($givenNameNode); // Country $countryNode = $out->createElement('country', 'UA'); $authorNode->appendChild($countryNode); $emailNode = $out->createElement('email', 'nosc@imath.kiev.ua'); $authorNode->appendChild($emailNode); $authorNode->appendChild($emailNode); $authorsNode->appendChild($authorNode); } // die; } $authorsEn = []; $authorsUa = []; $authorsRu = []; while ($rowAuth = mysqli_fetch_assoc($resAuth)) { // $authSeq++; $authId++; $familyNameEn = $rowAuth['last_name_en']; // if($nameParts[0] == "Board") $familyNameEn = $familyNameEn . array_shift($nameParts); $givenNameEn = $rowAuth['first_name_en'] . ' ' . $rowAuth['middle_name_en']; if ($givenNameEn == ""){ $givenNameEn = $familyNameEn; $familyNameEn = ""; } if ($givenNameEn == ""){ echo "No English name for author " . $rowAuth['id']; // die; } $nameEn = $rowAuth['short_name_en']; if (!$nameEn) $nameEn = $givenNameEn . ' ' . $familyNameEn; array_push($authorsEn, $nameEn); $familyNameUa = $rowAuth['last_name_ua']; // if($nameParts[0] == "Board") $familyNameEn = $familyNameEn . array_shift($nameParts); $givenNameUa = $rowAuth['first_name_ua'] . ' ' . $rowAuth['middle_name_ua']; if ($givenNameUa == ""){ $givenNameUa = $familyNameUa; $familyNameUa = ""; } if ($givenNameUa == ""){ echo "No Ukrainian name for author " . $rowAuth['id']; // die; } $nameUa = $rowAuth['short_name_ua']; if (!$nameUa) $nameUa = $givenNameUa . ' ' . $familyNameUa; array_push($authorsUa, $nameUa); $familyNameRu = $rowAuth['last_name_ru']; // if($nameParts[0] == "Board") $familyNameEn = $familyNameEn . array_shift($nameParts); $givenNameRu = $rowAuth['first_name_ru'] . ' ' . $rowAuth['middle_name_ru']; if ($givenNameRu == ""){ $givenNameRu = $familyNameRu; $familyNameRu = ""; } if ($givenNameRu == ""){ echo "No Russian name for author " . $rowAuth['id']; } $nameRu = $rowAuth['short_name_ru']; if (!$nameRu) $nameRu = $givenNameRu . ' ' . $familyNameRu; array_push($authorsRu, $nameRu); $authorNode = $out->createElement('author'); // $authorNode->setAttribute('primary_contact', 'true'); $authorNode->setAttribute('include_in_browse', 'true'); $authorNode->setAttribute('user_group_ref', 'Author'); $authSeq = $rowAuth['author_ambition']; $authorNode->setAttribute('seq', $authSeq); $authorNode->setAttribute('id', $authId); $givenNameNode = $out->createElement('givenname', $givenNameEn); $givenNameNode->setAttribute('locale','en'); $authorNode->appendChild($givenNameNode); $givenNameNode = $out->createElement('givenname', $givenNameUa); $givenNameNode->setAttribute('locale','uk'); $authorNode->appendChild($givenNameNode); $givenNameNode = $out->createElement('givenname', $givenNameRu); $givenNameNode->setAttribute('locale','ru'); $authorNode->appendChild($givenNameNode); $familyNameNode = $out->createElement('familyname', $familyNameEn); $familyNameNode->setAttribute('locale','en'); $authorNode->appendChild($familyNameNode); $familyNameNode = $out->createElement('familyname', $familyNameUa); $familyNameNode->setAttribute('locale','uk'); $authorNode->appendChild($familyNameNode); $familyNameNode = $out->createElement('familyname', $familyNameRu); $familyNameNode->setAttribute('locale','ru'); $authorNode->appendChild($familyNameNode); // Affiliation $sql = "SELECT * FROM AI LEFT JOIN Institutions ON AI.institution_id=Institutions.id WHERE AI.author_id=" . $rowAuth['id'] . " ORDER BY AI.institution_ambition"; $resInst = mysqli_query($m, $sql); if (mysqli_num_rows($resInst) == 0) { echo "\nNo affiliation for author " . $rowAuth["id"] . "!\n"; } else { $rowInst = mysqli_fetch_assoc($resInst); $affiliationNode = $out->createElement('affiliation'); // EN $affiliation = ''; if ($rowInst['name_gen_en']) $affiliation = $affiliation.$rowInst["name_gen_en"]; if ($rowInst['name_en']) { if ($rowInst['name_gen_en']) $affiliation = $affiliation . "; "; $affiliation = $affiliation . $rowInst["name_en"]; } $affiliationNameNode = $out->createElement('name'); $cdata = $out->createCDATASection($affiliation); $affiliationNameNode->appendChild($cdata); $affiliationNameNode->setAttribute('locale','en'); $affiliationNode->appendChild($affiliationNameNode); // UK $affiliation = ''; if ($rowInst['name_gen_ua']) $affiliation = $affiliation.$rowInst["name_gen_ua"]; if ($rowInst['name_ua']) { if ($rowInst['name_gen_ua']) $affiliation = $affiliation . "; "; $affiliation = $affiliation . $rowInst["name_ua"]; } $affiliationNameNode = $out->createElement('name'); $cdata = $out->createCDATASection($affiliation); $affiliationNameNode->appendChild($cdata); $affiliationNameNode->setAttribute('locale','uk'); $affiliationNode->appendChild($affiliationNameNode); // RU $affiliation = ''; if ($rowInst['name_gen_ru']) $affiliation = $affiliation.$rowInst["name_gen_ru"]; if ($rowInst['name_ru']) { if ($rowInst['name_gen_ru']) $affiliation = $affiliation . "; "; $affiliation = $affiliation . $rowInst["name_ru"]; } $affiliationNameNode = $out->createElement('name'); $cdata = $out->createCDATASection($affiliation); $affiliationNameNode->appendChild($cdata); $affiliationNameNode->setAttribute('locale','ru'); $affiliationNode->appendChild($affiliationNameNode); $authorNode->appendChild($affiliationNode); } // Country $country = $rowInst['country']; $countryNode = $out->createElement('country', $country); $authorNode->appendChild($countryNode); // Email $sql = "SELECT * FROM Emails where person_id=" . $rowAuth['id'] . " order by id DESC"; $resE = mysqli_query($m,$sql); $rowE = mysqli_fetch_assoc($resE); if($rowE){ $emailNode = $out->createElement('email', $rowE['email_field']); $authorNode->appendChild($emailNode); } else { $emailNode = $out->createElement('email', 'unknown'); echo "\nNo email for Author" . $rowAuth['id'] . "!\n"; } $authorNode->appendChild($emailNode); // URL $url = htmlspecialchars($rowAuth['homepage']); $urlNode = $out->createElement('url'); if ($url) $authorNode->appendChild($urlNode); $authorsNode->appendChild($authorNode); } $articleCopyrightHolderEnNode->nodeValue = implode("; ", $authorsEn); $articleCopyrightHolderUkNode->nodeValue = implode("; ", $authorsUa); $publicationNode->appendChild($authorsNode); // echo implode("; ", $authorsEn); // Article galleys $galleyNode = $out->createElementNS('http://pkp.sfu.ca', 'article_galley'); $galleyNode->setAttribute("xmlns:xsi", 'http://www.w3.org/2001/XMLSchema-instance'); $galleyNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $galleyNode->setAttribute('approved', 'true'); $galleyNode->setAttribute('locale', $articleLocale); $galleyIdNode = $out->createElement('id', $rowArt['id']); $galleyIdNode->setAttribute('type', 'internal'); $galleyIdNode->setAttribute('advice', 'ignore'); $galleyNode->appendChild($galleyIdNode); $galleyNameNode = $out->createElement('name', 'PDF'); $galleyNameNode->setAttribute('locale', 'en'); $galleyNode->appendChild($galleyNameNode); $galleyNameNode = $out->createElement('name', 'PDF'); $galleyNameNode->setAttribute('locale', 'uk'); $galleyNode->appendChild($galleyNameNode); $galleySeqNode = $out->createElement('seq', '0'); $galleyNode->appendChild($galleySeqNode); $galleySubNode = $out->createElement('submission_file_ref'); $galleySubNode->setAttribute('id', $rowArt['id']); $galleyNode->appendChild($galleySubNode); if($filename) $publicationNode->appendChild($galleyNode); // Pages $pagesNode = $out->createElement('pages', $rowArt['published_page_start'] . '-' . $rowArt['published_page_end'] ); $publicationNode->appendChild($pagesNode); $articleNode->appendChild($publicationNode); $articlesNode->appendChild($articleNode); $articlesNode->appendChild($articleNode); // Citations // $data = $rowArt['article_references']; // $data = str_replace("\r", "", $data); // $data = str_replace("\n", "", $data); // echo $data; // $citations = preg_split("|<li>|",$data); // $cite = new DOMDocument(); // $cite->loadHTML($data); // $xpath = new DOMXpath($cite); // $citations = $xpath->query('cite'); // print_r($citations); // $citationsNode = $out->createElement("citations"); // foreach($citations as $citation){ // $citation = trim($citation, " .,"); // $citationNode = $out->createElement("citation", $citation); // $citationsNode->appendChild($citationNode); // } // if ($rowArt['article_references']) $publicationNode->appendChild($citationsNode); } $issueNode->appendChild($articlesNode); $rootNode->appendChild($issueNode); } $rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', "xmlns:xsi" , 'http://www.w3.org/2001/XMLSchema-instance'); $rootNode->setAttribute('xsi:schemaLocation', "http://pkp.sfu.ca native.xsd"); $out->appendChild($rootNode); $out->save($outFile); // echo $out->saveXML(); die;
Simpan