Exemple #1
0
    }
    return '';
}
$context = stream_context_create(array('http' => array('method' => "GET", 'timeout' => 3)));
$content = @file_get_contents('http://www.prestashop.com/partner/preactivation/partners.php?version=1.0', false, $context);
if ($content && $content[0] == '<') {
    $result = simplexml_load_string($content);
    if ($result->partner) {
        echo '
							<h2>' . lang('Additional Benefits') . '</h2>
							<h3>' . lang('Exclusive offers dedicated to PrestaShop merchants') . '</h3>';
        $modulesHelpInstall = array();
        $modulesDescription = array();
        $modulesPrechecked = array();
        foreach ($result->partner as $p) {
            $modulesDescription[trim($p->key)] = array('name' => trim($p->label), 'logo' => trim($p->logo_medium), 'label' => getPreinstallXmlLang($p, 'label'), 'description' => getPreinstallXmlLang($p, 'description'), 'more' => getPreinstallXmlLang($p, 'more'));
            foreach ($p->country as $country_iso_code) {
                $modulesHelpInstall[trim($country_iso_code)][] = trim($p->key);
            }
            if ($p->prechecked) {
                foreach ($p->prechecked as $country_iso_code) {
                    $modulesPrechecked[trim($p->key)][trim($country_iso_code)] = 1;
                }
            }
        }
        foreach ($modulesHelpInstall as $country_iso_code => $modulesList) {
            echo '<div class="installModuleList' . ($country_iso_code == 'FR' ? ' selected' : '') . '" id="modulesList' . $country_iso_code . '">';
            foreach ($modulesList as $module) {
                echo '
									<table style="border: 1px solid #CCC; padding: 5px; width: 650px">
									<tr>
                        echo '<option value="' . (date('Y') - $i) . '">' . (date('Y') - $i) . '</option>';
                    }
                    echo '</select>';
                    echo '<select id="' . $p . '_' . $c . '_form_' . $field->key . '_month" name="' . $p . '_' . $c . '_form_' . $field->key . '_month" style="border:1px solid #D41958">';
                    for ($i = 1; $i <= 12; $i++) {
                        echo '<option value="' . ($i < 10 ? '0' . $i : $i) . '">' . ($i < 10 ? '0' . $i : $i) . '</option>';
                    }
                    echo '</select>';
                    echo '<select id="' . $p . '_' . $c . '_form_' . $field->key . '_day" name="' . $p . '_' . $c . '_form_' . $field->key . '_day" style="border:1px solid #D41958">';
                    for ($i = 1; $i <= 31; $i++) {
                        echo '<option value="' . ($i < 10 ? '0' . $i : $i) . '">' . ($i < 10 ? '0' . $i : $i) . '</option>';
                    }
                    echo '</select>';
                }
                if (getPreinstallXmlLang($field, 'help')) {
                    echo ' ' . getPreinstallXmlLang($field, 'help');
                }
                echo '<br /></div><br clear="left" />';
                if ($field->type == 'date') {
                    $varList .= "'&" . $field->key . "='+\$('#" . $p . "_" . $c . "_form_" . $field->key . "_year').val()+'-'+\$('#" . $p . "_" . $c . "_form_" . $field->key . "_month').val()+'-'+\$('#" . $p . "_" . $c . "_form_" . $field->key . "_day').val()+\n";
                } else {
                    $varList .= "'&" . $field->key . "='+ encodeURIComponent(\$('#" . $p . "_" . $c . "_form_" . $field->key . "').val())+\n";
                }
            }
            echo '
				<script>' . "\n\t\t\t\t\t\$('#btNext').click(function() {\n\t\t\t\t\t\tif (moduleChecked['" . strtoupper($c) . '_' . $p . "'] == 1 && \$('select#infosCountry option:selected').attr('rel') == '" . strtoupper($c) . "')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t  url: 'preactivation.php?request=send'+\n\t\t\t\t\t\t\t\t'&partner=" . $p . "'+\n\t\t\t\t\t\t\t\t" . $varList . "\n\t\t\t\t\t\t\t\t'&language_iso_code='+isoCodeLocalLanguage+\n\t\t\t\t\t\t\t\t'&country_iso_code='+encodeURIComponent(\$('select#infosCountry option:selected').attr('rel'))+\n\t\t\t\t\t\t\t\t'&activity='+ encodeURIComponent(\$('select#infosActivity').val())+\n\t\t\t\t\t\t\t\t'&timezone='+ encodeURIComponent(\$('select#infosTimezone').val())+\n\t\t\t\t\t\t\t\t'&shop='+ encodeURIComponent(\$('input#infosShop').val())+\n\t\t\t\t\t\t\t\t'&firstName='+ encodeURIComponent(\$('input#infosFirstname').val())+\n\t\t\t\t\t\t\t\t'&lastName='+ encodeURIComponent(\$('input#infosName').val())+\n\t\t\t\t\t\t\t\t'&email='+ encodeURIComponent(\$('input#infosEmail').val()),\n\t\t\t\t\t\t\t  context: document.body,\n\t\t\t\t\t\t\t  success: function(data) {\n\t\t\t\t\t\t\t\t\t\$('.lockedForAjax').removeAttr('disabled').removeClass('disabled').removeClass('lockedForAjax');\n\t\t\t\t\t\t\t  }\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});" . '
				</script>';
        }
    }
}
if ($_GET['request'] == 'send') {