diff options
author | Nathan Gass | 2012-03-22 18:19:43 +0000 |
---|---|---|
committer | Nathan Gass | 2012-03-22 18:19:43 +0000 |
commit | 1336ce6ac3baacd1cecbf776cfafa81f8d025272 (patch) | |
tree | 3924b3e2e12a5d5ea3b40890477d5e070498543c /devel-utf8/auto_prepend.php | |
parent | d59a4921188753dbe4c0161081755a28112c3ef6 (diff) | |
download | itools-1336ce6ac3baacd1cecbf776cfafa81f8d025272.tar.gz itools-1336ce6ac3baacd1cecbf776cfafa81f8d025272.tar.bz2 itools-1336ce6ac3baacd1cecbf776cfafa81f8d025272.zip |
Wrong branch itools/live/devel-utf8 removed
Diffstat (limited to 'devel-utf8/auto_prepend.php')
-rw-r--r-- | devel-utf8/auto_prepend.php | 232 |
1 files changed, 0 insertions, 232 deletions
diff --git a/devel-utf8/auto_prepend.php b/devel-utf8/auto_prepend.php deleted file mode 100644 index b71acb7..0000000 --- a/devel-utf8/auto_prepend.php +++ /dev/null @@ -1,232 +0,0 @@ -<?php - -/****************** functions for class it_debug **********************/ - -/** - * Return string containing names and values of all arguments - */ -function D() -{ - $args = func_get_args(); - return it_debug::dump($args); -} - -/** - * Echo string containing names and values of all arguments - */ -function ED() -{ - $args = func_get_args(); - if (ob_get_level() == 0 && $_SERVER['REMOTE_ADDR']) - ob_start(); # prevent later 'headers already sent' error - $GLOBALS['debug_noredir'] = 1; - echo it_debug::dump($args); - return $args[0]; -} - -/** - * Same as ED(), but if first argument is foo then $GLOBALS['debug_foo'] must be set for output - * @return boolean indicating whether $GLOBALS['debug_foo'] was set - */ -function EDC() -{ - $args = func_get_args(); - $var = array_shift($args); - $GLOBALS['ULTRADEBUGVARS'][$var] = 1; - - if (($result = $GLOBALS["debug_$var"]) && $args) - { - if (ob_get_level() == 0 && $_SERVER['REMOTE_ADDR']) - ob_start(); # prevent later 'headers already sent' error - echo it_debug::dump($args); - } - - if (!$result || $result === true) # Compatibility with old map relying on 0|1 - $result = intval($result); - - return $result; -} - -/** - * Echo string containing names and values of all arguments, then exit - */ -function EDX() -{ - $args = func_get_args(); - exit(it_debug::dump($args)); -} - - - -/****************** functions for class it_text **********************/ - -/** - * Return a text in the selected language - * @param $label Label of text to return - * @param $language Optional value array or language string - * @param $values Optional value array or language string - * @return Localized text string - */ -function T($label, $language = null, $values = null) -{ - it_text::init(); - - if (is_array($language)) # Need to swap params? - list($language, $values) = array($values, $language); - - return is_array($values) ? $GLOBALS['it_text']->etext($label, array_map(array("it_html", "Q"), $values), $language) : $GLOBALS['it_text']->text($label, $language); -} - -/** - * Return a text in the selected language - * Replaces variables of the form {var} with value from argument $values - * @param $label Label of text to return - * @param $values Associative array containing values to fill in - * @param $language Optional language to return text in. - * @return Localized text string with variables replaced by their values - */ -function ET($label, $values = null, $language = null) -{ - it_text::init(); - return $GLOBALS['it_text']->etext($label, $values, $language); -} - -/** - * Change language - * @param $language New language to set - */ -function T_set_language($language) -{ - it_text::init(); - return $GLOBALS['it_text']->set_language($language); -} - -/** - * Get active language - * @return currently active language - */ -function T_lang() -{ - it_text::init(); - return $GLOBALS['it_text']->get_language(); -} - -/** - * Get active language - * @return default language of browser - */ -function T_defaultlang() -{ - it_text::init(); - return $GLOBALS['it_text']->get_defaultlanguage(); -} - -/** - * Get available languages - * @return available languages as langcode => langname - */ -function T_languages() -{ - it_text::init(); - return $GLOBALS['it_text']->languages; -} - -/** - * Check if a text entry for a specific label exists - * @param $label Label to check - * @return true if text exists in actual (or supplied) language, false otherwise. - */ -function T_exists($label, $language = null) -{ - it_text::init(); - return $GLOBALS['it_text']->text_exists($label, $language); -} - -/** - * Return "db4" or "db2" depending on availability - */ -function db_version() -{ - return in_array("db4", dba_handlers()) ? "db4" : "db2"; -} - - - - -/****************** functions for class it_text **********************/ - -/** - * Build an url - */ -function U(/* ... */) -{ - $args = func_get_args(); - return call_user_func_array(array('it_html', 'U'), $args); -} - - - - -/************************** other functions ***************************/ - -/** - * Print an error message and end page - */ -function fail($text) -{ - trigger_error($text, E_USER_ERROR); - it::fatal($text); -} - -/** - * Global shortcut for $it_debug::debug() - * @see it_debug::debug() - */ -function debug($text, $level=0) -{ - if (isset($GLOBALS['it_debug'])) - $GLOBALS['it_debug']->debug($text, $level); -} - -/** - * Convert a htmlentities-encoded string back to normal - */ -function it_htmlentities_decode($string) -{ - return strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); -} - -/** - * Clone an object and return copy, works for all PHP versions - */ -function &it_clone(&$object) -{ - $result = (is_object($object) && version_compare(zend_version(), 2, '>=')) ? clone($object) : $object; - return $result; # PHP internals need a tmp var to return by ref -} - -/** - * Experimental PHP taint support, see ftp://ftp.porcupine.org/pub/php/ - */ -if (function_exists("taint")) -{ - function it_untaint($value, $marks = TC_HTML) { untaint($value, $marks); return $value; } - function it_taintcheck($value, $marks = TC_HTML) { if (istainted($value) & $marks) { untaint($value, $marks); it::error(it_untaint("it_taintcheck($value, $marks) failed")); } return $value; } -} -else -{ - define('TC_HTML', 0); - define('TC_SHELL', 0); - define('TC_MYSQL', 0); - define('TC_MYSQLI', 0); - define('TC_SELF', 0); - define('TC_ALL', 0); - define('TC_NONE', 0); - function it_untaint($value, $dummy_marks = 0) { return $value; } - function it_taintcheck($value, $dummy_marks = 0) { return $value; } -} - -# ULTRAHOME is generated in a safe way -$GLOBALS['ULTRAHOME'] = it_untaint($GLOBALS['ULTRAHOME'], TC_ALL); - -?> |