diff --git a/languages/wp-cas-server-pt_PT.mo b/languages/wp-cas-server-pt_PT.mo index ca1e5c1..4d35bf5 100644 Binary files a/languages/wp-cas-server-pt_PT.mo and b/languages/wp-cas-server-pt_PT.mo differ diff --git a/languages/wp-cas-server-pt_PT.po b/languages/wp-cas-server-pt_PT.po index 85d6fc8..b8155ef 100644 --- a/languages/wp-cas-server-pt_PT.po +++ b/languages/wp-cas-server-pt_PT.po @@ -2,134 +2,172 @@ # This file is distributed under the same license as the Cassava CAS Server package. msgid "" msgstr "" -"PO-Revision-Date: 2014-08-09 21:15:28+0000\n" +"Project-Id-Version: Cassava CAS Server\n" +"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-cas-server\n" +"POT-Creation-Date: 2015-05-06 21:31-0000\n" +"PO-Revision-Date: 2015-05-06 21:32-0000\n" +"Last-Translator: Luís Rodrigues \n" +"Language-Team: \n" +"Language: pt_PT\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: GlotPress/0.1\n" -"Project-Id-Version: Cassava CAS Server\n" - -#: includes/WPCASServer.php:196 -msgid "The CAS server is disabled." -msgstr "O servidor CAS está desativado." - -#: includes/WPCASServer.php:208 -msgid "The handler for the route is invalid." -msgstr "O suporte para a rota é inválido." - -#: includes/WPCASServer.php:235 -msgid "The server does not support the method requested." -msgstr "O servidor não suporta o método pedido." - -#: includes/WPCASServer.php:419 -msgid "Unknown error" -msgstr "Erro desconhecido" - -#: includes/WPCASServer.php:453 -msgid "Ticket is required." -msgstr "É obrigatório o ticket." +"X-Generator: Poedit 1.8beta2\n" -#: includes/WPCASServer.php:457 -msgid "Service is required." -msgstr "É obrigatório o service." - -#: includes/WPCASServer.php:481 -msgid "Ticket does not match the service provided." -msgstr "O ticket não corresponde ao service indicado." - -#: includes/WPCASServerPluginAdmin.php:55 -#: includes/WPCASServerPluginAdmin.php:56 +#: lib/Admin.php:50 lib/Admin.php:51 msgid "Cassava CAS Server" msgstr "Cassava CAS Server" -#: includes/WPCASServerPluginAdmin.php:89 -msgid "Cassava CAS Server requires that this site be configured for HTTPS. For more information, contact your system administrator or hosting provider." -msgstr "O Cassava CAS Server precisa que este site se encontre configurado para HTTPS. Para mais informações, contacte o seu administrador de sistemas ou prestador de alojamento." +#: lib/Admin.php:84 +msgid "" +"Cassava CAS Server requires that this site be configured for HTTPS. For more " +"information, contact your system administrator or hosting provider." +msgstr "" +"O Cassava CAS Server precisa que este site se encontre configurado para HTTPS. " +"Para mais informações, contacte o seu administrador de sistemas ou prestador de " +"alojamento." -#: includes/WPCASServerPluginAdmin.php:135 +#: lib/Admin.php:134 msgid "User Attributes To Return" msgstr "Atributos do utilizador a devolver" -#: includes/WPCASServerPluginAdmin.php:144 +#: lib/Admin.php:143 msgid "CAS server base" msgstr "Base do servidor CAS" -#: includes/WPCASServerPluginAdmin.php:196 +#: lib/Admin.php:199 msgid "Cassava CAS Server Settings" msgstr "Definições do Cassava CAS Server" -#: includes/WPCASServerPluginAdmin.php:198 -msgid "Configuration panel for the Central Authentication Service provided by this site." -msgstr "Painel de configuração para o Serviço Central de Autenticação (CAS) prestado por este site." +#: lib/Admin.php:201 +msgid "" +"Configuration panel for the Central Authentication Service provided by this site." +msgstr "" +"Painel de configuração para o Serviço Central de Autenticação (CAS) prestado por " +"este site." -#: includes/WPCASServerPluginAdmin.php:228 +#: lib/Admin.php:231 msgid "First Name" msgstr "Nome" -#: includes/WPCASServerPluginAdmin.php:229 +#: lib/Admin.php:232 msgid "Last Name" msgstr "Apelido" -#: includes/WPCASServerPluginAdmin.php:230 +#: lib/Admin.php:233 msgid "Public Name" msgstr "Nome público" -#: includes/WPCASServerPluginAdmin.php:231 +#: lib/Admin.php:234 msgid "Email" msgstr "Correio eletrónico" -#: includes/WPCASServerPluginAdmin.php:232 +#: lib/Admin.php:235 msgid "Website" msgstr "Website" -#: includes/WPCASServerPluginAdmin.php:254 +#: lib/Admin.php:257 msgid "User Attributes" msgstr "Atributos do utilizador" -#: includes/WPCASServerPluginAdmin.php:264 +#: lib/Admin.php:267 msgid "(e.g. %s)" msgstr "(ex: %s)" -#: includes/WPCASServerPluginAdmin.php:269 -msgid "Checked attributes are disclosed on successful validation requests (CAS 2.0 only)." -msgstr "Os atributos assinalados serão disponibilizados aquando de pedidos de validação com êxito (CAS 2.0 apenas)." +#: lib/Admin.php:272 +msgid "" +"Checked attributes are disclosed on successful validation requests (CAS 2.0 only)." +msgstr "" +"Os atributos assinalados serão disponibilizados aquando de pedidos de validação " +"com êxito (CAS 2.0 apenas)." + +#: lib/CAS/Controller/ValidateController.php:105 +msgid "Ticket is required." +msgstr "É obrigatório o ticket." + +#: lib/CAS/Controller/ValidateController.php:109 +msgid "Service is required." +msgstr "É obrigatório o service." + +#: lib/CAS/Controller/ValidateController.php:120 +msgid "Ticket does not match the service provided." +msgstr "O ticket não corresponde ao service indicado." + +#: lib/CAS/Response/BaseResponse.php:87 +msgid "Unknown error" +msgstr "Erro desconhecido" + +#: lib/CAS/Server.php:190 +msgid "The CAS server is disabled." +msgstr "O servidor CAS está desativado." + +#: lib/CAS/Server.php:204 +msgid "The controller for the route is invalid." +msgstr "O controlador para a rota é inválido." + +#: lib/CAS/Server.php:235 +msgid "The server does not support the method requested." +msgstr "O servidor não suporta o método pedido." -#: includes/WPCASTicket.php:144 -msgid "Ticket is malformed." -msgstr "O ticket está incorrecto." +#: lib/CAS/Ticket.php:141 +msgid "Expired ticket." +msgstr "Ticket fora do prazo de validade." -#: includes/WPCASTicket.php:150 -msgid "Ticket has expired." -msgstr "O ticket expirou." +#: lib/CAS/Ticket.php:147 +msgid "No user matches ticket." +msgstr "Nenhum utilizador corresponde ao ticket." -#: includes/WPCASTicket.php:156 -msgid "Ticket does not match a valid user." -msgstr "O ticket não diz respeito a um utilizador válido." +#: lib/CAS/Ticket.php:153 +msgid "Corrupted ticket." +msgstr "Ticket corrompido." -#: includes/WPCASTicket.php:162 -msgid "Ticket is corrupted." -msgstr "O ticket está corrompido." +#: lib/CAS/Ticket.php:157 +msgid "Unknown or used ticket." +msgstr "Ticket desconhecido ou usado." -#: includes/WPCASTicket.php:166 -msgid "Ticket is unknown or has already been used." -msgstr "Ticket desconhecido ou já utilizado." +#: lib/CAS/Ticket.php:200 +msgid "Malformed ticket." +msgstr "Ticket defeituoso." -#: includes/WPCASTicket.php:204 +#: lib/CAS/Ticket.php:254 msgid "Ticket type cannot be validated." msgstr "O tipo de ticket não pode ser validado." +#. Plugin Name of the plugin/theme msgid "Cassava: A WordPress CAS Server" msgstr "Cassava: Um servidor CAS para WordPress" +#. Plugin URI of the plugin/theme msgid "https://goblindegook.github.io/wp-cas-server" msgstr "https://goblindegook.github.io/wp-cas-server" +#. Description of the plugin/theme msgid "Provides authentication services based on the Jasig CAS protocol." msgstr "Presta serviços de autenticação baseados no protocolo Jasig CAS." +#. Author of the plugin/theme msgid "Luís Rodrigues" msgstr "Luís Rodrigues" +#. Author URI of the plugin/theme msgid "http://goblindegook.net/" -msgstr "http://goblindegook.net/" \ No newline at end of file +msgstr "http://goblindegook.net/" + +#~ msgid "The handler for the route is invalid." +#~ msgstr "O suporte para a rota é inválido." + +#~ msgid "Ticket is malformed." +#~ msgstr "O ticket está incorrecto." + +#~ msgid "Ticket has expired." +#~ msgstr "O ticket expirou." + +#~ msgid "Ticket does not match a valid user." +#~ msgstr "O ticket não diz respeito a um utilizador válido." + +#~ msgid "Ticket is corrupted." +#~ msgstr "O ticket está corrompido." + +#~ msgid "Ticket is unknown or has already been used." +#~ msgstr "Ticket desconhecido ou já utilizado." diff --git a/languages/wp-cas-server.pot b/languages/wp-cas-server.pot index 7ff2e6d..486f053 100644 --- a/languages/wp-cas-server.pot +++ b/languages/wp-cas-server.pot @@ -2,9 +2,9 @@ # This file is distributed under the same license as the Cassava: A WordPress CAS Server package. msgid "" msgstr "" -"Project-Id-Version: Cassava: A WordPress CAS Server 1.2.0\n" +"Project-Id-Version: Cassava: A WordPress CAS Server 1.2.1\n" "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-cas-server\n" -"POT-Creation-Date: 2015-02-22 19:30:29+00:00\n" +"POT-Creation-Date: 2015-05-06 20:29:47+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,53 +22,53 @@ msgid "" "information, contact your system administrator or hosting provider." msgstr "" -#: lib/Admin.php:132 +#: lib/Admin.php:134 msgid "User Attributes To Return" msgstr "" -#: lib/Admin.php:141 +#: lib/Admin.php:143 msgid "CAS server base" msgstr "" -#: lib/Admin.php:197 +#: lib/Admin.php:199 msgid "Cassava CAS Server Settings" msgstr "" -#: lib/Admin.php:199 +#: lib/Admin.php:201 msgid "" "Configuration panel for the Central Authentication Service provided by this " "site." msgstr "" -#: lib/Admin.php:229 +#: lib/Admin.php:231 msgid "First Name" msgstr "" -#: lib/Admin.php:230 +#: lib/Admin.php:232 msgid "Last Name" msgstr "" -#: lib/Admin.php:231 +#: lib/Admin.php:233 msgid "Public Name" msgstr "" -#: lib/Admin.php:232 +#: lib/Admin.php:234 msgid "Email" msgstr "" -#: lib/Admin.php:233 +#: lib/Admin.php:235 msgid "Website" msgstr "" -#: lib/Admin.php:255 +#: lib/Admin.php:257 msgid "User Attributes" msgstr "" -#: lib/Admin.php:265 +#: lib/Admin.php:267 msgid "(e.g. %s)" msgstr "" -#: lib/Admin.php:270 +#: lib/Admin.php:272 msgid "" "Checked attributes are disclosed on successful validation requests (CAS 2.0 " "only)." @@ -86,43 +86,43 @@ msgstr "" msgid "Ticket does not match the service provided." msgstr "" -#: lib/CAS/Response/BaseResponse.php:84 +#: lib/CAS/Response/BaseResponse.php:87 msgid "Unknown error" msgstr "" -#: lib/CAS/Server.php:189 +#: lib/CAS/Server.php:190 msgid "The CAS server is disabled." msgstr "" -#: lib/CAS/Server.php:203 +#: lib/CAS/Server.php:204 msgid "The controller for the route is invalid." msgstr "" -#: lib/CAS/Server.php:234 +#: lib/CAS/Server.php:235 msgid "The server does not support the method requested." msgstr "" -#: lib/CAS/Ticket.php:146 -msgid "Ticket is malformed." +#: lib/CAS/Ticket.php:141 +msgid "Expired ticket." msgstr "" -#: lib/CAS/Ticket.php:154 -msgid "Ticket has expired." +#: lib/CAS/Ticket.php:147 +msgid "No user matches ticket." msgstr "" -#: lib/CAS/Ticket.php:160 -msgid "Ticket does not match a valid user." +#: lib/CAS/Ticket.php:153 +msgid "Corrupted ticket." msgstr "" -#: lib/CAS/Ticket.php:166 -msgid "Ticket is corrupted." +#: lib/CAS/Ticket.php:157 +msgid "Unknown or used ticket." msgstr "" -#: lib/CAS/Ticket.php:170 -msgid "Ticket is unknown or has already been used." +#: lib/CAS/Ticket.php:200 +msgid "Malformed ticket." msgstr "" -#: lib/CAS/Ticket.php:208 +#: lib/CAS/Ticket.php:254 msgid "Ticket type cannot be validated." msgstr "" diff --git a/lib/CAS/Ticket.php b/lib/CAS/Ticket.php index 2f32d90..caad07a 100644 --- a/lib/CAS/Ticket.php +++ b/lib/CAS/Ticket.php @@ -118,17 +118,13 @@ public function __construct( $type, $user, $service, $expires = 0.0 ) { * @return string Ticket as string. */ public function __toString() { - return $this->type . '-' . base64_encode( implode( '|', array( - $this->user->user_login, - urlencode( $this->service ), - $this->expires, - $this->generateSignature() ) ) ); + return $this->encodeTicket(); } /** * Create a new ticket instance from a ticket string. * - * @param string $ticket Ticket string. + * @param string $string Ticket string. * @return Ticket Ticket object. * * @throws \Cassava\Exception\TicketException @@ -137,39 +133,49 @@ public function __toString() { * @uses \get_user_by() * @uses \is_wp_error() */ - public static function fromString( $ticket ) { + public static function fromString( $string ) { - if ( strpos( $ticket, '-' ) === false ) { - $ticket = static::TYPE_ST . '-' . $ticket; - } + $components = static::decodeTicket( $string ); - list( $type, $content ) = explode( '-', $ticket, 2 ); - - list( $login, $service, $expires, $signature ) = static::extractComponents( $content ); - - if ( $expires < time() ) { - throw new TicketException( __( 'Ticket has expired.', 'wp-cas-server' ) ); + if ( $components['expires'] < time() ) { + throw new TicketException( __( 'Expired ticket.', 'wp-cas-server' ) ); } - $user = \get_user_by( 'login', $login ); + $user = \get_user_by( 'login', $components['login'] ); if ( ! $user || \is_wp_error( $user ) ) { - throw new TicketException( __( 'Ticket does not match a valid user.', 'wp-cas-server' ) ); + throw new TicketException( __( 'No user matches ticket.', 'wp-cas-server' ) ); } - $ticket = new static( $type, $user, $service, $expires ); + $ticket = new static( $components['type'], $user, $components['service'], $components['expires'] ); - if ( $ticket->generateSignature() !== $signature ) { - throw new TicketException( __( 'Ticket is corrupted.', 'wp-cas-server' ) ); + if ( $ticket->generateSignature() !== $components['signature'] ) { + throw new TicketException( __( 'Corrupted ticket.', 'wp-cas-server' ) ); } if ( $ticket->isUsed() ) { - throw new TicketException( __( 'Ticket is unknown or has already been used.', 'wp-cas-server' ) ); + throw new TicketException( __( 'Unknown or used ticket.', 'wp-cas-server' ) ); } return $ticket; } + /** + * Serialize ticket components into a string. + * + * @return string Ticket string. + */ + protected function encodeTicket() { + $components = array( + $this->user->user_login, // 1. User login + urlencode( $this->service ), // 2. Service URL + $this->expires, // 3. Expiration timestamp + $this->generateSignature(), // 4. Cryptographic signature + ); + + return $this->type . '-' . base64_encode( implode( '|', $components ) ); + } + /** * Extracts components from a base64 encoded ticket string. * @@ -180,19 +186,27 @@ public static function fromString( $ticket ) { * * @uses \__() */ - private static function extractComponents( $ticket ) { + protected static function decodeTicket( $ticket ) { + + if ( strpos( $ticket, '-' ) === false ) { + $ticket = static::TYPE_ST . '-' . $ticket; + } + + list( $type, $content ) = explode( '-', $ticket, 2 ); - $components = explode( '|', base64_decode( $ticket ) ); + $values = explode( '|', base64_decode( $content ) ); - if (count( $components ) < 4) { - throw new TicketException( __( 'Ticket is malformed.', 'wp-cas-server' ) ); + if (count( $values ) < 4) { + throw new TicketException( __( 'Malformed ticket.', 'wp-cas-server' ) ); } - list( $login, $service, $expires, $signature ) = $components; + $keys = array( 'login', 'service', 'expires', 'signature' ); + $components = array_combine( $keys, $values ); - $service = urldecode( $service ); + $components['type'] = $type; + $components['service'] = urldecode( $components['service'] ); - return array( $login, $service, $expires, $signature ); + return $components; } /**