13 |
* $Id$ |
* $Id$ |
14 |
* |
* |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.4 2003/04/09 07:55:47 joko |
17 |
|
* + function untwingle_reference |
18 |
|
* |
19 |
|
* Revision 1.3 2003/04/08 22:35:16 joko |
20 |
|
* + 'function yesno' from utils/links.php |
21 |
|
* |
22 |
|
* Revision 1.2 2003/04/06 01:37:31 jonen |
23 |
|
* + added functions to generate and handle unique ID's |
24 |
|
* |
25 |
* Revision 1.1 2003/04/05 19:53:45 joko |
* Revision 1.1 2003/04/05 19:53:45 joko |
26 |
* moved here from ../ |
* moved here from ../ |
27 |
* |
* |
646 |
|
|
647 |
} |
} |
648 |
|
|
649 |
|
//examples on howto create unique id's |
650 |
|
// from: http://www.php.net/manual/en/function.uniqid.php |
651 |
|
function CreateGUID(){ |
652 |
|
srand((double)microtime()*1000000); |
653 |
|
$r = rand ; |
654 |
|
$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
655 |
|
$m = md5 ($u); |
656 |
|
return($m); |
657 |
|
} |
658 |
|
|
659 |
|
function CompressID( $ID ){ |
660 |
|
return(Base64_encode(pack("H*",$ID))); |
661 |
|
} |
662 |
|
|
663 |
|
function ExpandID ($ID){ |
664 |
|
return ( implode(unpack("H*",Base64_decode($ID)), '') ); |
665 |
|
} |
666 |
|
|
667 |
|
// from: utils/links.php |
668 |
|
function yesno($bool) { |
669 |
|
return $bool ? 'yes' : 'no'; |
670 |
|
} |
671 |
|
|
672 |
|
function untwingle_reference($item, $options = array()) { |
673 |
|
|
674 |
|
// default |
675 |
|
if (!$options['seperator']) { $options['seperator'] = '_'; } |
676 |
|
|
677 |
|
if ( is_string($item) && (substr($item, 0, 2) == "o_") ) { |
678 |
|
//print "YAI!<br/>"; |
679 |
|
$parts = split($options['seperator'], $item); |
680 |
|
$result = array( |
681 |
|
ident => $parts[1], |
682 |
|
type => $parts[2], |
683 |
|
); |
684 |
|
return $result; |
685 |
|
} |
686 |
|
} |
687 |
|
|
688 |
} |
} |
689 |
|
|