PHP Classes

File: class/gestor_articulos.php

Recommend this page to a friend!
  Classes of Javier AP   Pergamus Publication Manager   class/gestor_articulos.php   Download  
File: class/gestor_articulos.php
Role: Auxiliary script
Content type: text/plain
Description: Publication handling functions
Class: Pergamus Publication Manager
Web based manager for scientific publications
Author: By
Last change: Directory path added to filename
Date: 19 years ago
Size: 1,463 bytes
 

Contents

Class file image Download
<?php
function form_validation($year,$campos){
   foreach(
$campos as $valor){
      if(
$valor == '')
    return
'Remember to fill all the bold fields.';
   }
  
$file = '../docs/'.$_FILES['archivo']['name'];
   if(!
eregi("^[0-9][0-9][0-9][0-9]$", $year)){
       return
'The field \'year\' must contain four digits';
   } else if(
$_FILES['archivo']['name'] != "" && !eregi(".*\.(pdf|ps)", $_FILES['archivo']['name'])){
       return
'The file must be PDF or PostScript.';
   } else if(
$update_file != 'true' && file_exists($file) && $_FILES['archivo']['name'] != '') {
       return
'There\'s already a file with that name. Retry with renaming your file.';
   } else {
       return
'valid';
   }
}

function
get_section_title($pub_type){
    switch(
$pub_type){
        case
'InProceedings':
            return
'An article in a conference proceedings';
        case
'Article':
            return
'An article from a journal or magazine';
        case
'TechReport':
            return
'A report published by a school or other institution';
        case
'PhDThesis':
            return
'A PhD thesis';
        case
'Book':
            return
'A book with an explicit publisher';
        case
'InBook':
            return
'A chapter of a book';
    }
}

function
copy_file($file,$uploaddir){
   
$uploadfile = $uploaddir.$_FILES[$file]['name'];
   
move_uploaded_file($_FILES[$file]['tmp_name'], $uploadfile);
}

function
remove_file($archivo, $uploaddir){
   
$uploadfile = $uploaddir.$archivo;
   
unlink($uploadfile);
}
?>