diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-10-06 17:40:58 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-10-06 17:40:58 -0700 |
commit | c7c3db8c54ada33c785a7303de582a3d0c1a14ee (patch) | |
tree | bb25fb74754d6f124b73b70f50ddc228e6399f59 | |
parent | 9f0cedad8e4f4063db7c8ee5cd9821ff10e39ea0 (diff) | |
download | volse-hubzilla-c7c3db8c54ada33c785a7303de582a3d0c1a14ee.tar.gz volse-hubzilla-c7c3db8c54ada33c785a7303de582a3d0c1a14ee.tar.bz2 volse-hubzilla-c7c3db8c54ada33c785a7303de582a3d0c1a14ee.zip |
i18n officially ready for prime time.
-rw-r--r-- | boot.php | 15 | ||||
-rw-r--r-- | include/Contact.php | 21 | ||||
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | util/README | 15 |
4 files changed, 52 insertions, 5 deletions
@@ -169,6 +169,15 @@ class App { }} +// retrieve the App structure +// useful in functions which require it but don't get it passed to them + +if(! function_exists('get_app')) { +function get_app() { + global $a; + return $a; +}}; + // Multi-purpose function to check variable state. // Usage: x($var) or $x($array,'key') @@ -269,19 +278,21 @@ function replace_macros($s,$r) { // load string tranlsation table for alternate language -// not yet implemented if(! function_exists('load_translation_table')) { function load_translation_table($lang) { global $a; + if(file_exists("view/$lang/strings.php")) + include("view/$lang/strings.php"); }} // translate string if translation exists if(! function_exists('t')) { function t($s) { - global $a; + + $a = get_app(); if($a->strings[$s]) return $a->strings[$s]; diff --git a/include/Contact.php b/include/Contact.php index c59038e5d..a915ae0b4 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -1,6 +1,27 @@ <?php +// Included here for completeness, but this is a very dangerous operation. +// It is the caller's responsibility to confirm the requestor's intent and +// authorisation to do this. + +function user_remove($uid) { + q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `group` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `intro` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `item` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `mail` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `photo` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid)); + q("DELETE FROM `user` WHERE `uid` = %d", intval($uid)); + if($uid == get_uid()) { + unset($_SESSION['authenticated']); + unset($_SESSION['uid']); + killme(); + } +} function contact_remove($id) { @@ -6,11 +6,15 @@ $a = new App; $debug_text = ''; // Debugging functions should never be used on production systems. -// Setup the database. +// Setup the language and database. $install = ((file_exists('.htconfig.php')) ? false : true); @include(".htconfig.php"); + +if(x($lang)) + load_translation_table($lang); + require_once("dba.php"); $db = new dba($db_host, $db_user, $db_pass, $db_data, $install); unset($db_host, $db_user, $db_pass, $db_data); diff --git a/util/README b/util/README index ee164d103..5dca64265 100644 --- a/util/README +++ b/util/README @@ -10,7 +10,11 @@ tinymce, simplepie, and the HTML parsers. In order for extract to do its job, every use of the t() translation function must be preceded by one space. The string also can not contain parentheses. If -parens are required in a string, please use hex escapes. +parens are required in a string which requires translation, please use hex escapes. + +\x28 = ( +\x29 = ) + strings.php - a recent run of the strings program. This provides output that is suitable for direct inclusion in the program once the app has been @@ -19,7 +23,14 @@ initialised. There are also translatable strings in the various files in the view directory. By setting $lang = 'something' in .htconfig.php, the application will search for view/something/filename prior to the English version in -view/filename when loading templates and view files. +view/filename when loading templates and view files. The translated string table +should be placed in view/$lang/strings.php for automatic inclusion. + +You are not restricted to using known languages. You may also use this to +translate the software into "pirate", "surfer" or merely to replace certain +text which you don't care for. + + |