Project

General

Profile

« Previous | Next » 

Revision 787

Added by doc about 16 years ago

Fixed bug in the mailto encryption code of the Output-Filter module

View differences:

mdcr.js
1 1

  
2 2
// $Id$
3 3

  
4
/*
5
--------------------------------------------------------------------------------
6
  JAVASCRIPT ROUTINE FOR THE WEBSITE BAKER 2.7 OUTPUT FILTER MODULE
7
  Licencsed under GNU, written by Christian Sommer (Doc)
8
--------------------------------------------------------------------------------
9
*/
10 4

  
11
function mdcr(s) {
12
  location.href=dcstr(s);
5
function mdcr(a,b) {
6
  location.href=sdcr(a,b);
13 7
}
14 8

  
15
function dcstr(s) {
16
  var m = unescape(s);
17
  var x = m.charCodeAt(7)-97;
18
  var c = m.substr(0,7) + m.substr(8);
19
  var n=0;
20
  var r="";
21

  
22
  for(var i=0; i<c.length; i++) {
23
    r+=String.fromCharCode(c.charCodeAt(i) - x);
9
function sdcr(a,f) {
10
  var b = a.charCodeAt(a.length-1) -97;
11
  var c=""; var e;
12
  
13
  for(var d=a.length-2; d>-1; d--) {
14
    if(a.charCodeAt(d) < 97) {
15
      if(a.charCodeAt(d) == 70) { c+=String.fromCharCode(64); }
16
      if(a.charCodeAt(d) == 90) { c+=String.fromCharCode(46); }
17
      if(a.charCodeAt(d) == 88) { c+=String.fromCharCode(95); }
18
      if(a.charCodeAt(d) == 45) { c+=String.fromCharCode(45); }
19
    } else {
20
      e=(a.charCodeAt(d) - 97 - b) % 26;
21
      e+=(e<0 || e>25) ? +26 : 0;
22
      c+=String.fromCharCode(e+97);
23
    }
24 24
  }
25
  return r;
25
  return "mailto:"+c+unescape(f);
26 26
}

Also available in: Unified diff