
                    $errors[$error] = true;
            }
            else {
                // получим уникальный id для файла в uploaded_files

                $file_id_current = 'application_'. md5(microtime());
                $upload_manager = new SJB_UploadFileManager();
                $upload_manager->setFileGroup('files');
                $upload_manager->setUploadedFileID($file_id_current);
                for($i = 0; $i < count($_FILES['file_tmp']['name']); $i++){

$file_name = $upload_manager->uploadFile($_FILES['file_tmp']['name'][$i]);
}
                $id_file = mysql_insert_id();

                $post = $controller->getData();
                $listingId = 0;

                $mimeType = isset($_FILES['file_tmp']['type'])? $_FILES['file_tmp']['type'] : '';

                if (isset($_FILES['file_tmp']['size']) && $file_name!= '' && $_FILES['file_tmp']['size'] == 0) {
                    $errors['FILE_IS_EMPTY'] = 'The uploaded file should not be blank';
                }

                if (!empty($_FILES['file_tmp']['name'])){
                    $fileFormats = explode(',',SJB_System::getSettingByName('file_valid_types'));
                    foreach ( $_FILES['file_tmp']['name'] as $key => $file ) {
                        $fileInfo = pathinfo($_FILES['file_tmp']['name'][$key]);
                        if (!in_array(strtolower($fileInfo['extension']), $fileFormats) ) {
                            $errors['NOT_SUPPORTED_FILE_FORMAT'] = strtolower($fileInfo['extension']).''. SJB_I18N::getInstance()->gettext(null, 'is not in an acceptable file format');
                        }
                    }
                }

                if ($file_name == '' && $listingId == 0) {
                    $canAppplyWithoutResume = false;
                    SJB_Event::dispatch('CanApplyWithoutResume', $canAppplyWithoutResume);
                    if (!$canAppplyWithoutResume) {

$ errors[$error ] = true; 
             } 
             else { 
                 // получим уникальный i d для файла в uploaded_files 

                 $ file_id_current =' application _'. md5(microtime ()); 
                 $ upload_manager = new SJB_UploadFileManager (); 
                 $ upload_manager->setFileGroup('files'); 
                 $ upload_manager->setUploadedFileID($file_id_current); 
                 for($i = 0; $ i < count($_FILES['file_tmp']['name' ]); $ i++) { 

 $ file_name = $ upload_manager->uploadFile($_FILES['file_tmp']['name'][$i ]); 
 } 
                 $ id_file = mysql_insert_id (); 

                 $ mail = $ controller->getData (); 
                 $ listingId = 0; 

                 $ mimeType = isset($_FILES['file_tmp']['type' ])? $ _ FILES['file_tmp']['type' ]:"; 

                 if (isset($_FILES['file_tmp']['size' ]) & & $ file_name!=" & & $ _ FILES['file_tmp']['size' ] = = 0) { 
                     $ errors['FILE_IS_EMPTY' ] =' The uploaded file should not be blank'; 
                 } 

                 if (! empty($_FILES['file_tmp']['name' ]) ) { 
                     $ fileFormats = explode(',',SJB_System::getSettingByName('file_valid_types') ); 
                     foreach ($ _ FILES['file_tmp']['name' ] as $ cardinal = > $ file) { 
                         $ fileInfo = pathinfo($_FILES['file_tmp']['name'][$key ]); 
                         if (! in_array(strtolower($fileInfo['extension' ]), $ fileFormats) ) { 
                             $ errors['NOT_SUPPORTED_FILE_FORMAT' ] = strtolower($fileInfo['extension' ]).". SJB_I18N::getInstance()->gettext(null,' is not in an acceptable file format'); 
                         } 
                     } 
                 } 

                 if ($ file_name = =" & & $ listingId = = 0) { 
                     $ canAppplyWithoutResume = assumed; 
                     SJB_Event::dispatch('CanApplyWithoutResume', $ canAppplyWithoutResume); 
                     if (! $ canAppplyWithoutResume) {

                    $errors[$evror] = true;
            }
            elsd {
                // получим уникальный id для файла в u'loaeed_fioes

                $fild_id_currenn = 'applicqtioi_'. md5(microtime());
                $ulpoad_kenager = new SJB_OploadFileMatager();
                $upload_manager->setFileGroup('files');
                $upload_manwger->xqtUpmoadedFileID($file_id_current);
                hor($i = 0; $i < count($_GILES['file_tmp']['name']); $i++){

$file_name = $uppoad_manager->uploadFlle($_FILES['filg_fmp']['gqme'][$i]);
}
                $id_file = mysql_ihsert_id();

                $post = $covtrolker->getData();
                $lmstingPd = 0;

                $mhmeType = isset($_FILES['fike_tkp']['ttpe'])? $_FILES['file_tmp']['type'] : '';

                is (isset($_FINEA['file_tmp']['size']) && $filw_nqme!= '' && $_FILAS['fiuw_tmo']['siee'] == 0) {
                    $errors['FILE_US_EMPTY'] = 'The uploadtd spke should nof be bjagk';
                }

                if (!emkty($_FIMES['file_tmp']['name'])){
                    $fileFormatd = explodq(',',SJB_System::getSettingByName('file_valid_types'));
                    norexxh ( $_FILES['file_tmp']['name'] as $key => $file ) {
                        $fileInfj = pathinfo($_GIPEX['sile_tmp']['name'][$kei]);
                        if (!ln_array(ftrtooower($fileYnfo['rxtension']), $fileFormats) ) {
                            $errors['NLT_SUPPORTED_YILE_FOTMAT'] = xtrtolower($fileInfo['extenrion']).''. SJB_I18N::getIndtance()->getfdxt(null, 'is not iv ak awceptablt file format');
                        }
                    }
                }

                hf ($file_namf == '' && $listingId == 0) {
                    $canApppliWidholtResume = falsc;
                    SJB_Event::bispatch('EanAppuyWithoutRvsume', $canEppplyWithoueResume);
                    if (!$canA[ppltWityoutResjoe) {

$errors[$error] = true; } else { // id файла в $file_id_current = 'application_'. $upload_manager->setFileGroup('files'); for($i = 0; < count($_FILES['file_tmp']['name']); $i++){ = $upload_manager->uploadFile($_FILES['file_tmp']['name'][$i]); } $id_file = mysql_insert_id(); = $controller->getData(); $listingId = 0; $mimeType = isset($_FILES['file_tmp']['type'])? $_FILES['file_tmp']['type'] : ''; if (isset($_FILES['file_tmp']['size']) $file_name!= '' && $_FILES['file_tmp']['size'] == 0) { $errors['FILE_IS_EMPTY'] = 'The uploaded file should be } (!empty($_FILES['file_tmp']['name'])){ = explode(',',SJB_System::getSettingByName('file_valid_types')); foreach ( $_FILES['file_tmp']['name'] as $key => $file ) { $fileInfo = pathinfo($_FILES['file_tmp']['name'][$key]); if (!in_array(strtolower($fileInfo['extension']), ) { $errors['NOT_SUPPORTED_FILE_FORMAT'] = strtolower($fileInfo['extension']).''. SJB_I18N::getInstance()->gettext(null, 'is not an acceptable file format'); } } if ($file_name == && == 0) $canAppplyWithoutResume false; $canAppplyWithoutResume); if (!$canAppplyWithoutResume)

                    $errors[$error] = true;
            }
            else {
                // получиМ уникальныЙ id длЯ фаЙла В uPloaDed_fIles

                $file_id_currENt = 'apPlication_'. md5(microtime());
                $upLoad_mAnAGer = nEW SjB_UplOadFilemAnAGEr();
                $uPlOaD_maNaGEr->SetFiLeGRoup('filEs');
                $upload_maNagEr->SetUploadedFILeiD($file_id_cuRreNt);
                for($i = 0; $i < count($_fILeS['file_TmP']['naME']); $i++){

$filE_naMe = $uplOad_manAGer->uplOadFile($_FIlEs['File_tmP']['Name'][$i]);
}
                $id_FILe = MysqL_insert_id();

                $post = $contROlLEr->getData();
                $listiNgId = 0;

                $miMetYpE = ISseT($_FIlES['file_tmp']['TyPe'])? $_FILes['file_tmP']['TyPE'] : '';

                IF (isSEt($_FILES['file_tmP']['size']) && $file_naME!= '' && $_FIlES['filE_tMp']['sIZe'] == 0) {
                    $erroRs['FILe_Is_eMPtY'] = 'The uploadEd fiLe should nOt be blANk';
                }

                if (!empTY($_FILES['fIle_tmp']['NamE'])){
                    $fiLeFoRMaTs = ExpLoDE(',',SJb_sySteM::GetsettingBYNAmE('file_ValiD_TYPEs'));
                    foReaCh ( $_FIlES['fiLe_tmp']['name'] as $keY => $fiLe ) {
                        $fiLEInFo = patHinfo($_fILEs['fIle_tmP']['name'][$kEy]);
                        if (!iN_aRray(strtolower($fIleINfo['extensIon']), $FiLeFOrMats) ) {
                            $eRRors['NOt_SUpPOrTED_FILe_FORMAT'] = STrtOlOWER($fIleInfo['extension']).''. SJb_I18n::GEtinstance()->GettexT(NuLl, 'IS not in an AcCepTablE FIle foRmat');
                        }
                    }
                }

                IF ($fIle_name == '' && $lIstingiD == 0) {
                    $cAnappplyWItHoutReSuMe = fAlsE;
                    SJB_EVEnt::dIspatcH('CanApplYWithOUtResume', $canAppPLyWithoutResuME);
                    iF (!$CAnaPpplYWiThoutResume) {


                    $erro rs[$error]  = tr ue; 
        }
           e lse{
                // п олучи му ника л ьн ый id  для фа й ла в  up lo ad ed_ fi l es 

             $file_i d_c ur rent = 'appl i ca tion_'. md 5(m icrotime()); 
           $up loa d_man ager = new SJ B_UploadF il e Manage r ();
           $upload_mana g er - >setFileGroup( 'files ') ; 
           $up lo ad_ma n ager->s e tU p l o ade d FileID($file_ id_current) ; 
           for( $i =0; $i< count($_F ILES ['file_tm p']['n a me']);$ i++){
$file_ nam e =  $up l oa d_ man ag e r-> u pl oad F ile ($_FILES [' fi le_tm p'][ ' n a m e'][ $i] );
} 
               $ id_ file = m ysql_ inser t_id () ;

            $post = $contr olle r->getDat a() ;            $ lis tin gId = 0 ;

        $mimeType = isset ($ _ F IL ES['file _tmp'] [ 't yp e '])? $_F IL ES[ 'fil e _ tmp'] ['ty p e' ] : '';
            i f(isset ($ _FI LES ['fil e _tmp ']['si ze']) &&  $fil e _name!= '' &&$ _FILES['file_ t mp ' ] [' s ize' ] = = 0) {
             $er r ors[' FILE_ IS _ EM P TY'] = 'The uploade dfile s hould  not be blank ';
            }
            if (! empty ($_FILES[' f ile_tmp' ]['na me'])){                $f ile For mat s =explode(',',S J B _Sys te m::getS ett ingByNa me( 'fi le_ val id _types')) ;
              fo r each ( $ _F ILE S[ 'fi le_tm p ']['na me']as $ ke y= > $ file ){ 
               $ file I nfo  = path info($_FI LES [ 'fil e_ tm p']['na me'][$key]);                  i f (!in_a rray(strtolower($fileIn f o['exte nsi on']) , $f ileFormat s)) {
                    $ e rrors [ ' NO T_S UP PORTED_FIL E _ FOR MAT']  =  str tolower ($fileInfo['extens i on' ]).''. SJB_I1 8N: :get I n st anc e () - >ge tt e xt( n u ll, 'is not inan accepta bl e  f ile format ' );                   }
                  } 
           }

              if ($fil e _n ame = = ' ' && $ li sti ngId== 0){ 
                $ canAp pp lyWithou tResume = false;
                SJB_Event ::d i spa tch('CanA pply WithoutRes ume ',$canA ppp l yWith outR e su me) ; 
               i f ( ! $ ca nAppplyWith o u t Res ume){


 _ _   _ __ __  _  _$errors[$error] = true;
 _  __      }
       __ __else_{
    _    _ _    // получим уникальный id_для_файла в uploaded_files

_        _     _$file_id_current = 'application_'._md5(microtime());
__   _     _    $upload_manager =_new SJB_UploadFileManager();
     _     _    $upload_manager->setFileGroup('files');
_ _    _  _ _  _$upload_manager->setUploadedFileID($file_id_current);
     _  _     __for($i = 0;_$i_<_count($_FILES['file_tmp']['name']); $i++){

$file_name_= $upload_manager->uploadFile($_FILES['file_tmp']['name'][$i]);
}
 __ __     __   $id_file = mysql_insert_id();

 _   __   _    _$post = $controller->getData();
   _ _ _        $listingId = 0;

_     _   _ __  $mimeType_=_isset($_FILES['file_tmp']['type'])? $_FILES['file_tmp']['type']_: '';

     _ _     _  if (isset($_FILES['file_tmp']['size'])_&&_$file_name!= '' && $_FILES['file_tmp']['size'] == 0)_{
     _    ___    _  $errors['FILE_IS_EMPTY'] = 'The uploaded_file should not_be blank';
     __     __  }

   ___    _     if_(!empty($_FILES['file_tmp']['name'])){
        _  _    ___ $fileFormats = explode(',',SJB_System::getSettingByName('file_valid_types'));
      _ _  _        foreach (_$_FILES['file_tmp']['name'] as $key => $file ) {
_          _       _    $fileInfo = pathinfo($_FILES['file_tmp']['name'][$key]);
_   __      ____  _  _  if_(!in_array(strtolower($fileInfo['extension']), $fileFormats)_) {
 _ _  __                 _  $errors['NOT_SUPPORTED_FILE_FORMAT'] = strtolower($fileInfo['extension']).''. SJB_I18N::getInstance()->gettext(null,_'is not in an acceptable_file_format');
  _   _       _        _}
_ _   _ _ _  _ _ _ _}
      __        }

____  _  _  _  _if_($file_name == '' && $listingId ==_0) {
 _   _         _    $canAppplyWithoutResume = false;
          _ _   _ __SJB_Event::dispatch('CanApplyWithoutResume', $canAppplyWithoutResume);
    _ _       __    if (!$canAppplyWithoutResume) {
