Condition d'identification dans une page !

Réduire
X
 
  • Filtrer
  • Heure
  • Afficher
Tout effacer
nouveaux messages

  • [Problème] Condition d'identification dans une page !

    Bonjour tout le monde,

    J'ai une page d'un formulaire d'une extension dont le script d'identification qui ne disparait pas quand tu es identifié. C.à.d que si tu es identifier déjà dans le site et que tu te redirige vers la page du formulaire, cette dernière s'affiche avec un entête qui t'invite à s'identifier si tu as un compte ou à s'enregistré si tu n'en a pas encore ? je devine que c'est une question de {if, else} qui ne fonctionne pas ou d'autre chose peut être. Pouvez-vous m'aider trouver cette anomalie et merci d'avance :

    Code HTML:
    <?php
    
    /**
    
     * @version$Id: default.php 3033 2016-05-17 12:47:31Z stefan $
    
     * @packageJoomla.Site
    
     * @subpackagecom_joomcareer
    
     *
    
     * @authorWERI-Design GbR www.weri-design.de
    
     * @copyrightCopyright (C) 2013 WERI-Design GbR. All rights reserved.
    
     * @licenseGNU/GPL, see license.php
    
     */
    
    // no direct access
    
    defined ('_JEXEC') or die;
    
    JHTML::_('behavior.tooltip');
    
    JHtml::_('behavior.formvalidation');
    
    JHtml::_('behavior.keepalive');
    
    ?>
    
    <script type="text/javascript">
    
    Joomla.submitbutton = function(task) {
    
    if (task == 'registerfirm.cancel' || document.formvalidator.isValid(document.id('adminForm'))) {
    
    form = document.getElementById('adminForm')
    
    if (typeof(task) !== 'undefined') {
    
    form.task.value = task;
    
    }
    
    // Submit the form.
    
    if (typeof form.onsubmit == 'function') {
    
    form.onsubmit();
    
    }
    
    if (typeof form.fireEvent == 'function') {
    
    form.fireEvent('submit');
    
    }
    
    form.submit();
    
    } else {
    
    alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
    
    }
    
    }
    
    jQuery( document ).ready(function() {
    
    <?php if ($this->params->get('tax')) { ?>
    
    var tax = <?php echo $this->params->get('tax');?>;
    
    <?php
    
    }
    
    else { ?>
    
    var tax = 0.00;
    
    <?php }?>
    
    jQuery('select[name="jform[group_id]"]').on('change', function() {
    
    if (this.value != "") {
    
    var url = "index.php?option=com_joomcareer&task=registerfirm.getFirmGroupJson";
    
    jQuery.ajax({
    
    url: url,
    
    type: "POST",
    
    dataType: "json",
    
    data : {
    
    group_id: this.value           
    
    },
    
    beforeSend: function() {
    
       jQuery("#loader").show();
    
        },
    
    success : function(data) {
    
       jQuery.each(data, function(key, val) {
    
       var num = parseFloat(val.price);
    
       var rounded = num.toFixed(2);
    
           jQuery('#jc_price').val(rounded);
    
           if (tax != 0.00) {
    
           var tax_value = parseFloat(val.price)*(tax/100);
    
           tax_value = tax_value.toFixed(2);
    
           }
    
           else {
    
           var tax_value = 0.00;
    
           }
    
           jQuery('#jc_tax').val(tax_value);
    
           var sum = parseFloat(rounded) + parseFloat(tax_value);
    
           sum = sum.toFixed(2);
    
           jQuery('#jc_sum').val(sum);      
    
    });
    
    }
    
    });
    
    jQuery("#loader").ajaxStop(function() {
    
    jQuery(this).hide();
    
    });
    
    }
    
    });
    
    });
    
    </script>
    
    <div class="jc_login">
    
    <div class="note_already_existing_accout"><?php echo JText::_('EXISTING_ACCOUNT_NOTE'); ?></div>
    
    <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" class="form-validate" method="post" name="loginForm" id="loginForm">
    
    <div class="control-group">
    
    <div class="control-label">
    
    <?php echo JText::_('USERAME'); ?>
    
    </div>
    
    <div class="controls">
    
    <input id="username" class="validate-username" type="text" size="25" value="" name="username">
    
    </div>
    
    <div class="control-label">
    
    <?php echo JText::_('JGLOBAL_PASSWORD'); ?>
    
    </div>
    
    <div class="controls">
    
    <input id="password" class="validate-password" type="password" maxlength="99" size="25" value="" name="password">
    
    </div>
    
    <?php if ($this->tfa): ?>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <?php echo JText::_('JGLOBAL_SECRETKEY'); ?>
    
    </div>
    
    <div class="controls">
    
    <input id="secretkey" class="" type="text" maxlength="99" size="25" value="" name="secretkey">
    
    </div>
    
    </div>
    
    <?php endif; ?>
    
    <div class="firm_login_button">
    
    <button type="submit">
    
    <?php echo JText::_('JLOGIN'); ?>
    
    </button>
    
    </div>
    
    </div>
    
    <?php echo JHtml::_('form.token'); ?>
    
    </form>
    
    </div>
    
    <h2><?php echo JText::_('CREATE_FIRM_ACCOUNT'); ?></h2>
    
    <form enctype='multipart/form-data' action="<?php echo JRoute::_('index.php'); ?>" class="form-validate" method="post" name="adminForm" id="adminForm" class="form-validate">
    
    <div id="jc_firm_account">
    
    <h3><?php echo JText::_('USER_ACCOUNT'); ?></h3>
    
    <hr />
    
    <div class="jc_firm_account_section">
    
    <fieldset>
    
    <?php
    
    $formArray = array ('username', 'password', 'password2', 'id');
    
    foreach ($formArray as $value) {
    
    echo '<div class="control-group"><div class="control-label">'.$this->form->getLabel($value).'</div><div class="controls">'.$this->form->getInput($value).'</div></div>';
    
    } ?>
    
    </fieldset>
    
    </div>
    
    <?php
    
    $counter = 0;
    
    // create user specific attributes
    
    foreach ($this->attributes as $attribute) {
    
    if ($attribute->class) {
    
    $attribute_class = ' '.$attribute->class;
    
    }
    
    else {
    
    $attribute_class = '';
    
    }
    
    if ($counter == 0 AND $attribute->type_id != 8) {
    
    echo '<h3>'.JText::_('FIRM').'</h3><hr />';
    
    echo '<div class="jc_firm_account_section">';
    
    echo '<fieldset>';
    
    }
    
    elseif ($counter == 0 AND $attribute->type_id == 8) {
    
    echo '<div class="'.$attribute_class.'"><h3>'.JText::_($attribute->attribute_name).'</h3><hr /></div>';
    
    echo '<div class="jc_firm_account_section">';
    
    echo '<fieldset>';
    
    }
    
    elseif ($counter != 0 AND $attribute->type_id == 8) {
    
    echo '</fieldset>';
    
    echo '</div>';
    
    echo '<div class="'.$attribute_class.'"><h3>'.JText::_($attribute->attribute_name).'</h3><hr /></div>';
    
    echo '<div class="jc_firm_account_section">';
    
    echo '<fieldset>';
    
    }
    
    $class= 'class="inputbox"';
    
    ($attribute->required) ? $class = 'class="inputbox required"' : $class=$class;
    
    $star= $attribute->required ? '<span class="star"> *</span>' : '';
    
    $readonly= $attribute->readonly ? ' readonly="readonly"' : '';
    
    $size= $attribute->size ? ' size="' . (int) $attribute->size . '"' : '';
    
    ($attribute->cols) ? $cols=$attribute->cols : $cols='20';
    
    ($attribute->rows) ? $rows=$attribute->rows : $rows='10';
    
    if ($attribute->type_id != 8) {
    
    echo '<div class="control-group'.$attribute_class.'">';
    
    echo '<div class="control-label">';
    
    if ($attribute->attribute_description) {
    
    echo '<label id="jform_'.$attribute->alias.'-lbl" class="hasTip" title="'.htmlspecialchars($attribute->attribute_description, ENT_COMPAT, 'UTF-8').'" for="jform_'.$attribute->alias.'" data-original-title="<strong>'.JText::_($attribute->attribute_name).'</strong><br />'.JText::_($attribute->attribute_description).'">'.JText::_($attribute->attribute_name).' '.$star.'</label>';
    
    }
    
    else {
    
    echo '<label>'.JText::_($attribute->attribute_name).' '.$star.'</label>';
    
    }
    
    echo '</div>';
    
    echo '<div class="controls">';
    
    }
    
    if (!isset($this->data[$attribute->alias])) {
    
    $this->data[$attribute->alias] = '';
    
    }
    
    if ($attribute->alias == 'default_firm' || $attribute->alias == 'default-firm') {
    
    echo $this->form->getInput('name');
    
    }
    
    elseif ($attribute->alias == 'default_email' || $attribute->alias == 'default-email') {
    
    echo $this->form->getInput('email');
    
    }
    
    elseif ($attribute->alias == 'default_logo' || $attribute->alias == 'default-logo') {
    
    echo '<input name="logo" type="file" />';
    
    }
    
    elseif ($attribute->alias == 'default_description' || $attribute->alias == 'default-description') {
    
    echo $this->form->getInput('description');
    
    }
    
    else {
    
    switch ($attribute->type_id) {
    
    // text
    
    case 1:
    
    if ($this->data[$attribute->alias]) {
    
    $value = $this->data[$attribute->alias];
    
    }
    
    elseif ($attribute->texttype == 2) {
    
    $value= strftime('%Y-%m-%d');
    
    }
    
    else {
    
    $value = $attribute->default_value;
    
    }
    
    if ($attribute->texttype == 2) {
    
    $attributes['size'] = $attribute->size;
    
    $attributes['class'] = $class;
    
    echo JHtml::_('calendar', $value, "jform[".$attribute->alias."]", "jform_".$attribute->alias."", '%Y-%m-%d', $attributes);
    
    }
    
    else {
    
    $attributeName = $attribute->alias;
    
    echo '<input type="text" name="jform['.$attribute->alias.']" id="' . $attribute->alias . '"' . ' value="'. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $readonly . '/>';
    
    }
    
    break;
    
    // one checkbox
    
    case 2:
    
    if ($this->data[$attribute->alias]){
    
    $value = $this->data[$attribute->alias];
    
    $checked = ' checked="checked"';
    
    }
    
    else {
    
    $attributeName = $attribute->alias;
    
    $value ='';
    
    $checked = ($value == 1) ? ' checked="checked"' : '';
    
    }
    
    echo '<input type="checkbox" name="jform['.$attribute->alias.']" id="' . $attribute->alias . '"' . ' value="1"' . $checked . $class .'/>';
    
    break;
    
    // multiple checkbox
    
    case 3:
    
    $value = array();
    
    if ($this->data[$attribute->alias]) {
    
    $value =  $this->data[$attribute->alias];
    
    }
    
    else {
    
    $value = array();
    
    }
    
    $html = array();
    
    $checked = '';
    
    $html[] = '<fieldset id="' . $attribute->alias . '">';
    
    $i=1;
    
    foreach ($this->attributesOptions as $option) {
    
    if ($option->attribute_id == $attribute->id) {
    
    if ( in_array($option->id, $value)) {
    
    $checked = 'checked="checked"';
    
    }
    
    else {
    
    $checked = '';
    
    }
    
    if ($attribute->alignment == 1){
    
    $html[] = '<div>';
    
    }
    
    $html[] = '<label for="' . $attribute->alias . $i . '" style="display:inline; padding-left: 10px;">' . $option->option_name . '</label>';
    
    $html[] = '<input type="checkbox" id="' . $attribute->alias . $i . '" name="jform['.$attribute->alias.'][]"' . ' style="margin-left: 5px;" value="'.$option->id.'"' . $checked . '/>';
    
    $i++;
    
    if ($attribute->alignment == 1){
    
    $html[] = '</div>';
    
    }
    
    }
    
    }
    
    $html[] = '</fieldset>';
    
    foreach ($html as $list) {
    
    echo $list;
    
    }
    
    break;
    
    // dropdown select one
    
    case 4:
    
    $parent_is_dropdown = 0;
    
    // check if parent item is also a drop down
    
    foreach ($this->attributes as $attribute3) {
    
    if ($attribute->parent_id == $attribute3->id) {
    
    if ($attribute3->type_id == 4) {
    
    $parent_is_dropdown = 1;
    
    }
    
    break;
    
    }
    
    }
    
    // no parent
    
    if ($attribute->parent_id > 0 OR !$parent_is_dropdown) {
    
    $html = array();
    
    $attr = '';
    
    $options = array();
    
    $tmp = "";
    
    if ($this->data[$attribute->alias]){
    
    $value = $this->data[$attribute->alias];
    
    }
    
    else {
    
    $value = '';
    
    }
    
    $attr .= $class;
    
    if ($readonly) {
    
    $attr .= ' disabled="disabled"';
    
    }
    
    $attr .= $size;
    
    $tmp= JHtml::_('select.option', '', JText::_('NO_SELECTION'));
    
    $options[]= $tmp;
    
    foreach ($this->attributesOptions as $option) {
    
    if ($option->attribute_id == $attribute->id) {
    
    $tmp = JHtml::_('select.option', $option->id, $option->option_name);
    
    $options[] = $tmp;
    
    }
    
    }
    
    // Create a read-only list (no name) with a hidden input to store the value.
    
    if ($attribute->readonly) {
    
    $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, '');
    
    $html[] = '<input type="hidden" name="jform['.$attribute->alias.']" value="'. $value .'"/>';
    
    }
    
    // Create a regular list.
    
    else {
    
    $html[] = JHtml::_('select.genericlist', $options, 'jform['.$attribute->alias.']', trim($attr), 'value', 'text', $value, '');
    
    }
    
    foreach ($html as $list) {
    
    echo $list;
    
    }
    
    }
    
    // has parent
    
    else {
    
    $attribute_options = $this->model->getAttributeOptionsParent($attribute->id);
    
    if ($this->data[$attribute->alias]) {
    
    $value = $this->data[$attribute->alias];
    
    }
    
    else {
    
    $value = '';
    
    }
    
    echo '<select id="'.$attribute->alias.'" name="jform['.$attribute->alias.']" class="inputbox">';
    
    echo '<option value="">'.JText::_("NO_SELECTION").'</option>';
    
    foreach ($attribute_options AS $attribute_option) {
    
    if ($attribute->parent_id == -1) {
    
    if ($attribute->parent_id == -1 ) {
    
    $parent = $this->item->catid;
    
    }
    
    if ($value AND $attribute_option->id == $value AND $attribute_option->parent_id == $parent) {
    
    echo '<option selected="selected" value="'.$attribute_option->id.'" class="'.$attribute_option->parent_id.'">'.$attribute_option->option_name.'</option>';
    
    }
    
    else {
    
    echo '<option value="'.$attribute_option->id.'" class="'.$attribute_option->parent_id.'">'.$attribute_option->option_name.'</option>';
    
    }
    
    }
    
    else {
    
    $parent_alias = $attribute_option->parent_alias;
    
    $parent = $this->item->$parent_alias;
    
    if ($value AND $attribute_option->option_name == $value AND $attribute_option->parent_option == $parent) {
    
    echo '<option selected="selected" value="'.$attribute_option->option_name.'" class="'.$attribute_option->parent_option.'">'.$attribute_option->option_name.'</option>';
    
    }
    
    else {
    
    echo '<option value="'.$attribute_option->option_name.'" class="'.$attribute_option->parent_option.'">'.$attribute_option->option_name.'</option>';
    
    }
    
    }
    
    }
    
    echo '</select>';
    
    }
    
    break;
    
    // textarea
    
    case 5:
    
    if ($this->data[$attribute->alias]) {
    
    $value = $this->data[$attribute->alias];
    
    }
    
    else {
    
    $value = '';
    
    }
    
    // with editor
    
    if ($attribute->editor) {
    
    $height = '250';
    
    $width = '100%';
    
    $buttons = true;
    
    $editor = null;
    
    $type = "desired|alternative";
    
    // Get the list of editor types.
    
    $types = explode('|', $type);
    
    // Get the database object.
    
    $db = JFactory::getDBO();
    
    // Iterate over the types looking for an existing editor.
    
    foreach ($types as $element) {
    
    // Build the query.
    
    $query = $db->getQuery(true);
    
    $query->select('element');
    
    $query->from('#__extensions');
    
    $query->where('element = ' . $db->quote($element));
    
    $query->where('folder = ' . $db->quote('editors'));
    
    $query->where('enabled = 1');
    
    // Check of the editor exists.
    
    $db->setQuery($query, 0, 1);
    
    $editor = $db->loadResult();
    
    // If an editor was found stop looking.
    
    if ($editor) {
    
    break;
    
    }
    
    }
    
    $editor = JFactory::getEditor($editor ? $editor : null);
    
    echo '<div class="clr"></div>';
    
    echo $editor->display('jform['.$attribute->alias.']', htmlspecialchars($value, ENT_COMPAT, 'UTF-8'), $width, $height, $cols, $rows,$buttons, $attribute->alias);
    
    }
    
    // no editor, just textbox
    
    else {
    
    echo '<textarea name="jform['.$attribute->alias.']" id="' . $attribute->alias . '" cols="' . $cols . '" rows="'. $rows . '"' . $class . '>'. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</textarea>';
    
    }
    
    break;
    
    // file
    
    case 6:
    
    $attributeName = $attribute->alias;
    
    echo '<input type="file" name="'.$attribute->alias.'" id="' . $attribute->alias . '"' . ' ' . $class . $size . $readonly . '/>';
    
    break;
    
    // radio
    
    case 7:
    
    if ($this->data[$attribute->alias]){
    
    $value = $this->data[$attribute->alias];
    
    }
    
    else {
    
    $value = '';
    
    }
    
    $html = array();
    
    $checked = '';
    
    //$html[] = '<fieldset id="' . $attribute->alias . '">';
    
    $i=1;
    
    if ($value == '') {
    
    $checked = 'checked="checked"';
    
    }
    
    //$html[] = '<input type="radio" id="no_selection" name="jform['.$attribute->alias.']"' . ' style="margin-left: 5px;" value=""' . $checked . '/>';
    
    //$html[] = '<label for="' . $attribute->alias . $i . '" style="display:inline; padding-left: 5px;">' . JText::_('NO_SELECTION') . '</label>';
    
    $i++;
    
    foreach ($this->attributesOptions as $option) {
    
    if ($option->attribute_id == $attribute->id)
    
    {
    
    if ($option->id == $value) {
    
    $checked = 'checked="checked"';
    
    }
    
    else {
    
    $checked = '';
    
    }
    
    if ($attribute->alignment == 1) {
    
    $html[] = '<div>';
    
    }
    
    $html[] = '<input type="radio" id="' . $attribute->alias . $i . '" name="jform['.$attribute->alias.']"' . ' style="margin-left: 5px;" value="'.$option->id.'"' . $checked . '/>';
    
    $html[] = '<label for="' . $attribute->alias . $i . '" style="display:inline; padding-left: 5px;">' . $option->option_name . '</label>';
    
    $i++;
    
    if ($attribute->alignment == 1){
    
    $html[] = '</div>';
    
    }
    
    }
    
    }
    
    //$html[] = '</fieldset>';
    
    foreach ($html as $list) {
    
    echo $list;
    
    }
    
    break;
    
    // radiogroup/headline
    
    case 8:
    
    break;
    
    }
    
    }
    
    if ($attribute->unit != '') {
    
    echo '<span style="padding: 5px 0 0 3px;"> '.$attribute->unit.'</span>';
    
    }
    
    if ($attribute->type_id != 8) {
    
    echo '</div>';
    
    echo '</div>';
    
    }
    
    $counter++;
    
    }
    
    if ($counter) {
    
    echo '</fieldset>';
    
    echo '</div>';
    
    }
    
    ?>
    
    <!-- <h3><?php echo JText::_('FIRM_DESCRIPTION'); ?></h3>
    
    <hr />
    
    <div class="jc_firm_account_section">
    
    <fieldset>
    
    <div class="control-group">
    
    <?php  echo $this->form->getInput('description'); ?>
    
    </div>
    
    </fieldset>
    
    </div>-->
    
    <?php if ($this->params->get('subscription_function')) { ?>
    
    <h3><?php echo JText::_('PAYMENT'); ?></h3>
    
    <hr />
    
    <div class="jc_firm_account_section">
    
    <fieldset>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <?php echo $this->form->getLabel('group_id'); ?>
    
    </div>
    
    <div class="controls">
    
    <?php echo $this->form->getInput('group_id');?>
    
    <span id="loader" style="display: none;" class="loaderimage">
    
    <?php
    
    $image_url= 'components/com_joomcareer/assets/loader.gif';
    
    echo JHTML::_('image', $image_url, '');
    
    ?>
    
    </span>
    
    </div>
    
    </div>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <label id="jform_price-lbl" class="" for="jform_price"><?php echo JText::_('PRICE'); ?></label>
    
    </div>
    
    <div class="controls">
    
    <input id="jc_price" type="text" disabled="disabled" class="form-control input-small" value="<?php echo number_format($this->default_group->price, 2); ?>" />
    
    <span class="input-group-addon add-on"><?php echo $this->params->get('currency_symbol') ?></span>
    
    </div>
    
    </div>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <label id="jform_tax-lbl" class="" for="jform_tax"><?php echo JText::_('TAX'); ?></label>
    
    </div>
    
    <div class="controls">
    
    <?php
    
    if ($this->params->get('tax')) {
    
    $tax = $this->default_group->price*($this->params->get('tax')/100);
    
    }
    
    else {
    
    $tax = 0.00;
    
    }
    
    ?>
    
    <input id="jc_tax" type="text" disabled="disabled" class="form-control input-small" value="<?php echo number_format($tax, 2); ?>" />
    
    <span class="input-group-addon add-on"><?php echo $this->params->get('currency_symbol') ?></span>
    
    </div>
    
    </div>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <label id="jform_sum-lbl" class="" for="jform_sum"><?php echo JText::_('SUM'); ?></label>
    
    </div>
    
    <div class="controls">
    
    <?php
    
    $sum = $this->default_group->price+$tax;
    
    ?>
    
    <input id="jc_sum" type="text" disabled="disabled" class="form-control input-small" value="<?php echo number_format($sum,2); ?>" />
    
    <span class="input-group-addon add-on"><?php echo $this->params->get('currency_symbol') ?></span>
    
    </div>
    
    </div>
    
    </fieldset>
    
    </div>
    
    <?php } ?>
    
    </div>
    
    <?php if ($this->params->get('captcha')) { ?>
    
    <div class="control-group">
    
    <div class="control-label">
    
    <?php echo $this->form->getLabel('captcha'); ?>
    
    </div>
    
    <div class="controls">
    
    <?php echo $this->form->getInput('captcha'); ?>
    
    </div>
    
    </div>
    
    <?php } ?>
    
    <div class="clr"></div>
    
    <hr />
    
    <?php if ($this->params->get('register_firm_note') == 1 || $this->params->get('register_firm_note') == 2) { ?>
    
    <div class="register_firm_note">
    
    <?php if ($this->params->get('register_firm_note') == 1) { ?>
    
    <div class="register_firm_checkbox"><input type="checkbox" name="register_firm_note_checked" value="1" class="inputbox required" /></div>
    
    <?php } ?>
    
    <div class="register_firm_note_text"><?php echo $this->params->get('register_firm_note_text'); ?></div>
    
    </div>
    
    <hr />
    
    <?php } ?>
    
    <div class="firm_account_button">
    
    <button type="button" onclick="Joomla.submitbutton('registerfirm.register')">
    
    <?php echo JText::_('CREATE_ACCOUNT') ?>
    
    </button>
    
    </div>
    
    <input type="hidden" name="task" value="" />
    
    <?php echo JHtml::_('form.token'); ?>
    
    </form>

Annonce

Réduire
Aucune annonce pour le moment.

Partenaire de l'association

Réduire

Hébergeur Web PlanetHoster
Travaille ...
X