From: Vincent Bernat Date: Sun, 2 Oct 2011 13:18:48 +0000 (+0200) Subject: Imported Upstream version 0.6+dfsg X-Git-Url: https://git.donarmstrong.com/?p=roundcube.git;a=commitdiff_plain;h=a2dd2e41259a5e90016efcd7d083020b95e25527;ds=sidebyside Imported Upstream version 0.6+dfsg --- diff --git a/.htaccess b/.htaccess index 704779e..2bc9f95 100644 --- a/.htaccess +++ b/.htaccess @@ -29,6 +29,9 @@ php_value mbstring.func_overload 0 RewriteEngine On RewriteRule ^favicon.ico$ skins/default/images/favicon.ico +# security rules +RewriteRule .svn/ - [F] +RewriteRule ^README|INSTALL|LICENSE|SQL|bin|CHANGELOG$ - [F] @@ -46,5 +49,4 @@ ExpiresDefault "access plus 1 month" FileETag MTime Size - - +Options -Indexes diff --git a/CHANGELOG b/CHANGELOG index c56a199..f4daec4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,193 +1,96 @@ CHANGELOG Roundcube Webmail =========================== -- Fix XSS vulnerability in UI messages (#1488030) -- Fix identities "reply-to" and "bcc" fields have a bogus value when left empty (#1487943) -- Fix issue which cases IMAP disconnection when encrypt() method was used (#1487900) -- Fix some CSS issues in Settings for Internet Explorer -- Fixed handling of folder with name "0" in folder selector -- Fix bug where messages were deleted instead moved to trash folder after Shift key was used (#1487902) -- Fix relative URLs handling according to a in HTML (#1487889) -- Fix handling of top-level domains with more than 5 chars or unicode chars (#1487883) -- Fix usage of non-standard HTTP error codes (#1487797) -- Fix PHP warning on mistaken in_array() usage (#1487901) +- Fix bug where the last identity is used on reply (#1488101) +- Fix locked folder rename option on servers supporting RFC2086 only (#1488089) +- Fix encoding of LDAP contacts identifiers (#1488079) +- Fix session race conditions when composing new messages +- jQuery 1.6.4 +- Fix handling of binary attachments encoded with quoted-printable (#1488065) +- Fix text-overflow:ellipsis issues on messages list in FF7 and Webkit (#1488061) +- Fix handling of links with IP address +- Fix bug where message list filter was reset on folder compacting (#1488076) -RELEASE 0.5.2 -------------- -- TinyMCE 3.4.2 now compatible with IE9 -- PEAR::Net_SMTP 1.5.2, fixed timeout issue (#1487843) -- Fix bug where template name without plugin prefix was used in render_page hook -- Support 'abort' and 'result' response in 'preferences_save' hook, add error handling -- Fix bug where some content would cause hang on html2text conversion (#1487863) -- Improve space-stuffing handling in format=flowed messages (#1487861) -- Fix bug where some dates would produce SQL error in MySQL (#1487856) -- Added workaround for some IMAP server with broken STATUS response (#1487859) -- Fix bug where default_charset was not used for text messages (#1487836) -- Stateless request tokens. No keep-alive necessary on login page (#1487829) -- Force names of unique constraints in PostgreSQL DDL -- Add code for prevention from IMAP connection hangs when server closes socket unexpectedly -- Remove redundant DELETE query (for old session deletion) on login -- Get around unreliable rand() and mt_rand() in session ID generation (#1486281) -- Fix some emails are not shown using Cyrus IMAP (#1487820) -- Fix handling of mime-encoded words with non-integral number of octets in a word (#1487801) -- Fix parsing links with non-printable characters inside (#1487805) -- Fixed de_CH/de_DE localization bugs (#1487773) -- Add variable for 'Today' label in date_today option (#1486120) -- Applied plugin changes since 0.5-stable release -- Fix SQL query in rcube_user::query() so it uses index on MySQL again -- Use only one from IMAP authentication methods to prevent login delays (1487784) -- Fix strftime format support in date_today option -- Removed redundant tags from contact add/edit pages -- Fix CSS error in contact details screen on IE7 (#1487775) - -RELEASE 0.5.1 -------------- -- Fix handling of attachments with invalid content type (#1487767) -- Add workaround for DBMail's bug http://www.dbmail.org/mantis/view.php?id=881 (#1487766) -- Use IMAP's ID extension (RFC2971) to print more info into debug log -- Security: add optional referer check to prevent CSRF in GET requests -- Fix email_dns_check setting not used for identities/contacts (#1487740) -- Fix ICANN example addresses doesn't validate (#1487742) -- Security: protect login form submission from CSRF -- Security: prevent from relaying malicious requests through modcss.inc -- Fix handling of non-image attachments in multipart/related messages (#1487750) -- Fix IDNA support when IDN/INTL modules are in use (#1487742) -- Fix handling of invalid HTML comments in messages (#1487759) -- Fix parsing FETCH response for very long headers (#1487753) -- Fix add/remove columns in message list when message_sort_order isn't set (#1487751) -- Fix settings UI on IE 6 (#1487724) -- Remove double borders in folder listing (#1487713) -- Separate full message headers UI element from headers table (#1487715) -- Add part MIME ID to message_part_* hooks (#1487718) -- Updated PEAR::Net_Socket to 1.0.10 -- Updated PEAR::Net_IDNA2 to 0.1.1 -- Fix handling of comments inside an email address spec. (#1487673) -- Show full mail subject as title when hovering a cut subject link (#1487128) -- Fix randomly disappearing folders list in IE (#1487704) -- Fix list column add/removal in IE (#1487703) -- Fix login redirect issues (#1487686) -- Require PHP 5.2.1 or greater -- Fix %h/%z variables in username_domain option (#1487701) -- Workaround for setting charset in case of malformed bodystructure response (#1487700) -- Fix impossible to subscribe to protected folders (#1487656) -- Fix setting timezone in Preferences (#1487705) - -RELEASE 0.5 ------------ -- Fix double-login/session issue (#1487104) -- Wrap HTML parts with and add Doctype declaration (#1487098) -- Make rcube_autoload silently skip unknown classes (#1487109) -- Fix charset detection in vcards with encoded values (#1485542) -- Better CSS cursors for splitters (#1486874) -- Show the same message only once (#1487641) -- Fix namespaces handling (#1487649) -- Add handling of multifolder METADATA/ANNOTATION responses -- Fix handling of INBOX when personal namespace prefix is non-empty (#1487657) -- Fix handling square brackets in links (#1487672) -- Add description of 'use_https' option in main.inc.php.dist file - -RELEASE 0.5-RC +RELEASE 0.6-RC -------------- -- Plugin API: Add 'pass' argument in 'authenticate' hook (#1487134) -- Fix attachments of type message/rfc822 are not listed on attachments list -- Add 'login_lc' config option for case-insensitive authentication (#1487113) -- Fix window is blur'ed in IE when selecting a message (#1487316) -- Fix cursor position on compose form in Webkit browsers (#1486674) -- Fix setting charset of attachment filenames (#1487122) -- Allow setting autocomplete attribute for all inputs separately (#1487313) -- New Folder Manager UI -- Fix invalid Request when creating a folder (#1487443) -- Add folder size and quota indicator in folder manager (#1485780) -- Add possibility to move a subfolder into root folder (#1486791) -- Fix copying all messages in a folder copies only messages from current page -- Improve performance of moving or copying of all messages in a folder -- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206) -- Improve performance of folder rename and delete actions -- Better support for READ-ONLY and NOPERM responses handling (#1487083) -- Add confirmation message on purge/expunge command response -- Fix handling of untagged responses for AUTHENTICATE command (#1487450) -- Add username and IP address to log message on unsuccessful login (#1487626) -- Improved Mail-Followup-To and Mail-Reply-To headers handling -- Fix charset conversion for text attachments without charset specification (#1487634) +- jQuery 1.6.3 +- Fallback to mail_domain in LDAP variable replacements; added 'host' to 'user_create' hook arguments (#1488024) +- Fixed wrong vCard type parameter mobile (#1488067) +- Fixed vCard WORKFAX issue (#1488046) +- Add vCard's Profile URL support (#1488062) +- Fix imap_cache setting to values other than 'db' (#1488060) +- Fix handling of attachments inside message/rfc822 parts (#1488026) +- Make list of mimetypes that open in preview window configurable (#1487625) +- Added plugin hook 'message_part_get' for attachment downloads +- Fixed selecting identity on reply/forward (#1487981) +- Fix image type check for contact photo uploads -RELEASE 0.5-BETA +RELEASE 0.6-beta ---------------- -- Make session data storage more robust against garbage session data (#1487136) -- Config option for autocomplete on login screen -- Allow plugin templates to include local files (#1487133) -- List groups in address detail view and allow to subscribe/unsubscribe from there (#1486753) -- Messages caching: performance improvements, fixed syncing, fixes related with #1486748 -- Add link to identities in compose window (#1486729) -- Add Internationalized Domain Name (IDNA) support (#1483894) -- Add option to automatically send read notifications for known senders (#1485883) -- Add option to "Return receipt" will be always checked (#1486352) -- Fix HTML to plain text conversion doesn't handle citation blocks (#1486921) -- Use custom sorting when SORT is disabled by IMAP admin (#1486959) -- Allow setting some washtml options from plugin (#1486578) -- Add option do bind for an individual LDAP address book (#1486997) -- Change reply prefix to display email address only if sender name doesn't exist (#1486550) -- Plugin API: improved 'abort' flag handling, added 'result' item in some hooks (#1486914) -- Fix mailto optional params in plain text messages aren't handled (#1487026) -- Add Reply-to-List feature (#1484252) -- Add Mail-Followup-To/Mail-Reply-To support (#1485547) -- Fix confirmation message isn't displayed after sending mail on Chrome (#1486177) -- Fix keyboard doesn't work with autocomplete list with Chrome (#1487029) -- Improve tabs to fixed width and add tabs in identities info (#1486974) -- Add unique index on users.username+users.mail_host -- Make htmleditor option more consistent and add option to use HTML on reply to HTML message (#1485840) -- Use empty envelope sender address for message disposition notifications (RFC 2298.3) -- Support SMTP Delivery Status Notifications - RFC 3461 (#1486142) -- Use css sprite image for messages list -- Add (different) attachment icon for messages of type multipart/report (#1486165) -- Prevent from inserting empty link when composing HTML message (#1486944) -- Add caching support in id2uid and uid2id functions (#1487019) -- Add SASL proxy authentication for SMTP (#1486693) -- Improve displaying of UI messages (#1486977) -- Fix double e-mail filed in identity form (#1487054) -- Display IMAP errors for LIST/THREAD/SEARCH commands (#1486905) -- Add LITERAL+ (IMAP4 non-synchronizing literals) support (RFC 2088) -- Add separate column for message status icon (#1486665) -- Add ACL extension support into IMAP classes (RFC 4314) -- Add ANNOTATEMORE extension support into IMAP classes (draft-daboo-imap-annotatemore) -- Add METADATA extension support into IMAP classes (RFC 5464) -- Fix decoding of e-mail address strings in message headers (#1487068) -- Fix handling of attachments when Content-Disposition is not inline nor attachment (#1487051) -- Improve performance of unseen messages counting (#1487058) -- Improve performance of messages counting using ESEARCH extension (RFC4731) -- Add LIST-STATUS support in rcube_imap_generic class (RFC 5819) -- Add SASL-IR support in IMAP (RFC 4959) -- Add LOGINDISABLED support (RFC 2595) -- Add support for AUTH=PLAIN in IMAP authentication -- Re-implemented SMTP proxy authentication support -- Add support for IMAP proxy authentication (#1486690) -- Add support for AUTH=DIGEST-MD5 in IMAP (RFC 2831) -- Fix parent folder with unread subfolder not bold when message is open (#1487078) -- Add basic IMAP LIST's \Noselect option support -- Add support for selection options from LIST-EXTENDED extension (RFC 5258) -- Don't list subscribed but non-existent folders (#1486225) -- Fix handling of URLs with tilde (~) or semicolon (;) character (#1487087, #1487088) -- Plugin API: added 'contact_form' hook -- Add SORT=DISPLAY support (RFC 5957) -- Plugin API: add possibility to disable plugin in AJAX mode, 'noajax' property -- Plugin API: add possibility to disable plugin in framed mode, 'noframe' property -- Improve performance of setting IMAP flags using .SILENT suffix -- Improve performance of message cache status checking with skip_disabled=true -- Support contact's email addresses up to 255 characters long (#1487095) -- Add option to place replies in the folder of the message being replied to (#1485945) -- Add missing confirmation/error messages on contact/group/message actions (#1486845) -- Add 'loading' message on message move/copy/delete/mark actions -- Improve responsiveness of messages displaying (#1486986) -- Add option for minimum length of autocomplete's string (#1486428) -- Fix operations on messages in unsubscribed folder (#1487107) -- Add support for shared folders (#1403507) -- Fix handling of folders with name "0" (#1487119) -- Fix handling of folders with "<>" characters in name -- jQuery 1.4.4 -- Fix handling of HTML entity strings in plain text messages -- Fix focused elements aren't unfocused when clicking on the list (#1487123) -- Fix error in MSSQL DDL scripts (#1487112) -- Lock submit button in onsubmit event on login page (#1487036) -- Don't set attachment's charset in Content-type header (#1487122) -- Fix handling of message bodies (quoted-printable encoded) with NULL characters (#1486189) -- Add workaround for MSOE's multipart/related messages with non-related attachments - +- Added unique connection identifier to IMAP debug messages +- Add option to hide selected LDAP addressbook on the list +- Add client-side checking of uploaded files size +- Add newlines between organization, department, jobtitle (#1488028) +- Recalculate date when replying to a message and localize the cite header (#1487675) +- Fix handling of email addresses with quoted local part (#1487939) +- Fix EOL character in vCard exports (#1487873) +- Added optional "multithreading" autocomplete feature +- Plugin API: Added 'config_get' hook +- Fixed new_user_identity plugin to work with updated rcube_ldap class (#1487994) +- Plugin API: added folder_delete and folder_rename hooks +- Added possibility to undo last contact delete operation +- Fix sorting of contact groups after group create (#1487747) +- Add optional textual upload progress indicator (#1486039) +- Fix parsing URLs containing commas (#1487970) +- Added vertical splitter for books/groups list in addressbook (#1487923) +- Improved namespace roots handling in folder manager +- Added searching in all addressbook sources +- Added addressbook source selection in contacts import +- Implement LDAPv3 Virtual List View (VLV) for paged results listing +- Use 'address_template' config option when adding a new address block (#1487944) +- Added addressbook advanced search +- Add popup with basic fields selection for addressbook search +- Case-insensitive matching in autocompletion (#1487933) +- Added option to force spellchecking before sending a message (#1485458) +- Fix handling of "<" character in contact data, search fields and folder names (#1487864) +- Fix saving "<" character in identity name and organization fields (#1487864) +- Added option to specify to which address book add new contacts +- Added plugin hook for keep-alive requests +- Store user preferences in session when write-master is not available and session is stored in memcache, write them later +- Improve performence of folder manager operations +- Fix default_port option handling in Installer when config.inc.php file exists (#1487925) +- Removed option focus_on_new_message, added newmail_notifier plugin +- Added general rcube_cache class with Memcache and APC support +- Improved caching performance by skipping writes of unchanged data +- Option enable_caching replaced by imap_cache and messages_cache options +- Fix WORKFAX saving in address book (#1487910) +- Add forward-as-attachment feature +- jQuery-1.6.2 (#1487913, #1487144) +- Improve display name composition when saving contacts (#1487143) +- Fix problems with subfolders of INBOX folder on some IMAP servers (#1487725) +- Fix handling of folders that doesn't belong to any namespace (#1487637) +- Enable multiselection for attachments uploading in capable browsers (#1485969) +- Add possibility to change HTML editor configuration by skin +- Fix a bug where selecting too many contacts would produce too large URI request (#1487892) +- Improve performance by including files with absolute path (#1487849) +- Move folder name truncation to client/skin (#1485412) +- Added plugin hook for request token creation +- Replace LDAP vars in group queries (#1487837) +- Fix vcard folding with uncode characters (#1487868) +- Keep all submitted data if contact form validation fails (#1487865) +- Handle uncode strings in rcube_addressbook::normalize_string() (#1487866) +- Fix handling of debug_level=4 in ajax requests (#1487831) +- Enable TinyMCE's contextmenu (#1487014) +- Allow multiple concurrent compose sessions +- New config option for custom logo +- Allow skins to define/override texts with +- Add simple ACL rights/namespace handling in folder manager +- Force IE to send referers (#1487806) +- Better display of vcard import results (#1485457) +- Improved vcard import +- Interactive update script with improved DB schema check +- Fix problem with contactgroupmembers table creation on MySQL 4.x, add index on contact_id column +- Add LDAP SASL bind and proxy authentication (#1486692) +- Replying to a sent message puts the old recipient as the new recipient (#1487074) +- Fulltext search over (almost) all data for contacts +- Extend address book with rich contact information diff --git a/INSTALL b/INSTALL index ed51b13..9b07b2b 100644 --- a/INSTALL +++ b/INSTALL @@ -22,6 +22,7 @@ REQUIREMENTS - MDB2 2.5.0 or newer - Mail_Mime 1.8.1 or newer - Net_SMTP 1.4.2 or newer + - Net_IDNA2 0.1.1 or newer - Auth_SASL 1.0.3 or newer * php.ini options (see .htaccess file): - error_reporting E_ALL & ~E_NOTICE (or lower) @@ -31,6 +32,7 @@ REQUIREMENTS - zend.ze1_compatibility_mode disabled - suhosin.session.encrypt disabled - mbstring.func_overload disabled + - magic_quotes_runtime disabled * PHP compiled with OpenSSL to connect to IMAPS and to use the spell checker * A MySQL (4.0.8 or newer), PostgreSQL, MSSQL database engine or the SQLite extension for PHP diff --git a/INSTALL.orig b/INSTALL.orig deleted file mode 100644 index 49aae92..0000000 --- a/INSTALL.orig +++ /dev/null @@ -1,231 +0,0 @@ -INTRODUCTION -============ - -This file describes the basic steps to install Roundcube Webmail on your -web server. For additional information, please also consult the project's -wiki page at http://trac.roundcube.net/wiki - - -REQUIREMENTS -============ - -* The Apache or Lighttpd Webserver -* .htaccess support allowing overrides for DirectoryIndex -* PHP Version 5.2.1 or greater including - - PCRE, DOM, JSON, XML, Session, Sockets (required) - - libiconv (recommended) - - mbstring, fileinfo, mcrypt (optional) -* PEAR packages distributed with Roundcube or external: - - MDB2 2.5.0 or newer - - Mail_Mime 1.8.1 or newer - - Net_SMTP 1.4.2 or newer - - Auth_SASL 1.0.3 or newer -* php.ini options (see .htaccess file): - - error_reporting E_ALL & ~E_NOTICE (or lower) - - memory_limit > 16MB (increase as suitable to support large attachments) - - file_uploads enabled (for attachment upload features) - - session.auto_start disabled - - zend.ze1_compatibility_mode disabled - - suhosin.session.encrypt disabled - - mbstring.func_overload disabled -* PHP compiled with OpenSSL to connect to IMAPS and to use the spell checker -* A MySQL (4.0.8 or newer), PostgreSQL, MSSQL database engine - or the SQLite extension for PHP -* One of the above databases with permission to create tables -* An SMTP server (recommended) or PHP configured for mail delivery - - -INSTALLATION -============ - -1. Decompress and put this folder somewhere inside your document root -2. Make sure that the following directories (and the files within) - are writable by the webserver - - /temp - - /logs -3. Create a new database and a database user for Roundcube (see DATABASE SETUP) -4. Point your browser to http://url-to-roundcube/installer/ -5. Follow the instructions of the install script (or see MANUAL CONFIGURATION) -6. After creating and testing the configuration, remove the installer directory -7. Done! - - -CONFIGURATION HINTS -=================== - -Roundcube writes internal errors to the 'errors' log file located in the logs -directory which can be configured in config/main.inc.php. If you want ordinary -PHP errors to be logged there as well, enable the 'php_value error_log' line -in the .htaccess file and set the path to the log file accordingly. - -By default the session_path settings of PHP are not modified by Roundcube. -However if you want to limit the session cookies to the directory where -Roundcube resides you can uncomment and configure the according line -in the .htaccess file. - - -DATABASE SETUP -============== - -Note: Database for Roundcube must use UTF-8 character set. - -* MySQL -------- -Setting up the mysql database can be done by creating an empty database, -importing the table layout and granting the proper permissions to the -roundcube user. Here is an example of that procedure: - -# mysql -> CREATE DATABASE roundcubemail /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; -> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost - IDENTIFIED BY 'password'; -> quit - -# mysql roundcubemail < SQL/mysql.initial.sql - -Note 1: 'password' is the master password for the roundcube user. It is strongly -recommended you replace this with a more secure password. Please keep in -mind: You need to specify this password later in 'config/db.inc.php'. - - -* SQLite --------- -You need sqlite 2 (preferably 2.8) to setup the sqlite db -(sqlite 3.x also doesn't work at the moment). Here is -an example how you can setup the sqlite.db for roundcube: - -# sqlite -init SQL/sqlite.initial.sql sqlite.db -Loading resources from SQL/sqlite.initial.sql -SQLite version 2.8.16 -Enter ".help" for instructions -sqlite> .exit -# chmod o+rw sqlite.db - -Make sure your configuration points to the sqlite.db file and that the -webserver can write to the file and the directory containing the file. - - -* PostgreSQL ------------- -To use Roundcube with PostgreSQL support you have to follow these -simple steps, which have to be done as the postgres system user (or -which ever is the database superuser): - -$ createuser roundcube -$ createdb -O roundcube -E UNICODE roundcubemail -$ psql roundcubemail - -roundcubemail =# ALTER USER roundcube WITH PASSWORD 'the_new_password'; -roundcubemail =# \c - roundcube -roundcubemail => \i SQL/postgres.initial.sql - -All this has been tested with PostgreSQL 8.x and 7.4.x. Older -versions don't have a -O option for the createdb, so if you are -using that version you'll have to change ownership of the DB later. - - -Database cleaning ------------------ -Do keep your database slick and clean we recommend to periodically execute -bin/cleandb.sh which finally removes all records that are marked as deleted. -Best solution is to install a cronjob running this script daily. - - - -MANUAL CONFIGURATION -==================== - -First of all, rename the files config/*.inc.php.dist to config/*.inc.php. -You can then change these files according to your environment and your needs. -Details about the config parameters can be found in the config files. -See http://trac.roundcube.net/wiki/Howto_Install for even more guidance. - -You can also modify the default .htaccess file. This is necessary to -increase the allowed size of file attachments, for example: - php_value upload_max_filesize 2M - - -UPGRADING -========= - -If you already have a previous version of Roundcube installed, -please refer to the instructions in UPGRADING guide. - - -OPTIMISING -========== - -There are two forms of optimisation here, compression and caching, both aimed -at increasing an end user's experience using Roundcube Webmail. Compression -allows the static web pages to be delivered with less bandwidth. The index.php -of Roundcube Webmail already enables compression on its output. The settings -below allow compression to occur for all static files. Caching sets HTTP -response headers that enable a user's web client to understand what is static -and how to cache it. - -The caching directives used are: - * Etags - sets at tag so the client can request is the page has changed - * Cache-control - defines the age of the page and that the page is 'public' - This enables clients to cache javascript files that don't have private - information between sessions even if using HTTPS. It also allows proxies - to share the same cached page between users. - * Expires - provides another hint to increase the lifetime of static pages. - -For more information refer to RFC 2616. - -Side effects: -------------- -These directives are designed for production use. If you are using this in -a development environment you may get horribly confused if your webclient -is caching stuff that you changed on the server. Disabling the expires -parts below should save you some grief. - -If you are changing the skins, it is recommended that you copy content to -a different directory apart from 'default'. - -Apache: -------- -To enable these features in apache the following modules need to be enabled: - * mod_deflate - * mod_expires - * mod_headers - -The optimisation is already included in the .htaccess file in the top -directory of your installation. - -If you are using Apache version 2.2.9 and later, in the .htaccess file -change the 'append' word to 'merge' for a more correct response. Keeping -as 'append' shouldn't cause any problems though changing to merge will -eliminate the possibility of duplicate 'public' headers in Cache-control. - -Lighttpd: ---------- -With Lightty the addition of Expire: tags by mod_expire is incompatible with -the addition of "Cache-control: public". Using Cache-control 'public' is -used below as it is assumed to give a better caching result. - -Enable modules in server.modules: - "mod_setenv" - "mod_compress" - -Mod_compress is a server side cache of compressed files to improve its performance. - -$HTTP["host"] == "www.example.com" { - - static-file.etags = "enable" - # http://redmine.lighttpd.net/projects/lighttpd/wiki/Etag.use-mtimeDetails - etag.use-mtime = "enable" - - # http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSetEnv - $HTTP["url"] =~ "^/roundcubemail/(plugins|skins|program)" { - setenv.add-response-header = ( "Cache-Control" => "public, max-age=2592000") - } - - # http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModCompress - # set compress.cache-dir to somewhere outside the docroot. - compress.cache-dir = var.statedir + "/cache/compress" - - compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml", "image/gif", "image/png") -} - - diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql index 823d1b3..4aa6fc9 100644 --- a/SQL/mssql.initial.sql +++ b/SQL/mssql.initial.sql @@ -16,7 +16,8 @@ CREATE TABLE [dbo].[contacts] ( [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL , [firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , [surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , - [vcard] [text] COLLATE Latin1_General_CI_AI NULL + [vcard] [text] COLLATE Latin1_General_CI_AI NULL , + [words] [text] COLLATE Latin1_General_CI_AI NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -194,6 +195,8 @@ ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created] GO +CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY] +GO ALTER TABLE [dbo].[identities] ADD CONSTRAINT [DF_identities_user] DEFAULT ('0') FOR [user_id], diff --git a/SQL/mssql.upgrade.sql b/SQL/mssql.upgrade.sql index 4072c25..606db60 100644 --- a/SQL/mssql.upgrade.sql +++ b/SQL/mssql.upgrade.sql @@ -96,4 +96,17 @@ CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) GO ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL GO - + +-- Updates from version 0.5.1 +-- Updates from version 0.5.2 +-- Updates from version 0.5.3 +-- Updates from version 0.5.4 + +ALTER TABLE [dbo].[contacts] ADD [words] [text] COLLATE Latin1_General_CI_AI NULL +GO +CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY] +GO +DELETE FROM [dbo].[messages] +GO +DELETE FROM [dbo].[cache] +GO diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index 6e2c247..14bbb96 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -86,7 +86,8 @@ CREATE TABLE `contacts` ( `email` varchar(255) NOT NULL, `firstname` varchar(128) NOT NULL DEFAULT '', `surname` varchar(128) NOT NULL DEFAULT '', - `vcard` text NULL, + `vcard` longtext NULL, + `words` text NULL, `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY(`contact_id`), CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) @@ -116,7 +117,8 @@ CREATE TABLE `contactgroupmembers` ( CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`) REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`) - REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE + REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE, + INDEX `contactgroupmembers_contact_index` (`contact_id`) ) /*!40000 ENGINE=INNODB */; diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index aaab43f..ed21bda 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -133,3 +133,14 @@ ALTER TABLE `contacts` MODIFY `email` varchar(255) NOT NULL; TRUNCATE TABLE `messages`; +-- Updates from version 0.5.1 +-- Updates from version 0.5.2 +-- Updates from version 0.5.3 +-- Updates from version 0.5.4 + +ALTER TABLE `contacts` ADD `words` TEXT NULL AFTER `vcard`; +ALTER TABLE `contacts` CHANGE `vcard` `vcard` LONGTEXT /*!40101 CHARACTER SET utf8 */ NULL DEFAULT NULL; +ALTER TABLE `contactgroupmembers` ADD INDEX `contactgroupmembers_contact_index` (`contact_id`); + +TRUNCATE TABLE `messages`; +TRUNCATE TABLE `cache`; diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql index d6f4db7..5350e79 100644 --- a/SQL/postgres.initial.sql +++ b/SQL/postgres.initial.sql @@ -103,14 +103,15 @@ CREATE SEQUENCE contact_ids CREATE TABLE contacts ( contact_id integer DEFAULT nextval('contact_ids'::text) PRIMARY KEY, user_id integer NOT NULL - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, + REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, changed timestamp with time zone DEFAULT now() NOT NULL, del smallint DEFAULT 0 NOT NULL, name varchar(128) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, firstname varchar(128) DEFAULT '' NOT NULL, surname varchar(128) DEFAULT '' NOT NULL, - vcard text + vcard text, + words text ); CREATE INDEX contacts_user_id_idx ON contacts (user_id, email); @@ -156,6 +157,8 @@ CREATE TABLE contactgroupmembers ( PRIMARY KEY (contactgroup_id, contact_id) ); +CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id); + -- -- Sequence "cache_ids" -- Name: cache_ids; Type: SEQUENCE; Schema: public; Owner: postgres diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql index 0ae8d3f..94513c5 100644 --- a/SQL/postgres.update.sql +++ b/SQL/postgres.update.sql @@ -89,3 +89,14 @@ ALTER TABLE users ADD CONSTRAINT users_username_key UNIQUE (username, mail_host) ALTER TABLE contacts ALTER email TYPE varchar(255); TRUNCATE messages; + +-- Updates from version 0.5.1 +-- Updates from version 0.5.2 +-- Updates from version 0.5.3 +-- Updates from version 0.5.4 + +ALTER TABLE contacts ADD words TEXT NULL; +CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id); + +TRUNCATE messages; +TRUNCATE cache; diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql index 875b3cb..d2885e9 100644 --- a/SQL/sqlite.initial.sql +++ b/SQL/sqlite.initial.sql @@ -31,7 +31,8 @@ CREATE TABLE contacts ( email varchar(255) NOT NULL default '', firstname varchar(128) NOT NULL default '', surname varchar(128) NOT NULL default '', - vcard text NOT NULL default '' + vcard text NOT NULL default '', + words text NOT NULL default '' ); CREATE INDEX ix_contacts_user_id ON contacts(user_id, email); @@ -55,6 +56,8 @@ CREATE TABLE contactgroupmembers ( PRIMARY KEY (contactgroup_id, contact_id) ); +CREATE INDEX ix_contactgroupmembers_contact_id ON contactgroupmembers (contact_id); + -- -------------------------------------------------------- diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql index 6f2acf9..30c3ae9 100644 --- a/SQL/sqlite.update.sql +++ b/SQL/sqlite.update.sql @@ -182,3 +182,47 @@ DROP TABLE contacts_tmp; DELETE FROM messages; + +-- Updates from version 0.5.1 +-- Updates from version 0.5.2 +-- Updates from version 0.5.3 +-- Updates from version 0.5.4 + +CREATE TABLE contacts_tmp ( + contact_id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL default '0', + changed datetime NOT NULL default '0000-00-00 00:00:00', + del tinyint NOT NULL default '0', + name varchar(128) NOT NULL default '', + email varchar(255) NOT NULL default '', + firstname varchar(128) NOT NULL default '', + surname varchar(128) NOT NULL default '', + vcard text NOT NULL default '' +); + +INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard) + SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts; + +DROP TABLE contacts; +CREATE TABLE contacts ( + contact_id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL default '0', + changed datetime NOT NULL default '0000-00-00 00:00:00', + del tinyint NOT NULL default '0', + name varchar(128) NOT NULL default '', + email varchar(255) NOT NULL default '', + firstname varchar(128) NOT NULL default '', + surname varchar(128) NOT NULL default '', + vcard text NOT NULL default '', + words text NOT NULL default '' +); + +INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard) + SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts_tmp; + +CREATE INDEX ix_contacts_user_id ON contacts(user_id, email); +DROP TABLE contacts_tmp; + +DELETE FROM messages; +DELETE FROM cache; +CREATE INDEX ix_contactgroupmembers_contact_id ON contactgroupmembers (contact_id); diff --git a/UPGRADING b/UPGRADING index 329983d..ce951d1 100644 --- a/UPGRADING +++ b/UPGRADING @@ -3,7 +3,30 @@ UPGRADING instructions Follow these instructions if upgrading from a previous version of Roundcube Webmail. We recommend to carefully backup the existing -installation as well as the database before executig the following steps. +installation as well as the database before going through the following steps. + +Using the update script +----------------------- +There is a shell script (for unix based systems) that does the job for you. +To use it, unpack the archive of the new Roundcube version to a temporary location +(don't replace the Roundcube installation you want to update) +and cd into that directory. From there, run the following command in a shell: + + ./bin/installto.sh + +For you specify the path to the Roundcube installation +which should be updated. The update script will then copy all new files to the +target location and check and update the configuration and database schema. +After all is done, the temporary folder with the new Roundcube files can be +removed again. + +Please also see Post-Upgrade Activities section. + + +Updating manually +----------------- +If you don't have shell access to the Roundcube installation or if not running +it on a unix system, you need to do the following operations by hand: 1. Replace index.php and all files in - ./bin/ @@ -14,14 +37,18 @@ installation as well as the database before executig the following steps. - ./plugins/ 2. Run ./bin/update.sh from the commandline OR open http://url-to-roundcube/installer/ in a browser and choose "3 Test config". - To enable the latter one, you have to temporary set 'enable_installer' to true - in your local config/main.inc.php file. + To enable the latter one, you have to temporary set 'enable_installer' + to true in your local config/main.inc.php file. 3. Let the update script/installer check your configuration and - update your config files as suggested by the updater. -4. If suggested by the update script, run all commands in - ./SQL/[yourdbtype].update.sql that are superscribed with the - currently installed version number. -5. Make sure 'enable_installer' is set to false again. -6. Check .htaccess settings (some php settings could become required) + update your config files and database schema as suggested by the updater. +4. Make sure 'enable_installer' is set to false again. +5. See Post-Upgrade Activities section. +Post-Upgrade Activities +----------------------- +1. Check .htaccess settings (some php settings could become required) +2. If you're using build-in addressbook, run indexing script /bin/indexcontacts.sh. +3. When upgrading from version older than 0.6-beta you should make sure + your folder settings contain namespace prefix. For example Courier users + should add INBOX. prefix to folder names in main configuration file. diff --git a/bin/cleandb.sh b/bin/cleandb.sh index 4d699cc..a1b38d0 100755 --- a/bin/cleandb.sh +++ b/bin/cleandb.sh @@ -6,7 +6,7 @@ | bin/cleandb.sh | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2010, Roundcube Dev. - Switzerland | + | Copyright (C) 2010, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -16,16 +16,13 @@ | Author: Thomas Bruederli | +-----------------------------------------------------------------------+ - $Id: cleandb.sh 4164 2010-10-31 10:38:16Z thomasb $ + $Id: cleandb.sh 4677 2011-04-20 13:10:45Z alec $ */ -if (php_sapi_name() != 'cli') { - die('Not on the "shell" (php-cli).'); -} - define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); -require INSTALL_PATH.'program/include/iniset.php'; + +require INSTALL_PATH.'program/include/clisetup.php'; // mapping for table name => primary key $primary_keys = array( diff --git a/bin/decrypt.sh b/bin/decrypt.sh index 8d6ff5e..75269ef 100755 --- a/bin/decrypt.sh +++ b/bin/decrypt.sh @@ -6,7 +6,7 @@ | bin/decrypt.sh | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2009, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -16,7 +16,7 @@ | Author: Tomas Tevesz | +-----------------------------------------------------------------------+ - $Id: decrypt.sh 3989 2010-09-25 13:03:53Z alec $ + $Id: decrypt.sh 4677 2011-04-20 13:10:45Z alec $ */ /*- @@ -52,12 +52,9 @@ * - you are dealing with counterfeit header data. */ -if (php_sapi_name() != 'cli') { - die("Not on the 'shell' (php-cli).\n"); -} - define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/'); -require INSTALL_PATH . 'program/include/iniset.php'; + +require INSTALL_PATH . 'program/include/clisetup.php'; if ($argc < 2) { die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n"); diff --git a/bin/indexcontacts.sh b/bin/indexcontacts.sh new file mode 100755 index 0000000..d552be6 --- /dev/null +++ b/bin/indexcontacts.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env php + | + +-----------------------------------------------------------------------+ + + $Id: indexcontacts.sh 4623 2011-03-28 06:49:02Z alec $ + +*/ + +define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); + +require_once INSTALL_PATH.'program/include/clisetup.php'; + + +// connect to DB +$RCMAIL = rcmail::get_instance(); + +$db = $RCMAIL->get_dbh(); +$db->db_connect('w'); + +if (!$db->is_connected() || $db->is_error()) + die("No DB connection\n"); + +// iterate over all users +$sql_result = $db->query("SELECT user_id FROM " . $RCMAIL->config->get('db_table_users', 'users')." WHERE 1=1"); +while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) { + echo "Indexing contacts for user " . $sql_arr['user_id'] . "..."; + + $contacts = new rcube_contacts($db, $sql_arr['user_id']); + $contacts->set_pagesize(9999); + + $result = $contacts->list_records(); + while ($result->count && ($row = $result->next())) { + unset($row['words']); + $contacts->update($row['ID'], $row); + } + + echo "done.\n"; +} + +?> diff --git a/bin/installto.sh b/bin/installto.sh new file mode 100755 index 0000000..33652dc --- /dev/null +++ b/bin/installto.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env php + | + +-----------------------------------------------------------------------+ + + $Id: installto.sh 4677 2011-04-20 13:10:45Z alec $ + +*/ + +define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); + +require_once INSTALL_PATH . 'program/include/clisetup.php'; + +$target_dir = unslashify($_SERVER['argv'][1]); + +if (empty($target_dir) || !is_dir(realpath($target_dir))) + die("Invalid target: not a directory\nUsage: installto.sh \n"); + +// read version from iniset.php +$iniset = @file_get_contents($target_dir . '/program/include/iniset.php'); +if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m)) + die("No valid Roundcube installation found at $target_dir\n"); + +$oldversion = $m[1]; + +if (version_compare($oldversion, RCMAIL_VERSION, '>=')) + die("Installation at target location is up-to-date!\n"); + +echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n"; +$input = trim(fgets(STDIN)); + +if (strtolower($input) == 'y') { + $err = false; + echo "Copying files to target location..."; + foreach (array('program','installer','bin','SQL','plugins','skins/default') as $dir) { + if (!system("rsync -avuC " . INSTALL_PATH . "$dir/* $target_dir/$dir/")) { + $err = true; + break; + } + } + foreach (array('index.php','.htaccess','config/main.inc.php.dist','config/db.inc.php.dist','CHANGELOG','README','UPGRADING') as $file) { + if (!system("rsync -avu " . INSTALL_PATH . "$file $target_dir/$file")) { + $err = true; + break; + } + } + echo "done.\n\n"; + + if (!$err) { + echo "Running update script at target...\n"; + system("cd $target_dir && bin/update.sh --version=$oldversion"); + echo "All done.\n"; + } +} +else + echo "Update cancelled. See ya!\n"; + +?> diff --git a/bin/jsshrink.sh b/bin/jsshrink.sh index b85f517..be5aad1 100755 --- a/bin/jsshrink.sh +++ b/bin/jsshrink.sh @@ -41,8 +41,3 @@ for fn in app common googiespell list; do echo "Shrinking $JS_DIR/${fn}.js" do_shrink "$JS_DIR/${fn}.js.src" "$JS_DIR/${fn}.js" done - -for fn in tiny_mce/tiny_mce; do - echo "Shrinking $JS_DIR/${fn}.js" - do_shrink "$JS_DIR/${fn}_src.js" "$JS_DIR/${fn}.js" -done diff --git a/bin/jsunshrink.sh b/bin/jsunshrink.sh index 90c3ea5..9d77550 100755 --- a/bin/jsunshrink.sh +++ b/bin/jsunshrink.sh @@ -12,13 +12,3 @@ for fn in app common googiespell list; do echo "Reverted $JS_DIR/${fn}.js" fi done - -for fn in tiny_mce/tiny_mce; do - if [ -d "$JS_DIR/.svn" ] && which svn >/dev/null 2>&1; then - rm -f "$JS_DIR/${fn}.js" - svn revert "$JS_DIR/${fn}.js" - else - cp "$JS_DIR/${fn}_src.js" "$JS_DIR/${fn}.js" - echo "Reverted $JS_DIR/${fn}.js" - fi -done diff --git a/bin/msgimport.sh b/bin/msgimport.sh index 74dc816..845c585 100755 --- a/bin/msgimport.sh +++ b/bin/msgimport.sh @@ -79,7 +79,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) $fp = fopen($args['file'], 'r'); while (($line = fgets($fp)) !== false) { - if (preg_match('/^From\s+/', $line) && $lastline == '') + if (preg_match('/^From\s+-/', $line) && $lastline == '') { if (!empty($message)) { diff --git a/bin/update.sh b/bin/update.sh index a298887..52ac637 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -1,13 +1,43 @@ #!/usr/bin/env php | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); -require_once INSTALL_PATH . 'program/include/iniset.php'; +require_once INSTALL_PATH . 'program/include/clisetup.php'; require_once INSTALL_PATH . 'installer/rcube_install.php'; +// get arguments +$opts = get_opt(array('v' => 'version')); + +// ask user if no version is specified +if (!$opts['version']) { + echo "What version are you upgrading from? Type '?' if you don't know.\n"; + if (($input = trim(fgets(STDIN))) && preg_match('/^[0-9.]+[a-z-]*$/', $input)) + $opts['version'] = $input; +} + +if ($opts['version'] && version_compare($opts['version'], RCMAIL_VERSION, '>')) + die("Nothing to be done here. Bye!\n"); + + $RCI = rcube_install::get_instance(); $RCI->load_config(); @@ -88,7 +118,7 @@ if ($RCI->configured) { } } else { - echo "Please update your config files manually according to the above messages.\n"; + echo "Please update your config files manually according to the above messages.\n\n"; } } @@ -113,15 +143,29 @@ if ($RCI->configured) { echo "Error connecting to database: $db_error_msg\n"; $success = false; } - else if ($RCI->db_schema_check($DB, false)) { - $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql', 'sqlsrv' => 'mssql'); - $updatefile = INSTALL_PATH . 'SQL/' . (isset($db_map[$DB->db_provider]) ? $db_map[$DB->db_provider] : $DB->db_provider) . '.update.sql'; + else if ($err = $RCI->db_schema_check($DB, false)) { + $updatefile = INSTALL_PATH . 'SQL/' . (isset($RCI->db_map[$DB->db_provider]) ? $RCI->db_map[$DB->db_provider] : $DB->db_provider) . '.update.sql'; echo "WARNING: Database schema needs to be updated!\n"; - echo "Open $updatefile and execute all queries that are superscribed with the currently installed version number\n"; + echo join("\n", $err) . "\n\n"; $success = false; + + if ($opts['version']) { + echo "Do you want to run the update queries to get the schmea fixed? (y/N)\n"; + $input = trim(fgets(STDIN)); + if (strtolower($input) == 'y') { + $success = $RCI->update_db($DB, $opts['version']); + } + } + + if (!$success) + echo "Open $updatefile and execute all queries below the comment with the currently installed version number.\n"; } } + // index contacts for fulltext searching + if (version_compare($opts['version'], '0.6', '<')) { + system(INSTALL_PATH . 'bin/indexcontacts.sh'); + } if ($success) { echo "This instance of Roundcube is up-to-date.\n"; diff --git a/config/db.inc.php.dist b/config/db.inc.php.dist index e8938a1..78cd968 100644 --- a/config/db.inc.php.dist +++ b/config/db.inc.php.dist @@ -5,7 +5,7 @@ | Configuration file for database access | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2009, The Roundcube Dev Team | | Licensed under the GNU GPL | | | +-----------------------------------------------------------------------+ diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index f00bfa8..824085c 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -5,7 +5,7 @@ | Main configuration file | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2010, The Roundcube Dev Team | | Licensed under the GNU GPL | | | +-----------------------------------------------------------------------+ @@ -41,6 +41,9 @@ $rcmail_config['smtp_log'] = true; // Log successful logins to /userlogins or to syslog $rcmail_config['log_logins'] = false; +// Log session authentication errors to /session or to syslog +$rcmail_config['log_session'] = false; + // Log SQL queries to /sql or to syslog $rcmail_config['sql_debug'] = false; @@ -64,6 +67,7 @@ $rcmail_config['smtp_debug'] = false; // Supported replacement variables: // %n - http hostname ($_SERVER['SERVER_NAME']) // %d - domain (http hostname without the first part) +// %s - domain name after the '@' from e-mail address provided at login screen // For example %n = mail.domain.tld, %d = domain.tld $rcmail_config['default_host'] = ''; @@ -108,6 +112,13 @@ $rcmail_config['imap_auth_cid'] = null; // Optional IMAP authentication password to be used for imap_auth_cid $rcmail_config['imap_auth_pw'] = null; +// Type of IMAP indexes cache. Supported values: 'db', 'apc' and 'memcache'. +$rcmail_config['imap_cache'] = null; + +// Enables messages cache. Only 'db' cache is supported. +$rcmail_config['messages_cache'] = false; + + // ---------------------------------- // SMTP // ---------------------------------- @@ -168,10 +179,6 @@ $rcmail_config['log_dir'] = 'logs/'; // use this folder to store temp files (must be writeable for apache user) $rcmail_config['temp_dir'] = 'temp/'; -// enable caching of messages and mailbox data in the local database. -// this is recommended if the IMAP server does not run on the same machine -$rcmail_config['enable_caching'] = false; - // lifetime of message cache // possible units: s, m, h, d, w $rcmail_config['message_cache_lifetime'] = '10d'; @@ -192,6 +199,8 @@ $rcmail_config['login_autocomplete'] = 0; // If users authentication is not case sensitive this must be enabled. // You can also use it to force conversion of logins to lower case. +// After enabling it all user records need to be updated, e.g. with query: +// UPDATE users SET username = LOWER(username); $rcmail_config['login_lc'] = false; // automatically create a new Roundcube user when log-in the first time. @@ -199,6 +208,10 @@ $rcmail_config['login_lc'] = false; // set to false if only registered users can use this service $rcmail_config['auto_create_user'] = true; +// replace Roundcube logo with this image +// specify an URL relative to the document root of this Roundcube installation +$rcmail_config['skin_logo'] = null; + // Includes should be interpreted as PHP files $rcmail_config['skin_include_php'] = false; @@ -206,16 +219,28 @@ $rcmail_config['skin_include_php'] = false; // must be greater than 'keep_alive'/60 $rcmail_config['session_lifetime'] = 10; +// session domain: .example.org +$rcmail_config['session_domain'] = ''; + +// Backend to use for session storage. Can either be 'db' (default) or 'memcache' +// If set to memcache, a list of servers need to be specified in 'memcache_hosts' +// Make sure the Memcache extension (http://pecl.php.net/package/memcache) version >= 2.0.0 is installed +$rcmail_config['session_storage'] = 'db'; + +// Use these hosts for accessing memcached +// Define any number of hosts in the form hostname:port +$rcmail_config['memcache_hosts'] = null; // e.g. array( 'localhost:11211', '192.168.1.12:11211' ); + // check client IP in session athorization $rcmail_config['ip_check'] = false; -// Use an additional frequently changing cookie to athenticate user sessions. -// There have been problems reported with this feature. -$rcmail_config['double_auth'] = false; - // check referer of incoming requests $rcmail_config['referer_check'] = false; +// X-Frame-Options HTTP header value sent to prevent from Clickjacking. +// Possible values: sameorigin|deny. Set to false in order to disable sending them +$rcmail_config['x_frame_options'] = 'sameorigin'; + // this key is used to encrypt the users imap password which is stored // in the session record (and the client cookie if remember password is enabled). // please provide a string of exactly 24 chars. @@ -295,9 +320,6 @@ $rcmail_config['line_length'] = 72; // send plaintext messages as format=flowed $rcmail_config['send_format_flowed'] = true; -// session domain: .example.org -$rcmail_config['session_domain'] = ''; - // don't allow these settings to be overriden by the user $rcmail_config['dont_override'] = array(); @@ -308,9 +330,23 @@ $rcmail_config['dont_override'] = array(); // 3 - one identity with possibility to edit all params but not email address $rcmail_config['identities_level'] = 0; +// Mimetypes supported by the browser. +// attachments of these types will open in a preview window +// either a comma-separated list or an array: 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/pdf' +$rcmail_config['client_mimetypes'] = null; # null == default + // mime magic database $rcmail_config['mime_magic'] = '/usr/share/misc/magic'; +// path to imagemagick identify binary +$rcmail_config['im_identify_path'] = null; + +// path to imagemagick convert binary +$rcmail_config['im_convert_path'] = null; + +// maximum size of uploaded contact photos in pixel +$rcmail_config['contact_photo_size'] = 160; + // Enable DNS checking for e-mail address validation $rcmail_config['email_dns_check'] = false; @@ -350,23 +386,31 @@ $rcmail_config['date_long'] = 'd.m.Y H:i'; // Note: $ character will be replaced with 'Today' label $rcmail_config['date_today'] = 'H:i'; +// use this format for date display without time (date or strftime format) +$rcmail_config['date_format'] = 'Y-m-d'; + // store draft message is this mailbox // leave blank if draft messages should not be stored +// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['drafts_mbox'] = 'Drafts'; // store spam messages in this mailbox +// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['junk_mbox'] = 'Junk'; // store sent message is this mailbox // leave blank if sent messages should not be stored +// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['sent_mbox'] = 'Sent'; // move messages to this folder when deleting them // leave blank if they should be deleted directly +// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['trash_mbox'] = 'Trash'; // display these folders separately in the mailbox list. // these folders will also be displayed with localized names +// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); // automatically create the above listed default folders on login @@ -405,6 +449,16 @@ $rcmail_config['max_pagesize'] = 200; // Must be less than 'session_lifetime' $rcmail_config['min_keep_alive'] = 60; +// Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option. +// By default refresh time is set to 1 second. You can set this value to true +// or any integer value indicating number of seconds. +$rcmail_config['upload_progress'] = false; + +// Specifies for how many seconds the Undo button will be available +// after object delete action. Currently used with supporting address book sources. +// Setting it to 0, disables the feature. +$rcmail_config['undo_timeout'] = 0; + // ---------------------------------- // ADDRESSBOOK SETTINGS // ---------------------------------- @@ -418,9 +472,9 @@ $rcmail_config['address_book_type'] = 'sql'; // In order to enable public ldap search, configure an array like the Verisign // example further below. if you would like to test, simply uncomment the example. +// Array key must contain only safe characters, ie. a-zA-Z0-9_ $rcmail_config['ldap_public'] = array(); -// // If you are going to use LDAP for individual address books, you will need to // set 'user_specific' to true and use the variables to generate the appropriate DNs to access it. // @@ -448,6 +502,7 @@ $rcmail_config['ldap_public']['Verisign'] = array( 'hosts' => array('directory.verisign.com'), 'port' => 389, 'use_tls' => false, + 'ldap_version' => 3, // using LDAPv3 'user_specific' => false, // If true the base_dn, bind_dn and bind_pass default to the user's IMAP login. // %fu - The full username provided, assumes the username is an email // address, uses the username_domain value if not an email address. @@ -462,25 +517,65 @@ $rcmail_config['ldap_public']['Verisign'] = array( // The login name is used to search for the DN to bind with 'search_base_dn' => '', 'search_filter' => '', // e.g. '(&(objectClass=posixAccount)(uid=%u))' - - 'writable' => false, // Indicates if we can write to the LDAP directory or not. + // Optional authentication identifier to be used as SASL authorization proxy + // bind_dn need to be empty + 'auth_cid' => '', + // SASL authentication method (for proxy auth), e.g. DIGEST-MD5 + 'auth_method' => '', + // Indicates if the addressbook shall be displayed on the list. + // With this option enabled you can still search/view contacts. + 'hidden' => false, + // Indicates if we can write to the LDAP directory or not. // If writable is true then these fields need to be populated: // LDAP_Object_Classes, required_fields, LDAP_rdn - 'LDAP_Object_Classes' => array("top", "inetOrgPerson"), // To create a new contact these are the object classes to specify (or any other classes you wish to use). - 'required_fields' => array("cn", "sn", "mail"), // The required fields needed to build a new contact as required by the object classes (can include additional fields not required by the object classes). - 'LDAP_rdn' => 'mail', // The RDN field that is used for new entries, this field needs to be one of the search_fields, the base of base_dn is appended to the RDN to insert into the LDAP directory. - 'ldap_version' => 3, // using LDAPv3 - 'search_fields' => array('mail', 'cn'), // fields to search in - 'name_field' => 'cn', // this field represents the contact's name - 'email_field' => 'mail', // this field represents the contact's e-mail - 'surname_field' => 'sn', // this field represents the contact's last name - 'firstname_field' => 'gn', // this field represents the contact's first name + 'writable' => false, + // To create a new contact these are the object classes to specify + // (or any other classes you wish to use). + 'LDAP_Object_Classes' => array('top', 'inetOrgPerson'), + // The RDN field that is used for new entries, this field needs + // to be one of the search_fields, the base of base_dn is appended + // to the RDN to insert into the LDAP directory. + 'LDAP_rdn' => 'mail', + // The required fields needed to build a new contact as required by + // the object classes (can include additional fields not required by the object classes). + 'required_fields' => array('cn', 'sn', 'mail'), + 'search_fields' => array('mail', 'cn'), // fields to search in + // mapping of contact fields to directory attributes + 'fieldmap' => array( + // Roundcube => LDAP + 'name' => 'cn', + 'surname' => 'sn', + 'firstname' => 'givenName', + 'email' => 'mail', + 'phone:home' => 'homePhone', + 'phone:work' => 'telephoneNumber', + 'phone:mobile' => 'mobile', + 'street' => 'street', + 'zipcode' => 'postalCode', + 'locality' => 'l', + 'country' => 'c', + 'organization' => 'o', + ), 'sort' => 'cn', // The field to sort the listing by. 'scope' => 'sub', // search mode: sub|base|list - 'filter' => '', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act + 'filter' => '(objectClass=inetOrgPerson)', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act 'fuzzy_search' => true, // server allows wildcard search - 'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit. - 'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. + 'vlv' => false, // Enable Virtual List View to more efficiently fetch paginated data (if server supports it) + 'numsub_filter' => '(objectClass=organizationalUnit)', // with VLV, we also use numSubOrdinates to query the total number of records. Set this filter to get all numSubOrdinates attributes for counting + 'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit. + 'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. + + // definition for contact groups (uncomment if no groups are supported) + // for the groups base_dn, the user replacements %fu, %u, $d and %dc work as for base_dn (see above) + // if the groups base_dn is empty, the contact base_dn is used for the groups as well + // -> in this case, assure that groups and contacts are separated due to the concernig filters! + 'groups' => array( + 'base_dn' => '', + 'filter' => '(objectClass=groupOfNames)', + 'object_classes' => array("top", "groupOfNames"), + // name of the member attribute, e.g. uniqueMember + 'member_attr' => 'member', + ), ); */ @@ -493,6 +588,19 @@ $rcmail_config['autocomplete_addressbooks'] = array('sql'); // may need to do lengthy results building given overly-broad searches $rcmail_config['autocomplete_min_length'] = 1; +// Number of parallel autocomplete requests. +// If there's more than one address book, n parallel (async) requests will be created, +// where each request will search in one address book. By default (0), all address +// books are searched in one request. +$rcmail_config['autocomplete_threads'] = 0; + +// Max. numer of entries in autocomplete popup. Default: 15. +$rcmail_config['autocomplete_max'] = 15; + +// show address fields in this order +// available placeholders: {street}, {locality}, {zipcode}, {country}, {region} +$rcmail_config['address_template'] = '{street}
{locality} {zipcode}
{country} {region}'; + // ---------------------------------- // USER PREFERENCES // ---------------------------------- @@ -538,9 +646,6 @@ $rcmail_config['preview_pane'] = false; // Set to -1 if messages in preview pane should not be marked as read $rcmail_config['preview_pane_mark_read'] = 0; -// focus new window if new message arrives -$rcmail_config['focus_on_new_message'] = true; - // Clear Trash on logout $rcmail_config['logout_purge'] = false; @@ -564,8 +669,8 @@ $rcmail_config['skip_deleted'] = false; // False means that a message's read status is not affected by marking it as deleted $rcmail_config['read_when_deleted'] = true; -// Set to true to newer delete messages immediately -// Use 'Purge' to remove messages marked as deleted +// Set to true to never delete messages immediately +// Use 'Purge' to remove messages marked as deleted $rcmail_config['flag_for_deletion'] = false; // Default interval for keep-alive/check-recent requests (in seconds) @@ -608,6 +713,9 @@ $rcmail_config['force_7bit'] = false; // Please note that folder names should to be in sync with $rcmail_config['default_imap_folders'] $rcmail_config['search_mods'] = null; // Example: array('*' => array('subject'=>1, 'from'=>1), 'Sent' => array('subject'=>1, 'to'=>1)); +// Defaults of the addressbook search field configuration. +$rcmail_config['addressbook_search_mods'] = null; // Example: array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1, '*'=>1); + // 'Delete always' // This setting reflects if mail should be always deleted // when moving to Trash fails. This is necessary in some setups @@ -629,4 +737,15 @@ $rcmail_config['dsn_default'] = 0; // Place replies in the folder of the message being replied to $rcmail_config['reply_same_folder'] = false; +// Sets default mode of Forward feature to "forward as attachment" +$rcmail_config['forward_attachment'] = false; + +// Defines address book (internal index) to which new contacts will be added +// By default it is the first writeable addressbook. +// Note: Use '0' for built-in address book. +$rcmail_config['default_addressbook'] = null; + +// Enables spell checking before sending a message. +$rcmail_config['spellcheck_before_send'] = false; + // end of config file diff --git a/index.php b/index.php index f73e4f8..e3e55d7 100644 --- a/index.php +++ b/index.php @@ -2,9 +2,9 @@ /* +-------------------------------------------------------------------------+ | Roundcube Webmail IMAP Client | - | Version 0.5.3 | + | Version 0.6 | | | - | Copyright (C) 2005-2011, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2011, The Roundcube Dev Team | | | | This program is free software; you can redistribute it and/or modify | | it under the terms of the GNU General Public License version 2 | @@ -23,7 +23,7 @@ | Author: Thomas Bruederli | +-------------------------------------------------------------------------+ - $Id: index.php 4831 2011-06-02 13:36:57Z thomasb $ + $Id: index.php 5292 2011-09-28 19:16:41Z thomasb $ */ @@ -103,7 +103,7 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { $RCMAIL->session->regenerate_id(false); // send auth cookie if necessary - $RCMAIL->authenticate_session(); + $RCMAIL->session->set_auth_cookie(); // log successful login rcmail_log_login(); @@ -120,7 +120,7 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { // allow plugins to control the redirect url after login success $redir = $RCMAIL->plugins->exec_hook('login_after', $query + array('_task' => 'mail')); - unset($redir['abort']); + unset($redir['abort'], $redir['_err']); // send redirect $OUTPUT->redirect($redir); @@ -146,19 +146,25 @@ else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL-> // check session and auth cookie else if ($RCMAIL->task != 'login' && $_SESSION['user_id'] && $RCMAIL->action != 'send') { - if (!$RCMAIL->authenticate_session()) { - $OUTPUT->show_message('sessionerror', 'error'); + if (!$RCMAIL->session->check_auth()) { $RCMAIL->kill_session(); + $session_error = true; } } // not logged in -> show login page if (empty($RCMAIL->user->ID)) { + // log session failures + if (($task = get_input_value('_task', RCUBE_INPUT_GPC)) && !in_array($task, array('login','logout')) && !$session_error && ($sess_id = $_COOKIE[ini_get('session.name')])) { + $RCMAIL->session->log("Aborted session " . $sess_id . "; no valid session data found"); + $session_error = true; + } + if ($OUTPUT->ajax_call) - $OUTPUT->redirect(array(), 2000); + $OUTPUT->redirect(array('_err' => 'session'), 2000); if (!empty($_REQUEST['_framed'])) - $OUTPUT->command('redirect', '?'); + $OUTPUT->command('redirect', $RCMAIL->url(array('_err' => 'session'))); // check if installer is still active if ($RCMAIL->config->get('enable_installer') && is_readable('./installer/index.php')) { @@ -171,6 +177,9 @@ if (empty($RCMAIL->user->ID)) { ) ); } + + if ($session_error || $_REQUEST['_err'] == 'session') + $OUTPUT->show_message('sessionerror', 'error', null, true, -1); $RCMAIL->set_task('login'); $OUTPUT->send('login'); @@ -205,62 +214,24 @@ else { // handle special actions if ($RCMAIL->action == 'keep-alive') { $OUTPUT->reset(); + $RCMAIL->plugins->exec_hook('keep_alive', array()); $OUTPUT->send(); } else if ($RCMAIL->action == 'save-pref') { - include 'steps/utils/save_pref.inc'; + include INSTALL_PATH . 'program/steps/utils/save_pref.inc'; } -// map task/action to a certain include file -$action_map = array( - 'mail' => array( - 'preview' => 'show.inc', - 'print' => 'show.inc', - 'moveto' => 'move_del.inc', - 'delete' => 'move_del.inc', - 'send' => 'sendmail.inc', - 'expunge' => 'folders.inc', - 'purge' => 'folders.inc', - 'remove-attachment' => 'attachments.inc', - 'display-attachment' => 'attachments.inc', - 'upload' => 'attachments.inc', - 'group-expand' => 'autocomplete.inc', - ), - - 'addressbook' => array( - 'add' => 'edit.inc', - 'group-create' => 'groups.inc', - 'group-rename' => 'groups.inc', - 'group-delete' => 'groups.inc', - 'group-addmembers' => 'groups.inc', - 'group-delmembers' => 'groups.inc', - ), - - 'settings' => array( - 'folders' => 'folders.inc', - 'rename-folder' => 'folders.inc', - 'delete-folder' => 'folders.inc', - 'subscribe' => 'folders.inc', - 'unsubscribe' => 'folders.inc', - 'purge' => 'folders.inc', - 'folder-size' => 'folders.inc', - 'add-identity' => 'edit_identity.inc', - ) -); - // include task specific functions -if (is_file($incfile = 'program/steps/'.$RCMAIL->task.'/func.inc')) - include_once($incfile); +if (is_file($incfile = INSTALL_PATH . 'program/steps/'.$RCMAIL->task.'/func.inc')) + include_once $incfile; // allow 5 "redirects" to another action $redirects = 0; $incstep = null; while ($redirects < 5) { - $stepfile = !empty($action_map[$RCMAIL->task][$RCMAIL->action]) ? - $action_map[$RCMAIL->task][$RCMAIL->action] : strtr($RCMAIL->action, '-', '_') . '.inc'; - // execute a plugin action if ($RCMAIL->plugins->is_plugin_task($RCMAIL->task)) { + if (!$RCMAIL->action) $RCMAIL->action = 'index'; $RCMAIL->plugins->exec_action($RCMAIL->task.'.'.$RCMAIL->action); break; } @@ -269,8 +240,10 @@ while ($redirects < 5) { break; } // try to include the step file - else if (is_file($incfile = 'program/steps/'.$RCMAIL->task.'/'.$stepfile)) { - include($incfile); + else if (($stepfile = $RCMAIL->get_action_file()) + && is_file($incfile = INSTALL_PATH . 'program/steps/'.$RCMAIL->task.'/'.$stepfile) + ) { + include $incfile; $redirects++; } else { diff --git a/installer/check.php b/installer/check.php index 0ba5f58..944d384 100644 --- a/installer/check.php +++ b/installer/check.php @@ -22,6 +22,7 @@ $required_libs = array( 'PEAR' => 'PEAR.php', 'MDB2' => 'MDB2.php', 'Net_SMTP' => 'Net/SMTP.php', + 'Net_IDNA2' => 'Net/IDNA2.php', 'Mail_mime' => 'Mail/mime.php', ); diff --git a/installer/config.php b/installer/config.php index 6b52407..dabc478 100644 --- a/installer/config.php +++ b/installer/config.php @@ -361,7 +361,7 @@ echo $text_sentmbox->show($RCI->getprop('sent_mbox')); ?>
Store sent messages in this folder
-

Leave blank if sent messages should not be stored

+

Leave blank if sent messages should not be stored. Note: folder must include namespace prefix if any.

trash_mbox
@@ -374,7 +374,7 @@ echo $text_trashmbox->show($RCI->getprop('trash_mbox')); ?>
Move messages to this folder when deleting them
-

Leave blank if they should be deleted directly

+

Leave blank if they should be deleted directly. Note: folder must include namespace prefix if any.

drafts_mbox
@@ -387,7 +387,7 @@ echo $text_draftsmbox->show($RCI->getprop('drafts_mbox')); ?>
Store draft messages in this folder
-

Leave blank if they should not be stored

+

Leave blank if they should not be stored. Note: folder must include namespace prefix if any.

junk_mbox
@@ -399,6 +399,10 @@ echo $text_junkmbox->show($RCI->getprop('junk_mbox')); ?>
Store spam messages in this folder
+ +

Note: folder must include namespace prefix if any.

+ + @@ -500,13 +504,26 @@ echo $input_locale->show($RCI->getprop('language'));
'_skin', 'size' => 30, 'id' => "cfgskin")); +$input_skin = new html_select(array('name' => '_skin', 'id' => "cfgskin")); +$input_skin->add($RCI->list_skins()); echo $input_skin->show($RCI->getprop('skin')); ?>
Name of interface skin (folder in /skins)
+
skin_logo
+
+ '_skin_logo', 'size' => 50, 'id' => "cfgskinlogo")); +echo $input_skin->show($RCI->getprop('skin_logo')); + +?> +
Custom image to display instead of the Roundcube logo.
+

Enter a URL relative to the document root of this Roundcube installation.

+
+
pagesize *
| + +-------------------------------------------------------------------------+ + + $Id$ + +*/ + ini_set('error_reporting', E_ALL&~E_NOTICE); ini_set('display_errors', 1); @@ -41,7 +69,7 @@ if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowin header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="'.$filename.'"'); - + $RCI->merge_config(); echo $RCI->create_config($_GET['_mergeconfig'], true); exit; @@ -68,14 +96,13 @@ if ($RCI->configured && empty($_REQUEST['_step'])) { + + + + +
@@ -120,7 +147,7 @@ else {
diff --git a/installer/rcube_install.php b/installer/rcube_install.php index 69be025..ff3f7a4 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -5,7 +5,7 @@ | rcube_install.php | | | | This file is part of the Roundcube Webmail package | - | Copyright (C) 2008-2009, Roundcube Dev. - Switzerland | + | Copyright (C) 2008-2011, The Roundcube Dev Team | | Licensed under the GNU Public License | +-----------------------------------------------------------------------+ @@ -29,10 +29,11 @@ class rcube_install var $config = array(); var $configured = false; var $last_error = null; + var $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql', 'sqlsrv' => 'mssql'); var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; var $bool_config_props = array(); - var $obsolete_config = array('db_backend'); + var $obsolete_config = array('db_backend', 'double_auth'); var $replaced_config = array( 'skin_path' => 'skin', 'locale_string' => 'language', @@ -42,7 +43,10 @@ class rcube_install ); // these config options are required for a working system - var $required_config = array('db_dsnw', 'db_table_contactgroups', 'db_table_contactgroupmembers', 'des_key'); + var $required_config = array( + 'db_dsnw', 'db_table_contactgroups', 'db_table_contactgroupmembers', + 'des_key', 'session_lifetime', + ); /** * Constructor @@ -91,14 +95,15 @@ class rcube_install */ function _load_config($suffix) { - @include RCMAIL_CONFIG_DIR . '/main.inc' . $suffix; - if (is_array($rcmail_config)) { - $this->config += $rcmail_config; + if (is_readable($main_inc = RCMAIL_CONFIG_DIR . '/main.inc' . $suffix)) { + include($main_inc); + if (is_array($rcmail_config)) + $this->config += $rcmail_config; } - - @include RCMAIL_CONFIG_DIR . '/db.inc'. $suffix; - if (is_array($rcmail_config)) { - $this->config += $rcmail_config; + if (is_readable($db_inc = RCMAIL_CONFIG_DIR . '/db.inc'. $suffix)) { + include($db_inc); + if (is_array($rcmail_config)) + $this->config += $rcmail_config; } } @@ -119,8 +124,8 @@ class rcube_install return $value !== null && $value !== '' ? $value : $default; } - - + + /** * Take the default config file and replace the parameters * with the submitted form data @@ -131,13 +136,14 @@ class rcube_install function create_config($which, $force = false) { $out = @file_get_contents(RCMAIL_CONFIG_DIR . "/{$which}.inc.php.dist"); - + if (!$out) return '[Warning: could not read the config template file]'; foreach ($this->config as $prop => $default) { + $value = (isset($_POST["_$prop"]) || $this->bool_config_props[$prop]) ? $_POST["_$prop"] : $default; - + // convert some form data if ($prop == 'debug_level') { $val = 0; @@ -189,9 +195,9 @@ class rcube_install else if (is_numeric($value)) { $value = intval($value); } - + // skip this property - if (!$force && ($value == $default)) + if (!$force && !$this->configured && ($value == $default)) continue; // save change @@ -294,7 +300,7 @@ class rcube_install $this->config = array(); $this->load_defaults(); - foreach ($this->replaced_config as $prop => $replacement) + foreach ($this->replaced_config as $prop => $replacement) { if (isset($current[$prop])) { if ($prop == 'skin_path') $this->config[$replacement] = preg_replace('#skins/(\w+)/?$#', '\\1', $current[$prop]); @@ -302,8 +308,8 @@ class rcube_install $this->config[$replacement] = $current[$prop] ? 2 : 0; else $this->config[$replacement] = $current[$prop]; - - unset($current[$prop]); + } + unset($current[$prop]); } foreach ($this->obsolete_config as $prop) { @@ -320,6 +326,9 @@ class rcube_install } } + if ($current['keep_alive'] && $current['session_lifetime'] < $current['keep_alive']) + $current['session_lifetime'] = max(10, ceil($current['keep_alive'] / 60) * 2); + $this->config = array_merge($this->config, $current); foreach ((array)$current['ldap_public'] as $key => $values) { @@ -339,18 +348,8 @@ class rcube_install if (!$this->configured) return false; - // simple ad hand-made db schema - $db_schema = array( - 'users' => array(), - 'identities' => array(), - 'contacts' => array(), - 'contactgroups' => array(), - 'contactgroupmembers' => array(), - 'cache' => array(), - 'messages' => array(), - 'session' => array(), - ); - + // read reference schema from mysql.initial.sql + $db_schema = $this->db_read_schema(INSTALL_PATH . 'SQL/mysql.initial.sql'); $errors = array(); // check list of tables @@ -358,13 +357,43 @@ class rcube_install foreach ($db_schema as $table => $cols) { $table = !empty($this->config['db_table_'.$table]) ? $this->config['db_table_'.$table] : $table; - if (!in_array($table, $existing_tables)) - $errors[] = "Missing table ".$table; - // TODO: check cols and indices + if (!in_array($table, $existing_tables)) { + $errors[] = "Missing table '".$table."'"; + } + else { // compare cols + $db_cols = $DB->list_cols($table); + $diff = array_diff(array_keys($cols), $db_cols); + if (!empty($diff)) + $errors[] = "Missing columns in table '$table': " . join(',', $diff); + } } return !empty($errors) ? $errors : false; } + + /** + * Utility function to read database schema from an .sql file + */ + private function db_read_schema($schemafile) + { + $lines = file($schemafile); + $table_block = false; + $schema = array(); + foreach ($lines as $line) { + if (preg_match('/^\s*create table `?([a-z0-9_]+)`?/i', $line, $m)) { + $table_block = $m[1]; + } + else if ($table_block && preg_match('/^\s*`?([a-z0-9_-]+)`?\s+([a-z]+)/', $line, $m)) { + $col = $m[1]; + if (!in_array(strtoupper($col), array('PRIMARY','KEY','INDEX','UNIQUE','CONSTRAINT','REFERENCES','FOREIGN'))) { + $schema[$table_block][$col] = $m[2]; + } + } + } + + return $schema; + } + /** * Compare the local database schema with the reference schema @@ -474,6 +503,30 @@ class rcube_install return $out; } + /** + * Create a HTML dropdown to select a previous version of Roundcube + */ + function versions_select($attrib = array()) + { + $select = new html_select($attrib); + $select->add(array('0.1-stable', '0.1.1', '0.2-alpha', '0.2-beta', '0.2-stable', '0.3-stable', '0.3.1', '0.4-beta', '0.4.2', '0.5-beta', '0.5', '0.5.1')); + return $select; + } + + /** + * Return a list with available subfolders of the skin directory + */ + function list_skins() + { + $skins = array(); + $skindir = INSTALL_PATH . 'skins/'; + foreach (glob($skindir . '*') as $path) { + if (is_dir($path) && is_readable($path)) { + $skins[] = substr($path, strlen($skindir)); + } + } + return $skins; + } /** * Display OK status @@ -592,39 +645,98 @@ class rcube_install */ function init_db($DB) { - $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql'); - $engine = isset($db_map[$DB->db_provider]) ? $db_map[$DB->db_provider] : $DB->db_provider; + $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; // read schema file from /SQL/* - $fname = "../SQL/$engine.initial.sql"; + $fname = INSTALL_PATH . "SQL/$engine.initial.sql"; + if ($sql = @file_get_contents($fname)) { + $this->exec_sql($sql, $DB); + } + else { + $this->fail('DB Schema', "Cannot read the schema file: $fname"); + return false; + } + + if ($err = $this->get_error()) { + $this->fail('DB Schema', "Error creating database schema: $err"); + return false; + } + + return true; + } + + + /** + * Update database with SQL statements from SQL/*.update.sql + * + * @param object rcube_db Database connection + * @param string Version to update from + * @return boolen True on success, False on error + */ + function update_db($DB, $version) + { + $version = strtolower($version); + $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; + + // read schema file from /SQL/* + $fname = INSTALL_PATH . "SQL/$engine.update.sql"; if ($lines = @file($fname, FILE_SKIP_EMPTY_LINES)) { - $buff = ''; - foreach ($lines as $i => $line) { - if (preg_match('/^--/', $line)) - continue; - - $buff .= $line . "\n"; - if (preg_match('/;$/', trim($line))) { - $DB->query($buff); - $buff = ''; - if ($this->get_error()) - break; + $from = false; $sql = ''; + foreach ($lines as $line) { + $is_comment = preg_match('/^--/', $line); + if (!$from && $is_comment && preg_match('/from version\s([0-9.]+[a-z-]*)/', $line, $m)) { + $v = strtolower($m[1]); + if ($v == $version || version_compare($version, $v, '<=')) + $from = true; } + if ($from && !$is_comment) + $sql .= $line. "\n"; } + + if ($sql) + $this->exec_sql($sql, $DB); } else { - $this->fail('DB Schema', "Cannot read the schema file: $fname"); + $this->fail('DB Schema', "Cannot read the update file: $fname"); return false; } if ($err = $this->get_error()) { - $this->fail('DB Schema', "Error creating database schema: $err"); + $this->fail('DB Schema', "Error updating database: $err"); return false; } return true; } + + /** + * Execute the given SQL queries on the database connection + * + * @param string SQL queries to execute + * @param object rcube_db Database connection + * @return boolen True on success, False on error + */ + function exec_sql($sql, $DB) + { + $buff = ''; + foreach (explode("\n", $sql) as $line) { + if (preg_match('/^--/', $line) || trim($line) == '') + continue; + + $buff .= $line . "\n"; + if (preg_match('/(;|^GO)$/', trim($line))) { + $DB->query($buff); + $buff = ''; + if ($DB->is_error()) + break; + } + } + + return !$DB->is_error(); + } + + /** * Handler for Roundcube errors */ diff --git a/installer/styles.css b/installer/styles.css index 1acdc9c..06f49e3 100644 --- a/installer/styles.css +++ b/installer/styles.css @@ -1,62 +1,53 @@ - body { - margin: 1em 2em 2em 2em; - background-color: #fff; -} - -body, td, th, div, p { - font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; - font-size: small; - color: #000; + background: white; + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + font-size: small; + color: black; + margin: 0; } #banner { - position: relative; + position: relative; + height: 58px; + margin: 0 0 1em 0; + padding: 10px 20px; + background: url('images/banner_gradient.gif') top left repeat-x #d8edfd; + overflow: hidden; } -#header { - position: relative; - height: 56px; - background: url('images/banner_bg.gif') top left repeat-x #fff; +#banner .banner-bg { + position: absolute; + top: 0; + right: 0; + width: 630px; + height: 78px; + background: url('images/banner_schraffur.gif') top right no-repeat; + z-index: 0; } -#header div.banner-logo { - position: absolute; - top: 0px; - left: 0px; - width: 200px; - height: 56px; +#banner .banner-logo { + position: absolute; + top: 10px; + left: 20px; + z-index: 4; } -#header div.banner-right { - position: absolute; - right: 0px; - top: 0px; - width: 10px; - height: 56px; +#banner .banner-logo a { + border: 0; } #topnav { - position: absolute; - right: 20px; - bottom: 8px; - text-align: right; - color: #ebebeb; - font-size: smaller; + position: absolute; + top: 3.6em; + right: 20px; } #topnav a { - color: #ebebeb; - font-size: 11px; - text-decoration: none; -} - -#topnav a:hover { - text-decoration: underline; + color: #666; } #content { - margin: 8px 20px; + margin: 2em 20px; } #footer { diff --git a/installer/test.php b/installer/test.php index 713edfb..02a1ceb 100644 --- a/installer/test.php +++ b/installer/test.php @@ -156,6 +156,14 @@ if ($db_working && $_POST['initdb']) { } } +else if ($db_working && $_POST['updatedb']) { + if (!($success = $RCI->update_db($DB, $_POST['version']))) { + $updatefile = INSTALL_PATH . 'SQL/' . (isset($RCI->db_map[$DB->db_provider]) ? $RCI->db_map[$DB->db_provider] : $DB->db_provider) . '.update.sql'; + echo '

Please manually execute the SQL statements from '.$updatefile.' on your database.
'; + echo 'See comments in the file and execute queries below the comment with the currently installed version number.

'; + } +} + // test database if ($db_working) { $db_read = $DB->query("SELECT count(*) FROM {$RCI->config['db_table_users']}"); @@ -164,12 +172,13 @@ if ($db_working) { echo '

'; $db_working = false; } - else if ($RCI->db_schema_check($DB, $update = !empty($_POST['updatedb']))) { + else if ($err = $RCI->db_schema_check($DB, $update = !empty($_POST['updatedb']))) { $RCI->fail('DB Schema', "Database schema differs"); - $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql', 'sqlsrv' => 'mssql'); - $updatefile = INSTALL_PATH . 'SQL/' . (isset($db_map[$DB->db_provider]) ? $db_map[$DB->db_provider] : $DB->db_provider) . '.update.sql'; - echo '

Please manually execute the SQL statements from '.$updatefile.' on your database.
'; - echo 'See comments in the file and execute queries that are superscribed with the currently installed version number.

'; + echo '
  • ' . join("
  • \n
  • ", $err) . "
"; + $select = $RCI->versions_select(array('name' => 'version')); + echo '

You should run the update queries to get the schmea fixed.

Version to update from: ' . $select->show() . ' 

'; +// echo '

Please manually execute the SQL statements from '.$updatefile.' on your database.
'; +// echo 'See comments in the file and execute queries that are superscribed with the currently installed version number.

'; $db_working = false; } else { @@ -412,7 +421,7 @@ if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user After completing the installation and the final tests please remove the whole installer folder from the document root of the webserver or make sure that -enable_installer option in main.inc.php is disabled.
+enable_installer option in config/main.inc.php is disabled.

These files may expose sensitive configuration data like server passwords and encryption keys diff --git a/installer/utils.php b/installer/utils.php index 4294f79..a7521b9 100644 --- a/installer/utils.php +++ b/installer/utils.php @@ -2,9 +2,9 @@ /* +-------------------------------------------------------------------------+ | Roundcube Webmail IMAP Client | - | Version 0.3-20090702 | + | Version 0.6 | | | - | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | + | Copyright (C) 2005-2011, The Roundcube Dev Team | | | | This program is free software; you can redistribute it and/or modify | | it under the terms of the GNU General Public License version 2 | @@ -33,12 +33,26 @@ */ function __autoload($classname) { - $filename = preg_replace( - array('/MDB2_(.+)/', '/Mail_(.+)/', '/Net_(.+)/', '/^html_.+/', '/^utf8$/'), - array('MDB2/\\1', 'Mail/\\1', 'Net/\\1', 'html', 'utf8.class'), - $classname - ); - include_once $filename. '.php'; + $filename = preg_replace( + array( + '/MDB2_(.+)/', + '/Mail_(.+)/', + '/Net_(.+)/', + '/Auth_(.+)/', + '/^html_.+/', + '/^utf8$/' + ), + array( + 'MDB2/\\1', + 'Mail/\\1', + 'Net/\\1', + 'Auth/\\1', + 'html', + 'utf8.class' + ), + $classname + ); + include_once $filename. '.php'; } @@ -47,6 +61,20 @@ function __autoload($classname) */ function raise_error($p) { - $rci = rcube_install::get_instance(); - $rci->raise_error($p); + $rci = rcube_install::get_instance(); + $rci->raise_error($p); } + +/** + * Local callback function for PEAR errors + */ +function rcube_pear_error($err) +{ + raise_error(array( + 'code' => $err->getCode(), + 'message' => $err->getMessage(), + )); +} + +// set PEAR error handling (will also load the PEAR main class) +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error'); diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js new file mode 100644 index 0000000..4b1431a --- /dev/null +++ b/plugins/acl/acl.js @@ -0,0 +1,338 @@ +/** + * ACL plugin script + * + * @version 0.6.1 + * @author Aleksander Machniak + */ + +if (window.rcmail) { + rcmail.addEventListener('init', function() { + if (rcmail.gui_objects.acltable) { + rcmail.acl_list_init(); + // enable autocomplete on user input + if (rcmail.env.acl_users_source) { + rcmail.init_address_input_events($('#acluser'), {action:'settings/plugin.acl-autocomplete'}); + // fix inserted value + rcmail.addEventListener('autocomplete_insert', function(e) { + if (e.field.id != 'acluser') + return; + + var value = e.insert; + // get UID from the entry value + if (value.match(/\s*\(([^)]+)\)[, ]*$/)) + value = RegExp.$1; + e.field.value = value; + }); + } + } + + rcmail.enable_command('acl-create', 'acl-save', 'acl-cancel', 'acl-mode-switch', true); + rcmail.enable_command('acl-delete', 'acl-edit', false); + }); +} + +// Display new-entry form +rcube_webmail.prototype.acl_create = function() +{ + this.acl_init_form(); +} + +// Display ACL edit form +rcube_webmail.prototype.acl_edit = function() +{ + // @TODO: multi-row edition + var id = this.acl_list.get_single_selection(); + if (id) + this.acl_init_form(id); +} + +// ACL entry delete +rcube_webmail.prototype.acl_delete = function() +{ + var users = this.acl_get_usernames(); + + if (users && users.length && confirm(this.get_label('acl.deleteconfirm'))) { + this.http_request('settings/plugin.acl', '_act=delete&_user='+urlencode(users.join(',')) + + '&_mbox='+urlencode(this.env.mailbox), + this.set_busy(true, 'acl.deleting')); + } +} + +// Save ACL data +rcube_webmail.prototype.acl_save = function() +{ + var user = $('#acluser').val(), rights = '', type; + + $(':checkbox', this.env.acl_advanced ? $('#advancedrights') : sim_ul = $('#simplerights')).map(function() { + if (this.checked) + rights += this.value; + }); + + if (type = $('input:checked[name=usertype]').val()) { + if (type != 'user') + user = type; + } + + if (!user) { + alert(this.get_label('acl.nouser')); + return; + } + if (!rights) { + alert(this.get_label('acl.norights')); + return; + } + + this.http_request('settings/plugin.acl', '_act=save' + + '&_user='+urlencode(user) + + '&_acl=' +rights + + '&_mbox='+urlencode(this.env.mailbox) + + (this.acl_id ? '&_old='+this.acl_id : ''), + this.set_busy(true, 'acl.saving')); +} + +// Cancel/Hide form +rcube_webmail.prototype.acl_cancel = function() +{ + this.ksearch_blur(); + this.acl_form.hide(); +} + +// Update data after save (and hide form) +rcube_webmail.prototype.acl_update = function(o) +{ + // delete old row + if (o.old) + this.acl_remove_row(o.old); + // make sure the same ID doesn't exist + else if (this.env.acl[o.id]) + this.acl_remove_row(o.id); + + // add new row + this.acl_add_row(o, true); + // hide autocomplete popup + this.ksearch_blur(); + // hide form + this.acl_form.hide(); +} + +// Switch table display mode +rcube_webmail.prototype.acl_mode_switch = function(elem) +{ + this.env.acl_advanced = !this.env.acl_advanced; + this.enable_command('acl-delete', 'acl-edit', false); + this.http_request('settings/plugin.acl', '_act=list' + + '&_mode='+(this.env.acl_advanced ? 'advanced' : 'simple') + + '&_mbox='+urlencode(this.env.mailbox), + this.set_busy(true, 'loading')); +} + +// ACL table initialization +rcube_webmail.prototype.acl_list_init = function() +{ + this.acl_list = new rcube_list_widget(this.gui_objects.acltable, + {multiselect:true, draggable:false, keyboard:true, toggleselect:true}); + this.acl_list.addEventListener('select', function(o) { rcmail.acl_list_select(o); }); + this.acl_list.addEventListener('dblclick', function(o) { rcmail.acl_list_dblclick(o); }); + this.acl_list.addEventListener('keypress', function(o) { rcmail.acl_list_keypress(o); }); + this.acl_list.init(); +} + +// ACL table row selection handler +rcube_webmail.prototype.acl_list_select = function(list) +{ + rcmail.enable_command('acl-delete', list.selection.length > 0); + rcmail.enable_command('acl-edit', list.selection.length == 1); + list.focus(); +} + +// ACL table double-click handler +rcube_webmail.prototype.acl_list_dblclick = function(list) +{ + this.acl_edit(); +} + +// ACL table keypress handler +rcube_webmail.prototype.acl_list_keypress = function(list) +{ + if (list.key_pressed == list.ENTER_KEY) + this.command('acl-edit'); + else if (list.key_pressed == list.DELETE_KEY || list.key_pressed == list.BACKSPACE_KEY) + if (!this.acl_form || !this.acl_form.is(':visible')) + this.command('acl-delete'); +} + +// Reloads ACL table +rcube_webmail.prototype.acl_list_update = function(html) +{ + $(this.gui_objects.acltable).html(html); + this.acl_list_init(); +} + +// Returns names of users in selected rows +rcube_webmail.prototype.acl_get_usernames = function() +{ + var users = [], n, len, cell, row, + list = this.acl_list, + selection = list.get_selection(); + + for (n=0, len=selection.length; n= 0) { + users.push(selection[n]); + } + else { + row = list.rows[selection[n]].obj; + cell = $('td.user', row); + if (cell.length == 1) + users.push(cell.text()); + } + } + + return users; +} + +// Removes ACL table row +rcube_webmail.prototype.acl_remove_row = function(id) +{ + this.acl_list.remove_row(id); + // we don't need it anymore (remove id conflict) + $('#rcmrow'+id).remove(); + this.env.acl[id] = null; +} + +// Adds ACL table row +rcube_webmail.prototype.acl_add_row = function(o, sel) +{ + var n, len, ids = [], spec = [], id = o.id, list = this.acl_list, + items = this.env.acl_advanced ? [] : this.env.acl_items, + table = this.gui_objects.acltable, + row = $('thead > tr', table).clone(); + + // Update new row + $('td', row).map(function() { + var r, cl = this.className.replace(/^acl/, ''); + + if (items && items[cl]) + cl = items[cl]; + + if (cl == 'user') + $(this).text(o.username); + else + $(this).addClass(rcmail.acl_class(o.acl, cl)).text(''); + }); + + row.attr('id', 'rcmrow'+id); + row = row.get(0); + + this.env.acl[id] = o.acl; + + // sorting... (create an array of user identifiers, then sort it) + for (n in this.env.acl) { + if (this.env.acl[n]) { + if (this.env.acl_specials.length && $.inArray(n, this.env.acl_specials) >= 0) + spec.push(n); + else + ids.push(n); + } + } + ids.sort(); + // specials on the top + ids = spec.concat(ids); + + // find current id + for (n=0, len=ids.length; n= mw) + this.acl_form.css({left: parseInt((bw - mw)/2)+'px'}); + + // display it + this.acl_form.show(); + if (type == 'user') + name_input.focus(); +} + +// Returns class name according to ACL comparision result +rcube_webmail.prototype.acl_class = function(acl1, acl2) +{ + var i, len, found = 0; + + acl1 = String(acl1); + acl2 = String(acl2); + + for (i=0, len=acl2.length; i -1) + found++; + + if (found == len) + return 'enabled'; + else if (found) + return 'partial'; + + return 'disabled'; +} diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php new file mode 100644 index 0000000..976b362 --- /dev/null +++ b/plugins/acl/acl.php @@ -0,0 +1,696 @@ + + * + * + * Copyright (C) 2011, Kolab Systems AG + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +class acl extends rcube_plugin +{ + public $task = 'settings|addressbook|calendar'; + + private $rc; + private $supported = null; + private $mbox; + private $ldap; + private $specials = array('anyone', 'anonymous'); + + /** + * Plugin initialization + */ + function init() + { + $this->rc = rcmail::get_instance(); + + // Register hooks + $this->add_hook('folder_form', array($this, 'folder_form')); + // kolab_addressbook plugin + $this->add_hook('addressbook_form', array($this, 'folder_form')); + $this->add_hook('calendar_form_kolab', array($this, 'folder_form')); + // Plugin actions + $this->register_action('plugin.acl', array($this, 'acl_actions')); + $this->register_action('plugin.acl-autocomplete', array($this, 'acl_autocomplete')); + } + + /** + * Handler for plugin actions (AJAX) + */ + function acl_actions() + { + $action = trim(get_input_value('_act', RCUBE_INPUT_GPC)); + + // Connect to IMAP + $this->rc->imap_init(); + $this->rc->imap_connect(); + + // Load localization and configuration + $this->add_texts('localization/'); + $this->load_config(); + + if ($action == 'save') { + $this->action_save(); + } + else if ($action == 'delete') { + $this->action_delete(); + } + else if ($action == 'list') { + $this->action_list(); + } + + // Only AJAX actions + $this->rc->output->send(); + } + + /** + * Handler for user login autocomplete request + */ + function acl_autocomplete() + { + $this->load_config(); + + $search = get_input_value('_search', RCUBE_INPUT_GPC, true); + $users = array(); + + if ($this->init_ldap()) { + $this->ldap->set_pagesize(15); + $result = $this->ldap->search('*', $search); + + foreach ($result->records as $record) { + $user = $record['uid']; + + if (is_array($user)) { + $user = array_filter($user); + $user = $user[0]; + } + + if ($user) { + if ($record['name']) + $user = $record['name'] . ' (' . $user . ')'; + + $users[] = $user; + } + } + } + + sort($users, SORT_LOCALE_STRING); + + $this->rc->output->command('ksearch_query_results', $users, $search); + $this->rc->output->send(); + } + + /** + * Handler for 'folder_form' hook + * + * @param array $args Hook arguments array (form data) + * + * @return array Hook arguments array + */ + function folder_form($args) + { + // Edited folder name (empty in create-folder mode) + $mbox_imap = $args['options']['name']; + if (!strlen($mbox_imap)) { + return $args; + } +/* + // Do nothing on protected folders (?) + if ($args['options']['protected']) { + return $args; + } +*/ + // Namespace root + if ($args['options']['is_root']) { + return $args; + } + + // Get MYRIGHTS + if (!($myrights = $args['options']['rights'])) { + return $args; + } + + // Do nothing if no ACL support + if (!$this->rc->imap->get_capability('ACL')) { + return $args; + } + + // Load localization and include scripts + $this->load_config(); + $this->add_texts('localization/', array('deleteconfirm', 'norights', + 'nouser', 'deleting', 'saving')); + $this->include_script('acl.js'); + $this->rc->output->include_script('list.js'); + $this->include_stylesheet($this->local_skin_path().'/acl.css'); + + // add Info fieldset if it doesn't exist + if (!isset($args['form']['props']['fieldsets']['info'])) + $args['form']['props']['fieldsets']['info'] = array( + 'name' => rcube_label('info'), + 'content' => array()); + + // Display folder rights to 'Info' fieldset + $args['form']['props']['fieldsets']['info']['content']['myrights'] = array( + 'label' => Q($this->gettext('myrights')), + 'value' => $this->acl2text($myrights) + ); + + // Return if not folder admin + if (!in_array('a', $myrights)) { + return $args; + } + + // The 'Sharing' tab + $this->mbox = $mbox_imap; + $this->rc->output->set_env('acl_users_source', (bool) $this->rc->config->get('acl_users_source')); + $this->rc->output->set_env('mailbox', $mbox_imap); + $this->rc->output->add_handlers(array( + 'acltable' => array($this, 'templ_table'), + 'acluser' => array($this, 'templ_user'), + 'aclrights' => array($this, 'templ_rights'), + )); + + $args['form']['sharing'] = array( + 'name' => Q($this->gettext('sharing')), + 'content' => $this->rc->output->parse('acl.table', false, false), + ); + + return $args; + } + + /** + * Creates ACL rights table + * + * @param array $attrib Template object attributes + * + * @return string HTML Content + */ + function templ_table($attrib) + { + if (empty($attrib['id'])) + $attrib['id'] = 'acl-table'; + + $out = $this->list_rights($attrib); + + $this->rc->output->add_gui_object('acltable', $attrib['id']); + + return $out; + } + + /** + * Creates ACL rights form (rights list part) + * + * @param array $attrib Template object attributes + * + * @return string HTML Content + */ + function templ_rights($attrib) + { + // Get supported rights + $supported = $this->rights_supported(); + + // depending on server capability either use 'te' or 'd' for deleting msgs + $deleteright = implode(array_intersect(str_split('ted'), $supported)); + + $out = ''; + $ul = ''; + $input = new html_checkbox(); + + // Advanced rights + $attrib['id'] = 'advancedrights'; + foreach ($supported as $val) { + $id = "acl$val"; + $ul .= html::tag('li', null, + $input->show('', array( + 'name' => "acl[$val]", 'value' => $val, 'id' => $id)) + . html::label(array('for' => $id, 'title' => $this->gettext('longacl'.$val)), + $this->gettext('acl'.$val))); + } + + $out = html::tag('ul', $attrib, $ul, html::$common_attrib); + + // Simple rights + $ul = ''; + $attrib['id'] = 'simplerights'; + $items = array( + 'read' => 'lrs', + 'write' => 'wi', + 'delete' => $deleteright, + 'other' => preg_replace('/[lrswi'.$deleteright.']/', '', implode($supported)), + ); + + foreach ($items as $key => $val) { + $id = "acl$key"; + $ul .= html::tag('li', null, + $input->show('', array( + 'name' => "acl[$val]", 'value' => $val, 'id' => $id)) + . html::label(array('for' => $id, 'title' => $this->gettext('longacl'.$key)), + $this->gettext('acl'.$key))); + } + + $out .= "\n" . html::tag('ul', $attrib, $ul, html::$common_attrib); + + $this->rc->output->set_env('acl_items', $items); + + return $out; + } + + /** + * Creates ACL rights form (user part) + * + * @param array $attrib Template object attributes + * + * @return string HTML Content + */ + function templ_user($attrib) + { + // Create username input + $attrib['name'] = 'acluser'; + + $textfield = new html_inputfield($attrib); + + $fields['user'] = html::label(array('for' => 'iduser'), $this->gettext('username')) + . ' ' . $textfield->show(); + + // Add special entries + if (!empty($this->specials)) { + foreach ($this->specials as $key) { + $fields[$key] = html::label(array('for' => 'id'.$key), $this->gettext($key)); + } + } + + $this->rc->output->set_env('acl_specials', $this->specials); + + // Create list with radio buttons + if (count($fields) > 1) { + $ul = ''; + $radio = new html_radiobutton(array('name' => 'usertype')); + foreach ($fields as $key => $val) { + $ul .= html::tag('li', null, $radio->show($key == 'user' ? 'user' : '', + array('value' => $key, 'id' => 'id'.$key)) + . $val); + } + + $out = html::tag('ul', array('id' => 'usertype'), $ul, html::$common_attrib); + } + // Display text input alone + else { + $out = $fields['user']; + } + + return $out; + } + + /** + * Creates ACL rights table + * + * @param array $attrib Template object attributes + * + * @return string HTML Content + */ + private function list_rights($attrib=array()) + { + // Get ACL for the folder + $acl = $this->rc->imap->get_acl($this->mbox); + + if (!is_array($acl)) { + $acl = array(); + } + + // Keep special entries (anyone/anonymous) on top of the list + if (!empty($this->specials) && !empty($acl)) { + foreach ($this->specials as $key) { + if (isset($acl[$key])) { + $acl_special[$key] = $acl[$key]; + unset($acl[$key]); + } + } + } + + // Sort the list by username + uksort($acl, 'strnatcasecmp'); + + if (!empty($acl_special)) { + $acl = array_merge($acl_special, $acl); + } + + // Get supported rights and build column names + $supported = $this->rights_supported(); + + // depending on server capability either use 'te' or 'd' for deleting msgs + $deleteright = implode(array_intersect(str_split('ted'), $supported)); + + // Use advanced or simple (grouped) rights + $advanced = $this->rc->config->get('acl_advanced_mode'); + + if ($advanced) { + $items = array(); + foreach ($supported as $sup) { + $items[$sup] = $sup; + } + } + else { + $items = array( + 'read' => 'lrs', + 'write' => 'wi', + 'delete' => $deleteright, + 'other' => preg_replace('/[lrswi'.$deleteright.']/', '', implode($supported)), + ); + } + + // Create the table + $attrib['noheader'] = true; + $table = new html_table($attrib); + + // Create table header + $table->add_header('user', $this->gettext('identifier')); + foreach (array_keys($items) as $key) { + $table->add_header('acl'.$key, $this->gettext('shortacl'.$key)); + } + + $i = 1; + $js_table = array(); + foreach ($acl as $user => $rights) { + if ($this->rc->imap->conn->user == $user) { + continue; + } + + // filter out virtual rights (c or d) the server may return + $userrights = array_intersect($rights, $supported); + $userid = html_identifier($user); + + if (!empty($this->specials) && in_array($user, $this->specials)) { + $user = $this->gettext($user); + } + + $table->add_row(array('id' => 'rcmrow'.$userid)); + $table->add('user', Q($user)); + + foreach ($items as $key => $right) { + $in = $this->acl_compare($userrights, $right); + switch ($in) { + case 2: $class = 'enabled'; break; + case 1: $class = 'partial'; break; + default: $class = 'disabled'; break; + } + $table->add('acl' . $key . ' ' . $class, ''); + } + + $js_table[$userid] = implode($userrights); + } + + $this->rc->output->set_env('acl', $js_table); + $this->rc->output->set_env('acl_advanced', $advanced); + + $out = $table->show(); + + return $out; + } + + /** + * Handler for ACL update/create action + */ + private function action_save() + { + $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); // UTF7-IMAP + $user = trim(get_input_value('_user', RCUBE_INPUT_GPC)); + $acl = trim(get_input_value('_acl', RCUBE_INPUT_GPC)); + $oldid = trim(get_input_value('_old', RCUBE_INPUT_GPC)); + + $acl = array_intersect(str_split($acl), $this->rights_supported()); + + if (!empty($this->specials) && in_array($user, $this->specials)) { + $username = $this->gettext($user); + } + else { + if (!strpos($user, '@') && ($realm = $this->get_realm())) { + $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm)); + } + $username = $user; + } + + if ($acl && $user && $user != $_SESSION['username'] && strlen($mbox)) { + $result = $this->rc->imap->set_acl($mbox, $user, $acl); + } + + if ($result) { + $ret = array('id' => html_identifier($user), + 'username' => $username, 'acl' => implode($acl), 'old' => $oldid); + $this->rc->output->command('acl_update', $ret); + $this->rc->output->show_message($oldid ? 'acl.updatesuccess' : 'acl.createsuccess', 'confirmation'); + } + else { + $this->rc->output->show_message($oldid ? 'acl.updateerror' : 'acl.createerror', 'error'); + } + } + + /** + * Handler for ACL delete action + */ + private function action_delete() + { + $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); //UTF7-IMAP + $user = trim(get_input_value('_user', RCUBE_INPUT_GPC)); + + $user = explode(',', $user); + + foreach ($user as $u) { + if ($this->rc->imap->delete_acl($mbox, $u)) { + $this->rc->output->command('acl_remove_row', html_identifier($u)); + } + else { + $error = true; + } + } + + if (!$error) { + $this->rc->output->show_message('acl.deletesuccess', 'confirmation'); + } + else { + $this->rc->output->show_message('acl.deleteerror', 'error'); + } + } + + /** + * Handler for ACL list update action (with display mode change) + */ + private function action_list() + { + if (in_array('acl_advanced_mode', (array)$this->rc->config->get('dont_override'))) { + return; + } + + $this->mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); // UTF7-IMAP + $advanced = trim(get_input_value('_mode', RCUBE_INPUT_GPC)); + $advanced = $advanced == 'advanced' ? true : false; + + // Save state in user preferences + $this->rc->user->save_prefs(array('acl_advanced_mode' => $advanced)); + + $out = $this->list_rights(); + + $out = preg_replace(array('/^]+>/', '/<\/table>$/'), '', $out); + + $this->rc->output->command('acl_list_update', $out); + } + + /** + * Creates
    list with descriptive access rights + * + * @param array $rights MYRIGHTS result + * + * @return string HTML content + */ + function acl2text($rights) + { + if (empty($rights)) { + return ''; + } + + $supported = $this->rights_supported(); + $list = array(); + $attrib = array( + 'name' => 'rcmyrights', + 'style' => 'margin:0; padding:0 15px;', + ); + + foreach ($supported as $right) { + if (in_array($right, $rights)) { + $list[] = html::tag('li', null, Q($this->gettext('acl' . $right))); + } + } + + if (count($list) == count($supported)) + return Q($this->gettext('aclfull')); + + return html::tag('ul', $attrib, implode("\n", $list)); + } + + /** + * Compares two ACLs (according to supported rights) + * + * @param array $acl1 ACL rights array (or string) + * @param array $acl2 ACL rights array (or string) + * + * @param int Comparision result, 2 - full match, 1 - partial match, 0 - no match + */ + function acl_compare($acl1, $acl2) + { + if (!is_array($acl1)) $acl1 = str_split($acl1); + if (!is_array($acl2)) $acl2 = str_split($acl2); + + $rights = $this->rights_supported(); + + $acl1 = array_intersect($acl1, $rights); + $acl2 = array_intersect($acl2, $rights); + $res = array_intersect($acl1, $acl2); + + $cnt1 = count($res); + $cnt2 = count($acl2); + + if ($cnt1 == $cnt2) + return 2; + else if ($cnt1) + return 1; + else + return 0; + } + + /** + * Get list of supported access rights (according to RIGHTS capability) + * + * @return array List of supported access rights abbreviations + */ + function rights_supported() + { + if ($this->supported !== null) { + return $this->supported; + } + + $capa = $this->rc->imap->get_capability('RIGHTS'); + + if (is_array($capa)) { + $rights = strtolower($capa[0]); + } + else { + $rights = 'cd'; + } + + return $this->supported = str_split('lrswi' . $rights . 'pa'); + } + + /** + * Username realm detection. + * + * @return string Username realm (domain) + */ + private function get_realm() + { + // When user enters a username without domain part, realm + // alows to add it to the username (and display correct username in the table) + + if (isset($_SESSION['acl_username_realm'])) { + return $_SESSION['acl_username_realm']; + } + + // find realm in username of logged user (?) + list($name, $domain) = explode('@', $_SESSION['username']); + + // Use (always existent) ACL entry on the INBOX for the user to determine + // whether or not the user ID in ACL entries need to be qualified and how + // they would need to be qualified. + if (empty($domain)) { + $acl = $this->rc->imap->get_acl('INBOX'); + if (is_array($acl)) { + $regexp = '/^' . preg_quote($_SESSION['username'], '/') . '@(.*)$/'; + $regexp = '/^' . preg_quote('aleksander.machniak', '/') . '@(.*)$/'; + foreach (array_keys($acl) as $name) { + if (preg_match($regexp, $name, $matches)) { + $domain = $matches[1]; + break; + } + } + } + } + + return $_SESSION['acl_username_realm'] = $domain; + } + + /** + * Initializes autocomplete LDAP backend + */ + private function init_ldap() + { + if ($this->ldap) + return $this->ldap->ready; + + // get LDAP config + $config = $this->rc->config->get('acl_users_source'); + + if (empty($config)) { + return false; + } + + // not an array, use configured ldap_public source + if (!is_array($config)) { + $ldap_config = (array) $this->rc->config->get('ldap_public'); + $config = $ldap_config[$config]; + } + + $uid_field = $this->rc->config->get('acl_users_field', 'mail'); + $filter = $this->rc->config->get('acl_users_filter'); + + if (empty($uid_field) || empty($config)) { + return false; + } + + // get name attribute + if (!empty($config['fieldmap'])) { + $name_field = $config['fieldmap']['name']; + } + // ... no fieldmap, use the old method + if (empty($name_field)) { + $name_field = $config['name_field']; + } + + // add UID field to fieldmap, so it will be returned in a record with name + $config['fieldmap'] = array( + 'name' => $name_field, + 'uid' => $uid_field, + ); + + // search in UID and name fields + $config['search_fields'] = array_values($config['fieldmap']); + $config['required_fields'] = array($uid_field); + + // set search filter + if ($filter) + $config['filter'] = $filter; + + // disable vlv + $config['vlv'] = false; + + // Initialize LDAP connection + $this->ldap = new rcube_ldap($config, + $this->rc->config->get('ldap_debug'), + $this->rc->config->mail_domain($_SESSION['imap_host'])); + + return $this->ldap->ready; + } +} diff --git a/plugins/acl/config.inc.php.dist b/plugins/acl/config.inc.php.dist new file mode 100644 index 0000000..f957a23 --- /dev/null +++ b/plugins/acl/config.inc.php.dist @@ -0,0 +1,19 @@ + diff --git a/plugins/acl/localization/de_DE.inc b/plugins/acl/localization/de_DE.inc new file mode 100644 index 0000000..92c7e42 --- /dev/null +++ b/plugins/acl/localization/de_DE.inc @@ -0,0 +1,83 @@ + diff --git a/plugins/acl/localization/en_US.inc b/plugins/acl/localization/en_US.inc new file mode 100644 index 0000000..f5b1ae6 --- /dev/null +++ b/plugins/acl/localization/en_US.inc @@ -0,0 +1,83 @@ + diff --git a/plugins/acl/localization/pl_PL.inc b/plugins/acl/localization/pl_PL.inc new file mode 100644 index 0000000..0b36899 --- /dev/null +++ b/plugins/acl/localization/pl_PL.inc @@ -0,0 +1,83 @@ + diff --git a/plugins/acl/skins/default/acl.css b/plugins/acl/skins/default/acl.css new file mode 100644 index 0000000..e46a1d0 --- /dev/null +++ b/plugins/acl/skins/default/acl.css @@ -0,0 +1,94 @@ +#aclmanager +{ + position: relative; + border: 1px solid #999; + min-height: 302px; +} + +#aclcontainer +{ + overflow-x: auto; +} + +#acltable +{ + width: 100%; + border-collapse: collapse; + background-color: #F9F9F9; +} + +#acltable td +{ + width: 1%; + white-space: nowrap; +} + +#acltable thead td +{ + padding: 0 4px 0 2px; +} + +#acltable tbody td +{ + text-align: center; + padding: 2px; + border-bottom: 1px solid #999999; + cursor: default; +} + +#acltable tbody td.user +{ + width: 96%; + text-align: left; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; +} + +#acltable tbody td.partial +{ + background: url(images/partial.png) center no-repeat; +} + +#acltable tbody td.enabled +{ + background: url(images/enabled.png) center no-repeat; +} + +#acltable tr.selected td +{ + color: #FFFFFF; + background-color: #CC3333; +} + +#acladvswitch +{ + position: absolute; + right: 4px; + text-align: right; + line-height: 22px; +} + +#acladvswitch input +{ + vertical-align: middle; +} + +#acladvswitch span +{ + display: block; +} + +#aclform +{ + top: 80px; + width: 480px; + padding: 10px; +} + +#aclform div +{ + padding: 0; + text-align: center; + clear: both; +} diff --git a/plugins/acl/skins/default/images/enabled.png b/plugins/acl/skins/default/images/enabled.png new file mode 100644 index 0000000..98215f6 Binary files /dev/null and b/plugins/acl/skins/default/images/enabled.png differ diff --git a/plugins/acl/skins/default/images/partial.png b/plugins/acl/skins/default/images/partial.png new file mode 100644 index 0000000..12023f0 Binary files /dev/null and b/plugins/acl/skins/default/images/partial.png differ diff --git a/plugins/acl/skins/default/templates/table.html b/plugins/acl/skins/default/templates/table.html new file mode 100644 index 0000000..2365ef7 --- /dev/null +++ b/plugins/acl/skins/default/templates/table.html @@ -0,0 +1,54 @@ + + +
    +
    + +
    +
    + + + + + +
    +
    + +
    +
      +
    • +
    • +
    +
    + +
    +
    + +
    +
    + +
    +
    + + +
    +
    + + diff --git a/plugins/archive/localization/gl_ES.inc b/plugins/archive/localization/gl_ES.inc new file mode 100644 index 0000000..62a7678 --- /dev/null +++ b/plugins/archive/localization/gl_ES.inc @@ -0,0 +1,10 @@ + diff --git a/plugins/archive/localization/pt_BR.inc b/plugins/archive/localization/pt_BR.inc new file mode 100644 index 0000000..224f53c --- /dev/null +++ b/plugins/archive/localization/pt_BR.inc @@ -0,0 +1,8 @@ + diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php index 919beac..32461cf 100644 --- a/plugins/database_attachments/database_attachments.php +++ b/plugins/database_attachments/database_attachments.php @@ -22,9 +22,10 @@ class database_attachments extends filesystem_attachments /** * Helper method to generate a unique key for the given attachment file */ - private function _key($filepath) + private function _key($args) { - return $this->cache_prefix.md5(mktime().$filepath.$_SESSION['user_id']); + $uname = $args['path'] ? $args['path'] : $args['name']; + return $this->cache_prefix . $args['group'] . md5(mktime() . $uname . $_SESSION['user_id']); } /** @@ -34,8 +35,14 @@ class database_attachments extends filesystem_attachments { $args['status'] = false; $rcmail = rcmail::get_instance(); - $key = $this->_key($args['path']); - $data = base64_encode(file_get_contents($args['path'])); + $key = $this->_key($args); + + $data = file_get_contents($args['path']); + + if ($data === false) + return $args; + + $data = base64_encode($data); $status = $rcmail->db->query( "INSERT INTO ".get_table_name('cache')." @@ -44,13 +51,13 @@ class database_attachments extends filesystem_attachments $_SESSION['user_id'], $key, $data); - + if ($status) { $args['id'] = $key; $args['status'] = true; unset($args['path']); } - + return $args; } @@ -62,10 +69,14 @@ class database_attachments extends filesystem_attachments $args['status'] = false; $rcmail = rcmail::get_instance(); - $key = $this->_key($args['name']); + $key = $this->_key($args); + + if ($args['path']) { + $args['data'] = file_get_contents($args['path']); - if ($args['path']) - $args['data'] = file_get_contents($args['path']); + if ($args['data'] === false) + return $args; + } $data = base64_encode($args['data']); @@ -76,7 +87,7 @@ class database_attachments extends filesystem_attachments $_SESSION['user_id'], $key, $data); - + if ($status) { $args['id'] = $key; $args['status'] = true; @@ -99,11 +110,11 @@ class database_attachments extends filesystem_attachments AND cache_key=?", $_SESSION['user_id'], $args['id']); - + if ($status) { $args['status'] = true; } - + return $args; } @@ -124,7 +135,7 @@ class database_attachments extends filesystem_attachments function get($args) { $rcmail = rcmail::get_instance(); - + $sql_result = $rcmail->db->query( "SELECT cache_id, data FROM ".get_table_name('cache')." @@ -137,20 +148,21 @@ class database_attachments extends filesystem_attachments $args['data'] = base64_decode($sql_arr['data']); $args['status'] = true; } - + return $args; } - + /** * Delete all temp files associated with this user */ function cleanup($args) { + $prefix = $this->cache_prefix . $args['group']; $rcmail = rcmail::get_instance(); $rcmail->db->query( "DELETE FROM ".get_table_name('cache')." WHERE user_id=? - AND cache_key like '{$this->cache_prefix}%'", + AND cache_key like '{$prefix}%'", $_SESSION['user_id']); } } diff --git a/plugins/enigma/README b/plugins/enigma/README new file mode 100644 index 0000000..afb2322 --- /dev/null +++ b/plugins/enigma/README @@ -0,0 +1,35 @@ +------------------------------------------------------------------ +THIS IS NOT EVEN AN "ALPHA" STATE. USE ONLY FOR DEVELOPMENT!!!!!!! +------------------------------------------------------------------ + +WARNING: Don't use with gnupg-2.x! + +Enigma Plugin Status: + +* DONE: + +- PGP signed messages verification +- Handling of PGP keys files attached to incoming messages +- PGP encrypted messages decryption (started) +- PGP keys management UI (started) + +* TODO (must have): + +- Parsing of decrypted messages into array (see rcube_mime_struct) and then into rcube_message_part structure + (create core class rcube_mime_parser or take over PEAR::Mail_mimeDecode package and improve it) +- Sending encrypted/signed messages (probably some changes in core will be needed) +- Per-Identity settings (including keys/certs) (+ split Identities details page into tabs) +- Handling big messages with temp files (including changes in Roundcube core) +- Performance improvements (some caching, code review) +- better (and more) icons + +* TODO (later): + +- Keys generation +- Certs generation +- Keys/Certs info in Contacts details page (+ split Contact details page into tabs) +- Key server support +- S/MIME signed messages verification +- S/MIME encrypted messages decryption +- Handling of S/MIME certs files attached to incoming messages +- SSL (S/MIME) Certs management diff --git a/plugins/enigma/config.inc.php b/plugins/enigma/config.inc.php new file mode 100644 index 0000000..ca841d0 --- /dev/null +++ b/plugins/enigma/config.inc.php @@ -0,0 +1,14 @@ + 1) + page = this.env.current_page - 1; + else if (page == 'first' && this.env.current_page > 1) + page = 1; + + this.enigma_list(page); +} + +// Remove list rows +rcube_webmail.prototype.enigma_clear_list = function() +{ + this.enigma_loadframe(); + if (this.keys_list) + this.keys_list.clear(true); +} + +// Adds a row to the list +rcube_webmail.prototype.enigma_add_list_row = function(r) +{ + if (!this.gui_objects.keyslist || !this.keys_list) + return false; + + var list = this.keys_list, + tbody = this.gui_objects.keyslist.tBodies[0], + rowcount = tbody.rows.length, + even = rowcount%2, + css_class = 'message' + + (even ? ' even' : ' odd'), + // for performance use DOM instead of jQuery here + row = document.createElement('tr'), + col = document.createElement('td'); + + row.id = 'rcmrow' + r.id; + row.className = css_class; + + col.innerHTML = r.name; + row.appendChild(col); + list.insert_row(row); +} + +/*********************************************************/ +/********* Enigma Message methods *********/ +/*********************************************************/ + +// Import attached keys/certs file +rcube_webmail.prototype.enigma_import_attachment = function(mime_id) +{ + var lock = this.set_busy(true, 'loading'); + this.http_post('plugin.enigmaimport', '_uid='+this.env.uid+'&_mbox=' + +urlencode(this.env.mailbox)+'&_part='+urlencode(mime_id), lock); + + return false; +}; + diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php new file mode 100644 index 0000000..fb7c986 --- /dev/null +++ b/plugins/enigma/enigma.php @@ -0,0 +1,475 @@ + | + +-------------------------------------------------------------------------+ +*/ + +/* + This class contains only hooks and action handlers. + Most plugin logic is placed in enigma_engine and enigma_ui classes. +*/ + +class enigma extends rcube_plugin +{ + public $task = 'mail|settings'; + public $rc; + public $engine; + + private $env_loaded; + private $message; + private $keys_parts = array(); + private $keys_bodies = array(); + + + /** + * Plugin initialization. + */ + function init() + { + $rcmail = rcmail::get_instance(); + $this->rc = $rcmail; + + if ($this->rc->task == 'mail') { + // message parse/display hooks + $this->add_hook('message_part_structure', array($this, 'parse_structure')); + $this->add_hook('message_body_prefix', array($this, 'status_message')); + + // message displaying + if ($rcmail->action == 'show' || $rcmail->action == 'preview') { + $this->add_hook('message_load', array($this, 'message_load')); + $this->add_hook('template_object_messagebody', array($this, 'message_output')); + $this->register_action('plugin.enigmaimport', array($this, 'import_file')); + } + // message composing + else if ($rcmail->action == 'compose') { + $this->load_ui(); + $this->ui->init($section); + } + // message sending (and draft storing) + else if ($rcmail->action == 'sendmail') { + //$this->add_hook('outgoing_message_body', array($this, 'msg_encode')); + //$this->add_hook('outgoing_message_body', array($this, 'msg_sign')); + } + } + else if ($this->rc->task == 'settings') { + // add hooks for Enigma settings + $this->add_hook('preferences_sections_list', array($this, 'preferences_section')); + $this->add_hook('preferences_list', array($this, 'preferences_list')); + $this->add_hook('preferences_save', array($this, 'preferences_save')); + + // register handler for keys/certs management + $this->register_action('plugin.enigma', array($this, 'preferences_ui')); + + // grab keys/certs management iframe requests + $section = get_input_value('_section', RCUBE_INPUT_GET); + if ($this->rc->action == 'edit-prefs' && preg_match('/^enigma(certs|keys)/', $section)) { + $this->load_ui(); + $this->ui->init($section); + } + } + } + + /** + * Plugin environment initialization. + */ + function load_env() + { + if ($this->env_loaded) + return; + + $this->env_loaded = true; + + // Add include path for Enigma classes and drivers + $include_path = $this->home . '/lib' . PATH_SEPARATOR; + $include_path .= ini_get('include_path'); + set_include_path($include_path); + + // load the Enigma plugin configuration + $this->load_config(); + + // include localization (if wasn't included before) + $this->add_texts('localization/'); + } + + /** + * Plugin UI initialization. + */ + function load_ui() + { + if ($this->ui) + return; + + // load config/localization + $this->load_env(); + + // Load UI + $this->ui = new enigma_ui($this, $this->home); + } + + /** + * Plugin engine initialization. + */ + function load_engine() + { + if ($this->engine) + return; + + // load config/localization + $this->load_env(); + + $this->engine = new enigma_engine($this); + } + + /** + * Handler for message_part_structure hook. + * Called for every part of the message. + * + * @param array Original parameters + * + * @return array Modified parameters + */ + function parse_structure($p) + { + $struct = $p['structure']; + + if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') { + $this->parse_plain($p); + } + else if ($p['mimetype'] == 'multipart/signed') { + $this->parse_signed($p); + } + else if ($p['mimetype'] == 'multipart/encrypted') { + $this->parse_encrypted($p); + } + else if ($p['mimetype'] == 'application/pkcs7-mime') { + $this->parse_encrypted($p); + } + + return $p; + } + + /** + * Handler for preferences_sections_list hook. + * Adds Enigma settings sections into preferences sections list. + * + * @param array Original parameters + * + * @return array Modified parameters + */ + function preferences_section($p) + { + // add labels + $this->add_texts('localization/'); + + $p['list']['enigmasettings'] = array( + 'id' => 'enigmasettings', 'section' => $this->gettext('enigmasettings'), + ); + $p['list']['enigmacerts'] = array( + 'id' => 'enigmacerts', 'section' => $this->gettext('enigmacerts'), + ); + $p['list']['enigmakeys'] = array( + 'id' => 'enigmakeys', 'section' => $this->gettext('enigmakeys'), + ); + + return $p; + } + + /** + * Handler for preferences_list hook. + * Adds options blocks into Enigma settings sections in Preferences. + * + * @param array Original parameters + * + * @return array Modified parameters + */ + function preferences_list($p) + { + if ($p['section'] == 'enigmasettings') { + // This makes that section is not removed from the list + $p['blocks']['dummy']['options']['dummy'] = array(); + } + else if ($p['section'] == 'enigmacerts') { + // This makes that section is not removed from the list + $p['blocks']['dummy']['options']['dummy'] = array(); + } + else if ($p['section'] == 'enigmakeys') { + // This makes that section is not removed from the list + $p['blocks']['dummy']['options']['dummy'] = array(); + } + + return $p; + } + + /** + * Handler for preferences_save hook. + * Executed on Enigma settings form submit. + * + * @param array Original parameters + * + * @return array Modified parameters + */ + function preferences_save($p) + { + if ($p['section'] == 'enigmasettings') { + $a['prefs'] = array( +// 'dummy' => get_input_value('_dummy', RCUBE_INPUT_POST), + ); + } + + return $p; + } + + /** + * Handler for keys/certs management UI template. + */ + function preferences_ui() + { + $this->load_ui(); + $this->ui->init(); + } + + /** + * Handler for message_body_prefix hook. + * Called for every displayed (content) part of the message. + * Adds infobox about signature verification and/or decryption + * status above the body. + * + * @param array Original parameters + * + * @return array Modified parameters + */ + function status_message($p) + { + $part_id = $p['part']->mime_id; + + // skip: not a message part + if ($p['part'] instanceof rcube_message) + return $p; + + // skip: message has no signed/encoded content + if (!$this->engine) + return $p; + + // Decryption status + if (isset($this->engine->decryptions[$part_id])) { + + // get decryption status + $status = $this->engine->decryptions[$part_id]; + + // Load UI and add css script + $this->load_ui(); + $this->ui->add_css(); + + // display status info + $attrib['id'] = 'enigma-message'; + + if ($status instanceof enigma_error) { + $attrib['class'] = 'enigmaerror'; + $code = $status->getCode(); + if ($code == enigma_error::E_KEYNOTFOUND) + $msg = Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), + $this->gettext('decryptnokey'))); + else if ($code == enigma_error::E_BADPASS) + $msg = Q($this->gettext('decryptbadpass')); + else + $msg = Q($this->gettext('decrypterror')); + } + else { + $attrib['class'] = 'enigmanotice'; + $msg = Q($this->gettext('decryptok')); + } + + $p['prefix'] .= html::div($attrib, $msg); + } + + // Signature verification status + if (isset($this->engine->signed_parts[$part_id]) + && ($sig = $this->engine->signatures[$this->engine->signed_parts[$part_id]]) + ) { + // add css script + $this->load_ui(); + $this->ui->add_css(); + + // display status info + $attrib['id'] = 'enigma-message'; + + if ($sig instanceof enigma_signature) { + if ($sig->valid) { + $attrib['class'] = 'enigmanotice'; + $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>'; + $msg = Q(str_replace('$sender', $sender, $this->gettext('sigvalid'))); + } + else { + $attrib['class'] = 'enigmawarning'; + $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>'; + $msg = Q(str_replace('$sender', $sender, $this->gettext('siginvalid'))); + } + } + else if ($sig->getCode() == enigma_error::E_KEYNOTFOUND) { + $attrib['class'] = 'enigmawarning'; + $msg = Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')), + $this->gettext('signokey'))); + } + else { + $attrib['class'] = 'enigmaerror'; + $msg = Q($this->gettext('sigerror')); + } +/* + $msg .= ' ' . html::a(array('href' => "#sigdetails", + 'onclick' => JS_OBJECT_NAME.".command('enigma-sig-details')"), + Q($this->gettext('showdetails'))); +*/ + // test +// $msg .= '
    '.$sig->body.'
    '; + + $p['prefix'] .= html::div($attrib, $msg); + + // Display each signature message only once + unset($this->engine->signatures[$this->engine->signed_parts[$part_id]]); + } + + return $p; + } + + /** + * Handler for plain/text message. + * + * @param array Reference to hook's parameters (see enigma::parse_structure()) + */ + private function parse_plain(&$p) + { + $this->load_engine(); + $this->engine->parse_plain($p); + } + + /** + * Handler for multipart/signed message. + * Verifies signature. + * + * @param array Reference to hook's parameters (see enigma::parse_structure()) + */ + private function parse_signed(&$p) + { + $this->load_engine(); + $this->engine->parse_signed($p); + } + + /** + * Handler for multipart/encrypted and application/pkcs7-mime message. + * + * @param array Reference to hook's parameters (see enigma::parse_structure()) + */ + private function parse_encrypted(&$p) + { + $this->load_engine(); + $this->engine->parse_encrypted($p); + } + + /** + * Handler for message_load hook. + * Check message bodies and attachments for keys/certs. + */ + function message_load($p) + { + $this->message = $p['object']; + + // handle attachments vcard attachments + foreach ((array)$this->message->attachments as $attachment) { + if ($this->is_keys_part($attachment)) { + $this->keys_parts[] = $attachment->mime_id; + } + } + // the same with message bodies + foreach ((array)$this->message->parts as $idx => $part) { + if ($this->is_keys_part($part)) { + $this->keys_parts[] = $part->mime_id; + $this->keys_bodies[] = $part->mime_id; + } + } + // @TODO: inline PGP keys + + if ($this->keys_parts) { + $this->add_texts('localization'); + } + } + + /** + * Handler for template_object_messagebody hook. + * This callback function adds a box below the message content + * if there is a key/cert attachment available + */ + function message_output($p) + { + $attach_script = false; + + foreach ($this->keys_parts as $part) { + + // remove part's body + if (in_array($part, $this->keys_bodies)) + $p['content'] = ''; + + $style = "margin:0 1em; padding:0.2em 0.5em; border:1px solid #999; width: auto" + ." border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px"; + + // add box below messsage body + $p['content'] .= html::p(array('style' => $style), + html::a(array( + 'href' => "#", + 'onclick' => "return ".JS_OBJECT_NAME.".enigma_import_attachment('".JQ($part)."')", + 'title' => $this->gettext('keyattimport')), + html::img(array('src' => $this->url('skins/default/key_add.png'), 'style' => "vertical-align:middle"))) + . ' ' . html::span(null, $this->gettext('keyattfound'))); + + $attach_script = true; + } + + if ($attach_script) { + $this->include_script('enigma.js'); + } + + return $p; + } + + /** + * Handler for attached keys/certs import + */ + function import_file() + { + $this->load_engine(); + $this->engine->import_file(); + } + + /** + * Checks if specified message part is a PGP-key or S/MIME cert data + * + * @param rcube_message_part Part object + * + * @return boolean True if part is a key/cert + */ + private function is_keys_part($part) + { + // @TODO: S/MIME + return ( + // Content-Type: application/pgp-keys + $part->mimetype == 'application/pgp-keys' + ); + } +} diff --git a/plugins/enigma/home/.htaccess b/plugins/enigma/home/.htaccess new file mode 100644 index 0000000..8e6a345 --- /dev/null +++ b/plugins/enigma/home/.htaccess @@ -0,0 +1,2 @@ +Order allow,deny +Deny from all \ No newline at end of file diff --git a/plugins/enigma/lib/Crypt/GPG.php b/plugins/enigma/lib/Crypt/GPG.php new file mode 100644 index 0000000..6e8e717 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG.php @@ -0,0 +1,2542 @@ + + * addEncryptKey($mySecretKeyId); + * $encryptedData = $gpg->encrypt($data); + * ?> + * + * + * PHP version 5 + * + * LICENSE: + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category Encryption + * @package Crypt_GPG + * @author Nathan Fredrickson + * @author Michael Gauthier + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: GPG.php 302814 2010-08-26 15:43:07Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + * @link http://pear.php.net/manual/en/package.encryption.crypt-gpg.php + * @link http://www.gnupg.org/ + */ + +/** + * Signature handler class + */ +require_once 'Crypt/GPG/VerifyStatusHandler.php'; + +/** + * Decryption handler class + */ +require_once 'Crypt/GPG/DecryptStatusHandler.php'; + +/** + * GPG key class + */ +require_once 'Crypt/GPG/Key.php'; + +/** + * GPG sub-key class + */ +require_once 'Crypt/GPG/SubKey.php'; + +/** + * GPG user id class + */ +require_once 'Crypt/GPG/UserId.php'; + +/** + * GPG process and I/O engine class + */ +require_once 'Crypt/GPG/Engine.php'; + +/** + * GPG exception classes + */ +require_once 'Crypt/GPG/Exceptions.php'; + +// {{{ class Crypt_GPG + +/** + * A class to use GPG from PHP + * + * This class provides an object oriented interface to GNU Privacy Guard (GPG). + * + * Though GPG can support symmetric-key cryptography, this class is intended + * only to facilitate public-key cryptography. + * + * @category Encryption + * @package Crypt_GPG + * @author Nathan Fredrickson + * @author Michael Gauthier + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ +class Crypt_GPG +{ + // {{{ class error constants + + /** + * Error code returned when there is no error. + */ + const ERROR_NONE = 0; + + /** + * Error code returned when an unknown or unhandled error occurs. + */ + const ERROR_UNKNOWN = 1; + + /** + * Error code returned when a bad passphrase is used. + */ + const ERROR_BAD_PASSPHRASE = 2; + + /** + * Error code returned when a required passphrase is missing. + */ + const ERROR_MISSING_PASSPHRASE = 3; + + /** + * Error code returned when a key that is already in the keyring is + * imported. + */ + const ERROR_DUPLICATE_KEY = 4; + + /** + * Error code returned the required data is missing for an operation. + * + * This could be missing key data, missing encrypted data or missing + * signature data. + */ + const ERROR_NO_DATA = 5; + + /** + * Error code returned when an unsigned key is used. + */ + const ERROR_UNSIGNED_KEY = 6; + + /** + * Error code returned when a key that is not self-signed is used. + */ + const ERROR_NOT_SELF_SIGNED = 7; + + /** + * Error code returned when a public or private key that is not in the + * keyring is used. + */ + const ERROR_KEY_NOT_FOUND = 8; + + /** + * Error code returned when an attempt to delete public key having a + * private key is made. + */ + const ERROR_DELETE_PRIVATE_KEY = 9; + + /** + * Error code returned when one or more bad signatures are detected. + */ + const ERROR_BAD_SIGNATURE = 10; + + /** + * Error code returned when there is a problem reading GnuPG data files. + */ + const ERROR_FILE_PERMISSIONS = 11; + + // }}} + // {{{ class constants for data signing modes + + /** + * Signing mode for normal signing of data. The signed message will not + * be readable without special software. + * + * This is the default signing mode. + * + * @see Crypt_GPG::sign() + * @see Crypt_GPG::signFile() + */ + const SIGN_MODE_NORMAL = 1; + + /** + * Signing mode for clearsigning data. Clearsigned signatures are ASCII + * armored data and are readable without special software. If the signed + * message is unencrypted, the message will still be readable. The message + * text will be in the original encoding. + * + * @see Crypt_GPG::sign() + * @see Crypt_GPG::signFile() + */ + const SIGN_MODE_CLEAR = 2; + + /** + * Signing mode for creating a detached signature. When using detached + * signatures, only the signature data is returned. The original message + * text may be distributed separately from the signature data. This is + * useful for miltipart/signed email messages as per + * {@link http://www.ietf.org/rfc/rfc3156.txt RFC 3156}. + * + * @see Crypt_GPG::sign() + * @see Crypt_GPG::signFile() + */ + const SIGN_MODE_DETACHED = 3; + + // }}} + // {{{ class constants for fingerprint formats + + /** + * No formatting is performed. + * + * Example: C3BC615AD9C766E5A85C1F2716D27458B1BBA1C4 + * + * @see Crypt_GPG::getFingerprint() + */ + const FORMAT_NONE = 1; + + /** + * Fingerprint is formatted in the format used by the GnuPG gpg command's + * default output. + * + * Example: C3BC 615A D9C7 66E5 A85C 1F27 16D2 7458 B1BB A1C4 + * + * @see Crypt_GPG::getFingerprint() + */ + const FORMAT_CANONICAL = 2; + + /** + * Fingerprint is formatted in the format used when displaying X.509 + * certificates + * + * Example: C3:BC:61:5A:D9:C7:66:E5:A8:5C:1F:27:16:D2:74:58:B1:BB:A1:C4 + * + * @see Crypt_GPG::getFingerprint() + */ + const FORMAT_X509 = 3; + + // }}} + // {{{ other class constants + + /** + * URI at which package bugs may be reported. + */ + const BUG_URI = 'http://pear.php.net/bugs/report.php?package=Crypt_GPG'; + + // }}} + // {{{ protected class properties + + /** + * Engine used to control the GPG subprocess + * + * @var Crypt_GPG_Engine + * + * @see Crypt_GPG::setEngine() + */ + protected $engine = null; + + /** + * Keys used to encrypt + * + * The array is of the form: + * + * array( + * $key_id => array( + * 'fingerprint' => $fingerprint, + * 'passphrase' => null + * ) + * ); + * + * + * @var array + * @see Crypt_GPG::addEncryptKey() + * @see Crypt_GPG::clearEncryptKeys() + */ + protected $encryptKeys = array(); + + /** + * Keys used to decrypt + * + * The array is of the form: + * + * array( + * $key_id => array( + * 'fingerprint' => $fingerprint, + * 'passphrase' => $passphrase + * ) + * ); + * + * + * @var array + * @see Crypt_GPG::addSignKey() + * @see Crypt_GPG::clearSignKeys() + */ + protected $signKeys = array(); + + /** + * Keys used to sign + * + * The array is of the form: + * + * array( + * $key_id => array( + * 'fingerprint' => $fingerprint, + * 'passphrase' => $passphrase + * ) + * ); + * + * + * @var array + * @see Crypt_GPG::addDecryptKey() + * @see Crypt_GPG::clearDecryptKeys() + */ + protected $decryptKeys = array(); + + // }}} + // {{{ __construct() + + /** + * Creates a new GPG object + * + * Available options are: + * + * - string homedir - the directory where the GPG + * keyring files are stored. If not + * specified, Crypt_GPG uses the + * default of ~/.gnupg. + * - string publicKeyring - the file path of the public + * keyring. Use this if the public + * keyring is not in the homedir, or + * if the keyring is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * keyring with this option + * (/foo/bar/pubring.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string privateKeyring - the file path of the private + * keyring. Use this if the private + * keyring is not in the homedir, or + * if the keyring is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * keyring with this option + * (/foo/bar/secring.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string trustDb - the file path of the web-of-trust + * database. Use this if the trust + * database is not in the homedir, or + * if the database is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * trust database with this option + * (/foo/bar/trustdb.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string binary - the location of the GPG binary. If + * not specified, the driver attempts + * to auto-detect the GPG binary + * location using a list of known + * default locations for the current + * operating system. The option + * gpgBinary is a + * deprecated alias for this option. + * - boolean debug - whether or not to use debug mode. + * When debug mode is on, all + * communication to and from the GPG + * subprocess is logged. This can be + * + * @param array $options optional. An array of options used to create the + * GPG object. All options are optional and are + * represented as key-value pairs. + * + * @throws Crypt_GPG_FileException if the homedir does not exist + * and cannot be created. This can happen if homedir is + * not specified, Crypt_GPG is run as the web user, and the web + * user has no home directory. This exception is also thrown if any + * of the options publicKeyring, + * privateKeyring or trustDb options are + * specified but the files do not exist or are are not readable. + * This can happen if the user running the Crypt_GPG process (for + * example, the Apache user) does not have permission to read the + * files. + * + * @throws PEAR_Exception if the provided binary is invalid, or + * if no binary is provided and no suitable binary could + * be found. + */ + public function __construct(array $options = array()) + { + $this->setEngine(new Crypt_GPG_Engine($options)); + } + + // }}} + // {{{ importKey() + + /** + * Imports a public or private key into the keyring + * + * Keys may be removed from the keyring using + * {@link Crypt_GPG::deletePublicKey()} or + * {@link Crypt_GPG::deletePrivateKey()}. + * + * @param string $data the key data to be imported. + * + * @return array an associative array containing the following elements: + * - fingerprint - the fingerprint of the + * imported key, + * - public_imported - the number of public + * keys imported, + * - public_unchanged - the number of unchanged + * public keys, + * - private_imported - the number of private + * keys imported, + * - private_unchanged - the number of unchanged + * private keys. + * + * @throws Crypt_GPG_NoDataException if the key data is missing or if the + * data is is not valid key data. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function importKey($data) + { + return $this->_importKey($data, false); + } + + // }}} + // {{{ importKeyFile() + + /** + * Imports a public or private key file into the keyring + * + * Keys may be removed from the keyring using + * {@link Crypt_GPG::deletePublicKey()} or + * {@link Crypt_GPG::deletePrivateKey()}. + * + * @param string $filename the key file to be imported. + * + * @return array an associative array containing the following elements: + * - fingerprint - the fingerprint of the + * imported key, + * - public_imported - the number of public + * keys imported, + * - public_unchanged - the number of unchanged + * public keys, + * - private_imported - the number of private + * keys imported, + * - private_unchanged - the number of unchanged + * private keys. + * private keys. + * + * @throws Crypt_GPG_NoDataException if the key data is missing or if the + * data is is not valid key data. + * + * @throws Crypt_GPG_FileException if the key file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function importKeyFile($filename) + { + return $this->_importKey($filename, true); + } + + // }}} + // {{{ exportPublicKey() + + /** + * Exports a public key from the keyring + * + * The exported key remains on the keyring. To delete the public key, use + * {@link Crypt_GPG::deletePublicKey()}. + * + * If more than one key fingerprint is available for the specified + * $keyId (for example, if you use a non-unique uid) only the + * first public key is exported. + * + * @param string $keyId either the full uid of the public key, the email + * part of the uid of the public key or the key id of + * the public key. For example, + * "Test User (example) ", + * "test@example.com" or a hexadecimal string. + * @param boolean $armor optional. If true, ASCII armored data is returned; + * otherwise, binary data is returned. Defaults to + * true. + * + * @return string the public key data. + * + * @throws Crypt_GPG_KeyNotFoundException if a public key with the given + * $keyId is not found. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function exportPublicKey($keyId, $armor = true) + { + $fingerprint = $this->getFingerprint($keyId); + + if ($fingerprint === null) { + throw new Crypt_GPG_KeyNotFoundException( + 'Public key not found: ' . $keyId, + Crypt_GPG::ERROR_KEY_NOT_FOUND, $keyId); + } + + $keyData = ''; + $operation = '--export ' . escapeshellarg($fingerprint); + $arguments = ($armor) ? array('--armor') : array(); + + $this->engine->reset(); + $this->engine->setOutput($keyData); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + if ($code !== Crypt_GPG::ERROR_NONE) { + throw new Crypt_GPG_Exception( + 'Unknown error exporting public key. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + + return $keyData; + } + + // }}} + // {{{ deletePublicKey() + + /** + * Deletes a public key from the keyring + * + * If more than one key fingerprint is available for the specified + * $keyId (for example, if you use a non-unique uid) only the + * first public key is deleted. + * + * The private key must be deleted first or an exception will be thrown. + * See {@link Crypt_GPG::deletePrivateKey()}. + * + * @param string $keyId either the full uid of the public key, the email + * part of the uid of the public key or the key id of + * the public key. For example, + * "Test User (example) ", + * "test@example.com" or a hexadecimal string. + * + * @return void + * + * @throws Crypt_GPG_KeyNotFoundException if a public key with the given + * $keyId is not found. + * + * @throws Crypt_GPG_DeletePrivateKeyException if the specified public key + * has an associated private key on the keyring. The private key + * must be deleted first. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function deletePublicKey($keyId) + { + $fingerprint = $this->getFingerprint($keyId); + + if ($fingerprint === null) { + throw new Crypt_GPG_KeyNotFoundException( + 'Public key not found: ' . $keyId, + Crypt_GPG::ERROR_KEY_NOT_FOUND, $keyId); + } + + $operation = '--delete-key ' . escapeshellarg($fingerprint); + $arguments = array( + '--batch', + '--yes' + ); + + $this->engine->reset(); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + break; + case Crypt_GPG::ERROR_DELETE_PRIVATE_KEY: + throw new Crypt_GPG_DeletePrivateKeyException( + 'Private key must be deleted before public key can be ' . + 'deleted.', $code, $keyId); + default: + throw new Crypt_GPG_Exception( + 'Unknown error deleting public key. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + } + + // }}} + // {{{ deletePrivateKey() + + /** + * Deletes a private key from the keyring + * + * If more than one key fingerprint is available for the specified + * $keyId (for example, if you use a non-unique uid) only the + * first private key is deleted. + * + * Calls GPG with the --delete-secret-key command. + * + * @param string $keyId either the full uid of the private key, the email + * part of the uid of the private key or the key id of + * the private key. For example, + * "Test User (example) ", + * "test@example.com" or a hexadecimal string. + * + * @return void + * + * @throws Crypt_GPG_KeyNotFoundException if a private key with the given + * $keyId is not found. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function deletePrivateKey($keyId) + { + $fingerprint = $this->getFingerprint($keyId); + + if ($fingerprint === null) { + throw new Crypt_GPG_KeyNotFoundException( + 'Private key not found: ' . $keyId, + Crypt_GPG::ERROR_KEY_NOT_FOUND, $keyId); + } + + $operation = '--delete-secret-key ' . escapeshellarg($fingerprint); + $arguments = array( + '--batch', + '--yes' + ); + + $this->engine->reset(); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + break; + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + throw new Crypt_GPG_KeyNotFoundException( + 'Private key not found: ' . $keyId, + $code, $keyId); + default: + throw new Crypt_GPG_Exception( + 'Unknown error deleting private key. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + } + + // }}} + // {{{ getKeys() + + /** + * Gets the available keys in the keyring + * + * Calls GPG with the --list-keys command and grabs keys. See + * the first section of doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG package} for a detailed + * description of how the GPG command output is parsed. + * + * @param string $keyId optional. Only keys with that match the specified + * pattern are returned. The pattern may be part of + * a user id, a key id or a key fingerprint. If not + * specified, all keys are returned. + * + * @return array an array of {@link Crypt_GPG_Key} objects. If no keys + * match the specified $keyId an empty array is + * returned. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG_Key + */ + public function getKeys($keyId = '') + { + // get private key fingerprints + if ($keyId == '') { + $operation = '--list-secret-keys'; + } else { + $operation = '--list-secret-keys ' . escapeshellarg($keyId); + } + + // According to The file 'doc/DETAILS' in the GnuPG distribution, using + // double '--with-fingerprint' also prints the fingerprint for subkeys. + $arguments = array( + '--with-colons', + '--with-fingerprint', + '--with-fingerprint', + '--fixed-list-mode' + ); + + $output = ''; + + $this->engine->reset(); + $this->engine->setOutput($output); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + // ignore not found key errors + break; + case Crypt_GPG::ERROR_FILE_PERMISSIONS: + $filename = $this->engine->getErrorFilename(); + if ($filename) { + throw new Crypt_GPG_FileException(sprintf( + 'Error reading GnuPG data file \'%s\'. Check to make ' . + 'sure it is readable by the current user.', $filename), + $code, $filename); + } + throw new Crypt_GPG_FileException( + 'Error reading GnuPG data file. Check to make GnuPG data ' . + 'files are readable by the current user.', $code); + default: + throw new Crypt_GPG_Exception( + 'Unknown error getting keys. Please use the \'debug\' option ' . + 'when creating the Crypt_GPG object, and file a bug report ' . + 'at ' . self::BUG_URI, $code); + } + + $privateKeyFingerprints = array(); + + $lines = explode(PHP_EOL, $output); + foreach ($lines as $line) { + $lineExp = explode(':', $line); + if ($lineExp[0] == 'fpr') { + $privateKeyFingerprints[] = $lineExp[9]; + } + } + + // get public keys + if ($keyId == '') { + $operation = '--list-public-keys'; + } else { + $operation = '--list-public-keys ' . escapeshellarg($keyId); + } + + $output = ''; + + $this->engine->reset(); + $this->engine->setOutput($output); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + // ignore not found key errors + break; + case Crypt_GPG::ERROR_FILE_PERMISSIONS: + $filename = $this->engine->getErrorFilename(); + if ($filename) { + throw new Crypt_GPG_FileException(sprintf( + 'Error reading GnuPG data file \'%s\'. Check to make ' . + 'sure it is readable by the current user.', $filename), + $code, $filename); + } + throw new Crypt_GPG_FileException( + 'Error reading GnuPG data file. Check to make GnuPG data ' . + 'files are readable by the current user.', $code); + default: + throw new Crypt_GPG_Exception( + 'Unknown error getting keys. Please use the \'debug\' option ' . + 'when creating the Crypt_GPG object, and file a bug report ' . + 'at ' . self::BUG_URI, $code); + } + + $keys = array(); + + $key = null; // current key + $subKey = null; // current sub-key + + $lines = explode(PHP_EOL, $output); + foreach ($lines as $line) { + $lineExp = explode(':', $line); + + if ($lineExp[0] == 'pub') { + + // new primary key means last key should be added to the array + if ($key !== null) { + $keys[] = $key; + } + + $key = new Crypt_GPG_Key(); + + $subKey = Crypt_GPG_SubKey::parse($line); + $key->addSubKey($subKey); + + } elseif ($lineExp[0] == 'sub') { + + $subKey = Crypt_GPG_SubKey::parse($line); + $key->addSubKey($subKey); + + } elseif ($lineExp[0] == 'fpr') { + + $fingerprint = $lineExp[9]; + + // set current sub-key fingerprint + $subKey->setFingerprint($fingerprint); + + // if private key exists, set has private to true + if (in_array($fingerprint, $privateKeyFingerprints)) { + $subKey->setHasPrivate(true); + } + + } elseif ($lineExp[0] == 'uid') { + + $string = stripcslashes($lineExp[9]); // as per documentation + $userId = new Crypt_GPG_UserId($string); + + if ($lineExp[1] == 'r') { + $userId->setRevoked(true); + } + + $key->addUserId($userId); + + } + } + + // add last key + if ($key !== null) { + $keys[] = $key; + } + + return $keys; + } + + // }}} + // {{{ getFingerprint() + + /** + * Gets a key fingerprint from the keyring + * + * If more than one key fingerprint is available (for example, if you use + * a non-unique user id) only the first key fingerprint is returned. + * + * Calls the GPG --list-keys command with the + * --with-fingerprint option to retrieve a public key + * fingerprint. + * + * @param string $keyId either the full user id of the key, the email + * part of the user id of the key, or the key id of + * the key. For example, + * "Test User (example) ", + * "test@example.com" or a hexadecimal string. + * @param integer $format optional. How the fingerprint should be formatted. + * Use {@link Crypt_GPG::FORMAT_X509} for X.509 + * certificate format, + * {@link Crypt_GPG::FORMAT_CANONICAL} for the format + * used by GnuPG output and + * {@link Crypt_GPG::FORMAT_NONE} for no formatting. + * Defaults to Crypt_GPG::FORMAT_NONE. + * + * @return string the fingerprint of the key, or null if no fingerprint + * is found for the given $keyId. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function getFingerprint($keyId, $format = Crypt_GPG::FORMAT_NONE) + { + $output = ''; + $operation = '--list-keys ' . escapeshellarg($keyId); + $arguments = array( + '--with-colons', + '--with-fingerprint' + ); + + $this->engine->reset(); + $this->engine->setOutput($output); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + // ignore not found key errors + break; + default: + throw new Crypt_GPG_Exception( + 'Unknown error getting key fingerprint. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + + $fingerprint = null; + + $lines = explode(PHP_EOL, $output); + foreach ($lines as $line) { + if (substr($line, 0, 3) == 'fpr') { + $lineExp = explode(':', $line); + $fingerprint = $lineExp[9]; + + switch ($format) { + case Crypt_GPG::FORMAT_CANONICAL: + $fingerprintExp = str_split($fingerprint, 4); + $format = '%s %s %s %s %s %s %s %s %s %s'; + $fingerprint = vsprintf($format, $fingerprintExp); + break; + + case Crypt_GPG::FORMAT_X509: + $fingerprintExp = str_split($fingerprint, 2); + $fingerprint = implode(':', $fingerprintExp); + break; + } + + break; + } + } + + return $fingerprint; + } + + // }}} + // {{{ encrypt() + + /** + * Encrypts string data + * + * Data is ASCII armored by default but may optionally be returned as + * binary. + * + * @param string $data the data to be encrypted. + * @param boolean $armor optional. If true, ASCII armored data is returned; + * otherwise, binary data is returned. Defaults to + * true. + * + * @return string the encrypted data. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified. + * See {@link Crypt_GPG::addEncryptKey()}. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @sensitive $data + */ + public function encrypt($data, $armor = true) + { + return $this->_encrypt($data, false, null, $armor); + } + + // }}} + // {{{ encryptFile() + + /** + * Encrypts a file + * + * Encrypted data is ASCII armored by default but may optionally be saved + * as binary. + * + * @param string $filename the filename of the file to encrypt. + * @param string $encryptedFile optional. The filename of the file in + * which to store the encrypted data. If null + * or unspecified, the encrypted data is + * returned as a string. + * @param boolean $armor optional. If true, ASCII armored data is + * returned; otherwise, binary data is + * returned. Defaults to true. + * + * @return void|string if the $encryptedFile parameter is null, + * a string containing the encrypted data is returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified. + * See {@link Crypt_GPG::addEncryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function encryptFile($filename, $encryptedFile = null, $armor = true) + { + return $this->_encrypt($filename, true, $encryptedFile, $armor); + } + + // }}} + // {{{ encryptAndSign() + + /** + * Encrypts and signs data + * + * Data is encrypted and signed in a single pass. + * + * NOTE: Until GnuPG version 1.4.10, it was not possible to verify + * encrypted-signed data without decrypting it at the same time. If you try + * to use {@link Crypt_GPG::verify()} method on encrypted-signed data with + * earlier GnuPG versions, you will get an error. Please use + * {@link Crypt_GPG::decryptAndVerify()} to verify encrypted-signed data. + * + * @param string $data the data to be encrypted and signed. + * @param boolean $armor optional. If true, ASCII armored data is returned; + * otherwise, binary data is returned. Defaults to + * true. + * + * @return string the encrypted signed data. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified + * or if no signing key is specified. See + * {@link Crypt_GPG::addEncryptKey()} and + * {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG::decryptAndVerify() + */ + public function encryptAndSign($data, $armor = true) + { + return $this->_encryptAndSign($data, false, null, $armor); + } + + // }}} + // {{{ encryptAndSignFile() + + /** + * Encrypts and signs a file + * + * The file is encrypted and signed in a single pass. + * + * NOTE: Until GnuPG version 1.4.10, it was not possible to verify + * encrypted-signed files without decrypting them at the same time. If you + * try to use {@link Crypt_GPG::verify()} method on encrypted-signed files + * with earlier GnuPG versions, you will get an error. Please use + * {@link Crypt_GPG::decryptAndVerifyFile()} to verify encrypted-signed + * files. + * + * @param string $filename the name of the file containing the data to + * be encrypted and signed. + * @param string $signedFile optional. The name of the file in which the + * encrypted, signed data should be stored. If + * null or unspecified, the encrypted, signed + * data is returned as a string. + * @param boolean $armor optional. If true, ASCII armored data is + * returned; otherwise, binary data is returned. + * Defaults to true. + * + * @return void|string if the $signedFile parameter is null, a + * string containing the encrypted, signed data is + * returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified + * or if no signing key is specified. See + * {@link Crypt_GPG::addEncryptKey()} and + * {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG::decryptAndVerifyFile() + */ + public function encryptAndSignFile($filename, $signedFile = null, + $armor = true + ) { + return $this->_encryptAndSign($filename, true, $signedFile, $armor); + } + + // }}} + // {{{ decrypt() + + /** + * Decrypts string data + * + * This method assumes the required private key is available in the keyring + * and throws an exception if the private key is not available. To add a + * private key to the keyring, use the {@link Crypt_GPG::importKey()} or + * {@link Crypt_GPG::importKeyFile()} methods. + * + * @param string $encryptedData the data to be decrypted. + * + * @return string the decrypted data. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function decrypt($encryptedData) + { + return $this->_decrypt($encryptedData, false, null); + } + + // }}} + // {{{ decryptFile() + + /** + * Decrypts a file + * + * This method assumes the required private key is available in the keyring + * and throws an exception if the private key is not available. To add a + * private key to the keyring, use the {@link Crypt_GPG::importKey()} or + * {@link Crypt_GPG::importKeyFile()} methods. + * + * @param string $encryptedFile the name of the encrypted file data to + * decrypt. + * @param string $decryptedFile optional. The name of the file to which the + * decrypted data should be written. If null + * or unspecified, the decrypted data is + * returned as a string. + * + * @return void|string if the $decryptedFile parameter is null, + * a string containing the decrypted data is returned. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function decryptFile($encryptedFile, $decryptedFile = null) + { + return $this->_decrypt($encryptedFile, true, $decryptedFile); + } + + // }}} + // {{{ decryptAndVerify() + + /** + * Decrypts and verifies string data + * + * This method assumes the required private key is available in the keyring + * and throws an exception if the private key is not available. To add a + * private key to the keyring, use the {@link Crypt_GPG::importKey()} or + * {@link Crypt_GPG::importKeyFile()} methods. + * + * @param string $encryptedData the encrypted, signed data to be decrypted + * and verified. + * + * @return array two element array. The array has an element 'data' + * containing the decrypted data and an element + * 'signatures' containing an array of + * {@link Crypt_GPG_Signature} objects for the signed data. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function decryptAndVerify($encryptedData) + { + return $this->_decryptAndVerify($encryptedData, false, null); + } + + // }}} + // {{{ decryptAndVerifyFile() + + /** + * Decrypts and verifies a signed, encrypted file + * + * This method assumes the required private key is available in the keyring + * and throws an exception if the private key is not available. To add a + * private key to the keyring, use the {@link Crypt_GPG::importKey()} or + * {@link Crypt_GPG::importKeyFile()} methods. + * + * @param string $encryptedFile the name of the signed, encrypted file to + * to decrypt and verify. + * @param string $decryptedFile optional. The name of the file to which the + * decrypted data should be written. If null + * or unspecified, the decrypted data is + * returned in the results array. + * + * @return array two element array. The array has an element 'data' + * containing the decrypted data and an element + * 'signatures' containing an array of + * {@link Crypt_GPG_Signature} objects for the signed data. + * If the decrypted data is written to a file, the 'data' + * element is null. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function decryptAndVerifyFile($encryptedFile, $decryptedFile = null) + { + return $this->_decryptAndVerify($encryptedFile, true, $decryptedFile); + } + + // }}} + // {{{ sign() + + /** + * Signs data + * + * Data may be signed using any one of the three available signing modes: + * - {@link Crypt_GPG::SIGN_MODE_NORMAL} + * - {@link Crypt_GPG::SIGN_MODE_CLEAR} + * - {@link Crypt_GPG::SIGN_MODE_DETACHED} + * + * @param string $data the data to be signed. + * @param boolean $mode optional. The data signing mode to use. Should + * be one of {@link Crypt_GPG::SIGN_MODE_NORMAL}, + * {@link Crypt_GPG::SIGN_MODE_CLEAR} or + * {@link Crypt_GPG::SIGN_MODE_DETACHED}. If not + * specified, defaults to + * Crypt_GPG::SIGN_MODE_NORMAL. + * @param boolean $armor optional. If true, ASCII armored data is + * returned; otherwise, binary data is returned. + * Defaults to true. This has no effect if the + * mode Crypt_GPG::SIGN_MODE_CLEAR is + * used. + * @param boolean $textmode optional. If true, line-breaks in signed data + * are normalized. Use this option when signing + * e-mail, or for greater compatibility between + * systems with different line-break formats. + * Defaults to false. This has no effect if the + * mode Crypt_GPG::SIGN_MODE_CLEAR is + * used as clear-signing always uses textmode. + * + * @return string the signed data, or the signature data if a detached + * signature is requested. + * + * @throws Crypt_GPG_KeyNotFoundException if no signing key is specified. + * See {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function sign($data, $mode = Crypt_GPG::SIGN_MODE_NORMAL, + $armor = true, $textmode = false + ) { + return $this->_sign($data, false, null, $mode, $armor, $textmode); + } + + // }}} + // {{{ signFile() + + /** + * Signs a file + * + * The file may be signed using any one of the three available signing + * modes: + * - {@link Crypt_GPG::SIGN_MODE_NORMAL} + * - {@link Crypt_GPG::SIGN_MODE_CLEAR} + * - {@link Crypt_GPG::SIGN_MODE_DETACHED} + * + * @param string $filename the name of the file containing the data to + * be signed. + * @param string $signedFile optional. The name of the file in which the + * signed data should be stored. If null or + * unspecified, the signed data is returned as a + * string. + * @param boolean $mode optional. The data signing mode to use. Should + * be one of {@link Crypt_GPG::SIGN_MODE_NORMAL}, + * {@link Crypt_GPG::SIGN_MODE_CLEAR} or + * {@link Crypt_GPG::SIGN_MODE_DETACHED}. If not + * specified, defaults to + * Crypt_GPG::SIGN_MODE_NORMAL. + * @param boolean $armor optional. If true, ASCII armored data is + * returned; otherwise, binary data is returned. + * Defaults to true. This has no effect if the + * mode Crypt_GPG::SIGN_MODE_CLEAR is + * used. + * @param boolean $textmode optional. If true, line-breaks in signed data + * are normalized. Use this option when signing + * e-mail, or for greater compatibility between + * systems with different line-break formats. + * Defaults to false. This has no effect if the + * mode Crypt_GPG::SIGN_MODE_CLEAR is + * used as clear-signing always uses textmode. + * + * @return void|string if the $signedFile parameter is null, a + * string containing the signed data (or the signature + * data if a detached signature is requested) is + * returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no signing key is specified. + * See {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function signFile($filename, $signedFile = null, + $mode = Crypt_GPG::SIGN_MODE_NORMAL, $armor = true, $textmode = false + ) { + return $this->_sign( + $filename, + true, + $signedFile, + $mode, + $armor, + $textmode + ); + } + + // }}} + // {{{ verify() + + /** + * Verifies signed data + * + * The {@link Crypt_GPG::decrypt()} method may be used to get the original + * message if the signed data is not clearsigned and does not use a + * detached signature. + * + * @param string $signedData the signed data to be verified. + * @param string $signature optional. If verifying data signed using a + * detached signature, this must be the detached + * signature data. The data that was signed is + * specified in $signedData. + * + * @return array an array of {@link Crypt_GPG_Signature} objects for the + * signed data. For each signature that is valid, the + * {@link Crypt_GPG_Signature::isValid()} will return true. + * + * @throws Crypt_GPG_NoDataException if the provided data is not signed + * data. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG_Signature + */ + public function verify($signedData, $signature = '') + { + return $this->_verify($signedData, false, $signature); + } + + // }}} + // {{{ verifyFile() + + /** + * Verifies a signed file + * + * The {@link Crypt_GPG::decryptFile()} method may be used to get the + * original message if the signed data is not clearsigned and does not use + * a detached signature. + * + * @param string $filename the signed file to be verified. + * @param string $signature optional. If verifying a file signed using a + * detached signature, this must be the detached + * signature data. The file that was signed is + * specified in $filename. + * + * @return array an array of {@link Crypt_GPG_Signature} objects for the + * signed data. For each signature that is valid, the + * {@link Crypt_GPG_Signature::isValid()} will return true. + * + * @throws Crypt_GPG_NoDataException if the provided data is not signed + * data. + * + * @throws Crypt_GPG_FileException if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG_Signature + */ + public function verifyFile($filename, $signature = '') + { + return $this->_verify($filename, true, $signature); + } + + // }}} + // {{{ addDecryptKey() + + /** + * Adds a key to use for decryption + * + * @param mixed $key the key to use. This may be a key identifier, + * user id, fingerprint, {@link Crypt_GPG_Key} or + * {@link Crypt_GPG_SubKey}. The key must be able + * to encrypt. + * @param string $passphrase optional. The passphrase of the key required + * for decryption. + * + * @return void + * + * @see Crypt_GPG::decrypt() + * @see Crypt_GPG::decryptFile() + * @see Crypt_GPG::clearDecryptKeys() + * @see Crypt_GPG::_addKey() + * @see Crypt_GPG_DecryptStatusHandler + * + * @sensitive $passphrase + */ + public function addDecryptKey($key, $passphrase = null) + { + $this->_addKey($this->decryptKeys, true, false, $key, $passphrase); + } + + // }}} + // {{{ addEncryptKey() + + /** + * Adds a key to use for encryption + * + * @param mixed $key the key to use. This may be a key identifier, user id + * user id, fingerprint, {@link Crypt_GPG_Key} or + * {@link Crypt_GPG_SubKey}. The key must be able to + * encrypt. + * + * @return void + * + * @see Crypt_GPG::encrypt() + * @see Crypt_GPG::encryptFile() + * @see Crypt_GPG::clearEncryptKeys() + * @see Crypt_GPG::_addKey() + */ + public function addEncryptKey($key) + { + $this->_addKey($this->encryptKeys, true, false, $key); + } + + // }}} + // {{{ addSignKey() + + /** + * Adds a key to use for signing + * + * @param mixed $key the key to use. This may be a key identifier, + * user id, fingerprint, {@link Crypt_GPG_Key} or + * {@link Crypt_GPG_SubKey}. The key must be able + * to sign. + * @param string $passphrase optional. The passphrase of the key required + * for signing. + * + * @return void + * + * @see Crypt_GPG::sign() + * @see Crypt_GPG::signFile() + * @see Crypt_GPG::clearSignKeys() + * @see Crypt_GPG::handleSignStatus() + * @see Crypt_GPG::_addKey() + * + * @sensitive $passphrase + */ + public function addSignKey($key, $passphrase = null) + { + $this->_addKey($this->signKeys, false, true, $key, $passphrase); + } + + // }}} + // {{{ clearDecryptKeys() + + /** + * Clears all decryption keys + * + * @return void + * + * @see Crypt_GPG::decrypt() + * @see Crypt_GPG::addDecryptKey() + */ + public function clearDecryptKeys() + { + $this->decryptKeys = array(); + } + + // }}} + // {{{ clearEncryptKeys() + + /** + * Clears all encryption keys + * + * @return void + * + * @see Crypt_GPG::encrypt() + * @see Crypt_GPG::addEncryptKey() + */ + public function clearEncryptKeys() + { + $this->encryptKeys = array(); + } + + // }}} + // {{{ clearSignKeys() + + /** + * Clears all signing keys + * + * @return void + * + * @see Crypt_GPG::sign() + * @see Crypt_GPG::addSignKey() + */ + public function clearSignKeys() + { + $this->signKeys = array(); + } + + // }}} + // {{{ handleSignStatus() + + /** + * Handles the status output from GPG for the sign operation + * + * This method is responsible for sending the passphrase commands when + * required by the {@link Crypt_GPG::sign()} method. See doc/DETAILS + * in the {@link http://www.gnupg.org/download/ GPG distribution} for + * detailed information on GPG's status output. + * + * @param string $line the status line to handle. + * + * @return void + * + * @see Crypt_GPG::sign() + */ + public function handleSignStatus($line) + { + $tokens = explode(' ', $line); + switch ($tokens[0]) { + case 'NEED_PASSPHRASE': + $subKeyId = $tokens[1]; + if (array_key_exists($subKeyId, $this->signKeys)) { + $passphrase = $this->signKeys[$subKeyId]['passphrase']; + $this->engine->sendCommand($passphrase); + } else { + $this->engine->sendCommand(''); + } + break; + } + } + + // }}} + // {{{ handleImportKeyStatus() + + /** + * Handles the status output from GPG for the import operation + * + * This method is responsible for building the result array that is + * returned from the {@link Crypt_GPG::importKey()} method. See + * doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG distribution} for detailed + * information on GPG's status output. + * + * @param string $line the status line to handle. + * @param array &$result the current result array being processed. + * + * @return void + * + * @see Crypt_GPG::importKey() + * @see Crypt_GPG::importKeyFile() + * @see Crypt_GPG_Engine::addStatusHandler() + */ + public function handleImportKeyStatus($line, array &$result) + { + $tokens = explode(' ', $line); + switch ($tokens[0]) { + case 'IMPORT_OK': + $result['fingerprint'] = $tokens[2]; + break; + + case 'IMPORT_RES': + $result['public_imported'] = intval($tokens[3]); + $result['public_unchanged'] = intval($tokens[5]); + $result['private_imported'] = intval($tokens[11]); + $result['private_unchanged'] = intval($tokens[12]); + break; + } + } + + // }}} + // {{{ setEngine() + + /** + * Sets the I/O engine to use for GnuPG operations + * + * Normally this method does not need to be used. It provides a means for + * dependency injection. + * + * @param Crypt_GPG_Engine $engine the engine to use. + * + * @return void + */ + public function setEngine(Crypt_GPG_Engine $engine) + { + $this->engine = $engine; + } + + // }}} + // {{{ _addKey() + + /** + * Adds a key to one of the internal key arrays + * + * This handles resolving full key objects from the provided + * $key value. + * + * @param array &$array the array to which the key should be added. + * @param boolean $encrypt whether or not the key must be able to + * encrypt. + * @param boolean $sign whether or not the key must be able to sign. + * @param mixed $key the key to add. This may be a key identifier, + * user id, fingerprint, {@link Crypt_GPG_Key} or + * {@link Crypt_GPG_SubKey}. + * @param string $passphrase optional. The passphrase associated with the + * key. + * + * @return void + * + * @sensitive $passphrase + */ + private function _addKey(array &$array, $encrypt, $sign, $key, + $passphrase = null + ) { + $subKeys = array(); + + if (is_scalar($key)) { + $keys = $this->getKeys($key); + if (count($keys) == 0) { + throw new Crypt_GPG_KeyNotFoundException( + 'Key "' . $key . '" not found.', 0, $key); + } + $key = $keys[0]; + } + + if ($key instanceof Crypt_GPG_Key) { + if ($encrypt && !$key->canEncrypt()) { + throw new InvalidArgumentException( + 'Key "' . $key . '" cannot encrypt.'); + } + + if ($sign && !$key->canSign()) { + throw new InvalidArgumentException( + 'Key "' . $key . '" cannot sign.'); + } + + foreach ($key->getSubKeys() as $subKey) { + $canEncrypt = $subKey->canEncrypt(); + $canSign = $subKey->canSign(); + if ( ($encrypt && $sign && $canEncrypt && $canSign) + || ($encrypt && !$sign && $canEncrypt) + || (!$encrypt && $sign && $canSign) + ) { + // We add all subkeys that meet the requirements because we + // were not told which subkey is required. + $subKeys[] = $subKey; + } + } + } elseif ($key instanceof Crypt_GPG_SubKey) { + $subKeys[] = $key; + } + + if (count($subKeys) === 0) { + throw new InvalidArgumentException( + 'Key "' . $key . '" is not in a recognized format.'); + } + + foreach ($subKeys as $subKey) { + if ($encrypt && !$subKey->canEncrypt()) { + throw new InvalidArgumentException( + 'Key "' . $key . '" cannot encrypt.'); + } + + if ($sign && !$subKey->canSign()) { + throw new InvalidArgumentException( + 'Key "' . $key . '" cannot sign.'); + } + + $array[$subKey->getId()] = array( + 'fingerprint' => $subKey->getFingerprint(), + 'passphrase' => $passphrase + ); + } + } + + // }}} + // {{{ _importKey() + + /** + * Imports a public or private key into the keyring + * + * @param string $key the key to be imported. + * @param boolean $isFile whether or not the input is a filename. + * + * @return array an associative array containing the following elements: + * - fingerprint - the fingerprint of the + * imported key, + * - public_imported - the number of public + * keys imported, + * - public_unchanged - the number of unchanged + * public keys, + * - private_imported - the number of private + * keys imported, + * - private_unchanged - the number of unchanged + * private keys. + * + * @throws Crypt_GPG_NoDataException if the key data is missing or if the + * data is is not valid key data. + * + * @throws Crypt_GPG_FileException if the key file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + private function _importKey($key, $isFile) + { + $result = array(); + + if ($isFile) { + $input = @fopen($key, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open key file "' . + $key . '" for importing.', 0, $key); + } + } else { + $input = strval($key); + if ($input == '') { + throw new Crypt_GPG_NoDataException( + 'No valid GPG key data found.', Crypt_GPG::ERROR_NO_DATA); + } + } + + $arguments = array(); + $version = $this->engine->getVersion(); + + if ( version_compare($version, '1.0.5', 'ge') + && version_compare($version, '1.0.7', 'lt') + ) { + $arguments[] = '--allow-secret-key-import'; + } + + $this->engine->reset(); + $this->engine->addStatusHandler( + array($this, 'handleImportKeyStatus'), + array(&$result) + ); + + $this->engine->setOperation('--import', $arguments); + $this->engine->setInput($input); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_DUPLICATE_KEY: + case Crypt_GPG::ERROR_NONE: + // ignore duplicate key import errors + break; + case Crypt_GPG::ERROR_NO_DATA: + throw new Crypt_GPG_NoDataException( + 'No valid GPG key data found.', $code); + default: + throw new Crypt_GPG_Exception( + 'Unknown error importing GPG key. Please use the \'debug\' ' . + 'option when creating the Crypt_GPG object, and file a bug ' . + 'report at ' . self::BUG_URI, $code); + } + + return $result; + } + + // }}} + // {{{ _encrypt() + + /** + * Encrypts data + * + * @param string $data the data to encrypt. + * @param boolean $isFile whether or not the data is a filename. + * @param string $outputFile the filename of the file in which to store + * the encrypted data. If null, the encrypted + * data is returned as a string. + * @param boolean $armor if true, ASCII armored data is returned; + * otherwise, binary data is returned. + * + * @return void|string if the $outputFile parameter is null, a + * string containing the encrypted data is returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified. + * See {@link Crypt_GPG::addEncryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + private function _encrypt($data, $isFile, $outputFile, $armor) + { + if (count($this->encryptKeys) === 0) { + throw new Crypt_GPG_KeyNotFoundException( + 'No encryption keys specified.'); + } + + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input file "' . + $data . '" for encryption.', 0, $data); + } + } else { + $input = strval($data); + } + + if ($outputFile === null) { + $output = ''; + } else { + $output = @fopen($outputFile, 'wb'); + if ($output === false) { + if ($isFile) { + fclose($input); + } + throw new Crypt_GPG_FileException('Could not open output ' . + 'file "' . $outputFile . '" for storing encrypted data.', + 0, $outputFile); + } + } + + $arguments = ($armor) ? array('--armor') : array(); + foreach ($this->encryptKeys as $key) { + $arguments[] = '--recipient ' . escapeshellarg($key['fingerprint']); + } + + $this->engine->reset(); + $this->engine->setInput($input); + $this->engine->setOutput($output); + $this->engine->setOperation('--encrypt', $arguments); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + if ($outputFile !== null) { + fclose($output); + } + + $code = $this->engine->getErrorCode(); + + if ($code !== Crypt_GPG::ERROR_NONE) { + throw new Crypt_GPG_Exception( + 'Unknown error encrypting data. Please use the \'debug\' ' . + 'option when creating the Crypt_GPG object, and file a bug ' . + 'report at ' . self::BUG_URI, $code); + } + + if ($outputFile === null) { + return $output; + } + } + + // }}} + // {{{ _decrypt() + + /** + * Decrypts data + * + * @param string $data the data to be decrypted. + * @param boolean $isFile whether or not the data is a filename. + * @param string $outputFile the name of the file to which the decrypted + * data should be written. If null, the decrypted + * data is returned as a string. + * + * @return void|string if the $outputFile parameter is null, a + * string containing the decrypted data is returned. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + private function _decrypt($data, $isFile, $outputFile) + { + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input file "' . + $data . '" for decryption.', 0, $data); + } + } else { + $input = strval($data); + if ($input == '') { + throw new Crypt_GPG_NoDataException( + 'Cannot decrypt data. No PGP encrypted data was found in '. + 'the provided data.', Crypt_GPG::ERROR_NO_DATA); + } + } + + if ($outputFile === null) { + $output = ''; + } else { + $output = @fopen($outputFile, 'wb'); + if ($output === false) { + if ($isFile) { + fclose($input); + } + throw new Crypt_GPG_FileException('Could not open output ' . + 'file "' . $outputFile . '" for storing decrypted data.', + 0, $outputFile); + } + } + + $handler = new Crypt_GPG_DecryptStatusHandler($this->engine, + $this->decryptKeys); + + $this->engine->reset(); + $this->engine->addStatusHandler(array($handler, 'handle')); + $this->engine->setOperation('--decrypt'); + $this->engine->setInput($input); + $this->engine->setOutput($output); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + if ($outputFile !== null) { + fclose($output); + } + + // if there was any problem decrypting the data, the handler will + // deal with it here. + $handler->throwException(); + + if ($outputFile === null) { + return $output; + } + } + + // }}} + // {{{ _sign() + + /** + * Signs data + * + * @param string $data the data to be signed. + * @param boolean $isFile whether or not the data is a filename. + * @param string $outputFile the name of the file in which the signed data + * should be stored. If null, the signed data is + * returned as a string. + * @param boolean $mode the data signing mode to use. Should be one of + * {@link Crypt_GPG::SIGN_MODE_NORMAL}, + * {@link Crypt_GPG::SIGN_MODE_CLEAR} or + * {@link Crypt_GPG::SIGN_MODE_DETACHED}. + * @param boolean $armor if true, ASCII armored data is returned; + * otherwise, binary data is returned. This has + * no effect if the mode + * Crypt_GPG::SIGN_MODE_CLEAR is + * used. + * @param boolean $textmode if true, line-breaks in signed data be + * normalized. Use this option when signing + * e-mail, or for greater compatibility between + * systems with different line-break formats. + * Defaults to false. This has no effect if the + * mode Crypt_GPG::SIGN_MODE_CLEAR is + * used as clear-signing always uses textmode. + * + * @return void|string if the $outputFile parameter is null, a + * string containing the signed data (or the signature + * data if a detached signature is requested) is + * returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no signing key is specified. + * See {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + private function _sign($data, $isFile, $outputFile, $mode, $armor, + $textmode + ) { + if (count($this->signKeys) === 0) { + throw new Crypt_GPG_KeyNotFoundException( + 'No signing keys specified.'); + } + + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input ' . + 'file "' . $data . '" for signing.', 0, $data); + } + } else { + $input = strval($data); + } + + if ($outputFile === null) { + $output = ''; + } else { + $output = @fopen($outputFile, 'wb'); + if ($output === false) { + if ($isFile) { + fclose($input); + } + throw new Crypt_GPG_FileException('Could not open output ' . + 'file "' . $outputFile . '" for storing signed ' . + 'data.', 0, $outputFile); + } + } + + switch ($mode) { + case Crypt_GPG::SIGN_MODE_DETACHED: + $operation = '--detach-sign'; + break; + case Crypt_GPG::SIGN_MODE_CLEAR: + $operation = '--clearsign'; + break; + case Crypt_GPG::SIGN_MODE_NORMAL: + default: + $operation = '--sign'; + break; + } + + $arguments = array(); + + if ($armor) { + $arguments[] = '--armor'; + } + if ($textmode) { + $arguments[] = '--textmode'; + } + + foreach ($this->signKeys as $key) { + $arguments[] = '--local-user ' . + escapeshellarg($key['fingerprint']); + } + + $this->engine->reset(); + $this->engine->addStatusHandler(array($this, 'handleSignStatus')); + $this->engine->setInput($input); + $this->engine->setOutput($output); + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + if ($outputFile !== null) { + fclose($output); + } + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + break; + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + throw new Crypt_GPG_KeyNotFoundException( + 'Cannot sign data. Private key not found. Import the '. + 'private key before trying to sign data.', $code, + $this->engine->getErrorKeyId()); + case Crypt_GPG::ERROR_BAD_PASSPHRASE: + throw new Crypt_GPG_BadPassphraseException( + 'Cannot sign data. Incorrect passphrase provided.', $code); + case Crypt_GPG::ERROR_MISSING_PASSPHRASE: + throw new Crypt_GPG_BadPassphraseException( + 'Cannot sign data. No passphrase provided.', $code); + default: + throw new Crypt_GPG_Exception( + 'Unknown error signing data. Please use the \'debug\' option ' . + 'when creating the Crypt_GPG object, and file a bug report ' . + 'at ' . self::BUG_URI, $code); + } + + if ($outputFile === null) { + return $output; + } + } + + // }}} + // {{{ _encryptAndSign() + + /** + * Encrypts and signs data + * + * @param string $data the data to be encrypted and signed. + * @param boolean $isFile whether or not the data is a filename. + * @param string $outputFile the name of the file in which the encrypted, + * signed data should be stored. If null, the + * encrypted, signed data is returned as a + * string. + * @param boolean $armor if true, ASCII armored data is returned; + * otherwise, binary data is returned. + * + * @return void|string if the $outputFile parameter is null, a + * string containing the encrypted, signed data is + * returned. + * + * @throws Crypt_GPG_KeyNotFoundException if no encryption key is specified + * or if no signing key is specified. See + * {@link Crypt_GPG::addEncryptKey()} and + * {@link Crypt_GPG::addSignKey()}. + * + * @throws Crypt_GPG_BadPassphraseException if a specified passphrase is + * incorrect or if a required passphrase is not specified. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + private function _encryptAndSign($data, $isFile, $outputFile, $armor) + { + if (count($this->signKeys) === 0) { + throw new Crypt_GPG_KeyNotFoundException( + 'No signing keys specified.'); + } + + if (count($this->encryptKeys) === 0) { + throw new Crypt_GPG_KeyNotFoundException( + 'No encryption keys specified.'); + } + + + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input ' . + 'file "' . $data . '" for encrypting and signing.', 0, + $data); + } + } else { + $input = strval($data); + } + + if ($outputFile === null) { + $output = ''; + } else { + $output = @fopen($outputFile, 'wb'); + if ($output === false) { + if ($isFile) { + fclose($input); + } + throw new Crypt_GPG_FileException('Could not open output ' . + 'file "' . $outputFile . '" for storing encrypted, ' . + 'signed data.', 0, $outputFile); + } + } + + $arguments = ($armor) ? array('--armor') : array(); + + foreach ($this->signKeys as $key) { + $arguments[] = '--local-user ' . + escapeshellarg($key['fingerprint']); + } + + foreach ($this->encryptKeys as $key) { + $arguments[] = '--recipient ' . escapeshellarg($key['fingerprint']); + } + + $this->engine->reset(); + $this->engine->addStatusHandler(array($this, 'handleSignStatus')); + $this->engine->setInput($input); + $this->engine->setOutput($output); + $this->engine->setOperation('--encrypt --sign', $arguments); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + if ($outputFile !== null) { + fclose($output); + } + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + break; + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + throw new Crypt_GPG_KeyNotFoundException( + 'Cannot sign encrypted data. Private key not found. Import '. + 'the private key before trying to sign the encrypted data.', + $code, $this->engine->getErrorKeyId()); + case Crypt_GPG::ERROR_BAD_PASSPHRASE: + throw new Crypt_GPG_BadPassphraseException( + 'Cannot sign encrypted data. Incorrect passphrase provided.', + $code); + case Crypt_GPG::ERROR_MISSING_PASSPHRASE: + throw new Crypt_GPG_BadPassphraseException( + 'Cannot sign encrypted data. No passphrase provided.', $code); + default: + throw new Crypt_GPG_Exception( + 'Unknown error encrypting and signing data. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + + if ($outputFile === null) { + return $output; + } + } + + // }}} + // {{{ _verify() + + /** + * Verifies data + * + * @param string $data the signed data to be verified. + * @param boolean $isFile whether or not the data is a filename. + * @param string $signature if verifying a file signed using a detached + * signature, this must be the detached signature + * data. Otherwise, specify ''. + * + * @return array an array of {@link Crypt_GPG_Signature} objects for the + * signed data. + * + * @throws Crypt_GPG_NoDataException if the provided data is not signed + * data. + * + * @throws Crypt_GPG_FileException if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG_Signature + */ + private function _verify($data, $isFile, $signature) + { + if ($signature == '') { + $operation = '--verify'; + $arguments = array(); + } else { + // Signed data goes in FD_MESSAGE, detached signature data goes in + // FD_INPUT. + $operation = '--verify - "-&' . Crypt_GPG_Engine::FD_MESSAGE. '"'; + $arguments = array('--enable-special-filenames'); + } + + $handler = new Crypt_GPG_VerifyStatusHandler(); + + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input ' . + 'file "' . $data . '" for verifying.', 0, $data); + } + } else { + $input = strval($data); + if ($input == '') { + throw new Crypt_GPG_NoDataException( + 'No valid signature data found.', Crypt_GPG::ERROR_NO_DATA); + } + } + + $this->engine->reset(); + $this->engine->addStatusHandler(array($handler, 'handle')); + + if ($signature == '') { + // signed or clearsigned data + $this->engine->setInput($input); + } else { + // detached signature + $this->engine->setInput($signature); + $this->engine->setMessage($input); + } + + $this->engine->setOperation($operation, $arguments); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + $code = $this->engine->getErrorCode(); + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + case Crypt_GPG::ERROR_BAD_SIGNATURE: + break; + case Crypt_GPG::ERROR_NO_DATA: + throw new Crypt_GPG_NoDataException( + 'No valid signature data found.', $code); + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + throw new Crypt_GPG_KeyNotFoundException( + 'Public key required for data verification not in keyring.', + $code, $this->engine->getErrorKeyId()); + default: + throw new Crypt_GPG_Exception( + 'Unknown error validating signature details. Please use the ' . + '\'debug\' option when creating the Crypt_GPG object, and ' . + 'file a bug report at ' . self::BUG_URI, $code); + } + + return $handler->getSignatures(); + } + + // }}} + // {{{ _decryptAndVerify() + + /** + * Decrypts and verifies encrypted, signed data + * + * @param string $data the encrypted signed data to be decrypted and + * verified. + * @param boolean $isFile whether or not the data is a filename. + * @param string $outputFile the name of the file to which the decrypted + * data should be written. If null, the decrypted + * data is returned in the results array. + * + * @return array two element array. The array has an element 'data' + * containing the decrypted data and an element + * 'signatures' containing an array of + * {@link Crypt_GPG_Signature} objects for the signed data. + * If the decrypted data is written to a file, the 'data' + * element is null. + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring or it the public + * key needed for verification is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG signed, encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_FileException if the output file is not writeable or + * if the input file is not readable. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @see Crypt_GPG_Signature + */ + private function _decryptAndVerify($data, $isFile, $outputFile) + { + if ($isFile) { + $input = @fopen($data, 'rb'); + if ($input === false) { + throw new Crypt_GPG_FileException('Could not open input ' . + 'file "' . $data . '" for decrypting and verifying.', 0, + $data); + } + } else { + $input = strval($data); + if ($input == '') { + throw new Crypt_GPG_NoDataException( + 'No valid encrypted signed data found.', + Crypt_GPG::ERROR_NO_DATA); + } + } + + if ($outputFile === null) { + $output = ''; + } else { + $output = @fopen($outputFile, 'wb'); + if ($output === false) { + if ($isFile) { + fclose($input); + } + throw new Crypt_GPG_FileException('Could not open output ' . + 'file "' . $outputFile . '" for storing decrypted data.', + 0, $outputFile); + } + } + + $verifyHandler = new Crypt_GPG_VerifyStatusHandler(); + + $decryptHandler = new Crypt_GPG_DecryptStatusHandler($this->engine, + $this->decryptKeys); + + $this->engine->reset(); + $this->engine->addStatusHandler(array($verifyHandler, 'handle')); + $this->engine->addStatusHandler(array($decryptHandler, 'handle')); + $this->engine->setInput($input); + $this->engine->setOutput($output); + $this->engine->setOperation('--decrypt'); + $this->engine->run(); + + if ($isFile) { + fclose($input); + } + + if ($outputFile !== null) { + fclose($output); + } + + $return = array( + 'data' => null, + 'signatures' => $verifyHandler->getSignatures() + ); + + // if there was any problem decrypting the data, the handler will + // deal with it here. + try { + $decryptHandler->throwException(); + } catch (Exception $e) { + if ($e instanceof Crypt_GPG_KeyNotFoundException) { + throw new Crypt_GPG_KeyNotFoundException( + 'Public key required for data verification not in ', + 'the keyring. Either no suitable private decryption key ' . + 'is in the keyring or the public key required for data ' . + 'verification is not in the keyring. Import a suitable ' . + 'key before trying to decrypt and verify this data.', + self::ERROR_KEY_NOT_FOUND, $this->engine->getErrorKeyId()); + } + + if ($e instanceof Crypt_GPG_NoDataException) { + throw new Crypt_GPG_NoDataException( + 'Cannot decrypt and verify data. No PGP encrypted data ' . + 'was found in the provided data.', self::ERROR_NO_DATA); + } + + throw $e; + } + + if ($outputFile === null) { + $return['data'] = $output; + } + + return $return; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php b/plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php new file mode 100644 index 0000000..40e8d50 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php @@ -0,0 +1,336 @@ + + * @copyright 2008-2009 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: DecryptStatusHandler.php 302814 2010-08-26 15:43:07Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ + +/** + * Crypt_GPG base class + */ +require_once 'Crypt/GPG.php'; + +/** + * GPG exception classes + */ +require_once 'Crypt/GPG/Exceptions.php'; + + +/** + * Status line handler for the decrypt operation + * + * This class is used internally by Crypt_GPG and does not need be used + * directly. See the {@link Crypt_GPG} class for end-user API. + * + * This class is responsible for sending the passphrase commands when required + * by the {@link Crypt_GPG::decrypt()} method. See doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG distribution} for detailed + * information on GPG's status output for the decrypt operation. + * + * This class is also responsible for parsing error status and throwing a + * meaningful exception in the event that decryption fails. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ +class Crypt_GPG_DecryptStatusHandler +{ + // {{{ protected properties + + /** + * Keys used to decrypt + * + * The array is of the form: + * + * array( + * $key_id => array( + * 'fingerprint' => $fingerprint, + * 'passphrase' => $passphrase + * ) + * ); + * + * + * @var array + */ + protected $keys = array(); + + /** + * Engine used to which passphrases are passed + * + * @var Crypt_GPG_Engine + */ + protected $engine = null; + + /** + * The id of the current sub-key used for decryption + * + * @var string + */ + protected $currentSubKey = ''; + + /** + * Whether or not decryption succeeded + * + * If the message is only signed (compressed) and not encrypted, this is + * always true. If the message is encrypted, this flag is set to false + * until we know the decryption succeeded. + * + * @var boolean + */ + protected $decryptionOkay = true; + + /** + * Whether or not there was no data for decryption + * + * @var boolean + */ + protected $noData = false; + + /** + * Keys for which the passhprase is missing + * + * This contains primary user ids indexed by sub-key id and is used to + * create helpful exception messages. + * + * @var array + */ + protected $missingPassphrases = array(); + + /** + * Keys for which the passhprase is incorrect + * + * This contains primary user ids indexed by sub-key id and is used to + * create helpful exception messages. + * + * @var array + */ + protected $badPassphrases = array(); + + /** + * Keys that can be used to decrypt the data but are missing from the + * keychain + * + * This is an array with both the key and value being the sub-key id of + * the missing keys. + * + * @var array + */ + protected $missingKeys = array(); + + // }}} + // {{{ __construct() + + /** + * Creates a new decryption status handler + * + * @param Crypt_GPG_Engine $engine the GPG engine to which passphrases are + * passed. + * @param array $keys the decryption keys to use. + */ + public function __construct(Crypt_GPG_Engine $engine, array $keys) + { + $this->engine = $engine; + $this->keys = $keys; + } + + // }}} + // {{{ handle() + + /** + * Handles a status line + * + * @param string $line the status line to handle. + * + * @return void + */ + public function handle($line) + { + $tokens = explode(' ', $line); + switch ($tokens[0]) { + case 'ENC_TO': + // Now we know the message is encrypted. Set flag to check if + // decryption succeeded. + $this->decryptionOkay = false; + + // this is the new key message + $this->currentSubKeyId = $tokens[1]; + break; + + case 'NEED_PASSPHRASE': + // send passphrase to the GPG engine + $subKeyId = $tokens[1]; + if (array_key_exists($subKeyId, $this->keys)) { + $passphrase = $this->keys[$subKeyId]['passphrase']; + $this->engine->sendCommand($passphrase); + } else { + $this->engine->sendCommand(''); + } + break; + + case 'USERID_HINT': + // remember the user id for pretty exception messages + $this->badPassphrases[$tokens[1]] + = implode(' ', array_splice($tokens, 2)); + + break; + + case 'GOOD_PASSPHRASE': + // if we got a good passphrase, remove the key from the list of + // bad passphrases. + unset($this->badPassphrases[$this->currentSubKeyId]); + break; + + case 'MISSING_PASSPHRASE': + $this->missingPassphrases[$this->currentSubKeyId] + = $this->currentSubKeyId; + + break; + + case 'NO_SECKEY': + // note: this message is also received if there are multiple + // recipients and a previous key had a correct passphrase. + $this->missingKeys[$tokens[1]] = $tokens[1]; + break; + + case 'NODATA': + $this->noData = true; + break; + + case 'DECRYPTION_OKAY': + // If the message is encrypted, this is the all-clear signal. + $this->decryptionOkay = true; + break; + } + } + + // }}} + // {{{ throwException() + + /** + * Takes the final status of the decrypt operation and throws an + * appropriate exception + * + * If decryption was successful, no exception is thrown. + * + * @return void + * + * @throws Crypt_GPG_KeyNotFoundException if the private key needed to + * decrypt the data is not in the user's keyring. + * + * @throws Crypt_GPG_NoDataException if specified data does not contain + * GPG encrypted data. + * + * @throws Crypt_GPG_BadPassphraseException if a required passphrase is + * incorrect or if a required passphrase is not specified. See + * {@link Crypt_GPG::addDecryptKey()}. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + */ + public function throwException() + { + $code = Crypt_GPG::ERROR_NONE; + + if (!$this->decryptionOkay) { + if (count($this->badPassphrases) > 0) { + $code = Crypt_GPG::ERROR_BAD_PASSPHRASE; + } elseif (count($this->missingKeys) > 0) { + $code = Crypt_GPG::ERROR_KEY_NOT_FOUND; + } else { + $code = Crypt_GPG::ERROR_UNKNOWN; + } + } elseif ($this->noData) { + $code = Crypt_GPG::ERROR_NO_DATA; + } + + switch ($code) { + case Crypt_GPG::ERROR_NONE: + break; + + case Crypt_GPG::ERROR_KEY_NOT_FOUND: + if (count($this->missingKeys) > 0) { + $keyId = reset($this->missingKeys); + } else { + $keyId = ''; + } + throw new Crypt_GPG_KeyNotFoundException( + 'Cannot decrypt data. No suitable private key is in the ' . + 'keyring. Import a suitable private key before trying to ' . + 'decrypt this data.', $code, $keyId); + + case Crypt_GPG::ERROR_BAD_PASSPHRASE: + $badPassphrases = array_diff_key( + $this->badPassphrases, + $this->missingPassphrases + ); + + $missingPassphrases = array_intersect_key( + $this->badPassphrases, + $this->missingPassphrases + ); + + $message = 'Cannot decrypt data.'; + if (count($badPassphrases) > 0) { + $message = ' Incorrect passphrase provided for keys: "' . + implode('", "', $badPassphrases) . '".'; + } + if (count($missingPassphrases) > 0) { + $message = ' No passphrase provided for keys: "' . + implode('", "', $badPassphrases) . '".'; + } + + throw new Crypt_GPG_BadPassphraseException($message, $code, + $badPassphrases, $missingPassphrases); + + case Crypt_GPG::ERROR_NO_DATA: + throw new Crypt_GPG_NoDataException( + 'Cannot decrypt data. No PGP encrypted data was found in '. + 'the provided data.', $code); + + default: + throw new Crypt_GPG_Exception( + 'Unknown error decrypting data.', $code); + } + } + + // }}} +} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/Engine.php b/plugins/enigma/lib/Crypt/GPG/Engine.php new file mode 100644 index 0000000..081be8e --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/Engine.php @@ -0,0 +1,1758 @@ + + * @author Michael Gauthier + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Engine.php 302822 2010-08-26 17:30:57Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ + +/** + * Crypt_GPG base class. + */ +require_once 'Crypt/GPG.php'; + +/** + * GPG exception classes. + */ +require_once 'Crypt/GPG/Exceptions.php'; + +/** + * Standard PEAR exception is used if GPG binary is not found. + */ +require_once 'PEAR/Exception.php'; + +// {{{ class Crypt_GPG_Engine + +/** + * Native PHP Crypt_GPG I/O engine + * + * This class is used internally by Crypt_GPG and does not need be used + * directly. See the {@link Crypt_GPG} class for end-user API. + * + * This engine uses PHP's native process control functions to directly control + * the GPG process. The GPG executable is required to be on the system. + * + * All data is passed to the GPG subprocess using file descriptors. This is the + * most secure method of passing data to the GPG subprocess. + * + * @category Encryption + * @package Crypt_GPG + * @author Nathan Fredrickson + * @author Michael Gauthier + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ +class Crypt_GPG_Engine +{ + // {{{ constants + + /** + * Size of data chunks that are sent to and retrieved from the IPC pipes. + * + * PHP reads 8192 bytes. If this is set to less than 8192, PHP reads 8192 + * and buffers the rest so we might as well just read 8192. + * + * Using values other than 8192 also triggers PHP bugs. + * + * @see http://bugs.php.net/bug.php?id=35224 + */ + const CHUNK_SIZE = 8192; + + /** + * Standard input file descriptor. This is used to pass data to the GPG + * process. + */ + const FD_INPUT = 0; + + /** + * Standard output file descriptor. This is used to receive normal output + * from the GPG process. + */ + const FD_OUTPUT = 1; + + /** + * Standard output file descriptor. This is used to receive error output + * from the GPG process. + */ + const FD_ERROR = 2; + + /** + * GPG status output file descriptor. The status file descriptor outputs + * detailed information for many GPG commands. See the second section of + * the file doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG package} for a detailed + * description of GPG's status output. + */ + const FD_STATUS = 3; + + /** + * Command input file descriptor. This is used for methods requiring + * passphrases. + */ + const FD_COMMAND = 4; + + /** + * Extra message input file descriptor. This is used for passing signed + * data when verifying a detached signature. + */ + const FD_MESSAGE = 5; + + /** + * Minimum version of GnuPG that is supported. + */ + const MIN_VERSION = '1.0.2'; + + // }}} + // {{{ private class properties + + /** + * Whether or not to use debugging mode + * + * When set to true, every GPG command is echoed before it is run. Sensitive + * data is always handled using pipes and is not specified as part of the + * command. As a result, sensitive data is never displayed when debug is + * enabled. Sensitive data includes private key data and passphrases. + * + * Debugging is off by default. + * + * @var boolean + * @see Crypt_GPG_Engine::__construct() + */ + private $_debug = false; + + /** + * Location of GPG binary + * + * @var string + * @see Crypt_GPG_Engine::__construct() + * @see Crypt_GPG_Engine::_getBinary() + */ + private $_binary = ''; + + /** + * Directory containing the GPG key files + * + * This property only contains the path when the homedir option + * is specified in the constructor. + * + * @var string + * @see Crypt_GPG_Engine::__construct() + */ + private $_homedir = ''; + + /** + * File path of the public keyring + * + * This property only contains the file path when the public_keyring + * option is specified in the constructor. + * + * If the specified file path starts with ~/, the path is + * relative to the homedir if specified, otherwise to + * ~/.gnupg. + * + * @var string + * @see Crypt_GPG_Engine::__construct() + */ + private $_publicKeyring = ''; + + /** + * File path of the private (secret) keyring + * + * This property only contains the file path when the private_keyring + * option is specified in the constructor. + * + * If the specified file path starts with ~/, the path is + * relative to the homedir if specified, otherwise to + * ~/.gnupg. + * + * @var string + * @see Crypt_GPG_Engine::__construct() + */ + private $_privateKeyring = ''; + + /** + * File path of the trust database + * + * This property only contains the file path when the trust_db + * option is specified in the constructor. + * + * If the specified file path starts with ~/, the path is + * relative to the homedir if specified, otherwise to + * ~/.gnupg. + * + * @var string + * @see Crypt_GPG_Engine::__construct() + */ + private $_trustDb = ''; + + /** + * Array of pipes used for communication with the GPG binary + * + * This is an array of file descriptor resources. + * + * @var array + */ + private $_pipes = array(); + + /** + * Array of currently opened pipes + * + * This array is used to keep track of remaining opened pipes so they can + * be closed when the GPG subprocess is finished. This array is a subset of + * the {@link Crypt_GPG_Engine::$_pipes} array and contains opened file + * descriptor resources. + * + * @var array + * @see Crypt_GPG_Engine::_closePipe() + */ + private $_openPipes = array(); + + /** + * A handle for the GPG process + * + * @var resource + */ + private $_process = null; + + /** + * Whether or not the operating system is Darwin (OS X) + * + * @var boolean + */ + private $_isDarwin = false; + + /** + * Commands to be sent to GPG's command input stream + * + * @var string + * @see Crypt_GPG_Engine::sendCommand() + */ + private $_commandBuffer = ''; + + /** + * Array of status line handlers + * + * @var array + * @see Crypt_GPG_Engine::addStatusHandler() + */ + private $_statusHandlers = array(); + + /** + * Array of error line handlers + * + * @var array + * @see Crypt_GPG_Engine::addErrorHandler() + */ + private $_errorHandlers = array(); + + /** + * The error code of the current operation + * + * @var integer + * @see Crypt_GPG_Engine::getErrorCode() + */ + private $_errorCode = Crypt_GPG::ERROR_NONE; + + /** + * File related to the error code of the current operation + * + * @var string + * @see Crypt_GPG_Engine::getErrorFilename() + */ + private $_errorFilename = ''; + + /** + * Key id related to the error code of the current operation + * + * @var string + * @see Crypt_GPG_Engine::getErrorKeyId() + */ + private $_errorkeyId = ''; + + /** + * The number of currently needed passphrases + * + * If this is not zero when the GPG command is completed, the error code is + * set to {@link Crypt_GPG::ERROR_MISSING_PASSPHRASE}. + * + * @var integer + */ + private $_needPassphrase = 0; + + /** + * The input source + * + * This is data to send to GPG. Either a string or a stream resource. + * + * @var string|resource + * @see Crypt_GPG_Engine::setInput() + */ + private $_input = null; + + /** + * The extra message input source + * + * Either a string or a stream resource. + * + * @var string|resource + * @see Crypt_GPG_Engine::setMessage() + */ + private $_message = null; + + /** + * The output location + * + * This is where the output from GPG is sent. Either a string or a stream + * resource. + * + * @var string|resource + * @see Crypt_GPG_Engine::setOutput() + */ + private $_output = ''; + + /** + * The GPG operation to execute + * + * @var string + * @see Crypt_GPG_Engine::setOperation() + */ + private $_operation; + + /** + * Arguments for the current operation + * + * @var array + * @see Crypt_GPG_Engine::setOperation() + */ + private $_arguments = array(); + + /** + * The version number of the GPG binary + * + * @var string + * @see Crypt_GPG_Engine::getVersion() + */ + private $_version = ''; + + /** + * Cached value indicating whether or not mbstring function overloading is + * on for strlen + * + * This is cached for optimal performance inside the I/O loop. + * + * @var boolean + * @see Crypt_GPG_Engine::_byteLength() + * @see Crypt_GPG_Engine::_byteSubstring() + */ + private static $_mbStringOverload = null; + + // }}} + // {{{ __construct() + + /** + * Creates a new GPG engine + * + * Available options are: + * + * - string homedir - the directory where the GPG + * keyring files are stored. If not + * specified, Crypt_GPG uses the + * default of ~/.gnupg. + * - string publicKeyring - the file path of the public + * keyring. Use this if the public + * keyring is not in the homedir, or + * if the keyring is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * keyring with this option + * (/foo/bar/pubring.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string privateKeyring - the file path of the private + * keyring. Use this if the private + * keyring is not in the homedir, or + * if the keyring is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * keyring with this option + * (/foo/bar/secring.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string trustDb - the file path of the web-of-trust + * database. Use this if the trust + * database is not in the homedir, or + * if the database is in a directory + * not writable by the process + * invoking GPG (like Apache). Then + * you can specify the path to the + * trust database with this option + * (/foo/bar/trustdb.gpg), and specify + * a writable directory (like /tmp) + * using the homedir option. + * - string binary - the location of the GPG binary. If + * not specified, the driver attempts + * to auto-detect the GPG binary + * location using a list of known + * default locations for the current + * operating system. The option + * gpgBinary is a + * deprecated alias for this option. + * - boolean debug - whether or not to use debug mode. + * When debug mode is on, all + * communication to and from the GPG + * subprocess is logged. This can be + * useful to diagnose errors when + * using Crypt_GPG. + * + * @param array $options optional. An array of options used to create the + * GPG object. All options are optional and are + * represented as key-value pairs. + * + * @throws Crypt_GPG_FileException if the homedir does not exist + * and cannot be created. This can happen if homedir is + * not specified, Crypt_GPG is run as the web user, and the web + * user has no home directory. This exception is also thrown if any + * of the options publicKeyring, + * privateKeyring or trustDb options are + * specified but the files do not exist or are are not readable. + * This can happen if the user running the Crypt_GPG process (for + * example, the Apache user) does not have permission to read the + * files. + * + * @throws PEAR_Exception if the provided binary is invalid, or + * if no binary is provided and no suitable binary could + * be found. + */ + public function __construct(array $options = array()) + { + $this->_isDarwin = (strncmp(strtoupper(PHP_OS), 'DARWIN', 6) === 0); + + // populate mbstring overloading cache if not set + if (self::$_mbStringOverload === null) { + self::$_mbStringOverload = (extension_loaded('mbstring') + && (ini_get('mbstring.func_overload') & 0x02) === 0x02); + } + + // get homedir + if (array_key_exists('homedir', $options)) { + $this->_homedir = (string)$options['homedir']; + } else { + // note: this requires the package OS dep exclude 'windows' + $info = posix_getpwuid(posix_getuid()); + $this->_homedir = $info['dir'].'/.gnupg'; + } + + // attempt to create homedir if it does not exist + if (!is_dir($this->_homedir)) { + if (@mkdir($this->_homedir, 0777, true)) { + // Set permissions on homedir. Parent directories are created + // with 0777, homedir is set to 0700. + chmod($this->_homedir, 0700); + } else { + throw new Crypt_GPG_FileException('The \'homedir\' "' . + $this->_homedir . '" is not readable or does not exist '. + 'and cannot be created. This can happen if \'homedir\' '. + 'is not specified in the Crypt_GPG options, Crypt_GPG is '. + 'run as the web user, and the web user has no home '. + 'directory.', + 0, $this->_homedir); + } + } + + // get binary + if (array_key_exists('binary', $options)) { + $this->_binary = (string)$options['binary']; + } elseif (array_key_exists('gpgBinary', $options)) { + // deprecated alias + $this->_binary = (string)$options['gpgBinary']; + } else { + $this->_binary = $this->_getBinary(); + } + + if ($this->_binary == '' || !is_executable($this->_binary)) { + throw new PEAR_Exception('GPG binary not found. If you are sure '. + 'the GPG binary is installed, please specify the location of '. + 'the GPG binary using the \'binary\' driver option.'); + } + + /* + * Note: + * + * Normally, GnuPG expects keyrings to be in the homedir and expects + * to be able to write temporary files in the homedir. Sometimes, + * keyrings are not in the homedir, or location of the keyrings does + * not allow writing temporary files. In this case, the homedir + * option by itself is not enough to specify the keyrings because GnuPG + * can not write required temporary files. Additional options are + * provided so you can specify the location of the keyrings separately + * from the homedir. + */ + + // get public keyring + if (array_key_exists('publicKeyring', $options)) { + $this->_publicKeyring = (string)$options['publicKeyring']; + if (!is_readable($this->_publicKeyring)) { + throw new Crypt_GPG_FileException('The \'publicKeyring\' "' . + $this->_publicKeyring . '" does not exist or is ' . + 'not readable. Check the location and ensure the file ' . + 'permissions are correct.', 0, $this->_publicKeyring); + } + } + + // get private keyring + if (array_key_exists('privateKeyring', $options)) { + $this->_privateKeyring = (string)$options['privateKeyring']; + if (!is_readable($this->_privateKeyring)) { + throw new Crypt_GPG_FileException('The \'privateKeyring\' "' . + $this->_privateKeyring . '" does not exist or is ' . + 'not readable. Check the location and ensure the file ' . + 'permissions are correct.', 0, $this->_privateKeyring); + } + } + + // get trust database + if (array_key_exists('trustDb', $options)) { + $this->_trustDb = (string)$options['trustDb']; + if (!is_readable($this->_trustDb)) { + throw new Crypt_GPG_FileException('The \'trustDb\' "' . + $this->_trustDb . '" does not exist or is not readable. ' . + 'Check the location and ensure the file permissions are ' . + 'correct.', 0, $this->_trustDb); + } + } + + if (array_key_exists('debug', $options)) { + $this->_debug = (boolean)$options['debug']; + } + } + + // }}} + // {{{ __destruct() + + /** + * Closes open GPG subprocesses when this object is destroyed + * + * Subprocesses should never be left open by this class unless there is + * an unknown error and unexpected script termination occurs. + */ + public function __destruct() + { + $this->_closeSubprocess(); + } + + // }}} + // {{{ addErrorHandler() + + /** + * Adds an error handler method + * + * The method is run every time a new error line is received from the GPG + * subprocess. The handler method must accept the error line to be handled + * as its first parameter. + * + * @param callback $callback the callback method to use. + * @param array $args optional. Additional arguments to pass as + * parameters to the callback method. + * + * @return void + */ + public function addErrorHandler($callback, array $args = array()) + { + $this->_errorHandlers[] = array( + 'callback' => $callback, + 'args' => $args + ); + } + + // }}} + // {{{ addStatusHandler() + + /** + * Adds a status handler method + * + * The method is run every time a new status line is received from the + * GPG subprocess. The handler method must accept the status line to be + * handled as its first parameter. + * + * @param callback $callback the callback method to use. + * @param array $args optional. Additional arguments to pass as + * parameters to the callback method. + * + * @return void + */ + public function addStatusHandler($callback, array $args = array()) + { + $this->_statusHandlers[] = array( + 'callback' => $callback, + 'args' => $args + ); + } + + // }}} + // {{{ sendCommand() + + /** + * Sends a command to the GPG subprocess over the command file-descriptor + * pipe + * + * @param string $command the command to send. + * + * @return void + * + * @sensitive $command + */ + public function sendCommand($command) + { + if (array_key_exists(self::FD_COMMAND, $this->_openPipes)) { + $this->_commandBuffer .= $command . PHP_EOL; + } + } + + // }}} + // {{{ reset() + + /** + * Resets the GPG engine, preparing it for a new operation + * + * @return void + * + * @see Crypt_GPG_Engine::run() + * @see Crypt_GPG_Engine::setOperation() + */ + public function reset() + { + $this->_operation = ''; + $this->_arguments = array(); + $this->_input = null; + $this->_message = null; + $this->_output = ''; + $this->_errorCode = Crypt_GPG::ERROR_NONE; + $this->_needPassphrase = 0; + $this->_commandBuffer = ''; + + $this->_statusHandlers = array(); + $this->_errorHandlers = array(); + + $this->addStatusHandler(array($this, '_handleErrorStatus')); + $this->addErrorHandler(array($this, '_handleErrorError')); + + if ($this->_debug) { + $this->addStatusHandler(array($this, '_handleDebugStatus')); + $this->addErrorHandler(array($this, '_handleDebugError')); + } + } + + // }}} + // {{{ run() + + /** + * Runs the current GPG operation + * + * This creates and manages the GPG subprocess. + * + * The operation must be set with {@link Crypt_GPG_Engine::setOperation()} + * before this method is called. + * + * @return void + * + * @throws Crypt_GPG_InvalidOperationException if no operation is specified. + * + * @see Crypt_GPG_Engine::reset() + * @see Crypt_GPG_Engine::setOperation() + */ + public function run() + { + if ($this->_operation === '') { + throw new Crypt_GPG_InvalidOperationException('No GPG operation ' . + 'specified. Use Crypt_GPG_Engine::setOperation() before ' . + 'calling Crypt_GPG_Engine::run().'); + } + + $this->_openSubprocess(); + $this->_process(); + $this->_closeSubprocess(); + } + + // }}} + // {{{ getErrorCode() + + /** + * Gets the error code of the last executed operation + * + * This value is only meaningful after {@link Crypt_GPG_Engine::run()} has + * been executed. + * + * @return integer the error code of the last executed operation. + */ + public function getErrorCode() + { + return $this->_errorCode; + } + + // }}} + // {{{ getErrorFilename() + + /** + * Gets the file related to the error code of the last executed operation + * + * This value is only meaningful after {@link Crypt_GPG_Engine::run()} has + * been executed. If there is no file related to the error, an empty string + * is returned. + * + * @return string the file related to the error code of the last executed + * operation. + */ + public function getErrorFilename() + { + return $this->_errorFilename; + } + + // }}} + // {{{ getErrorKeyId() + + /** + * Gets the key id related to the error code of the last executed operation + * + * This value is only meaningful after {@link Crypt_GPG_Engine::run()} has + * been executed. If there is no key id related to the error, an empty + * string is returned. + * + * @return string the key id related to the error code of the last executed + * operation. + */ + public function getErrorKeyId() + { + return $this->_errorKeyId; + } + + // }}} + // {{{ setInput() + + /** + * Sets the input source for the current GPG operation + * + * @param string|resource &$input either a reference to the string + * containing the input data or an open + * stream resource containing the input + * data. + * + * @return void + */ + public function setInput(&$input) + { + $this->_input =& $input; + } + + // }}} + // {{{ setMessage() + + /** + * Sets the message source for the current GPG operation + * + * Detached signature data should be specified here. + * + * @param string|resource &$message either a reference to the string + * containing the message data or an open + * stream resource containing the message + * data. + * + * @return void + */ + public function setMessage(&$message) + { + $this->_message =& $message; + } + + // }}} + // {{{ setOutput() + + /** + * Sets the output destination for the current GPG operation + * + * @param string|resource &$output either a reference to the string in + * which to store GPG output or an open + * stream resource to which the output data + * should be written. + * + * @return void + */ + public function setOutput(&$output) + { + $this->_output =& $output; + } + + // }}} + // {{{ setOperation() + + /** + * Sets the operation to perform + * + * @param string $operation the operation to perform. This should be one + * of GPG's operations. For example, + * --encrypt, --decrypt, + * --sign, etc. + * @param array $arguments optional. Additional arguments for the GPG + * subprocess. See the GPG manual for specific + * values. + * + * @return void + * + * @see Crypt_GPG_Engine::reset() + * @see Crypt_GPG_Engine::run() + */ + public function setOperation($operation, array $arguments = array()) + { + $this->_operation = $operation; + $this->_arguments = $arguments; + } + + // }}} + // {{{ getVersion() + + /** + * Gets the version of the GnuPG binary + * + * @return string a version number string containing the version of GnuPG + * being used. This value is suitable to use with PHP's + * version_compare() function. + * + * @throws Crypt_GPG_Exception if an unknown or unexpected error occurs. + * Use the debug option and file a bug report if these + * exceptions occur. + * + * @throws Crypt_GPG_UnsupportedException if the provided binary is not + * GnuPG or if the GnuPG version is less than 1.0.2. + */ + public function getVersion() + { + if ($this->_version == '') { + + $options = array( + 'homedir' => $this->_homedir, + 'binary' => $this->_binary, + 'debug' => $this->_debug + ); + + $engine = new self($options); + $info = ''; + + // Set a garbage version so we do not end up looking up the version + // recursively. + $engine->_version = '1.0.0'; + + $engine->reset(); + $engine->setOutput($info); + $engine->setOperation('--version'); + $engine->run(); + + $code = $this->getErrorCode(); + + if ($code !== Crypt_GPG::ERROR_NONE) { + throw new Crypt_GPG_Exception( + 'Unknown error getting GnuPG version information. Please ' . + 'use the \'debug\' option when creating the Crypt_GPG ' . + 'object, and file a bug report at ' . Crypt_GPG::BUG_URI, + $code); + } + + $matches = array(); + $expression = '/gpg \(GnuPG\) (\S+)/'; + + if (preg_match($expression, $info, $matches) === 1) { + $this->_version = $matches[1]; + } else { + throw new Crypt_GPG_Exception( + 'No GnuPG version information provided by the binary "' . + $this->_binary . '". Are you sure it is GnuPG?'); + } + + if (version_compare($this->_version, self::MIN_VERSION, 'lt')) { + throw new Crypt_GPG_Exception( + 'The version of GnuPG being used (' . $this->_version . + ') is not supported by Crypt_GPG. The minimum version ' . + 'required by Crypt_GPG is ' . self::MIN_VERSION); + } + } + + + return $this->_version; + } + + // }}} + // {{{ _handleErrorStatus() + + /** + * Handles error values in the status output from GPG + * + * This method is responsible for setting the + * {@link Crypt_GPG_Engine::$_errorCode}. See doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG distribution} for detailed + * information on GPG's status output. + * + * @param string $line the status line to handle. + * + * @return void + */ + private function _handleErrorStatus($line) + { + $tokens = explode(' ', $line); + switch ($tokens[0]) { + case 'BAD_PASSPHRASE': + $this->_errorCode = Crypt_GPG::ERROR_BAD_PASSPHRASE; + break; + + case 'MISSING_PASSPHRASE': + $this->_errorCode = Crypt_GPG::ERROR_MISSING_PASSPHRASE; + break; + + case 'NODATA': + $this->_errorCode = Crypt_GPG::ERROR_NO_DATA; + break; + + case 'DELETE_PROBLEM': + if ($tokens[1] == '1') { + $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND; + break; + } elseif ($tokens[1] == '2') { + $this->_errorCode = Crypt_GPG::ERROR_DELETE_PRIVATE_KEY; + break; + } + break; + + case 'IMPORT_RES': + if ($tokens[12] > 0) { + $this->_errorCode = Crypt_GPG::ERROR_DUPLICATE_KEY; + } + break; + + case 'NO_PUBKEY': + case 'NO_SECKEY': + $this->_errorKeyId = $tokens[1]; + $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND; + break; + + case 'NEED_PASSPHRASE': + $this->_needPassphrase++; + break; + + case 'GOOD_PASSPHRASE': + $this->_needPassphrase--; + break; + + case 'EXPSIG': + case 'EXPKEYSIG': + case 'REVKEYSIG': + case 'BADSIG': + $this->_errorCode = Crypt_GPG::ERROR_BAD_SIGNATURE; + break; + + } + } + + // }}} + // {{{ _handleErrorError() + + /** + * Handles error values in the error output from GPG + * + * This method is responsible for setting the + * {@link Crypt_GPG_Engine::$_errorCode}. + * + * @param string $line the error line to handle. + * + * @return void + */ + private function _handleErrorError($line) + { + if ($this->_errorCode === Crypt_GPG::ERROR_NONE) { + $pattern = '/no valid OpenPGP data found/'; + if (preg_match($pattern, $line) === 1) { + $this->_errorCode = Crypt_GPG::ERROR_NO_DATA; + } + } + + if ($this->_errorCode === Crypt_GPG::ERROR_NONE) { + $pattern = '/No secret key|secret key not available/'; + if (preg_match($pattern, $line) === 1) { + $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND; + } + } + + if ($this->_errorCode === Crypt_GPG::ERROR_NONE) { + $pattern = '/No public key|public key not found/'; + if (preg_match($pattern, $line) === 1) { + $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND; + } + } + + if ($this->_errorCode === Crypt_GPG::ERROR_NONE) { + $matches = array(); + $pattern = '/can\'t (?:access|open) `(.*?)\'/'; + if (preg_match($pattern, $line, $matches) === 1) { + $this->_errorFilename = $matches[1]; + $this->_errorCode = Crypt_GPG::ERROR_FILE_PERMISSIONS; + } + } + } + + // }}} + // {{{ _handleDebugStatus() + + /** + * Displays debug output for status lines + * + * @param string $line the status line to handle. + * + * @return void + */ + private function _handleDebugStatus($line) + { + $this->_debug('STATUS: ' . $line); + } + + // }}} + // {{{ _handleDebugError() + + /** + * Displays debug output for error lines + * + * @param string $line the error line to handle. + * + * @return void + */ + private function _handleDebugError($line) + { + $this->_debug('ERROR: ' . $line); + } + + // }}} + // {{{ _process() + + /** + * Performs internal streaming operations for the subprocess using either + * strings or streams as input / output points + * + * This is the main I/O loop for streaming to and from the GPG subprocess. + * + * The implementation of this method is verbose mainly for performance + * reasons. Adding streams to a lookup array and looping the array inside + * the main I/O loop would be siginficantly slower for large streams. + * + * @return void + * + * @throws Crypt_GPG_Exception if there is an error selecting streams for + * reading or writing. If this occurs, please file a bug report at + * http://pear.php.net/bugs/report.php?package=Crypt_GPG. + */ + private function _process() + { + $this->_debug('BEGIN PROCESSING'); + + $this->_commandBuffer = ''; // buffers input to GPG + $messageBuffer = ''; // buffers input to GPG + $inputBuffer = ''; // buffers input to GPG + $outputBuffer = ''; // buffers output from GPG + $statusBuffer = ''; // buffers output from GPG + $errorBuffer = ''; // buffers output from GPG + $inputComplete = false; // input stream is completely buffered + $messageComplete = false; // message stream is completely buffered + + if (is_string($this->_input)) { + $inputBuffer = $this->_input; + $inputComplete = true; + } + + if (is_string($this->_message)) { + $messageBuffer = $this->_message; + $messageComplete = true; + } + + if (is_string($this->_output)) { + $outputBuffer =& $this->_output; + } + + // convenience variables + $fdInput = $this->_pipes[self::FD_INPUT]; + $fdOutput = $this->_pipes[self::FD_OUTPUT]; + $fdError = $this->_pipes[self::FD_ERROR]; + $fdStatus = $this->_pipes[self::FD_STATUS]; + $fdCommand = $this->_pipes[self::FD_COMMAND]; + $fdMessage = $this->_pipes[self::FD_MESSAGE]; + + while (true) { + + $inputStreams = array(); + $outputStreams = array(); + $exceptionStreams = array(); + + // set up input streams + if (is_resource($this->_input) && !$inputComplete) { + if (feof($this->_input)) { + $inputComplete = true; + } else { + $inputStreams[] = $this->_input; + } + } + + // close GPG input pipe if there is no more data + if ($inputBuffer == '' && $inputComplete) { + $this->_debug('=> closing GPG input pipe'); + $this->_closePipe(self::FD_INPUT); + } + + if (is_resource($this->_message) && !$messageComplete) { + if (feof($this->_message)) { + $messageComplete = true; + } else { + $inputStreams[] = $this->_message; + } + } + + // close GPG message pipe if there is no more data + if ($messageBuffer == '' && $messageComplete) { + $this->_debug('=> closing GPG message pipe'); + $this->_closePipe(self::FD_MESSAGE); + } + + if (!feof($fdOutput)) { + $inputStreams[] = $fdOutput; + } + + if (!feof($fdStatus)) { + $inputStreams[] = $fdStatus; + } + + if (!feof($fdError)) { + $inputStreams[] = $fdError; + } + + // set up output streams + if ($outputBuffer != '' && is_resource($this->_output)) { + $outputStreams[] = $this->_output; + } + + if ($this->_commandBuffer != '') { + $outputStreams[] = $fdCommand; + } + + if ($messageBuffer != '') { + $outputStreams[] = $fdMessage; + } + + if ($inputBuffer != '') { + $outputStreams[] = $fdInput; + } + + // no streams left to read or write, we're all done + if (count($inputStreams) === 0 && count($outputStreams) === 0) { + break; + } + + $this->_debug('selecting streams'); + + $ready = stream_select( + $inputStreams, + $outputStreams, + $exceptionStreams, + null + ); + + $this->_debug('=> got ' . $ready); + + if ($ready === false) { + throw new Crypt_GPG_Exception( + 'Error selecting stream for communication with GPG ' . + 'subprocess. Please file a bug report at: ' . + 'http://pear.php.net/bugs/report.php?package=Crypt_GPG'); + } + + if ($ready === 0) { + throw new Crypt_GPG_Exception( + 'stream_select() returned 0. This can not happen! Please ' . + 'file a bug report at: ' . + 'http://pear.php.net/bugs/report.php?package=Crypt_GPG'); + } + + // write input (to GPG) + if (in_array($fdInput, $outputStreams)) { + $this->_debug('GPG is ready for input'); + + $chunk = self::_byteSubstring( + $inputBuffer, + 0, + self::CHUNK_SIZE + ); + + $length = self::_byteLength($chunk); + + $this->_debug( + '=> about to write ' . $length . ' bytes to GPG input' + ); + + $length = fwrite($fdInput, $chunk, $length); + + $this->_debug('=> wrote ' . $length . ' bytes'); + + $inputBuffer = self::_byteSubstring( + $inputBuffer, + $length + ); + } + + // read input (from PHP stream) + if (in_array($this->_input, $inputStreams)) { + $this->_debug('input stream is ready for reading'); + $this->_debug( + '=> about to read ' . self::CHUNK_SIZE . + ' bytes from input stream' + ); + + $chunk = fread($this->_input, self::CHUNK_SIZE); + $length = self::_byteLength($chunk); + $inputBuffer .= $chunk; + + $this->_debug('=> read ' . $length . ' bytes'); + } + + // write message (to GPG) + if (in_array($fdMessage, $outputStreams)) { + $this->_debug('GPG is ready for message data'); + + $chunk = self::_byteSubstring( + $messageBuffer, + 0, + self::CHUNK_SIZE + ); + + $length = self::_byteLength($chunk); + + $this->_debug( + '=> about to write ' . $length . ' bytes to GPG message' + ); + + $length = fwrite($fdMessage, $chunk, $length); + $this->_debug('=> wrote ' . $length . ' bytes'); + + $messageBuffer = self::_byteSubstring($messageBuffer, $length); + } + + // read message (from PHP stream) + if (in_array($this->_message, $inputStreams)) { + $this->_debug('message stream is ready for reading'); + $this->_debug( + '=> about to read ' . self::CHUNK_SIZE . + ' bytes from message stream' + ); + + $chunk = fread($this->_message, self::CHUNK_SIZE); + $length = self::_byteLength($chunk); + $messageBuffer .= $chunk; + + $this->_debug('=> read ' . $length . ' bytes'); + } + + // read output (from GPG) + if (in_array($fdOutput, $inputStreams)) { + $this->_debug('GPG output stream ready for reading'); + $this->_debug( + '=> about to read ' . self::CHUNK_SIZE . + ' bytes from GPG output' + ); + + $chunk = fread($fdOutput, self::CHUNK_SIZE); + $length = self::_byteLength($chunk); + $outputBuffer .= $chunk; + + $this->_debug('=> read ' . $length . ' bytes'); + } + + // write output (to PHP stream) + if (in_array($this->_output, $outputStreams)) { + $this->_debug('output stream is ready for data'); + + $chunk = self::_byteSubstring( + $outputBuffer, + 0, + self::CHUNK_SIZE + ); + + $length = self::_byteLength($chunk); + + $this->_debug( + '=> about to write ' . $length . ' bytes to output stream' + ); + + $length = fwrite($this->_output, $chunk, $length); + + $this->_debug('=> wrote ' . $length . ' bytes'); + + $outputBuffer = self::_byteSubstring($outputBuffer, $length); + } + + // read error (from GPG) + if (in_array($fdError, $inputStreams)) { + $this->_debug('GPG error stream ready for reading'); + $this->_debug( + '=> about to read ' . self::CHUNK_SIZE . + ' bytes from GPG error' + ); + + $chunk = fread($fdError, self::CHUNK_SIZE); + $length = self::_byteLength($chunk); + $errorBuffer .= $chunk; + + $this->_debug('=> read ' . $length . ' bytes'); + + // pass lines to error handlers + while (($pos = strpos($errorBuffer, PHP_EOL)) !== false) { + $line = self::_byteSubstring($errorBuffer, 0, $pos); + foreach ($this->_errorHandlers as $handler) { + array_unshift($handler['args'], $line); + call_user_func_array( + $handler['callback'], + $handler['args'] + ); + + array_shift($handler['args']); + } + $errorBuffer = self::_byteSubString( + $errorBuffer, + $pos + self::_byteLength(PHP_EOL) + ); + } + } + + // read status (from GPG) + if (in_array($fdStatus, $inputStreams)) { + $this->_debug('GPG status stream ready for reading'); + $this->_debug( + '=> about to read ' . self::CHUNK_SIZE . + ' bytes from GPG status' + ); + + $chunk = fread($fdStatus, self::CHUNK_SIZE); + $length = self::_byteLength($chunk); + $statusBuffer .= $chunk; + + $this->_debug('=> read ' . $length . ' bytes'); + + // pass lines to status handlers + while (($pos = strpos($statusBuffer, PHP_EOL)) !== false) { + $line = self::_byteSubstring($statusBuffer, 0, $pos); + // only pass lines beginning with magic prefix + if (self::_byteSubstring($line, 0, 9) == '[GNUPG:] ') { + $line = self::_byteSubstring($line, 9); + foreach ($this->_statusHandlers as $handler) { + array_unshift($handler['args'], $line); + call_user_func_array( + $handler['callback'], + $handler['args'] + ); + + array_shift($handler['args']); + } + } + $statusBuffer = self::_byteSubString( + $statusBuffer, + $pos + self::_byteLength(PHP_EOL) + ); + } + } + + // write command (to GPG) + if (in_array($fdCommand, $outputStreams)) { + $this->_debug('GPG is ready for command data'); + + // send commands + $chunk = self::_byteSubstring( + $this->_commandBuffer, + 0, + self::CHUNK_SIZE + ); + + $length = self::_byteLength($chunk); + + $this->_debug( + '=> about to write ' . $length . ' bytes to GPG command' + ); + + $length = fwrite($fdCommand, $chunk, $length); + + $this->_debug('=> wrote ' . $length); + + $this->_commandBuffer = self::_byteSubstring( + $this->_commandBuffer, + $length + ); + } + + } // end loop while streams are open + + $this->_debug('END PROCESSING'); + } + + // }}} + // {{{ _openSubprocess() + + /** + * Opens an internal GPG subprocess for the current operation + * + * Opens a GPG subprocess, then connects the subprocess to some pipes. Sets + * the private class property {@link Crypt_GPG_Engine::$_process} to + * the new subprocess. + * + * @return void + * + * @throws Crypt_GPG_OpenSubprocessException if the subprocess could not be + * opened. + * + * @see Crypt_GPG_Engine::setOperation() + * @see Crypt_GPG_Engine::_closeSubprocess() + * @see Crypt_GPG_Engine::$_process + */ + private function _openSubprocess() + { + $version = $this->getVersion(); + + $env = $_ENV; + + // Newer versions of GnuPG return localized results. Crypt_GPG only + // works with English, so set the locale to 'C' for the subprocess. + $env['LC_ALL'] = 'C'; + + $commandLine = $this->_binary; + + $defaultArguments = array( + '--status-fd ' . escapeshellarg(self::FD_STATUS), + '--command-fd ' . escapeshellarg(self::FD_COMMAND), + '--no-secmem-warning', + '--no-tty', + '--no-default-keyring', // ignored if keying files are not specified + '--no-options' // prevent creation of ~/.gnupg directory + ); + + if (version_compare($version, '1.0.7', 'ge')) { + if (version_compare($version, '2.0.0', 'lt')) { + $defaultArguments[] = '--no-use-agent'; + } + $defaultArguments[] = '--no-permission-warning'; + } + + if (version_compare($version, '1.4.2', 'ge')) { + $defaultArguments[] = '--exit-on-status-write-error'; + } + + if (version_compare($version, '1.3.2', 'ge')) { + $defaultArguments[] = '--trust-model always'; + } else { + $defaultArguments[] = '--always-trust'; + } + + $arguments = array_merge($defaultArguments, $this->_arguments); + + if ($this->_homedir) { + $arguments[] = '--homedir ' . escapeshellarg($this->_homedir); + + // the random seed file makes subsequent actions faster so only + // disable it if we have to. + if (!is_writeable($this->_homedir)) { + $arguments[] = '--no-random-seed-file'; + } + } + + if ($this->_publicKeyring) { + $arguments[] = '--keyring ' . escapeshellarg($this->_publicKeyring); + } + + if ($this->_privateKeyring) { + $arguments[] = '--secret-keyring ' . + escapeshellarg($this->_privateKeyring); + } + + if ($this->_trustDb) { + $arguments[] = '--trustdb-name ' . escapeshellarg($this->_trustDb); + } + + $commandLine .= ' ' . implode(' ', $arguments) . ' ' . + $this->_operation; + + // Binary operations will not work on Windows with PHP < 5.2.6. This is + // in case stream_select() ever works on Windows. + $rb = (version_compare(PHP_VERSION, '5.2.6') < 0) ? 'r' : 'rb'; + $wb = (version_compare(PHP_VERSION, '5.2.6') < 0) ? 'w' : 'wb'; + + $descriptorSpec = array( + self::FD_INPUT => array('pipe', $rb), // stdin + self::FD_OUTPUT => array('pipe', $wb), // stdout + self::FD_ERROR => array('pipe', $wb), // stderr + self::FD_STATUS => array('pipe', $wb), // status + self::FD_COMMAND => array('pipe', $rb), // command + self::FD_MESSAGE => array('pipe', $rb) // message + ); + + $this->_debug('OPENING SUBPROCESS WITH THE FOLLOWING COMMAND:'); + $this->_debug($commandLine); + + $this->_process = proc_open( + $commandLine, + $descriptorSpec, + $this->_pipes, + null, + $env, + array('binary_pipes' => true) + ); + + if (!is_resource($this->_process)) { + throw new Crypt_GPG_OpenSubprocessException( + 'Unable to open GPG subprocess.', 0, $commandLine); + } + + $this->_openPipes = $this->_pipes; + $this->_errorCode = Crypt_GPG::ERROR_NONE; + } + + // }}} + // {{{ _closeSubprocess() + + /** + * Closes a the internal GPG subprocess + * + * Closes the internal GPG subprocess. Sets the private class property + * {@link Crypt_GPG_Engine::$_process} to null. + * + * @return void + * + * @see Crypt_GPG_Engine::_openSubprocess() + * @see Crypt_GPG_Engine::$_process + */ + private function _closeSubprocess() + { + if (is_resource($this->_process)) { + $this->_debug('CLOSING SUBPROCESS'); + + // close remaining open pipes + foreach (array_keys($this->_openPipes) as $pipeNumber) { + $this->_closePipe($pipeNumber); + } + + $exitCode = proc_close($this->_process); + + if ($exitCode != 0) { + $this->_debug( + '=> subprocess returned an unexpected exit code: ' . + $exitCode + ); + + if ($this->_errorCode === Crypt_GPG::ERROR_NONE) { + if ($this->_needPassphrase > 0) { + $this->_errorCode = Crypt_GPG::ERROR_MISSING_PASSPHRASE; + } else { + $this->_errorCode = Crypt_GPG::ERROR_UNKNOWN; + } + } + } + + $this->_process = null; + $this->_pipes = array(); + } + } + + // }}} + // {{{ _closePipe() + + /** + * Closes an opened pipe used to communicate with the GPG subprocess + * + * If the pipe is already closed, it is ignored. If the pipe is open, it + * is flushed and then closed. + * + * @param integer $pipeNumber the file descriptor number of the pipe to + * close. + * + * @return void + */ + private function _closePipe($pipeNumber) + { + $pipeNumber = intval($pipeNumber); + if (array_key_exists($pipeNumber, $this->_openPipes)) { + fflush($this->_openPipes[$pipeNumber]); + fclose($this->_openPipes[$pipeNumber]); + unset($this->_openPipes[$pipeNumber]); + } + } + + // }}} + // {{{ _getBinary() + + /** + * Gets the name of the GPG binary for the current operating system + * + * This method is called if the 'binary' option is not + * specified when creating this driver. + * + * @return string the name of the GPG binary for the current operating + * system. If no suitable binary could be found, an empty + * string is returned. + */ + private function _getBinary() + { + $binary = ''; + + if ($this->_isDarwin) { + $binaryFiles = array( + '/opt/local/bin/gpg', // MacPorts + '/usr/local/bin/gpg', // Mac GPG + '/sw/bin/gpg', // Fink + '/usr/bin/gpg' + ); + } else { + $binaryFiles = array( + '/usr/bin/gpg', + '/usr/local/bin/gpg' + ); + } + + foreach ($binaryFiles as $binaryFile) { + if (is_executable($binaryFile)) { + $binary = $binaryFile; + break; + } + } + + return $binary; + } + + // }}} + // {{{ _debug() + + /** + * Displays debug text if debugging is turned on + * + * Debugging text is prepended with a debug identifier and echoed to stdout. + * + * @param string $text the debugging text to display. + * + * @return void + */ + private function _debug($text) + { + if ($this->_debug) { + if (array_key_exists('SHELL', $_ENV)) { + foreach (explode(PHP_EOL, $text) as $line) { + echo "Crypt_GPG DEBUG: ", $line, PHP_EOL; + } + } else { + // running on a web server, format debug output nicely + foreach (explode(PHP_EOL, $text) as $line) { + echo "Crypt_GPG DEBUG: ", $line, + '
    ', PHP_EOL; + } + } + } + } + + // }}} + // {{{ _byteLength() + + /** + * Gets the length of a string in bytes even if mbstring function + * overloading is turned on + * + * This is used for stream-based communication with the GPG subprocess. + * + * @param string $string the string for which to get the length. + * + * @return integer the length of the string in bytes. + * + * @see Crypt_GPG_Engine::$_mbStringOverload + */ + private static function _byteLength($string) + { + if (self::$_mbStringOverload) { + return mb_strlen($string, '8bit'); + } + + return strlen((binary)$string); + } + + // }}} + // {{{ _byteSubstring() + + /** + * Gets the substring of a string in bytes even if mbstring function + * overloading is turned on + * + * This is used for stream-based communication with the GPG subprocess. + * + * @param string $string the input string. + * @param integer $start the starting point at which to get the substring. + * @param integer $length optional. The length of the substring. + * + * @return string the extracted part of the string. Unlike the default PHP + * substr() function, the returned value is + * always a string and never false. + * + * @see Crypt_GPG_Engine::$_mbStringOverload + */ + private static function _byteSubstring($string, $start, $length = null) + { + if (self::$_mbStringOverload) { + if ($length === null) { + return mb_substr( + $string, + $start, + self::_byteLength($string) - $start, '8bit' + ); + } + + return mb_substr($string, $start, $length, '8bit'); + } + + if ($length === null) { + return (string)substr((binary)$string, $start); + } + + return (string)substr((binary)$string, $start, $length); + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/Exceptions.php b/plugins/enigma/lib/Crypt/GPG/Exceptions.php new file mode 100644 index 0000000..744acf5 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/Exceptions.php @@ -0,0 +1,473 @@ + + * @author Michael Gauthier + * @copyright 2005 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Exceptions.php 273745 2009-01-18 05:24:25Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + */ + +/** + * PEAR Exception handler and base class + */ +require_once 'PEAR/Exception.php'; + +// {{{ class Crypt_GPG_Exception + +/** + * An exception thrown by the Crypt_GPG package + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2005 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_Exception extends PEAR_Exception +{ +} + +// }}} +// {{{ class Crypt_GPG_FileException + +/** + * An exception thrown when a file is used in ways it cannot be used + * + * For example, if an output file is specified and the file is not writeable, or + * if an input file is specified and the file is not readable, this exception + * is thrown. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2007-2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_FileException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * The name of the file that caused this exception + * + * @var string + */ + private $_filename = ''; + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_FileException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $filename the name of the file that caused this exception. + */ + public function __construct($message, $code = 0, $filename = '') + { + $this->_filename = $filename; + parent::__construct($message, $code); + } + + // }}} + // {{{ getFilename() + + /** + * Returns the filename of the file that caused this exception + * + * @return string the filename of the file that caused this exception. + * + * @see Crypt_GPG_FileException::$_filename + */ + public function getFilename() + { + return $this->_filename; + } + + // }}} +} + +// }}} +// {{{ class Crypt_GPG_OpenSubprocessException + +/** + * An exception thrown when the GPG subprocess cannot be opened + * + * This exception is thrown when the {@link Crypt_GPG_Engine} tries to open a + * new subprocess and fails. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2005 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_OpenSubprocessException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * The command used to try to open the subprocess + * + * @var string + */ + private $_command = ''; + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_OpenSubprocessException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $command the command that was called to open the + * new subprocess. + * + * @see Crypt_GPG::_openSubprocess() + */ + public function __construct($message, $code = 0, $command = '') + { + $this->_command = $command; + parent::__construct($message, $code); + } + + // }}} + // {{{ getCommand() + + /** + * Returns the contents of the internal _command property + * + * @return string the command used to open the subprocess. + * + * @see Crypt_GPG_OpenSubprocessException::$_command + */ + public function getCommand() + { + return $this->_command; + } + + // }}} +} + +// }}} +// {{{ class Crypt_GPG_InvalidOperationException + +/** + * An exception thrown when an invalid GPG operation is attempted + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_InvalidOperationException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * The attempted operation + * + * @var string + */ + private $_operation = ''; + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_OpenSubprocessException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $operation the operation. + */ + public function __construct($message, $code = 0, $operation = '') + { + $this->_operation = $operation; + parent::__construct($message, $code); + } + + // }}} + // {{{ getOperation() + + /** + * Returns the contents of the internal _operation property + * + * @return string the attempted operation. + * + * @see Crypt_GPG_InvalidOperationException::$_operation + */ + public function getOperation() + { + return $this->_operation; + } + + // }}} +} + +// }}} +// {{{ class Crypt_GPG_KeyNotFoundException + +/** + * An exception thrown when Crypt_GPG fails to find the key for various + * operations + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2005 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_KeyNotFoundException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * The key identifier that was searched for + * + * @var string + */ + private $_keyId = ''; + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_KeyNotFoundException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $keyId the key identifier of the key. + */ + public function __construct($message, $code = 0, $keyId= '') + { + $this->_keyId = $keyId; + parent::__construct($message, $code); + } + + // }}} + // {{{ getKeyId() + + /** + * Gets the key identifier of the key that was not found + * + * @return string the key identifier of the key that was not found. + */ + public function getKeyId() + { + return $this->_keyId; + } + + // }}} +} + +// }}} +// {{{ class Crypt_GPG_NoDataException + +/** + * An exception thrown when Crypt_GPG cannot find valid data for various + * operations + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2006 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_NoDataException extends Crypt_GPG_Exception +{ +} + +// }}} +// {{{ class Crypt_GPG_BadPassphraseException + +/** + * An exception thrown when a required passphrase is incorrect or missing + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2006-2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_BadPassphraseException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * Keys for which the passhprase is missing + * + * This contains primary user ids indexed by sub-key id. + * + * @var array + */ + private $_missingPassphrases = array(); + + /** + * Keys for which the passhprase is incorrect + * + * This contains primary user ids indexed by sub-key id. + * + * @var array + */ + private $_badPassphrases = array(); + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_BadPassphraseException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $badPassphrases an array containing user ids of keys + * for which the passphrase is incorrect. + * @param string $missingPassphrases an array containing user ids of keys + * for which the passphrase is missing. + */ + public function __construct($message, $code = 0, + array $badPassphrases = array(), array $missingPassphrases = array() + ) { + $this->_badPassphrases = $badPassphrases; + $this->_missingPassphrases = $missingPassphrases; + + parent::__construct($message, $code); + } + + // }}} + // {{{ getBadPassphrases() + + /** + * Gets keys for which the passhprase is incorrect + * + * @return array an array of keys for which the passphrase is incorrect. + * The array contains primary user ids indexed by the sub-key + * id. + */ + public function getBadPassphrases() + { + return $this->_badPassphrases; + } + + // }}} + // {{{ getMissingPassphrases() + + /** + * Gets keys for which the passhprase is missing + * + * @return array an array of keys for which the passphrase is missing. + * The array contains primary user ids indexed by the sub-key + * id. + */ + public function getMissingPassphrases() + { + return $this->_missingPassphrases; + } + + // }}} +} + +// }}} +// {{{ class Crypt_GPG_DeletePrivateKeyException + +/** + * An exception thrown when an attempt is made to delete public key that has an + * associated private key on the keyring + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + */ +class Crypt_GPG_DeletePrivateKeyException extends Crypt_GPG_Exception +{ + // {{{ private class properties + + /** + * The key identifier the deletion attempt was made upon + * + * @var string + */ + private $_keyId = ''; + + // }}} + // {{{ __construct() + + /** + * Creates a new Crypt_GPG_DeletePrivateKeyException + * + * @param string $message an error message. + * @param integer $code a user defined error code. + * @param string $keyId the key identifier of the public key that was + * attempted to delete. + * + * @see Crypt_GPG::deletePublicKey() + */ + public function __construct($message, $code = 0, $keyId = '') + { + $this->_keyId = $keyId; + parent::__construct($message, $code); + } + + // }}} + // {{{ getKeyId() + + /** + * Gets the key identifier of the key that was not found + * + * @return string the key identifier of the key that was not found. + */ + public function getKeyId() + { + return $this->_keyId; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/Key.php b/plugins/enigma/lib/Crypt/GPG/Key.php new file mode 100644 index 0000000..67a4b9c --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/Key.php @@ -0,0 +1,223 @@ + + * @copyright 2008-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Key.php 295621 2010-03-01 04:18:54Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + */ + +/** + * Sub-key class definition + */ +require_once 'Crypt/GPG/SubKey.php'; + +/** + * User id class definition + */ +require_once 'Crypt/GPG/UserId.php'; + +// {{{ class Crypt_GPG_Key + +/** + * A data class for GPG key information + * + * This class is used to store the results of the {@link Crypt_GPG::getKeys()} + * method. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @see Crypt_GPG::getKeys() + */ +class Crypt_GPG_Key +{ + // {{{ class properties + + /** + * The user ids associated with this key + * + * This is an array of {@link Crypt_GPG_UserId} objects. + * + * @var array + * + * @see Crypt_GPG_Key::addUserId() + * @see Crypt_GPG_Key::getUserIds() + */ + private $_userIds = array(); + + /** + * The subkeys of this key + * + * This is an array of {@link Crypt_GPG_SubKey} objects. + * + * @var array + * + * @see Crypt_GPG_Key::addSubKey() + * @see Crypt_GPG_Key::getSubKeys() + */ + private $_subKeys = array(); + + // }}} + // {{{ getSubKeys() + + /** + * Gets the sub-keys of this key + * + * @return array the sub-keys of this key. + * + * @see Crypt_GPG_Key::addSubKey() + */ + public function getSubKeys() + { + return $this->_subKeys; + } + + // }}} + // {{{ getUserIds() + + /** + * Gets the user ids of this key + * + * @return array the user ids of this key. + * + * @see Crypt_GPG_Key::addUserId() + */ + public function getUserIds() + { + return $this->_userIds; + } + + // }}} + // {{{ getPrimaryKey() + + /** + * Gets the primary sub-key of this key + * + * The primary key is the first added sub-key. + * + * @return Crypt_GPG_SubKey the primary sub-key of this key. + */ + public function getPrimaryKey() + { + $primary_key = null; + if (count($this->_subKeys) > 0) { + $primary_key = $this->_subKeys[0]; + } + return $primary_key; + } + + // }}} + // {{{ canSign() + + /** + * Gets whether or not this key can sign data + * + * This key can sign data if any sub-key of this key can sign data. + * + * @return boolean true if this key can sign data and false if this key + * cannot sign data. + */ + public function canSign() + { + $canSign = false; + foreach ($this->_subKeys as $subKey) { + if ($subKey->canSign()) { + $canSign = true; + break; + } + } + return $canSign; + } + + // }}} + // {{{ canEncrypt() + + /** + * Gets whether or not this key can encrypt data + * + * This key can encrypt data if any sub-key of this key can encrypt data. + * + * @return boolean true if this key can encrypt data and false if this + * key cannot encrypt data. + */ + public function canEncrypt() + { + $canEncrypt = false; + foreach ($this->_subKeys as $subKey) { + if ($subKey->canEncrypt()) { + $canEncrypt = true; + break; + } + } + return $canEncrypt; + } + + // }}} + // {{{ addSubKey() + + /** + * Adds a sub-key to this key + * + * The first added sub-key will be the primary key of this key. + * + * @param Crypt_GPG_SubKey $subKey the sub-key to add. + * + * @return Crypt_GPG_Key the current object, for fluent interface. + */ + public function addSubKey(Crypt_GPG_SubKey $subKey) + { + $this->_subKeys[] = $subKey; + return $this; + } + + // }}} + // {{{ addUserId() + + /** + * Adds a user id to this key + * + * @param Crypt_GPG_UserId $userId the user id to add. + * + * @return Crypt_GPG_Key the current object, for fluent interface. + */ + public function addUserId(Crypt_GPG_UserId $userId) + { + $this->_userIds[] = $userId; + return $this; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/Signature.php b/plugins/enigma/lib/Crypt/GPG/Signature.php new file mode 100644 index 0000000..03ab44c --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/Signature.php @@ -0,0 +1,428 @@ + + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Signature.php 302773 2010-08-25 14:16:28Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + */ + +/** + * User id class definition + */ +require_once 'Crypt/GPG/UserId.php'; + +// {{{ class Crypt_GPG_Signature + +/** + * A class for GPG signature information + * + * This class is used to store the results of the Crypt_GPG::verify() method. + * + * @category Encryption + * @package Crypt_GPG + * @author Nathan Fredrickson + * @author Michael Gauthier + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @see Crypt_GPG::verify() + */ +class Crypt_GPG_Signature +{ + // {{{ class properties + + /** + * A base64-encoded string containing a unique id for this signature if + * this signature has been verified as ok + * + * This id is used to prevent replay attacks and is not present for all + * types of signatures. + * + * @var string + */ + private $_id = ''; + + /** + * The fingerprint of the key used to create the signature + * + * @var string + */ + private $_keyFingerprint = ''; + + /** + * The id of the key used to create the signature + * + * @var string + */ + private $_keyId = ''; + + /** + * The creation date of this signature + * + * This is a Unix timestamp. + * + * @var integer + */ + private $_creationDate = 0; + + /** + * The expiration date of the signature + * + * This is a Unix timestamp. If this signature does not expire, this will + * be zero. + * + * @var integer + */ + private $_expirationDate = 0; + + /** + * The user id associated with this signature + * + * @var Crypt_GPG_UserId + */ + private $_userId = null; + + /** + * Whether or not this signature is valid + * + * @var boolean + */ + private $_isValid = false; + + // }}} + // {{{ __construct() + + /** + * Creates a new signature + * + * Signatures can be initialized from an array of named values. Available + * names are: + * + * - string id - the unique id of this signature. + * - string fingerprint - the fingerprint of the key used to + * create the signature. The fingerprint + * should not contain formatting + * characters. + * - string keyId - the id of the key used to create the + * the signature. + * - integer creation - the date the signature was created. + * This is a UNIX timestamp. + * - integer expiration - the date the signature expired. This + * is a UNIX timestamp. If the signature + * does not expire, use 0. + * - boolean valid - whether or not the signature is valid. + * - string userId - the user id associated with the + * signature. This may also be a + * {@link Crypt_GPG_UserId} object. + * + * @param Crypt_GPG_Signature|array $signature optional. Either an existing + * signature object, which is copied; or an array of initial values. + */ + public function __construct($signature = null) + { + // copy from object + if ($signature instanceof Crypt_GPG_Signature) { + $this->_id = $signature->_id; + $this->_keyFingerprint = $signature->_keyFingerprint; + $this->_keyId = $signature->_keyId; + $this->_creationDate = $signature->_creationDate; + $this->_expirationDate = $signature->_expirationDate; + $this->_isValid = $signature->_isValid; + + if ($signature->_userId instanceof Crypt_GPG_UserId) { + $this->_userId = clone $signature->_userId; + } else { + $this->_userId = $signature->_userId; + } + } + + // initialize from array + if (is_array($signature)) { + if (array_key_exists('id', $signature)) { + $this->setId($signature['id']); + } + + if (array_key_exists('fingerprint', $signature)) { + $this->setKeyFingerprint($signature['fingerprint']); + } + + if (array_key_exists('keyId', $signature)) { + $this->setKeyId($signature['keyId']); + } + + if (array_key_exists('creation', $signature)) { + $this->setCreationDate($signature['creation']); + } + + if (array_key_exists('expiration', $signature)) { + $this->setExpirationDate($signature['expiration']); + } + + if (array_key_exists('valid', $signature)) { + $this->setValid($signature['valid']); + } + + if (array_key_exists('userId', $signature)) { + $userId = new Crypt_GPG_UserId($signature['userId']); + $this->setUserId($userId); + } + } + } + + // }}} + // {{{ getId() + + /** + * Gets the id of this signature + * + * @return string a base64-encoded string containing a unique id for this + * signature. This id is used to prevent replay attacks and + * is not present for all types of signatures. + */ + public function getId() + { + return $this->_id; + } + + // }}} + // {{{ getKeyFingerprint() + + /** + * Gets the fingerprint of the key used to create this signature + * + * @return string the fingerprint of the key used to create this signature. + */ + public function getKeyFingerprint() + { + return $this->_keyFingerprint; + } + + // }}} + // {{{ getKeyId() + + /** + * Gets the id of the key used to create this signature + * + * Whereas the fingerprint of the signing key may not always be available + * (for example if the signature is bad), the id should always be + * available. + * + * @return string the id of the key used to create this signature. + */ + public function getKeyId() + { + return $this->_keyId; + } + + // }}} + // {{{ getCreationDate() + + /** + * Gets the creation date of this signature + * + * @return integer the creation date of this signature. This is a Unix + * timestamp. + */ + public function getCreationDate() + { + return $this->_creationDate; + } + + // }}} + // {{{ getExpirationDate() + + /** + * Gets the expiration date of the signature + * + * @return integer the expiration date of this signature. This is a Unix + * timestamp. If this signature does not expire, this will + * be zero. + */ + public function getExpirationDate() + { + return $this->_expirationDate; + } + + // }}} + // {{{ getUserId() + + /** + * Gets the user id associated with this signature + * + * @return Crypt_GPG_UserId the user id associated with this signature. + */ + public function getUserId() + { + return $this->_userId; + } + + // }}} + // {{{ isValid() + + /** + * Gets whether or no this signature is valid + * + * @return boolean true if this signature is valid and false if it is not. + */ + public function isValid() + { + return $this->_isValid; + } + + // }}} + // {{{ setId() + + /** + * Sets the id of this signature + * + * @param string $id a base64-encoded string containing a unique id for + * this signature. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + * + * @see Crypt_GPG_Signature::getId() + */ + public function setId($id) + { + $this->_id = strval($id); + return $this; + } + + // }}} + // {{{ setKeyFingerprint() + + /** + * Sets the key fingerprint of this signature + * + * @param string $fingerprint the key fingerprint of this signature. This + * is the fingerprint of the primary key used to + * create this signature. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setKeyFingerprint($fingerprint) + { + $this->_keyFingerprint = strval($fingerprint); + return $this; + } + + // }}} + // {{{ setKeyId() + + /** + * Sets the key id of this signature + * + * @param string $id the key id of this signature. This is the id of the + * primary key used to create this signature. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setKeyId($id) + { + $this->_keyId = strval($id); + return $this; + } + + // }}} + // {{{ setCreationDate() + + /** + * Sets the creation date of this signature + * + * @param integer $creationDate the creation date of this signature. This + * is a Unix timestamp. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setCreationDate($creationDate) + { + $this->_creationDate = intval($creationDate); + return $this; + } + + // }}} + // {{{ setExpirationDate() + + /** + * Sets the expiration date of this signature + * + * @param integer $expirationDate the expiration date of this signature. + * This is a Unix timestamp. Specify zero if + * this signature does not expire. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setExpirationDate($expirationDate) + { + $this->_expirationDate = intval($expirationDate); + return $this; + } + + // }}} + // {{{ setUserId() + + /** + * Sets the user id associated with this signature + * + * @param Crypt_GPG_UserId $userId the user id associated with this + * signature. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setUserId(Crypt_GPG_UserId $userId) + { + $this->_userId = $userId; + return $this; + } + + // }}} + // {{{ setValid() + + /** + * Sets whether or not this signature is valid + * + * @param boolean $isValid true if this signature is valid and false if it + * is not. + * + * @return Crypt_GPG_Signature the current object, for fluent interface. + */ + public function setValid($isValid) + { + $this->_isValid = ($isValid) ? true : false; + return $this; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/SubKey.php b/plugins/enigma/lib/Crypt/GPG/SubKey.php new file mode 100644 index 0000000..b6316e9 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/SubKey.php @@ -0,0 +1,649 @@ + + * @author Nathan Fredrickson + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: SubKey.php 302768 2010-08-25 13:45:52Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + */ + +// {{{ class Crypt_GPG_SubKey + +/** + * A class for GPG sub-key information + * + * This class is used to store the results of the {@link Crypt_GPG::getKeys()} + * method. Sub-key objects are members of a {@link Crypt_GPG_Key} object. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @author Nathan Fredrickson + * @copyright 2005-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @see Crypt_GPG::getKeys() + * @see Crypt_GPG_Key::getSubKeys() + */ +class Crypt_GPG_SubKey +{ + // {{{ class constants + + /** + * RSA encryption algorithm. + */ + const ALGORITHM_RSA = 1; + + /** + * Elgamal encryption algorithm (encryption only). + */ + const ALGORITHM_ELGAMAL_ENC = 16; + + /** + * DSA encryption algorithm (sometimes called DH, sign only). + */ + const ALGORITHM_DSA = 17; + + /** + * Elgamal encryption algorithm (signage and encryption - should not be + * used). + */ + const ALGORITHM_ELGAMAL_ENC_SGN = 20; + + // }}} + // {{{ class properties + + /** + * The id of this sub-key + * + * @var string + */ + private $_id = ''; + + /** + * The algorithm used to create this sub-key + * + * The value is one of the Crypt_GPG_SubKey::ALGORITHM_* constants. + * + * @var integer + */ + private $_algorithm = 0; + + /** + * The fingerprint of this sub-key + * + * @var string + */ + private $_fingerprint = ''; + + /** + * Length of this sub-key in bits + * + * @var integer + */ + private $_length = 0; + + /** + * Date this sub-key was created + * + * This is a Unix timestamp. + * + * @var integer + */ + private $_creationDate = 0; + + /** + * Date this sub-key expires + * + * This is a Unix timestamp. If this sub-key does not expire, this will be + * zero. + * + * @var integer + */ + private $_expirationDate = 0; + + /** + * Whether or not this sub-key can sign data + * + * @var boolean + */ + private $_canSign = false; + + /** + * Whether or not this sub-key can encrypt data + * + * @var boolean + */ + private $_canEncrypt = false; + + /** + * Whether or not the private key for this sub-key exists in the keyring + * + * @var boolean + */ + private $_hasPrivate = false; + + /** + * Whether or not this sub-key is revoked + * + * @var boolean + */ + private $_isRevoked = false; + + // }}} + // {{{ __construct() + + /** + * Creates a new sub-key object + * + * Sub-keys can be initialized from an array of named values. Available + * names are: + * + * - string id - the key id of the sub-key. + * - integer algorithm - the encryption algorithm of the + * sub-key. + * - string fingerprint - the fingerprint of the sub-key. The + * fingerprint should not contain + * formatting characters. + * - integer length - the length of the sub-key in bits. + * - integer creation - the date the sub-key was created. + * This is a UNIX timestamp. + * - integer expiration - the date the sub-key expires. This + * is a UNIX timestamp. If the sub-key + * does not expire, use 0. + * - boolean canSign - whether or not the sub-key can be + * used to sign data. + * - boolean canEncrypt - whether or not the sub-key can be + * used to encrypt data. + * - boolean hasPrivate - whether or not the private key for + * the sub-key exists in the keyring. + * - boolean isRevoked - whether or not this sub-key is + * revoked. + * + * @param Crypt_GPG_SubKey|string|array $key optional. Either an existing + * sub-key object, which is copied; a sub-key string, which is + * parsed; or an array of initial values. + */ + public function __construct($key = null) + { + // parse from string + if (is_string($key)) { + $key = self::parse($key); + } + + // copy from object + if ($key instanceof Crypt_GPG_SubKey) { + $this->_id = $key->_id; + $this->_algorithm = $key->_algorithm; + $this->_fingerprint = $key->_fingerprint; + $this->_length = $key->_length; + $this->_creationDate = $key->_creationDate; + $this->_expirationDate = $key->_expirationDate; + $this->_canSign = $key->_canSign; + $this->_canEncrypt = $key->_canEncrypt; + $this->_hasPrivate = $key->_hasPrivate; + $this->_isRevoked = $key->_isRevoked; + } + + // initialize from array + if (is_array($key)) { + if (array_key_exists('id', $key)) { + $this->setId($key['id']); + } + + if (array_key_exists('algorithm', $key)) { + $this->setAlgorithm($key['algorithm']); + } + + if (array_key_exists('fingerprint', $key)) { + $this->setFingerprint($key['fingerprint']); + } + + if (array_key_exists('length', $key)) { + $this->setLength($key['length']); + } + + if (array_key_exists('creation', $key)) { + $this->setCreationDate($key['creation']); + } + + if (array_key_exists('expiration', $key)) { + $this->setExpirationDate($key['expiration']); + } + + if (array_key_exists('canSign', $key)) { + $this->setCanSign($key['canSign']); + } + + if (array_key_exists('canEncrypt', $key)) { + $this->setCanEncrypt($key['canEncrypt']); + } + + if (array_key_exists('hasPrivate', $key)) { + $this->setHasPrivate($key['hasPrivate']); + } + + if (array_key_exists('isRevoked', $key)) { + $this->setRevoked($key['isRevoked']); + } + } + } + + // }}} + // {{{ getId() + + /** + * Gets the id of this sub-key + * + * @return string the id of this sub-key. + */ + public function getId() + { + return $this->_id; + } + + // }}} + // {{{ getAlgorithm() + + /** + * Gets the algorithm used by this sub-key + * + * The algorithm should be one of the Crypt_GPG_SubKey::ALGORITHM_* + * constants. + * + * @return integer the algorithm used by this sub-key. + */ + public function getAlgorithm() + { + return $this->_algorithm; + } + + // }}} + // {{{ getCreationDate() + + /** + * Gets the creation date of this sub-key + * + * This is a Unix timestamp. + * + * @return integer the creation date of this sub-key. + */ + public function getCreationDate() + { + return $this->_creationDate; + } + + // }}} + // {{{ getExpirationDate() + + /** + * Gets the date this sub-key expires + * + * This is a Unix timestamp. If this sub-key does not expire, this will be + * zero. + * + * @return integer the date this sub-key expires. + */ + public function getExpirationDate() + { + return $this->_expirationDate; + } + + // }}} + // {{{ getFingerprint() + + /** + * Gets the fingerprint of this sub-key + * + * @return string the fingerprint of this sub-key. + */ + public function getFingerprint() + { + return $this->_fingerprint; + } + + // }}} + // {{{ getLength() + + /** + * Gets the length of this sub-key in bits + * + * @return integer the length of this sub-key in bits. + */ + public function getLength() + { + return $this->_length; + } + + // }}} + // {{{ canSign() + + /** + * Gets whether or not this sub-key can sign data + * + * @return boolean true if this sub-key can sign data and false if this + * sub-key can not sign data. + */ + public function canSign() + { + return $this->_canSign; + } + + // }}} + // {{{ canEncrypt() + + /** + * Gets whether or not this sub-key can encrypt data + * + * @return boolean true if this sub-key can encrypt data and false if this + * sub-key can not encrypt data. + */ + public function canEncrypt() + { + return $this->_canEncrypt; + } + + // }}} + // {{{ hasPrivate() + + /** + * Gets whether or not the private key for this sub-key exists in the + * keyring + * + * @return boolean true the private key for this sub-key exists in the + * keyring and false if it does not. + */ + public function hasPrivate() + { + return $this->_hasPrivate; + } + + // }}} + // {{{ isRevoked() + + /** + * Gets whether or not this sub-key is revoked + * + * @return boolean true if this sub-key is revoked and false if it is not. + */ + public function isRevoked() + { + return $this->_isRevoked; + } + + // }}} + // {{{ setCreationDate() + + /** + * Sets the creation date of this sub-key + * + * The creation date is a Unix timestamp. + * + * @param integer $creationDate the creation date of this sub-key. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setCreationDate($creationDate) + { + $this->_creationDate = intval($creationDate); + return $this; + } + + // }}} + // {{{ setExpirationDate() + + /** + * Sets the expiration date of this sub-key + * + * The expiration date is a Unix timestamp. Specify zero if this sub-key + * does not expire. + * + * @param integer $expirationDate the expiration date of this sub-key. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setExpirationDate($expirationDate) + { + $this->_expirationDate = intval($expirationDate); + return $this; + } + + // }}} + // {{{ setId() + + /** + * Sets the id of this sub-key + * + * @param string $id the id of this sub-key. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setId($id) + { + $this->_id = strval($id); + return $this; + } + + // }}} + // {{{ setAlgorithm() + + /** + * Sets the algorithm used by this sub-key + * + * @param integer $algorithm the algorithm used by this sub-key. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setAlgorithm($algorithm) + { + $this->_algorithm = intval($algorithm); + return $this; + } + + // }}} + // {{{ setFingerprint() + + /** + * Sets the fingerprint of this sub-key + * + * @param string $fingerprint the fingerprint of this sub-key. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setFingerprint($fingerprint) + { + $this->_fingerprint = strval($fingerprint); + return $this; + } + + // }}} + // {{{ setLength() + + /** + * Sets the length of this sub-key in bits + * + * @param integer $length the length of this sub-key in bits. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setLength($length) + { + $this->_length = intval($length); + return $this; + } + + // }}} + // {{{ setCanSign() + + /** + * Sets whether of not this sub-key can sign data + * + * @param boolean $canSign true if this sub-key can sign data and false if + * it can not. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setCanSign($canSign) + { + $this->_canSign = ($canSign) ? true : false; + return $this; + } + + // }}} + // {{{ setCanEncrypt() + + /** + * Sets whether of not this sub-key can encrypt data + * + * @param boolean $canEncrypt true if this sub-key can encrypt data and + * false if it can not. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setCanEncrypt($canEncrypt) + { + $this->_canEncrypt = ($canEncrypt) ? true : false; + return $this; + } + + // }}} + // {{{ setHasPrivate() + + /** + * Sets whether of not the private key for this sub-key exists in the + * keyring + * + * @param boolean $hasPrivate true if the private key for this sub-key + * exists in the keyring and false if it does + * not. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setHasPrivate($hasPrivate) + { + $this->_hasPrivate = ($hasPrivate) ? true : false; + return $this; + } + + // }}} + // {{{ setRevoked() + + /** + * Sets whether or not this sub-key is revoked + * + * @param boolean $isRevoked whether or not this sub-key is revoked. + * + * @return Crypt_GPG_SubKey the current object, for fluent interface. + */ + public function setRevoked($isRevoked) + { + $this->_isRevoked = ($isRevoked) ? true : false; + return $this; + } + + // }}} + // {{{ parse() + + /** + * Parses a sub-key object from a sub-key string + * + * See doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG distribution} for information + * on how the sub-key string is parsed. + * + * @param string $string the string containing the sub-key. + * + * @return Crypt_GPG_SubKey the sub-key object parsed from the string. + */ + public static function parse($string) + { + $tokens = explode(':', $string); + + $subKey = new Crypt_GPG_SubKey(); + + $subKey->setId($tokens[4]); + $subKey->setLength($tokens[2]); + $subKey->setAlgorithm($tokens[3]); + $subKey->setCreationDate(self::_parseDate($tokens[5])); + $subKey->setExpirationDate(self::_parseDate($tokens[6])); + + if ($tokens[1] == 'r') { + $subKey->setRevoked(true); + } + + if (strpos($tokens[11], 's') !== false) { + $subKey->setCanSign(true); + } + + if (strpos($tokens[11], 'e') !== false) { + $subKey->setCanEncrypt(true); + } + + return $subKey; + } + + // }}} + // {{{ _parseDate() + + /** + * Parses a date string as provided by GPG into a UNIX timestamp + * + * @param string $string the date string. + * + * @return integer the UNIX timestamp corresponding to the provided date + * string. + */ + private static function _parseDate($string) + { + if ($string == '') { + $timestamp = 0; + } else { + // all times are in UTC according to GPG documentation + $timeZone = new DateTimeZone('UTC'); + + if (strpos($string, 'T') === false) { + // interpret as UNIX timestamp + $string = '@' . $string; + } + + $date = new DateTime($string, $timeZone); + + // convert to UNIX timestamp + $timestamp = intval($date->format('U')); + } + + return $timestamp; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/UserId.php b/plugins/enigma/lib/Crypt/GPG/UserId.php new file mode 100644 index 0000000..0443570 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/UserId.php @@ -0,0 +1,373 @@ + + * @copyright 2008-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: UserId.php 295621 2010-03-01 04:18:54Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + */ + +// {{{ class Crypt_GPG_UserId + +/** + * A class for GPG user id information + * + * This class is used to store the results of the {@link Crypt_GPG::getKeys()} + * method. User id objects are members of a {@link Crypt_GPG_Key} object. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008-2010 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @see Crypt_GPG::getKeys() + * @see Crypt_GPG_Key::getUserIds() + */ +class Crypt_GPG_UserId +{ + // {{{ class properties + + /** + * The name field of this user id + * + * @var string + */ + private $_name = ''; + + /** + * The comment field of this user id + * + * @var string + */ + private $_comment = ''; + + /** + * The email field of this user id + * + * @var string + */ + private $_email = ''; + + /** + * Whether or not this user id is revoked + * + * @var boolean + */ + private $_isRevoked = false; + + /** + * Whether or not this user id is valid + * + * @var boolean + */ + private $_isValid = true; + + // }}} + // {{{ __construct() + + /** + * Creates a new user id + * + * User ids can be initialized from an array of named values. Available + * names are: + * + * - string name - the name field of the user id. + * - string comment - the comment field of the user id. + * - string email - the email field of the user id. + * - boolean valid - whether or not the user id is valid. + * - boolean revoked - whether or not the user id is revoked. + * + * @param Crypt_GPG_UserId|string|array $userId optional. Either an + * existing user id object, which is copied; a user id string, which + * is parsed; or an array of initial values. + */ + public function __construct($userId = null) + { + // parse from string + if (is_string($userId)) { + $userId = self::parse($userId); + } + + // copy from object + if ($userId instanceof Crypt_GPG_UserId) { + $this->_name = $userId->_name; + $this->_comment = $userId->_comment; + $this->_email = $userId->_email; + $this->_isRevoked = $userId->_isRevoked; + $this->_isValid = $userId->_isValid; + } + + // initialize from array + if (is_array($userId)) { + if (array_key_exists('name', $userId)) { + $this->setName($userId['name']); + } + + if (array_key_exists('comment', $userId)) { + $this->setComment($userId['comment']); + } + + if (array_key_exists('email', $userId)) { + $this->setEmail($userId['email']); + } + + if (array_key_exists('revoked', $userId)) { + $this->setRevoked($userId['revoked']); + } + + if (array_key_exists('valid', $userId)) { + $this->setValid($userId['valid']); + } + } + } + + // }}} + // {{{ getName() + + /** + * Gets the name field of this user id + * + * @return string the name field of this user id. + */ + public function getName() + { + return $this->_name; + } + + // }}} + // {{{ getComment() + + /** + * Gets the comments field of this user id + * + * @return string the comments field of this user id. + */ + public function getComment() + { + return $this->_comment; + } + + // }}} + // {{{ getEmail() + + /** + * Gets the email field of this user id + * + * @return string the email field of this user id. + */ + public function getEmail() + { + return $this->_email; + } + + // }}} + // {{{ isRevoked() + + /** + * Gets whether or not this user id is revoked + * + * @return boolean true if this user id is revoked and false if it is not. + */ + public function isRevoked() + { + return $this->_isRevoked; + } + + // }}} + // {{{ isValid() + + /** + * Gets whether or not this user id is valid + * + * @return boolean true if this user id is valid and false if it is not. + */ + public function isValid() + { + return $this->_isValid; + } + + // }}} + // {{{ __toString() + + /** + * Gets a string representation of this user id + * + * The string is formatted as: + * name (comment) . + * + * @return string a string representation of this user id. + */ + public function __toString() + { + $components = array(); + + if (strlen($this->_name) > 0) { + $components[] = $this->_name; + } + + if (strlen($this->_comment) > 0) { + $components[] = '(' . $this->_comment . ')'; + } + + if (strlen($this->_email) > 0) { + $components[] = '<' . $this->_email. '>'; + } + + return implode(' ', $components); + } + + // }}} + // {{{ setName() + + /** + * Sets the name field of this user id + * + * @param string $name the name field of this user id. + * + * @return Crypt_GPG_UserId the current object, for fluent interface. + */ + public function setName($name) + { + $this->_name = strval($name); + return $this; + } + + // }}} + // {{{ setComment() + + /** + * Sets the comment field of this user id + * + * @param string $comment the comment field of this user id. + * + * @return Crypt_GPG_UserId the current object, for fluent interface. + */ + public function setComment($comment) + { + $this->_comment = strval($comment); + return $this; + } + + // }}} + // {{{ setEmail() + + /** + * Sets the email field of this user id + * + * @param string $email the email field of this user id. + * + * @return Crypt_GPG_UserId the current object, for fluent interface. + */ + public function setEmail($email) + { + $this->_email = strval($email); + return $this; + } + + // }}} + // {{{ setRevoked() + + /** + * Sets whether or not this user id is revoked + * + * @param boolean $isRevoked whether or not this user id is revoked. + * + * @return Crypt_GPG_UserId the current object, for fluent interface. + */ + public function setRevoked($isRevoked) + { + $this->_isRevoked = ($isRevoked) ? true : false; + return $this; + } + + // }}} + // {{{ setValid() + + /** + * Sets whether or not this user id is valid + * + * @param boolean $isValid whether or not this user id is valid. + * + * @return Crypt_GPG_UserId the current object, for fluent interface. + */ + public function setValid($isValid) + { + $this->_isValid = ($isValid) ? true : false; + return $this; + } + + // }}} + // {{{ parse() + + /** + * Parses a user id object from a user id string + * + * A user id string is of the form: + * name (comment) with the comment + * and email-address fields being optional. + * + * @param string $string the user id string to parse. + * + * @return Crypt_GPG_UserId the user id object parsed from the string. + */ + public static function parse($string) + { + $userId = new Crypt_GPG_UserId(); + $email = ''; + $comment = ''; + + // get email address from end of string if it exists + $matches = array(); + if (preg_match('/^(.+?) <([^>]+)>$/', $string, $matches) === 1) { + $string = $matches[1]; + $email = $matches[2]; + } + + // get comment from end of string if it exists + $matches = array(); + if (preg_match('/^(.+?) \(([^\)]+)\)$/', $string, $matches) === 1) { + $string = $matches[1]; + $comment = $matches[2]; + } + + $name = $string; + + $userId->setName($name); + $userId->setComment($comment); + $userId->setEmail($email); + + return $userId; + } + + // }}} +} + +// }}} + +?> diff --git a/plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php b/plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php new file mode 100644 index 0000000..083bd30 --- /dev/null +++ b/plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php @@ -0,0 +1,216 @@ + + * @copyright 2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: VerifyStatusHandler.php 302908 2010-08-31 03:56:54Z gauthierm $ + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ + +/** + * Signature object class definition + */ +require_once 'Crypt/GPG/Signature.php'; + +/** + * Status line handler for the verify operation + * + * This class is used internally by Crypt_GPG and does not need be used + * directly. See the {@link Crypt_GPG} class for end-user API. + * + * This class is responsible for building signature objects that are returned + * by the {@link Crypt_GPG::verify()} method. See doc/DETAILS in the + * {@link http://www.gnupg.org/download/ GPG distribution} for detailed + * information on GPG's status output for the verify operation. + * + * @category Encryption + * @package Crypt_GPG + * @author Michael Gauthier + * @copyright 2008 silverorange + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/Crypt_GPG + * @link http://www.gnupg.org/ + */ +class Crypt_GPG_VerifyStatusHandler +{ + // {{{ protected properties + + /** + * The current signature id + * + * Ths signature id is emitted by GPG before the new signature line so we + * must remember it temporarily. + * + * @var string + */ + protected $signatureId = ''; + + /** + * List of parsed {@link Crypt_GPG_Signature} objects + * + * @var array + */ + protected $signatures = array(); + + /** + * Array index of the current signature + * + * @var integer + */ + protected $index = -1; + + // }}} + // {{{ handle() + + /** + * Handles a status line + * + * @param string $line the status line to handle. + * + * @return void + */ + public function handle($line) + { + $tokens = explode(' ', $line); + switch ($tokens[0]) { + case 'GOODSIG': + case 'EXPSIG': + case 'EXPKEYSIG': + case 'REVKEYSIG': + case 'BADSIG': + $signature = new Crypt_GPG_Signature(); + + // if there was a signature id, set it on the new signature + if ($this->signatureId != '') { + $signature->setId($this->signatureId); + $this->signatureId = ''; + } + + // Detect whether fingerprint or key id was returned and set + // signature values appropriately. Key ids are strings of either + // 16 or 8 hexadecimal characters. Fingerprints are strings of 40 + // hexadecimal characters. The key id is the last 16 characters of + // the key fingerprint. + if (strlen($tokens[1]) > 16) { + $signature->setKeyFingerprint($tokens[1]); + $signature->setKeyId(substr($tokens[1], -16)); + } else { + $signature->setKeyId($tokens[1]); + } + + // get user id string + $string = implode(' ', array_splice($tokens, 2)); + $string = rawurldecode($string); + + $signature->setUserId(Crypt_GPG_UserId::parse($string)); + + $this->index++; + $this->signatures[$this->index] = $signature; + break; + + case 'ERRSIG': + $signature = new Crypt_GPG_Signature(); + + // if there was a signature id, set it on the new signature + if ($this->signatureId != '') { + $signature->setId($this->signatureId); + $this->signatureId = ''; + } + + // Detect whether fingerprint or key id was returned and set + // signature values appropriately. Key ids are strings of either + // 16 or 8 hexadecimal characters. Fingerprints are strings of 40 + // hexadecimal characters. The key id is the last 16 characters of + // the key fingerprint. + if (strlen($tokens[1]) > 16) { + $signature->setKeyFingerprint($tokens[1]); + $signature->setKeyId(substr($tokens[1], -16)); + } else { + $signature->setKeyId($tokens[1]); + } + + $this->index++; + $this->signatures[$this->index] = $signature; + + break; + + case 'VALIDSIG': + if (!array_key_exists($this->index, $this->signatures)) { + break; + } + + $signature = $this->signatures[$this->index]; + + $signature->setValid(true); + $signature->setKeyFingerprint($tokens[1]); + + if (strpos($tokens[3], 'T') === false) { + $signature->setCreationDate($tokens[3]); + } else { + $signature->setCreationDate(strtotime($tokens[3])); + } + + if (array_key_exists(4, $tokens)) { + if (strpos($tokens[4], 'T') === false) { + $signature->setExpirationDate($tokens[4]); + } else { + $signature->setExpirationDate(strtotime($tokens[4])); + } + } + + break; + + case 'SIG_ID': + // note: signature id comes before new signature line and may not + // exist for some signature types + $this->signatureId = $tokens[1]; + break; + } + } + + // }}} + // {{{ getSignatures() + + /** + * Gets the {@link Crypt_GPG_Signature} objects parsed by this handler + * + * @return array the signature objects parsed by this handler. + */ + public function getSignatures() + { + return $this->signatures; + } + + // }}} +} + +?> diff --git a/plugins/enigma/lib/enigma_driver.php b/plugins/enigma/lib/enigma_driver.php new file mode 100644 index 0000000..a9a3e47 --- /dev/null +++ b/plugins/enigma/lib/enigma_driver.php @@ -0,0 +1,106 @@ + | + +-------------------------------------------------------------------------+ +*/ + +abstract class enigma_driver +{ + /** + * Class constructor. + * + * @param string User name (email address) + */ + abstract function __construct($user); + + /** + * Driver initialization. + * + * @return mixed NULL on success, enigma_error on failure + */ + abstract function init(); + + /** + * Encryption. + */ + abstract function encrypt($text, $keys); + + /** + * Decryption.. + */ + abstract function decrypt($text, $key, $passwd); + + /** + * Signing. + */ + abstract function sign($text, $key, $passwd); + + /** + * Signature verification. + * + * @param string Message body + * @param string Signature, if message is of type PGP/MIME and body doesn't contain it + * + * @return mixed Signature information (enigma_signature) or enigma_error + */ + abstract function verify($text, $signature); + + /** + * Key/Cert file import. + * + * @param string File name or file content + * @param bollean True if first argument is a filename + * + * @return mixed Import status array or enigma_error + */ + abstract function import($content, $isfile=false); + + /** + * Keys listing. + * + * @param string Optional pattern for key ID, user ID or fingerprint + * + * @return mixed Array of enigma_key objects or enigma_error + */ + abstract function list_keys($pattern=''); + + /** + * Single key information. + * + * @param string Key ID, user ID or fingerprint + * + * @return mixed Key (enigma_key) object or enigma_error + */ + abstract function get_key($keyid); + + /** + * Key pair generation. + * + * @param array Key/User data + * + * @return mixed Key (enigma_key) object or enigma_error + */ + abstract function gen_key($data); + + /** + * Key deletion. + */ + abstract function del_key($keyid); +} diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php new file mode 100644 index 0000000..5aa3221 --- /dev/null +++ b/plugins/enigma/lib/enigma_driver_gnupg.php @@ -0,0 +1,305 @@ + | + +-------------------------------------------------------------------------+ +*/ + +require_once 'Crypt/GPG.php'; + +class enigma_driver_gnupg extends enigma_driver +{ + private $rc; + private $gpg; + private $homedir; + private $user; + + function __construct($user) + { + $rcmail = rcmail::get_instance(); + $this->rc = $rcmail; + $this->user = $user; + } + + /** + * Driver initialization and environment checking. + * Should only return critical errors. + * + * @return mixed NULL on success, enigma_error on failure + */ + function init() + { + $homedir = $this->rc->config->get('enigma_pgp_homedir', INSTALL_PATH . '/plugins/enigma/home'); + + if (!$homedir) + return new enigma_error(enigma_error::E_INTERNAL, + "Option 'enigma_pgp_homedir' not specified"); + + // check if homedir exists (create it if not) and is readable + if (!file_exists($homedir)) + return new enigma_error(enigma_error::E_INTERNAL, + "Keys directory doesn't exists: $homedir"); + if (!is_writable($homedir)) + return new enigma_error(enigma_error::E_INTERNAL, + "Keys directory isn't writeable: $homedir"); + + $homedir = $homedir . '/' . $this->user; + + // check if user's homedir exists (create it if not) and is readable + if (!file_exists($homedir)) + mkdir($homedir, 0700); + + if (!file_exists($homedir)) + return new enigma_error(enigma_error::E_INTERNAL, + "Unable to create keys directory: $homedir"); + if (!is_writable($homedir)) + return new enigma_error(enigma_error::E_INTERNAL, + "Unable to write to keys directory: $homedir"); + + $this->homedir = $homedir; + + // Create Crypt_GPG object + try { + $this->gpg = new Crypt_GPG(array( + 'homedir' => $this->homedir, +// 'debug' => true, + )); + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + function encrypt($text, $keys) + { +/* + foreach ($keys as $key) { + $this->gpg->addEncryptKey($key); + } + $enc = $this->gpg->encrypt($text); + return $enc; +*/ + } + + function decrypt($text, $key, $passwd) + { +// $this->gpg->addDecryptKey($key, $passwd); + try { + $dec = $this->gpg->decrypt($text); + return $dec; + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + function sign($text, $key, $passwd) + { +/* + $this->gpg->addSignKey($key, $passwd); + $signed = $this->gpg->sign($text, Crypt_GPG::SIGN_MODE_DETACHED); + return $signed; +*/ + } + + function verify($text, $signature) + { + try { + $verified = $this->gpg->verify($text, $signature); + return $this->parse_signature($verified[0]); + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + public function import($content, $isfile=false) + { + try { + if ($isfile) + return $this->gpg->importKeyFile($content); + else + return $this->gpg->importKey($content); + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + public function list_keys($pattern='') + { + try { + $keys = $this->gpg->getKeys($pattern); + $result = array(); +//print_r($keys); + foreach ($keys as $idx => $key) { + $result[] = $this->parse_key($key); + unset($keys[$idx]); + } +//print_r($result); + return $result; + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + public function get_key($keyid) + { + $list = $this->list_keys($keyid); + + if (is_array($list)) + return array_shift($list); + + // error + return $list; + } + + public function gen_key($data) + { + } + + public function del_key($keyid) + { +// $this->get_key($keyid); + + + } + + public function del_privkey($keyid) + { + try { + $this->gpg->deletePrivateKey($keyid); + return true; + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + public function del_pubkey($keyid) + { + try { + $this->gpg->deletePublicKey($keyid); + return true; + } + catch (Exception $e) { + return $this->get_error_from_exception($e); + } + } + + /** + * Converts Crypt_GPG exception into Enigma's error object + * + * @param mixed Exception object + * + * @return enigma_error Error object + */ + private function get_error_from_exception($e) + { + $data = array(); + + if ($e instanceof Crypt_GPG_KeyNotFoundException) { + $error = enigma_error::E_KEYNOTFOUND; + $data['id'] = $e->getKeyId(); + } + else if ($e instanceof Crypt_GPG_BadPassphraseException) { + $error = enigma_error::E_BADPASS; + $data['bad'] = $e->getBadPassphrases(); + $data['missing'] = $e->getMissingPassphrases(); + } + else if ($e instanceof Crypt_GPG_NoDataException) + $error = enigma_error::E_NODATA; + else if ($e instanceof Crypt_GPG_DeletePrivateKeyException) + $error = enigma_error::E_DELKEY; + else + $error = enigma_error::E_INTERNAL; + + $msg = $e->getMessage(); + + return new enigma_error($error, $msg, $data); + } + + /** + * Converts Crypt_GPG_Signature object into Enigma's signature object + * + * @param Crypt_GPG_Signature Signature object + * + * @return enigma_signature Signature object + */ + private function parse_signature($sig) + { + $user = $sig->getUserId(); + + $data = new enigma_signature(); + $data->id = $sig->getId(); + $data->valid = $sig->isValid(); + $data->fingerprint = $sig->getKeyFingerprint(); + $data->created = $sig->getCreationDate(); + $data->expires = $sig->getExpirationDate(); + $data->name = $user->getName(); + $data->comment = $user->getComment(); + $data->email = $user->getEmail(); + + return $data; + } + + /** + * Converts Crypt_GPG_Key object into Enigma's key object + * + * @param Crypt_GPG_Key Key object + * + * @return enigma_key Key object + */ + private function parse_key($key) + { + $ekey = new enigma_key(); + + foreach ($key->getUserIds() as $idx => $user) { + $id = new enigma_userid(); + $id->name = $user->getName(); + $id->comment = $user->getComment(); + $id->email = $user->getEmail(); + $id->valid = $user->isValid(); + $id->revoked = $user->isRevoked(); + + $ekey->users[$idx] = $id; + } + + $ekey->name = trim($ekey->users[0]->name . ' <' . $ekey->users[0]->email . '>'); + + foreach ($key->getSubKeys() as $idx => $subkey) { + $skey = new enigma_subkey(); + $skey->id = $subkey->getId(); + $skey->revoked = $subkey->isRevoked(); + $skey->created = $subkey->getCreationDate(); + $skey->expires = $subkey->getExpirationDate(); + $skey->fingerprint = $subkey->getFingerprint(); + $skey->has_private = $subkey->hasPrivate(); + $skey->can_sign = $subkey->canSign(); + $skey->can_encrypt = $subkey->canEncrypt(); + + $ekey->subkeys[$idx] = $skey; + }; + + $ekey->id = $ekey->subkeys[0]->id; + + return $ekey; + } +} diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php new file mode 100644 index 0000000..59ae120 --- /dev/null +++ b/plugins/enigma/lib/enigma_engine.php @@ -0,0 +1,547 @@ + | + +-------------------------------------------------------------------------+ + +*/ + +/* + RFC2440: OpenPGP Message Format + RFC3156: MIME Security with OpenPGP + RFC3851: S/MIME +*/ + +class enigma_engine +{ + private $rc; + private $enigma; + private $pgp_driver; + private $smime_driver; + + public $decryptions = array(); + public $signatures = array(); + public $signed_parts = array(); + + + /** + * Plugin initialization. + */ + function __construct($enigma) + { + $rcmail = rcmail::get_instance(); + $this->rc = $rcmail; + $this->enigma = $enigma; + } + + /** + * PGP driver initialization. + */ + function load_pgp_driver() + { + if ($this->pgp_driver) + return; + + $driver = 'enigma_driver_' . $this->rc->config->get('enigma_pgp_driver', 'gnupg'); + $username = $this->rc->user->get_username(); + + // Load driver + $this->pgp_driver = new $driver($username); + + if (!$this->pgp_driver) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: Unable to load PGP driver: $driver" + ), true, true); + } + + // Initialise driver + $result = $this->pgp_driver->init(); + + if ($result instanceof enigma_error) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: ".$result->getMessage() + ), true, true); + } + } + + /** + * S/MIME driver initialization. + */ + function load_smime_driver() + { + if ($this->smime_driver) + return; + + // NOT IMPLEMENTED! + return; + + $driver = 'enigma_driver_' . $this->rc->config->get('enigma_smime_driver', 'phpssl'); + $username = $this->rc->user->get_username(); + + // Load driver + $this->smime_driver = new $driver($username); + + if (!$this->smime_driver) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: Unable to load S/MIME driver: $driver" + ), true, true); + } + + // Initialise driver + $result = $this->smime_driver->init(); + + if ($result instanceof enigma_error) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: ".$result->getMessage() + ), true, true); + } + } + + /** + * Handler for plain/text message. + * + * @param array Reference to hook's parameters + */ + function parse_plain(&$p) + { + $part = $p['structure']; + + // Get message body from IMAP server + $this->set_part_body($part, $p['object']->uid); + + // @TODO: big message body can be a file resource + // PGP signed message + if (preg_match('/^-----BEGIN PGP SIGNED MESSAGE-----/', $part->body)) { + $this->parse_plain_signed($p); + } + // PGP encrypted message + else if (preg_match('/^-----BEGIN PGP MESSAGE-----/', $part->body)) { + $this->parse_plain_encrypted($p); + } + } + + /** + * Handler for multipart/signed message. + * + * @param array Reference to hook's parameters + */ + function parse_signed(&$p) + { + $struct = $p['structure']; + + // S/MIME + if ($struct->parts[1] && $struct->parts[1]->mimetype == 'application/pkcs7-signature') { + $this->parse_smime_signed($p); + } + // PGP/MIME: + // The multipart/signed body MUST consist of exactly two parts. + // The first part contains the signed data in MIME canonical format, + // including a set of appropriate content headers describing the data. + // The second body MUST contain the PGP digital signature. It MUST be + // labeled with a content type of "application/pgp-signature". + else if ($struct->parts[1] && $struct->parts[1]->mimetype == 'application/pgp-signature') { + $this->parse_pgp_signed($p); + } + } + + /** + * Handler for multipart/encrypted message. + * + * @param array Reference to hook's parameters + */ + function parse_encrypted(&$p) + { + $struct = $p['structure']; + + // S/MIME + if ($struct->mimetype == 'application/pkcs7-mime') { + $this->parse_smime_encrypted($p); + } + // PGP/MIME: + // The multipart/encrypted MUST consist of exactly two parts. The first + // MIME body part must have a content type of "application/pgp-encrypted". + // This body contains the control information. + // The second MIME body part MUST contain the actual encrypted data. It + // must be labeled with a content type of "application/octet-stream". + else if ($struct->parts[0] && $struct->parts[0]->mimetype == 'application/pgp-encrypted' && + $struct->parts[1] && $struct->parts[1]->mimetype == 'application/octet-stream' + ) { + $this->parse_pgp_encrypted($p); + } + } + + /** + * Handler for plain signed message. + * Excludes message and signature bodies and verifies signature. + * + * @param array Reference to hook's parameters + */ + private function parse_plain_signed(&$p) + { + $this->load_pgp_driver(); + $part = $p['structure']; + + // Verify signature + if ($this->rc->action == 'show' || $this->rc->action == 'preview') { + $sig = $this->pgp_verify($part->body); + } + + // @TODO: Handle big bodies using (temp) files + + // In this way we can use fgets on string as on file handle + $fh = fopen('php://memory', 'br+'); + // @TODO: fopen/fwrite errors handling + if ($fh) { + fwrite($fh, $part->body); + rewind($fh); + } + $part->body = null; + + // Extract body (and signature?) + while (!feof($fh)) { + $line = fgets($fh, 1024); + + if ($part->body === null) + $part->body = ''; + else if (preg_match('/^-----BEGIN PGP SIGNATURE-----/', $line)) + break; + else + $part->body .= $line; + } + + // Remove "Hash" Armor Headers + $part->body = preg_replace('/^.*\r*\n\r*\n/', '', $part->body); + // de-Dash-Escape (RFC2440) + $part->body = preg_replace('/(^|\n)- -/', '\\1-', $part->body); + + // Store signature data for display + if (!empty($sig)) { + $this->signed_parts[$part->mime_id] = $part->mime_id; + $this->signatures[$part->mime_id] = $sig; + } + + fclose($fh); + } + + /** + * Handler for PGP/MIME signed message. + * Verifies signature. + * + * @param array Reference to hook's parameters + */ + private function parse_pgp_signed(&$p) + { + $this->load_pgp_driver(); + $struct = $p['structure']; + + // Verify signature + if ($this->rc->action == 'show' || $this->rc->action == 'preview') { + $msg_part = $struct->parts[0]; + $sig_part = $struct->parts[1]; + + // Get bodies + $this->set_part_body($msg_part, $p['object']->uid); + $this->set_part_body($sig_part, $p['object']->uid); + + // Verify + $sig = $this->pgp_verify($msg_part->body, $sig_part->body); + + // Store signature data for display + $this->signatures[$struct->mime_id] = $sig; + + // Message can be multipart (assign signature to each subpart) + if (!empty($msg_part->parts)) { + foreach ($msg_part->parts as $part) + $this->signed_parts[$part->mime_id] = $struct->mime_id; + } + else + $this->signed_parts[$msg_part->mime_id] = $struct->mime_id; + + // Remove signature file from attachments list + unset($struct->parts[1]); + } + } + + /** + * Handler for S/MIME signed message. + * Verifies signature. + * + * @param array Reference to hook's parameters + */ + private function parse_smime_signed(&$p) + { + $this->load_smime_driver(); + } + + /** + * Handler for plain encrypted message. + * + * @param array Reference to hook's parameters + */ + private function parse_plain_encrypted(&$p) + { + $this->load_pgp_driver(); + $part = $p['structure']; + + // Get body + $this->set_part_body($part, $p['object']->uid); + + // Decrypt + $result = $this->pgp_decrypt($part->body); + + // Store decryption status + $this->decryptions[$part->mime_id] = $result; + + // Parse decrypted message + if ($result === true) { + // @TODO + } + } + + /** + * Handler for PGP/MIME encrypted message. + * + * @param array Reference to hook's parameters + */ + private function parse_pgp_encrypted(&$p) + { + $this->load_pgp_driver(); + $struct = $p['structure']; + $part = $struct->parts[1]; + + // Get body + $this->set_part_body($part, $p['object']->uid); + + // Decrypt + $result = $this->pgp_decrypt($part->body); + + $this->decryptions[$part->mime_id] = $result; +//print_r($part); + // Parse decrypted message + if ($result === true) { + // @TODO + } + else { + // Make sure decryption status message will be displayed + $part->type = 'content'; + $p['object']->parts[] = $part; + } + } + + /** + * Handler for S/MIME encrypted message. + * + * @param array Reference to hook's parameters + */ + private function parse_smime_encrypted(&$p) + { + $this->load_smime_driver(); + } + + /** + * PGP signature verification. + * + * @param mixed Message body + * @param mixed Signature body (for MIME messages) + * + * @return mixed enigma_signature or enigma_error + */ + private function pgp_verify(&$msg_body, $sig_body=null) + { + // @TODO: Handle big bodies using (temp) files + // @TODO: caching of verification result + + $sig = $this->pgp_driver->verify($msg_body, $sig_body); + + if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::E_KEYNOTFOUND) + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: " . $error->getMessage() + ), true, false); + +//print_r($sig); + return $sig; + } + + /** + * PGP message decryption. + * + * @param mixed Message body + * + * @return mixed True or enigma_error + */ + private function pgp_decrypt(&$msg_body) + { + // @TODO: Handle big bodies using (temp) files + // @TODO: caching of verification result + + $result = $this->pgp_driver->decrypt($msg_body, $key, $pass); + +//print_r($result); + + if ($result instanceof enigma_error) { + $err_code = $result->getCode(); + if (!in_array($err_code, array(enigma_error::E_KEYNOTFOUND, enigma_error::E_BADPASS))) + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: " . $result->getMessage() + ), true, false); + return $result; + } + +// $msg_body = $result; + return true; + } + + /** + * PGP keys listing. + * + * @param mixed Key ID/Name pattern + * + * @return mixed Array of keys or enigma_error + */ + function list_keys($pattern='') + { + $this->load_pgp_driver(); + $result = $this->pgp_driver->list_keys($pattern); + + if ($result instanceof enigma_error) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: " . $result->getMessage() + ), true, false); + } + + return $result; + } + + /** + * PGP key details. + * + * @param mixed Key ID + * + * @return mixed enigma_key or enigma_error + */ + function get_key($keyid) + { + $this->load_pgp_driver(); + $result = $this->pgp_driver->get_key($keyid); + + if ($result instanceof enigma_error) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: " . $result->getMessage() + ), true, false); + } + + return $result; + } + + /** + * PGP keys/certs importing. + * + * @param mixed Import file name or content + * @param boolean True if first argument is a filename + * + * @return mixed Import status data array or enigma_error + */ + function import_key($content, $isfile=false) + { + $this->load_pgp_driver(); + $result = $this->pgp_driver->import($content, $isfile); + + if ($result instanceof enigma_error) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Enigma plugin: " . $result->getMessage() + ), true, false); + } + else { + $result['imported'] = $result['public_imported'] + $result['private_imported']; + $result['unchanged'] = $result['public_unchanged'] + $result['private_unchanged']; + } + + return $result; + } + + /** + * Handler for keys/certs import request action + */ + function import_file() + { + $uid = get_input_value('_uid', RCUBE_INPUT_POST); + $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); + $mime_id = get_input_value('_part', RCUBE_INPUT_POST); + + if ($uid && $mime_id) { + $part = $this->rc->imap->get_message_part($uid, $mime_id); + } + + if ($part && is_array($result = $this->import_key($part))) { + $this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation', + array('new' => $result['imported'], 'old' => $result['unchanged'])); + } + else + $this->rc->output->show_message('enigma.keysimportfailed', 'error'); + + $this->rc->output->send(); + } + + /** + * Checks if specified message part contains body data. + * If body is not set it will be fetched from IMAP server. + * + * @param rcube_message_part Message part object + * @param integer Message UID + */ + private function set_part_body($part, $uid) + { + // @TODO: Create such function in core + // @TODO: Handle big bodies using file handles + if (!isset($part->body)) { + $part->body = $this->rc->imap->get_message_part( + $uid, $part->mime_id, $part); + } + } + + /** + * Adds CSS style file to the page header. + */ + private function add_css() + { + $skin = $this->rc->config->get('skin'); + if (!file_exists($this->home . "/skins/$skin/enigma.css")) + $skin = 'default'; + + $this->include_stylesheet("skins/$skin/enigma.css"); + } +} diff --git a/plugins/enigma/lib/enigma_error.php b/plugins/enigma/lib/enigma_error.php new file mode 100644 index 0000000..9f424dc --- /dev/null +++ b/plugins/enigma/lib/enigma_error.php @@ -0,0 +1,62 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_error +{ + private $code; + private $message; + private $data = array(); + + // error codes + const E_OK = 0; + const E_INTERNAL = 1; + const E_NODATA = 2; + const E_KEYNOTFOUND = 3; + const E_DELKEY = 4; + const E_BADPASS = 5; + + function __construct($code = null, $message = '', $data = array()) + { + $this->code = $code; + $this->message = $message; + $this->data = $data; + } + + function getCode() + { + return $this->code; + } + + function getMessage() + { + return $this->message; + } + + function getData($name) + { + if ($name) + return $this->data[$name]; + else + return $this->data; + } +} diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php new file mode 100644 index 0000000..520c36b --- /dev/null +++ b/plugins/enigma/lib/enigma_key.php @@ -0,0 +1,129 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_key +{ + public $id; + public $name; + public $users = array(); + public $subkeys = array(); + + const TYPE_UNKNOWN = 0; + const TYPE_KEYPAIR = 1; + const TYPE_PUBLIC = 2; + + /** + * Keys list sorting callback for usort() + */ + static function cmp($a, $b) + { + return strcmp($a->name, $b->name); + } + + /** + * Returns key type + */ + function get_type() + { + if ($this->subkeys[0]->has_private) + return enigma_key::TYPE_KEYPAIR; + else if (!empty($this->subkeys[0])) + return enigma_key::TYPE_PUBLIC; + + return enigma_key::TYPE_UNKNOWN; + } + + /** + * Returns true if all user IDs are revoked + */ + function is_revoked() + { + foreach ($this->subkeys as $subkey) + if (!$subkey->revoked) + return false; + + return true; + } + + /** + * Returns true if any user ID is valid + */ + function is_valid() + { + foreach ($this->users as $user) + if ($user->valid) + return true; + + return false; + } + + /** + * Returns true if any of subkeys is not expired + */ + function is_expired() + { + $now = time(); + + foreach ($this->subkeys as $subkey) + if (!$subkey->expires || $subkey->expires > $now) + return true; + + return false; + } + + /** + * Converts long ID or Fingerprint to short ID + * Crypt_GPG uses internal, but e.g. Thunderbird's Enigmail displays short ID + * + * @param string Key ID or fingerprint + * @return string Key short ID + */ + static function format_id($id) + { + // E.g. 04622F2089E037A5 => 89E037A5 + + return substr($id, -8); + } + + /** + * Formats fingerprint string + * + * @param string Key fingerprint + * + * @return string Formatted fingerprint (with spaces) + */ + static function format_fingerprint($fingerprint) + { + if (!$fingerprint) + return ''; + + $result = ''; + for ($i=0; $i<40; $i++) { + if ($i % 4 == 0) + $result .= ' '; + $result .= $fingerprint[$i]; + } + return $result; + } + +} diff --git a/plugins/enigma/lib/enigma_signature.php b/plugins/enigma/lib/enigma_signature.php new file mode 100644 index 0000000..6599090 --- /dev/null +++ b/plugins/enigma/lib/enigma_signature.php @@ -0,0 +1,34 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_signature +{ + public $id; + public $valid; + public $fingerprint; + public $created; + public $expires; + public $name; + public $comment; + public $email; +} diff --git a/plugins/enigma/lib/enigma_subkey.php b/plugins/enigma/lib/enigma_subkey.php new file mode 100644 index 0000000..1b9fb95 --- /dev/null +++ b/plugins/enigma/lib/enigma_subkey.php @@ -0,0 +1,57 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_subkey +{ + public $id; + public $fingerprint; + public $expires; + public $created; + public $revoked; + public $has_private; + public $can_sign; + public $can_encrypt; + + /** + * Converts internal ID to short ID + * Crypt_GPG uses internal, but e.g. Thunderbird's Enigmail displays short ID + * + * @return string Key ID + */ + function get_short_id() + { + // E.g. 04622F2089E037A5 => 89E037A5 + return enigma_key::format_id($this->id); + } + + /** + * Getter for formatted fingerprint + * + * @return string Formatted fingerprint + */ + function get_fingerprint() + { + return enigma_key::format_fingerprint($this->fingerprint); + } + +} diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php new file mode 100644 index 0000000..b9ccff5 --- /dev/null +++ b/plugins/enigma/lib/enigma_ui.php @@ -0,0 +1,459 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_ui +{ + private $rc; + private $enigma; + private $home; + private $css_added; + private $data; + + + function __construct($enigma_plugin, $home='') + { + $this->enigma = $enigma_plugin; + $this->rc = $enigma_plugin->rc; + // we cannot use $enigma_plugin->home here + $this->home = $home; + } + + /** + * UI initialization and requests handlers. + * + * @param string Preferences section + */ + function init($section='') + { + $this->enigma->include_script('enigma.js'); + + // Enigma actions + if ($this->rc->action == 'plugin.enigma') { + $action = get_input_value('_a', RCUBE_INPUT_GPC); + + switch ($action) { + case 'keyedit': + $this->key_edit(); + break; + case 'keyimport': + $this->key_import(); + break; + case 'keysearch': + case 'keylist': + $this->key_list(); + break; + case 'keyinfo': + default: + $this->key_info(); + } + } + // Message composing UI + else if ($this->rc->action == 'compose') { + $this->compose_ui(); + } + // Preferences UI + else { // if ($this->rc->action == 'edit-prefs') { + if ($section == 'enigmacerts') { + $this->rc->output->add_handlers(array( + 'keyslist' => array($this, 'tpl_certs_list'), + 'keyframe' => array($this, 'tpl_cert_frame'), + 'countdisplay' => array($this, 'tpl_certs_rowcount'), + 'searchform' => array($this->rc->output, 'search_form'), + )); + $this->rc->output->set_pagetitle($this->enigma->gettext('enigmacerts')); + $this->rc->output->send('enigma.certs'); + } + else { + $this->rc->output->add_handlers(array( + 'keyslist' => array($this, 'tpl_keys_list'), + 'keyframe' => array($this, 'tpl_key_frame'), + 'countdisplay' => array($this, 'tpl_keys_rowcount'), + 'searchform' => array($this->rc->output, 'search_form'), + )); + $this->rc->output->set_pagetitle($this->enigma->gettext('enigmakeys')); + $this->rc->output->send('enigma.keys'); + } + } + } + + /** + * Adds CSS style file to the page header. + */ + function add_css() + { + if ($this->css_loaded) + return; + + $skin = $this->rc->config->get('skin'); + if (!file_exists($this->home . "/skins/$skin/enigma.css")) + $skin = 'default'; + + $this->enigma->include_stylesheet("skins/$skin/enigma.css"); + $this->css_added = true; + } + + /** + * Template object for key info/edit frame. + * + * @param array Object attributes + * + * @return string HTML output + */ + function tpl_key_frame($attrib) + { + if (!$attrib['id']) { + $attrib['id'] = 'rcmkeysframe'; + } + + $attrib['name'] = $attrib['id']; + + $this->rc->output->set_env('contentframe', $attrib['name']); + $this->rc->output->set_env('blankpage', $attrib['src'] ? + $this->rc->output->abs_url($attrib['src']) : 'program/blank.gif'); + + return html::tag('iframe', $attrib); + } + + /** + * Template object for list of keys. + * + * @param array Object attributes + * + * @return string HTML content + */ + function tpl_keys_list($attrib) + { + // add id to message list table if not specified + if (!strlen($attrib['id'])) { + $attrib['id'] = 'rcmenigmakeyslist'; + } + + // define list of cols to be displayed + $a_show_cols = array('name'); + + // create XHTML table + $out = rcube_table_output($attrib, array(), $a_show_cols, 'id'); + + // set client env + $this->rc->output->add_gui_object('keyslist', $attrib['id']); + $this->rc->output->include_script('list.js'); + + // add some labels to client + $this->rc->output->add_label('enigma.keyconfirmdelete'); + + return $out; + } + + /** + * Key listing (and searching) request handler + */ + private function key_list() + { + $this->enigma->load_engine(); + + $pagesize = $this->rc->config->get('pagesize', 100); + $page = max(intval(get_input_value('_p', RCUBE_INPUT_GPC)), 1); + $search = get_input_value('_q', RCUBE_INPUT_GPC); + + // define list of cols to be displayed + $a_show_cols = array('name'); + $result = array(); + + // Get the list + $list = $this->enigma->engine->list_keys($search); + + if ($list && ($list instanceof enigma_error)) + $this->rc->output->show_message('enigma.keylisterror', 'error'); + else if (empty($list)) + $this->rc->output->show_message('enigma.nokeysfound', 'notice'); + else { + if (is_array($list)) { + // Save the size + $listsize = count($list); + + // Sort the list by key (user) name + usort($list, array('enigma_key', 'cmp')); + + // Slice current page + $list = array_slice($list, ($page - 1) * $pagesize, $pagesize); + + $size = count($list); + + // Add rows + foreach($list as $idx => $key) { + $this->rc->output->command('enigma_add_list_row', + array('name' => Q($key->name), 'id' => $key->id)); + } + } + } + + $this->rc->output->set_env('search_request', $search); + $this->rc->output->set_env('pagecount', ceil($listsize/$pagesize)); + $this->rc->output->set_env('current_page', $page); + $this->rc->output->command('set_rowcount', + $this->get_rowcount_text($listsize, $size, $page)); + + $this->rc->output->send(); + } + + /** + * Template object for list records counter. + * + * @param array Object attributes + * + * @return string HTML output + */ + function tpl_keys_rowcount($attrib) + { + if (!$attrib['id']) + $attrib['id'] = 'rcmcountdisplay'; + + $this->rc->output->add_gui_object('countdisplay', $attrib['id']); + + return html::span($attrib, $this->get_rowcount_text()); + } + + /** + * Returns text representation of list records counter + */ + private function get_rowcount_text($all=0, $curr_count=0, $page=1) + { + if (!$curr_count) + $out = $this->enigma->gettext('nokeysfound'); + else { + $pagesize = $this->rc->config->get('pagesize', 100); + $first = ($page - 1) * $pagesize; + + $out = $this->enigma->gettext(array( + 'name' => 'keysfromto', + 'vars' => array( + 'from' => $first + 1, + 'to' => $first + $curr_count, + 'count' => $all) + )); + } + + return $out; + } + + /** + * Key information page handler + */ + private function key_info() + { + $id = get_input_value('_id', RCUBE_INPUT_GET); + + $this->enigma->load_engine(); + $res = $this->enigma->engine->get_key($id); + + if ($res instanceof enigma_key) + $this->data = $res; + else { // error + $this->rc->output->show_message('enigma.keyopenerror', 'error'); + $this->rc->output->command('parent.enigma_loadframe'); + $this->rc->output->send('iframe'); + } + + $this->rc->output->add_handlers(array( + 'keyname' => array($this, 'tpl_key_name'), + 'keydata' => array($this, 'tpl_key_data'), + )); + + $this->rc->output->set_pagetitle($this->enigma->gettext('keyinfo')); + $this->rc->output->send('enigma.keyinfo'); + } + + /** + * Template object for key name + */ + function tpl_key_name($attrib) + { + return Q($this->data->name); + } + + /** + * Template object for key information page content + */ + function tpl_key_data($attrib) + { + $out = ''; + $table = new html_table(array('cols' => 2)); + + // Key user ID + $table->add('title', $this->enigma->gettext('keyuserid')); + $table->add(null, Q($this->data->name)); + // Key ID + $table->add('title', $this->enigma->gettext('keyid')); + $table->add(null, $this->data->subkeys[0]->get_short_id()); + // Key type + $keytype = $this->data->get_type(); + if ($keytype == enigma_key::TYPE_KEYPAIR) + $type = $this->enigma->gettext('typekeypair'); + else if ($keytype == enigma_key::TYPE_PUBLIC) + $type = $this->enigma->gettext('typepublickey'); + $table->add('title', $this->enigma->gettext('keytype')); + $table->add(null, $type); + // Key fingerprint + $table->add('title', $this->enigma->gettext('fingerprint')); + $table->add(null, $this->data->subkeys[0]->get_fingerprint()); + + $out .= html::tag('fieldset', null, + html::tag('legend', null, + $this->enigma->gettext('basicinfo')) . $table->show($attrib)); + + // Subkeys + $table = new html_table(array('cols' => 6)); + // Columns: Type, ID, Algorithm, Size, Created, Expires + + $out .= html::tag('fieldset', null, + html::tag('legend', null, + $this->enigma->gettext('subkeys')) . $table->show($attrib)); + + // Additional user IDs + $table = new html_table(array('cols' => 2)); + // Columns: User ID, Validity + + $out .= html::tag('fieldset', null, + html::tag('legend', null, + $this->enigma->gettext('userids')) . $table->show($attrib)); + + return $out; + } + + /** + * Key import page handler + */ + private function key_import() + { + // Import process + if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name'])) { + $this->enigma->load_engine(); + $result = $this->enigma->engine->import_key($_FILES['_file']['tmp_name'], true); + + if (is_array($result)) { + // reload list if any keys has been added + if ($result['imported']) { + $this->rc->output->command('parent.enigma_list', 1); + } + else + $this->rc->output->command('parent.enigma_loadframe'); + + $this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation', + array('new' => $result['imported'], 'old' => $result['unchanged'])); + + $this->rc->output->send('iframe'); + } + else + $this->rc->output->show_message('enigma.keysimportfailed', 'error'); + } + else if ($err = $_FILES['_file']['error']) { + if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { + $this->rc->output->show_message('filesizeerror', 'error', + array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))); + } else { + $this->rc->output->show_message('fileuploaderror', 'error'); + } + } + + $this->rc->output->add_handlers(array( + 'importform' => array($this, 'tpl_key_import_form'), + )); + + $this->rc->output->set_pagetitle($this->enigma->gettext('keyimport')); + $this->rc->output->send('enigma.keyimport'); + } + + /** + * Template object for key import (upload) form + */ + function tpl_key_import_form($attrib) + { + $attrib += array('id' => 'rcmKeyImportForm'); + + $upload = new html_inputfield(array('type' => 'file', 'name' => '_file', + 'id' => 'rcmimportfile', 'size' => 30)); + + $form = html::p(null, + Q($this->enigma->gettext('keyimporttext'), 'show') + . html::br() . html::br() . $upload->show() + ); + + $this->rc->output->add_label('selectimportfile', 'importwait'); + $this->rc->output->add_gui_object('importform', $attrib['id']); + + $out = $this->rc->output->form_tag(array( + 'action' => $this->rc->url(array('action' => 'plugin.enigma', 'a' => 'keyimport')), + 'method' => 'post', + 'enctype' => 'multipart/form-data') + $attrib, + $form); + + return $out; + } + + private function compose_ui() + { + if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) + return; + + // Options menu button + // @TODO: make this work with non-default skins + $this->enigma->add_button(array( + 'name' => 'enigmamenu', + 'imagepas' => 'skins/default/enigma.png', + 'imageact' => 'skins/default/enigma.png', + 'onclick' => "rcmail_ui.show_popup('enigmamenu', true); return false", + 'title' => 'securityoptions', + 'domain' => 'enigma', + ), 'toolbar'); + + // Options menu contents + $this->enigma->add_hook('render_page', array($this, 'compose_menu')); + } + + function compose_menu($p) + { + $menu = new html_table(array('cols' => 2)); + $chbox = new html_checkbox(array('value' => 1)); + + $menu->add(null, html::label(array('for' => 'enigmadefaultopt'), + Q($this->enigma->gettext('identdefault')))); + $menu->add(null, $chbox->show(1, array('name' => '_enigma_default', 'id' => 'enigmadefaultopt'))); + + $menu->add(null, html::label(array('for' => 'enigmasignopt'), + Q($this->enigma->gettext('signmsg')))); + $menu->add(null, $chbox->show(1, array('name' => '_enigma_sign', 'id' => 'enigmasignopt'))); + + $menu->add(null, html::label(array('for' => 'enigmacryptopt'), + Q($this->enigma->gettext('encryptmsg')))); + $menu->add(null, $chbox->show(1, array('name' => '_enigma_crypt', 'id' => 'enigmacryptopt'))); + + $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), + $menu->show()); + + $p['content'] = preg_replace('/(
    ]+>)/i', '\\1'."\n$menu", $p['content']); + + return $p; + + } + +} diff --git a/plugins/enigma/lib/enigma_userid.php b/plugins/enigma/lib/enigma_userid.php new file mode 100644 index 0000000..36185e7 --- /dev/null +++ b/plugins/enigma/lib/enigma_userid.php @@ -0,0 +1,31 @@ + | + +-------------------------------------------------------------------------+ +*/ + +class enigma_userid +{ + public $revoked; + public $valid; + public $name; + public $comment; + public $email; +} diff --git a/plugins/enigma/localization/en_US.inc b/plugins/enigma/localization/en_US.inc new file mode 100644 index 0000000..e0f03d9 --- /dev/null +++ b/plugins/enigma/localization/en_US.inc @@ -0,0 +1,53 @@ + diff --git a/plugins/enigma/localization/ja_JP.inc b/plugins/enigma/localization/ja_JP.inc new file mode 100644 index 0000000..8820144 --- /dev/null +++ b/plugins/enigma/localization/ja_JP.inc @@ -0,0 +1,55 @@ + diff --git a/plugins/enigma/localization/ru_RU.inc b/plugins/enigma/localization/ru_RU.inc new file mode 100644 index 0000000..3033d00 --- /dev/null +++ b/plugins/enigma/localization/ru_RU.inc @@ -0,0 +1,65 @@ + | +| Updates: | ++-----------------------------------------------------------------------+ + +@version 2010-12-23 + +*/ + +$labels = array(); +$labels['enigmasettings'] = 'Enigma: Настройки'; +$labels['enigmacerts'] = 'Enigma: Сертификаты (S/MIME)'; +$labels['enigmakeys'] = 'Enigma: Ключи (PGP)'; +$labels['keysfromto'] = 'Ключи от $from к $to в количестве $count'; +$labels['keyname'] = 'Имя'; +$labels['keyid'] = 'Идентификатор ключа'; +$labels['keyuserid'] = 'Идентификатор пользователя'; +$labels['keytype'] = 'Тип ключа'; +$labels['fingerprint'] = 'Отпечаток (хэш) ключа'; +$labels['subkeys'] = 'Подразделы'; +$labels['basicinfo'] = 'Основные сведения'; +$labels['userids'] = 'Дополнительные идентификаторы пользователя'; +$labels['typepublickey'] = 'Открытый ключ'; +$labels['typekeypair'] = 'пара ключей'; +$labels['keyattfound'] = 'Это сообщение содержит один или несколько ключей PGP.'; +$labels['keyattimport'] = 'Импортировать ключи'; + +$labels['createkeys'] = 'Создать новую пару ключей'; +$labels['importkeys'] = 'Импортировать ключ(и)'; +$labels['exportkeys'] = 'Экспортировать ключ(и)'; +$labels['deletekeys'] = 'Удалить ключ(и)'; +$labels['keyactions'] = 'Действия с ключами...'; +$labels['keydisable'] = 'Отключить ключ'; +$labels['keyrevoke'] = 'Отозвать ключ'; +$labels['keysend'] = 'Отправить публичный ключ в собщении'; +$labels['keychpass'] = 'Изменить пароль'; + +$messages = array(); +$messages['sigvalid'] = 'Проверенная подпись у $sender.'; +$messages['siginvalid'] = 'Неверная подпись у $sender.'; +$messages['signokey'] = 'Непроверяемая подпись. Открытый ключ не найден. Идентификатор ключа: $keyid.'; +$messages['sigerror'] = 'Непроверяемая подпись. Внутренняя ошибка.'; +$messages['decryptok'] = 'Сообщение расшифровано.'; +$messages['decrypterror'] = 'Расшифровка не удалась.'; +$messages['decryptnokey'] = 'Расшифровка не удалась. Секретный ключ не найден. Идентификатор ключа: $keyid.'; +$messages['decryptbadpass'] = 'Расшифровка не удалась. Неправильный пароль.'; +$messages['nokeysfound'] = 'Ключи не найдены'; +$messages['keyopenerror'] = 'Невозможно получить информацию о ключе! Внутренняя ошибка.'; +$messages['keylisterror'] = 'Невозможно сделать список ключей! Внутренняя ошибка.'; +$messages['keysimportfailed'] = 'Невозможно импортировать ключ(и)! Внутренняя ошибка.'; +$messages['keysimportsuccess'] = 'Ключи успешно импортированы. Импортировано: $new, без изменений: $old.'; +$messages['keyconfirmdelete'] = 'Вы точно хотите удалить выбранные ключи?'; +$messages['keyimporttext'] = 'Вы можете импортировать открытые и секретные ключи или сообщения об отзыве ключей в формате ASCII-Armor.'; + +?> diff --git a/plugins/enigma/skins/default/enigma.css b/plugins/enigma/skins/default/enigma.css new file mode 100644 index 0000000..b1c656f --- /dev/null +++ b/plugins/enigma/skins/default/enigma.css @@ -0,0 +1,182 @@ +/*** Style for Enigma plugin ***/ + +/***** Messages displaying *****/ + +#enigma-message, +/* fixes border-top */ +#messagebody div #enigma-message +{ + margin: 0; + margin-bottom: 5px; + min-height: 20px; + padding: 10px 10px 6px 46px; +} + +div.enigmaerror, +/* fixes border-top */ +#messagebody div.enigmaerror +{ + background: url(enigma_error.png) 6px 1px no-repeat; + background-color: #EF9398; + border: 1px solid #DC5757; +} + +div.enigmanotice, +/* fixes border-top */ +#messagebody div.enigmanotice +{ + background: url(enigma.png) 6px 1px no-repeat; + background-color: #A6EF7B; + border: 1px solid #76C83F; +} + +div.enigmawarning, +/* fixes border-top */ +#messagebody div.enigmawarning +{ + background: url(enigma.png) 6px 1px no-repeat; + background-color: #F7FDCB; + border: 1px solid #C2D071; +} + +#enigma-message a +{ + color: #666666; + padding-left: 10px; +} + +#enigma-message a:hover +{ + color: #333333; +} + +/***** Keys/Certs Management *****/ + +div.enigmascreen +{ + position: absolute; + top: 65px; + right: 10px; + bottom: 10px; + left: 10px; +} + +#enigmacontent-box +{ + position: absolute; + top: 0px; + left: 290px; + right: 0px; + bottom: 0px; + border: 1px solid #999999; + overflow: hidden; +} + +#enigmakeyslist +{ + position: absolute; + top: 0; + bottom: 0; + left: 0; + border: 1px solid #999999; + background-color: #F9F9F9; + overflow: hidden; +} + +#keylistcountbar +{ + margin-top: 4px; + margin-left: 4px; +} + +#keys-table +{ + width: 100%; + table-layout: fixed; +} + +#keys-table td +{ + cursor: default; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; +} + +#key-details table td.title +{ + font-weight: bold; + text-align: right; +} + +#keystoolbar +{ + position: absolute; + top: 30px; + left: 10px; + height: 35px; +} + +#keystoolbar a +{ + padding-right: 10px; +} + +#keystoolbar a.button, +#keystoolbar a.buttonPas, +#keystoolbar span.separator { + display: block; + float: left; + width: 32px; + height: 32px; + padding: 0; + margin-right: 10px; + overflow: hidden; + background: url(keys_toolbar.png) 0 0 no-repeat transparent; + opacity: 0.99; /* this is needed to make buttons appear correctly in Chrome */ +} + +#keystoolbar a.buttonPas { + opacity: 0.35; +} + +#keystoolbar a.createSel { + background-position: 0 -32px; +} + +#keystoolbar a.create { + background-position: 0 0; +} + +#keystoolbar a.deleteSel { + background-position: -32px -32px; +} + +#keystoolbar a.delete { + background-position: -32px 0; +} + +#keystoolbar a.importSel { + background-position: -64px -32px; +} + +#keystoolbar a.import { + background-position: -64px 0; +} + +#keystoolbar a.exportSel { + background-position: -96px -32px; +} + +#keystoolbar a.export { + background-position: -96px 0; +} + +#keystoolbar a.keymenu { + background-position: -128px 0; + width: 36px; +} + +#keystoolbar span.separator { + width: 5px; + background-position: -166px 0; +} diff --git a/plugins/enigma/skins/default/enigma.png b/plugins/enigma/skins/default/enigma.png new file mode 100644 index 0000000..3ef106e Binary files /dev/null and b/plugins/enigma/skins/default/enigma.png differ diff --git a/plugins/enigma/skins/default/enigma_error.png b/plugins/enigma/skins/default/enigma_error.png new file mode 100644 index 0000000..9bf100e Binary files /dev/null and b/plugins/enigma/skins/default/enigma_error.png differ diff --git a/plugins/enigma/skins/default/key.png b/plugins/enigma/skins/default/key.png new file mode 100644 index 0000000..ea1cbd1 Binary files /dev/null and b/plugins/enigma/skins/default/key.png differ diff --git a/plugins/enigma/skins/default/key_add.png b/plugins/enigma/skins/default/key_add.png new file mode 100644 index 0000000..f22cc87 Binary files /dev/null and b/plugins/enigma/skins/default/key_add.png differ diff --git a/plugins/enigma/skins/default/keys_toolbar.png b/plugins/enigma/skins/default/keys_toolbar.png new file mode 100644 index 0000000..7cc258c Binary files /dev/null and b/plugins/enigma/skins/default/keys_toolbar.png differ diff --git a/plugins/enigma/skins/default/templates/keyimport.html b/plugins/enigma/skins/default/templates/keyimport.html new file mode 100644 index 0000000..4e0b304 --- /dev/null +++ b/plugins/enigma/skins/default/templates/keyimport.html @@ -0,0 +1,20 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + +
    + +
    + +

    +
    +

    +
    + + + diff --git a/plugins/enigma/skins/default/templates/keyinfo.html b/plugins/enigma/skins/default/templates/keyinfo.html new file mode 100644 index 0000000..2e8ed61 --- /dev/null +++ b/plugins/enigma/skins/default/templates/keyinfo.html @@ -0,0 +1,17 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + +
    + +
    + +
    + + + diff --git a/plugins/enigma/skins/default/templates/keys.html b/plugins/enigma/skins/default/templates/keys.html new file mode 100644 index 0000000..810c4a2 --- /dev/null +++ b/plugins/enigma/skins/default/templates/keys.html @@ -0,0 +1,76 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + +
    +
    + +
    + + +   + + + +
    + +
    + + + +
    + +
    + +
    +
    +
    + +
    +
    + +
    +
    + + + +
    + +
    + +
    +
    + +
    +
      +
    • +
    • +
    • +
    • +
    +
    + + + diff --git a/plugins/example_addressbook/example_addressbook.php b/plugins/example_addressbook/example_addressbook.php index c50f8d8..a15461f 100644 --- a/plugins/example_addressbook/example_addressbook.php +++ b/plugins/example_addressbook/example_addressbook.php @@ -9,12 +9,13 @@ require_once(dirname(__FILE__) . '/example_addressbook_backend.php'); class example_addressbook extends rcube_plugin { private $abook_id = 'static'; - + private $abook_name = 'Static List'; + public function init() { $this->add_hook('addressbooks_list', array($this, 'address_sources')); $this->add_hook('addressbook_get', array($this, 'get_address_book')); - + // use this address book for autocompletion queries // (maybe this should be configurable by the user?) $config = rcmail::get_instance()->config; @@ -24,26 +25,26 @@ class example_addressbook extends rcube_plugin $config->set('autocomplete_addressbooks', $sources); } } - + public function address_sources($p) { - $abook = new example_addressbook_backend; + $abook = new example_addressbook_backend($this->abook_name); $p['sources'][$this->abook_id] = array( 'id' => $this->abook_id, - 'name' => 'Static List', + 'name' => $this->abook_name, 'readonly' => $abook->readonly, 'groups' => $abook->groups, ); return $p; } - + public function get_address_book($p) { if ($p['id'] === $this->abook_id) { - $p['instance'] = new example_addressbook_backend; + $p['instance'] = new example_addressbook_backend($this->abook_name); } - + return $p; } - + } diff --git a/plugins/example_addressbook/example_addressbook_backend.php b/plugins/example_addressbook/example_addressbook_backend.php index 5f4e0f4..8c143c2 100644 --- a/plugins/example_addressbook/example_addressbook_backend.php +++ b/plugins/example_addressbook/example_addressbook_backend.php @@ -12,20 +12,27 @@ class example_addressbook_backend extends rcube_addressbook public $primary_key = 'ID'; public $readonly = true; public $groups = true; - + private $filter; private $result; - - public function __construct() + private $name; + + public function __construct($name) { $this->ready = true; + $this->name = $name; + } + + public function get_name() + { + return $this->name; } - + public function set_search_set($filter) { $this->filter = $filter; } - + public function get_search_set() { return $this->filter; @@ -44,12 +51,12 @@ class example_addressbook_backend extends rcube_addressbook array('ID' => 'testgroup2', 'name' => "Sample Group"), ); } - + public function list_records($cols=null, $subset=0) { $this->result = $this->count(); $this->result->add(array('ID' => '111', 'name' => "Example Contact", 'firstname' => "Example", 'surname' => "Contact", 'email' => "example@roundcube.net")); - + return $this->result; } @@ -74,7 +81,7 @@ class example_addressbook_backend extends rcube_addressbook $this->list_records(); $first = $this->result->first(); $sql_arr = $first['ID'] == $id ? $first : null; - + return $assoc && $sql_arr ? $sql_arr : $this->result; } @@ -105,5 +112,5 @@ class example_addressbook_backend extends rcube_addressbook { return false; } - + } diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php index a2ac3a8..12c78d9 100644 --- a/plugins/filesystem_attachments/filesystem_attachments.php +++ b/plugins/filesystem_attachments/filesystem_attachments.php @@ -19,7 +19,7 @@ */ class filesystem_attachments extends rcube_plugin { - public $task = 'mail|addressbook'; + public $task = '?(?!login).*'; function init() { @@ -49,6 +49,7 @@ class filesystem_attachments extends rcube_plugin function upload($args) { $args['status'] = false; + $group = $args['group']; $rcmail = rcmail::get_instance(); // use common temp dir for file uploads @@ -61,7 +62,7 @@ class filesystem_attachments extends rcube_plugin $args['status'] = true; // Note the file for later cleanup - $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmpfname; + $_SESSION['plugins']['filesystem_attachments'][$group][] = $tmpfname; } return $args; @@ -72,6 +73,7 @@ class filesystem_attachments extends rcube_plugin */ function save($args) { + $group = $args['group']; $args['status'] = false; if (!$args['path']) { @@ -91,7 +93,7 @@ class filesystem_attachments extends rcube_plugin $args['status'] = true; // Note the file for later cleanup - $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $args['path']; + $_SESSION['plugins']['filesystem_attachments'][$group][] = $args['path']; return $args; } @@ -135,13 +137,17 @@ class filesystem_attachments extends rcube_plugin // $_SESSION['compose']['attachments'] is not a complete record of // temporary files because loading a draft or starting a forward copies // the file to disk, but does not make an entry in that array - if (is_array($_SESSION['plugins']['filesystem_attachments']['tmp_files'])){ - foreach ($_SESSION['plugins']['filesystem_attachments']['tmp_files'] as $filename){ - if(file_exists($filename)){ - unlink($filename); + if (is_array($_SESSION['plugins']['filesystem_attachments'])){ + foreach ($_SESSION['plugins']['filesystem_attachments'] as $group => $files) { + if ($args['group'] && $args['group'] != $group) + continue; + foreach ((array)$files as $filename){ + if(file_exists($filename)){ + unlink($filename); + } } + unset($_SESSION['plugins']['filesystem_attachments'][$group]); } - unset($_SESSION['plugins']['filesystem_attachments']['tmp_files']); } return $args; } diff --git a/plugins/help/help.php b/plugins/help/help.php index 0c70b3a..ccf8082 100644 --- a/plugins/help/help.php +++ b/plugins/help/help.php @@ -29,7 +29,7 @@ class help extends rcube_plugin $this->register_task('help'); // register actions - $this->register_action('', array($this, 'action')); + $this->register_action('index', array($this, 'action')); $this->register_action('about', array($this, 'action')); $this->register_action('license', array($this, 'action')); diff --git a/plugins/help/localization/gl_ES.inc b/plugins/help/localization/gl_ES.inc new file mode 100644 index 0000000..2895dad --- /dev/null +++ b/plugins/help/localization/gl_ES.inc @@ -0,0 +1,8 @@ + diff --git a/plugins/help/localization/pt_BR.inc b/plugins/help/localization/pt_BR.inc new file mode 100644 index 0000000..f557ad2 --- /dev/null +++ b/plugins/help/localization/pt_BR.inc @@ -0,0 +1,8 @@ + diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php index 6da6488..fa074f0 100644 --- a/plugins/http_authentication/http_authentication.php +++ b/plugins/http_authentication/http_authentication.php @@ -5,17 +5,24 @@ * * Make use of an existing HTTP authentication and perform login with the existing user credentials * - * @version 1.2 + * Configuration: + * // redirect the client to this URL after logout. This page is then responsible to clear HTTP auth + * $rcmail_config['logout_url'] = 'http://server.tld/logout.html'; + * + * See logout.html (in this directory) for an example how HTTP auth can be cleared. + * + * @version 1.4 * @author Thomas Bruederli */ class http_authentication extends rcube_plugin { - public $task = 'login'; + public $task = 'login|logout'; function init() { $this->add_hook('startup', array($this, 'startup')); $this->add_hook('authenticate', array($this, 'authenticate')); + $this->add_hook('logout_after', array($this, 'logout')); } function startup($args) @@ -30,16 +37,30 @@ class http_authentication extends rcube_plugin function authenticate($args) { + // Allow entering other user data in login form, + // e.g. after log out (#1487953) + if (!empty($args['user'])) { + return $args; + } + if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) { $args['user'] = $_SERVER['PHP_AUTH_USER']; $args['pass'] = $_SERVER['PHP_AUTH_PW']; } - + $args['cookiecheck'] = false; $args['valid'] = true; - + return $args; } + function logout($args) + { + // redirect to configured URL in order to clear HTTP auth credentials + if (!empty($_SERVER['PHP_AUTH_USER']) && $args['user'] == $_SERVER['PHP_AUTH_USER'] && ($url = rcmail::get_instance()->config->get('logout_url'))) { + header("Location: $url", true, 307); + } + } + } diff --git a/plugins/http_authentication/logout.html b/plugins/http_authentication/logout.html new file mode 100644 index 0000000..0a78a62 --- /dev/null +++ b/plugins/http_authentication/logout.html @@ -0,0 +1,29 @@ + + + + +Logout + + + + +

    You've successully been logged out!

    + + \ No newline at end of file diff --git a/plugins/jqueryui/README b/plugins/jqueryui/README new file mode 100644 index 0000000..10f8dad --- /dev/null +++ b/plugins/jqueryui/README @@ -0,0 +1,29 @@ ++-------------------------------------------------------------------------+ +| +| Author: Cor Bosman (roundcube@wa.ter.net) +| Plugin: jqueryui +| Version: 1.8.14 +| Purpose: Add jquery-ui to roundcube for every plugin to use +| ++-------------------------------------------------------------------------+ + +jqueryui adds the complete jquery-ui library including the smoothness +theme to roundcube. This allows other plugins to use jquery-ui without +having to load their own version. The benefit of using 1 central jquery-ui +is that we wont run into problems of conflicting jquery libraries being +loaded. All plugins that want to use jquery-ui should use this plugin as +a requirement. + +It is possible for plugin authors to override the default smoothness theme. +To do this, go to the jquery-ui website, and use the download feature to +download your own theme. In the advanced settings, provide a scope class to +your theme and add that class to all your UI elements. Finally, load the +downloaded css files in your own plugin. + +Some jquery-ui modules provide localization. One example is the datepicker module. +If you want to load localization for a specific module, then set up config.inc.php. +Check the config.inc.php.dist file on how to set this up for the datepicker module. + +As of version 1.8.6 this plugin also supports other themes. If you're a theme +developer and would like a different default theme to be used for your RC theme +then let me know and we can set things up. diff --git a/plugins/jqueryui/config.inc.php.dist b/plugins/jqueryui/config.inc.php.dist new file mode 100644 index 0000000..8526e6a --- /dev/null +++ b/plugins/jqueryui/config.inc.php.dist @@ -0,0 +1,11 @@ + 'redmond', +); + +?> diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php new file mode 100644 index 0000000..7ed2018 --- /dev/null +++ b/plugins/jqueryui/jqueryui.php @@ -0,0 +1,54 @@ + + * @author Thomas Bruederli + */ +class jqueryui extends rcube_plugin +{ + public $noajax = true; + + public function init() + { + $version = '1.8.14'; + + $rcmail = rcmail::get_instance(); + $this->load_config(); + + // include UI scripts + $this->include_script("js/jquery-ui-$version.custom.min.js"); + + // include UI stylesheet + $skin = $rcmail->config->get('skin', 'default'); + $ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); + $ui_theme = $ui_map[$skin] ? $ui_map[$skin] : 'default'; + + if (file_exists($this->home . "/themes/$ui_theme/jquery-ui-$version.custom.css")) { + $this->include_stylesheet("themes/$ui_theme/jquery-ui-$version.custom.css"); + } + else { + $this->include_stylesheet("themes/default/jquery-ui-$version.custom.css"); + } + + // jquery UI localization + $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array()); + if (count($jquery_ui_i18n) > 0) { + $lang_l = str_replace('_', '-', substr($_SESSION['language'], 0, 5)); + $lang_s = substr($_SESSION['language'], 0, 2); + foreach($jquery_ui_i18n as $package) { + if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_l.js")) { + $this->include_script("js/i18n/jquery.ui.$package-$lang_l.js"); + } + else if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_s.js")) { + $this->include_script("js/i18n/jquery.ui.$package-$lang_s.js"); + } + } + } + } + +} diff --git a/plugins/jqueryui/js/i18n/jquery-ui-i18n.js b/plugins/jqueryui/js/i18n/jquery-ui-i18n.js new file mode 100644 index 0000000..1e5977e --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery-ui-i18n.js @@ -0,0 +1,1242 @@ +/* Afrikaans initialisation for the jQuery UI date picker plugin. */ +/* Written by Renier Pretorius. */ +jQuery(function($){ + $.datepicker.regional['af'] = { + closeText: 'Selekteer', + prevText: 'Vorige', + nextText: 'Volgende', + currentText: 'Vandag', + monthNames: ['Januarie','Februarie','Maart','April','Mei','Junie', + 'Julie','Augustus','September','Oktober','November','Desember'], + monthNamesShort: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', + 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'], + dayNames: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'], + dayNamesShort: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'], + dayNamesMin: ['So','Ma','Di','Wo','Do','Vr','Sa'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['af']); +}); +/* Arabic Translation for jQuery UI date picker plugin. */ +/* Khaled Al Horani -- koko.dw@gmail.com */ +/* خالد الحوراني -- koko.dw@gmail.com */ +/* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */ +jQuery(function($){ + $.datepicker.regional['ar'] = { + closeText: 'إغلاق', + prevText: '<السابق', + nextText: 'التالي>', + currentText: 'اليوم', + monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران', + 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], + dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'], + dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], + dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], + weekHeader: 'أسبوع', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ar']); +});/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Jamil Najafov (necefov33@gmail.com). */ +jQuery(function($) { + $.datepicker.regional['az'] = { + closeText: 'Bağla', + prevText: '<Geri', + nextText: 'Ä°rəli>', + currentText: 'Bugün', + monthNames: ['Yanvar','Fevral','Mart','Aprel','May','Ä°yun', + 'Ä°yul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'], + monthNamesShort: ['Yan','Fev','Mar','Apr','May','Ä°yun', + 'Ä°yul','Avq','Sen','Okt','Noy','Dek'], + dayNames: ['Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'], + dayNamesShort: ['B','Be','Ça','Ç','Ca','C','Ş'], + dayNamesMin: ['B','B','Ç','С','Ç','C','Ş'], + weekHeader: 'Hf', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['az']); +});/* Bulgarian initialisation for the jQuery UI date picker plugin. */ +/* Written by Stoyan Kyosev (http://svest.org). */ +jQuery(function($){ + $.datepicker.regional['bg'] = { + closeText: 'затвори', + prevText: '<назад', + nextText: 'напред>', + nextBigText: '>>', + currentText: 'днес', + monthNames: ['Януари','Февруари','Март','Април','Май','Юни', + 'Юли','Август','Септември','Октомври','Ноември','Декември'], + monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни', + 'Юли','Авг','Сеп','Окт','Нов','Дек'], + dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'], + dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'], + dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'], + weekHeader: 'Wk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['bg']); +}); +/* Bosnian i18n for the jQuery UI date picker plugin. */ +/* Written by Kenan Konjo. */ +jQuery(function($){ + $.datepicker.regional['bs'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Januar','Februar','Mart','April','Maj','Juni', + 'Juli','August','Septembar','Oktobar','Novembar','Decembar'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Wk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['bs']); +});/* Inicialització en català per a l'extenció 'calendar' per jQuery. */ +/* Writers: (joan.leon@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ca'] = { + closeText: 'Tancar', + prevText: '<Ant', + nextText: 'Seg>', + currentText: 'Avui', + monthNames: ['Gener','Febrer','Març','Abril','Maig','Juny', + 'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'], + monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Oct','Nov','Des'], + dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'], + dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'], + dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ca']); +});/* Czech initialisation for the jQuery UI date picker plugin. */ +/* Written by Tomas Muller (tomas@tomas-muller.net). */ +jQuery(function($){ + $.datepicker.regional['cs'] = { + closeText: 'Zavřít', + prevText: '<Dříve', + nextText: 'Později>', + currentText: 'Nyní', + monthNames: ['leden','únor','březen','duben','květen','červen', + 'červenec','srpen','září','říjen','listopad','prosinec'], + monthNamesShort: ['led','úno','bře','dub','kvě','čer', + 'čvc','srp','zář','říj','lis','pro'], + dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], + dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], + dayNamesMin: ['ne','po','út','st','čt','pá','so'], + weekHeader: 'Týd', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['cs']); +}); +/* Danish initialisation for the jQuery UI date picker plugin. */ +/* Written by Jan Christensen ( deletestuff@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['da'] = { + closeText: 'Luk', + prevText: '<Forrige', + nextText: 'Næste>', + currentText: 'Idag', + monthNames: ['Januar','Februar','Marts','April','Maj','Juni', + 'Juli','August','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], + dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], + dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], + weekHeader: 'Uge', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['da']); +}); +/* German initialisation for the jQuery UI date picker plugin. */ +/* Written by Milian Wolff (mail@milianw.de). */ +jQuery(function($){ + $.datepicker.regional['de'] = { + closeText: 'schließen', + prevText: '<zurück', + nextText: 'Vor>', + currentText: 'heute', + monthNames: ['Januar','Februar','März','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Dezember'], + monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dez'], + dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], + dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], + dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], + weekHeader: 'Wo', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['de']); +}); +/* Greek (el) initialisation for the jQuery UI date picker plugin. */ +/* Written by Alex Cicovic (http://www.alexcicovic.com) */ +jQuery(function($){ + $.datepicker.regional['el'] = { + closeText: 'Κλείσιμο', + prevText: 'Προηγούμενος', + nextText: 'Επόμενος', + currentText: 'Τρέχων Μήνας', + monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος', + 'Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'], + monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν', + 'Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'], + dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'], + dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'], + dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'], + weekHeader: 'Εβδ', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['el']); +});/* English/UK initialisation for the jQuery UI date picker plugin. */ +/* Written by Stuart. */ +jQuery(function($){ + $.datepicker.regional['en-GB'] = { + closeText: 'Done', + prevText: 'Prev', + nextText: 'Next', + currentText: 'Today', + monthNames: ['January','February','March','April','May','June', + 'July','August','September','October','November','December'], + monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['en-GB']); +}); +/* Esperanto initialisation for the jQuery UI date picker plugin. */ +/* Written by Olivier M. (olivierweb@ifrance.com). */ +jQuery(function($){ + $.datepicker.regional['eo'] = { + closeText: 'Fermi', + prevText: '<Anta', + nextText: 'Sekv>', + currentText: 'Nuna', + monthNames: ['Januaro','Februaro','Marto','Aprilo','Majo','Junio', + 'Julio','AÅ­gusto','Septembro','Oktobro','Novembro','Decembro'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','AÅ­g','Sep','Okt','Nov','Dec'], + dayNames: ['Dimanĉo','Lundo','Mardo','Merkredo','Ä´aÅ­do','Vendredo','Sabato'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Ä´aÅ­','Ven','Sab'], + dayNamesMin: ['Di','Lu','Ma','Me','Ä´a','Ve','Sa'], + weekHeader: 'Sb', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['eo']); +}); +/* Inicialización en español para la extensión 'UI date picker' para jQuery. */ +/* Traducido por Vester (xvester@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['es'] = { + closeText: 'Cerrar', + prevText: '<Ant', + nextText: 'Sig>', + currentText: 'Hoy', + monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', + 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], + monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', + 'Jul','Ago','Sep','Oct','Nov','Dic'], + dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], + dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], + dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['es']); +});/* Estonian initialisation for the jQuery UI date picker plugin. */ +/* Written by Mart Sõmermaa (mrts.pydev at gmail com). */ +jQuery(function($){ + $.datepicker.regional['et'] = { + closeText: 'Sulge', + prevText: 'Eelnev', + nextText: 'Järgnev', + currentText: 'Täna', + monthNames: ['Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni', + 'Juuli','August','September','Oktoober','November','Detsember'], + monthNamesShort: ['Jaan', 'Veebr', 'Märts', 'Apr', 'Mai', 'Juuni', + 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'], + dayNames: ['Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'], + dayNamesShort: ['Pühap', 'Esmasp', 'Teisip', 'Kolmap', 'Neljap', 'Reede', 'Laup'], + dayNamesMin: ['P','E','T','K','N','R','L'], + weekHeader: 'Sm', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['et']); +}); /* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */ +/* Karrikas-ek itzulia (karrikas@karrikas.com) */ +jQuery(function($){ + $.datepicker.regional['eu'] = { + closeText: 'Egina', + prevText: '<Aur', + nextText: 'Hur>', + currentText: 'Gaur', + monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina', + 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'], + monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka', + 'Uzt','Abu','Ira','Urr','Aza','Abe'], + dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'], + dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'], + dayNamesMin: ['Ig','As','As','As','Os','Os','La'], + weekHeader: 'Wk', + dateFormat: 'yy/mm/dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['eu']); +});/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */ +/* Javad Mowlanezhad -- jmowla@gmail.com */ +/* Jalali calendar should supported soon! (Its implemented but I have to test it) */ +jQuery(function($) { + $.datepicker.regional['fa'] = { + closeText: 'بستن', + prevText: '<قبلي', + nextText: 'بعدي>', + currentText: 'امروز', + monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور', + 'مهر','آبان','آذر','دي','بهمن','اسفند'], + monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], + dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'], + dayNamesShort: ['ي','د','س','چ','Ù¾','ج', 'Ø´'], + dayNamesMin: ['ي','د','س','چ','Ù¾','ج', 'Ø´'], + weekHeader: 'هف', + dateFormat: 'yy/mm/dd', + firstDay: 6, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fa']); +});/* Finnish initialisation for the jQuery UI date picker plugin. */ +/* Written by Harri Kilpi� (harrikilpio@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['fi'] = { + closeText: 'Sulje', + prevText: '«Edellinen', + nextText: 'Seuraava»', + currentText: 'Tänään', + monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu', + 'Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'], + monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä', + 'Heinä','Elo','Syys','Loka','Marras','Joulu'], + dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'], + dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'], + dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'], + weekHeader: 'Vk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fi']); +}); +/* Faroese initialisation for the jQuery UI date picker plugin */ +/* Written by Sverri Mohr Olsen, sverrimo@gmail.com */ +jQuery(function($){ + $.datepicker.regional['fo'] = { + closeText: 'Lat aftur', + prevText: '<Fyrra', + nextText: 'Næsta>', + currentText: 'Í dag', + monthNames: ['Januar','Februar','Mars','Apríl','Mei','Juni', + 'Juli','August','September','Oktober','November','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun', + 'Jul','Aug','Sep','Okt','Nov','Des'], + dayNames: ['Sunnudagur','Mánadagur','Týsdagur','Mikudagur','Hósdagur','Fríggjadagur','Leyardagur'], + dayNamesShort: ['Sun','Mán','Týs','Mik','Hós','Frí','Ley'], + dayNamesMin: ['Su','Má','Tý','Mi','Hó','Fr','Le'], + weekHeader: 'Vk', + dateFormat: 'dd-mm-yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fo']); +}); +/* Swiss-French initialisation for the jQuery UI date picker plugin. */ +/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */ +jQuery(function($){ + $.datepicker.regional['fr-CH'] = { + closeText: 'Fermer', + prevText: '<Préc', + nextText: 'Suiv>', + currentText: 'Courant', + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], + dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], + dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fr-CH']); +});/* French initialisation for the jQuery UI date picker plugin. */ +/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */ +jQuery(function($){ + $.datepicker.regional['fr'] = { + closeText: 'Fermer', + prevText: '<Préc', + nextText: 'Suiv>', + currentText: 'Courant', + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], + dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], + dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fr']); +});/* Galician localization for 'UI date picker' jQuery extension. */ +/* Translated by Jorge Barreiro . */ +jQuery(function($){ + $.datepicker.regional['gl'] = { + closeText: 'Pechar', + prevText: '<Ant', + nextText: 'Seg>', + currentText: 'Hoxe', + monthNames: ['Xaneiro','Febreiro','Marzo','Abril','Maio','Xuño', + 'Xullo','Agosto','Setembro','Outubro','Novembro','Decembro'], + monthNamesShort: ['Xan','Feb','Mar','Abr','Mai','Xuñ', + 'Xul','Ago','Set','Out','Nov','Dec'], + dayNames: ['Domingo','Luns','Martes','Mércores','Xoves','Venres','Sábado'], + dayNamesShort: ['Dom','Lun','Mar','Mér','Xov','Ven','Sáb'], + dayNamesMin: ['Do','Lu','Ma','Mé','Xo','Ve','Sá'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['gl']); +});/* Hebrew initialisation for the UI Datepicker extension. */ +/* Written by Amir Hardon (ahardon at gmail dot com). */ +jQuery(function($){ + $.datepicker.regional['he'] = { + closeText: 'סגור', + prevText: '<הקודם', + nextText: 'הבא>', + currentText: 'היום', + monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני', + 'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'], + monthNamesShort: ['1','2','3','4','5','6', + '7','8','9','10','11','12'], + dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'], + dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], + dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['he']); +}); +/* Croatian i18n for the jQuery UI date picker plugin. */ +/* Written by Vjekoslav Nesek. */ +jQuery(function($){ + $.datepicker.regional['hr'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj', + 'Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'], + monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip', + 'Srp','Kol','Ruj','Lis','Stu','Pro'], + dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Tje', + dateFormat: 'dd.mm.yy.', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hr']); +});/* Hungarian initialisation for the jQuery UI date picker plugin. */ +/* Written by Istvan Karaszi (jquery@spam.raszi.hu). */ +jQuery(function($){ + $.datepicker.regional['hu'] = { + closeText: 'bezárás', + prevText: '« vissza', + nextText: 'előre »', + currentText: 'ma', + monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', + 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'], + monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún', + 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'], + dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'], + dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'], + dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'], + weekHeader: 'Hé', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hu']); +}); +/* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/ +jQuery(function($){ + $.datepicker.regional['hy'] = { + closeText: 'Փակել', + prevText: '<Նախ.', + nextText: 'Հաջ.>', + currentText: 'Այսօր', + monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս', + 'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'], + monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս', + 'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Ô´Õ¥Õ¯'], + dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','Õ°Õ«Õ¶Õ£Õ·Õ¡Õ¢Õ©Õ«','ուրբաթ','Õ·Õ¡Õ¢Õ¡Õ©'], + dayNamesShort: ['կիր','երկ','երք','չրք','Õ°Õ¶Õ£','ուրբ','Õ·Õ¢Õ©'], + dayNamesMin: ['կիր','երկ','երք','չրք','Õ°Õ¶Õ£','ուրբ','Õ·Õ¢Õ©'], + weekHeader: 'ՇԲՏ', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hy']); +});/* Indonesian initialisation for the jQuery UI date picker plugin. */ +/* Written by Deden Fathurahman (dedenf@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['id'] = { + closeText: 'Tutup', + prevText: '<mundur', + nextText: 'maju>', + currentText: 'hari ini', + monthNames: ['Januari','Februari','Maret','April','Mei','Juni', + 'Juli','Agustus','September','Oktober','Nopember','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun', + 'Jul','Agus','Sep','Okt','Nop','Des'], + dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'], + dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'], + dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'], + weekHeader: 'Mg', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['id']); +});/* Icelandic initialisation for the jQuery UI date picker plugin. */ +/* Written by Haukur H. Thorsson (haukur@eskill.is). */ +jQuery(function($){ + $.datepicker.regional['is'] = { + closeText: 'Loka', + prevText: '< Fyrri', + nextText: 'Næsti >', + currentText: 'Í dag', + monthNames: ['Janúar','Febrúar','Mars','Apríl','Maí','Júní', + 'Júlí','Ágúst','September','Október','Nóvember','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maí','Jún', + 'Júl','Ágú','Sep','Okt','Nóv','Des'], + dayNames: ['Sunnudagur','Mánudagur','Þriðjudagur','Miðvikudagur','Fimmtudagur','Föstudagur','Laugardagur'], + dayNamesShort: ['Sun','Mán','Þri','Mið','Fim','Fös','Lau'], + dayNamesMin: ['Su','Má','Þr','Mi','Fi','Fö','La'], + weekHeader: 'Vika', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['is']); +});/* Italian initialisation for the jQuery UI date picker plugin. */ +/* Written by Antonello Pasella (antonello.pasella@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['it'] = { + closeText: 'Chiudi', + prevText: '<Prec', + nextText: 'Succ>', + currentText: 'Oggi', + monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno', + 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], + monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu', + 'Lug','Ago','Set','Ott','Nov','Dic'], + dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], + dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], + dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['it']); +}); +/* Japanese initialisation for the jQuery UI date picker plugin. */ +/* Written by Kentaro SATO (kentaro@ranvis.com). */ +jQuery(function($){ + $.datepicker.regional['ja'] = { + closeText: '閉じる', + prevText: '<前', + nextText: '次>', + currentText: '今日', + monthNames: ['1月','2月','3月','4月','5月','6月', + '7月','8月','9月','10月','11月','12月'], + monthNamesShort: ['1月','2月','3月','4月','5月','6月', + '7月','8月','9月','10月','11月','12月'], + dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'], + dayNamesShort: ['日','月','火','æ°´','木','金','土'], + dayNamesMin: ['日','月','火','æ°´','木','金','土'], + weekHeader: '週', + dateFormat: 'yy/mm/dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['ja']); +});/* Korean initialisation for the jQuery calendar extension. */ +/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ko'] = { + closeText: '닫기', + prevText: '이전달', + nextText: '다음달', + currentText: '오늘', + monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', + '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], + monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', + '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], + dayNames: ['일','월','화','수','목','금','토'], + dayNamesShort: ['일','월','화','수','목','금','토'], + dayNamesMin: ['일','월','화','수','목','금','토'], + weekHeader: 'Wk', + dateFormat: 'yy-mm-dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: '년'}; + $.datepicker.setDefaults($.datepicker.regional['ko']); +});/* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['kz'] = { + closeText: 'Жабу', + prevText: '<Алдыңғы', + nextText: 'Келесі>', + currentText: 'Бүгін', + monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым', + 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'], + monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау', + 'Шіл','Там','Қыр','Қаз','Қар','Жел'], + dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'], + dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'], + dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'], + weekHeader: 'Не', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['kz']); +}); +/* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* @author Arturas Paleicikas */ +jQuery(function($){ + $.datepicker.regional['lt'] = { + closeText: 'Uždaryti', + prevText: '<Atgal', + nextText: 'Pirmyn>', + currentText: 'Å iandien', + monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis', + 'Liepa','RugpjÅ«tis','Rugsėjis','Spalis','Lapkritis','Gruodis'], + monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir', + 'Lie','Rugp','Rugs','Spa','Lap','Gru'], + dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','Å¡eÅ¡tadienis'], + dayNamesShort: ['sek','pir','ant','tre','ket','pen','Å¡eÅ¡'], + dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Å e'], + weekHeader: 'Wk', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['lt']); +});/* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* @author Arturas Paleicikas */ +jQuery(function($){ + $.datepicker.regional['lv'] = { + closeText: 'Aizvērt', + prevText: 'Iepr', + nextText: 'Nāka', + currentText: 'Å odien', + monthNames: ['Janvāris','Februāris','Marts','AprÄ«lis','Maijs','JÅ«nijs', + 'JÅ«lijs','Augusts','Septembris','Oktobris','Novembris','Decembris'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','JÅ«n', + 'JÅ«l','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['svētdiena','pirmdiena','otrdiena','treÅ¡diena','ceturtdiena','piektdiena','sestdiena'], + dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'], + dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'], + weekHeader: 'Nav', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['lv']); +});/* Malaysian initialisation for the jQuery UI date picker plugin. */ +/* Written by Mohd Nawawi Mohamad Jamili (nawawi@ronggeng.net). */ +jQuery(function($){ + $.datepicker.regional['ms'] = { + closeText: 'Tutup', + prevText: '<Sebelum', + nextText: 'Selepas>', + currentText: 'hari ini', + monthNames: ['Januari','Februari','Mac','April','Mei','Jun', + 'Julai','Ogos','September','Oktober','November','Disember'], + monthNamesShort: ['Jan','Feb','Mac','Apr','Mei','Jun', + 'Jul','Ogo','Sep','Okt','Nov','Dis'], + dayNames: ['Ahad','Isnin','Selasa','Rabu','Khamis','Jumaat','Sabtu'], + dayNamesShort: ['Aha','Isn','Sel','Rab','kha','Jum','Sab'], + dayNamesMin: ['Ah','Is','Se','Ra','Kh','Ju','Sa'], + weekHeader: 'Mg', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ms']); +});/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Mathias Bynens */ +jQuery(function($){ + $.datepicker.regional.nl = { + closeText: 'Sluiten', + prevText: '←', + nextText: '→', + currentText: 'Vandaag', + monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', + 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', + 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'], + dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional.nl); +});/* Norwegian initialisation for the jQuery UI date picker plugin. */ +/* Written by Naimdjon Takhirov (naimdjon@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['no'] = { + closeText: 'Lukk', + prevText: '«Forrige', + nextText: 'Neste»', + currentText: 'I dag', + monthNames: ['Januar','Februar','Mars','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun', + 'Jul','Aug','Sep','Okt','Nov','Des'], + dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], + dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], + dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], + weekHeader: 'Uke', + dateFormat: 'yy-mm-dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['no']); +}); +/* Polish initialisation for the jQuery UI date picker plugin. */ +/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['pl'] = { + closeText: 'Zamknij', + prevText: '<Poprzedni', + nextText: 'Następny>', + currentText: 'Dziś', + monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec', + 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'], + monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze', + 'Lip','Sie','Wrz','Pa','Lis','Gru'], + dayNames: ['Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota'], + dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'], + dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'], + weekHeader: 'Tydz', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pl']); +}); +/* Brazilian initialisation for the jQuery UI date picker plugin. */ +/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['pt-BR'] = { + closeText: 'Fechar', + prevText: '<Anterior', + nextText: 'Próximo>', + currentText: 'Hoje', + monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], + monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Out','Nov','Dez'], + dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'], + dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pt-BR']); +});/* Portuguese initialisation for the jQuery UI date picker plugin. */ +jQuery(function($){ + $.datepicker.regional['pt'] = { + closeText: 'Fechar', + prevText: '<Anterior', + nextText: 'Seguinte', + currentText: 'Hoje', + monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], + monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Out','Nov','Dez'], + dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'], + dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + weekHeader: 'Sem', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pt']); +});/* Romanian initialisation for the jQuery UI date picker plugin. + * + * Written by Edmond L. (ll_edmond@walla.com) + * and Ionut G. Stan (ionut.g.stan@gmail.com) + */ +jQuery(function($){ + $.datepicker.regional['ro'] = { + closeText: 'Închide', + prevText: '« Luna precedentă', + nextText: 'Luna următoare »', + currentText: 'Azi', + monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie', + 'Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'], + monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', + 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + dayNames: ['Duminică', 'Luni', 'MarÅ£i', 'Miercuri', 'Joi', 'Vineri', 'Sâmbătă'], + dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], + dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sâ'], + weekHeader: 'Săpt', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ro']); +}); +/* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Andrew Stromnov (stromnov@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ru'] = { + closeText: 'Закрыть', + prevText: '<Пред', + nextText: 'След>', + currentText: 'Сегодня', + monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь', + 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'], + monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн', + 'Июл','Авг','Сен','Окт','Ноя','Дек'], + dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'], + dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'], + dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'], + weekHeader: 'Нед', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ru']); +});/* Slovak initialisation for the jQuery UI date picker plugin. */ +/* Written by Vojtech Rinik (vojto@hmm.sk). */ +jQuery(function($){ + $.datepicker.regional['sk'] = { + closeText: 'ZavrieÅ¥', + prevText: '<Predchádzajúci', + nextText: 'Nasledujúci>', + currentText: 'Dnes', + monthNames: ['Január','Február','Marec','Apríl','Máj','Jún', + 'Júl','August','September','Október','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún', + 'Júl','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Å tvrtok','Piatok','Sobota'], + dayNamesShort: ['Ned','Pon','Uto','Str','Å tv','Pia','Sob'], + dayNamesMin: ['Ne','Po','Ut','St','Å t','Pia','So'], + weekHeader: 'Ty', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sk']); +}); +/* Slovenian initialisation for the jQuery UI date picker plugin. */ +/* Written by Jaka Jancar (jaka@kubje.org). */ +/* c = č, s = š z = ž C = Č S = Š Z = Ž */ +jQuery(function($){ + $.datepicker.regional['sl'] = { + closeText: 'Zapri', + prevText: '<Prejšnji', + nextText: 'Naslednji>', + currentText: 'Trenutni', + monthNames: ['Januar','Februar','Marec','April','Maj','Junij', + 'Julij','Avgust','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Avg','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljek','Torek','Sreda','Četrtek','Petek','Sobota'], + dayNamesShort: ['Ned','Pon','Tor','Sre','Čet','Pet','Sob'], + dayNamesMin: ['Ne','Po','To','Sr','Če','Pe','So'], + weekHeader: 'Teden', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sl']); +}); +/* Albanian initialisation for the jQuery UI date picker plugin. */ +/* Written by Flakron Bytyqi (flakron@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['sq'] = { + closeText: 'mbylle', + prevText: '<mbrapa', + nextText: 'Përpara>', + currentText: 'sot', + monthNames: ['Janar','Shkurt','Mars','Prill','Maj','Qershor', + 'Korrik','Gusht','Shtator','Tetor','Nëntor','Dhjetor'], + monthNamesShort: ['Jan','Shk','Mar','Pri','Maj','Qer', + 'Kor','Gus','Sht','Tet','Nën','Dhj'], + dayNames: ['E Diel','E Hënë','E Martë','E Mërkurë','E Enjte','E Premte','E Shtune'], + dayNamesShort: ['Di','Hë','Ma','Më','En','Pr','Sh'], + dayNamesMin: ['Di','Hë','Ma','Më','En','Pr','Sh'], + weekHeader: 'Ja', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sq']); +}); +/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Written by Dejan Dimić. */ +jQuery(function($){ + $.datepicker.regional['sr-SR'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Januar','Februar','Mart','April','Maj','Jun', + 'Jul','Avgust','Septembar','Oktobar','Novembar','Decembar'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Avg','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljak','Utorak','Sreda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sre','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Sed', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sr-SR']); +}); +/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Written by Dejan Dimić. */ +jQuery(function($){ + $.datepicker.regional['sr'] = { + closeText: 'Затвори', + prevText: '<', + nextText: '>', + currentText: 'Данас', + monthNames: ['Јануар','Фебруар','Март','Април','Мај','Јун', + 'Јул','Август','Септембар','Октобар','Новембар','Децембар'], + monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун', + 'Јул','Авг','Сеп','Окт','Нов','Дец'], + dayNames: ['Недеља','Понедељак','Уторак','Среда','Четвртак','Петак','Субота'], + dayNamesShort: ['Нед','Пон','Уто','Сре','Чет','Пет','Суб'], + dayNamesMin: ['Не','По','Ут','Ср','Че','Пе','Су'], + weekHeader: 'Сед', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sr']); +}); +/* Swedish initialisation for the jQuery UI date picker plugin. */ +/* Written by Anders Ekdahl ( anders@nomadiz.se). */ +jQuery(function($){ + $.datepicker.regional['sv'] = { + closeText: 'Stäng', + prevText: '«Förra', + nextText: 'Nästa»', + currentText: 'Idag', + monthNames: ['Januari','Februari','Mars','April','Maj','Juni', + 'Juli','Augusti','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNamesShort: ['Sön','MÃ¥n','Tis','Ons','Tor','Fre','Lör'], + dayNames: ['Söndag','MÃ¥ndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], + dayNamesMin: ['Sö','MÃ¥','Ti','On','To','Fr','Lö'], + weekHeader: 'Ve', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sv']); +}); +/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by S A Sureshkumar (saskumar@live.com). */ +jQuery(function($){ + $.datepicker.regional['ta'] = { + closeText: 'மூடு', + prevText: 'முன்னையது', + nextText: 'அடுத்தது', + currentText: 'இன்று', + monthNames: ['தை','மாசி','பங்குனி','சித்திரை','வைகாசி','ஆனி', + 'ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி'], + monthNamesShort: ['தை','மாசி','பங்','சித்','வைகா','ஆனி', + 'ஆடி','ஆவ','புர','ஐப்','கார்','மார்'], + dayNames: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்க்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'], + dayNamesShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'], + dayNamesMin: ['ஞா','தி','செ','பு','வி','வெ','ச'], + weekHeader: 'Не', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ta']); +}); +/* Thai initialisation for the jQuery UI date picker plugin. */ +/* Written by pipo (pipo@sixhead.com). */ +jQuery(function($){ + $.datepicker.regional['th'] = { + closeText: 'ปิด', + prevText: '« à¸¢à¹‰à¸­à¸™', + nextText: 'ถัดไป »', + currentText: 'วันนี้', + monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน', + 'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'], + monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.', + 'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'], + dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'], + dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], + dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['th']); +});/* Turkish initialisation for the jQuery UI date picker plugin. */ +/* Written by Izzet Emre Erkan (kara@karalamalar.net). */ +jQuery(function($){ + $.datepicker.regional['tr'] = { + closeText: 'kapat', + prevText: '<geri', + nextText: 'ileri>', + currentText: 'bugün', + monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran', + 'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'], + monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz', + 'Tem','Ağu','Eyl','Eki','Kas','Ara'], + dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'], + dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], + dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], + weekHeader: 'Hf', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['tr']); +});/* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Maxim Drogobitskiy (maxdao@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['uk'] = { + closeText: 'Закрити', + prevText: '<', + nextText: '>', + currentText: 'Сьогодні', + monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень', + 'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'], + monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер', + 'Лип','Сер','Вер','Жов','Лис','Гру'], + dayNames: ['неділя','понеділок','вівторок','середа','четвер','п’ятниця','субота'], + dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'], + dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'], + weekHeader: 'Не', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['uk']); +});/* Vietnamese initialisation for the jQuery UI date picker plugin. */ +/* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */ +jQuery(function($){ + $.datepicker.regional['vi'] = { + closeText: 'Đóng', + prevText: '<Trước', + nextText: 'Tiếp>', + currentText: 'Hôm nay', + monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng TÆ°', 'Tháng Năm', 'Tháng Sáu', + 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'], + monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', + 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'], + dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ TÆ°', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'], + dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + weekHeader: 'Tu', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['vi']); +}); +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by Cloudream (cloudream@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-CN'] = { + closeText: '关闭', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-CN']); +}); +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by SCCY (samuelcychan@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-HK'] = { + closeText: '關閉', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'dd-mm-yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-HK']); +}); +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by Ressol (ressol@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-TW'] = { + closeText: '關閉', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'yy/mm/dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-TW']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-af.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-af.js new file mode 100644 index 0000000..43fbf6c --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-af.js @@ -0,0 +1,23 @@ +/* Afrikaans initialisation for the jQuery UI date picker plugin. */ +/* Written by Renier Pretorius. */ +jQuery(function($){ + $.datepicker.regional['af'] = { + closeText: 'Selekteer', + prevText: 'Vorige', + nextText: 'Volgende', + currentText: 'Vandag', + monthNames: ['Januarie','Februarie','Maart','April','Mei','Junie', + 'Julie','Augustus','September','Oktober','November','Desember'], + monthNamesShort: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', + 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'], + dayNames: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'], + dayNamesShort: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'], + dayNamesMin: ['So','Ma','Di','Wo','Do','Vr','Sa'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['af']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ar.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ar.js new file mode 100644 index 0000000..c799b48 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ar.js @@ -0,0 +1,24 @@ +/* Arabic Translation for jQuery UI date picker plugin. */ +/* Khaled Al Horani -- koko.dw@gmail.com */ +/* خالد الحوراني -- koko.dw@gmail.com */ +/* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */ +jQuery(function($){ + $.datepicker.regional['ar'] = { + closeText: 'إغلاق', + prevText: '<السابق', + nextText: 'التالي>', + currentText: 'اليوم', + monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران', + 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], + dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'], + dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], + dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], + weekHeader: 'أسبوع', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ar']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-az.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-az.js new file mode 100644 index 0000000..b543405 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-az.js @@ -0,0 +1,23 @@ +/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Jamil Najafov (necefov33@gmail.com). */ +jQuery(function($) { + $.datepicker.regional['az'] = { + closeText: 'Bağla', + prevText: '<Geri', + nextText: 'Ä°rəli>', + currentText: 'Bugün', + monthNames: ['Yanvar','Fevral','Mart','Aprel','May','Ä°yun', + 'Ä°yul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'], + monthNamesShort: ['Yan','Fev','Mar','Apr','May','Ä°yun', + 'Ä°yul','Avq','Sen','Okt','Noy','Dek'], + dayNames: ['Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'], + dayNamesShort: ['B','Be','Ça','Ç','Ca','C','Ş'], + dayNamesMin: ['B','B','Ç','С','Ç','C','Ş'], + weekHeader: 'Hf', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['az']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bg.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bg.js new file mode 100644 index 0000000..b5113f7 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bg.js @@ -0,0 +1,24 @@ +/* Bulgarian initialisation for the jQuery UI date picker plugin. */ +/* Written by Stoyan Kyosev (http://svest.org). */ +jQuery(function($){ + $.datepicker.regional['bg'] = { + closeText: 'затвори', + prevText: '<назад', + nextText: 'напред>', + nextBigText: '>>', + currentText: 'днес', + monthNames: ['Януари','Февруари','Март','Април','Май','Юни', + 'Юли','Август','Септември','Октомври','Ноември','Декември'], + monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни', + 'Юли','Авг','Сеп','Окт','Нов','Дек'], + dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'], + dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'], + dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'], + weekHeader: 'Wk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['bg']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bs.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bs.js new file mode 100644 index 0000000..30ab826 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-bs.js @@ -0,0 +1,23 @@ +/* Bosnian i18n for the jQuery UI date picker plugin. */ +/* Written by Kenan Konjo. */ +jQuery(function($){ + $.datepicker.regional['bs'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Januar','Februar','Mart','April','Maj','Juni', + 'Juli','August','Septembar','Oktobar','Novembar','Decembar'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Wk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['bs']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ca.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ca.js new file mode 100644 index 0000000..b128e69 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ca.js @@ -0,0 +1,23 @@ +/* Inicialització en català per a l'extenció 'calendar' per jQuery. */ +/* Writers: (joan.leon@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ca'] = { + closeText: 'Tancar', + prevText: '<Ant', + nextText: 'Seg>', + currentText: 'Avui', + monthNames: ['Gener','Febrer','Març','Abril','Maig','Juny', + 'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'], + monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Oct','Nov','Des'], + dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'], + dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'], + dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ca']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-cs.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-cs.js new file mode 100644 index 0000000..c3c07ea --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-cs.js @@ -0,0 +1,23 @@ +/* Czech initialisation for the jQuery UI date picker plugin. */ +/* Written by Tomas Muller (tomas@tomas-muller.net). */ +jQuery(function($){ + $.datepicker.regional['cs'] = { + closeText: 'Zavřít', + prevText: '<Dříve', + nextText: 'Později>', + currentText: 'Nyní', + monthNames: ['leden','únor','březen','duben','květen','červen', + 'červenec','srpen','září','říjen','listopad','prosinec'], + monthNamesShort: ['led','úno','bře','dub','kvě','čer', + 'čvc','srp','zář','říj','lis','pro'], + dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], + dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], + dayNamesMin: ['ne','po','út','st','čt','pá','so'], + weekHeader: 'Týd', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['cs']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-da.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-da.js new file mode 100644 index 0000000..4a99a58 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-da.js @@ -0,0 +1,23 @@ +/* Danish initialisation for the jQuery UI date picker plugin. */ +/* Written by Jan Christensen ( deletestuff@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['da'] = { + closeText: 'Luk', + prevText: '<Forrige', + nextText: 'Næste>', + currentText: 'Idag', + monthNames: ['Januar','Februar','Marts','April','Maj','Juni', + 'Juli','August','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], + dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], + dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], + weekHeader: 'Uge', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['da']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de-CH.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de-CH.js new file mode 100644 index 0000000..f31e418 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de-CH.js @@ -0,0 +1,23 @@ +/* Swiss-German initialisation for the jQuery UI date picker plugin. */ +/* By Douglas Jose & Juerg Meier. */ +jQuery(function($){ + $.datepicker.regional['de-CH'] = { + closeText: 'schliessen', + prevText: '<zurück', + nextText: 'nächster>', + currentText: 'heute', + monthNames: ['Januar','Februar','März','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Dezember'], + monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dez'], + dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], + dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], + dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], + weekHeader: 'Wo', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['de-CH']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de.js new file mode 100644 index 0000000..ac2d516 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-de.js @@ -0,0 +1,23 @@ +/* German initialisation for the jQuery UI date picker plugin. */ +/* Written by Milian Wolff (mail@milianw.de). */ +jQuery(function($){ + $.datepicker.regional['de'] = { + closeText: 'schließen', + prevText: '<zurück', + nextText: 'Vor>', + currentText: 'heute', + monthNames: ['Januar','Februar','März','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Dezember'], + monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dez'], + dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], + dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], + dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], + weekHeader: 'Wo', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['de']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-el.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-el.js new file mode 100644 index 0000000..9542769 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-el.js @@ -0,0 +1,23 @@ +/* Greek (el) initialisation for the jQuery UI date picker plugin. */ +/* Written by Alex Cicovic (http://www.alexcicovic.com) */ +jQuery(function($){ + $.datepicker.regional['el'] = { + closeText: 'Κλείσιμο', + prevText: 'Προηγούμενος', + nextText: 'Επόμενος', + currentText: 'Τρέχων Μήνας', + monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος', + 'Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'], + monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν', + 'Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'], + dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'], + dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'], + dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'], + weekHeader: 'Εβδ', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['el']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-en-GB.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-en-GB.js new file mode 100644 index 0000000..aac7b61 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-en-GB.js @@ -0,0 +1,23 @@ +/* English/UK initialisation for the jQuery UI date picker plugin. */ +/* Written by Stuart. */ +jQuery(function($){ + $.datepicker.regional['en-GB'] = { + closeText: 'Done', + prevText: 'Prev', + nextText: 'Next', + currentText: 'Today', + monthNames: ['January','February','March','April','May','June', + 'July','August','September','October','November','December'], + monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['en-GB']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eo.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eo.js new file mode 100644 index 0000000..ba57156 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eo.js @@ -0,0 +1,23 @@ +/* Esperanto initialisation for the jQuery UI date picker plugin. */ +/* Written by Olivier M. (olivierweb@ifrance.com). */ +jQuery(function($){ + $.datepicker.regional['eo'] = { + closeText: 'Fermi', + prevText: '<Anta', + nextText: 'Sekv>', + currentText: 'Nuna', + monthNames: ['Januaro','Februaro','Marto','Aprilo','Majo','Junio', + 'Julio','AÅ­gusto','Septembro','Oktobro','Novembro','Decembro'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','AÅ­g','Sep','Okt','Nov','Dec'], + dayNames: ['Dimanĉo','Lundo','Mardo','Merkredo','Ä´aÅ­do','Vendredo','Sabato'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Ä´aÅ­','Ven','Sab'], + dayNamesMin: ['Di','Lu','Ma','Me','Ä´a','Ve','Sa'], + weekHeader: 'Sb', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['eo']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-es.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-es.js new file mode 100644 index 0000000..a02133d --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-es.js @@ -0,0 +1,23 @@ +/* Inicialización en español para la extensión 'UI date picker' para jQuery. */ +/* Traducido por Vester (xvester@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['es'] = { + closeText: 'Cerrar', + prevText: '<Ant', + nextText: 'Sig>', + currentText: 'Hoy', + monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', + 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], + monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', + 'Jul','Ago','Sep','Oct','Nov','Dic'], + dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], + dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], + dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['es']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-et.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-et.js new file mode 100644 index 0000000..f97311f --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-et.js @@ -0,0 +1,23 @@ +/* Estonian initialisation for the jQuery UI date picker plugin. */ +/* Written by Mart Sõmermaa (mrts.pydev at gmail com). */ +jQuery(function($){ + $.datepicker.regional['et'] = { + closeText: 'Sulge', + prevText: 'Eelnev', + nextText: 'Järgnev', + currentText: 'Täna', + monthNames: ['Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni', + 'Juuli','August','September','Oktoober','November','Detsember'], + monthNamesShort: ['Jaan', 'Veebr', 'Märts', 'Apr', 'Mai', 'Juuni', + 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'], + dayNames: ['Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'], + dayNamesShort: ['Pühap', 'Esmasp', 'Teisip', 'Kolmap', 'Neljap', 'Reede', 'Laup'], + dayNamesMin: ['P','E','T','K','N','R','L'], + weekHeader: 'Sm', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['et']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eu.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eu.js new file mode 100644 index 0000000..9ba6ee2 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-eu.js @@ -0,0 +1,23 @@ +/* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */ +/* Karrikas-ek itzulia (karrikas@karrikas.com) */ +jQuery(function($){ + $.datepicker.regional['eu'] = { + closeText: 'Egina', + prevText: '<Aur', + nextText: 'Hur>', + currentText: 'Gaur', + monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina', + 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'], + monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka', + 'Uzt','Abu','Ira','Urr','Aza','Abe'], + dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'], + dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'], + dayNamesMin: ['Ig','As','As','As','Os','Os','La'], + weekHeader: 'Wk', + dateFormat: 'yy/mm/dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['eu']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fa.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fa.js new file mode 100644 index 0000000..adb3709 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fa.js @@ -0,0 +1,23 @@ +/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */ +/* Javad Mowlanezhad -- jmowla@gmail.com */ +/* Jalali calendar should supported soon! (Its implemented but I have to test it) */ +jQuery(function($) { + $.datepicker.regional['fa'] = { + closeText: 'بستن', + prevText: '<قبلي', + nextText: 'بعدي>', + currentText: 'امروز', + monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور', + 'مهر','آبان','آذر','دي','بهمن','اسفند'], + monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], + dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'], + dayNamesShort: ['ي','د','س','چ','Ù¾','ج', 'Ø´'], + dayNamesMin: ['ي','د','س','چ','Ù¾','ج', 'Ø´'], + weekHeader: 'هف', + dateFormat: 'yy/mm/dd', + firstDay: 6, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fa']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fi.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fi.js new file mode 100644 index 0000000..e1f25fd --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fi.js @@ -0,0 +1,23 @@ +/* Finnish initialisation for the jQuery UI date picker plugin. */ +/* Written by Harri Kilpi� (harrikilpio@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['fi'] = { + closeText: 'Sulje', + prevText: '«Edellinen', + nextText: 'Seuraava»', + currentText: 'Tänään', + monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu', + 'Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'], + monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä', + 'Heinä','Elo','Syys','Loka','Marras','Joulu'], + dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'], + dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'], + dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'], + weekHeader: 'Vk', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fi']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fo.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fo.js new file mode 100644 index 0000000..c143622 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fo.js @@ -0,0 +1,23 @@ +/* Faroese initialisation for the jQuery UI date picker plugin */ +/* Written by Sverri Mohr Olsen, sverrimo@gmail.com */ +jQuery(function($){ + $.datepicker.regional['fo'] = { + closeText: 'Lat aftur', + prevText: '<Fyrra', + nextText: 'Næsta>', + currentText: 'Í dag', + monthNames: ['Januar','Februar','Mars','Apríl','Mei','Juni', + 'Juli','August','September','Oktober','November','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun', + 'Jul','Aug','Sep','Okt','Nov','Des'], + dayNames: ['Sunnudagur','Mánadagur','Týsdagur','Mikudagur','Hósdagur','Fríggjadagur','Leyardagur'], + dayNamesShort: ['Sun','Mán','Týs','Mik','Hós','Frí','Ley'], + dayNamesMin: ['Su','Má','Tý','Mi','Hó','Fr','Le'], + weekHeader: 'Vk', + dateFormat: 'dd-mm-yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fo']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr-CH.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr-CH.js new file mode 100644 index 0000000..38212d5 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr-CH.js @@ -0,0 +1,23 @@ +/* Swiss-French initialisation for the jQuery UI date picker plugin. */ +/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */ +jQuery(function($){ + $.datepicker.regional['fr-CH'] = { + closeText: 'Fermer', + prevText: '<Préc', + nextText: 'Suiv>', + currentText: 'Courant', + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], + dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], + dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fr-CH']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr.js new file mode 100644 index 0000000..134bda6 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-fr.js @@ -0,0 +1,23 @@ +/* French initialisation for the jQuery UI date picker plugin. */ +/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */ +jQuery(function($){ + $.datepicker.regional['fr'] = { + closeText: 'Fermer', + prevText: '<Préc', + nextText: 'Suiv>', + currentText: 'Courant', + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], + dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], + dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['fr']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-gl.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-gl.js new file mode 100644 index 0000000..278403e --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-gl.js @@ -0,0 +1,23 @@ +/* Galician localization for 'UI date picker' jQuery extension. */ +/* Translated by Jorge Barreiro . */ +jQuery(function($){ + $.datepicker.regional['gl'] = { + closeText: 'Pechar', + prevText: '<Ant', + nextText: 'Seg>', + currentText: 'Hoxe', + monthNames: ['Xaneiro','Febreiro','Marzo','Abril','Maio','Xuño', + 'Xullo','Agosto','Setembro','Outubro','Novembro','Decembro'], + monthNamesShort: ['Xan','Feb','Mar','Abr','Mai','Xuñ', + 'Xul','Ago','Set','Out','Nov','Dec'], + dayNames: ['Domingo','Luns','Martes','Mércores','Xoves','Venres','Sábado'], + dayNamesShort: ['Dom','Lun','Mar','Mér','Xov','Ven','Sáb'], + dayNamesMin: ['Do','Lu','Ma','Mé','Xo','Ve','Sá'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['gl']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-he.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-he.js new file mode 100644 index 0000000..3b3dc38 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-he.js @@ -0,0 +1,23 @@ +/* Hebrew initialisation for the UI Datepicker extension. */ +/* Written by Amir Hardon (ahardon at gmail dot com). */ +jQuery(function($){ + $.datepicker.regional['he'] = { + closeText: 'סגור', + prevText: '<הקודם', + nextText: 'הבא>', + currentText: 'היום', + monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני', + 'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'], + monthNamesShort: ['1','2','3','4','5','6', + '7','8','9','10','11','12'], + dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'], + dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], + dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['he']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hr.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hr.js new file mode 100644 index 0000000..0285c1a --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hr.js @@ -0,0 +1,23 @@ +/* Croatian i18n for the jQuery UI date picker plugin. */ +/* Written by Vjekoslav Nesek. */ +jQuery(function($){ + $.datepicker.regional['hr'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj', + 'Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'], + monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip', + 'Srp','Kol','Ruj','Lis','Stu','Pro'], + dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Tje', + dateFormat: 'dd.mm.yy.', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hr']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hu.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hu.js new file mode 100644 index 0000000..249e7b0 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hu.js @@ -0,0 +1,23 @@ +/* Hungarian initialisation for the jQuery UI date picker plugin. */ +/* Written by Istvan Karaszi (jquery@spam.raszi.hu). */ +jQuery(function($){ + $.datepicker.regional['hu'] = { + closeText: 'bezárás', + prevText: '« vissza', + nextText: 'előre »', + currentText: 'ma', + monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', + 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'], + monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún', + 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'], + dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'], + dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'], + dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'], + weekHeader: 'Hé', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hu']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hy.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hy.js new file mode 100644 index 0000000..c6cc194 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-hy.js @@ -0,0 +1,23 @@ +/* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/ +jQuery(function($){ + $.datepicker.regional['hy'] = { + closeText: 'Փակել', + prevText: '<Նախ.', + nextText: 'Հաջ.>', + currentText: 'Այսօր', + monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս', + 'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'], + monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս', + 'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Ô´Õ¥Õ¯'], + dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','Õ°Õ«Õ¶Õ£Õ·Õ¡Õ¢Õ©Õ«','ուրբաթ','Õ·Õ¡Õ¢Õ¡Õ©'], + dayNamesShort: ['կիր','երկ','երք','չրք','Õ°Õ¶Õ£','ուրբ','Õ·Õ¢Õ©'], + dayNamesMin: ['կիր','երկ','երք','չրք','Õ°Õ¶Õ£','ուրբ','Õ·Õ¢Õ©'], + weekHeader: 'ՇԲՏ', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['hy']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-id.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-id.js new file mode 100644 index 0000000..c626fbb --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-id.js @@ -0,0 +1,23 @@ +/* Indonesian initialisation for the jQuery UI date picker plugin. */ +/* Written by Deden Fathurahman (dedenf@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['id'] = { + closeText: 'Tutup', + prevText: '<mundur', + nextText: 'maju>', + currentText: 'hari ini', + monthNames: ['Januari','Februari','Maret','April','Mei','Juni', + 'Juli','Agustus','September','Oktober','Nopember','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun', + 'Jul','Agus','Sep','Okt','Nop','Des'], + dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'], + dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'], + dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'], + weekHeader: 'Mg', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['id']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-is.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-is.js new file mode 100644 index 0000000..c53235a --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-is.js @@ -0,0 +1,23 @@ +/* Icelandic initialisation for the jQuery UI date picker plugin. */ +/* Written by Haukur H. Thorsson (haukur@eskill.is). */ +jQuery(function($){ + $.datepicker.regional['is'] = { + closeText: 'Loka', + prevText: '< Fyrri', + nextText: 'Næsti >', + currentText: 'Í dag', + monthNames: ['Janúar','Febrúar','Mars','Apríl','Maí','Júní', + 'Júlí','Ágúst','September','Október','Nóvember','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maí','Jún', + 'Júl','Ágú','Sep','Okt','Nóv','Des'], + dayNames: ['Sunnudagur','Mánudagur','Þriðjudagur','Miðvikudagur','Fimmtudagur','Föstudagur','Laugardagur'], + dayNamesShort: ['Sun','Mán','Þri','Mið','Fim','Fös','Lau'], + dayNamesMin: ['Su','Má','Þr','Mi','Fi','Fö','La'], + weekHeader: 'Vika', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['is']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-it.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-it.js new file mode 100644 index 0000000..59da2df --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-it.js @@ -0,0 +1,23 @@ +/* Italian initialisation for the jQuery UI date picker plugin. */ +/* Written by Antonello Pasella (antonello.pasella@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['it'] = { + closeText: 'Chiudi', + prevText: '<Prec', + nextText: 'Succ>', + currentText: 'Oggi', + monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno', + 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], + monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu', + 'Lug','Ago','Set','Ott','Nov','Dic'], + dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], + dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], + dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['it']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ja.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ja.js new file mode 100644 index 0000000..79cd827 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ja.js @@ -0,0 +1,23 @@ +/* Japanese initialisation for the jQuery UI date picker plugin. */ +/* Written by Kentaro SATO (kentaro@ranvis.com). */ +jQuery(function($){ + $.datepicker.regional['ja'] = { + closeText: '閉じる', + prevText: '<前', + nextText: '次>', + currentText: '今日', + monthNames: ['1月','2月','3月','4月','5月','6月', + '7月','8月','9月','10月','11月','12月'], + monthNamesShort: ['1月','2月','3月','4月','5月','6月', + '7月','8月','9月','10月','11月','12月'], + dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'], + dayNamesShort: ['日','月','火','æ°´','木','金','土'], + dayNamesMin: ['日','月','火','æ°´','木','金','土'], + weekHeader: '週', + dateFormat: 'yy/mm/dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['ja']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ko.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ko.js new file mode 100644 index 0000000..5b35316 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ko.js @@ -0,0 +1,23 @@ +/* Korean initialisation for the jQuery calendar extension. */ +/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ko'] = { + closeText: '닫기', + prevText: '이전달', + nextText: '다음달', + currentText: '오늘', + monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', + '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], + monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', + '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], + dayNames: ['일','월','화','수','목','금','토'], + dayNamesShort: ['일','월','화','수','목','금','토'], + dayNamesMin: ['일','월','화','수','목','금','토'], + weekHeader: 'Wk', + dateFormat: 'yy-mm-dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: '년'}; + $.datepicker.setDefaults($.datepicker.regional['ko']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-kz.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-kz.js new file mode 100644 index 0000000..f1f897b --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-kz.js @@ -0,0 +1,23 @@ +/* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['kz'] = { + closeText: 'Жабу', + prevText: '<Алдыңғы', + nextText: 'Келесі>', + currentText: 'Бүгін', + monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым', + 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'], + monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау', + 'Шіл','Там','Қыр','Қаз','Қар','Жел'], + dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'], + dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'], + dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'], + weekHeader: 'Не', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['kz']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lt.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lt.js new file mode 100644 index 0000000..67d5119 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lt.js @@ -0,0 +1,23 @@ +/* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* @author Arturas Paleicikas */ +jQuery(function($){ + $.datepicker.regional['lt'] = { + closeText: 'Uždaryti', + prevText: '<Atgal', + nextText: 'Pirmyn>', + currentText: 'Å iandien', + monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis', + 'Liepa','RugpjÅ«tis','Rugsėjis','Spalis','Lapkritis','Gruodis'], + monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir', + 'Lie','Rugp','Rugs','Spa','Lap','Gru'], + dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','Å¡eÅ¡tadienis'], + dayNamesShort: ['sek','pir','ant','tre','ket','pen','Å¡eÅ¡'], + dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Å e'], + weekHeader: 'Wk', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['lt']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lv.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lv.js new file mode 100644 index 0000000..003934e --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-lv.js @@ -0,0 +1,23 @@ +/* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* @author Arturas Paleicikas */ +jQuery(function($){ + $.datepicker.regional['lv'] = { + closeText: 'Aizvērt', + prevText: 'Iepr', + nextText: 'Nāka', + currentText: 'Å odien', + monthNames: ['Janvāris','Februāris','Marts','AprÄ«lis','Maijs','JÅ«nijs', + 'JÅ«lijs','Augusts','Septembris','Oktobris','Novembris','Decembris'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','JÅ«n', + 'JÅ«l','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['svētdiena','pirmdiena','otrdiena','treÅ¡diena','ceturtdiena','piektdiena','sestdiena'], + dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'], + dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'], + weekHeader: 'Nav', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['lv']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ms.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ms.js new file mode 100644 index 0000000..e953ac0 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ms.js @@ -0,0 +1,23 @@ +/* Malaysian initialisation for the jQuery UI date picker plugin. */ +/* Written by Mohd Nawawi Mohamad Jamili (nawawi@ronggeng.net). */ +jQuery(function($){ + $.datepicker.regional['ms'] = { + closeText: 'Tutup', + prevText: '<Sebelum', + nextText: 'Selepas>', + currentText: 'hari ini', + monthNames: ['Januari','Februari','Mac','April','Mei','Jun', + 'Julai','Ogos','September','Oktober','November','Disember'], + monthNamesShort: ['Jan','Feb','Mac','Apr','Mei','Jun', + 'Jul','Ogo','Sep','Okt','Nov','Dis'], + dayNames: ['Ahad','Isnin','Selasa','Rabu','Khamis','Jumaat','Sabtu'], + dayNamesShort: ['Aha','Isn','Sel','Rab','kha','Jum','Sab'], + dayNamesMin: ['Ah','Is','Se','Ra','Kh','Ju','Sa'], + weekHeader: 'Mg', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ms']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl-BE.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl-BE.js new file mode 100644 index 0000000..50217d8 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl-BE.js @@ -0,0 +1,23 @@ +/* Dutch/Belgian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Mathias Bynens */ +jQuery(function($){ + $.datepicker.regional['nl-BE'] = { + closeText: 'Sluiten', + prevText: '←', + nextText: '→', + currentText: 'Vandaag', + monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', + 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', + 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'], + dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['nl-BE']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl.js new file mode 100644 index 0000000..663d6bb --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-nl.js @@ -0,0 +1,23 @@ +/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Mathias Bynens */ +jQuery(function($){ + $.datepicker.regional.nl = { + closeText: 'Sluiten', + prevText: '←', + nextText: '→', + currentText: 'Vandaag', + monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', + 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', + 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'], + dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional.nl); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-no.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-no.js new file mode 100644 index 0000000..12b2356 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-no.js @@ -0,0 +1,23 @@ +/* Norwegian initialisation for the jQuery UI date picker plugin. */ +/* Written by Naimdjon Takhirov (naimdjon@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['no'] = { + closeText: 'Lukk', + prevText: '«Forrige', + nextText: 'Neste»', + currentText: 'I dag', + monthNames: ['Januar','Februar','Mars','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Desember'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun', + 'Jul','Aug','Sep','Okt','Nov','Des'], + dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], + dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], + dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], + weekHeader: 'Uke', + dateFormat: 'yy-mm-dd', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['no']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pl.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pl.js new file mode 100644 index 0000000..61fa29c --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pl.js @@ -0,0 +1,23 @@ +/* Polish initialisation for the jQuery UI date picker plugin. */ +/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['pl'] = { + closeText: 'Zamknij', + prevText: '<Poprzedni', + nextText: 'Następny>', + currentText: 'Dziś', + monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec', + 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'], + monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze', + 'Lip','Sie','Wrz','Pa','Lis','Gru'], + dayNames: ['Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota'], + dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'], + dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'], + weekHeader: 'Tydz', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pl']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt-BR.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt-BR.js new file mode 100644 index 0000000..3cc8c79 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt-BR.js @@ -0,0 +1,23 @@ +/* Brazilian initialisation for the jQuery UI date picker plugin. */ +/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['pt-BR'] = { + closeText: 'Fechar', + prevText: '<Anterior', + nextText: 'Próximo>', + currentText: 'Hoje', + monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], + monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Out','Nov','Dez'], + dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'], + dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + weekHeader: 'Sm', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pt-BR']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt.js new file mode 100644 index 0000000..f09f5ae --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-pt.js @@ -0,0 +1,22 @@ +/* Portuguese initialisation for the jQuery UI date picker plugin. */ +jQuery(function($){ + $.datepicker.regional['pt'] = { + closeText: 'Fechar', + prevText: '<Anterior', + nextText: 'Seguinte', + currentText: 'Hoje', + monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], + monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', + 'Jul','Ago','Set','Out','Nov','Dez'], + dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'], + dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + weekHeader: 'Sem', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['pt']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ro.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ro.js new file mode 100644 index 0000000..4fe95ae --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ro.js @@ -0,0 +1,26 @@ +/* Romanian initialisation for the jQuery UI date picker plugin. + * + * Written by Edmond L. (ll_edmond@walla.com) + * and Ionut G. Stan (ionut.g.stan@gmail.com) + */ +jQuery(function($){ + $.datepicker.regional['ro'] = { + closeText: 'Închide', + prevText: '« Luna precedentă', + nextText: 'Luna următoare »', + currentText: 'Azi', + monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie', + 'Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'], + monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', + 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + dayNames: ['Duminică', 'Luni', 'MarÅ£i', 'Miercuri', 'Joi', 'Vineri', 'Sâmbătă'], + dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], + dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sâ'], + weekHeader: 'Săpt', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ro']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ru.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ru.js new file mode 100644 index 0000000..50a4613 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ru.js @@ -0,0 +1,23 @@ +/* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Andrew Stromnov (stromnov@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ru'] = { + closeText: 'Закрыть', + prevText: '<Пред', + nextText: 'След>', + currentText: 'Сегодня', + monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь', + 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'], + monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн', + 'Июл','Авг','Сен','Окт','Ноя','Дек'], + dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'], + dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'], + dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'], + weekHeader: 'Нед', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ru']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sk.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sk.js new file mode 100644 index 0000000..8a6771c --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sk.js @@ -0,0 +1,23 @@ +/* Slovak initialisation for the jQuery UI date picker plugin. */ +/* Written by Vojtech Rinik (vojto@hmm.sk). */ +jQuery(function($){ + $.datepicker.regional['sk'] = { + closeText: 'ZavrieÅ¥', + prevText: '<Predchádzajúci', + nextText: 'Nasledujúci>', + currentText: 'Dnes', + monthNames: ['Január','Február','Marec','Apríl','Máj','Jún', + 'Júl','August','September','Október','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún', + 'Júl','Aug','Sep','Okt','Nov','Dec'], + dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Å tvrtok','Piatok','Sobota'], + dayNamesShort: ['Ned','Pon','Uto','Str','Å tv','Pia','Sob'], + dayNamesMin: ['Ne','Po','Ut','St','Å t','Pia','So'], + weekHeader: 'Ty', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sk']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sl.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sl.js new file mode 100644 index 0000000..5165501 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sl.js @@ -0,0 +1,24 @@ +/* Slovenian initialisation for the jQuery UI date picker plugin. */ +/* Written by Jaka Jancar (jaka@kubje.org). */ +/* c = č, s = š z = ž C = Č S = Š Z = Ž */ +jQuery(function($){ + $.datepicker.regional['sl'] = { + closeText: 'Zapri', + prevText: '<Prejšnji', + nextText: 'Naslednji>', + currentText: 'Trenutni', + monthNames: ['Januar','Februar','Marec','April','Maj','Junij', + 'Julij','Avgust','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Avg','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljek','Torek','Sreda','Četrtek','Petek','Sobota'], + dayNamesShort: ['Ned','Pon','Tor','Sre','Čet','Pet','Sob'], + dayNamesMin: ['Ne','Po','To','Sr','Če','Pe','So'], + weekHeader: 'Teden', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sl']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sq.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sq.js new file mode 100644 index 0000000..be84104 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sq.js @@ -0,0 +1,23 @@ +/* Albanian initialisation for the jQuery UI date picker plugin. */ +/* Written by Flakron Bytyqi (flakron@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['sq'] = { + closeText: 'mbylle', + prevText: '<mbrapa', + nextText: 'Përpara>', + currentText: 'sot', + monthNames: ['Janar','Shkurt','Mars','Prill','Maj','Qershor', + 'Korrik','Gusht','Shtator','Tetor','Nëntor','Dhjetor'], + monthNamesShort: ['Jan','Shk','Mar','Pri','Maj','Qer', + 'Kor','Gus','Sht','Tet','Nën','Dhj'], + dayNames: ['E Diel','E Hënë','E Martë','E Mërkurë','E Enjte','E Premte','E Shtune'], + dayNamesShort: ['Di','Hë','Ma','Më','En','Pr','Sh'], + dayNamesMin: ['Di','Hë','Ma','Më','En','Pr','Sh'], + weekHeader: 'Ja', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sq']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr-SR.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr-SR.js new file mode 100644 index 0000000..8f8ea5e --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr-SR.js @@ -0,0 +1,23 @@ +/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Written by Dejan Dimić. */ +jQuery(function($){ + $.datepicker.regional['sr-SR'] = { + closeText: 'Zatvori', + prevText: '<', + nextText: '>', + currentText: 'Danas', + monthNames: ['Januar','Februar','Mart','April','Maj','Jun', + 'Jul','Avgust','Septembar','Oktobar','Novembar','Decembar'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Avg','Sep','Okt','Nov','Dec'], + dayNames: ['Nedelja','Ponedeljak','Utorak','Sreda','Četvrtak','Petak','Subota'], + dayNamesShort: ['Ned','Pon','Uto','Sre','Čet','Pet','Sub'], + dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'], + weekHeader: 'Sed', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sr-SR']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr.js new file mode 100644 index 0000000..49c9b4a --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sr.js @@ -0,0 +1,23 @@ +/* Serbian i18n for the jQuery UI date picker plugin. */ +/* Written by Dejan Dimić. */ +jQuery(function($){ + $.datepicker.regional['sr'] = { + closeText: 'Затвори', + prevText: '<', + nextText: '>', + currentText: 'Данас', + monthNames: ['Јануар','Фебруар','Март','Април','Мај','Јун', + 'Јул','Август','Септембар','Октобар','Новембар','Децембар'], + monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун', + 'Јул','Авг','Сеп','Окт','Нов','Дец'], + dayNames: ['Недеља','Понедељак','Уторак','Среда','Четвртак','Петак','Субота'], + dayNamesShort: ['Нед','Пон','Уто','Сре','Чет','Пет','Суб'], + dayNamesMin: ['Не','По','Ут','Ср','Че','Пе','Су'], + weekHeader: 'Сед', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sr']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sv.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sv.js new file mode 100644 index 0000000..8236b62 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-sv.js @@ -0,0 +1,23 @@ +/* Swedish initialisation for the jQuery UI date picker plugin. */ +/* Written by Anders Ekdahl ( anders@nomadiz.se). */ +jQuery(function($){ + $.datepicker.regional['sv'] = { + closeText: 'Stäng', + prevText: '«Förra', + nextText: 'Nästa»', + currentText: 'Idag', + monthNames: ['Januari','Februari','Mars','April','Maj','Juni', + 'Juli','Augusti','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], + dayNamesShort: ['Sön','MÃ¥n','Tis','Ons','Tor','Fre','Lör'], + dayNames: ['Söndag','MÃ¥ndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], + dayNamesMin: ['Sö','MÃ¥','Ti','On','To','Fr','Lö'], + weekHeader: 'Ve', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['sv']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ta.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ta.js new file mode 100644 index 0000000..91116d3 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-ta.js @@ -0,0 +1,23 @@ +/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by S A Sureshkumar (saskumar@live.com). */ +jQuery(function($){ + $.datepicker.regional['ta'] = { + closeText: 'மூடு', + prevText: 'முன்னையது', + nextText: 'அடுத்தது', + currentText: 'இன்று', + monthNames: ['தை','மாசி','பங்குனி','சித்திரை','வைகாசி','ஆனி', + 'ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி'], + monthNamesShort: ['தை','மாசி','பங்','சித்','வைகா','ஆனி', + 'ஆடி','ஆவ','புர','ஐப்','கார்','மார்'], + dayNames: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்க்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'], + dayNamesShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'], + dayNamesMin: ['ஞா','தி','செ','பு','வி','வெ','ச'], + weekHeader: 'Не', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ta']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-th.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-th.js new file mode 100644 index 0000000..978500a --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-th.js @@ -0,0 +1,23 @@ +/* Thai initialisation for the jQuery UI date picker plugin. */ +/* Written by pipo (pipo@sixhead.com). */ +jQuery(function($){ + $.datepicker.regional['th'] = { + closeText: 'ปิด', + prevText: '« à¸¢à¹‰à¸­à¸™', + nextText: 'ถัดไป »', + currentText: 'วันนี้', + monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน', + 'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'], + monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.', + 'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'], + dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'], + dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], + dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], + weekHeader: 'Wk', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['th']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-tr.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-tr.js new file mode 100644 index 0000000..dedfc7f --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-tr.js @@ -0,0 +1,23 @@ +/* Turkish initialisation for the jQuery UI date picker plugin. */ +/* Written by Izzet Emre Erkan (kara@karalamalar.net). */ +jQuery(function($){ + $.datepicker.regional['tr'] = { + closeText: 'kapat', + prevText: '<geri', + nextText: 'ileri>', + currentText: 'bugün', + monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran', + 'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'], + monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz', + 'Tem','Ağu','Eyl','Eki','Kas','Ara'], + dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'], + dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], + dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], + weekHeader: 'Hf', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['tr']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-uk.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-uk.js new file mode 100644 index 0000000..112b40e --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-uk.js @@ -0,0 +1,23 @@ +/* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Maxim Drogobitskiy (maxdao@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['uk'] = { + closeText: 'Закрити', + prevText: '<', + nextText: '>', + currentText: 'Сьогодні', + monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень', + 'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'], + monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер', + 'Лип','Сер','Вер','Жов','Лис','Гру'], + dayNames: ['неділя','понеділок','вівторок','середа','четвер','п’ятниця','субота'], + dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'], + dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'], + weekHeader: 'Не', + dateFormat: 'dd/mm/yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['uk']); +}); \ No newline at end of file diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-vi.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-vi.js new file mode 100644 index 0000000..9813a59 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-vi.js @@ -0,0 +1,23 @@ +/* Vietnamese initialisation for the jQuery UI date picker plugin. */ +/* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */ +jQuery(function($){ + $.datepicker.regional['vi'] = { + closeText: 'Đóng', + prevText: '<Trước', + nextText: 'Tiếp>', + currentText: 'Hôm nay', + monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng TÆ°', 'Tháng Năm', 'Tháng Sáu', + 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'], + monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', + 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'], + dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ TÆ°', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'], + dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + weekHeader: 'Tu', + dateFormat: 'dd/mm/yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['vi']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-CN.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-CN.js new file mode 100644 index 0000000..6c4883f --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-CN.js @@ -0,0 +1,23 @@ +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by Cloudream (cloudream@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-CN'] = { + closeText: '关闭', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'yy-mm-dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-CN']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-HK.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-HK.js new file mode 100644 index 0000000..06c4c62 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-HK.js @@ -0,0 +1,23 @@ +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by SCCY (samuelcychan@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-HK'] = { + closeText: '關閉', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'dd-mm-yy', + firstDay: 0, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-HK']); +}); diff --git a/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-TW.js b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-TW.js new file mode 100644 index 0000000..d211573 --- /dev/null +++ b/plugins/jqueryui/js/i18n/jquery.ui.datepicker-zh-TW.js @@ -0,0 +1,23 @@ +/* Chinese initialisation for the jQuery UI date picker plugin. */ +/* Written by Ressol (ressol@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['zh-TW'] = { + closeText: '關閉', + prevText: '<上月', + nextText: '下月>', + currentText: '今天', + monthNames: ['一月','二月','三月','四月','五月','六月', + '七月','八月','九月','十月','十一月','十二月'], + monthNamesShort: ['一','二','三','四','五','六', + '七','八','九','十','十一','十二'], + dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'], + dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], + dayNamesMin: ['日','一','二','三','四','五','六'], + weekHeader: '周', + dateFormat: 'yy/mm/dd', + firstDay: 1, + isRTL: false, + showMonthAfterYear: true, + yearSuffix: 'å¹´'}; + $.datepicker.setDefaults($.datepicker.regional['zh-TW']); +}); diff --git a/plugins/jqueryui/js/jquery-ui-1.8.14.custom.min.js b/plugins/jqueryui/js/jquery-ui-1.8.14.custom.min.js new file mode 100755 index 0000000..f9e4f1e --- /dev/null +++ b/plugins/jqueryui/js/jquery-ui-1.8.14.custom.min.js @@ -0,0 +1,789 @@ +/*! + * jQuery UI 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14", +keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus(); +b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this, +"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection", +function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth, +outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b); +return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e= +0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted= +false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, +left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= +k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= +m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= +d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= +a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), +g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Draggable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== +"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= +this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('
    ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;this.helper= +this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}); +this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true}, +_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b= +false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration, +10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle|| +!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&& +a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent= +this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"), +10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"), +10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top, +(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!= +"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"), +10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+ +this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&& +!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.leftg[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.topg[3])?h:!(h-this.offset.click.topg[2])?e:!(e-this.offset.click.left=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= +i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), +top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= +this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", +nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== +String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); +this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); +var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= +false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); +this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= +{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; +if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, +_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, +{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: +Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= +null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ +a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ +c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); +b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.14"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), +10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- +f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? +e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= +e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, +step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= +e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; +var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: +a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- +d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, +f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, +display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= +e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= +d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); +;/* + * jQuery UI Selectable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), +selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
    ")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, +c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", +c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= +this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== +"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&& +!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top, +left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; +this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= +document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); +return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], +e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); +c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): +this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, +dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, +toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); +if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), +this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= +this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= +d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| +0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", +a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- +f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- +this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, +this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", +a,this._uiHash());for(e=0;e li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); +a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); +if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", +function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a= +this.options;if(a.icons){c("").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"); +this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); +b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); +a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ +c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; +if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); +if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), +e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| +e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", +"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.14", +animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/); +f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide", +paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); +;/* + * jQuery UI Autocomplete 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + */ +(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g= +false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= +a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)}; +this.menu=d("
      ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& +a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); +d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& +b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= +this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, +"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); +(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", +-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); +this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b, +this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| +this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| +this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("");e.secondary&&a.append("");if(!this.options.text){d.push(f?"ui-button-icons-only": +"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")=== +"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"); +b.Widget.prototype.destroy.call(this)}})})(jQuery); +;/* + * jQuery UI Dialog 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.button.js + * jquery.ui.draggable.js + * jquery.ui.mouse.js + * jquery.ui.position.js + * jquery.ui.resizable.js + */ +(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, +position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
      ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ +b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
      ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), +h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", +e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); +a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== +b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+= +1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== +f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
      ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, +function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", +handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, +originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", +f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): +[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); +if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): +e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= +this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- +b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.14",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), +create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), +height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); +b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(a.range==="min"||a.range==="max"?" ui-slider-range-"+a.range:""))}for(var j=c.length;j"); +this.handles=c.add(d(e.join("")).appendTo(b.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle", +g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!b.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");i=b._start(g,l);if(i===false)return}break}m=b.options.step;i=b.options.values&&b.options.values.length? +(h=b.values(l)):(h=b.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=b._valueMin();break;case d.ui.keyCode.END:h=b._valueMax();break;case d.ui.keyCode.PAGE_UP:h=b._trimAlignValue(i+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(i-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===b._valueMax())return;h=b._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===b._valueMin())return;h=b._trimAlignValue(i- +m);break}b._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(g,k);b._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy(); +return this},_mouseCapture:function(b){var a=this.options,c,f,e,j,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(a.range===true&&this.values(1)===a.min){g+=1;e=d(this.handles[g])}if(this._start(b,g)===false)return false; +this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();a=e.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-e.width()/2,top:b.pageY-a.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(b){var a= +this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;if(this.orientation==="horizontal"){a= +this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a); +c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var f;if(this.options.values&&this.options.values.length){f=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>f||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, +_refreshValue:function(){var b=this.options.range,a=this.options,c=this,f=!this._animateOff?a.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},a.animate); +if(h===1)c.range[f?"animate":"css"]({width:e-g+"%"},{queue:false,duration:a.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},a.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:a.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, +1)[f?"animate":"css"]({width:e+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.14"})})(jQuery); +;/* + * jQuery UI Tabs 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
      ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
    • #{label}
    • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& +e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= +d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| +(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); +this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= +this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); +if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); +this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ +g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", +function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; +this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= +-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; +d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= +d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, +e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); +j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); +if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, +this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, +load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, +"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, +url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.14"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k'))}function N(a){return a.bind("mouseout",function(b){b= +d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");b.addClass("ui-state-hover"); +b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.14"}});var A=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){H(this._defaults, +a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0, +selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('
      '))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]= +h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c= +this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f==""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a, +"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker", +function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput); +a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left", +this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus", +this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b= +b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5", +cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a); +d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c= +d.datepicker._get(b,"beforeShow");H(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c= +{left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover"); +if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv); +J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"); +a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]|| +c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+ +i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b= +this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute", +left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&& +d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth= +b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear= +!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a); +a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a)); +d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()% +100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=B+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y", +TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= +a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), +b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= +this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+s+"":f?"":''+s+"";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
      '+(c?h:"")+(this._isInRange(a,s)?'":"")+(c?"":h)+"
      ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),B= +this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right": +"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='
      '+(/all|left/.test(t)&&x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,B,v)+'
      ';var z=j?'": +"";for(t=0;t<7;t++){var r=(t+h)%7;z+="=5?' class="ui-datepicker-week-end"':"")+'>'+q[r]+""}y+=z+"";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q";var R=!j?"":'";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&ro;R+='";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+""}g++;if(g>11){g=0;m++}y+="
      '+this._get(a,"weekHeader")+"
      '+ +this._get(a,"calculateWeek")(r)+""+(F&&!D?" ":L?''+r.getDate()+"":''+ +r.getDate()+"")+"
      "+(l?""+(i[0]>0&&G==i[1]-1?'
      ':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"), +l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
      ',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()): +g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
      ";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c== +"Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear"); +if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); +c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, +"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= +function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, +[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.14";window["DP_jQuery_"+A]=d})(jQuery); +;/* + * jQuery UI Progressbar 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
      ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.14"})})(jQuery); +;/* + * jQuery UI Effects 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; +f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, +[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.14",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); +c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, +a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); +a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", +"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* +((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= +e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= +e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], +10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/plugins/jqueryui/themes/default/images/buttongradient.png b/plugins/jqueryui/themes/default/images/buttongradient.png new file mode 100644 index 0000000..0595474 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/buttongradient.png differ diff --git a/plugins/jqueryui/themes/default/images/listheader.png b/plugins/jqueryui/themes/default/images/listheader.png new file mode 100644 index 0000000..670df0c Binary files /dev/null and b/plugins/jqueryui/themes/default/images/listheader.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png b/plugins/jqueryui/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 0000000..5b5dab2 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_flat_75_ffffff_40x100.png b/plugins/jqueryui/themes/default/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100755 index 0000000..ac8b229 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_flat_90_cc3333_40x100.png b/plugins/jqueryui/themes/default/images/ui-bg_flat_90_cc3333_40x100.png new file mode 100755 index 0000000..6a5d37d Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_flat_90_cc3333_40x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png b/plugins/jqueryui/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100755 index 0000000..4443fdc Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_a3a3a3_1x100.png b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_a3a3a3_1x100.png new file mode 100755 index 0000000..b3533aa Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_a3a3a3_1x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_e6e6e7_1x100.png b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_e6e6e7_1x100.png new file mode 100755 index 0000000..d0a127f Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_e6e6e7_1x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_f4f4f4_1x100.png b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_f4f4f4_1x100.png new file mode 100755 index 0000000..ecc0ac1 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-bg_highlight-hard_90_f4f4f4_1x100.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-icons_000000_256x240.png b/plugins/jqueryui/themes/default/images/ui-icons_000000_256x240.png new file mode 100755 index 0000000..7c211aa Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-icons_000000_256x240.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-icons_333333_256x240.png b/plugins/jqueryui/themes/default/images/ui-icons_333333_256x240.png new file mode 100755 index 0000000..fe079a5 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-icons_333333_256x240.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-icons_666666_256x240.png b/plugins/jqueryui/themes/default/images/ui-icons_666666_256x240.png new file mode 100755 index 0000000..f87de1c Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-icons_666666_256x240.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-icons_cc3333_256x240.png b/plugins/jqueryui/themes/default/images/ui-icons_cc3333_256x240.png new file mode 100755 index 0000000..b2fe029 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-icons_cc3333_256x240.png differ diff --git a/plugins/jqueryui/themes/default/images/ui-icons_dddddd_256x240.png b/plugins/jqueryui/themes/default/images/ui-icons_dddddd_256x240.png new file mode 100755 index 0000000..91aada0 Binary files /dev/null and b/plugins/jqueryui/themes/default/images/ui-icons_dddddd_256x240.png differ diff --git a/plugins/jqueryui/themes/default/jquery-ui-1.8.14.custom.css b/plugins/jqueryui/themes/default/jquery-ui-1.8.14.custom.css new file mode 100755 index 0000000..dbc78fd --- /dev/null +++ b/plugins/jqueryui/themes/default/jquery-ui-1.8.14.custom.css @@ -0,0 +1,580 @@ +/* + * jQuery UI CSS Framework 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ctl=themeroller&ffDefault=Lucida%20Grande,%20Verdana,%20Arial,%20Helvetica,%20sans-serif&fwDefault=normal&fsDefault=1em&cornerRadius=0&bgColorHeader=f4f4f4&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=90&borderColorHeader=999999&fcHeader=333333&iconColorHeader=333333&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=000000&iconColorContent=000000&bgColorDefault=e6e6e7&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=90&borderColorDefault=aaaaaa&fcDefault=000000&iconColorDefault=666666&bgColorHover=e6e6e7&bgTextureHover=04_highlight_hard.png&bgImgOpacityHover=90&borderColorHover=999999&fcHover=000000&iconColorHover=333333&bgColorActive=a3a3a3&bgTextureActive=04_highlight_hard.png&bgImgOpacityActive=90&borderColorActive=a4a4a4&fcActive=000000&iconColorActive=333333&bgColorHighlight=cc3333&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=90&borderColorHighlight=cc3333&fcHighlight=ffffff&iconColorHighlight=dddddd&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cc3333&fcError=cc3333&iconColorError=cc3333&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=35&thicknessShadow=6px&offsetTopShadow=-6px&offsetLeftShadow=-6px&cornerRadiusShadow=6px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif; font-size: 1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #000000; } +.ui-widget-content a { color: #000000; } +.ui-widget-header { border: 1px solid #999999; border-width: 0 0 1px 0; background: #f4f4f4 url(images/listheader.png) 50% 50% repeat; color: #333333; font-weight: bold; margin: -0.2em -0.2em 0 -0.2em; } +.ui-widget-header a { color: #333333; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #aaaaaa; background: #e6e6e7 url(images/ui-bg_highlight-hard_90_e6e6e7_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #000000; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #000000; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #e6e6e7 url(images/ui-bg_highlight-hard_90_e6e6e7_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #000000; } +.ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #a4a4a4; background: #a3a3a3 url(images/ui-bg_highlight-hard_90_a3a3a3_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #000000; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #000000; text-decoration: none; } +.ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #c33; color: #a00; } +.ui-tabs-nav .ui-state-focus { border: 1px solid #a4a4a4; color: #000000; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #cc3333; background: #cc3333 url(images/ui-bg_flat_90_cc3333_40x100.png) 50% 50% repeat-x; color: #ffffff; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #ffffff; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc3333; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cc3333; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc3333; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc3333; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .6; filter:Alpha(Opacity=60); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_000000_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_000000_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_333333_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_666666_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_333333_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_333333_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_dddddd_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cc3333_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 0; -webkit-border-top-left-radius: 0; -khtml-border-top-left-radius: 0; border-top-left-radius: 0; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 0; -webkit-border-top-right-radius: 0; -khtml-border-top-right-radius: 0; border-top-right-radius: 0; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 0; -webkit-border-bottom-left-radius: 0; -khtml-border-bottom-left-radius: 0; border-bottom-left-radius: 0; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 0; -webkit-border-bottom-right-radius: 0; -khtml-border-bottom-right-radius: 0; border-bottom-right-radius: 0; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -6px 0 0 -6px; padding: 6px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .35;filter:Alpha(Opacity=35); -moz-border-radius: 6px; -khtml-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; }/* + * jQuery UI Resizable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +#ui-active-menuitem { background:#c33; border-color:#a22; color:#fff; } + +/* + * jQuery UI Menu 1.8.14 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; + box-shadow: 1px 1px 18px #999; + -moz-box-shadow: 1px 1px 12px #999; + -webkit-box-shadow: #999 1px 1px 12px; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: default; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } +button.ui-button-text-only, a.ui-button-text-only { background-image: url(images/buttongradient.png) !important; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .3em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; box-shadow: 1px 1px 18px #999; -moz-box-shadow: 1px 1px 12px #999; -webkit-box-shadow: #999 1px 1px 12px; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: default; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 0 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .3em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } + +.ui-dialog .ui-tabs .ui-tabs-nav li.ui-tabs-selected { background:#fff; } + +/* + * jQuery UI Datepicker 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; box-shadow: 1px 1px 18px #999; -moz-box-shadow: 1px 1px 12px #999; -webkit-box-shadow: #999 1px 1px 12px; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker td.ui-datepicker-current-day .ui-state-active { background:#c33; border-color:#a22; color:#fff; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: default; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Progressbar 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/plugins/jqueryui/themes/default/roundcube-custom.diff b/plugins/jqueryui/themes/default/roundcube-custom.diff new file mode 100644 index 0000000..cd1e300 --- /dev/null +++ b/plugins/jqueryui/themes/default/roundcube-custom.diff @@ -0,0 +1,124 @@ +--- jquery-ui-1.8.14.custom.css.orig 2011-07-20 13:59:40.000000000 +0200 ++++ jquery-ui-1.8.14.custom.css 2011-07-24 16:23:47.000000000 +0200 +@@ -61,7 +61,7 @@ + .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif; font-size: 1em; } + .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #000000; } + .ui-widget-content a { color: #000000; } +-.ui-widget-header { border: 1px solid #999999; background: #f4f4f4 url(images/ui-bg_highlight-hard_90_f4f4f4_1x100.png) 50% 50% repeat-x; color: #333333; font-weight: bold; } ++.ui-widget-header { border: 1px solid #999999; border-width: 0 0 1px 0; background: #f4f4f4 url(images/listheader.png) 50% 50% repeat; color: #333333; font-weight: bold; margin: -0.2em -0.2em 0 -0.2em; } + .ui-widget-header a { color: #333333; } + + /* Interaction states +@@ -72,6 +72,8 @@ + .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; } + .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #a4a4a4; background: #a3a3a3 url(images/ui-bg_highlight-hard_90_a3a3a3_1x100.png) 50% 50% repeat-x; font-weight: normal; color: #000000; } + .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #000000; text-decoration: none; } ++.ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #c33; color: #a00; } ++.ui-tabs-nav .ui-state-focus { border: 1px solid #a4a4a4; color: #000000; } + .ui-widget :active { outline: none; } + + /* Interaction Cues +@@ -82,7 +84,7 @@ + .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc3333; } + .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc3333; } + .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } ++.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .6; filter:Alpha(Opacity=60); font-weight: normal; } + .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + + /* Icons +@@ -349,6 +351,8 @@ + /* workarounds */ + * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + ++#ui-active-menuitem { background:#c33; border-color:#a22; color:#fff; } ++ + /* + * jQuery UI Menu 1.8.14 + * +@@ -364,6 +368,9 @@ + margin: 0; + display:block; + float: left; ++ box-shadow: 1px 1px 18px #999; ++ -moz-box-shadow: 1px 1px 12px #999; ++ -webkit-box-shadow: #999 1px 1px 12px; + } + .ui-menu .ui-menu { + margin-top: -3px; +@@ -397,15 +404,16 @@ + * + * http://docs.jquery.com/UI/Button#theming + */ +-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ ++.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: default; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ + .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ + button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ + .ui-button-icons-only { width: 3.4em; } + button.ui-button-icons-only { width: 3.7em; } ++button.ui-button-text-only, a.ui-button-text-only { background-image: url(images/buttongradient.png) !important; } + + /*button text element */ + .ui-button .ui-button-text { display: block; line-height: 1.4; } +-.ui-button-text-only .ui-button-text { padding: .4em 1em; } ++.ui-button-text-only .ui-button-text { padding: .3em 1em; } + .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } + .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } + .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +@@ -435,7 +443,7 @@ + * + * http://docs.jquery.com/UI/Dialog#theming + */ +-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } ++.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; box-shadow: 1px 1px 18px #999; -moz-box-shadow: 1px 1px 12px #999; -webkit-box-shadow: #999 1px 1px 12px; } + .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } + .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } + .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +@@ -444,7 +452,7 @@ + .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } + .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } + .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +-.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } ++.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: default; } + .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } + .ui-draggable .ui-dialog-titlebar { cursor: move; } + /* +@@ -481,13 +489,16 @@ + */ + .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ + .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +-.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +-.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } ++.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 0 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; } ++.ui-tabs .ui-tabs-nav li a { float: left; padding: .3em 1em; text-decoration: none; } + .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } + .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } + .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ + .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } + .ui-tabs .ui-tabs-hide { display: none !important; } ++ ++.ui-dialog .ui-tabs .ui-tabs-nav li.ui-tabs-selected { background:#fff; } ++ + /* + * jQuery UI Datepicker 1.8.14 + * +@@ -497,7 +508,7 @@ + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } ++.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; box-shadow: 1px 1px 18px #999; -moz-box-shadow: 1px 1px 12px #999; -webkit-box-shadow: #999 1px 1px 12px; } + .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } + .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } + .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +@@ -515,8 +526,9 @@ + .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } + .ui-datepicker td { border: 0; padding: 1px; } + .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } ++.ui-datepicker td.ui-datepicker-current-day .ui-state-active { background:#c33; border-color:#a22; color:#fff; } + .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } ++.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: default; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } + .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + + /* with multiple calendars */ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png b/plugins/jqueryui/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 0000000..5b5dab2 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_flat_55_fbec88_40x100.png b/plugins/jqueryui/themes/redmond/images/ui-bg_flat_55_fbec88_40x100.png new file mode 100755 index 0000000..47acaad Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_flat_55_fbec88_40x100.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png new file mode 100755 index 0000000..9fb564f Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png new file mode 100755 index 0000000..0149515 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_glass_95_fef1ec_1x400.png b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100755 index 0000000..4443fdc Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png b/plugins/jqueryui/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png new file mode 100755 index 0000000..81ecc36 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png b/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png new file mode 100755 index 0000000..4f3faf8 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png b/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png new file mode 100755 index 0000000..38c3833 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_217bc0_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_217bc0_256x240.png new file mode 100755 index 0000000..6f4bd87 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_217bc0_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_2e83ff_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_2e83ff_256x240.png new file mode 100755 index 0000000..09d1cdc Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_2e83ff_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_469bdd_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_469bdd_256x240.png new file mode 100755 index 0000000..bd2cf07 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_469bdd_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_6da8d5_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_6da8d5_256x240.png new file mode 100755 index 0000000..3d6f567 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_6da8d5_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_cd0a0a_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_cd0a0a_256x240.png new file mode 100755 index 0000000..2ab019b Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_cd0a0a_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_d8e7f3_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_d8e7f3_256x240.png new file mode 100755 index 0000000..ad2dc6f Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_d8e7f3_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/images/ui-icons_f9bd01_256x240.png b/plugins/jqueryui/themes/redmond/images/ui-icons_f9bd01_256x240.png new file mode 100755 index 0000000..7862502 Binary files /dev/null and b/plugins/jqueryui/themes/redmond/images/ui-icons_f9bd01_256x240.png differ diff --git a/plugins/jqueryui/themes/redmond/jquery-ui-1.8.14.custom.css b/plugins/jqueryui/themes/redmond/jquery-ui-1.8.14.custom.css new file mode 100755 index 0000000..49dc0ab --- /dev/null +++ b/plugins/jqueryui/themes/redmond/jquery-ui-1.8.14.custom.css @@ -0,0 +1,568 @@ +/* + * jQuery UI CSS Framework 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } +.ui-widget-header a { color: #ffffff; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; } +.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.14 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Progressbar 1.8.14 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 20e3bb8..e354064 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,8 +1,34 @@ +- Fixed import from Horde-INGO (#1488064) + +* version 4.3 [2011-07-28] +----------------------------------------------------------- +- Fixed handling of error in Net_Sieve::listScripts() +- Fixed handling of REFERRAL responses (http://pear.php.net/bugs/bug.php?id=17107) +- Fixed bug where wrong folders hierarchy was displayed on folders listing + +* version 4.2 [2011-05-24] +----------------------------------------------------------- +- Moved elsif replacement code to handle only imports from other formats +- Fixed mod_mailbox() usage for newer Roundcube versions +- Fixed regex extension (error: regex require missing) + +* version 4.1 [2011-03-07] +----------------------------------------------------------- +- Fix fileinto target is always INBOX (#1487776) - Fix escaping of backslash character in quoted strings (#1487780) -- Fix STARTTLS for timsieved < 2.3.10 - Fix handling of non-safe characters (double-quote, backslash) or UTF-8 characters (dovecot's implementation bug workaround) in script names +- Fix saving of a script using flags extension on servers with imap4flags support (#1487825) + +* version 4.0 [2011-02-10] +----------------------------------------------------------- +- Fix STARTTLS for timsieved < 2.3.10 +- Added :regex and :matches support (#1487746) +- Added setflag/addflag/removeflag support (#1487449) +- Added support for vacation :subject field (#1487120) +- rcube_sieve_script class moved to separate file +- Moved javascript code from skin templates into managesieve.js file * version 3.0 [2011-02-01] ----------------------------------------------------------- diff --git a/plugins/managesieve/lib/Net/Sieve.php b/plugins/managesieve/lib/Net/Sieve.php index 0f6a5f6..a8e36d8 100644 --- a/plugins/managesieve/lib/Net/Sieve.php +++ b/plugins/managesieve/lib/Net/Sieve.php @@ -296,6 +296,13 @@ class Net_Sieve */ function connect($host, $port, $options = null, $useTLS = true) { + $this->_data['host'] = $host; + $this->_data['port'] = $port; + $this->_useTLS = $useTLS; + if (!empty($options) && is_array($options)) { + $this->_options = array_merge($this->_options, $options); + } + if (NET_SIEVE_STATE_DISCONNECTED != $this->_state) { return PEAR::raiseError('Not currently in DISCONNECTED state', 1); } @@ -359,6 +366,12 @@ class Net_Sieve */ function login($user, $pass, $logintype = null, $euser = '', $bypassAuth = false) { + $this->_data['user'] = $user; + $this->_data['pass'] = $pass; + $this->_data['logintype'] = $logintype; + $this->_data['euser'] = $euser; + $this->_bypassAuth = $bypassAuth; + if (NET_SIEVE_STATE_AUTHORISATION != $this->_state) { return PEAR::raiseError('Not currently in AUTHORISATION state', 1); } diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php index 64bdb20..3e52809 100644 --- a/plugins/managesieve/lib/rcube_sieve.php +++ b/plugins/managesieve/lib/rcube_sieve.php @@ -5,11 +5,11 @@ Author: Aleksander Machniak - $Id: rcube_sieve.php 4555 2011-02-16 10:48:11Z alec $ + $Id: rcube_sieve.php 5203 2011-09-12 06:44:56Z alec $ */ -// Sieve Language Basics: http://www.ietf.org/rfc/rfc5228.txt +// Managesieve Protocol: RFC5804 define('SIEVE_ERROR_CONNECTION', 1); define('SIEVE_ERROR_LOGIN', 2); @@ -31,6 +31,7 @@ class rcube_sieve public $script; // rcube_sieve_script object public $current; // name of currently loaded script private $disabled; // array of disabled extensions + private $exts; // array of supported extensions /** @@ -73,6 +74,7 @@ class rcube_sieve return $this->_set_error(SIEVE_ERROR_LOGIN); } + $this->exts = $this->get_extensions(); $this->disabled = $disabled; } @@ -191,6 +193,9 @@ class rcube_sieve */ public function get_extensions() { + if ($this->exts) + return $this->exts; + if (!$this->sieve) return $this->_set_error(SIEVE_ERROR_INTERNAL); @@ -218,10 +223,12 @@ class rcube_sieve if (!$this->sieve) return $this->_set_error(SIEVE_ERROR_INTERNAL); - $this->list = $this->sieve->listScripts(); + $list = $this->sieve->listScripts(); - if (PEAR::isError($this->list)) + if (PEAR::isError($list)) return $this->_set_error(SIEVE_ERROR_OTHER); + + $this->list = $list; } return $this->list; @@ -280,24 +287,22 @@ class rcube_sieve private function _parse($txt) { // try to parse from Roundcube format - $script = new rcube_sieve_script($txt, $this->disabled); + $script = new rcube_sieve_script($txt, $this->disabled, $this->exts); // ... else try to import from different formats if (empty($script->content)) { $script = $this->_import_rules($txt); - $script = new rcube_sieve_script($script, $this->disabled); - } + $script = new rcube_sieve_script($script, $this->disabled, $this->exts); - // replace all elsif with if+stop, we support only ifs - foreach ($script->content as $idx => $rule) { - if (!isset($script->content[$idx+1]) - || preg_match('/^else|elsif$/', $script->content[$idx+1]['type'])) { + // replace all elsif with if+stop, we support only ifs + foreach ($script->content as $idx => $rule) { // 'stop' not found? - if (!preg_match('/^(stop|vacation)$/', $rule['actions'][count($rule['actions'])-1]['type'])) { - $script->content[$idx]['actions'][] = array( - 'type' => 'stop' - ); + foreach ($rule['actions'] as $action) { + if (preg_match('/^(stop|vacation)$/', $action['type'])) { + continue 2; + } } + $script->content[$idx]['actions'][] = array('type' => 'stop'); } } @@ -344,8 +349,9 @@ class rcube_sieve $name = array(); // Squirrelmail (Avelsieve) - if ($tokens = preg_split('/(#START_SIEVE_RULE.*END_SIEVE_RULE)\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { - foreach($tokens as $token) { + if (preg_match('/(#START_SIEVE_RULE.*END_SIEVE_RULE)\r?\n/', $script)) { + $tokens = preg_split('/(#START_SIEVE_RULE.*END_SIEVE_RULE)\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE); + foreach ($tokens as $token) { if (preg_match('/^#START_SIEVE_RULE.*/', $token, $matches)) { $name[$i] = "unnamed rule ".($i+1); $content .= "# rule:[".$name[$i]."]\n"; @@ -361,9 +367,10 @@ class rcube_sieve } } // Horde (INGO) - else if ($tokens = preg_split('/(# .+)\r?\n/i', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { + else if (preg_match('/(# .+)\r?\n/', $script)) { + $tokens = preg_split('/(# .+)\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE); foreach($tokens as $token) { - if (preg_match('/^# (.+)/i', $token, $matches)) { + if (preg_match('/^# (.+)/', $token, $matches)) { $name[$i] = $matches[1]; $content .= "# rule:[" . $name[$i] . "]\n"; } @@ -392,688 +399,3 @@ class rcube_sieve write_log('sieve', preg_replace('/\r\n$/', '', $message)); } } - - -class rcube_sieve_script -{ - public $content = array(); // script rules array - - private $supported = array( // extensions supported by class - 'fileinto', - 'reject', - 'ereject', - 'copy', // RFC3894 - 'vacation', // RFC5230 - 'relational', // RFC3431 - // TODO: (most wanted first) body, imapflags, notify, regex - ); - - /** - * Object constructor - * - * @param string Script's text content - * @param array Disabled extensions - */ - public function __construct($script, $disabled=null) - { - if (!empty($disabled)) { - // we're working on lower-cased names - $disabled = array_map('strtolower', (array) $disabled); - foreach ($disabled as $ext) { - if (($idx = array_search($ext, $this->supported)) !== false) { - unset($this->supported[$idx]); - } - } - } - - $this->content = $this->_parse_text($script); - } - - /** - * Adds script contents as text to the script array (at the end) - * - * @param string Text script contents - */ - public function add_text($script) - { - $content = $this->_parse_text($script); - $result = false; - - // check existsing script rules names - foreach ($this->content as $idx => $elem) { - $names[$elem['name']] = $idx; - } - - foreach ($content as $elem) { - if (!isset($names[$elem['name']])) { - array_push($this->content, $elem); - $result = true; - } - } - - return $result; - } - - /** - * Adds rule to the script (at the end) - * - * @param string Rule name - * @param array Rule content (as array) - */ - public function add_rule($content) - { - // TODO: check this->supported - array_push($this->content, $content); - return sizeof($this->content)-1; - } - - public function delete_rule($index) - { - if(isset($this->content[$index])) { - unset($this->content[$index]); - return true; - } - return false; - } - - public function size() - { - return sizeof($this->content); - } - - public function update_rule($index, $content) - { - // TODO: check this->supported - if ($this->content[$index]) { - $this->content[$index] = $content; - return $index; - } - return false; - } - - /** - * Returns script as text - */ - public function as_text() - { - $script = ''; - $exts = array(); - $idx = 0; - - // rules - foreach ($this->content as $rule) { - $extension = ''; - $tests = array(); - $i = 0; - - // header - $script .= '# rule:[' . $rule['name'] . "]\n"; - - // constraints expressions - foreach ($rule['tests'] as $test) { - $tests[$i] = ''; - switch ($test['test']) { - case 'size': - $tests[$i] .= ($test['not'] ? 'not ' : ''); - $tests[$i] .= 'size :' . ($test['type']=='under' ? 'under ' : 'over ') . $test['arg']; - break; - case 'true': - $tests[$i] .= ($test['not'] ? 'false' : 'true'); - break; - case 'exists': - $tests[$i] .= ($test['not'] ? 'not ' : ''); - $tests[$i] .= 'exists ' . self::escape_string($test['arg']); - break; - case 'header': - $tests[$i] .= ($test['not'] ? 'not ' : ''); - - // relational operator + comparator - if (preg_match('/^(value|count)-([gteqnl]{2})/', $test['type'], $m)) { - array_push($exts, 'relational'); - array_push($exts, 'comparator-i;ascii-numeric'); - $tests[$i] .= 'header :' . $m[1] . ' "' . $m[2] . '" :comparator "i;ascii-numeric"'; - } - else - $tests[$i] .= 'header :' . $test['type']; - - $tests[$i] .= ' ' . self::escape_string($test['arg1']); - $tests[$i] .= ' ' . self::escape_string($test['arg2']); - break; - } - $i++; - } - - // disabled rule: if false #.... - $script .= 'if ' . ($rule['disabled'] ? 'false # ' : ''); - - if (empty($tests)) { - $tests_str = 'true'; - } - else if (count($tests) > 1) { - $tests_str = implode(', ', $tests); - } - else { - $tests_str = $tests[0]; - } - - if ($rule['join'] || count($tests) > 1) { - $script .= sprintf('%s (%s)', $rule['join'] ? 'allof' : 'anyof', $tests_str); - } - else { - $script .= $tests_str; - } - $script .= "\n{\n"; - - // action(s) - foreach ($rule['actions'] as $action) { - switch ($action['type']) { - case 'fileinto': - array_push($exts, 'fileinto'); - $script .= "\tfileinto "; - if ($action['copy']) { - $script .= ':copy '; - array_push($exts, 'copy'); - } - $script .= self::escape_string($action['target']) . ";\n"; - break; - case 'redirect': - $script .= "\tredirect "; - if ($action['copy']) { - $script .= ':copy '; - array_push($exts, 'copy'); - } - $script .= self::escape_string($action['target']) . ";\n"; - break; - case 'reject': - case 'ereject': - array_push($exts, $action['type']); - $script .= "\t".$action['type']." " - . self::escape_string($action['target']) . ";\n"; - break; - case 'keep': - case 'discard': - case 'stop': - $script .= "\t" . $action['type'] .";\n"; - break; - case 'vacation': - array_push($exts, 'vacation'); - $script .= "\tvacation"; - if (!empty($action['days'])) - $script .= " :days " . $action['days']; - if (!empty($action['addresses'])) - $script .= " :addresses " . self::escape_string($action['addresses']); - if (!empty($action['subject'])) - $script .= " :subject " . self::escape_string($action['subject']); - if (!empty($action['handle'])) - $script .= " :handle " . self::escape_string($action['handle']); - if (!empty($action['from'])) - $script .= " :from " . self::escape_string($action['from']); - if (!empty($action['mime'])) - $script .= " :mime"; - $script .= " " . self::escape_string($action['reason']) . ";\n"; - break; - } - } - - $script .= "}\n"; - $idx++; - } - - // requires - if (!empty($exts)) - $script = 'require ["' . implode('","', array_unique($exts)) . "\"];\n" . $script; - - return $script; - } - - /** - * Returns script object - * - */ - public function as_array() - { - return $this->content; - } - - /** - * Returns array of supported extensions - * - */ - public function get_extensions() - { - return array_values($this->supported); - } - - /** - * Converts text script to rules array - * - * @param string Text script - */ - private function _parse_text($script) - { - $i = 0; - $content = array(); - - // tokenize rules - if ($tokens = preg_split('/(# rule:\[.*\])\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { - foreach($tokens as $token) { - if (preg_match('/^# rule:\[(.*)\]/', $token, $matches)) { - $content[$i]['name'] = $matches[1]; - } - else if (isset($content[$i]['name']) && sizeof($content[$i]) == 1) { - if ($rule = $this->_tokenize_rule($token)) { - $content[$i] = array_merge($content[$i], $rule); - $i++; - } - else // unknown rule format - unset($content[$i]); - } - } - } - - return $content; - } - - /** - * Convert text script fragment to rule object - * - * @param string Text rule - */ - private function _tokenize_rule($content) - { - $cond = strtolower(self::tokenize($content, 1)); - - if ($cond != 'if' && $cond != 'elsif' && $cond != 'else') { - return null; - } - - $disabled = false; - $join = false; - - // disabled rule (false + comment): if false # ..... - if (preg_match('/^\s*false\s+#/i', $content)) { - $content = preg_replace('/^\s*false\s+#\s*/i', '', $content); - $disabled = true; - } - - while (strlen($content)) { - $tokens = self::tokenize($content, true); - $separator = array_pop($tokens); - - if (!empty($tokens)) { - $token = array_shift($tokens); - } - else { - $token = $separator; - } - - $token = strtolower($token); - - if ($token == 'not') { - $not = true; - $token = strtolower(array_shift($tokens)); - } - else { - $not = false; - } - - switch ($token) { - case 'allof': - $join = true; - break; - case 'anyof': - break; - - case 'size': - $size = array('test' => 'size', 'not' => $not); - for ($i=0, $len=count($tokens); $i<$len; $i++) { - if (!is_array($tokens[$i]) - && preg_match('/^:(under|over)$/i', $tokens[$i]) - ) { - $size['type'] = strtolower(substr($tokens[$i], 1)); - } - else { - $size['arg'] = $tokens[$i]; - } - } - - $tests[] = $size; - break; - - case 'header': - $header = array('test' => 'header', 'not' => $not, 'arg1' => '', 'arg2' => ''); - for ($i=0, $len=count($tokens); $i<$len; $i++) { - if (!is_array($tokens[$i]) && preg_match('/^:comparator$/i', $tokens[$i])) { - $i++; - } - else if (!is_array($tokens[$i]) && preg_match('/^:(count|value)$/i', $tokens[$i])) { - $header['type'] = strtolower(substr($tokens[$i], 1)) . '-' . $tokens[++$i]; - } - else if (!is_array($tokens[$i]) && preg_match('/^:(is|contains|matches)$/i', $tokens[$i])) { - $header['type'] = strtolower(substr($tokens[$i], 1)); - } - else { - $header['arg1'] = $header['arg2']; - $header['arg2'] = $tokens[$i]; - } - } - - $tests[] = $header; - break; - - case 'exists': - $tests[] = array('test' => 'exists', 'not' => $not, - 'arg' => array_pop($tokens)); - break; - - case 'true': - $tests[] = array('test' => 'true', 'not' => $not); - break; - - case 'false': - $tests[] = array('test' => 'true', 'not' => !$not); - break; - } - - // goto actions... - if ($separator == '{') { - break; - } - } - - // ...and actions block - if ($tests) { - $actions = $this->_parse_actions($content); - } - - if ($tests && $actions) { - $result = array( - 'type' => $cond, - 'tests' => $tests, - 'actions' => $actions, - 'join' => $join, - 'disabled' => $disabled, - ); - } - - return $result; - } - - /** - * Parse body of actions section - * - * @param string Text body - * @return array Array of parsed action type/target pairs - */ - private function _parse_actions($content) - { - $result = null; - - while (strlen($content)) { - $tokens = self::tokenize($content, true); - $separator = array_pop($tokens); - - if (!empty($tokens)) { - $token = array_shift($tokens); - } - else { - $token = $separator; - } - - switch ($token) { - case 'discard': - case 'keep': - case 'stop': - $result[] = array('type' => $token); - break; - - case 'fileinto': - case 'redirect': - $copy = false; - $target = ''; - - for ($i=0, $len=count($tokens); $i<$len; $i++) { - if (strtolower($tokens[$i]) == ':copy') { - $copy = true; - } - else { - $target = $tokens[$i]; - } - } - - $result[] = array('type' => $token, 'copy' => $copy, - 'target' => $target); - break; - - case 'reject': - case 'ereject': - $result[] = array('type' => $token, 'target' => array_pop($tokens)); - break; - - case 'vacation': - $vacation = array('type' => 'vacation', 'reason' => array_pop($tokens)); - - for ($i=0, $len=count($tokens); $i<$len; $i++) { - $tok = strtolower($tokens[$i]); - if ($tok == ':days') { - $vacation['days'] = $tokens[++$i]; - } - else if ($tok == ':subject') { - $vacation['subject'] = $tokens[++$i]; - } - else if ($tok == ':addresses') { - $vacation['addresses'] = $tokens[++$i]; - } - else if ($tok == ':handle') { - $vacation['handle'] = $tokens[++$i]; - } - else if ($tok == ':from') { - $vacation['from'] = $tokens[++$i]; - } - else if ($tok == ':mime') { - $vacation['mime'] = true; - } - } - - $result[] = $vacation; - break; - } - } - - return $result; - } - - /** - * Escape special chars into quoted string value or multi-line string - * or list of strings - * - * @param string $str Text or array (list) of strings - * - * @return string Result text - */ - static function escape_string($str) - { - if (is_array($str) && count($str) > 1) { - foreach($str as $idx => $val) - $str[$idx] = self::escape_string($val); - - return '[' . implode(',', $str) . ']'; - } - else if (is_array($str)) { - $str = array_pop($str); - } - - // multi-line string - if (preg_match('/[\r\n\0]/', $str) || strlen($str) > 1024) { - return sprintf("text:\n%s\n.\n", self::escape_multiline_string($str)); - } - // quoted-string - else { - $replace = array('\\' => '\\\\', '"' => '\\"'); - $str = str_replace(array_keys($replace), array_values($replace), $str); - return '"' . $str . '"'; - } - } - - /** - * Escape special chars in multi-line string value - * - * @param string $str Text - * - * @return string Text - */ - static function escape_multiline_string($str) - { - $str = preg_split('/(\r?\n)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE); - - foreach ($str as $idx => $line) { - // dot-stuffing - if (isset($line[0]) && $line[0] == '.') { - $str[$idx] = '.' . $line; - } - } - - return implode($str); - } - - /** - * Splits script into string tokens - * - * @param string &$str The script - * @param mixed $num Number of tokens to return, 0 for all - * or True for all tokens until separator is found. - * Separator will be returned as last token. - * @param int $in_list Enable to called recursively inside a list - * - * @return mixed Tokens array or string if $num=1 - */ - static function tokenize(&$str, $num=0, $in_list=false) - { - $result = array(); - - // remove spaces from the beginning of the string - while (($str = ltrim($str)) !== '' - && (!$num || $num === true || count($result) < $num) - ) { - switch ($str[0]) { - - // Quoted string - case '"': - $len = strlen($str); - - for ($pos=1; $pos<$len; $pos++) { - if ($str[$pos] == '"') { - break; - } - if ($str[$pos] == "\\") { - if ($str[$pos + 1] == '"' || $str[$pos + 1] == "\\") { - $pos++; - } - } - } - if ($str[$pos] != '"') { - // error - } - // we need to strip slashes for a quoted string - $result[] = stripslashes(substr($str, 1, $pos - 1)); - $str = substr($str, $pos + 1); - break; - - // Parenthesized list - case '[': - $str = substr($str, 1); - $result[] = self::tokenize($str, 0, true); - break; - case ']': - $str = substr($str, 1); - return $result; - break; - - // list/test separator - case ',': - // command separator - case ';': - // block/tests-list - case '(': - case ')': - case '{': - case '}': - $sep = $str[0]; - $str = substr($str, 1); - if ($num === true) { - $result[] = $sep; - break 2; - } - break; - - // bracket-comment - case '/': - if ($str[1] == '*') { - if ($end_pos = strpos($str, '*/')) { - $str = substr($str, $end_pos + 2); - } - else { - // error - $str = ''; - } - } - break; - - // hash-comment - case '#': - if ($lf_pos = strpos($str, "\n")) { - $str = substr($str, $lf_pos); - break; - } - else { - $str = ''; - } - - // String atom - default: - // empty or one character - if ($str === '') { - break 2; - } - if (strlen($str) < 2) { - $result[] = $str; - $str = ''; - break; - } - - // tag/identifier/number - if (preg_match('/^([a-z0-9:_]+)/i', $str, $m)) { - $str = substr($str, strlen($m[1])); - - if ($m[1] != 'text:') { - $result[] = $m[1]; - } - // multiline string - else { - // possible hash-comment after "text:" - if (preg_match('/^( |\t)*(#[^\n]+)?\n/', $str, $m)) { - $str = substr($str, strlen($m[0])); - } - // get text until alone dot in a line - if (preg_match('/^(.*)\r?\n\.\r?\n/sU', $str, $m)) { - $text = $m[1]; - // remove dot-stuffing - $text = str_replace("\n..", "\n.", $text); - $str = substr($str, strlen($m[0])); - } - else { - $text = ''; - } - - $result[] = $text; - } - } - - break; - } - } - - return $num === 1 ? (isset($result[0]) ? $result[0] : null) : $result; - } - -} diff --git a/plugins/managesieve/lib/rcube_sieve_script.php b/plugins/managesieve/lib/rcube_sieve_script.php new file mode 100644 index 0000000..871fb14 --- /dev/null +++ b/plugins/managesieve/lib/rcube_sieve_script.php @@ -0,0 +1,731 @@ + + + $Id: rcube_sieve_script.php 4806 2011-05-24 08:32:01Z alec $ + +*/ + +class rcube_sieve_script +{ + public $content = array(); // script rules array + + private $supported = array( // extensions supported by class + 'fileinto', // RFC3028 + 'reject', // RFC5429 + 'ereject', // RFC5429 + 'copy', // RFC3894 + 'vacation', // RFC5230 + 'relational', // RFC3431 + 'regex', // draft-ietf-sieve-regex-01 + 'imapflags', // draft-melnikov-sieve-imapflags-06 + 'imap4flags', // RFC5232 + // TODO: body, notify + ); + + private $capabilities; + + /** + * Object constructor + * + * @param string Script's text content + * @param array List of disabled extensions + * @param array List of capabilities supported by server + */ + public function __construct($script, $disabled=null, $capabilities=null) + { + if (!empty($disabled)) { + // we're working on lower-cased names + $disabled = array_map('strtolower', (array) $disabled); + foreach ($disabled as $ext) { + if (($idx = array_search($ext, $this->supported)) !== false) { + unset($this->supported[$idx]); + } + } + } + + $this->capabilities = $capabilities; + $this->content = $this->_parse_text($script); + } + + /** + * Adds script contents as text to the script array (at the end) + * + * @param string Text script contents + */ + public function add_text($script) + { + $content = $this->_parse_text($script); + $result = false; + + // check existsing script rules names + foreach ($this->content as $idx => $elem) { + $names[$elem['name']] = $idx; + } + + foreach ($content as $elem) { + if (!isset($names[$elem['name']])) { + array_push($this->content, $elem); + $result = true; + } + } + + return $result; + } + + /** + * Adds rule to the script (at the end) + * + * @param string Rule name + * @param array Rule content (as array) + */ + public function add_rule($content) + { + // TODO: check this->supported + array_push($this->content, $content); + return sizeof($this->content)-1; + } + + public function delete_rule($index) + { + if(isset($this->content[$index])) { + unset($this->content[$index]); + return true; + } + return false; + } + + public function size() + { + return sizeof($this->content); + } + + public function update_rule($index, $content) + { + // TODO: check this->supported + if ($this->content[$index]) { + $this->content[$index] = $content; + return $index; + } + return false; + } + + /** + * Returns script as text + */ + public function as_text() + { + $script = ''; + $exts = array(); + $idx = 0; + + // rules + foreach ($this->content as $rule) { + $extension = ''; + $tests = array(); + $i = 0; + + // header + $script .= '# rule:[' . $rule['name'] . "]\n"; + + // constraints expressions + foreach ($rule['tests'] as $test) { + $tests[$i] = ''; + switch ($test['test']) { + case 'size': + $tests[$i] .= ($test['not'] ? 'not ' : ''); + $tests[$i] .= 'size :' . ($test['type']=='under' ? 'under ' : 'over ') . $test['arg']; + break; + case 'true': + $tests[$i] .= ($test['not'] ? 'false' : 'true'); + break; + case 'exists': + $tests[$i] .= ($test['not'] ? 'not ' : ''); + $tests[$i] .= 'exists ' . self::escape_string($test['arg']); + break; + case 'header': + $tests[$i] .= ($test['not'] ? 'not ' : ''); + + // relational operator + comparator + if (preg_match('/^(value|count)-([gteqnl]{2})/', $test['type'], $m)) { + array_push($exts, 'relational'); + array_push($exts, 'comparator-i;ascii-numeric'); + + $tests[$i] .= 'header :' . $m[1] . ' "' . $m[2] . '" :comparator "i;ascii-numeric"'; + } + else { + if ($test['type'] == 'regex') { + array_push($exts, 'regex'); + } + + $tests[$i] .= 'header :' . $test['type']; + } + + $tests[$i] .= ' ' . self::escape_string($test['arg1']); + $tests[$i] .= ' ' . self::escape_string($test['arg2']); + break; + } + $i++; + } + + // disabled rule: if false #.... + $script .= 'if ' . ($rule['disabled'] ? 'false # ' : ''); + + if (empty($tests)) { + $tests_str = 'true'; + } + else if (count($tests) > 1) { + $tests_str = implode(', ', $tests); + } + else { + $tests_str = $tests[0]; + } + + if ($rule['join'] || count($tests) > 1) { + $script .= sprintf('%s (%s)', $rule['join'] ? 'allof' : 'anyof', $tests_str); + } + else { + $script .= $tests_str; + } + $script .= "\n{\n"; + + // action(s) + foreach ($rule['actions'] as $action) { + switch ($action['type']) { + + case 'fileinto': + array_push($exts, 'fileinto'); + $script .= "\tfileinto "; + if ($action['copy']) { + $script .= ':copy '; + array_push($exts, 'copy'); + } + $script .= self::escape_string($action['target']) . ";\n"; + break; + + case 'redirect': + $script .= "\tredirect "; + if ($action['copy']) { + $script .= ':copy '; + array_push($exts, 'copy'); + } + $script .= self::escape_string($action['target']) . ";\n"; + break; + + case 'reject': + case 'ereject': + array_push($exts, $action['type']); + $script .= "\t".$action['type']." " + . self::escape_string($action['target']) . ";\n"; + break; + + case 'addflag': + case 'setflag': + case 'removeflag': + if (is_array($this->capabilities) && in_array('imap4flags', $this->capabilities)) + array_push($exts, 'imap4flags'); + else + array_push($exts, 'imapflags'); + + $script .= "\t".$action['type']." " + . self::escape_string($action['target']) . ";\n"; + break; + + case 'keep': + case 'discard': + case 'stop': + $script .= "\t" . $action['type'] .";\n"; + break; + + case 'vacation': + array_push($exts, 'vacation'); + $script .= "\tvacation"; + if (!empty($action['days'])) + $script .= " :days " . $action['days']; + if (!empty($action['addresses'])) + $script .= " :addresses " . self::escape_string($action['addresses']); + if (!empty($action['subject'])) + $script .= " :subject " . self::escape_string($action['subject']); + if (!empty($action['handle'])) + $script .= " :handle " . self::escape_string($action['handle']); + if (!empty($action['from'])) + $script .= " :from " . self::escape_string($action['from']); + if (!empty($action['mime'])) + $script .= " :mime"; + $script .= " " . self::escape_string($action['reason']) . ";\n"; + break; + } + } + + $script .= "}\n"; + $idx++; + } + + // requires + if (!empty($exts)) + $script = 'require ["' . implode('","', array_unique($exts)) . "\"];\n" . $script; + + return $script; + } + + /** + * Returns script object + * + */ + public function as_array() + { + return $this->content; + } + + /** + * Returns array of supported extensions + * + */ + public function get_extensions() + { + return array_values($this->supported); + } + + /** + * Converts text script to rules array + * + * @param string Text script + */ + private function _parse_text($script) + { + $i = 0; + $content = array(); + + // tokenize rules + if ($tokens = preg_split('/(# rule:\[.*\])\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { + foreach($tokens as $token) { + if (preg_match('/^# rule:\[(.*)\]/', $token, $matches)) { + $content[$i]['name'] = $matches[1]; + } + else if (isset($content[$i]['name']) && sizeof($content[$i]) == 1) { + if ($rule = $this->_tokenize_rule($token)) { + $content[$i] = array_merge($content[$i], $rule); + $i++; + } + else // unknown rule format + unset($content[$i]); + } + } + } + + return $content; + } + + /** + * Convert text script fragment to rule object + * + * @param string Text rule + */ + private function _tokenize_rule($content) + { + $cond = strtolower(self::tokenize($content, 1)); + + if ($cond != 'if' && $cond != 'elsif' && $cond != 'else') { + return null; + } + + $disabled = false; + $join = false; + + // disabled rule (false + comment): if false # ..... + if (preg_match('/^\s*false\s+#/i', $content)) { + $content = preg_replace('/^\s*false\s+#\s*/i', '', $content); + $disabled = true; + } + + while (strlen($content)) { + $tokens = self::tokenize($content, true); + $separator = array_pop($tokens); + + if (!empty($tokens)) { + $token = array_shift($tokens); + } + else { + $token = $separator; + } + + $token = strtolower($token); + + if ($token == 'not') { + $not = true; + $token = strtolower(array_shift($tokens)); + } + else { + $not = false; + } + + switch ($token) { + case 'allof': + $join = true; + break; + case 'anyof': + break; + + case 'size': + $size = array('test' => 'size', 'not' => $not); + for ($i=0, $len=count($tokens); $i<$len; $i++) { + if (!is_array($tokens[$i]) + && preg_match('/^:(under|over)$/i', $tokens[$i]) + ) { + $size['type'] = strtolower(substr($tokens[$i], 1)); + } + else { + $size['arg'] = $tokens[$i]; + } + } + + $tests[] = $size; + break; + + case 'header': + $header = array('test' => 'header', 'not' => $not, 'arg1' => '', 'arg2' => ''); + for ($i=0, $len=count($tokens); $i<$len; $i++) { + if (!is_array($tokens[$i]) && preg_match('/^:comparator$/i', $tokens[$i])) { + $i++; + } + else if (!is_array($tokens[$i]) && preg_match('/^:(count|value)$/i', $tokens[$i])) { + $header['type'] = strtolower(substr($tokens[$i], 1)) . '-' . $tokens[++$i]; + } + else if (!is_array($tokens[$i]) && preg_match('/^:(is|contains|matches|regex)$/i', $tokens[$i])) { + $header['type'] = strtolower(substr($tokens[$i], 1)); + } + else { + $header['arg1'] = $header['arg2']; + $header['arg2'] = $tokens[$i]; + } + } + + $tests[] = $header; + break; + + case 'exists': + $tests[] = array('test' => 'exists', 'not' => $not, + 'arg' => array_pop($tokens)); + break; + + case 'true': + $tests[] = array('test' => 'true', 'not' => $not); + break; + + case 'false': + $tests[] = array('test' => 'true', 'not' => !$not); + break; + } + + // goto actions... + if ($separator == '{') { + break; + } + } + + // ...and actions block + if ($tests) { + $actions = $this->_parse_actions($content); + } + + if ($tests && $actions) { + $result = array( + 'type' => $cond, + 'tests' => $tests, + 'actions' => $actions, + 'join' => $join, + 'disabled' => $disabled, + ); + } + + return $result; + } + + /** + * Parse body of actions section + * + * @param string Text body + * @return array Array of parsed action type/target pairs + */ + private function _parse_actions($content) + { + $result = null; + + while (strlen($content)) { + $tokens = self::tokenize($content, true); + $separator = array_pop($tokens); + + if (!empty($tokens)) { + $token = array_shift($tokens); + } + else { + $token = $separator; + } + + switch ($token) { + case 'discard': + case 'keep': + case 'stop': + $result[] = array('type' => $token); + break; + + case 'fileinto': + case 'redirect': + $copy = false; + $target = ''; + + for ($i=0, $len=count($tokens); $i<$len; $i++) { + if (strtolower($tokens[$i]) == ':copy') { + $copy = true; + } + else { + $target = $tokens[$i]; + } + } + + $result[] = array('type' => $token, 'copy' => $copy, + 'target' => $target); + break; + + case 'reject': + case 'ereject': + $result[] = array('type' => $token, 'target' => array_pop($tokens)); + break; + + case 'vacation': + $vacation = array('type' => 'vacation', 'reason' => array_pop($tokens)); + + for ($i=0, $len=count($tokens); $i<$len; $i++) { + $tok = strtolower($tokens[$i]); + if ($tok == ':days') { + $vacation['days'] = $tokens[++$i]; + } + else if ($tok == ':subject') { + $vacation['subject'] = $tokens[++$i]; + } + else if ($tok == ':addresses') { + $vacation['addresses'] = $tokens[++$i]; + } + else if ($tok == ':handle') { + $vacation['handle'] = $tokens[++$i]; + } + else if ($tok == ':from') { + $vacation['from'] = $tokens[++$i]; + } + else if ($tok == ':mime') { + $vacation['mime'] = true; + } + } + + $result[] = $vacation; + break; + + case 'setflag': + case 'addflag': + case 'removeflag': + $result[] = array('type' => $token, + // Flags list: last token (skip optional variable) + 'target' => $tokens[count($tokens)-1] + ); + break; + } + } + + return $result; + } + + /** + * Escape special chars into quoted string value or multi-line string + * or list of strings + * + * @param string $str Text or array (list) of strings + * + * @return string Result text + */ + static function escape_string($str) + { + if (is_array($str) && count($str) > 1) { + foreach($str as $idx => $val) + $str[$idx] = self::escape_string($val); + + return '[' . implode(',', $str) . ']'; + } + else if (is_array($str)) { + $str = array_pop($str); + } + + // multi-line string + if (preg_match('/[\r\n\0]/', $str) || strlen($str) > 1024) { + return sprintf("text:\n%s\n.\n", self::escape_multiline_string($str)); + } + // quoted-string + else { + return '"' . addcslashes($str, '\\"') . '"'; + } + } + + /** + * Escape special chars in multi-line string value + * + * @param string $str Text + * + * @return string Text + */ + static function escape_multiline_string($str) + { + $str = preg_split('/(\r?\n)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE); + + foreach ($str as $idx => $line) { + // dot-stuffing + if (isset($line[0]) && $line[0] == '.') { + $str[$idx] = '.' . $line; + } + } + + return implode($str); + } + + /** + * Splits script into string tokens + * + * @param string &$str The script + * @param mixed $num Number of tokens to return, 0 for all + * or True for all tokens until separator is found. + * Separator will be returned as last token. + * @param int $in_list Enable to called recursively inside a list + * + * @return mixed Tokens array or string if $num=1 + */ + static function tokenize(&$str, $num=0, $in_list=false) + { + $result = array(); + + // remove spaces from the beginning of the string + while (($str = ltrim($str)) !== '' + && (!$num || $num === true || count($result) < $num) + ) { + switch ($str[0]) { + + // Quoted string + case '"': + $len = strlen($str); + + for ($pos=1; $pos<$len; $pos++) { + if ($str[$pos] == '"') { + break; + } + if ($str[$pos] == "\\") { + if ($str[$pos + 1] == '"' || $str[$pos + 1] == "\\") { + $pos++; + } + } + } + if ($str[$pos] != '"') { + // error + } + // we need to strip slashes for a quoted string + $result[] = stripslashes(substr($str, 1, $pos - 1)); + $str = substr($str, $pos + 1); + break; + + // Parenthesized list + case '[': + $str = substr($str, 1); + $result[] = self::tokenize($str, 0, true); + break; + case ']': + $str = substr($str, 1); + return $result; + break; + + // list/test separator + case ',': + // command separator + case ';': + // block/tests-list + case '(': + case ')': + case '{': + case '}': + $sep = $str[0]; + $str = substr($str, 1); + if ($num === true) { + $result[] = $sep; + break 2; + } + break; + + // bracket-comment + case '/': + if ($str[1] == '*') { + if ($end_pos = strpos($str, '*/')) { + $str = substr($str, $end_pos + 2); + } + else { + // error + $str = ''; + } + } + break; + + // hash-comment + case '#': + if ($lf_pos = strpos($str, "\n")) { + $str = substr($str, $lf_pos); + break; + } + else { + $str = ''; + } + + // String atom + default: + // empty or one character + if ($str === '') { + break 2; + } + if (strlen($str) < 2) { + $result[] = $str; + $str = ''; + break; + } + + // tag/identifier/number + if (preg_match('/^([a-z0-9:_]+)/i', $str, $m)) { + $str = substr($str, strlen($m[1])); + + if ($m[1] != 'text:') { + $result[] = $m[1]; + } + // multiline string + else { + // possible hash-comment after "text:" + if (preg_match('/^( |\t)*(#[^\n]+)?\n/', $str, $m)) { + $str = substr($str, strlen($m[0])); + } + // get text until alone dot in a line + if (preg_match('/^(.*)\r?\n\.\r?\n/sU', $str, $m)) { + $text = $m[1]; + // remove dot-stuffing + $text = str_replace("\n..", "\n.", $text); + $str = substr($str, strlen($m[0])); + } + else { + $text = ''; + } + + $result[] = $text; + } + } + + break; + } + } + + return $num === 1 ? (isset($result[0]) ? $result[0] : null) : $result; + } + +} diff --git a/plugins/managesieve/localization/en_US.inc b/plugins/managesieve/localization/en_US.inc index 1bfc88d..f08357e 100644 --- a/plugins/managesieve/localization/en_US.inc +++ b/plugins/managesieve/localization/en_US.inc @@ -17,6 +17,10 @@ $labels['filteris'] = 'is equal to'; $labels['filterisnot'] = 'is not equal to'; $labels['filterexists'] = 'exists'; $labels['filternotexists'] = 'not exists'; +$labels['filtermatches'] = 'matches expression'; +$labels['filternotmatches'] = 'not matches expression'; +$labels['filterregex'] = 'matches regular expression'; +$labels['filternotregex'] = 'not matches regular expression'; $labels['filterunder'] = 'under'; $labels['filterover'] = 'over'; $labels['addrule'] = 'Add rule'; @@ -37,6 +41,7 @@ $labels['recipient'] = 'Recipient'; $labels['vacationaddresses'] = 'Additional list of recipient e-mails (comma separated):'; $labels['vacationdays'] = 'How often send messages (in days):'; $labels['vacationreason'] = 'Message body (vacation reason):'; +$labels['vacationsubject'] = 'Message subject:'; $labels['rulestop'] = 'Stop evaluating rules'; $labels['filterset'] = 'Filters set'; $labels['filtersetadd'] = 'Add filters set'; @@ -64,6 +69,14 @@ $labels['valueislessthan'] = 'value is less than'; $labels['valueislessthanequal'] = 'value is less than or equal to'; $labels['valueequals'] = 'value is equal to'; $labels['valuenotequals'] = 'value does not equal'; +$labels['setflags'] = 'Set flags to the message'; +$labels['addflags'] = 'Add flags to the message'; +$labels['removeflags'] = 'Remove flags from the message'; +$labels['flagread'] = 'Read'; +$labels['flagdeleted'] = 'Deleted'; +$labels['flaganswered'] = 'Answered'; +$labels['flagflagged'] = 'Flagged'; +$labels['flagdraft'] = 'Draft'; $messages = array(); $messages['filterunknownerror'] = 'Unknown server error'; diff --git a/plugins/managesieve/localization/fr_FR.inc b/plugins/managesieve/localization/fr_FR.inc index 49bd3c6..a2a83c2 100644 --- a/plugins/managesieve/localization/fr_FR.inc +++ b/plugins/managesieve/localization/fr_FR.inc @@ -27,8 +27,6 @@ $labels['messagereply'] = 'Répondre avec le message'; $labels['messagedelete'] = 'Supprimer le message'; $labels['messagediscard'] = 'Rejeter avec le message'; $labels['messagecopyto'] = 'Copier le message vers'; -$labels['messagesendcopy'] = 'Envoyer une copie du message à'; -$labels['messagecopyto'] = 'Copier le message vers'; $labels['messagesendcopy'] = 'Envoyer une copie du message à'; $labels['messagesrules'] = 'Pour les mails entrants:'; $labels['messagesactions'] = '...exécuter les actions suivantes:'; @@ -40,6 +38,14 @@ $labels['vacationaddresses'] = 'Liste des destinataires (séparés par une virgu $labels['vacationdays'] = 'Ne pas renvoyer un message avant (jours) :'; $labels['vacationreason'] = 'Corps du message (raison de l\'absence) :'; $labels['rulestop'] = 'Arrêter d\'évaluer les prochaines règles'; +$labels['setflags'] = 'Mettre les flags au message'; +$labels['addflags'] = 'Ajouter les flags au message'; +$labels['removeflags'] = 'Supprimer les flags du message'; +$labels['flagread'] = 'Lu'; +$labels['flagdeleted'] = 'Suprimé'; +$labels['flaganswered'] = 'répondu'; +$labels['flagflagged'] = 'Favori'; +$labels['flagdraft'] = 'Brouillon'; $messages = array(); $messages['filterunknownerror'] = 'Erreur du serveur inconnue'; diff --git a/plugins/managesieve/localization/gl_ES.inc b/plugins/managesieve/localization/gl_ES.inc new file mode 100644 index 0000000..a03d9de --- /dev/null +++ b/plugins/managesieve/localization/gl_ES.inc @@ -0,0 +1,81 @@ + diff --git a/plugins/managesieve/localization/hr_HR.inc b/plugins/managesieve/localization/hr_HR.inc new file mode 100644 index 0000000..3b8eb50 --- /dev/null +++ b/plugins/managesieve/localization/hr_HR.inc @@ -0,0 +1,105 @@ + diff --git a/plugins/managesieve/localization/pl_PL.inc b/plugins/managesieve/localization/pl_PL.inc index 1fbe65d..290dd1a 100644 --- a/plugins/managesieve/localization/pl_PL.inc +++ b/plugins/managesieve/localization/pl_PL.inc @@ -9,8 +9,8 @@ $labels['filteradd'] = 'Dodaj filtr'; $labels['filterdel'] = 'Usuń filtr'; $labels['moveup'] = 'Przenieś wyżej'; $labels['movedown'] = 'Przenieś niżej'; -$labels['filterallof'] = 'spełniające wszystkie poniższe kryteria'; -$labels['filteranyof'] = 'spełniające dowolne z poniższych kryteriów'; +$labels['filterallof'] = 'spełniających wszystkie poniższe kryteria'; +$labels['filteranyof'] = 'spełniających dowolne z poniższych kryteriów'; $labels['filterany'] = 'wszystkich'; $labels['filtercontains'] = 'zawiera'; $labels['filternotcontains'] = 'nie zawiera'; @@ -18,6 +18,10 @@ $labels['filteris'] = 'jest równe'; $labels['filterisnot'] = 'nie jest równe'; $labels['filterexists'] = 'istnieje'; $labels['filternotexists'] = 'nie istnieje'; +$labels['filtermatches'] = 'pasuje do wyrażenia'; +$labels['filternotmatches'] = 'nie pasuje do wyrażenia'; +$labels['filterregex'] = 'pasuje do wyrażenia regularnego'; +$labels['filternotregex'] = 'nie pasuje do wyrażenia regularnego'; $labels['filterunder'] = 'poniżej'; $labels['filterover'] = 'ponad'; $labels['addrule'] = 'Dodaj regułę'; @@ -39,6 +43,7 @@ $labels['rulestop'] = 'Przerwij przetwarzanie reguł'; $labels['vacationdays'] = 'Częstotliwość wysyłania wiadomości (w dniach):'; $labels['vacationaddresses'] = 'Lista dodatkowych adresów odbiorców (oddzielonych przecinkami):'; $labels['vacationreason'] = 'Treść (przyczyna nieobecności):'; +$labels['vacationsubject'] = 'Temat wiadomości:'; $labels['filterset'] = 'Zbiór filtrów'; $labels['filtersetadd'] = 'Dodaj zbiór filtrów'; $labels['filtersetdel'] = 'Usuń bieżący zbiór filtrów'; @@ -65,6 +70,14 @@ $labels['valueislessthan'] = 'wartość jest mniejsza od'; $labels['valueislessthanequal'] = 'wartość jest równa lub mniejsza od'; $labels['valueequals'] = 'wartość jest równa'; $labels['valuenotequals'] = 'wartość jest różna od'; +$labels['setflags'] = 'Ustaw flagi wiadomości'; +$labels['addflags'] = 'Dodaj flagi do wiadomości'; +$labels['removeflags'] = 'Usuń flagi wiadomości'; +$labels['flagread'] = 'Przeczytana'; +$labels['flagdeleted'] = 'Usunięta'; +$labels['flaganswered'] = 'Z odpowiedzią'; +$labels['flagflagged'] = 'Oflagowana'; +$labels['flagdraft'] = 'Szkic'; $messages = array(); $messages['filterunknownerror'] = 'Nieznany błąd serwera'; diff --git a/plugins/managesieve/localization/pt_PT.inc b/plugins/managesieve/localization/pt_PT.inc index d35a963..592916f 100644 --- a/plugins/managesieve/localization/pt_PT.inc +++ b/plugins/managesieve/localization/pt_PT.inc @@ -1,80 +1,185 @@
      Por exemplo: Se o João lhe enviar e-mails na segunda-feira e o período está definido para 7 dias, o João irá receber uma mensagem de Fora do Escritório na segunda-feira, mas não irá receber mais nenhuma até à segunda-feira seguinte, não importa quantos e-mails ele lhe envie durante a semana.'; +$messages['vachandleexp'] = 'Um identificador pode ser usado para ligar as diferentes mensagens de Fora do Escritório em conjunto, uma vez que uma mensagem foi enviada outra mensagem com o mesmo identificador será reenviado no mesmo período.'; +$messages['vactoexp'] = 'Lista de endereços de destinatários adicionais que estão incluídos na resposta automática. Se um destinatário de e-mail não é o seu endereço principal e não está nesta lista, nenhuma mensagem será enviada.'; +$messages['vactoexp_adv'] = 'Separar múltiplos endereços com virgula (,). Exemplo: test1@example.com,test2@example.com,test3@example.com'; +$messages['vactoexp_err'] = 'Erro: Múltiplos endereços devem ser separados por virgula (,).'; +$messages['norulename'] = 'Por favor, indique um nome para este filtro'; +$messages['ruleexists'] = 'Já existe um filtro com este nome. Por favor, indique outro'; +$messages['noheader'] = 'Por favor, indique o nome do cabeçalho para testar'; +$messages['headerbadchars'] = 'Erro: O cabeçalho contém caracteres proibidos'; +$messages['noheadervalue'] = 'Por favor indique um valor para testar o cabeçalho contra'; +$messages['sizewrongformat'] = 'Erro: O tamanho da mensagem deve ser numérico'; +$messages['noredirect'] = 'Indique um endereço de e-mail para redirecionar as mensagens'; +$messages['redirectaddresserror'] = 'Erro: O endereço de e-mail parece ser inválido'; +$messages['noreject'] = 'Indique uma mensagem para enviar juntamente com o e-mail rejeitado'; +$messages['vacnodays'] = 'Por favor insira um número de dias para o período em que a mensagem não será reenviado para a mesma pessoa'; +$messages['vacdayswrongformat'] = 'Erro: O período deve ser um número maior ou igual a 1'; +$messages['vacnomsg'] = 'Insira o texto para a sua mensagem'; +$messages['notifynomethod'] = 'Por favor, indique um método pelo qual a notificação deve ser enviada'; +$messages['notifynomsg'] = 'Insira o texto para a sua mensagem'; +$messages['sieveruleexp'] = 'Por favor, defina uma ou mais regras sobre as quais cada mensagem será testada. Os filtros são executados na ordem em que aparecem à esquerda do ecrã, se for encontrada uma correspondência mais nenhum filtro será testado.'; +$messages['sieveruleexp_stop'] = 'Por favor, defina uma ou mais regras sobre as quais cada mensagem será testada. Os filtros são executados na ordem em que aparecem à esquerda do ecrã até uma acção de \'Stop\' ser encontrada.'; +$messages['sieveactexp'] = 'Por favor, seleccione uma das opções abaixo. Essas acções serão realizadas para qualquer mensagem correspondente à(s) regra(s) acima.'; +$messages['sieveheadershlp'] = 'Abaixo estão alguns exemplos de outros cabeçalhos que podem ser testados pelos filtros. Selecione um cabeçalho para adicioná-lo à regra, ou introduza um personalizado na caixa acima.'; +$messages['movingfilter'] = 'A mover filtro...'; +$messages['noexistingfilters'] = 'Não foi detectado nenhum filtro existente!'; +$messages['importdefault'] = 'Usar filtros predefinidos: Há um conjunto de filtros predefinidos disponíveis. Gostaria de usar esses filtros?'; +$messages['importother'] = 'Importação de filtros:Foi encontrado outro conjunto de filtros de %s. Gostaria de importar esses filtros para o seu conjunto actual?'; +$messages['switchtoadveditor'] = 'Mudando para o editor avançado permite editar o ficheiro Sieve directamente. Quaisquer alterações aqui efectuadas podem ser ilegíveis no editor normal e podem ser perdidas quando os filtros são guardados usando o editor normal. Deseja continuar?'; +$messages['filterimported'] = 'Filtro importado com sucesso'; +$messages['filterimporterror'] = 'Não foi possível importar o filtro. Ocorreu um erro no servidor.'; +$messages['notifyinvalidmethod'] = 'O método parece não estar escrito num formato válido, ele deve ser um URL. Por exemplo: "mailto: alert@example.com».'; +$messages['nobodycontentpart'] = 'Por favor, indique uma parte de conteúdo para testar'; +$messages['badoperator'] = 'O operador seleccionado não pode ser usado nesta regra'; +$messages['filteractionerror'] = 'A acção solicitada não é suportada pelo servidor'; +$messages['filtermissingerror'] = 'Não foi possível encontrar a regra solicitada'; +$messages['contentpartexp'] = 'O tipo de MIME ou parte específica da mensagem que deve ser testado. Por exemplo: `text/html`, `audio/mp3` or `image`.'; +$messages['delrulesetconf'] = 'Tem certeza que quer eliminar este conjunto de regras?'; +$messages['rulesetexists'] = 'Um conjunto de regras com este nome já existe. Por favor, indique outro nome'; +$messages['copyexisting'] = 'Copiar conjunto de regras existente:Gostaria de copiar os filtros de um conjunto de de regras existente para o seu conjunto actual?'; +$messages['filtercopied'] = 'Filtro copiado com sucesso'; +$messages['nosieverulesets'] = 'Nenhum conjunto de regras encontrado.'; +$messages['baddateformat'] = 'Erro: Indique a data no formato AAAA-MM-DD'; +$messages['badtimeformat'] = 'Erro: Indique a hora no formato HH:MM:SS'; ?> \ No newline at end of file diff --git a/plugins/managesieve/localization/ru_RU.inc b/plugins/managesieve/localization/ru_RU.inc index c9cd336..68aa411 100644 --- a/plugins/managesieve/localization/ru_RU.inc +++ b/plugins/managesieve/localization/ru_RU.inc @@ -5,15 +5,15 @@ | plugins/managesieve/localization/ru_RU.inc | | | | Russian translation for roundcube/managesieve plugin | -| Copyright (C) 2008-2010 | +| Copyright (C) 2008-2011 | | Licensed under the GNU GPL | | | +-----------------------------------------------------------------------+ -| Author: | +| Author: Sergey Dukachev | | Updates: Sergey Dukachev | +-----------------------------------------------------------------------+ -@version 2010-10-11 +@version 2011-05-11 */ @@ -76,23 +76,19 @@ $labels['countislessthanequal'] = 'количество меньше или ра $labels['countequals'] = 'количество равно'; $labels['countnotequals'] = 'количество не равно'; $labels['valueisgreaterthan'] = 'значение больше, чем'; -$labels['countisgreaterthan'] = 'кПлОчествП бПльше, чеЌ'; -$labels['countisgreaterthanequal'] = 'кПлОчествП бПльше ОлО равМП'; -$labels['countislessthan'] = 'кПлОчествП ЌеМьше, чеЌ'; -$labels['countislessthanequal'] = 'кПлОчествП ЌеМьше ОлО равМП'; -$labels['countequals'] = 'кПлОчествП равМП'; -$labels['countnotequals'] = 'кПлОчествП Ме равМП'; -$labels['valueisgreaterthan'] = 'зМачеМОе бПльше, чеЌ'; -$labels['valueisgreaterthanequal'] = 'зМачеМОе бПльше ОлО равМП'; -$labels['valueislessthan'] = 'зМачеМОе ЌеМьше, чеЌ'; -$labels['valueislessthanequal'] = 'зМачеМОе ЌеМьше ОлО равМП'; -$labels['valueequals'] = 'зМачеМОе равМП'; -$labels['valuenotequals'] = 'зМачеМОе Ме равМП'; $labels['valueisgreaterthanequal'] = 'значение больше или равно'; $labels['valueislessthan'] = 'значение меньше, чем'; $labels['valueislessthanequal'] = 'значение меньше или равно'; $labels['valueequals'] = 'значение равно'; $labels['valuenotequals'] = 'значение не равно'; +$labels['setflags'] = 'Установить флаг на сообщение'; +$labels['addflags'] = 'Добавить флаг к сообщению'; +$labels['removeflags'] = 'Убрать флаги из сообщения'; +$labels['flagread'] = 'Прочитано'; +$labels['flagdeleted'] = 'Удалено'; +$labels['flaganswered'] = 'Отвечено'; +$labels['flagflagged'] = 'Помечено'; +$labels['flagdraft'] = 'Черновик'; $messages = array(); $messages['filterunknownerror'] = 'Неизвестная ошибка сервера'; diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index 04977eb..ec6247a 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -97,7 +97,7 @@ rcube_webmail.prototype.managesieve_rowid = function(id) for (i=0; i + * @version 4.3 + * @author Aleksander Machniak * * Configuration (see config.inc.php.dist) * - * $Id: managesieve.php 4555 2011-02-16 10:48:11Z alec $ + * Copyright (C) 2008-2011, The Roundcube Dev Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: managesieve.php 4983 2011-07-28 07:31:16Z alec $ */ class managesieve extends rcube_plugin @@ -60,8 +75,10 @@ class managesieve extends rcube_plugin 'filtersetform' => array($this, 'filterset_form'), )); - require_once($this->home . '/lib/Net/Sieve.php'); - require_once($this->home . '/lib/rcube_sieve.php'); + // Add include path for internal classes + $include_path = $this->home . '/lib' . PATH_SEPARATOR; + $include_path .= ini_get('include_path'); + set_include_path($include_path); $host = rcube_parse_host($this->rc->config->get('managesieve_host', 'localhost')); $port = $this->rc->config->get('managesieve_port', 2000); @@ -360,6 +377,8 @@ class managesieve extends rcube_plugin $reasons = $_POST['_action_reason']; $addresses = $_POST['_action_addresses']; $days = $_POST['_action_days']; + $subject = $_POST['_action_subject']; + $flags = $_POST['_action_flags']; // we need a "hack" for radiobuttons foreach ($sizeitems as $item) @@ -373,12 +392,13 @@ class managesieve extends rcube_plugin if ($name == '') $this->errors['name'] = $this->gettext('cannotbeempty'); - else + else { foreach($this->script as $idx => $rule) if($rule['name'] == $name && $idx != $fid) { $this->errors['name'] = $this->gettext('ruleexist'); break; } + } $i = 0; // rules @@ -481,15 +501,17 @@ class managesieve extends rcube_plugin $target = $this->strip_value($act_targets[$idx]); switch ($type) { + case 'fileinto': case 'fileinto_copy': $mailbox = $this->strip_value($mailboxes[$idx]); - $this->form['actions'][$i]['target'] = $mailbox; + $this->form['actions'][$i]['target'] = $this->mod_mailbox($mailbox, 'in'); if ($type == 'fileinto_copy') { $type = 'fileinto'; $this->form['actions'][$i]['copy'] = true; } break; + case 'reject': case 'ereject': $target = $this->strip_value($area_targets[$idx]); @@ -498,6 +520,7 @@ class managesieve extends rcube_plugin // if ($target == '') // $this->errors['actions'][$i]['targetarea'] = $this->gettext('cannotbeempty'); break; + case 'redirect': case 'redirect_copy': $this->form['actions'][$i]['target'] = $target; @@ -512,12 +535,29 @@ class managesieve extends rcube_plugin $this->form['actions'][$i]['copy'] = true; } break; + + case 'addflag': + case 'setflag': + case 'removeflag': + $_target = array(); + if (empty($flags[$idx])) { + $this->errors['actions'][$i]['target'] = $this->gettext('noflagset'); + } + else { + foreach ($flags[$idx] as $flag) { + $_target[] = $this->strip_value($flag); + } + } + $this->form['actions'][$i]['target'] = $_target; + break; + case 'vacation': $reason = $this->strip_value($reasons[$idx]); $this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason); $this->form['actions'][$i]['days'] = $days[$idx]; + $this->form['actions'][$i]['subject'] = $subject[$idx]; $this->form['actions'][$i]['addresses'] = explode(',', $addresses[$idx]); -// @TODO: vacation :subject, :mime, :from, :handle +// @TODO: vacation :mime, :from, :handle if ($this->form['actions'][$i]['addresses']) { foreach($this->form['actions'][$i]['addresses'] as $aidx => $address) { @@ -848,7 +888,7 @@ class managesieve extends rcube_plugin // headers select $select_header = new html_select(array('name' => "_header[]", 'id' => 'header'.$id, - 'onchange' => 'header_select(' .$id .')')); + 'onchange' => 'rule_header_select(' .$id .')')); foreach($this->headers as $name => $val) $select_header->add(Q($this->gettext($name)), Q($val)); $select_header->add(Q($this->gettext('size')), 'size'); @@ -893,8 +933,12 @@ class managesieve extends rcube_plugin $select_op->add(Q($this->gettext('filterisnot')), 'notis'); $select_op->add(Q($this->gettext('filterexists')), 'exists'); $select_op->add(Q($this->gettext('filternotexists')), 'notexists'); -// $select_op->add(Q($this->gettext('filtermatches')), 'matches'); -// $select_op->add(Q($this->gettext('filternotmatches')), 'notmatches'); + $select_op->add(Q($this->gettext('filtermatches')), 'matches'); + $select_op->add(Q($this->gettext('filternotmatches')), 'notmatches'); + if (in_array('regex', $this->exts)) { + $select_op->add(Q($this->gettext('filterregex')), 'regex'); + $select_op->add(Q($this->gettext('filternotregex')), 'notregex'); + } if (in_array('relational', $this->exts)) { $select_op->add(Q($this->gettext('countisgreaterthan')), 'count-gt'); $select_op->add(Q($this->gettext('countisgreaterthanequal')), 'count-ge'); @@ -991,6 +1035,11 @@ class managesieve extends rcube_plugin if (in_array('vacation', $this->exts)) $select_action->add(Q($this->gettext('messagereply')), 'vacation'); $select_action->add(Q($this->gettext('messagedelete')), 'discard'); + if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { + $select_action->add(Q($this->gettext('setflags')), 'setflag'); + $select_action->add(Q($this->gettext('addflags')), 'addflag'); + $select_action->add(Q($this->gettext('removeflags')), 'removeflag'); + } $select_action->add(Q($this->gettext('rulestop')), 'stop'); $select_type = $action['type']; @@ -1018,11 +1067,15 @@ class managesieve extends rcube_plugin $out .= '
      '; $out .= ''. Q($this->gettext('vacationreason')) .'
      ' .'\n"; + $out .= '
      ' .Q($this->gettext('vacationsubject')) . '
      ' + .'error_class($id, 'action', 'subject', 'action_subject') .' />'; $out .= '
      ' .Q($this->gettext('vacationaddresses')) . '
      ' .'error_class($id, 'action', 'addresses', 'action_addr') .' />'; $out .= '
      ' . Q($this->gettext('vacationdays')) . '
      ' .'error_class($id, 'action', 'days', 'action_days') .' />'; $out .= '
      '; - // mailbox select - $out .= '' + . Q($this->gettext('flag'.$fidx)) .'
      '; + } + $out .= ''; + // mailbox select if ($action['type'] == 'fileinto') - $mailbox = $action['target']; + $mailbox = $this->mod_mailbox($action['target'], 'out'); else $mailbox = ''; - foreach ($a_folders as $folder) { - $utf7folder = $this->rc->imap->mod_mailbox($folder); - $names = explode($delimiter, rcube_charset_convert($folder, 'UTF7-IMAP')); - $name = $names[sizeof($names)-1]; - - if ($replace_delimiter = $this->rc->config->get('managesieve_replace_delimiter')) - $utf7folder = str_replace($delimiter, $replace_delimiter, $utf7folder); - - // convert to Sieve implementation encoding - $utf7folder = $this->mbox_encode($utf7folder, $mbox_encoding); - - if ($folder_class = rcmail_folder_classname($name)) - $foldername = $this->gettext($folder_class); - else - $foldername = $name; - - $out .= sprintf(''."\n", - htmlspecialchars($utf7folder), - ($mailbox == $utf7folder ? ' selected="selected"' : ''), - str_repeat(' ', 4 * (sizeof($names)-1)), - Q(abbreviate_string($foldername, 40 - (2 * sizeof($names)-1)))); - } - $out .= ''; + $this->rc->imap_connect(); + $select = rcmail_mailbox_select(array( + 'realnames' => false, + 'maxlength' => 100, + 'id' => 'action_mailbox' . $id, + 'name' => '_action_mailbox[]', + 'style' => 'display:'.(!isset($action) || $action['type']=='fileinto' ? 'inline' : 'none') + )); + $out .= $select->show($mailbox); $out .= ''; // add/del buttons @@ -1115,11 +1163,6 @@ class managesieve extends rcube_plugin return ''; } - private function mbox_encode($text, $encoding) - { - return rcube_charset_convert($text, 'UTF7-IMAP', $encoding); - } - private function add_tip($id, $str, $error=false) { if ($error) @@ -1137,4 +1180,32 @@ class managesieve extends rcube_plugin $this->rc->output->add_script($script, 'foot'); } + /** + * Converts mailbox name from/to UTF7-IMAP from/to internal Sieve encoding + * with delimiter replacement. + * + * @param string $mailbox Mailbox name + * @param string $mode Conversion direction ('in'|'out') + * + * @return string Mailbox name + */ + private function mod_mailbox($mailbox, $mode = 'out') + { + $delimiter = $_SESSION['imap_delimiter']; + $replace_delimiter = $this->rc->config->get('managesieve_replace_delimiter'); + $mbox_encoding = $this->rc->config->get('managesieve_mbox_encoding', 'UTF7-IMAP'); + + if ($mode == 'out') { + $mailbox = rcube_charset_convert($mailbox, $mbox_encoding, 'UTF7-IMAP'); + if ($replace_delimiter && $replace_delimiter != $delimiter) + $mailbox = str_replace($replace_delimiter, $delimiter, $mailbox); + } + else { + $mailbox = rcube_charset_convert($mailbox, 'UTF7-IMAP', $mbox_encoding); + if ($replace_delimiter && $replace_delimiter != $delimiter) + $mailbox = str_replace($delimiter, $replace_delimiter, $mailbox); + } + + return $mailbox; + } } diff --git a/plugins/managesieve/skins/default/templates/filteredit.html b/plugins/managesieve/skins/default/templates/filteredit.html index 556d996..8b19935 100644 --- a/plugins/managesieve/skins/default/templates/filteredit.html +++ b/plugins/managesieve/skins/default/templates/filteredit.html @@ -7,93 +7,6 @@ - -
      diff --git a/plugins/managesieve/tests/parser.phpt b/plugins/managesieve/tests/parser.phpt index a3b820d..d703534 100644 --- a/plugins/managesieve/tests/parser.phpt +++ b/plugins/managesieve/tests/parser.phpt @@ -3,10 +3,10 @@ Main test of script parser --SKIPIF-- --FILE-- as_text(); ?> --EXPECT-- -require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric"]; +require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric","imapflags"]; # rule:[spam] if header :contains "X-DSPAM-Result" "Spam" { @@ -101,3 +106,9 @@ if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14" { redirect "test@test.tld"; } +# rule:[imapflags] +if header :matches "Subject" "^Test$" +{ + setflag "\\Seen"; + addflag ["\\Answered","\\Deleted"]; +} diff --git a/plugins/managesieve/tests/tokenize.phpt b/plugins/managesieve/tests/tokenize.phpt index d1f68ac..f988653 100644 --- a/plugins/managesieve/tests/tokenize.phpt +++ b/plugins/managesieve/tests/tokenize.phpt @@ -3,7 +3,7 @@ Script parsing: tokenizer --SKIPIF-- --FILE-- diff --git a/plugins/markasjunk/localization/it_IT.inc b/plugins/markasjunk/localization/it_IT.inc new file mode 100644 index 0000000..cc44fae --- /dev/null +++ b/plugins/markasjunk/localization/it_IT.inc @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/plugins/new_user_dialog/new_user_dialog.php b/plugins/new_user_dialog/new_user_dialog.php index c537b9b..9d7cbcb 100644 --- a/plugins/new_user_dialog/new_user_dialog.php +++ b/plugins/new_user_dialog/new_user_dialog.php @@ -66,6 +66,20 @@ class new_user_dialog extends rcube_plugin 'disabled' => ($identities_level == 1 || $identities_level == 3) ))); + $table->add('title', $this->gettext('organization')); + $table->add(null, html::tag('input', array( + 'type' => 'text', + 'name' => '_organization', + 'value' => $identity['organization'] + ))); + + $table->add('title', $this->gettext('signature')); + $table->add(null, html::tag('textarea', array( + 'name' => '_signature', + 'rows' => '3', + ),$identity['signature'] + )); + // add overlay input box to html page $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array( @@ -82,11 +96,10 @@ class new_user_dialog extends rcube_plugin // disable keyboard events for messages list (#1486726) $rcmail->output->add_script( - "$(document).ready(function () { - rcmail.message_list.key_press = function(){}; - rcmail.message_list.key_down = function(){}; - $('input[name=_name]').focus(); - });", 'foot'); + "rcmail.message_list.key_press = function(){}; + rcmail.message_list.key_down = function(){}; + $('input[name=_name]').focus(); + ", 'docready'); $this->include_stylesheet('newuserdialog.css'); } @@ -107,6 +120,8 @@ class new_user_dialog extends rcube_plugin $save_data = array( 'name' => get_input_value('_name', RCUBE_INPUT_POST), 'email' => get_input_value('_email', RCUBE_INPUT_POST), + 'organization' => get_input_value('_organization', RCUBE_INPUT_POST), + 'signature' => get_input_value('_signature', RCUBE_INPUT_POST), ); // don't let the user alter the e-mail address if disabled by config @@ -126,4 +141,4 @@ class new_user_dialog extends rcube_plugin } -?> \ No newline at end of file +?> diff --git a/plugins/new_user_dialog/newuserdialog.css b/plugins/new_user_dialog/newuserdialog.css index c03e6fd..1c3e652 100644 --- a/plugins/new_user_dialog/newuserdialog.css +++ b/plugins/new_user_dialog/newuserdialog.css @@ -48,7 +48,8 @@ white-space: nowrap; } -#newuseroverlay table td input +#newuseroverlay table td input, +#newuseroverlay table td textarea { width: 20em; } diff --git a/plugins/new_user_identity/new_user_identity.php b/plugins/new_user_identity/new_user_identity.php index 45750fa..32c2c9d 100644 --- a/plugins/new_user_identity/new_user_identity.php +++ b/plugins/new_user_identity/new_user_identity.php @@ -6,7 +6,7 @@ * * This plugin requires that a working public_ldap directory be configured. * - * @version 1.0 + * @version 1.05 * @author Kris Steinhoff * * Example configuration: @@ -15,15 +15,21 @@ * // user's full name in their new identity. (This should be an * // string, which refers to the $rcmail_config['ldap_public'] array.) * $rcmail_config['new_user_identity_addressbook'] = 'People'; - * + * * // When automatically setting a new users's full name in their * // new identity, match the user's login name against this field. * $rcmail_config['new_user_identity_match'] = 'uid'; + * + * // Use this field (from fieldmap configuration) to fill alias col of + * // the new user record. + * $rcmail_config['new_user_identity_alias'] = 'alias'; */ class new_user_identity extends rcube_plugin { public $task = 'login'; + private $ldap; + function init() { $this->add_hook('user_create', array($this, 'lookup_user_name')); @@ -32,19 +38,52 @@ class new_user_identity extends rcube_plugin function lookup_user_name($args) { $rcmail = rcmail::get_instance(); - if ($addressbook = $rcmail->config->get('new_user_identity_addressbook')) { - $match = $rcmail->config->get('new_user_identity_match'); - $ldap = $rcmail->get_address_book($addressbook); - $ldap->prop['search_fields'] = array($match); - $results = $ldap->search($match, $args['user'], TRUE); + + if ($this->init_ldap($args['host'])) { + $results = $this->ldap->search('*', $args['user'], TRUE); if (count($results->records) == 1) { $args['user_name'] = $results->records[0]['name']; if (!$args['user_email'] && strpos($results->records[0]['email'], '@')) { $args['user_email'] = rcube_idn_to_ascii($results->records[0]['email']); } + if (($alias_col = $rcmail->config->get('new_user_identity_alias')) && $results->records[0][$alias_col]) { + $args['alias'] = $results->records[0][$alias_col]; + } } } return $args; } + + private function init_ldap($host) + { + if ($this->ldap) + return $this->ldap->ready; + + $rcmail = rcmail::get_instance(); + + $addressbook = $rcmail->config->get('new_user_identity_addressbook'); + $ldap_config = (array)$rcmail->config->get('ldap_public'); + $match = $rcmail->config->get('new_user_identity_match'); + + if (empty($addressbook) || empty($match) || empty($ldap_config[$addressbook])) { + return false; + } + + $this->ldap = new new_user_identity_ldap_backend( + $ldap_config[$addressbook], + $rcmail->config->get('ldap_debug'), + $rcmail->config->mail_domain($host), + $match); + + return $this->ldap->ready; + } +} + +class new_user_identity_ldap_backend extends rcube_ldap +{ + function __construct($p, $debug, $mail_domain, $search) + { + parent::__construct($p, $debug, $mail_domain); + $this->prop['search_fields'] = (array)$search; + } } -?> diff --git a/plugins/newmail_notifier/config.inc.php.dist b/plugins/newmail_notifier/config.inc.php.dist new file mode 100644 index 0000000..21b3d96 --- /dev/null +++ b/plugins/newmail_notifier/config.inc.php.dist @@ -0,0 +1,9 @@ + diff --git a/plugins/newmail_notifier/favicon.ico b/plugins/newmail_notifier/favicon.ico new file mode 100644 index 0000000..86e10c1 Binary files /dev/null and b/plugins/newmail_notifier/favicon.ico differ diff --git a/plugins/newmail_notifier/localization/en_US.inc b/plugins/newmail_notifier/localization/en_US.inc new file mode 100644 index 0000000..fbb5d9a --- /dev/null +++ b/plugins/newmail_notifier/localization/en_US.inc @@ -0,0 +1,6 @@ + diff --git a/plugins/newmail_notifier/localization/pl_PL.inc b/plugins/newmail_notifier/localization/pl_PL.inc new file mode 100644 index 0000000..5fe3790 --- /dev/null +++ b/plugins/newmail_notifier/localization/pl_PL.inc @@ -0,0 +1,6 @@ + diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js new file mode 100644 index 0000000..6afd66a --- /dev/null +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -0,0 +1,66 @@ +/** + * New Mail Notifier plugin script + * + * @version 0.2 + * @author Aleksander Machniak + */ + +if (window.rcmail && rcmail.env.task == 'mail') { + rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run); + rcmail.addEventListener('actionbefore', newmail_notifier_stop); + rcmail.addEventListener('init', function() { + // bind to messages list select event, so favicon will be reverted on message preview too + if (rcmail.message_list) + rcmail.message_list.addEventListener('select', newmail_notifier_stop); + }); +} + +// Executes notification methods +function newmail_notifier_run(prop) +{ + if (prop.basic) + newmail_notifier_basic(); + if (prop.sound) + newmail_notifier_sound(); +} + +// Stops notification +function newmail_notifier_stop(prop) +{ + // revert original favicon + if (rcmail.env.favicon_href && (!prop || prop.action != 'check-recent')) { + $('').replaceAll('link[rel="shortcut icon"]'); + rcmail.env.favicon_href = null; + } +} + +// Basic notification: window.focus and favicon change +function newmail_notifier_basic() +{ + window.focus(); + + // we cannot simply change a href attribute, we must to replace the link element (at least in FF) + var link = $(''), + oldlink = $('link[rel="shortcut icon"]'); + + rcmail.env.favicon_href = oldlink.attr('href'); + link.replaceAll(oldlink); +} + +// Sound notification +function newmail_notifier_sound() +{ + var elem, src = 'plugins/newmail_notifier/sound.wav'; + + // HTML5 + try { + elem = $('