<?php
class filesManager {
    var $_file;
    var $_namefile;
    var $_type;
    
    public function __construct($namefile) {
        $this->_file = $namefile;
        $this->_namefile = substr($this->_file, 0 , strrpos($this->_file, "."));
        $this->_type = strtolower(substr($this->_file, strrpos($this->_file, ".")+1, strlen($this->_file)));
    }
    
    public function getExtension(){
        return $this->_type;
    }
    
    public function getName(){
        return $this->_namefile;
    }
    
    public function isImage(){
        switch($this->_type){
            case "jpg": $flag = TRUE;
                break;
            case "png": $flag = TRUE;
                break;
            case "bmp": $flag = TRUE;
                break;
            case "gif": $flag = TRUE;
                break;
            default : $flag = FALSE;
                break;
        }
        return $flag;
    }
    
    public function isDoc(){
        switch($this->_type){
            case "doc": $flag = TRUE;
                break;
            case "docx": $flag = TRUE;
                break;
            case "pdf": $flag = TRUE;
                break;
            case "odt": $flag = TRUE;
                break;
            case "txt": $flag = TRUE;
                break;
            default : $flag = FALSE;
                break;
        }
        return $flag;
    }
    
    public function isZip(){
        switch($this->_type){
            case "zip": $flag = TRUE;
                break;
            case "arc": $flag = TRUE;
                break;
            case "arj": $flag = TRUE;
                break;
            case "bin": $flag = TRUE;
                break;
            case "dmg": $flag = TRUE;
                break;
            case "gz": $flag = TRUE;
                break;
            case "gzip": $flag = TRUE;
                break;
            case "tar": $flag = TRUE;
                break;
            case "z": $flag = TRUE;
                break;
            case "rar": $flag = TRUE;
                break;
            case "7z": $flag = TRUE;
                break;
            default : $flag = FALSE;
                break;
        }
        return $flag;
    }
}
?>
