From: Florent Bruneau Date: Mon, 31 Jan 2011 19:21:13 +0000 (+0100) Subject: Merge remote branch 'origin/xorg/maint' into xorg/master X-Git-Tag: xorg/1.1.0~161 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=956cd5c10a027f75283d91545a5d5feeed1874ef;p=platal.git Merge remote branch 'origin/xorg/maint' into xorg/master Conflicts: ChangeLog Makefile classes/userfilter/conditions.inc.php core htdocs/javascript/do_challenge_response.js htdocs/javascript/password.js htdocs/javascript/wiki.js htdocs/javascript/xorg.js include/massmailer.inc.php modules/admin.php modules/api.php modules/axletter/axletter.inc.php templates/admin/user.tpl templates/axletter/admin.tpl templates/axletter/edit.tpl templates/axletter/index.tpl templates/axletter/show.tpl templates/emails/antispam.tpl templates/emails/index.tpl templates/events/form.tpl templates/gadgets/ig-skin.tpl templates/lists/index.tpl templates/profile/fiche_referent.tpl templates/search/index.tpl templates/skin/common.bandeau.head.tpl templates/skin/common.title.header.tpl templates/survey/show_textarea.tpl templates/survey/success.tpl Signed-off-by: Florent Bruneau --- 956cd5c10a027f75283d91545a5d5feeed1874ef diff --cc ChangeLog index 6e0b06f,4b6ad77..6b16616 --- a/ChangeLog +++ b/ChangeLog @@@ -1,47 -1,5 +1,47 @@@ ================================================================================ +VERSION 1.1.0 XX XX XXXX + +Bug/Wish: + + * Admin: + - #1320: Add administrations pages for country and language edition -JAC + - #1371: Allows email edition before mailing list validation -JAC + + * Carnet: + - #1139: Fixes contact pdf export with pictures -JAC + + * Core: + - #1040: Adapts login page for non-X users -FRU + - #1325: Fixes csv downloading with IE8 -JAC + + * Emails: + - #1201: Increases allowed email size -JAC + + * Payments: + - #1314,1295: Finally fix "has paid" lists -Xel + + * Profile: + - #1288: Adds explaination about job keywords in profile edition -JAC + - #1294: Fixes email in job information -JAC + - #1322: Removes duplicated city and postal code in vcard addresses -JAC + - #1323: Displays email aliases in vcards when public -JAC + + * Search: + - #1283: Restricts second operation on promo search -Car + - #1312: Adds search on subadministrativearea -JAC + - #1313: Fixes advanced form js in IE7 -Car + + * Xnet: + - #1347: Fixes menu when changing rights in Xnet -JAC + + * XnetEvent: + - #1233: Enables event subscribtion notification -JAC + + * XnetGrp: + - #1230: Adds custom welcome message for group subscription -JAC + +================================================================================ - VERSION 1.0.2 XX XX XXXX + VERSION 1.0.2 31 01 2011 Bug/Wish: diff --cc Makefile index c3eb316,d7ee751..283e02e --- a/Makefile +++ b/Makefile @@@ -221,21 -209,17 +221,29 @@@ htdocs/javascript/jquery.ui-$(JQUERY_UI htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: @$(download) -$(JQUERY_UI_PATHES): htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js +htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).datepicker-fr.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/minified/i18n/jquery.ui.datepicker-fr.min.js +htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).datepicker-fr.js: + @$(download) + +$(JQUERY_UI_PATHES) htdocs/javascript/jquery.ui.datepicker-fr.js: htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js + ln -snf $(> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + w = Array(80); + a = 1732584193; + b = -271733879; + c = -1732584194; + d = 271733878; + e = -1009589776; + + for(i = 0; i < x.length; i += 16) + { + olda = a; + oldb = b; + oldc = c; + oldd = d; + olde = e; + + for(j = 0; j < 80; j++) + { + if(j < 16) w[j] = x[i + j]; + else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), + safe_add(safe_add(e, w[j]), sha1_kt(j))); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + e = safe_add(e, olde); + } + return Array(a, b, c, d, e); + +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1_ft(t, b, c, d) +{ + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1_kt(t) +{ + return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : + (t < 60) ? -1894007588 : -899497514; +} + +/* + * Calculate the HMAC-SHA1 of a key and some data + */ +function core_hmac_sha1(key, data) +{ + var bkey = str2binb(key); + var i, ipad, opad; + var hash; + + if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); + + ipad = Array(16); + opad = Array(16); + for(i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); + return core_sha1(opad.concat(hash), 512 + 160); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert an 8-bit or 16-bit string to an array of big-endian words + * In 8-bit function, characters >255 have their hi-byte silently ignored. + */ +function str2binb(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + var i; + for(i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); + return bin; +} + +/* + * Convert an array of big-endian words to a string + */ +function binb2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + var i; + for(i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); + return str; +} + +/* + * Convert an array of big-endian words to a hex string. + */ +function binb2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + var i; + for(i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of big-endian words to a base-64 string + */ +function binb2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + var i, j, triplet; + for(i = 0; i < binarray.length * 4; i += 3) + { + triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); + for(j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} + +/* }}} */ + +function hash_encrypt(a) { + return hex_sha1(a); +} + +var hexa_h = "0123456789abcdef"; + +function dechex(a) { + return hexa_h.charAt(a); +} + +function hexdec(a) { + return hexa_h.indexOf(a); +} + +function hash_xor(a, b) { + var c,i,j,k,d; + c = ""; + i = a.length; + j = b.length; + if (i < j) { + d = a; a = b; b = d; + k = i; i = j; j = k; + } + for (k = 0; k < j; k++) { + c += dechex(hexdec(a.charAt(k)) ^ hexdec(b.charAt(k))); + } + for (; k < i; k++) { + c += a.charAt(k); + } + return c; +} + - function getType(c) { if (c >= 'a' && c <= 'z') { return 1; @@@ -566,130 -349,167 +565,290 @@@ function checkPassword(box, okLabel) } } +function hashResponse(password1, password2, hasConfirmation) { + var pw1 = $('[name=' + password1 + ']').val(); + var pw2; + + if (hasConfirmation) { + pw2 = $('[name=' + password2 + ']').val(); + if (pw1 !== pw2) { + alert("\nErreur : les deux champs ne sont pas identiques !"); + return false; + } + $('[name=' + password2 + ']').val(''); + } else if (pw1 === '********') { + return true; + } + + if (pw1.length < 6) { + alert("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !"); + return false; + } + if (!differentTypes(pw1)) { + alert ("\nErreur : le nouveau mot de passe doit comporter au moins deux types de caractères parmi les suivants : lettres minuscules, lettres majuscules, chiffres, caractères spéciaux."); + return false; + } + + alert("Le mot de passe que tu as rentré va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair."); + $('[name=' + password1 + ']').val(''); + $('[name=pwhash]').val(hash_encrypt(pw1)); + return true; +} + +function correctUserName() { + var u = document.forms.login.username; + var mots; + + // login with no space + if (!u.value.contains(' ')) { + return true; + } + mots = u.value.split(' '); + // jean paul.du pont -> jean-paul.du-pont + if (u.value.contains('.')) { + u.value = mots.join('-'); + return true; + } + // jean dupont -> jean.dupont + if (mots.length === 2) { + u.value = mots[0] + "." + mots[1]; + return true; + } + // jean dupont 2001 -> jean.dupont.2001 + if (mots.length === 3 && mots[2] > 1920 && mots[2] < 3000) { + u.value = mots.join('.'); + return true; + } + // jean de la vallee -> jean.de-la-vallee + if (mots[1].toUpperCase() === 'DE') { + u.value = mots[0] + "." + mots.join('-').substr(mots[0].length+1); + return true; + } + // jean paul dupont -> jean-paul.dupont + if (mots.length === 3 && mots[0].toUpperCase() === 'JEAN') { + u.value = mots[0] + "-" + mots[1] + "." + mots[2]; + return true; + } + + alert('Ton email ne doit pas contenir de blanc.\nLe format standard est\n\nprenom.nom.promotion\n\nSi ton nom ou ton prenom est composé,\nsépare les mots par des -'); + + return false; +} + +function doChallengeResponse() { + var new_pass, old_pass, str; + + if (!correctUserName()) { + return false; + } + + new_pass = hash_encrypt(document.forms.login.password.value); + old_pass = hash_encrypt(document.forms.login.password.value.substr(0, 10)); + + str = document.forms.login.username.value + ":" + + new_pass + ":" + + document.forms.loginsub.challenge.value; + + document.forms.loginsub.response.value = hash_encrypt(str); + if (new_pass !== old_pass) { + document.forms.loginsub.xorpass.value = hash_xor(new_pass, old_pass); + } + document.forms.loginsub.username.value = document.forms.login.username.value; + document.forms.loginsub.remember.value = document.forms.login.remember.checked; + document.forms.loginsub.domain.value = document.forms.login.domain.value; + document.forms.login.password.value = ""; + document.forms.loginsub.submit(); +} + +function doChallengeResponseLogged() { + var str = document.forms.loginsub.username.value + ":" + + hash_encrypt(document.forms.login.password.value) + ":" + + document.forms.loginsub.challenge.value; + + document.forms.loginsub.response.value = hash_encrypt(str); + document.forms.loginsub.remember.value = document.forms.login.remember.checked; + document.forms.login.password.value = ""; + document.forms.loginsub.submit(); +} + +// }}} +// {{{ send test email + +function sendTestEmail(token, hruid) +{ + var url = 'emails/test'; + var msg = "Un email a été envoyé avec succès"; + if (hruid) { + url += '/' + hruid; + msg += " sur l'adresse de " + hruid + "."; + } else { + msg += " sur ton addresse."; + } + $('#mail_sent').successMessage($url + '?token=' + token, msg); + return false; +} + // }}} + // {{{ jQuery object extension + + (function($) { + /* Add new functions to jQuery namesapce */ + $.extend({ + /* The goal of the following functions is to provide an AJAX API that + * take a different callback in case of HTTP success code (2XX) and in + * other cases. + */ + + xajax: function(source, method, data, onSuccess, onError, type) { + /* Shift argument */ + if ($.isFunction(data)) { + type = type || onError; + onError = onSuccess; + onSuccess = data; + data = null; + } + if (onError != null && !$.isFunction(onError)) { + type = type || onError; + onError = null; + } + + function ajaxHandler(data, textStatus, xhr) { + if (textStatus == 'success') { + if (onSuccess) { + onSuccess(data, textStatus, xhr); + } + } else if (textStatus == 'error') { + if (onError) { + onError(data, textStatus, xhr); + } else { + alert("Une error s'est produite lors du traitement de la requête.\n" + + "Ta session a peut-être expiré"); + } + } + } + return $.ajax({ + url: source, + type: method, + success: ajaxHandler, + data : data, + dataType: type + }); + }, + + xget: function(source, data, onSuccess, onError, type) { + return $.xajax(source, 'GET', data, onSuccess, onError, type); + }, + + xgetJSON: function(source, data, onSuccess, onError) { + return $.xget(source, data, onSuccess, onError, 'json'); + }, + + xgetScript: function(source, onSuccess, onError) { + return $.xget(source, null, onSuccess, onError, 'script'); + }, + + xgetText: function(source, data, onSuccess, onError) { + return $.xget(source, data, onSuccess, onError, 'text'); + }, + + xpost: function(source, data, onSuccess, onError, type) { + return $.xajax(source, 'POST', data, onSuccess, onError, type); + } + }); + + /* Add new functions to jQuery objects */ + $.fn.extend({ + tmpMessage: function(message, success) { + if (success) { + this.html(" " + message) + .css('color', 'green'); + } else { + this.html(" " + message) + .css('color', 'red'); + } + return this.css('fontWeight', 'bold') + .show() + .delay(1000) + .fadeOut(500); + }, + + updateHtml: function(source, callback) { + var elements = this; + function handler(data) { + elements.html(data); + if (callback) { + callback(data); + } + } + $.xget(source, handler, 'text'); + return this; + }, + + successMessage: function(source, message) { + var elements = this; + $.xget(source, function() { + elements.tmpMessage(message, true); + }); + return this; + }, + + wiki: function(text, withTitle) { + if (text == '') { + return this.html(''); + } + var url = 'wiki_preview'; + if (!withTitle) { + url += '/notitile'; + } + var $this = this; + $.post(url, { text: text }, + function (data) { + $this.html(data); + }, 'text'); + return this; + }, + + popWin: function(w, h) { + return this.click(function() { + window.open(this.href, '_blank', + 'toolbar=0,location=0,directories=0,status=0,' + +'menubar=0,scrollbars=1,resizable=1,' + +'width='+w+',height='+h); + return false; + }); + } + }); + })(jQuery); + + // }}} + // {{{ preview wiki + + function previewWiki(idFrom, idTo, withTitle, idShow) + { + $('#' + idTo).wiki($('#' + idFrom).val(), withTitle); + if (idShow != null) { + $('#' + idShow).show(); + } + } + + // }}} + // {{{ send test email + + function sendTestEmail(token, hruid) + { + var url = 'emails/test'; + var msg = "Un email a été envoyé avec succès"; + if (hruid != null) { + url += '/' + hruid; + msg += " sur l'adresse de " + hruid + "."; + } else { + msg += " sur ton addresse."; + } + $('#mail_sent').successMessage($url + '?token=' + token, msg); + return false; + } + + // }}} /***************************************************************************