HEX
Server: Apache
System: Linux clpupre 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64
User: undanet (1000)
PHP: 7.4.3
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/undanet/www/PortalEmpleo/src/Views/FormularioInscripcionConvocatoriaEspontaneaView.php
<form method="post" name="frmInscripcionConvocatoria" id="frmInscripcionConvocatoria" action="" enctype="multipart/form-data">

<?php

    $root = get_site_url() . '/';
    $rootwp = "";
    $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

        if( pll_current_language() == 'en')
            $lang = 'en_GB';
        else 
            $lang = 'es_ES';

    if(!isset($data['candidato']) || !is_object($data['candidato']))
    {
		wp_redirect($root . $rootwp . 'es/perfil-del-candidato/?c=' );
        if($lang=='en' || $lang=='en_GB')
        {
				echo '<div class="fondo_color">To sign up for any call you must complete your candidate profile. You can do it in the <a href="' . $root . $rootwp . 'en/candidate-profile/" target="_self" class="underline bold">following link</a>. Once it is completed, you can sign up for the job offer you want.</div>';
        }
        else
        {
                echo '<div class="fondo_color">Para inscribirse en alguna convocatoria debes completar primero tu perfil de candidatura. Puedes hacerlo en el <a href="' . $root . $rootwp . 'es/perfil-del-candidato/?c=' . $_GET['id'] . '" target="_self" class="underline bold">siguiente enlace</a>. Una vez completado ya puedes inscribirte en la oferta de trabajo deseada. </div>';
        }
    }
    else
    {
        echo '<section id="infoconvocatoria"><div class="fondo_color">';
        if($lang=='en' || $lang=='en_GB')
        {
            echo '<p class="justificado">Free Call:';
        }
        else
        {
            echo '<p class="justificado">Convocatoria Espont&aacute;nea:';
        }
        echo '</p></div></section>';

        if($lang=='en' || $lang=='en_GB')
        {
            echo '<div class="">When you register for this call, your personal data from your profile will be used. If you wish, you can check and update them at <a href="' . $root . $rootwp . 'en/candidate-profile/" target="_self" class=""><u>this link</u></a>.</div>';
        }
        else
        {
            echo '<div class="">Al inscribirte en esta convocatoria se emplear&aacute;n tus datos personales de tu perfil. Si lo deseas puedes consultarlos y/o actualizarlos en el <a href="' . $root . $rootwp . 'es/perfil-del-candidato/" target="_self" class=""><u>siguiente enlace</u></a>.</div>';
        }

        echo '<table border="0" style="margin-top: 2em;"" class="nomargin"><tbody><tr>';
        if($lang=='en' || $lang=='en_GB')
        {
            echo '<td><label for="txtPuestoTrabajo">Job:</label><label class="red nomargin">*</label></td>';
            //echo '<td><input type="text" id="txtPuestoTrabajo" name="txtPuestoTrabajo" placeholder="Type the job that you wish..." required><td></tr>';
        }
        else
        {
            echo '<td><label for="txtPuestoTrabajo">Puesto Trabajo:</label><label class="red nomargin">*</label></td>';
            //echo '<td><input type="text" id="txtPuestoTrabajo" name="txtPuestoTrabajo" placeholder="Indique el puesto al que aspire..." required><td></tr>';
        }

        echo '<td>';
        $nombreCombo = "Perfil";
        include(__DIR__ . "/../Utils/combobox_loader.php");

        if ( isset($nombreCombo) ){
            unset ($nombreCombo);
        }
        if ( isset($valSelected) ){
            unset ($valSelected);
        }
        echo '</td>';

        echo '<tr><td>';
                if($lang=='en' || $lang=='en_GB')
                {
                    echo '<label for="flCV">Curriculum Vitae <small>(Max. 10MB)</small>:</label><label class="red nomargin">*</label></td>';
                }
                else
                {
                    echo '<label for="flCV">Curriculum Vitae <small>(Max. 10MB)</small>:</label><label class="red nomargin">*</label></td>';
                }
        echo '</td><td><table class="nomargin"><tbody><tr>';
                if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacv()))>0)
                {
                    echo '<td><input type="text" id="txtflCV" name="txtflCV" value="' . $data['candidato']->getRutacv() . '" hidden></td></tr><tr>';
                    echo '<td><a id="linkCV" name="linkCV" href="' . $root . 'descarga/?id=' . ($data['candidato']->getCodigousuariowp())->getId() . '&file=' . basename($data['candidato']->getRutacv()) . '" target="_blank" hidden>' . basename($data['candidato']->getRutacv())  . '</a></td></tr><tr>';
                    echo '<td><input type="file" name="flCV" id="flCV" accept=".doc,.docx,application/msword,.pdf,application/pdf" value="' . $data['candidato']->getRutacv() . '"></td>';
                }
                else
                {
                    echo '<td><input type="file" name="flCV" id="flCV" accept=".doc,.docx,application/msword,.pdf,application/pdf" required></td>';
                }

                if($lang=='en' || $lang=='en_GB')
                {
                    echo '<td><div name="flCVError" id ="flCVError" hidden="true" class="red">Admitted files .doc, .docx y .pdf</div></td>';
                }
                else
                {
                    echo '<td><div name="flCVError" id ="flCVError" hidden="true" class="red">Admite .doc, .docx y .pdf</div></td>';
                }
                echo '</tr></tbody></table>';
                if($lang=='en' || $lang=='en_GB')
                {
                    echo '</tr><tr><td colspan="2" style="padding-left: 5%;"><input type="checkbox" id="chkCVPerfil" name="chkCVPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Use CV from my profile</label></td>';
                }
                else
                {
                    echo '</tr><tr><td colspan="2" style="padding-left: 5%;"><input type="checkbox" id="chkCVPerfil" name="chkCVPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Utilizar el CV de mi perfil</label></td>';
                }
        echo '</td><tr><td>';
            if($lang=='en' || $lang=='en_GB')
            {
                echo '<label for="flCartaPresentacion">Cover Letter <small>(Max. 10MB)</small>:</label></td>';
            }
            else
            {
                echo '<label for="flCartaPresentacion">Carta de Presentaci&oacute;n <small>(Max. 10MB)</small>:</label></td>';
            }
        echo '</td><td><table class="nomargin"><tbody><tr>';
            if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacp()))>0)
            {
                echo '<td><input type="text" id="txtflCartaPresentacion" name="txtflCartaPresentacion" value="' . $data['candidato']->getRutacp() . '" hidden></td></tr><tr>';
                echo '<td><a id="linkCP" name="linkCP" href="' . $root . 'descarga/?id=' . ($data['candidato']->getCodigousuariowp())->getId() . '&file=' . basename($data['candidato']->getRutacp()) . '" target="_blank" hidden>' . basename($data['candidato']->getRutacp())  . '</a></td></tr><tr>';
                echo '<td><input type="file" name="flCartaPresentacion" id="flCartaPresentacion" accept=".doc,.docx,application/msword,.pdf,application/pdf" value="' . $data['candidato']->getRutacp() . '"></td>';
            }
            else
            {
                echo '<td><input type="file" name="flCartaPresentacion" id="flCartaPresentacion" accept=".doc,.docx,application/msword,.pdf,application/pdf" required></td>';
            }

            if($lang=='en' || $lang=='en_GB')
            {
                echo '<td><div name="flCartaPresentacionError" id ="flCartaPresentacionError" hidden="true" class="red">Admitted files .doc, .docx y .pdf</div></td>';
            }
            else
            {
                echo '<td><div name="flCartaPresentacionError" id ="flCartaPresentacionError" hidden="true" class="red">Admite .doc, .docx y .pdf</div></td>';
            }
            echo '</tr></tbody></table>';

            if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacp()))>0)
            {
                if($lang=='en' || $lang=='en_GB')
                {
                    echo '</tr><tr><td colspan="2" style="padding-left: 5%;"><input type="checkbox" id="chkCPPerfil" name="chkCPPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Use the cover letter from my profile</label></td>';
                }
                else
                {
                    echo '</tr><tr><td colspan="2" style="padding-left: 5%;"><input type="checkbox" id="chkCPPerfil" name="chkCPPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Utilizar la carta de presentaci&oacute;n de mi perfil</label></td>';
                }
            }
        echo '</td></tr></tbody></table>';

        echo'<script language="javascript">
            var file = document.getElementById("flCV");
            file.onchange = function(e) {
                var fileError = document.getElementById("flCVError");
                var ext = this.value.match(/\.([^\.]+)$/)[1];
                switch (ext) {
                    case "doc":
                    case "docx":
                    case "pdf":
                        //alert("Allowed");
                        fileError.hidden = true;
                        this.style.fontWeight="bold";
                    break;
                    default:
                        //alert("Not allowed");
                        this.value = "";
                        fileError.hidden = false;
                        this.style.fontWeight="unset";
                    break;
                }
            };

            var file2 = document.getElementById("flCartaPresentacion");
            file2.onchange = function(e) {
                var fileError2 = document.getElementById("flCartaPresentacionError");
                var ext = this.value.match(/\.([^\.]+)$/)[1];
                switch (ext) {
                    case "doc":
                    case "docx":
                    case "pdf":
                        //alert("Allowed");
                        fileError2.hidden = true;
                        this.style.fontWeight="bold";
                    break;
                    default:
                        //alert("Not allowed");
                        fileError2.hidden = false;
                        this.value = "";
                        this.style.fontWeight="unset";
                    break;
                }
            };
            
            var chkCV = document.getElementById("chkCVPerfil");
            chkCV.onchange = function(e) {
                var aCV = document.getElementById("linkCV");
                var fileCV = document.getElementById("flCV");
                if(chkCV.checked)
                {
                    aCV.hidden = false;
                    fileCV.hidden = true;
                }
                else
                {
                    aCV.hidden = true;
                    fileCV.hidden = false;
                }
            };
            
            var chkCP = document.getElementById("chkCPPerfil");
            chkCP.onchange = function(e) {
                var aCP = document.getElementById("linkCP");
                var fileCP = document.getElementById("flCartaPresentacion");
                if(chkCP.checked)
                {
                    aCP.hidden = false;
                    fileCP.hidden = true;
                }
                else
                {
                    aCP.hidden = true;
                    fileCP.hidden = false;
                }
            };
        </script>';
    }
?>

<?php
    echo '<br>';
    echo '<table><tbody><tr><td><input type="text" id="accionMisCandidaturas" name="accionMisCandidaturas" value="" hidden></td></tr></tbody></table>';
    if(isset($data['candidato']) && is_object($data['candidato']))
    {
        echo '<input type="text" name="txtCdt" id="txtCdt" value="' . $data['candidato']->getIdcandidato() . '" hidden>';
        echo '<input type="text" name="codigoUsuarioWP" id="codigoUsuarioWP" value="' . ($data['candidato']->getCodigousuariowp())->getId() . '" hidden>';
    }
    if($lang=='en' || $lang=='en_GB')
    {
		if(isset($data['candidato']) && is_object($data['candidato'])) {
			echo '<input type="button" name="btnaccionConvocatoria" value="Register" onClick="fnccandidatoconvocatoriasubmit(this,\'' . trim($lang) . '\');">';
		}
	}
    else
    {
		if(isset($data['candidato']) && is_object($data['candidato'])) {
			echo '<input type="button" name="btnaccionConvocatoria" value="Inscribirse" onClick="fnccandidatoconvocatoriasubmit(this,\'' . trim($lang) . '\');">';
		}
	}

    echo '<script language="javascript">
    function validar() {
        if(document.getElementById("chkCVPerfil").checked ||  document.getElementById("flCV").value.trim().length>0)
        {
            return true;
        }
        
        return false;
    }

    function validarPuesto() {
        if(document.getElementById("txtPuestoTrabajo").value.trim().length>0)
        {
            return true;
        }
        
        return false;
    }

    function fnccandidatoconvocatoriasubmit(object,lang) {
        if(validar()/* && validarPuesto()*/)
        {
            if(lang=="en" || lang=="en_GB")
            {
                var msg = "Do you want to register at a free call?";
            }
            else
            {
                var msg = "¿Quieres inscribirte en un convocatoria espontánea?";
            }
            if(confirm(msg))
            {
                document.getElementById("accionMisCandidaturas").value = "CandidaturaEspontanea";
                document.getElementById("frmInscripcionConvocatoria").submit();
            }
        }
        else
        {
            if(lang=="en" || lang=="en_GB")
            {
                if(!validar())
                {
                    alert("You must attach a curriculum file or mark the check if you want to use your profile\'s one");
                }
                if(!validarPuesto())
                {
                    alert("Job field must be filled");
                }
            }
            else 
            {
                
                if(!validar())
                {
                    alert("Debe adjuntar un curriculum o indicar que desea utilizar el de su perfil");
                }
                if(!validarPuesto())
                {
                    alert("Debe indicar un puesto de trabajo");
                }
            }
        }
    }

    var inputs = document.getElementsByTagName("option");

	for(var i = 0; i < inputs.length; i++) {
		inputs[i].value = inputs[i].text;
	}
    </script>';
?>
</form>