libraries/tbs/plugins/tbs_plugin_opentbs.php
function _PutDec(&$txt, $val, $pos, $len) {
		$x = '';
		for ($i=0;$i<$len;$i++) {
			if ($val==0) {
				$z = 0;
			} else {
				$z = intval($val % 256);
				if (($val<0) && ($z!=0)) { // ($z!=0) is very important, example: val=-420085702
					// special opration for negative value. If the number id too big, PHP stores it into a signed integer. For example: crc32('coucou') => -256185401 instead of  4038781895. NegVal = BigVal - (MaxVal+1) = BigVal - 256^4
					$val = ($val - $z)/256 -1;
					$z = 256 + $z;
				} else {
					$val = ($val - $z)/256;
				}
			}
			$x .= chr($z);
		}
		$txt = substr_replace($txt, $x, $pos, $len);
	}
function _PutDec(&$txt, $val, $pos, $len) {
		$x = '';
		for ($i=0;$i<$len;$i++) {
			if ($val==0) {
				$z = 0;
			} else {
				$z = intval($val % 256);
				if (($val<0) && ($z!=0)) { // ($z!=0) is very important, example: val=-420085702
					// special opration for negative value. If the number id too big, PHP stores it into a signed integer. For example: crc32('coucou') => -256185401 instead of  4038781895. NegVal = BigVal - (MaxVal+1) = BigVal - 256^4
					$val = ($val - $z)/256 -1;
					$z = 256 + $z;
				} else {
					$val = ($val - $z)/256;
				}
			}
			$x .= chr($z);
		}
		$txt = substr_replace($txt, $x, $pos, $len);
	}
function _PutDec ( & $ txt , $ val , $ pos , $ len ) { $ x = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( $ val == 0 ) { $ z = 0 ; } else { $ z = intval ( $ val % 256 ) ; if ( ( $ val < 0 ) && ( $ z != 0 ) ) { // ($z!=0) is very important, example: val=-420085702 // special opration for negative value. If the number id too big, PHP stores it into a signed integer. For example: crc32('coucou') => -256185401 instead of  4038781895. NegVal = BigVal - (MaxVal+1) = BigVal - 256^4 $ val = ( $ val - $ z ) / 256 - 1 ; $ z = 256 + $ z ; } else { $ val = ( $ val - $ z ) / 256 ; } } $ x .= chr ( $ z ) ; } $ txt = substr_replace ( $ txt , $ x , $ pos , $ len ) ; }
----------------
----------------