From 576978376132b05e4d8286f0e3d78bbe0babb6cf Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 8 May 2013 01:17:52 +0000 Subject: [PATCH] Multilinguified. --- app/xmpp/app_languages.php | 188 +++++++++++++++ app/xmpp/profile_delete.php | 16 +- app/xmpp/profile_edit.php | 410 +++++++++++++++++---------------- app/xmpp/profile_list.php | 24 +- app/xmpp/update_complete.php | 11 +- app/xmpp/xmpp.php | 9 + app/xmpp/xmpp_profile_edit.php | 41 ++-- 7 files changed, 462 insertions(+), 237 deletions(-) create mode 100644 app/xmpp/app_languages.php diff --git a/app/xmpp/app_languages.php b/app/xmpp/app_languages.php new file mode 100644 index 0000000000..1375df8a6b --- /dev/null +++ b/app/xmpp/app_languages.php @@ -0,0 +1,188 @@ + \ No newline at end of file diff --git a/app/xmpp/profile_delete.php b/app/xmpp/profile_delete.php index 9e6d39dd18..eab283a7a2 100644 --- a/app/xmpp/profile_delete.php +++ b/app/xmpp/profile_delete.php @@ -29,13 +29,19 @@ include "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; if (permission_exists('xmpp_delete')) { - //access granted + //access granted } else { - echo "access denied"; - exit; + echo "access denied"; + exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + require_once "includes/header.php"; $domain_name = $_SESSION['domains'][$domain_uuid]['domain_name']; @@ -64,7 +70,7 @@ $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and xmpp_profile_uuid = '$profile_id' "; $db->exec(check_sql($sql)); -$filename = $_SESSION['switch']['conf']['dir'] . "/jingle_profiles/" . "v_" . $domain_name . "_" . +$filename = $_SESSION['switch']['conf']['dir'] . "/jingle_profiles/" . "v_" . $domain_name . "_" . preg_replace("/[^A-Za-z0-9]/", "", $profile['profile_name']) . "_" . $profile_id . ".xml"; unlink($filename); @@ -85,6 +91,8 @@ if ($fp) { fclose($fp); } +$action = "delete"; + include "update_complete.php"; //show the footer diff --git a/app/xmpp/profile_edit.php b/app/xmpp/profile_edit.php index c70aff61e5..3f75fc1b25 100644 --- a/app/xmpp/profile_edit.php +++ b/app/xmpp/profile_edit.php @@ -26,256 +26,264 @@ function hide_advanced_config() {
-
- - - + - - - + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
- - - +
+
- Profile Edit
-
- - - -
+ + + +
+ + + - - -
+ + +
+
+ '> + '> +
- Defines a connections to a Jabber, GTalk, or other XMPP Provider server.
-
+
+
+

-
- Profile Name: - - -
- Enter the profile name here. -
+ : + + +
+ +
- Username: + :
- Enter the XMPP username here. +
- Password: + : - +
- Enter the password here. +
- Auto-Login: + :
- Choose whether to automatically login. -
- XMPP Server: - - -
- Enter alternate XMPP server if the server is not the same as the one in the Username
- Example GoogleTalk is: talk.google.com -
- Default Extension: - - -
- Default extension (if one cannot be determined) +
-
- - - - + + + + + + + + + + +
Show Advanced - - + : + + +
+ +
+ : + + +
+ +
+
+ + + + -
+ +
+
-
+ +
+ +
+ : + + +
+ +
+ : + + +
+ +
+ : + + +
+ +
+ : + + +
+ +
- - - - - Enabled: - - - -
- - + + - - Profile Description: - - - '> -
- Enter the description of the Profile here. - - - - - '> - - + + : + + + +
+ + + + + + : + + + '> +
+ + + + + + '> + '> +
diff --git a/app/xmpp/profile_list.php b/app/xmpp/profile_list.php index fce7773c44..46b07542e3 100644 --- a/app/xmpp/profile_list.php +++ b/app/xmpp/profile_list.php @@ -2,8 +2,8 @@ -
XMPP Manager
- Utilizes the Jingle protocol. Jingle is an extension to the Jabber/XMPP protocol. +

+
@@ -11,14 +11,14 @@ - - - - - + + + + + @@ -38,11 +38,11 @@ foreach($profiles_array as $profile){ @@ -53,7 +53,7 @@ if ($c==0) { $c=1; } else { $c=0; } diff --git a/app/xmpp/update_complete.php b/app/xmpp/update_complete.php index b7af89cb9a..a7b080dff8 100644 --- a/app/xmpp/update_complete.php +++ b/app/xmpp/update_complete.php @@ -1,11 +1,10 @@
-
diff --git a/app/xmpp/xmpp.php b/app/xmpp/xmpp.php index 3d15b9ef2e..0bb9ec4655 100644 --- a/app/xmpp/xmpp.php +++ b/app/xmpp/xmpp.php @@ -35,7 +35,16 @@ else { echo "access denied"; exit; } + +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + require_once "includes/header.php"; +$page["title"] = $text['title-xmpp']; + require_once "includes/paging.php"; //connect to event socket diff --git a/app/xmpp/xmpp_profile_edit.php b/app/xmpp/xmpp_profile_edit.php index f844257472..4964c8ccb4 100644 --- a/app/xmpp/xmpp_profile_edit.php +++ b/app/xmpp/xmpp_profile_edit.php @@ -38,18 +38,30 @@ else { exit; } -require_once "includes/header.php"; - -$domain_name = $_SESSION['domains'][$_SESSION['domain_uuid']]['domain_name']; +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } //add or update the database if (isset($_REQUEST["id"])) { $action = "update"; $profile_id = check_str($_REQUEST["id"]); -} else { +} else { $action = "add"; } +require_once "includes/header.php"; +if ($action == "update") { + $page["title"] = $text['title-xmpp-edit']; +} +else if ($action == "add") { + $page["title"] = $text['title-xmpp-add']; +} + +$domain_name = $_SESSION['domains'][$_SESSION['domain_uuid']]['domain_name']; + if ($action == "update") { $sql = ""; $sql .= "select * from v_xmpp "; @@ -83,9 +95,9 @@ if ($action == "update") { $profile['local_network_acl'] = "localnet.auto"; } -if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) { +if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != $text['button-save'])) { // If we arent saving a Profile Display the form. - include "profile_edit.php"; + include "profile_edit.php"; require_once "includes/footer.php"; exit; } @@ -94,16 +106,17 @@ foreach ($_REQUEST as $field => $data){ $request[$field] = check_str($data); } + // check the data $error = ""; -if (strlen($request['profile_name']) < 1) $error .= "Profile name is a Required Field
\n"; -if (strlen($request['profile_username']) < 1) $error .= "Username is a Required Field
\n"; -if (strlen($request['profile_password']) < 1) $error .= "Password is a Required Field
\n"; -if (strlen($request['default_exten']) < 1) $error .= "Default Extension is a Required Field
\n"; -if (strlen($error) > 0) { +if (strlen($request['profile_name']) < 1) $error .= $text['message-required'].$text['label-profile_name']."
\n"; +if (strlen($request['profile_username']) < 1) $error .= $text['message-required'].$text['label-username']."
\n"; +if (strlen($request['profile_password']) < 1) $error .= $text['message-required'].$text['label-password']."
\n"; +if (strlen($request['default_exten']) < 1) $error .= $text['message-required'].$text['label-default_exten']."
\n"; +if (strlen($error) > 0) { include "errors.php"; $profile = $request; - include "profile_edit.php"; + include "profile_edit.php"; require_once "includes/footer.php"; exit; } @@ -164,7 +177,7 @@ if ($action == "add" && permission_exists('xmpp_add')) { $sql .= ") "; $db->exec(check_sql($sql)); -} +} elseif ($action == "update" && permission_exists('xmpp_edit')) { $sql = ""; $sql .= "UPDATE v_xmpp SET "; @@ -195,7 +208,7 @@ elseif ($action == "update" && permission_exists('xmpp_edit')) { $sql .= "where xmpp_profile_uuid = '" . $request['id'] . "' "; $db->exec(check_sql($sql)); $xmpp_profile_uuid = $request['id']; -} +} if ($request['enabled'] == "true") { //prepare the xml
ProfileContextStatusEnabledDescription - + '>
  - ' alt='edit'> + ' alt=''> - ' onclick="return confirm('Do you really want to delete this?')" - alt='delete'> + ' onclick="return confirm('')" + alt=''>
- + '>