Wiki source for HashAction

Show raw source

===Hash Action===

Creates an MD5 and/or SHA1 hash of the page body it's embedded in. The hash value is calculated from the wiki markup, so it should uniquely identify each page revision regardless of formatting applied to the markup. Currently in use on the [[http://wiki.opennic.glue | OpenNIC wiki]] [requires access to [[ | OpenNIC DNS]].

* Calculate a hash value for the page body.
* Hash value is calculated against the stringified version of the
* wiki markup, not the formatted output. Therefore, restoration of
* older page version should generate the same hash values independent
* of any CSS/formatter modifications.
* Syntax: {{hash type="md5"}} (Generates MD5 sum for page body)
* {{hash type="sha1"}} (Generates SHA1 sum for page body)
* @package Actions
* @version $Id$
* @license GNU General
* Public License
* @filesource
* @author {@link Brian Koontz}
if("md5" === $vars['type'])
print md5($this->htmlspecialchars_ent($this->page['body']));
else if("sha1" === $vars['type'])
print sha1($this->htmlspecialchars_ent($this->page['body']));
print "<em class=\"error\">Invalid hash type</em>";

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki