Browse Source

Server side translations working.

Nathaniel van Diepen 10 years ago
parent
commit
44af78ba72

+ 0 - 608
lang/en/C/LC_MESSAGES/omninet.po

@@ -1,608 +0,0 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Omninet\n"
-"POT-Creation-Date: 2014-02-20 22:21-0700\n"
-"PO-Revision-Date: 2014-02-20 22:21-0700\n"
-"Last-Translator: Nathaniel van Diepen <[email protected]>\n"
-"Language-Team: Omnimaga <[email protected]>\n"
-"Language: en\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 1.6.4\n"
-"X-Poedit-Basepath: .\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Poedit-SearchPath-0: ../../../..\n"
-
-#: ../../../../lib/configuration.php:133 ../../../../lib/users.php:163
-msgid "Save"
-msgstr ""
-
-#: ../../../../lib/irc.php:37
-msgid "Insufficient Parameters to login"
-msgstr ""
-
-#: ../../../../lib/irc.php:40
-msgid "Account is not registered"
-msgstr ""
-
-#: ../../../../lib/irc.php:43
-msgid "Invalid Username/Password"
-msgstr ""
-
-#: ../../../../lib/irc.php:46
-msgid "Account is frozen"
-msgstr ""
-
-#: ../../../../lib/irc.php:49
-msgid "Could not log in"
-msgstr ""
-
-#: ../../../../lib/irc.php:132
-msgid "Could not connect."
-msgstr ""
-
-#: ../../../../lib/irc.php:133
-msgid "Could not set timeout."
-msgstr ""
-
-#: ../../../../lib/irc.php:143 ../../../../lib/irc.php:160
-#: ../../../../lib/irc.php:177
-msgid "RehashServ is already running."
-msgstr ""
-
-#: ../../../../lib/irc.php:145 ../../../../lib/irc.php:162
-#: ../../../../lib/irc.php:179
-msgid "IRC Server refused the connection."
-msgstr ""
-
-#: ../../../../lib/irc.php:166
-msgid "Failed to authenticate with NickServ"
-msgstr ""
-
-#: ../../../../lib/irc.php:183
-msgid "vhost not set."
-msgstr ""
-
-#: ../../../../lib/irc.php:203
-msgid "There is an error in the config. See console for output."
-msgstr ""
-
-#: ../../../../lib/irc.php:205
-msgid "Rehashed. View console for output."
-msgstr ""
-
-#: ../../../../lib/opers.php:56
-msgid "Managed Oper"
-msgstr ""
-
-#: ../../../../lib/opers.php:56
-msgid "Personal Oper"
-msgstr ""
-
-#: ../../../../lib/opers.php:59 ../../../../lib/servers.php:111
-#: ../../../../lib/users.php:143
-msgid "Nick"
-msgstr ""
-
-#: ../../../../lib/opers.php:65
-msgid "Omnimaga Profile"
-msgstr ""
-
-#: ../../../../lib/opers.php:71 ../../../../site/index.php:336
-msgid "New Password"
-msgstr ""
-
-#: ../../../../lib/security.php:63
-msgid "Invalid credentials"
-msgstr ""
-
-#: ../../../../lib/security.php:67 ../../../../lib/security.php:81
-#: ../../../../site/api/index.php:159 ../../../../site/index.php:349
-#: ../../../../site/index.php:403
-msgid "User"
-msgstr ""
-
-#: ../../../../lib/security.php:67 ../../../../lib/security.php:81
-#: ../../../../site/api/index.php:159
-msgid "does not exist"
-msgstr ""
-
-#: ../../../../lib/security.php:73
-msgid "Invalid persona email"
-msgstr ""
-
-#: ../../../../lib/security.php:84 ../../../../site/api/index.php:258
-msgid "Invalid password"
-msgstr ""
-
-#: ../../../../lib/security.php:102 ../../../../lib/security.php:171
-msgid "Failed to create Authy user"
-msgstr ""
-
-#: ../../../../lib/security.php:115
-msgid "Token didn't match "
-msgstr ""
-
-#: ../../../../lib/security.php:122 ../../../../lib/security.php:204
-#: ../../../../site/api/index.php:44 ../../../../site/api/index.php:77
-#: ../../../../site/api/index.php:105 ../../../../site/api/index.php:154
-#: ../../../../site/api/index.php:168 ../../../../site/api/index.php:230
-#: ../../../../site/api/index.php:245 ../../../../site/api/index.php:253
-msgid "You have been logged out"
-msgstr ""
-
-#: ../../../../lib/security.php:137 ../../../../lib/security.php:140
-#: ../../../../lib/security.php:150
-msgid "Failed to disable 2-factor authentication"
-msgstr ""
-
-#: ../../../../lib/security.php:178
-msgid "No cell number set"
-msgstr ""
-
-#: ../../../../lib/security.php:181
-msgid "No country code set"
-msgstr ""
-
-#: ../../../../lib/security.php:191
-msgid "Could not register"
-msgstr ""
-
-#: ../../../../lib/security.php:194
-msgid "No secret key defined"
-msgstr ""
-
-#: ../../../../lib/security.php:197
-msgid "No token provided"
-msgstr ""
-
-#: ../../../../lib/servers.php:104 ../../../../site/api/index.php:124
-msgid "Owner"
-msgstr ""
-
-#: ../../../../lib/servers.php:105 ../../../../lib/users.php:137
-msgid "Real Name"
-msgstr ""
-
-#: ../../../../lib/servers.php:105 ../../../../lib/users.php:149
-msgid "Email"
-msgstr ""
-
-#: ../../../../lib/servers.php:108 ../../../../site/index.php:182
-msgid "Opers"
-msgstr ""
-
-#: ../../../../lib/servers.php:111
-msgid "Role"
-msgstr ""
-
-#: ../../../../lib/servers.php:119
-msgid "Parent"
-msgstr ""
-
-#: ../../../../lib/servers.php:123
-msgid "Children"
-msgstr ""
-
-#: ../../../../site/api/index.php:22
-msgid "Missing username and/or password"
-msgstr ""
-
-#: ../../../../site/api/index.php:23
-msgid "Missing user type"
-msgstr ""
-
-#: ../../../../site/api/index.php:32
-msgid "No token set"
-msgstr ""
-
-#: ../../../../site/api/index.php:73
-msgid "Cannot fetch memos"
-msgstr ""
-
-#: ../../../../site/api/index.php:101
-msgid "Cannot fetch news"
-msgstr ""
-
-#: ../../../../site/api/index.php:117
-msgid "Voice"
-msgstr ""
-
-#: ../../../../site/api/index.php:118
-msgid "Automatic voice"
-msgstr ""
-
-#: ../../../../site/api/index.php:119
-msgid "Halfop"
-msgstr ""
-
-#: ../../../../site/api/index.php:120
-msgid "Automatic Halfop"
-msgstr ""
-
-#: ../../../../site/api/index.php:121
-msgid "Op"
-msgstr ""
-
-#: ../../../../site/api/index.php:122
-msgid "Automatic Op"
-msgstr ""
-
-#: ../../../../site/api/index.php:123
-msgid "Admin"
-msgstr ""
-
-#: ../../../../site/api/index.php:125
-msgid "Set"
-msgstr ""
-
-#: ../../../../site/api/index.php:126
-msgid "Invite/Getkey"
-msgstr ""
-
-#: ../../../../site/api/index.php:127
-msgid "Kick/Ban"
-msgstr ""
-
-#: ../../../../site/api/index.php:128
-msgid "Recover/Clear"
-msgstr ""
-
-#: ../../../../site/api/index.php:129
-msgid "Modify access lists"
-msgstr ""
-
-#: ../../../../site/api/index.php:130
-msgid "Topic"
-msgstr ""
-
-#: ../../../../site/api/index.php:131
-msgid "View access lists"
-msgstr ""
-
-#: ../../../../site/api/index.php:132
-msgid "Founder"
-msgstr ""
-
-#: ../../../../site/api/index.php:133
-msgid "Banned"
-msgstr ""
-
-#: ../../../../site/api/index.php:150
-msgid "Cannot fetch channels"
-msgstr ""
-
-#: ../../../../site/api/index.php:155
-msgid "No message or user entered"
-msgstr ""
-
-#: ../../../../site/api/index.php:161
-msgid "Memo Sent"
-msgstr ""
-
-#: ../../../../site/api/index.php:164 ../../../../site/api/index.php:172
-msgid "Cannot send memo"
-msgstr ""
-
-#: ../../../../site/api/index.php:169
-msgid "No id given"
-msgstr ""
-
-#: ../../../../site/api/index.php:205
-msgid "Failed to add email"
-msgstr ""
-
-#: ../../../../site/api/index.php:205
-msgid "to user"
-msgstr ""
-
-#: ../../../../site/api/index.php:207
-msgid "Email does not match any users"
-msgstr ""
-
-#: ../../../../site/api/index.php:231
-msgid "No ID set"
-msgstr ""
-
-#: ../../../../site/api/index.php:233
-msgid "Could not remove email address"
-msgstr ""
-
-#: ../../../../site/api/index.php:250
-msgid "2-factor disabled."
-msgstr ""
-
-#: ../../../../site/api/index.php:257 ../../../../site/api/index.php:272
-#: ../../../../site/api/index.php:283
-msgid "Make sure that everything is filled in. Try reloading if it is."
-msgstr ""
-
-#: ../../../../site/api/index.php:263
-msgid "Could not update password with nickserv"
-msgstr ""
-
-#: ../../../../site/api/index.php:273
-msgid "Not Logged in to use"
-msgstr ""
-
-#: ../../../../site/api/index.php:273
-msgid "with key"
-msgstr ""
-
-#: ../../../../site/api/index.php:274
-msgid "Must be logged in with type user to sync pass"
-msgstr ""
-
-#: ../../../../site/api/index.php:277
-msgid "Could not verify with nickserv"
-msgstr ""
-
-#: ../../../../site/api/index.php:280
-msgid "Nickserv password synchronized with main account"
-msgstr ""
-
-#: ../../../../site/api/index.php:288 ../../../../site/api/index.php:301
-#: ../../../../site/api/index.php:320
-msgid "Not logged in"
-msgstr ""
-
-#: ../../../../site/api/index.php:289 ../../../../site/api/index.php:302
-msgid "No user set."
-msgstr ""
-
-#: ../../../../site/api/index.php:290
-msgid "No email set."
-msgstr ""
-
-#: ../../../../site/api/index.php:291
-msgid "No real name set."
-msgstr ""
-
-#: ../../../../site/api/index.php:292 ../../../../site/api/index.php:303
-msgid "No nick set."
-msgstr ""
-
-#: ../../../../site/api/index.php:293
-msgid "User with id"
-msgstr ""
-
-#: ../../../../site/api/index.php:293 ../../../../site/api/index.php:305
-msgid "does not exist. You should reload the page."
-msgstr ""
-
-#: ../../../../site/api/index.php:297
-msgid "Unable to update user"
-msgstr ""
-
-#: ../../../../site/api/index.php:304
-msgid "No profile set."
-msgstr ""
-
-#: ../../../../site/api/index.php:305
-msgid "Oper with id"
-msgstr ""
-
-#: ../../../../site/api/index.php:307 ../../../../site/api/index.php:309
-msgid "Unable to update oper"
-msgstr ""
-
-#: ../../../../site/api/index.php:315
-msgid "Failed to update setting"
-msgstr ""
-
-#: ../../../../site/api/index.php:315
-msgid "with value"
-msgstr ""
-
-#: ../../../../site/api/index.php:324
-msgid "Invalid Action"
-msgstr ""
-
-#: ../../../../site/index.php:66 ../../../../site/index.php:67
-#: ../../../../site/index.php:111 ../../../../site/index.php:112
-#: ../../../../site/index.php:142 ../../../../site/index.php:143
-msgid "Refresh"
-msgstr ""
-
-#: ../../../../site/index.php:69 ../../../../site/index.php:70
-msgid "New Memo"
-msgstr ""
-
-#: ../../../../site/index.php:72 ../../../../site/index.php:73
-msgid "Delete All"
-msgstr ""
-
-#: ../../../../site/index.php:79 ../../../../site/index.php:121
-msgid "From"
-msgstr ""
-
-#: ../../../../site/index.php:87 ../../../../site/index.php:129
-msgid "Sent"
-msgstr ""
-
-#: ../../../../site/index.php:95
-msgid "Body"
-msgstr ""
-
-#: ../../../../site/index.php:101 ../../../../site/index.php:102
-msgid "Reply"
-msgstr ""
-
-#: ../../../../site/index.php:104 ../../../../site/index.php:105
-#: ../../../../site/index.php:158 ../../../../site/index.php:159
-msgid "Delete"
-msgstr ""
-
-#: ../../../../site/index.php:145 ../../../../site/index.php:146
-msgid "New Channel"
-msgstr ""
-
-#: ../../../../site/index.php:152
-msgid "Flags:"
-msgstr ""
-
-#: ../../../../site/index.php:177
-msgid "News"
-msgstr ""
-
-#: ../../../../site/index.php:178
-msgid "Memos"
-msgstr ""
-
-#: ../../../../site/index.php:179
-msgid "Channels"
-msgstr ""
-
-#: ../../../../site/index.php:181
-msgid "Servers"
-msgstr ""
-
-#: ../../../../site/index.php:183
-msgid "Configuration"
-msgstr ""
-
-#: ../../../../site/index.php:185
-msgid "Profile"
-msgstr ""
-
-#: ../../../../site/index.php:220
-msgid "To"
-msgstr ""
-
-#: ../../../../site/index.php:226
-msgid "Message"
-msgstr ""
-
-#: ../../../../site/index.php:248
-msgid "Country"
-msgstr ""
-
-#: ../../../../site/index.php:256
-msgid "Cell #"
-msgstr ""
-
-#: ../../../../site/index.php:279
-msgid "Token"
-msgstr ""
-
-#: ../../../../site/index.php:294
-msgid "Disable 2-factor"
-msgstr ""
-
-#: ../../../../site/index.php:300
-msgid "Link Persona"
-msgstr ""
-
-#: ../../../../site/index.php:303
-msgid "Remove"
-msgstr ""
-
-#: ../../../../site/index.php:311
-msgid "Switch Role"
-msgstr ""
-
-#: ../../../../site/index.php:313
-msgid "Rehash"
-msgstr ""
-
-#: ../../../../site/index.php:315 ../../../../site/index.php:326
-msgid "Change Password"
-msgstr ""
-
-#: ../../../../site/index.php:317
-msgid "Sync Password"
-msgstr ""
-
-#: ../../../../site/index.php:319
-msgid "Logout"
-msgstr ""
-
-#: ../../../../site/index.php:330 ../../../../site/index.php:428
-msgid "Password"
-msgstr ""
-
-#: ../../../../site/index.php:360
-msgid "Switch"
-msgstr ""
-
-#: ../../../../site/index.php:364 ../../../../site/index.php:434
-msgid "Type"
-msgstr ""
-
-#: ../../../../site/index.php:382 ../../../../site/index.php:414
-msgid "Login"
-msgstr ""
-
-#: ../../../../site/index.php:386
-msgid "2-Factor Verification"
-msgstr ""
-
-#: ../../../../site/index.php:418
-msgid "Persona"
-msgstr ""
-
-#: ../../../../site/index.php:422
-msgid "Username"
-msgstr ""
-
-#: ../../../../site/js/index.js:69
-msgid "Oper updated"
-msgstr ""
-
-#: ../../../../site/js/index.js:80
-msgid "Could not submit the form"
-msgstr ""
-
-#: ../../../../site/js/index.js:106
-msgid "Could not rehash the servers"
-msgstr ""
-
-#: ../../../../site/js/index.js:147
-msgid "Could not synchronize your password"
-msgstr ""
-
-#: ../../../../site/js/index.js:160
-msgid "This is an admin only feature. Continue?"
-msgstr ""
-
-#: ../../../../site/js/index.js:187
-msgid "Login failure"
-msgstr ""
-
-#: ../../../../site/js/index.js:212
-msgid "Could not remove persona address"
-msgstr ""
-
-#: ../../../../site/js/index.js:338
-msgid "Server Ping"
-msgstr ""
-
-#: ../../../../site/js/index.js:353 ../../../../site/js/index.js:436
-msgid "Could not ping server"
-msgstr ""
-
-#: ../../../../site/js/index.js:361
-msgid "Fetching Memos"
-msgstr ""
-
-#: ../../../../site/js/index.js:390 ../../../../site/js/index.js:474
-#: ../../../../site/js/index.js:509
-msgid "Could not contact server"
-msgstr ""
-
-#: ../../../../site/js/index.js:417
-msgid "Deleting memo"
-msgstr ""
-
-#: ../../../../site/js/index.js:443
-msgid "Fetching News"
-msgstr ""
-
-#: ../../../../site/js/index.js:465
-msgid "New news item"
-msgstr ""
-
-#: ../../../../site/js/index.js:484
-msgid "Fetching Channels"
-msgstr ""

BIN
lang/en/C/LC_MESSAGES/omninet.mo → lang/en/LC_MESSAGES/omninet.mo


+ 590 - 0
lang/en/LC_MESSAGES/omninet.po

@@ -0,0 +1,590 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Omninet\n"
+"POT-Creation-Date: 2014-02-21 12:03-0700\n"
+"PO-Revision-Date: 2014-02-21 12:03-0700\n"
+"Last-Translator: Nathaniel van Diepen <[email protected]>\n"
+"Language-Team: Omnimaga <[email protected]>\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.6.4\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-KeywordsList: __\n"
+"X-Poedit-SearchPath-0: ../../../..\n"
+
+#: ../../../../omninet-control-panel/lib/configuration.php:133
+#: ../../../../omninet-control-panel/lib/users.php:163
+msgid "Save"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:37
+msgid "Insufficient Parameters to login"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:40
+msgid "Account is not registered"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:43
+msgid "Invalid Username/Password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:46
+msgid "Account is frozen"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:49
+msgid "Could not log in"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:132
+msgid "Could not connect."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:133
+msgid "Could not set timeout."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:143
+#: ../../../../omninet-control-panel/lib/irc.php:160
+#: ../../../../omninet-control-panel/lib/irc.php:177
+msgid "RehashServ is already running."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:145
+#: ../../../../omninet-control-panel/lib/irc.php:162
+#: ../../../../omninet-control-panel/lib/irc.php:179
+msgid "IRC Server refused the connection."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:166
+msgid "Failed to authenticate with NickServ"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:183
+msgid "vhost not set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:203
+msgid "There is an error in the config. See console for output."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/irc.php:205
+msgid "Rehashed. View console for output."
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/opers.php:56
+msgid "Managed Oper"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/opers.php:56
+msgid "Personal Oper"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/opers.php:59
+#: ../../../../omninet-control-panel/lib/servers.php:111
+#: ../../../../omninet-control-panel/lib/users.php:143
+msgid "Nick"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/opers.php:65
+msgid "Omnimaga Profile"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/opers.php:71
+#: ../../../../omninet-control-panel/site/index.php:348
+msgid "New Password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:63
+msgid "Invalid credentials"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:67
+#: ../../../../omninet-control-panel/lib/security.php:81
+#: ../../../../omninet-control-panel/site/api/index.php:159
+#: ../../../../omninet-control-panel/site/index.php:361
+#: ../../../../omninet-control-panel/site/index.php:415
+msgid "User"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:67
+#: ../../../../omninet-control-panel/lib/security.php:81
+#: ../../../../omninet-control-panel/site/api/index.php:159
+msgid "does not exist"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:73
+msgid "Invalid persona email"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:84
+#: ../../../../omninet-control-panel/site/api/index.php:258
+msgid "Invalid password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:102
+#: ../../../../omninet-control-panel/lib/security.php:171
+msgid "Failed to create Authy user"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:115
+msgid "Token didn't match "
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:122
+#: ../../../../omninet-control-panel/lib/security.php:204
+#: ../../../../omninet-control-panel/site/api/index.php:44
+#: ../../../../omninet-control-panel/site/api/index.php:77
+#: ../../../../omninet-control-panel/site/api/index.php:105
+#: ../../../../omninet-control-panel/site/api/index.php:154
+#: ../../../../omninet-control-panel/site/api/index.php:168
+#: ../../../../omninet-control-panel/site/api/index.php:230
+#: ../../../../omninet-control-panel/site/api/index.php:245
+#: ../../../../omninet-control-panel/site/api/index.php:253
+msgid "You have been logged out"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:137
+#: ../../../../omninet-control-panel/lib/security.php:140
+#: ../../../../omninet-control-panel/lib/security.php:150
+msgid "Failed to disable 2-factor authentication"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:178
+msgid "No cell number set"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:181
+msgid "No country code set"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:191
+msgid "Could not register"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:194
+msgid "No secret key defined"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/security.php:197
+msgid "No token provided"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:104
+#: ../../../../omninet-control-panel/site/api/index.php:124
+msgid "Owner"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:105
+#: ../../../../omninet-control-panel/lib/users.php:137
+msgid "Real Name"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:105
+#: ../../../../omninet-control-panel/lib/users.php:149
+msgid "Email"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:108
+#: ../../../../omninet-control-panel/site/index.php:194
+msgid "Opers"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:111
+msgid "Role"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:119
+msgid "Parent"
+msgstr ""
+
+#: ../../../../omninet-control-panel/lib/servers.php:123
+msgid "Children"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:22
+msgid "Missing username and/or password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:23
+msgid "Missing user type"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:32
+msgid "No token set"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:73
+msgid "Cannot fetch memos"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:101
+msgid "Cannot fetch news"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:117
+msgid "Voice"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:118
+msgid "Automatic voice"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:119
+msgid "Halfop"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:120
+msgid "Automatic Halfop"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:121
+msgid "Op"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:122
+msgid "Automatic Op"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:123
+msgid "Admin"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:125
+msgid "Set"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:126
+msgid "Invite/Getkey"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:127
+msgid "Kick/Ban"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:128
+msgid "Recover/Clear"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:129
+msgid "Modify access lists"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:130
+msgid "Topic"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:131
+msgid "View access lists"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:132
+msgid "Founder"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:133
+msgid "Banned"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:150
+msgid "Cannot fetch channels"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:155
+msgid "No message or user entered"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:161
+msgid "Memo Sent"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:164
+#: ../../../../omninet-control-panel/site/api/index.php:172
+msgid "Cannot send memo"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:169
+msgid "No id given"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:205
+msgid "Failed to add email"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:205
+msgid "to user"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:207
+msgid "Email does not match any users"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:231
+msgid "No ID set"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:233
+msgid "Could not remove email address"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:250
+msgid "2-factor disabled."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:257
+#: ../../../../omninet-control-panel/site/api/index.php:272
+#: ../../../../omninet-control-panel/site/api/index.php:283
+msgid "Make sure that everything is filled in. Try reloading if it is."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:263
+msgid "Could not update password with nickserv"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:273
+msgid "Not Logged in to use"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:273
+msgid "with key"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:274
+msgid "Must be logged in with type user to sync pass"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:277
+msgid "Could not verify with nickserv"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:280
+msgid "Nickserv password synchronized with main account"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:288
+#: ../../../../omninet-control-panel/site/api/index.php:301
+#: ../../../../omninet-control-panel/site/api/index.php:320
+msgid "Not logged in"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:289
+#: ../../../../omninet-control-panel/site/api/index.php:302
+msgid "No user set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:290
+msgid "No email set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:291
+msgid "No real name set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:292
+#: ../../../../omninet-control-panel/site/api/index.php:303
+msgid "No nick set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:293
+msgid "User with id"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:293
+#: ../../../../omninet-control-panel/site/api/index.php:305
+msgid "does not exist. You should reload the page."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:297
+msgid "Unable to update user"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:304
+msgid "No profile set."
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:305
+msgid "Oper with id"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:307
+#: ../../../../omninet-control-panel/site/api/index.php:309
+msgid "Unable to update oper"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:315
+msgid "Failed to update setting"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:315
+msgid "with value"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/api/index.php:324
+msgid "Invalid Action"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:78
+#: ../../../../omninet-control-panel/site/index.php:79
+#: ../../../../omninet-control-panel/site/index.php:123
+#: ../../../../omninet-control-panel/site/index.php:124
+#: ../../../../omninet-control-panel/site/index.php:154
+#: ../../../../omninet-control-panel/site/index.php:155
+msgid "Refresh"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:81
+#: ../../../../omninet-control-panel/site/index.php:82
+msgid "New Memo"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:84
+#: ../../../../omninet-control-panel/site/index.php:85
+msgid "Delete All"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:91
+#: ../../../../omninet-control-panel/site/index.php:133
+msgid "From"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:99
+#: ../../../../omninet-control-panel/site/index.php:141
+msgid "Sent"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:107
+msgid "Body"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:113
+#: ../../../../omninet-control-panel/site/index.php:114
+msgid "Reply"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:116
+#: ../../../../omninet-control-panel/site/index.php:117
+#: ../../../../omninet-control-panel/site/index.php:170
+#: ../../../../omninet-control-panel/site/index.php:171
+msgid "Delete"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:157
+#: ../../../../omninet-control-panel/site/index.php:158
+msgid "New Channel"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:164
+msgid "Flags:"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:189
+msgid "News"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:190
+msgid "Memos"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:191
+msgid "Channels"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:193
+msgid "Servers"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:195
+msgid "Configuration"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:197
+msgid "Profile"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:232
+msgid "To"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:238
+msgid "Message"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:260
+msgid "Country"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:268
+msgid "Cell #"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:291
+msgid "Token"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:306
+msgid "Disable 2-factor"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:312
+msgid "Link Persona"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:315
+msgid "Remove"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:323
+msgid "Switch Role"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:325
+msgid "Rehash"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:327
+#: ../../../../omninet-control-panel/site/index.php:338
+msgid "Change Password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:329
+msgid "Sync Password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:331
+msgid "Logout"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:342
+#: ../../../../omninet-control-panel/site/index.php:440
+msgid "Password"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:372
+msgid "Switch"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:376
+#: ../../../../omninet-control-panel/site/index.php:446
+msgid "Type"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:394
+#: ../../../../omninet-control-panel/site/index.php:426
+msgid "Login"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:398
+msgid "2-Factor Verification"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:430
+msgid "Persona"
+msgstr ""
+
+#: ../../../../omninet-control-panel/site/index.php:434
+msgid "Username"
+msgstr ""

BIN
lang/en_CA/C/LC_MESSAGES/omninet.mo → lang/en_CA/LC_MESSAGES/omninet.mo


+ 3 - 3
lang/en_CA/C/LC_MESSAGES/omninet.po → lang/en_CA/LC_MESSAGES/omninet.po

@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Omninet Control panel\n"
 "POT-Creation-Date: 2014-02-20 22:21-0700\n"
-"PO-Revision-Date: 2014-02-20 22:21-0700\n"
+"PO-Revision-Date: 2014-02-21 11:38-0700\n"
 "Last-Translator: Nathaniel van Diepen <[email protected]>\n"
 "Language-Team: Omnimaga <[email protected]>\n"
 "Language: en_CA\n"
@@ -12,7 +12,7 @@ msgstr ""
 "X-Generator: Poedit 1.6.4\n"
 "X-Poedit-Basepath: .\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Poedit-SearchPath-0: ../../../..\n"
+"X-Poedit-SearchPath-0: ../../..\n"
 
 #: ../../../../lib/configuration.php:133 ../../../../lib/users.php:163
 msgid "Save"
@@ -544,7 +544,7 @@ msgstr ""
 
 #: ../../../../site/index.php:422
 msgid "Username"
-msgstr "Test"
+msgstr ""
 
 #: ../../../../site/js/index.js:69
 msgid "Oper updated"

+ 0 - 0
lang/en_US/C/LC_MESSAGES/omninet.mo → lang/en_US/LC_MESSAGES/omninet.mo


+ 0 - 0
lang/en_US/C/LC_MESSAGES/omninet.po → lang/en_US/LC_MESSAGES/omninet.po


+ 0 - 0
lang/fr/C/LC_MESSAGES/omninet.mo → lang/fr/LC_MESSAGES/omninet.mo


+ 0 - 0
lang/fr/C/LC_MESSAGES/omninet.po → lang/fr/LC_MESSAGES/omninet.po


+ 0 - 0
lang/fr_CA/C/LC_MESSAGES/omninet.mo → lang/fr_CA/LC_MESSAGES/omninet.mo


+ 0 - 0
lang/fr_CA/C/LC_MESSAGES/omninet.po → lang/fr_CA/LC_MESSAGES/omninet.po


+ 0 - 0
lang/fr_FR/C/LC_MESSAGES/omninet.mo → lang/fr_FR/LC_MESSAGES/omninet.mo


+ 0 - 0
lang/fr_FR/C/LC_MESSAGES/omninet.po → lang/fr_FR/LC_MESSAGES/omninet.po


+ 1 - 1
lib/configuration.php

@@ -130,6 +130,6 @@
 			}
 			array_push($items,$item);
 		}
-		return get_form_html('configuration',$items,_('Save'));
+		return get_form_html('configuration',$items,__('Save'));
 	}
 ?>

+ 536 - 0
lib/gettext.inc

@@ -0,0 +1,536 @@
+<?php
+/*
+   Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
+   Copyright (c) 2009 Danilo Segan <[email protected]>
+
+   Drop in replacement for native gettext.
+
+   This file is part of PHP-gettext.
+
+   PHP-gettext is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   PHP-gettext is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with PHP-gettext; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+/*
+LC_CTYPE        0
+LC_NUMERIC      1
+LC_TIME         2
+LC_COLLATE      3
+LC_MONETARY     4
+LC_MESSAGES     5
+LC_ALL          6
+*/
+
+// LC_MESSAGES is not available if php-gettext is not loaded
+// while the other constants are already available from session extension.
+if (!defined('LC_MESSAGES')) {
+  define('LC_MESSAGES',	5);
+}
+
+require('streams.php');
+require('gettext.php');
+
+
+// Variables
+
+global $text_domains, $default_domain, $LC_CATEGORIES, $EMULATEGETTEXT, $CURRENTLOCALE;
+$text_domains = array();
+$default_domain = 'messages';
+$LC_CATEGORIES = array('LC_CTYPE', 'LC_NUMERIC', 'LC_TIME', 'LC_COLLATE', 'LC_MONETARY', 'LC_MESSAGES', 'LC_ALL');
+$EMULATEGETTEXT = 0;
+$CURRENTLOCALE = '';
+
+/* Class to hold a single domain included in $text_domains. */
+class domain {
+  var $l10n;
+  var $path;
+  var $codeset;
+}
+
+// Utility functions
+
+/**
+ * Return a list of locales to try for any POSIX-style locale specification.
+ */
+function get_list_of_locales($locale) {
+  /* Figure out all possible locale names and start with the most
+   * specific ones.  I.e. for sr_CS.UTF-8@latin, look through all of
+   * sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.
+   */
+  $locale_names = array();
+  $lang = NULL;
+  $country = NULL;
+  $charset = NULL;
+  $modifier = NULL;
+  if ($locale) {
+    if (preg_match("/^(?P<lang>[a-z]{2,3})"              // language code
+                   ."(?:_(?P<country>[A-Z]{2}))?"           // country code
+                   ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?"    // charset
+                   ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/",  // @ modifier
+                   $locale, $matches)) {
+
+      if (isset($matches["lang"])) $lang = $matches["lang"];
+      if (isset($matches["country"])) $country = $matches["country"];
+      if (isset($matches["charset"])) $charset = $matches["charset"];
+      if (isset($matches["modifier"])) $modifier = $matches["modifier"];
+
+      if ($modifier) {
+        if ($country) {
+          if ($charset)
+            array_push($locale_names, "${lang}_$country.$charset@$modifier");
+          array_push($locale_names, "${lang}_$country@$modifier");
+        } elseif ($charset)
+            array_push($locale_names, "${lang}.$charset@$modifier");
+        array_push($locale_names, "$lang@$modifier");
+      }
+      if ($country) {
+        if ($charset)
+          array_push($locale_names, "${lang}_$country.$charset");
+        array_push($locale_names, "${lang}_$country");
+      } elseif ($charset)
+          array_push($locale_names, "${lang}.$charset");
+      array_push($locale_names, $lang);
+    }
+
+    // If the locale name doesn't match POSIX style, just include it as-is.
+    if (!in_array($locale, $locale_names))
+      array_push($locale_names, $locale);
+  }
+  return $locale_names;
+}
+
+/**
+ * Utility function to get a StreamReader for the given text domain.
+ */
+function _get_reader($domain=null, $category=5, $enable_cache=true) {
+    global $text_domains, $default_domain, $LC_CATEGORIES;
+    if (!isset($domain)) $domain = $default_domain;
+    if (!isset($text_domains[$domain]->l10n)) {
+        // get the current locale
+        $locale = _setlocale(LC_MESSAGES, 0);
+        $bound_path = isset($text_domains[$domain]->path) ?
+          $text_domains[$domain]->path : './';
+        $subpath = $LC_CATEGORIES[$category] ."/$domain.mo";
+
+        $locale_names = get_list_of_locales($locale);
+        $input = null;
+        foreach ($locale_names as $locale) {
+          $full_path = $bound_path . $locale . "/" . $subpath;
+          if (file_exists($full_path)) {
+            $input = new FileReader($full_path);
+            break;
+          }
+        }
+
+        if (!array_key_exists($domain, $text_domains)) {
+          // Initialize an empty domain object.
+          $text_domains[$domain] = new domain();
+        }
+        $text_domains[$domain]->l10n = new gettext_reader($input,
+                                                          $enable_cache);
+    }
+    return $text_domains[$domain]->l10n;
+}
+
+/**
+ * Returns whether we are using our emulated gettext API or PHP built-in one.
+ */
+function locale_emulation() {
+    global $EMULATEGETTEXT;
+    return $EMULATEGETTEXT;
+}
+
+/**
+ * Checks if the current locale is supported on this system.
+ */
+function _check_locale_and_function($function=false) {
+    global $EMULATEGETTEXT;
+    if ($function and !function_exists($function))
+        return false;
+    return !$EMULATEGETTEXT;
+}
+
+/**
+ * Get the codeset for the given domain.
+ */
+function _get_codeset($domain=null) {
+    global $text_domains, $default_domain, $LC_CATEGORIES;
+    if (!isset($domain)) $domain = $default_domain;
+    return (isset($text_domains[$domain]->codeset))? $text_domains[$domain]->codeset : ini_get('mbstring.internal_encoding');
+}
+
+/**
+ * Convert the given string to the encoding set by bind_textdomain_codeset.
+ */
+function _encode($text) {
+    $source_encoding = mb_detect_encoding($text);
+    $target_encoding = _get_codeset();
+    if ($source_encoding != $target_encoding) {
+        return mb_convert_encoding($text, $target_encoding, $source_encoding);
+    }
+    else {
+        return $text;
+    }
+}
+
+
+// Custom implementation of the standard gettext related functions
+
+/**
+ * Returns passed in $locale, or environment variable $LANG if $locale == ''.
+ */
+function _get_default_locale($locale) {
+  if ($locale == '') // emulate variable support
+    return getenv('LANG');
+  else
+    return $locale;
+}
+
+/**
+ * Sets a requested locale, if needed emulates it.
+ */
+function _setlocale($category, $locale) {
+    global $CURRENTLOCALE, $EMULATEGETTEXT;
+    if ($locale === 0) { // use === to differentiate between string "0"
+        if ($CURRENTLOCALE != '')
+            return $CURRENTLOCALE;
+        else
+            // obey LANG variable, maybe extend to support all of LC_* vars
+            // even if we tried to read locale without setting it first
+            return _setlocale($category, $CURRENTLOCALE);
+    } else {
+        if (function_exists('setlocale')) {
+          $ret = setlocale($category, $locale);
+          if (($locale == '' and !$ret) or // failed setting it by env
+              ($locale != '' and $ret != $locale)) { // failed setting it
+            // Failed setting it according to environment.
+            $CURRENTLOCALE = _get_default_locale($locale);
+            $EMULATEGETTEXT = 1;
+          } else {
+            $CURRENTLOCALE = $ret;
+            $EMULATEGETTEXT = 0;
+          }
+        } else {
+          // No function setlocale(), emulate it all.
+          $CURRENTLOCALE = _get_default_locale($locale);
+          $EMULATEGETTEXT = 1;
+        }
+        // Allow locale to be changed on the go for one translation domain.
+        global $text_domains, $default_domain;
+        if (array_key_exists($default_domain, $text_domains)) {
+            unset($text_domains[$default_domain]->l10n);
+        }
+        return $CURRENTLOCALE;
+    }
+}
+
+/**
+ * Sets the path for a domain.
+ */
+function _bindtextdomain($domain, $path) {
+    global $text_domains;
+    // ensure $path ends with a slash ('/' should work for both, but lets still play nice)
+    if (substr(php_uname(), 0, 7) == "Windows") {
+      if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/')
+        $path .= '\\';
+    } else {
+      if ($path[strlen($path)-1] != '/')
+        $path .= '/';
+    }
+    if (!array_key_exists($domain, $text_domains)) {
+      // Initialize an empty domain object.
+      $text_domains[$domain] = new domain();
+    }
+    $text_domains[$domain]->path = $path;
+}
+
+/**
+ * Specify the character encoding in which the messages from the DOMAIN message catalog will be returned.
+ */
+function _bind_textdomain_codeset($domain, $codeset) {
+    global $text_domains;
+    $text_domains[$domain]->codeset = $codeset;
+}
+
+/**
+ * Sets the default domain.
+ */
+function _textdomain($domain) {
+    global $default_domain;
+    $default_domain = $domain;
+}
+
+/**
+ * Lookup a message in the current domain.
+ */
+function _gettext($msgid) {
+    $l10n = _get_reader();
+    return _encode($l10n->translate($msgid));
+}
+
+/**
+ * Alias for gettext.
+ */
+function __($msgid) {
+    return _gettext($msgid);
+}
+
+/**
+ * Plural version of gettext.
+ */
+function _ngettext($singular, $plural, $number) {
+    $l10n = _get_reader();
+    return _encode($l10n->ngettext($singular, $plural, $number));
+}
+
+/**
+ * Override the current domain.
+ */
+function _dgettext($domain, $msgid) {
+    $l10n = _get_reader($domain);
+    return _encode($l10n->translate($msgid));
+}
+
+/**
+ * Plural version of dgettext.
+ */
+function _dngettext($domain, $singular, $plural, $number) {
+    $l10n = _get_reader($domain);
+    return _encode($l10n->ngettext($singular, $plural, $number));
+}
+
+/**
+ * Overrides the domain and category for a single lookup.
+ */
+function _dcgettext($domain, $msgid, $category) {
+    $l10n = _get_reader($domain, $category);
+    return _encode($l10n->translate($msgid));
+}
+/**
+ * Plural version of dcgettext.
+ */
+function _dcngettext($domain, $singular, $plural, $number, $category) {
+    $l10n = _get_reader($domain, $category);
+    return _encode($l10n->ngettext($singular, $plural, $number));
+}
+
+/**
+ * Context version of gettext.
+ */
+function _pgettext($context, $msgid) {
+    $l10n = _get_reader();
+    return _encode($l10n->pgettext($context, $msgid));
+}
+
+/**
+ * Override the current domain in a context gettext call.
+ */
+function _dpgettext($domain, $context, $msgid) {
+    $l10n = _get_reader($domain);
+    return _encode($l10n->pgettext($context, $msgid));
+}
+
+/**
+ * Overrides the domain and category for a single context-based lookup.
+ */
+function _dcpgettext($domain, $context, $msgid, $category) {
+    $l10n = _get_reader($domain, $category);
+    return _encode($l10n->pgettext($context, $msgid));
+}
+
+/**
+ * Context version of ngettext.
+ */
+function _npgettext($context, $singular, $plural) {
+    $l10n = _get_reader();
+    return _encode($l10n->npgettext($context, $singular, $plural));
+}
+
+/**
+ * Override the current domain in a context ngettext call.
+ */
+function _dnpgettext($domain, $context, $singular, $plural) {
+    $l10n = _get_reader($domain);
+    return _encode($l10n->npgettext($context, $singular, $plural));
+}
+
+/**
+ * Overrides the domain and category for a plural context-based lookup.
+ */
+function _dcnpgettext($domain, $context, $singular, $plural, $category) {
+    $l10n = _get_reader($domain, $category);
+    return _encode($l10n->npgettext($context, $singular, $plural));
+}
+
+
+
+// Wrappers to use if the standard gettext functions are available,
+// but the current locale is not supported by the system.
+// Use the standard impl if the current locale is supported, use the
+// custom impl otherwise.
+
+function T_setlocale($category, $locale) {
+    return _setlocale($category, $locale);
+}
+
+function T_bindtextdomain($domain, $path) {
+    if (_check_locale_and_function()) return bindtextdomain($domain, $path);
+    else return _bindtextdomain($domain, $path);
+}
+function T_bind_textdomain_codeset($domain, $codeset) {
+    // bind_textdomain_codeset is available only in PHP 4.2.0+
+    if (_check_locale_and_function('bind_textdomain_codeset'))
+        return bind_textdomain_codeset($domain, $codeset);
+    else return _bind_textdomain_codeset($domain, $codeset);
+}
+function T_textdomain($domain) {
+    if (_check_locale_and_function()) return textdomain($domain);
+    else return _textdomain($domain);
+}
+function T_gettext($msgid) {
+    if (_check_locale_and_function()) return gettext($msgid);
+    else return _gettext($msgid);
+}
+function T_($msgid) {
+    if (_check_locale_and_function()) return _($msgid);
+    return __($msgid);
+}
+function T_ngettext($singular, $plural, $number) {
+    if (_check_locale_and_function())
+        return ngettext($singular, $plural, $number);
+    else return _ngettext($singular, $plural, $number);
+}
+function T_dgettext($domain, $msgid) {
+    if (_check_locale_and_function()) return dgettext($domain, $msgid);
+    else return _dgettext($domain, $msgid);
+}
+function T_dngettext($domain, $singular, $plural, $number) {
+    if (_check_locale_and_function())
+        return dngettext($domain, $singular, $plural, $number);
+    else return _dngettext($domain, $singular, $plural, $number);
+}
+function T_dcgettext($domain, $msgid, $category) {
+    if (_check_locale_and_function())
+        return dcgettext($domain, $msgid, $category);
+    else return _dcgettext($domain, $msgid, $category);
+}
+function T_dcngettext($domain, $singular, $plural, $number, $category) {
+    if (_check_locale_and_function())
+      return dcngettext($domain, $singular, $plural, $number, $category);
+    else return _dcngettext($domain, $singular, $plural, $number, $category);
+}
+
+function T_pgettext($context, $msgid) {
+  if (_check_locale_and_function('pgettext'))
+      return pgettext($context, $msgid);
+  else
+      return _pgettext($context, $msgid);
+}
+
+function T_dpgettext($domain, $context, $msgid) {
+  if (_check_locale_and_function('dpgettext'))
+      return dpgettext($domain, $context, $msgid);
+  else
+      return _dpgettext($domain, $context, $msgid);
+}
+
+function T_dcpgettext($domain, $context, $msgid, $category) {
+  if (_check_locale_and_function('dcpgettext'))
+      return dcpgettext($domain, $context, $msgid, $category);
+  else
+      return _dcpgettext($domain, $context, $msgid, $category);
+}
+
+function T_npgettext($context, $singular, $plural, $number) {
+    if (_check_locale_and_function('npgettext'))
+        return npgettext($context, $singular, $plural, $number);
+    else
+        return _npgettext($context, $singular, $plural, $number);
+}
+
+function T_dnpgettext($domain, $context, $singular, $plural, $number) {
+  if (_check_locale_and_function('dnpgettext'))
+      return dnpgettext($domain, $context, $singular, $plural, $number);
+  else
+      return _dnpgettext($domain, $context, $singular, $plural, $number);
+}
+
+function T_dcnpgettext($domain, $context, $singular, $plural,
+                       $number, $category) {
+    if (_check_locale_and_function('dcnpgettext'))
+        return dcnpgettext($domain, $context, $singular,
+                           $plural, $number, $category);
+    else
+        return _dcnpgettext($domain, $context, $singular,
+                            $plural, $number, $category);
+}
+
+
+
+// Wrappers used as a drop in replacement for the standard gettext functions
+
+if (!function_exists('gettext')) {
+    function bindtextdomain($domain, $path) {
+        return _bindtextdomain($domain, $path);
+    }
+    function bind_textdomain_codeset($domain, $codeset) {
+        return _bind_textdomain_codeset($domain, $codeset);
+    }
+    function textdomain($domain) {
+        return _textdomain($domain);
+    }
+    function gettext($msgid) {
+        return _gettext($msgid);
+    }
+    function _($msgid) {
+        return __($msgid);
+    }
+    function ngettext($singular, $plural, $number) {
+        return _ngettext($singular, $plural, $number);
+    }
+    function dgettext($domain, $msgid) {
+        return _dgettext($domain, $msgid);
+    }
+    function dngettext($domain, $singular, $plural, $number) {
+        return _dngettext($domain, $singular, $plural, $number);
+    }
+    function dcgettext($domain, $msgid, $category) {
+        return _dcgettext($domain, $msgid, $category);
+    }
+    function dcngettext($domain, $singular, $plural, $number, $category) {
+        return _dcngettext($domain, $singular, $plural, $number, $category);
+    }
+    function pgettext($context, $msgid) {
+        return _pgettext($context, $msgid);
+    }
+    function npgettext($context, $singular, $plural, $number) {
+        return _npgettext($context, $singular, $plural, $number);
+    }
+    function dpgettext($domain, $context, $msgid) {
+        return _dpgettext($domain, $context, $msgid);
+    }
+    function dnpgettext($domain, $context, $singular, $plural, $number) {
+        return _dnpgettext($domain, $context, $singular, $plural, $number);
+    }
+    function dcpgettext($domain, $context, $msgid, $category) {
+        return _dcpgettext($domain, $context, $msgid, $category);
+    }
+    function dcnpgettext($domain, $context, $singular, $plural,
+                         $number, $category) {
+      return _dcnpgettext($domain, $context, $singular, $plural,
+                          $number, $category);
+    }
+}
+
+?>

+ 432 - 0
lib/gettext.php

@@ -0,0 +1,432 @@
+<?php
+/*
+   Copyright (c) 2003, 2009 Danilo Segan <[email protected]>.
+   Copyright (c) 2005 Nico Kaiser <[email protected]>
+
+   This file is part of PHP-gettext.
+
+   PHP-gettext is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   PHP-gettext is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with PHP-gettext; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/**
+ * Provides a simple gettext replacement that works independently from
+ * the system's gettext abilities.
+ * It can read MO files and use them for translating strings.
+ * The files are passed to gettext_reader as a Stream (see streams.php)
+ *
+ * This version has the ability to cache all strings and translations to
+ * speed up the string lookup.
+ * While the cache is enabled by default, it can be switched off with the
+ * second parameter in the constructor (e.g. whenusing very large MO files
+ * that you don't want to keep in memory)
+ */
+class gettext_reader {
+  //public:
+   var $error = 0; // public variable that holds error code (0 if no error)
+
+   //private:
+  var $BYTEORDER = 0;        // 0: low endian, 1: big endian
+  var $STREAM = NULL;
+  var $short_circuit = false;
+  var $enable_cache = false;
+  var $originals = NULL;      // offset of original table
+  var $translations = NULL;    // offset of translation table
+  var $pluralheader = NULL;    // cache header field for plural forms
+  var $total = 0;          // total string count
+  var $table_originals = NULL;  // table for original strings (offsets)
+  var $table_translations = NULL;  // table for translated strings (offsets)
+  var $cache_translations = NULL;  // original -> translation mapping
+
+
+  /* Methods */
+
+
+  /**
+   * Reads a 32bit Integer from the Stream
+   *
+   * @access private
+   * @return Integer from the Stream
+   */
+  function readint() {
+      if ($this->BYTEORDER == 0) {
+        // low endian
+        $input=unpack('V', $this->STREAM->read(4));
+        return array_shift($input);
+      } else {
+        // big endian
+        $input=unpack('N', $this->STREAM->read(4));
+        return array_shift($input);
+      }
+    }
+
+  function read($bytes) {
+    return $this->STREAM->read($bytes);
+  }
+
+  /**
+   * Reads an array of Integers from the Stream
+   *
+   * @param int count How many elements should be read
+   * @return Array of Integers
+   */
+  function readintarray($count) {
+    if ($this->BYTEORDER == 0) {
+        // low endian
+        return unpack('V'.$count, $this->STREAM->read(4 * $count));
+      } else {
+        // big endian
+        return unpack('N'.$count, $this->STREAM->read(4 * $count));
+      }
+  }
+
+  /**
+   * Constructor
+   *
+   * @param object Reader the StreamReader object
+   * @param boolean enable_cache Enable or disable caching of strings (default on)
+   */
+  function gettext_reader($Reader, $enable_cache = true) {
+    // If there isn't a StreamReader, turn on short circuit mode.
+    if (! $Reader || isset($Reader->error) ) {
+      $this->short_circuit = true;
+      return;
+    }
+
+    // Caching can be turned off
+    $this->enable_cache = $enable_cache;
+
+    $MAGIC1 = "\x95\x04\x12\xde";
+    $MAGIC2 = "\xde\x12\x04\x95";
+
+    $this->STREAM = $Reader;
+    $magic = $this->read(4);
+    if ($magic == $MAGIC1) {
+      $this->BYTEORDER = 1;
+    } elseif ($magic == $MAGIC2) {
+      $this->BYTEORDER = 0;
+    } else {
+      $this->error = 1; // not MO file
+      return false;
+    }
+
+    // FIXME: Do we care about revision? We should.
+    $revision = $this->readint();
+
+    $this->total = $this->readint();
+    $this->originals = $this->readint();
+    $this->translations = $this->readint();
+  }
+
+  /**
+   * Loads the translation tables from the MO file into the cache
+   * If caching is enabled, also loads all strings into a cache
+   * to speed up translation lookups
+   *
+   * @access private
+   */
+  function load_tables() {
+    if (is_array($this->cache_translations) &&
+      is_array($this->table_originals) &&
+      is_array($this->table_translations))
+      return;
+
+    /* get original and translations tables */
+    if (!is_array($this->table_originals)) {
+      $this->STREAM->seekto($this->originals);
+      $this->table_originals = $this->readintarray($this->total * 2);
+    }
+    if (!is_array($this->table_translations)) {
+      $this->STREAM->seekto($this->translations);
+      $this->table_translations = $this->readintarray($this->total * 2);
+    }
+
+    if ($this->enable_cache) {
+      $this->cache_translations = array ();
+      /* read all strings in the cache */
+      for ($i = 0; $i < $this->total; $i++) {
+        $this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
+        $original = $this->STREAM->read($this->table_originals[$i * 2 + 1]);
+        $this->STREAM->seekto($this->table_translations[$i * 2 + 2]);
+        $translation = $this->STREAM->read($this->table_translations[$i * 2 + 1]);
+        $this->cache_translations[$original] = $translation;
+      }
+    }
+  }
+
+  /**
+   * Returns a string from the "originals" table
+   *
+   * @access private
+   * @param int num Offset number of original string
+   * @return string Requested string if found, otherwise ''
+   */
+  function get_original_string($num) {
+    $length = $this->table_originals[$num * 2 + 1];
+    $offset = $this->table_originals[$num * 2 + 2];
+    if (! $length)
+      return '';
+    $this->STREAM->seekto($offset);
+    $data = $this->STREAM->read($length);
+    return (string)$data;
+  }
+
+  /**
+   * Returns a string from the "translations" table
+   *
+   * @access private
+   * @param int num Offset number of original string
+   * @return string Requested string if found, otherwise ''
+   */
+  function get_translation_string($num) {
+    $length = $this->table_translations[$num * 2 + 1];
+    $offset = $this->table_translations[$num * 2 + 2];
+    if (! $length)
+      return '';
+    $this->STREAM->seekto($offset);
+    $data = $this->STREAM->read($length);
+    return (string)$data;
+  }
+
+  /**
+   * Binary search for string
+   *
+   * @access private
+   * @param string string
+   * @param int start (internally used in recursive function)
+   * @param int end (internally used in recursive function)
+   * @return int string number (offset in originals table)
+   */
+  function find_string($string, $start = -1, $end = -1) {
+    if (($start == -1) or ($end == -1)) {
+      // find_string is called with only one parameter, set start end end
+      $start = 0;
+      $end = $this->total;
+    }
+    if (abs($start - $end) <= 1) {
+      // We're done, now we either found the string, or it doesn't exist
+      $txt = $this->get_original_string($start);
+      if ($string == $txt)
+        return $start;
+      else
+        return -1;
+    } else if ($start > $end) {
+      // start > end -> turn around and start over
+      return $this->find_string($string, $end, $start);
+    } else {
+      // Divide table in two parts
+      $half = (int)(($start + $end) / 2);
+      $cmp = strcmp($string, $this->get_original_string($half));
+      if ($cmp == 0)
+        // string is exactly in the middle => return it
+        return $half;
+      else if ($cmp < 0)
+        // The string is in the upper half
+        return $this->find_string($string, $start, $half);
+      else
+        // The string is in the lower half
+        return $this->find_string($string, $half, $end);
+    }
+  }
+
+  /**
+   * Translates a string
+   *
+   * @access public
+   * @param string string to be translated
+   * @return string translated string (or original, if not found)
+   */
+  function translate($string) {
+    if ($this->short_circuit)
+      return $string;
+    $this->load_tables();
+
+    if ($this->enable_cache) {
+      // Caching enabled, get translated string from cache
+      if (array_key_exists($string, $this->cache_translations))
+        return $this->cache_translations[$string];
+      else
+        return $string;
+    } else {
+      // Caching not enabled, try to find string
+      $num = $this->find_string($string);
+      if ($num == -1)
+        return $string;
+      else
+        return $this->get_translation_string($num);
+    }
+  }
+
+  /**
+   * Sanitize plural form expression for use in PHP eval call.
+   *
+   * @access private
+   * @return string sanitized plural form expression
+   */
+  function sanitize_plural_expression($expr) {
+    // Get rid of disallowed characters.
+    $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr);
+
+    // Add parenthesis for tertiary '?' operator.
+    $expr .= ';';
+    $res = '';
+    $p = 0;
+    for ($i = 0; $i < strlen($expr); $i++) {
+      $ch = $expr[$i];
+      switch ($ch) {
+      case '?':
+        $res .= ' ? (';
+        $p++;
+        break;
+      case ':':
+        $res .= ') : (';
+        break;
+      case ';':
+        $res .= str_repeat( ')', $p) . ';';
+        $p = 0;
+        break;
+      default:
+        $res .= $ch;
+      }
+    }
+    return $res;
+  }
+
+  /**
+   * Parse full PO header and extract only plural forms line.
+   *
+   * @access private
+   * @return string verbatim plural form header field
+   */
+  function extract_plural_forms_header_from_po_header($header) {
+    if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs))
+      $expr = $regs[2];
+    else
+      $expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
+    return $expr;
+  }
+
+  /**
+   * Get possible plural forms from MO header
+   *
+   * @access private
+   * @return string plural form header
+   */
+  function get_plural_forms() {
+    // lets assume message number 0 is header
+    // this is true, right?
+    $this->load_tables();
+
+    // cache header field for plural forms
+    if (! is_string($this->pluralheader)) {
+      if ($this->enable_cache) {
+        $header = $this->cache_translations[""];
+      } else {
+        $header = $this->get_translation_string(0);
+      }
+      $expr = $this->extract_plural_forms_header_from_po_header($header);
+      $this->pluralheader = $this->sanitize_plural_expression($expr);
+    }
+    return $this->pluralheader;
+  }
+
+  /**
+   * Detects which plural form to take
+   *
+   * @access private
+   * @param n count
+   * @return int array index of the right plural form
+   */
+  function select_string($n) {
+    $string = $this->get_plural_forms();
+    $string = str_replace('nplurals',"\$total",$string);
+    $string = str_replace("n",$n,$string);
+    $string = str_replace('plural',"\$plural",$string);
+
+    $total = 0;
+    $plural = 0;
+
+    eval("$string");
+    if ($plural >= $total) $plural = $total - 1;
+    return $plural;
+  }
+
+  /**
+   * Plural version of gettext
+   *
+   * @access public
+   * @param string single
+   * @param string plural
+   * @param string number
+   * @return translated plural form
+   */
+  function ngettext($single, $plural, $number) {
+    if ($this->short_circuit) {
+      if ($number != 1)
+        return $plural;
+      else
+        return $single;
+    }
+
+    // find out the appropriate form
+    $select = $this->select_string($number);
+
+    // this should contains all strings separated by NULLs
+    $key = $single . chr(0) . $plural;
+
+
+    if ($this->enable_cache) {
+      if (! array_key_exists($key, $this->cache_translations)) {
+        return ($number != 1) ? $plural : $single;
+      } else {
+        $result = $this->cache_translations[$key];
+        $list = explode(chr(0), $result);
+        return $list[$select];
+      }
+    } else {
+      $num = $this->find_string($key);
+      if ($num == -1) {
+        return ($number != 1) ? $plural : $single;
+      } else {
+        $result = $this->get_translation_string($num);
+        $list = explode(chr(0), $result);
+        return $list[$select];
+      }
+    }
+  }
+
+  function pgettext($context, $msgid) {
+    $key = $context . chr(4) . $msgid;
+    $ret = $this->translate($key);
+    if (strpos($ret, "\004") !== FALSE) {
+      return $msgid;
+    } else {
+      return $ret;
+    }
+  }
+
+  function npgettext($context, $singular, $plural, $number) {
+    $key = $context . chr(4) . $singular;
+    $ret = $this->ngettext($key, $plural, $number);
+    if (strpos($ret, "\004") !== FALSE) {
+      return $singular;
+    } else {
+      return $ret;
+    }
+
+  }
+}
+
+?>

+ 17 - 17
lib/irc.php

@@ -34,19 +34,19 @@
 		}else{
 			switch($response->faultCode()){
 				case 1:
-					$m = _('Insufficient Parameters to login');
+					$m = __('Insufficient Parameters to login');
 				break;
 				case 3:
-					$m = _("Account is not registered");
+					$m = __("Account is not registered");
 				break;
 				case 5:
-					$m = _("Invalid Username/Password");
+					$m = __("Invalid Username/Password");
 				break;
 				case 6:
-					$m = _("Account is frozen");
+					$m = __("Account is frozen");
 				break;
 				default:
-					$m = _("Could not log in");
+					$m = __("Could not log in");
 			}
 			return Array(false,$m);
 		}
@@ -129,8 +129,8 @@
 			$u = $user;
 		}
 		$msg = '';
-		if(!$irc = fsockopen(get_conf('irc-server'),get_conf('irc-port'))){return ircclose(1,_("Could not connect."));}
-		stream_set_timeout($irc,1) or ircclose(2,_("Could not set timeout."));
+		if(!$irc = fsockopen(get_conf('irc-server'),get_conf('irc-port'))){return ircclose(1,__("Could not connect."));}
+		stream_set_timeout($irc,1) or ircclose(2,__("Could not set timeout."));
 		while(!feof($irc)&&!$msg = fgets($irc,128)){}
 		if(!ircputs("NICK RehashServ\r\n")){return $ircret;}
 		if(!ircputs("USER RehashServ omni.irc.omnimaga.org RehashServ :RehashServ\r\n")){return $ircret;}
@@ -140,9 +140,9 @@
 				$msg .= $line;
 				$data = explode(' ',$line);
 				if(isval($data,1,'433')){
-					return ircclose(4,_("RehashServ is already running."));
+					return ircclose(4,__("RehashServ is already running."));
 				}elseif(strrpos($line,'ERROR :Closing Link:') !== false){
-					return ircclose(3,_("IRC Server refused the connection."));
+					return ircclose(3,__("IRC Server refused the connection."));
 				}elseif($data[0] == 'PING'){
 					if(!ircputs("PONG {$data[1]}")){return $ircret;}
 				}elseif(isval($data,1,'001')){
@@ -157,13 +157,13 @@
 				$msg .= $line;
 				$data = explode(' ',$line);
 				if(isval($data,1,'433')){
-					return ircclose(4,_("RehashServ is already running."));
+					return ircclose(4,__("RehashServ is already running."));
 				}elseif(strrpos($line,'ERROR :Closing Link:') !== false){
-					return ircclose(3,_("IRC Server refused the connection."));
+					return ircclose(3,__("IRC Server refused the connection."));
 				}elseif(strrpos($line,":You are now identified for") !== false){
 					break;
 				}elseif(strrpos($line,'Password incorrect.') !== false){
-					return ircclose(5,_("Failed to authenticate with NickServ"));
+					return ircclose(5,__("Failed to authenticate with NickServ"));
 				}
 			}
 		}
@@ -174,13 +174,13 @@
 				$msg .= $line;
 				$data = explode(' ',$line);
 				if(isval($data,1,'433')){
-					return ircclose(4,_("RehashServ is already running."));
+					return ircclose(4,__("RehashServ is already running."));
 				}elseif(strrpos($line,'ERROR :Closing Link:') !== false){
-					return ircclose(3,_("IRC Server refused the connection."));
+					return ircclose(3,__("IRC Server refused the connection."));
 				}elseif(strrpos($line,':Your vhost of') !== false && strrpos($line,'is now activated') !== false){
 					break;
 				}elseif(strrpos($line,"Please contact an Operator to get a vhost assigned to this nick") !== false){
-					return ircclose(6,_("vhost not set."));
+					return ircclose(6,__("vhost not set."));
 				}
 			}
 		}
@@ -200,8 +200,8 @@
 		}
 		fclose($irc);
 		if(strrpos($msg,':*** Notice -- Configuration loaded without any problems ..') === false){
-			return '{"code":6,"message":"'._('There is an error in the config. See console for output.').'","log":'.json_encode($msg).'}';
+			return '{"code":6,"message":"'.__('There is an error in the config. See console for output.').'","log":'.json_encode($msg).'}';
 		}
-		return '{"code":0,"message":"'._('Rehashed. View console for output.').'","log":'.json_encode($msg).'}';
+		return '{"code":0,"message":"'.__('Rehashed. View console for output.').'","log":'.json_encode($msg).'}';
 	}
 ?>

+ 5 - 3
lib/locale.php

@@ -1,4 +1,5 @@
 <?php
+	require_once(DIR.'/lib/gettext.inc');
 	@$locales = explode(',',$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
 	$langs = scandir(DIR.'/lang');
 	$found = false;
@@ -17,7 +18,8 @@
 		$locale = 'en';
 	}
 	define('LOCALE',$locale);
-	bindtextdomain('omninet',DIR.'/lang/'.LOCALE);
-	bind_textdomain_codeset('omninet','UTF-8');
-	textdomain('omninet');
+	T_setlocale(LC_MESSAGES,LOCALE);
+	T_bindtextdomain('omninet',DIR.'/lang');
+	T_bind_textdomain_codeset('omninet','UTF-8');
+	T_textdomain('omninet');
 ?>

+ 4 - 4
lib/opers.php

@@ -53,22 +53,22 @@
 		}
 		$ret = "";
 		foreach($opers as $k => $oper){
-			$ret .= "<h3>".($u['id'] != $oper['user_id']?_("Managed Oper").":":_("Personal Oper").":")."</h3>".get_form_html('oper-form-'.$oper['id'],Array(
+			$ret .= "<h3>".($u['id'] != $oper['user_id']?__("Managed Oper").":":__("Personal Oper").":")."</h3>".get_form_html('oper-form-'.$oper['id'],Array(
 				Array(
 					'name'=>'nick',
-					'label'=>_('Nick'),
+					'label'=>__('Nick'),
 					'type'=>'text',
 					'value'=>$oper['nick']
 				),
 				Array(
 					'name'=>'swhois',
-					'label'=>_('Omnimaga Profile'),
+					'label'=>__('Omnimaga Profile'),
 					'type'=>'text',
 					'value'=>$oper['swhois']
 				),
 				Array(
 					'name'=>'password',
-					'label'=>_('New Password'),
+					'label'=>__('New Password'),
 					'type'=>'password',
 					'value'=>''
 				),

+ 18 - 18
lib/security.php

@@ -60,17 +60,17 @@
 				setcookie('type','user',null,'/');
 				return true;
 			}else{
-				return _("Invalid credentials");
+				return __("Invalid credentials");
 			}
 		}elseif($type=='persona'){
 			if(!$user = get_user_obj($nick,$effective_role)){
-				return _("User")." {$nick} "._("does not exist");
+				return __("User")." {$nick} ".__("does not exist");
 			}
 			if(!isset($_COOKIE['personaUser'])){
 				return false;
 			}
 			if(!in_array($_COOKIE['personaUser'],get_emails($user['id']))){
-				return _("Invalid persona email");
+				return __("Invalid persona email");
 			}
 			setcookie('user',$nick,null,'/');
 			setcookie('key',$user['api_key'],null,'/');
@@ -78,10 +78,10 @@
 			return true;
 		}else{
 			if(!$user = get_user_obj($nick,$type)){
-				return _("User")." {$nick} "._("does not exist");
+				return __("User")." {$nick} ".__("does not exist");
 			}
 			if($user['password'] != mkpasswd($pass,$user['salt'])){
-				return _("Invalid password");
+				return __("Invalid password");
 			}
 			setcookie('user',$nick,null,'/');
 			setcookie('key',$user['api_key'],null,'/');
@@ -99,7 +99,7 @@
 						setcookie('token',$u['secret_key'],null,'/');
 						$r = true;
 					}else{
-						$r = _('Failed to create Authy user').': ';
+						$r = __('Failed to create Authy user').': ';
 						foreach($verification->errors() as $field => $message){
 							$message = json_decode($message);
 							$r .= $message['message'];
@@ -112,14 +112,14 @@
 						$_SESSION['secret_key'] = $u['secret_key'];
 						$r = true;
 					}else{
-						$r = _("Token didn't match ").$u['secret_key'];
+						$r = __("Token didn't match ").$u['secret_key'];
 					}
 				break;
 				default:
 					$r = true;
 			}
 		}else{
-			$r = _("You have been logged out");
+			$r = __("You have been logged out");
 		}
 		return $r;
 	}
@@ -134,10 +134,10 @@
 					if($deletion->ok()){
 						setcookie('secret_key','',time() - 3600,'/');
 						if(!query("UPDATE users u SET u.secret_key=NULL WHERE u.id=%d",Array($u['id']))){
-							$r = _('Failed to disable 2-factor authentication');
+							$r = __('Failed to disable 2-factor authentication');
 						}
 					}else{
-						$r = _('Failed to disable 2-factor authentication').': ';
+						$r = __('Failed to disable 2-factor authentication').': ';
 						foreach($deletion->errors() as $field => $message){
 							$message = json_decode($message);
 							$r .= $message->message;
@@ -147,7 +147,7 @@
 				case 'google-authenticator':
 					setcookie('secret_key','',time() - 3600,'/');
 					if(!query("UPDATE users u SET u.secret_key=NULL WHERE u.id=%d",Array($u['id']))){
-						$r = _('Failed to disable 2-factor authentication');
+						$r = __('Failed to disable 2-factor authentication');
 					}
 				break;
 				default:
@@ -168,17 +168,17 @@
 								query("UPDATE users u SET u.secret_key='%s' WHERE u.id=%d",Array($user->id(),$u['id']));
 								$r = true;
 							}else{
-								$r = _('Failed to create Authy user').': ';
+								$r = __('Failed to create Authy user').': ';
 								foreach($user->errors() as $field => $message){
 									$message = json_decode($message);
 									$r .= $message['message'];
 								}
 							}
 						}else{
-							$r = _("No cell number set");
+							$r = __("No cell number set");
 						}
 					}else{
-						$r = _("No country code set");
+						$r = __("No country code set");
 					}
 				break;
 				case 'google-authenticator':
@@ -188,20 +188,20 @@
 								query("UPDATE users u SET u.secret_key='%s' WHERE u.id=%d",Array($_SESSION['secret_key'],$u['id']));
 								$r = true;
 							}else{
-								$r = _('Could not register');
+								$r = __('Could not register');
 							}
 						}else{
-							$r = _('No secret key defined');
+							$r = __('No secret key defined');
 						}
 					}else{
-						$r = _('No token provided');
+						$r = __('No token provided');
 					}
 				break;
 				default:
 					$r = true;
 			}
 		}else{
-			$r = _("You have been logged out");
+			$r = __("You have been logged out");
 		}
 		return $r;
 	}

+ 6 - 6
lib/servers.php

@@ -101,14 +101,14 @@
 		foreach($servers as $k => $server){
 			$r .= "<h3>{$server['name']} ({$server['host']}) - {$server['description']}</h3><div>";
 			$suser = get_user_from_id_obj($server['user_id']);
-			$r .= "<h4>"._('Owner').":</h4>{$suser['nick']}<ul>";
-			$r .= "<li>"._('Real Name').": {$suser['real_name']}</li><li>"._('Email').": {$suser['email']}</li></ul>";
+			$r .= "<h4>".__('Owner').":</h4>{$suser['nick']}<ul>";
+			$r .= "<li>".__('Real Name').": {$suser['real_name']}</li><li>".__('Email').": {$suser['email']}</li></ul>";
 			$id = 0;
 			if(count($server['opers']) > 0){
-				$r .= "<h4>"._('Opers').":</h4><table class='tree'>";
+				$r .= "<h4>".__('Opers').":</h4><table class='tree'>";
 				$id++;
 				$pid = $id;
-				$r .= "<tr style='font-weight:bold;' class='treegrid-".($id)."'><td>"._('Nick')."</td><td>"._('Role')."</td></tr>";
+				$r .= "<tr style='font-weight:bold;' class='treegrid-".($id)."'><td>".__('Nick')."</td><td>".__('Role')."</td></tr>";
 				foreach($server['opers'] as $kk => $oper){
 					$id++;
 					$r .= "<tr class='treegrid-{$id} treegrid-parent-{$pid}'><td>{$oper['nick']}</td><td>{$oper['role']}</td></tr>";
@@ -116,11 +116,11 @@
 				$r .= "</table>";
 			}
 			if(isset($server['parent'])){
-				$r .= "<h4>"._('Parent')."</h4>";
+				$r .= "<h4>".__('Parent')."</h4>";
 				$r .= get_servers_list_html(Array($server['parent']),$depth+1);
 			}
 			if(count($server['children']) > 0){
-				$r .= "<h4>"._('Children')."</h4>";
+				$r .= "<h4>".__('Children')."</h4>";
 				$r .= get_servers_list_html($server['children'],$depth+1);
 			}
 			$r .="</div>";

+ 167 - 0
lib/streams.php

@@ -0,0 +1,167 @@
+<?php
+/*
+   Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <[email protected]>.
+
+   This file is part of PHP-gettext.
+
+   PHP-gettext is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   PHP-gettext is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with PHP-gettext; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+  // Simple class to wrap file streams, string streams, etc.
+  // seek is essential, and it should be byte stream
+class StreamReader {
+  // should return a string [FIXME: perhaps return array of bytes?]
+  function read($bytes) {
+    return false;
+  }
+
+  // should return new position
+  function seekto($position) {
+    return false;
+  }
+
+  // returns current position
+  function currentpos() {
+    return false;
+  }
+
+  // returns length of entire stream (limit for seekto()s)
+  function length() {
+    return false;
+  }
+};
+
+class StringReader {
+  var $_pos;
+  var $_str;
+
+  function StringReader($str='') {
+    $this->_str = $str;
+    $this->_pos = 0;
+  }
+
+  function read($bytes) {
+    $data = substr($this->_str, $this->_pos, $bytes);
+    $this->_pos += $bytes;
+    if (strlen($this->_str)<$this->_pos)
+      $this->_pos = strlen($this->_str);
+
+    return $data;
+  }
+
+  function seekto($pos) {
+    $this->_pos = $pos;
+    if (strlen($this->_str)<$this->_pos)
+      $this->_pos = strlen($this->_str);
+    return $this->_pos;
+  }
+
+  function currentpos() {
+    return $this->_pos;
+  }
+
+  function length() {
+    return strlen($this->_str);
+  }
+
+};
+
+
+class FileReader {
+  var $_pos;
+  var $_fd;
+  var $_length;
+
+  function FileReader($filename) {
+    if (file_exists($filename)) {
+
+      $this->_length=filesize($filename);
+      $this->_pos = 0;
+      $this->_fd = fopen($filename,'rb');
+      if (!$this->_fd) {
+        $this->error = 3; // Cannot read file, probably permissions
+        return false;
+      }
+    } else {
+      $this->error = 2; // File doesn't exist
+      return false;
+    }
+  }
+
+  function read($bytes) {
+    if ($bytes) {
+      fseek($this->_fd, $this->_pos);
+
+      // PHP 5.1.1 does not read more than 8192 bytes in one fread()
+      // the discussions at PHP Bugs suggest it's the intended behaviour
+      $data = '';
+      while ($bytes > 0) {
+        $chunk  = fread($this->_fd, $bytes);
+        $data  .= $chunk;
+        $bytes -= strlen($chunk);
+      }
+      $this->_pos = ftell($this->_fd);
+
+      return $data;
+    } else return '';
+  }
+
+  function seekto($pos) {
+    fseek($this->_fd, $pos);
+    $this->_pos = ftell($this->_fd);
+    return $this->_pos;
+  }
+
+  function currentpos() {
+    return $this->_pos;
+  }
+
+  function length() {
+    return $this->_length;
+  }
+
+  function close() {
+    fclose($this->_fd);
+  }
+
+};
+
+// Preloads entire file in memory first, then creates a StringReader
+// over it (it assumes knowledge of StringReader internals)
+class CachedFileReader extends StringReader {
+  function CachedFileReader($filename) {
+    if (file_exists($filename)) {
+
+      $length=filesize($filename);
+      $fd = fopen($filename,'rb');
+
+      if (!$fd) {
+        $this->error = 3; // Cannot read file, probably permissions
+        return false;
+      }
+      $this->_str = fread($fd, $length);
+      fclose($fd);
+
+    } else {
+      $this->error = 2; // File doesn't exist
+      return false;
+    }
+  }
+};
+
+
+?>

+ 4 - 4
lib/users.php

@@ -134,19 +134,19 @@
 		return get_form_html('user-form-'.$user['id'],Array(
 			Array(
 				'name'=>'real_name',
-				'label'=>_('Real Name'),
+				'label'=>__('Real Name'),
 				'type'=>'text',
 				'value'=>$user['real_name']
 			),
 			Array(
 				'name'=>'nick',
-				'label'=>_('Nick'),
+				'label'=>__('Nick'),
 				'type'=>'text',
 				'value'=>$user['nick']
 			),
 			Array(
 				'name'=>'email',
-				'label'=>_('Email'),
+				'label'=>__('Email'),
 				'type'=>'text',
 				'value'=>$user['email']
 			),
@@ -160,7 +160,7 @@
 				'type'=>'hidden',
 				'value'=>'user'
 			)
-		),_('Save'));
+		),__('Save'));
 	}
 	function has_flag($user,$flag){
 		return strpos($user['flags'],$flag)!==false;

+ 68 - 68
site/api/index.php

@@ -19,8 +19,8 @@
 			die();
 		break;
 		case 'login':
-			isset($_GET['username']) && isset($_GET['password']) or die('{"code":2,"message":"'._('Missing username and/or password').'"}');
-			isset($_GET['type']) or die('{"code":2,"message":"'._('Missing user type').'"}');
+			isset($_GET['username']) && isset($_GET['password']) or die('{"code":2,"message":"'.__('Missing username and/or password').'"}');
+			isset($_GET['type']) or die('{"code":2,"message":"'.__('Missing user type').'"}');
 			$r = login($_GET['username'],$_GET['password'],$_GET['type']);
 			if($r !== true){
 				die('{"code":2,"message":"'.$r.'"}');
@@ -29,7 +29,7 @@
 			}
 		break;
 		case 'verify':
-			isset($_GET['token']) or die('{"code":1,"message":"'._('No token set').'"}');
+			isset($_GET['token']) or die('{"code":1,"message":"'.__('No token set').'"}');
 			$r = verify($_GET['token']);
 			if($r !== true){
 				die('{"code":2,"message":"'.$r.'"}');
@@ -41,7 +41,7 @@
 			die('{"code":0}');
 		break;
 		case 'get-memos':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
 			$u['type'] = 'user' && isset($_COOKIE['user']) && isset($_SESSION['password']) or die('{"code":0}');
 			$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'MemoServ','list');
 			if($res[0]){
@@ -70,11 +70,11 @@
 				}
 				die('{"code":0,"memos":'.json_encode($memos).'}');
 			}else{
-				die('{"code":1,"message":"'._('Cannot fetch memos').'"}');
+				die('{"code":1,"message":"'.__('Cannot fetch memos').'"}');
 			}
 		break;
 		case 'get-news':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
 			$u['type'] = 'user' && isset($_COOKIE['user']) && isset($_SESSION['password']) or die('{"code":0}');
 			$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'InfoServ','list');
 			if($res[0]){
@@ -98,11 +98,11 @@
 				}
 				die('{"code":0,"news":'.json_encode($news).'}');
 			}else{
-				die('{"code":1,"message":"'._('Cannot fetch news').'"}');
+				die('{"code":1,"message":"'.__('Cannot fetch news').'"}');
 			}
 		break;
 		case 'get-channels':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
 			$u['type'] = 'user' && isset($_COOKIE['user']) && isset($_SESSION['password']) or die('{"code":0}');
 			$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'NickServ','listchans');
 			if($res[0]){
@@ -114,23 +114,23 @@
 						$flags = array();
 						foreach($flags_list as $kk => $flag){
 							switch($flag){
-								case 'v':$name=_('Voice');break;
-								case 'V':$name=_('Automatic voice');break;
-								case 'h':$name=_('Halfop');break;
-								case 'H':$name=_('Automatic Halfop');break;
-								case 'o':$name=_('Op');break;
-								case 'O':$name=_('Automatic Op');break;
-								case 'a':$name=_('Admin');break;
-								case 'q':$name=_('Owner');break;
-								case 's':$name=_('Set');break;
-								case 'i':$name=_('Invite/Getkey');break;
-								case 'r':$name=_('Kick/Ban');break;
-								case 'R':$name=_('Recover/Clear');break;
-								case 'f':$name=_('Modify access lists');break;
-								case 't':$name=_('Topic');break;
-								case 'A':$name=_('View access lists');break;
-								case 'F':$name=_('Founder');break;
-								case 'b':$name=_('Banned');break;
+								case 'v':$name=__('Voice');break;
+								case 'V':$name=__('Automatic voice');break;
+								case 'h':$name=__('Halfop');break;
+								case 'H':$name=__('Automatic Halfop');break;
+								case 'o':$name=__('Op');break;
+								case 'O':$name=__('Automatic Op');break;
+								case 'a':$name=__('Admin');break;
+								case 'q':$name=__('Owner');break;
+								case 's':$name=__('Set');break;
+								case 'i':$name=__('Invite/Getkey');break;
+								case 'r':$name=__('Kick/Ban');break;
+								case 'R':$name=__('Recover/Clear');break;
+								case 'f':$name=__('Modify access lists');break;
+								case 't':$name=__('Topic');break;
+								case 'A':$name=__('View access lists');break;
+								case 'F':$name=__('Founder');break;
+								case 'b':$name=__('Banned');break;
 								default:$name=$flag;
 							}
 							array_push($flags,array(
@@ -147,29 +147,29 @@
 				}
 				die('{"code":0,"channels":'.json_encode($channels).'}');
 			}else{
-				die('{"code":1,"message":"'._('Cannot fetch channels').'"}');
+				die('{"code":1,"message":"'.__('Cannot fetch channels').'"}');
 			}
 		break;
 		case 'send-memo':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
-			isset($_GET['to']) && isset($_GET['message']) or die('{"code":1,"message":"'._('No message or user entered').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
+			isset($_GET['to']) && isset($_GET['message']) or die('{"code":1,"message":"'.__('No message or user entered').'"}');
 			$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'MemoServ','send',Array($_GET['to'],$_GET['message']));
 			if($res[0]){
 				if(substr($res[1],-19) == ' is not registered.'){
-					die('{"code":1,"message":"'._('User').' '.$_GET['to'].' '._('does not exist').'"}');
+					die('{"code":1,"message":"'.__('User').' '.$_GET['to'].' '.__('does not exist').'"}');
 				}else{
-					die('{"code":0,"message":"'._('Memo Sent').'"}');
+					die('{"code":0,"message":"'.__('Memo Sent').'"}');
 				}
 			}else{
-				die('{"code":1,"message":"'._('Cannot send memo').': '.$res[1].'"}');
+				die('{"code":1,"message":"'.__('Cannot send memo').': '.$res[1].'"}');
 			}
 		break;
 		case 'delete-memo':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
-			isset($_GET['id']) or die('{"code":1,"message":"'._('No id given').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
+			isset($_GET['id']) or die('{"code":1,"message":"'.__('No id given').'"}');
 			$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'MemoServ','delete',Array($_GET['id']));
 			if(!$res[0]){
-				die('{"code":1,"message":"'._('Cannot send memo').': '+$res[1]+'"}');
+				die('{"code":1,"message":"'.__('Cannot send memo').': '+$res[1]+'"}');
 			}
 			die('{"code":0}');
 		break;
@@ -202,9 +202,9 @@
 			$result = json_decode($result);
 			if($result->status == 'okay'){
 				if($register && !add_email($u['id'],$result->email)){
-					die('{"code":1,"message":"'._('Failed to add email').' '.$result->email.' '._('to user').' '.$u['nick'].'"}');
+					die('{"code":1,"message":"'.__('Failed to add email').' '.$result->email.' '.__('to user').' '.$u['nick'].'"}');
 				}elseif(!$register && !$u = get_user_for_email($result->email)){
-					die('{"code":1,"message":"'._('Email does not match any users').'"}');
+					die('{"code":1,"message":"'.__('Email does not match any users').'"}');
 				}
 				setcookie('personaUser',$result->email,null,'/');
 				$pass = null;
@@ -227,10 +227,10 @@
 			}
 		break;
 		case 'persona-remove':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
-			isset($_GET['id']) or die('{"code":1,"message":"'._('No ID set').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
+			isset($_GET['id']) or die('{"code":1,"message":"'.__('No ID set').'"}');
 			if(!remove_email($u['id'],$_GET['id'],true)){
-				die('{"code":1,"message":"'._('Could not remove email address').'"}');
+				die('{"code":1,"message":"'.__('Could not remove email address').'"}');
 			}
 			die('{"code":0}');
 		break;
@@ -242,25 +242,25 @@
 			die('{"code":0}');
 		break;
 		case '2-factor-delete':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
 			$r = delete_token($u['id']);
 			if($r !== true){
 				die('{"code":1,"message":"'.$r.'"}');
 			}
-			die('{"code":0,"message":"'._('2-factor disabled.').'"}');
+			die('{"code":0,"message":"'.__('2-factor disabled.').'"}');
 		break;
 		case 'ping':
-			$u or die('{"code":1,"message":"'._('You have been logged out').'"}');
+			$u or die('{"code":1,"message":"'.__('You have been logged out').'"}');
 			die('{"code":0}');
 		break;
 		case 'newpass':
-			$u && isset($_GET['password']) && isset($_GET['newpass']) or die('{"code":2,"message":"'._('Make sure that everything is filled in. Try reloading if it is.').'"}');
-			$u['password'] == mkpasswd($_GET['password'],$u['salt']) or die('{"code":2,"message":"'._('Invalid password').'"}');
+			$u && isset($_GET['password']) && isset($_GET['newpass']) or die('{"code":2,"message":"'.__('Make sure that everything is filled in. Try reloading if it is.').'"}');
+			$u['password'] == mkpasswd($_GET['password'],$u['salt']) or die('{"code":2,"message":"'.__('Invalid password').'"}');
 			$u['api_key'] == $_COOKIE['key'] or die('{"code":3,"message":"Not Logged in to use '.$u['nick'].' with key '.$u['api_key'].' != '.$_COOKIE['key'].'."}');
 			if($_COOKIE['type'] == 'user'){
 				$res = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$u['nick'],$_GET['password'],'NickServ','set',Array('password',trim($_GET['newpass'])));
 				if($res[0] === false){
-					die('{"code":2,"message":"'._('Could not update password with nickserv').': '.$res[1].'"}');
+					die('{"code":2,"message":"'.__('Could not update password with nickserv').': '.$res[1].'"}');
 				}else{
 					$_SESSION['password'] = $_GET['newpass'];
 				}
@@ -269,58 +269,58 @@
 			die('{"code":0}');
 		break;
 		case 'sync-pass':
-			$u && isset($_SESSION['password'])or die('{"code":2,"message":"'._('Make sure that everything is filled in. Try reloading if it is.').'"}');
-			$u['api_key'] == $_COOKIE['key'] or die('{"code":3,"message":"'._('Not Logged in to use').' '.$u['nick'].' '._('with key').' '.$u['api_key'].' != '.$_COOKIE['key'].'."}');
-			$_COOKIE['type'] == 'user' or die('{"code":3,"message":"'._('Must be logged in with type user to sync pass').'"}');
+			$u && isset($_SESSION['password'])or die('{"code":2,"message":"'.__('Make sure that everything is filled in. Try reloading if it is.').'"}');
+			$u['api_key'] == $_COOKIE['key'] or die('{"code":3,"message":"'.__('Not Logged in to use').' '.$u['nick'].' '.__('with key').' '.$u['api_key'].' != '.$_COOKIE['key'].'."}');
+			$_COOKIE['type'] == 'user' or die('{"code":3,"message":"'.__('Must be logged in with type user to sync pass').'"}');
 			$res = atheme_login(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),$u['nick'],$_SESSION['password']);
 			if($res[0] === false){
-				die('{"code":2,"message":"'._('Could not verify with nickserv').': '.$res[1].'"}');
+				die('{"code":2,"message":"'.__('Could not verify with nickserv').': '.$res[1].'"}');
 			}
 			query("UPDATE users u SET u.password='%s' WHERE u.id=%d",Array(mkpasswd($_SESSION['password']),$u['id']));
-			die('{"code":0,"message":"'._('Nickserv password synchronized with main account').'"}');
+			die('{"code":0,"message":"'.__('Nickserv password synchronized with main account').'"}');
 		break;
 		case 'role':
-			$u && isset($_GET['type']) or die('{"code":2,"message":"'._('Make sure that everything is filled in. Try reloading if it is.').'"}');
+			$u && isset($_GET['type']) or die('{"code":2,"message":"'.__('Make sure that everything is filled in. Try reloading if it is.').'"}');
 			setcookie('type',$_GET['type'],null,'/');
 			die('{"code":0}');
 		break;
 		case 'user':
-			$u or die('{"code":10,"message":"'._('Not logged in').'"}');
-			isset($_GET['id']) or die('{"code":2,"message":"'._('No user set.').'"}');
-			isset($_GET['email']) or die('{"code":2,"message":"'._('No email set.').'"}');
-			isset($_GET['real_name']) or die('{"code":2,"message":"'._('No real name set.').'"}');
-			isset($_GET['nick']) or die('{"code":2,"message":"'._('No nick set.').'"}');
-			$user = get_user_from_id_obj($_GET['id']) or die('{"code":2,"message":"'._('User with id').' '.$_GET['id'].' '._('does not exist. You should reload the page.').'"}');
+			$u or die('{"code":10,"message":"'.__('Not logged in').'"}');
+			isset($_GET['id']) or die('{"code":2,"message":"'.__('No user set.').'"}');
+			isset($_GET['email']) or die('{"code":2,"message":"'.__('No email set.').'"}');
+			isset($_GET['real_name']) or die('{"code":2,"message":"'.__('No real name set.').'"}');
+			isset($_GET['nick']) or die('{"code":2,"message":"'.__('No nick set.').'"}');
+			$user = get_user_from_id_obj($_GET['id']) or die('{"code":2,"message":"'.__('User with id').' '.$_GET['id'].' '.__('does not exist. You should reload the page.').'"}');
 			if($u['id'] == $user['id']){
 				setcookie('user',$_GET['nick'],null,'/');
 			}
-			query("UPDATE users u SET u.nick='%s', u.real_name='%s', u.email='%s' WHERE u.id=%d",Array($_GET['nick'],$_GET['real_name'],$_GET['email'],$_GET['id'])) or die('{"code":2,"message":"'._('Unable to update user').'"}');
+			query("UPDATE users u SET u.nick='%s', u.real_name='%s', u.email='%s' WHERE u.id=%d",Array($_GET['nick'],$_GET['real_name'],$_GET['email'],$_GET['id'])) or die('{"code":2,"message":"'.__('Unable to update user').'"}');
 			die(ircrehash());
 		break;
 		case 'oper':
-			$u or die('{"code":10,"message":"'._('Not logged in').'"}');
-			isset($_GET['id']) or die('{"code":2,"message":"'._('No user set.').'"}');
-			isset($_GET['nick']) or die('{"code":2,"message":"'._('No nick set.').'"}');
-			isset($_GET['swhois']) or die('{"code":2,"message":"'._('No profile set.').'"}');
-			$oper = get_oper_from_id_obj($_GET['id']) or die('{"code":2,"message":"'._('Oper with id').' '.$_GET['id'].' '._('does not exist. You should reload the page.').'"}');
+			$u or die('{"code":10,"message":"'.__('Not logged in').'"}');
+			isset($_GET['id']) or die('{"code":2,"message":"'.__('No user set.').'"}');
+			isset($_GET['nick']) or die('{"code":2,"message":"'.__('No nick set.').'"}');
+			isset($_GET['swhois']) or die('{"code":2,"message":"'.__('No profile set.').'"}');
+			$oper = get_oper_from_id_obj($_GET['id']) or die('{"code":2,"message":"'.__('Oper with id').' '.$_GET['id'].' '.__('does not exist. You should reload the page.').'"}');
 			if(isset($_GET['password']) && $_GET['password'] != ""){
-				query("UPDATE opers o SET o.nick='%s', o.swhois='%s', o.password='%s', o.password_type_id=2 WHERE o.id=%d",Array($_GET['nick'],$_GET['swhois'],mkpasswd($_GET['password']),$_GET['id'])) or die('{"code":2,"message":"'._('Unable to update oper').'"}');
+				query("UPDATE opers o SET o.nick='%s', o.swhois='%s', o.password='%s', o.password_type_id=2 WHERE o.id=%d",Array($_GET['nick'],$_GET['swhois'],mkpasswd($_GET['password']),$_GET['id'])) or die('{"code":2,"message":"'.__('Unable to update oper').'"}');
 			}else{
-				query("UPDATE opers o SET o.nick='%s', o.swhois='%s' WHERE o.id=%d",Array($_GET['nick'],$_GET['swhois'],$_GET['id'])) or die('{"code":2,"message":"'._('Unable to update oper').'"}');
+				query("UPDATE opers o SET o.nick='%s', o.swhois='%s' WHERE o.id=%d",Array($_GET['nick'],$_GET['swhois'],$_GET['id'])) or die('{"code":2,"message":"'.__('Unable to update oper').'"}');
 			}
 			die(ircrehash());
 		break;
 		case 'config':
 			foreach($_GET as $key => $val){
-				set_conf($key,$val,get_conf_type($key)) or die('{"code":1,"message":"'._('Failed to update setting').': '.$key.' '._('with value').': '.$val.'"}');
+				set_conf($key,$val,get_conf_type($key)) or die('{"code":1,"message":"'.__('Failed to update setting').': '.$key.' '.__('with value').': '.$val.'"}');
 			}
 			die('{"code":0}');
 		break;
 		case 'rehash':
-			$u or die('{"code":10,"message":"'._('Not logged in').'"}');
+			$u or die('{"code":10,"message":"'.__('Not logged in').'"}');
 			die(ircrehash());
 		break;
 		default:
-			die('{"code":1,"message":"'._('Invalid Action').': '.$_GET['action'].'"}');
+			die('{"code":1,"message":"'.__('Invalid Action').': '.$_GET['action'].'"}');
 	}
 ?>

+ 58 - 58
site/index.php

@@ -75,20 +75,20 @@
 				echo "});</script>";
 				if(has_flag($user,'u')){ ?>
 					<script id="template-memos" type="text/x-handlebars-template">
-						<button class="button" value="<?php echo _('Refresh'); ?>" onclick="window.FetchMemos(true);">
-							<?php echo _('Refresh'); ?>
+						<button class="button" value="<?php echo __('Refresh'); ?>" onclick="window.FetchMemos(true);">
+							<?php echo __('Refresh'); ?>
 						</button>
-						<button style="background-color:green;background-image:none;" class="button" value="<?php echo _('New Memo'); ?>" id="send-memo" onclick="$('#memo-diag').dialog('open');">
-							<?php echo _('New Memo'); ?>
+						<button style="background-color:green;background-image:none;" class="button" value="<?php echo __('New Memo'); ?>" id="send-memo" onclick="$('#memo-diag').dialog('open');">
+							<?php echo __('New Memo'); ?>
 						</button>
-						<button class="button" style="background-color:red;background-image:none;" value="<?php echo _('Delete All'); ?>" onclick="return window.DeleteMemos();">
-							<?php echo _('Delete All'); ?>
+						<button class="button" style="background-color:red;background-image:none;" value="<?php echo __('Delete All'); ?>" onclick="return window.DeleteMemos();">
+							<?php echo __('Delete All'); ?>
 						</button>
 						{{#each memos}}
 							<div style="padding: 5px;" class="ui-widget ui-state-default ui-corner-all" id="memo-{{this.id}}">
 								<div>
 									<span>
-										<?php echo _('From'); ?>:
+										<?php echo __('From'); ?>:
 									</span>
 									<span style="font-weight:normal;" class='memo-from'>
 										{{this.from}}
@@ -96,7 +96,7 @@
 								</div>
 								<div>
 									<span>
-										<?php echo _('Sent'); ?>:
+										<?php echo __('Sent'); ?>:
 									</span>
 									<span style="font-weight:normal;" class='memo-date'>
 										{{this.date}}
@@ -104,24 +104,24 @@
 								</div>
 								<div>
 									<span>
-										<?php echo _('Body'); ?>:
+										<?php echo __('Body'); ?>:
 									</span>
 									<span style="font-weight:normal;" class="memo-body">
 										{{html this.body}}
 									</span>
 								</div>
-								<button class="button" value="<?php echo _('Reply'); ?>" onclick="return window.ReplyToMemoFromButton.call(this);">
-									<?php echo _('Reply'); ?>
+								<button class="button" value="<?php echo __('Reply'); ?>" onclick="return window.ReplyToMemoFromButton.call(this);">
+									<?php echo __('Reply'); ?>
 								</button>
-								<button style="background-color:red;background-image:none;" class="button" value="<?php echo _('Delete'); ?>" onclick="return window.DeleteMemoFromButton.call(this);">
-									<?php echo _('Delete'); ?>
+								<button style="background-color:red;background-image:none;" class="button" value="<?php echo __('Delete'); ?>" onclick="return window.DeleteMemoFromButton.call(this);">
+									<?php echo __('Delete'); ?>
 								</button>
 							</div>
 						{{/each}}
 					</script>
 					<script id="template-news" type="text/x-handlebars-template">
-						<button value="<?php echo _('Refresh'); ?>" onclick="window.FetchNews(true);">
-							<?php echo _('Refresh'); ?>
+						<button value="<?php echo __('Refresh'); ?>" onclick="window.FetchNews(true);">
+							<?php echo __('Refresh'); ?>
 						</button>
 						{{#each news}}
 							<div id="news-{{this.id}}" class="ui-widget ui-state-default ui-corner-all" style="padding:5px;">
@@ -130,7 +130,7 @@
 								</h2>
 								<div>
 									<span>
-										<?php echo _('From'); ?>:
+										<?php echo __('From'); ?>:
 									</span>
 									<span style="font-weight:normal;">
 										{{this.from}}
@@ -138,7 +138,7 @@
 								</div>
 								<div>
 									<span>
-										<?php echo _('Sent'); ?>:
+										<?php echo __('Sent'); ?>:
 									</span>
 									<span style="font-weight:normal;">
 										{{this.date}}
@@ -151,24 +151,24 @@
 						{{/each}}
 					</script>
 					<script id="template-channels" type="text/x-handlebars-template">
-						<button value="<?php echo _('Refresh'); ?>" onclick="window.FetchChannels(true);">
-							<?php echo _('Refresh'); ?>
+						<button value="<?php echo __('Refresh'); ?>" onclick="window.FetchChannels(true);">
+							<?php echo __('Refresh'); ?>
 						</button>
-						<button value="<?php echo _('New Channel'); ?>" style="background-color:green;background-image:none;" onclick="">
-							<?php echo _('New Channel'); ?>
+						<button value="<?php echo __('New Channel'); ?>" style="background-color:green;background-image:none;" onclick="">
+							<?php echo __('New Channel'); ?>
 						</button>
 						{{#each channels}}
 							<div id="channel-{{this.name}}" class="ui-widget ui-state-default ui-corner-all" style="padding:5px;">
 								{{this.name}}
 								<br/>
-								<?php echo _('Flags:'); ?>
+								<?php echo __('Flags:'); ?>
 								<ul>
 									{{#each this.flags}}
 										<li>{{this.name}}</li>
 									{{/each}}
 								</ul>
-								<button value="<?php echo _('Delete'); ?>" style="background-color:red;background-image:none;" onclick="">
-									<?php echo _('Delete'); ?>
+								<button value="<?php echo __('Delete'); ?>" style="background-color:red;background-image:none;" onclick="">
+									<?php echo __('Delete'); ?>
 								</button>
 							</div>
 						{{/each}}
@@ -186,15 +186,15 @@
 				<ul>
 					<?php
 						if(has_flag($user,'u')){ ?>
-							<li><a href="#news"><?php echo _('News'); ?></a></li>
-							<li><a href="#memos"><?php echo _('Memos'); ?></a></li>
-							<li><a href="#channels"><?php echo _('Channels'); ?></a></li>
+							<li><a href="#news"><?php echo __('News'); ?></a></li>
+							<li><a href="#memos"><?php echo __('Memos'); ?></a></li>
+							<li><a href="#channels"><?php echo __('Channels'); ?></a></li>
 						<?php }
-						echo has_flag($user,'n')?'<li><a href="#servers">'._('Servers').'</a></li>':'';
-						echo has_flag($user,'o')?'<li><a href="#opers">'._('Opers').'</a></li>':'';
-						echo has_flag($user,'a')?'<li><a href="#config">'._('Configuration').'</a></li>':'';
+						echo has_flag($user,'n')?'<li><a href="#servers">'.__('Servers').'</a></li>':'';
+						echo has_flag($user,'o')?'<li><a href="#opers">'.__('Opers').'</a></li>':'';
+						echo has_flag($user,'a')?'<li><a href="#config">'.__('Configuration').'</a></li>':'';
 					?>
-					<li><a href="#profile"><?php echo _('Profile'); ?></a></li>
+					<li><a href="#profile"><?php echo __('Profile'); ?></a></li>
 					<div id="user-menu-button" class="right button">
 						<?php echo $user['nick']; ?>
 					</div>
@@ -229,13 +229,13 @@
 						'form_fields'=>array(
 							array(
 								'name'=>'to',
-								'label'=>_('To'),
+								'label'=>__('To'),
 								'type'=>'string',
 								'value'=>''
 							),
 							array(
 								'name'=>'message',
-								'label'=>_('Message'),
+								'label'=>__('Message'),
 								'type'=>'string',
 								'value'=>''
 							),
@@ -257,7 +257,7 @@
 										echo '<div class="login-form">Enable 2-factor Authentication'.get_form_html('2-factor',array(
 											array(
 												'name'=>'country-code',
-												'label'=>_('Country'),
+												'label'=>__('Country'),
 												'type'=>'text',
 												'attributes'=>array(
 													'id'=>'authy-countries'
@@ -265,7 +265,7 @@
 											),
 											array(
 												'name'=>'cellphone',
-												'label'=>_('Cell #'),
+												'label'=>__('Cell #'),
 												'type'=>'text',
 												'attributes'=>array(
 													'id'=>'authy-cellphone'
@@ -288,7 +288,7 @@
 											),
 											array(
 												'name'=>'token',
-												'label'=>_('Token'),
+												'label'=>__('Token'),
 												'type'=>'text'
 											),
 											array(
@@ -303,16 +303,16 @@
 							}else{
 								switch(get_conf('2-factor-method')){
 									case 'authy':case 'google-authenticator':
-										echo "<button id='2-factor-disable' value='".('Disable 2-factor')."'>"._('Disable 2-factor')."</button>";
+										echo "<button id='2-factor-disable' value='".('Disable 2-factor')."'>".__('Disable 2-factor')."</button>";
 									break;
 									default:
 								}
 							}
 							if(get_conf('persona-endpoint') != 'none'){
-								echo "<div><span id='persona-register' class='ui-button ui-widget ui-state-default ui-corner-all' style='overflow:hidden;height:42px;padding:0px 20px 0px 0px;vertical-align:middle;'><img style='height:100%;float:left;' src='img/persona-logo.png'/><span style='display:inline-block;line-height:42px;'>"._('Link Persona')."</span></span></div>";
+								echo "<div><span id='persona-register' class='ui-button ui-widget ui-state-default ui-corner-all' style='overflow:hidden;height:42px;padding:0px 20px 0px 0px;vertical-align:middle;'><img style='height:100%;float:left;' src='img/persona-logo.png'/><span style='display:inline-block;line-height:42px;'>".__('Link Persona')."</span></span></div>";
 								$emails = get_emails($user['id'],true);
 								foreach($emails as $k => $email){
-									echo "<div><button id='persona-remove-{$email['id']}' value='"._('Remove')."'>"._('Remove')."</button>{$email['email']}</div>";
+									echo "<div><button id='persona-remove-{$email['id']}' value='".__('Remove')."'>".__('Remove')."</button>{$email['email']}</div>";
 								}
 							}
 						}
@@ -320,32 +320,32 @@
 				</div>
 			</div>
 			<ul class="menu" id="user-menu">
-				<li><a id="roles-button"><?php echo _('Switch Role'); ?></a></li>
+				<li><a id="roles-button"><?php echo __('Switch Role'); ?></a></li>
 				<?php if(has_flag($user,'n')||has_flag($user,'a')){?>
-					<li><a id="rehash-servers"><?php echo _('Rehash'); ?></a></li>
+					<li><a id="rehash-servers"><?php echo __('Rehash'); ?></a></li>
 				<?php } ?>
-				<li><a id="newpass-button"><?php echo _('Change Password'); ?></a></li>
+				<li><a id="newpass-button"><?php echo __('Change Password'); ?></a></li>
 				<?php if(has_flag($user,'u')){ ?>
-					<li><a id="sync-pass"><?php echo _('Sync Password'); ?></a></li>
+					<li><a id="sync-pass"><?php echo __('Sync Password'); ?></a></li>
 				<?php } ?>
-				<li><a id="logout"><?php echo _('Logout'); ?></a></li>
+				<li><a id="logout"><?php echo __('Logout'); ?></a></li>
 			</ul>
 			<?php
 					array_push($dialogs,array(
 						'id'=>'newpass-diag',
 						'type'=>'form',
 						'form_id'=>'newpass',
-						'form_submit_label'=>_('Change Password'),
+						'form_submit_label'=>__('Change Password'),
 						'form_fields'=>array(
 							array(
 								'name'=>'password',
-								'label'=>_('Password'),
+								'label'=>__('Password'),
 								'type'=>'password',
 								'value'=>''
 							),
 							array(
 								'name'=>'newpass',
-								'label'=>_('New Password'),
+								'label'=>__('New Password'),
 								'type'=>'password',
 								'value'=>''
 							),
@@ -358,7 +358,7 @@
 					));
 					$roles = array(array(
 						'value'=>'user',
-						'label'=>_('User')
+						'label'=>__('User')
 					));
 					if($res = query("SELECT rt.name AS value,rt.description AS label FROM user_role_types rt JOIN user_roles r ON r.user_role_id = rt.id JOIN users u ON r.user_id = u.id WHERE u.id = %d",array($user['id']))){
 						while($role = $res->fetch_assoc()){
@@ -369,11 +369,11 @@
 						'id'=>'roles-diag',
 						'type'=>'form',
 						'form_id'=>'roles',
-						'form_submit_label'=>_('Switch'),
+						'form_submit_label'=>__('Switch'),
 						'form_fields'=>array(
 							array(
 								'name'=>'type',
-								'label'=>_('Type'),
+								'label'=>__('Type'),
 								'type'=>'select',
 								'values'=>$roles,
 								'value'=>isset($_COOKIE['type'])?$_COOKIE['type']:'user'
@@ -391,11 +391,11 @@
 						'type'=>'form',
 						'autocomplete'=>'off',
 						'form_id'=>'verify',
-						'form_submit_label'=>_('Login'),
+						'form_submit_label'=>__('Login'),
 						'form_fields'=>array(
 							array(
 								'name'=>'token',
-								'label'=>_('2-Factor Verification'),
+								'label'=>__('2-Factor Verification'),
 								'type'=>'text',
 								'attributes'=>array(
 									'id'=>'authy-token',
@@ -412,7 +412,7 @@
 				}else{ 
 					$roles = array(array(
 						'value'=>'user',
-						'label'=>_('User')
+						'label'=>__('User')
 					));
 					if($res = query("SELECT name AS value,description AS label FROM ircd.user_role_types")){
 						while($role = $res->fetch_assoc()){
@@ -423,27 +423,27 @@
 						'id'=>'login-diag',
 						'type'=>'form',
 						'form_id'=>'login',
-						'form_submit_label'=>_('Login'),
+						'form_submit_label'=>__('Login'),
 						'form_fields'=>array(
 							array(
 								'type'=>'custom',
-								'html'=>get_conf('persona-endpoint') != 'none'?"<div><span id='persona-register' class='ui-button ui-widget ui-state-default ui-corner-all' style='overflow:hidden;height:42px;padding:0px 20px 0px 0px;vertical-align:middle;'><img style='height:100%;float:left;' src='img/persona-logo.png'/><span style='display:inline-block;line-height:42px;'>"._('Persona')."</span></span></div>":''
+								'html'=>get_conf('persona-endpoint') != 'none'?"<div><span id='persona-register' class='ui-button ui-widget ui-state-default ui-corner-all' style='overflow:hidden;height:42px;padding:0px 20px 0px 0px;vertical-align:middle;'><img style='height:100%;float:left;' src='img/persona-logo.png'/><span style='display:inline-block;line-height:42px;'>".__('Persona')."</span></span></div>":''
 							),
 							array(
 								'name'=>'username',
-								'label'=>_('Username'),
+								'label'=>__('Username'),
 								'type'=>'text',
 								'value'=>''
 							),
 							array(
 								'name'=>'password',
-								'label'=>_('Password'),
+								'label'=>__('Password'),
 								'type'=>'password',
 								'value'=>''
 							),
 							array(
 								'name'=>'type',
-								'label'=>_('Type'),
+								'label'=>__('Type'),
 								'type'=>'select',
 								'values'=>$roles
 							),

+ 0 - 1
site/js/index.js

@@ -572,7 +572,6 @@ $(function(){
 				});
 			}
 		},1000);
-		translate();
 		$('body').resize();
 	});
 });