2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: md5.inc.php,v 1.18 2005/06/04 01:44:10 henoheno Exp $
7 // User interface of pkwk_hash_compute() for system admin
8 function plugin_md5_action()
12 if (PKWK_SAFE_MODE || PKWK_READONLY) die_message('Prohibited');
15 $key = isset($post['key']) ? $post['key'] : '';
16 $submit = isset($post['key']);
18 // Compute (Don't show its $key at the same time)
20 $prefix = isset($post['prefix']);
21 $salt = isset($post['salt']) ? $post['salt'] : '';
23 // With scheme-prefix or not
24 if (! preg_match('/^\{.+\}.*$/', $salt)) {
25 $scheme = isset($post['scheme']) ? '{' . $post['scheme'] . '}': '';
26 $salt = $scheme . $salt;
32 //($prefix ? 'userPassword: ' : '') .
33 pkwk_hash_compute($salt, $key, $prefix, TRUE));
36 // If plugin=md5&md5=password, only set it (Don't compute)
37 $value = isset($get['md5']) ? $get['md5'] : '';
38 if (strlen($value) > PKWK_PASSPHRASE_LIMIT_LENGTH)
39 die_message('Limit: malicious message length');
40 if ($value != '') $value = 'value="' . htmlspecialchars($value) . '" ';
42 $self = get_script_uri();
44 if ($submit) $form .= '<strong>NO PHRASE</strong><br />';
46 <p><strong>NOTICE: Don't use this feature via untrustful or unsure network</strong></p>
48 <form action="$self" method="post">
50 <input type="hidden" name="plugin" value="md5" />
51 <label for="_p_md5_phrase">Phrase:</label>
52 <input type="text" name="key" id="_p_md5_phrase" size="60" $value/><br />
54 <input type="radio" name="scheme" id="_p_md5_sha1" value="x-php-sha1" />
55 <label for="_p_md5_sha1">PHP sha1()</label><br />
56 <input type="radio" name="scheme" id="_p_md5_md5" value="x-php-md5" checked="checked" />
57 <label for="_p_md5_md5">PHP md5()</label><br />
58 <input type="radio" name="scheme" id="_p_md5_crpt" value="x-php-crypt" />
59 <label for="_p_md5_crpt">PHP crypt() *</label><br />
61 <input type="radio" name="scheme" id="_p_md5_lssha" value="SSHA" />
62 <label for="_p_md5_lssha">LDAP SSHA (sha-1 with a seed) *</label><br />
63 <input type="radio" name="scheme" id="_p_md5_lsha" value="SHA" />
64 <label for="_p_md5_lsha">LDAP SHA (sha-1)</label><br />
66 <input type="radio" name="scheme" id="_p_md5_lsmd5" value="SMD5" />
67 <label for="_p_md5_lsmd5">LDAP SMD5 (md5 with a seed) *</label><br />
68 <input type="radio" name="scheme" id="_p_md5_lmd5" value="MD5" />
69 <label for="_p_md5_lmd5">LDAP MD5</label><br />
71 <input type="radio" name="scheme" id="_p_md5_lcrpt" value="CRYPT" />
72 <label for="_p_md5_lcrpt">LDAP CRYPT *</label><br />
74 <input type="checkbox" name="prefix" id="_p_md5_prefix" checked="checked" />
75 <label for="_p_md5_prefix">Add scheme prefix (RFC2307, Using LDAP as NIS)</label><br />
77 <label for="_p_md5_salt">Salt, '{scheme}', '{scheme}salt', or userPassword itself to specify:</label><br />
78 <input type="text" name="salt" id="_p_md5_salt" size="60" /><br />
80 <input type="submit" value="Compute" /><br />
83 <p>* = Salt enabled<p/>
87 return array('msg'=>'Compute userPassword', 'body'=>$form);