Ejemplo n.º 1
0
 if (EJHSFormValidator::checkIfFileIsUploaded($_FILES)) {
     ## Check the file is JPEG OR GIF > If Nto Set errmsg
     if (!EJHSFormValidator::validateJPEG($_FILES)) {
         $errmsg .= "Selected File As Cover Page Should Be Of Type: JPEG Or GIF";
     } else {
         $fileIsUploaded = TRUE;
     }
 }
 if ($errmsg == '') {
     $new_upload_dir = "Volume-" . $vol . "-Num" . $num;
     ## Journal Location Not Changed, and New Journal Information Does Not Exist
     if (EJHSJournal::checkIfUploadLocationIsChanged($updateID, $new_upload_dir) && !EJHSJournal::checkIfJournalExists($vol, $num)) {
         $create_dir = "Volume-" . $vol . "-Num" . $num;
         $old_upload_dir = EJHSJournal::getUploadDir($updateID);
         ##OLD UPLOAD DIR
         EJHSJournal::recursiveCopy($old_upload_dir . '/', $new_upload_dir . '/');
         EJHSJournal::deleteFiles($old_upload_dir);
         ## DELETE OLD DIR WITH CONTENTS
         $upload_dir = $new_upload_dir;
     }
     ## RENAME and UPLOAD
     if ($fileIsUploaded) {
         $fullFileName = explode(".", $_FILES["cover"]["name"]);
         $ext = $fullFileName[1];
         $fileName = "Volume-" . $vol . "-Num-" . $num . "-cover-page" . "." . $ext;
         EJHSJournal::renameAndUpload($_FILES, $new_upload_dir, $fileName);
     }
     ## DEALL With Table Updates
     if (EJHSJournal::update($year_of_edition, $month, $vol, $num, $issn, $eissn, $new_upload_dir, $fileName, $updateID) && EJHSJournalArticle::updateArticleUploadDir($updateID, $new_upload_dir)) {
         $_SESSION['notice1'] = "Journal Update Was Successful.";
         header('location: journal_edit.php');
Ejemplo n.º 2
0
 public static function recursiveCopy($src, $dst)
 {
     @mkdir($dst);
     $dir = opendir($src);
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($src . '/' . $file)) {
                 EJHSJournal::recursiveCopy($src . '/' . $file, $dst . '/' . $file);
             } else {
                 copy($src . '/' . $file, $dst . '/' . $file);
             }
         }
     }
     closedir($dir);
 }
Ejemplo n.º 3
0
 }
 if ($year_of_edition == '') {
     $errmsg .= "Year of Edition should be selected <br />";
 }
 if ($issn == '') {
     $errmsg .= " ISSN Field should be entered. <br />";
 }
 if ($errmsg == '') {
     $new_upload_dir = "Volume-" . $vol . "-Num" . $num;
     ## Journal Location Not Changed, and New Journal Information Does Not Exist
     if (!EJHSJournal::checkIfJournalExists($vol, $num)) {
         $journalExists = FALSE;
         $create_dir = "Volume-" . $vol . "-Num" . $num;
         $old_upload_dir = EJHSJournal::getUploadDir($updateID);
         ##OLD UPLOAD DIR
         EJHSJournal::recursiveCopy($old_upload_dir, $new_upload_dir);
         EJHSJournal::deleteFiles($old_upload_dir);
         ## DELETE OLD DIR WITH CONTENTS
     }
     if ($journalExists) {
         $vol = NULL;
         $num = NULL;
         //$new_upload_dir		= NULL;
     }
     if (EJHSJournal::update($year_of_edition, $month, $vol, $num, $issn, $eissn, $new_upload_dir, $updateID) && EJHSJournalArticle::updateArticleUploadDir($new_upload_dir, $updateID)) {
         $_SESSION['notice1'] = "Journal Update Was Successful. ";
         header('location: journal_edit.php');
     } else {
         echo mysql_error() . "It Seems Like There Are Errors";
     }
 }