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