array('HandleMd5', TYPE_TEXT, 'leakon => 374705bc8057061ff384d6e9b0f7d3e3'), 'gbk_encode' => array('HandleGBKEncode', TYPE_TEXT, '百度 => %B0%D9%B6%C8'), 'gbk_decode' => array('HandleGBKDecode', TYPE_TEXT, '%B0%D9%B6%C8 => 百度'), 'utf8_encode' => array('urlencode', TYPE_TEXT, '百度 => %E7%99%BE%E5%BA%A6'), 'utf8_decode' => array('urldecode', TYPE_TEXT, '%E7%99%BE%E5%BA%A6 => 百度'), 'str_time' => array('my_strtotime', TYPE_TEXT, '1983-08-03 10:10 => 428724600 (Timezone:PRC)'), 'time_str' => array('timetostr', TYPE_TEXT, '1173522000 => 2007-03-10 18:20 (Timezone:PRC)'), '1970_days' => array('Days_after_1970', TYPE_TEXT, '13794 => 1790-01-01 + (13794 * 86400) => 2007-10-08 (Timezone:PRC)'), 'log_decode' => array('HandleLogDecode', TYPE_TEXT, '\xb0\xd9\xb6\xc8 => 百度'), 'htmlentities' => array('my_htmlentities', TYPE_TEXT, '<a href="http://www.leakon.com/">Leakon's Blog</a> => &lt;a href=&quot;http://www.leakon.com/&quot;&gt;Leakon&#039;s Blog&lt;/a&gt;'), 'html_entity_decode' => array('my_html_entity_decode', TYPE_TEXT, '&lt;a href=&quot;http://www.leakon.com/&quot;&gt;Leakon&#039;s Blog&lt;/a&gt; => <a href="http://www.leakon.com/">Leakon's Blog</a>'), 'unserialize' => array('unserialize', TYPE_TEXTAREA, 'a:2:{s:4:"name";s:6:"Leakon";s:3:"age";i:25;} => Array([name] => Leakon, [age] => 25)'), 'gbk_unserialize' => array('gbk_unserialize', TYPE_TEXTAREA, 'a:2:{s:4:"name";s:6:"Leakon";s:3:"age";i:25;} => Array([name] => Leakon, [age] => 25)'), 'base64_encode' => array('base64_encode', TYPE_TEXTAREA, 'leakon.com => bGVha29uLmNvbQ=='), 'base64_decode' => array('base64_decode', TYPE_TEXTAREA, 'bGVha29uLmNvbQ== => leakon.com'), ); $useHtmlSpecialChars = false; if (isset($_REQUEST['use_special_chars']) && '1' == $_REQUEST['use_special_chars']) { $useHtmlSpecialChars = true; } ################################################################################ ## Function Begin function DrawInput($key, $mapData) { static $isOddRow = 0; $arrForm =& $_POST['form']; $classOfTr = $isOddRow ? 'oddRow' : ''; $isOddRow = abs($isOddRow - 1); $strLastObj = ''; if (isset($_POST['func']) && $key == $_POST['func']) { $strLastObj = ''; $classOfTr = 'rowFocus'; } echo ' ' . $key . '
Top Submit

'; if (isset($mapData[MAPPING_DEMO]) && strlen($mapData[MAPPING_DEMO])) { echo '' . $mapData[MAPPING_DEMO] . '
'; } if (TYPE_TEXT == $mapData[MAPPING_FORM_TYPE]) { echo ' '; } else if (TYPE_TEXTAREA == $mapData[MAPPING_FORM_TYPE]) { echo ' '; } echo '

'; if (isset($arrForm[$key]) && strlen($strOfForm = trim($arrForm[$key]))) { if (IS_MAGIC_QUOTE) { $strOfForm = stripslashes($strOfForm); } $ret = call_user_func($mapData[MAPPING_FUNC_NAME], $strOfForm); Output($ret); } echo $strLastObj; echo ' '; } function Output($var) { if ($GLOBALS['useHtmlSpecialChars']) { $var = htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } echo '
';
	print_r($var);
	echo	'
'; } function SetInput($strInput) { if (IS_MAGIC_QUOTE) { $strInput = stripslashes($strInput); } return htmlspecialchars($strInput, ENT_QUOTES, 'UTF-8'); } // From http://w3.org/International/questions/qa-forms-utf-8.html function isUTF8($string) { // IF mb_string is compiled, use mb_detect_order & mb_detect_encoding is prefered. // mb_detect_order("UTF-8,GBK,SJIS,EUC-JP"); // $encoding = mb_detect_encoding($string); $regex = '/^(' . '[\x09\x0A\x0D\x20-\x7E]|' # ASCII . '[\xC2-\xDF][\x80-\xBF]|' # non-overlong 2-byte . '\xE0[\xA0-\xBF][\x80-\xBF]|' # excluding overlongs . '[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|' # straight 3-byte . '\xED[\x80-\x9F][\x80-\xBF]|' # excluding surrogates . '\xF0[\x90-\xBF][\x80-\xBF]{2}|' # planes 1-3 . '[\xF1-\xF3][\x80-\xBF]{3}|' # planes 4-15 . '\xF4[\x80-\x8F][\x80-\xBF]{2}' # plane 16 . ')*\z/x'; return 1 == preg_match($regex, $string); } ################################################################################ ## Handler function HandleGBKEncode($strInput) { $strInput = mb_convert_encoding($strInput, 'GBK', 'UTF-8'); return urlencode($strInput); } function HandleGBKDecode($strInput) { $strInput = urldecode($strInput); return mb_convert_encoding($strInput, 'UTF-8', 'GBK'); } function HandleMd5($strInput) { return md5($strInput); } function HandleLogDecode($strInput) { $strInput = str_ireplace("\\x", "%", $strInput); $strInput = urldecode($strInput); return HandleGBKDecode($strInput); } function timetostr($strInput) { $time = substr($strInput, 0, 10); return date('Y-m-d H:i:s', $strInput) . Append1970Days($strInput); } function my_strtotime($strInput) { $time = strtotime($strInput); return $time . Append1970Days($time); } function Append1970Days($strInput) { $daysAfter1970 = floor($strInput / 86400); return "
$daysAfter1970 days after 1970-01-01"; } function Days_after_1970($strInput) { return date('Y-m-d H:i:s', $strInput * 86400); } function my_htmlentities($strInput) { return htmlentities(htmlentities($strInput, ENT_QUOTES), ENT_QUOTES); } function my_html_entity_decode($strInput) { return htmlentities(html_entity_decode($strInput, ENT_QUOTES), ENT_QUOTES); } function gbk_unserialize($strInput) { $gbkString = mb_convert_encoding($strInput, 'GBK', 'UTF-8'); $arr = unserialize($gbkString); return ConvertR($arr, 'UTF-8', 'GBK'); } function ConvertR($mixedInput, $to, $from) { if (is_array($mixedInput)) { $arrNew = array(); foreach ($mixedInput as $key => $val) { $newKey = mb_convert_encoding($key, $to, $from); $arrNew[$newKey] = ConvertR($val, $to, $from); } return $arrNew; } else { return mb_convert_encoding($mixedInput, $to, $from); } } ## Function End ################################################################################ ?> DevelopTools - Leakon $val) { $arrIndex[] = '' . $key . ''; } $arrIndex[] = 'Leakon'; $mod = count($arrIndex) % NAV_COLUMN; $patchNum = $mod == 0 ? 0 : NAV_COLUMN - $mod; $rowCount = 0; foreach ($arrIndex as $val) { $arrRows[$rowCount][] = $val; if (NAV_COLUMN == count($arrRows[$rowCount])) { $rowCount++; } } for ($i = 0; $i < $patchNum; $i++) { $arrRows[$rowCount][] = ' '; } $strTable = ''; foreach ($arrRows as $oneRow) { $strTable .= ''; } echo $strTable; ?>
' . implode('', $oneRow) . '
/> $val) { DrawInput($key, $val); } ?>