From 4e17e6c9dbac8991ee8b302cb2581241247dc8bc Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 25 Sep 2005 14:18:03 +0000 Subject: Initial revision --- .htaccess | 12 + CHANGELOG | 26 + INSTALL | 32 + SQL/initial.sql | 93 + UPGRADING | 15 + config/.htaccess | 2 + config/db.inc.php | 46 + config/main.inc.php | 96 + index.php | 273 +++ logs/.htaccess | 2 + logs/errors | 0 logs/sendmail | 0 program/blank.gif | Bin 0 -> 56 bytes program/include/bugs.inc | 104 + program/include/cache.inc | 112 + program/include/main.inc | 1020 +++++++++ program/include/rcube_imap.inc | 1117 ++++++++++ program/include/rcube_mysql.inc | 186 ++ program/include/rcube_shared.inc | 1417 ++++++++++++ program/include/session.inc | 154 ++ program/js/app.js | 2388 +++++++++++++++++++++ program/js/common.js | 343 +++ program/lib/Mail/mime.php | 733 +++++++ program/lib/Mail/mimeDecode.php | 842 ++++++++ program/lib/Mail/mimePart.php | 351 +++ program/lib/PEAR.php | 927 ++++++++ program/lib/des.inc | 218 ++ program/lib/enriched.inc | 114 + program/lib/html2text.inc | 440 ++++ program/lib/icl_commons.inc | 81 + program/lib/imap.inc | 2038 ++++++++++++++++++ program/lib/mime.inc | 322 +++ program/lib/smtp.inc | 351 +++ program/lib/utf7.inc | 384 ++++ program/lib/utf8.inc | 102 + program/localization/de/labels.inc | 171 ++ program/localization/de/messages.inc | 56 + program/localization/en/labels.inc | 171 ++ program/localization/en/messages.inc | 56 + program/steps/addressbook/delete.inc | 104 + program/steps/addressbook/edit.inc | 123 ++ program/steps/addressbook/func.inc | 198 ++ program/steps/addressbook/list.inc | 59 + program/steps/addressbook/save.inc | 168 ++ program/steps/addressbook/show.inc | 81 + program/steps/error.inc | 117 + program/steps/mail/addcontact.inc | 70 + program/steps/mail/compose.inc | 545 +++++ program/steps/mail/func.inc | 1101 ++++++++++ program/steps/mail/get.inc | 159 ++ program/steps/mail/list.inc | 49 + program/steps/mail/mark.inc | 41 + program/steps/mail/move_del.inc | 82 + program/steps/mail/sendmail.inc | 251 +++ program/steps/mail/show.inc | 169 ++ program/steps/mail/upload.inc | 75 + program/steps/mail/viewsource.inc | 39 + program/steps/settings/delete_identity.inc | 55 + program/steps/settings/edit_identity.inc | 106 + program/steps/settings/func.inc | 194 ++ program/steps/settings/identities.inc | 48 + program/steps/settings/manage_folders.inc | 176 ++ program/steps/settings/save_identity.inc | 136 ++ program/steps/settings/save_prefs.inc | 59 + skins/default/addresses.css | 119 + skins/default/common.css | 277 +++ skins/default/images/blank.gif | Bin 0 -> 56 bytes skins/default/images/buttons/add_act.png | Bin 0 -> 295 bytes skins/default/images/buttons/add_contact_act.png | Bin 0 -> 1626 bytes skins/default/images/buttons/add_contact_pas.png | Bin 0 -> 1599 bytes skins/default/images/buttons/add_pas.png | Bin 0 -> 301 bytes skins/default/images/buttons/addressbook.png | Bin 0 -> 1768 bytes skins/default/images/buttons/attach_act.png | Bin 0 -> 1776 bytes skins/default/images/buttons/attach_pas.png | Bin 0 -> 1750 bytes skins/default/images/buttons/back_act.png | Bin 0 -> 1321 bytes skins/default/images/buttons/back_pas.png | Bin 0 -> 1317 bytes skins/default/images/buttons/bg.gif | Bin 0 -> 211 bytes skins/default/images/buttons/compose_act.png | Bin 0 -> 1650 bytes skins/default/images/buttons/compose_pas.png | Bin 0 -> 1617 bytes skins/default/images/buttons/contacts_act.png | Bin 0 -> 1742 bytes skins/default/images/buttons/contacts_pas.png | Bin 0 -> 1721 bytes skins/default/images/buttons/delete_act.png | Bin 0 -> 2107 bytes skins/default/images/buttons/delete_pas.png | Bin 0 -> 2070 bytes skins/default/images/buttons/download_act.png | Bin 0 -> 2133 bytes skins/default/images/buttons/download_pas.png | Bin 0 -> 2107 bytes skins/default/images/buttons/edit_contact_act.png | Bin 0 -> 2157 bytes skins/default/images/buttons/edit_contact_pas.png | Bin 0 -> 2135 bytes skins/default/images/buttons/forward_act.png | Bin 0 -> 1502 bytes skins/default/images/buttons/forward_pas.png | Bin 0 -> 1472 bytes skins/default/images/buttons/inbox_act.png | Bin 0 -> 1827 bytes skins/default/images/buttons/inbox_pas.png | Bin 0 -> 1804 bytes skins/default/images/buttons/logout.gif | Bin 0 -> 454 bytes skins/default/images/buttons/logout.png | Bin 0 -> 2036 bytes skins/default/images/buttons/mail.png | Bin 0 -> 1827 bytes skins/default/images/buttons/next_act.png | Bin 0 -> 267 bytes skins/default/images/buttons/next_pas.png | Bin 0 -> 260 bytes skins/default/images/buttons/previous_act.png | Bin 0 -> 262 bytes skins/default/images/buttons/previous_pas.png | Bin 0 -> 277 bytes skins/default/images/buttons/print_act.png | Bin 0 -> 1468 bytes skins/default/images/buttons/print_pas.png | Bin 0 -> 1464 bytes skins/default/images/buttons/reply_act.png | Bin 0 -> 1775 bytes skins/default/images/buttons/reply_pas.png | Bin 0 -> 1754 bytes skins/default/images/buttons/send_act.png | Bin 0 -> 1820 bytes skins/default/images/buttons/send_pas.png | Bin 0 -> 1836 bytes skins/default/images/buttons/settings.png | Bin 0 -> 1054 bytes skins/default/images/buttons/source_act.png | Bin 0 -> 1657 bytes skins/default/images/buttons/source_pas.png | Bin 0 -> 1632 bytes skins/default/images/buttons/spacer.gif | Bin 0 -> 43 bytes skins/default/images/display/confirm.png | Bin 0 -> 2135 bytes skins/default/images/display/info.png | Bin 0 -> 2162 bytes skins/default/images/display/loading.gif | Bin 0 -> 2964 bytes skins/default/images/display/warning.png | Bin 0 -> 1422 bytes skins/default/images/icons/abcard.png | Bin 0 -> 441 bytes skins/default/images/icons/attachment.png | Bin 0 -> 657 bytes skins/default/images/icons/dot.png | Bin 0 -> 244 bytes skins/default/images/icons/flagged.png | Bin 0 -> 514 bytes skins/default/images/icons/folder-closed.png | Bin 0 -> 662 bytes skins/default/images/icons/folder-inbox.png | Bin 0 -> 586 bytes skins/default/images/icons/folder-junk.png | Bin 0 -> 800 bytes skins/default/images/icons/folder-open.png | Bin 0 -> 796 bytes skins/default/images/icons/folder-sent.png | Bin 0 -> 629 bytes skins/default/images/icons/folder-trash.png | Bin 0 -> 775 bytes skins/default/images/icons/forwarded.png | Bin 0 -> 315 bytes skins/default/images/icons/plus.gif | Bin 0 -> 93 bytes skins/default/images/icons/replied.png | Bin 0 -> 317 bytes skins/default/images/icons/silhouette.png | Bin 0 -> 261 bytes skins/default/images/icons/unread.png | Bin 0 -> 460 bytes skins/default/images/listheader_aqua.gif | Bin 0 -> 270 bytes skins/default/images/listheader_dark.gif | Bin 0 -> 280 bytes skins/default/images/listheader_light.gif | Bin 0 -> 261 bytes skins/default/images/mailbox_list.gif | Bin 0 -> 207 bytes skins/default/images/mailbox_selected.gif | Bin 0 -> 158 bytes skins/default/images/rcube_watermark.png | Bin 0 -> 16441 bytes skins/default/images/roundcube_logo.gif | Bin 0 -> 2284 bytes skins/default/images/roundcube_logo.png | Bin 0 -> 4868 bytes skins/default/images/roundcube_logo_print.gif | Bin 0 -> 2400 bytes skins/default/images/tab_act.gif | Bin 0 -> 519 bytes skins/default/images/tab_pas.gif | Bin 0 -> 511 bytes skins/default/includes/header.html | 3 + skins/default/includes/settingscripts.html | 11 + skins/default/includes/settingstabs.html | 3 + skins/default/includes/taskbar.html | 14 + skins/default/mail.css | 647 ++++++ skins/default/pngbehavior.htc | 52 + skins/default/print.css | 111 + skins/default/settings.css | 150 ++ skins/default/templates/addcontact.html | 24 + skins/default/templates/addidentity.html | 35 + skins/default/templates/addressbook.html | 37 + skins/default/templates/compose.html | 118 + skins/default/templates/editcontact.html | 24 + skins/default/templates/editidentity.html | 37 + skins/default/templates/error.html | 16 + skins/default/templates/identities.html | 23 + skins/default/templates/login.html | 30 + skins/default/templates/mail.html | 50 + skins/default/templates/managefolders.html | 38 + skins/default/templates/message.html | 41 + skins/default/templates/messagepart.html | 22 + skins/default/templates/printmessage.html | 18 + skins/default/templates/settings.html | 28 + skins/default/templates/showcontact.html | 19 + skins/default/watermark.html | 12 + temp/.htaccess | 2 + 164 files changed, 20961 insertions(+) create mode 100644 .htaccess create mode 100644 CHANGELOG create mode 100644 INSTALL create mode 100644 SQL/initial.sql create mode 100644 UPGRADING create mode 100644 config/.htaccess create mode 100644 config/db.inc.php create mode 100644 config/main.inc.php create mode 100644 index.php create mode 100644 logs/.htaccess create mode 100644 logs/errors create mode 100644 logs/sendmail create mode 100644 program/blank.gif create mode 100644 program/include/bugs.inc create mode 100644 program/include/cache.inc create mode 100644 program/include/main.inc create mode 100644 program/include/rcube_imap.inc create mode 100644 program/include/rcube_mysql.inc create mode 100644 program/include/rcube_shared.inc create mode 100644 program/include/session.inc create mode 100644 program/js/app.js create mode 100644 program/js/common.js create mode 100644 program/lib/Mail/mime.php create mode 100644 program/lib/Mail/mimeDecode.php create mode 100644 program/lib/Mail/mimePart.php create mode 100644 program/lib/PEAR.php create mode 100644 program/lib/des.inc create mode 100644 program/lib/enriched.inc create mode 100644 program/lib/html2text.inc create mode 100644 program/lib/icl_commons.inc create mode 100644 program/lib/imap.inc create mode 100644 program/lib/mime.inc create mode 100644 program/lib/smtp.inc create mode 100644 program/lib/utf7.inc create mode 100644 program/lib/utf8.inc create mode 100644 program/localization/de/labels.inc create mode 100644 program/localization/de/messages.inc create mode 100644 program/localization/en/labels.inc create mode 100644 program/localization/en/messages.inc create mode 100644 program/steps/addressbook/delete.inc create mode 100644 program/steps/addressbook/edit.inc create mode 100644 program/steps/addressbook/func.inc create mode 100644 program/steps/addressbook/list.inc create mode 100644 program/steps/addressbook/save.inc create mode 100644 program/steps/addressbook/show.inc create mode 100644 program/steps/error.inc create mode 100644 program/steps/mail/addcontact.inc create mode 100644 program/steps/mail/compose.inc create mode 100644 program/steps/mail/func.inc create mode 100644 program/steps/mail/get.inc create mode 100644 program/steps/mail/list.inc create mode 100644 program/steps/mail/mark.inc create mode 100644 program/steps/mail/move_del.inc create mode 100644 program/steps/mail/sendmail.inc create mode 100644 program/steps/mail/show.inc create mode 100644 program/steps/mail/upload.inc create mode 100644 program/steps/mail/viewsource.inc create mode 100644 program/steps/settings/delete_identity.inc create mode 100644 program/steps/settings/edit_identity.inc create mode 100644 program/steps/settings/func.inc create mode 100644 program/steps/settings/identities.inc create mode 100644 program/steps/settings/manage_folders.inc create mode 100644 program/steps/settings/save_identity.inc create mode 100644 program/steps/settings/save_prefs.inc create mode 100644 skins/default/addresses.css create mode 100755 skins/default/common.css create mode 100644 skins/default/images/blank.gif create mode 100644 skins/default/images/buttons/add_act.png create mode 100644 skins/default/images/buttons/add_contact_act.png create mode 100644 skins/default/images/buttons/add_contact_pas.png create mode 100644 skins/default/images/buttons/add_pas.png create mode 100644 skins/default/images/buttons/addressbook.png create mode 100644 skins/default/images/buttons/attach_act.png create mode 100644 skins/default/images/buttons/attach_pas.png create mode 100644 skins/default/images/buttons/back_act.png create mode 100644 skins/default/images/buttons/back_pas.png create mode 100644 skins/default/images/buttons/bg.gif create mode 100644 skins/default/images/buttons/compose_act.png create mode 100644 skins/default/images/buttons/compose_pas.png create mode 100644 skins/default/images/buttons/contacts_act.png create mode 100644 skins/default/images/buttons/contacts_pas.png create mode 100644 skins/default/images/buttons/delete_act.png create mode 100644 skins/default/images/buttons/delete_pas.png create mode 100644 skins/default/images/buttons/download_act.png create mode 100644 skins/default/images/buttons/download_pas.png create mode 100644 skins/default/images/buttons/edit_contact_act.png create mode 100644 skins/default/images/buttons/edit_contact_pas.png create mode 100644 skins/default/images/buttons/forward_act.png create mode 100644 skins/default/images/buttons/forward_pas.png create mode 100644 skins/default/images/buttons/inbox_act.png create mode 100644 skins/default/images/buttons/inbox_pas.png create mode 100644 skins/default/images/buttons/logout.gif create mode 100644 skins/default/images/buttons/logout.png create mode 100644 skins/default/images/buttons/mail.png create mode 100644 skins/default/images/buttons/next_act.png create mode 100644 skins/default/images/buttons/next_pas.png create mode 100644 skins/default/images/buttons/previous_act.png create mode 100644 skins/default/images/buttons/previous_pas.png create mode 100644 skins/default/images/buttons/print_act.png create mode 100644 skins/default/images/buttons/print_pas.png create mode 100644 skins/default/images/buttons/reply_act.png create mode 100644 skins/default/images/buttons/reply_pas.png create mode 100644 skins/default/images/buttons/send_act.png create mode 100644 skins/default/images/buttons/send_pas.png create mode 100644 skins/default/images/buttons/settings.png create mode 100644 skins/default/images/buttons/source_act.png create mode 100644 skins/default/images/buttons/source_pas.png create mode 100644 skins/default/images/buttons/spacer.gif create mode 100644 skins/default/images/display/confirm.png create mode 100644 skins/default/images/display/info.png create mode 100755 skins/default/images/display/loading.gif create mode 100644 skins/default/images/display/warning.png create mode 100644 skins/default/images/icons/abcard.png create mode 100644 skins/default/images/icons/attachment.png create mode 100644 skins/default/images/icons/dot.png create mode 100644 skins/default/images/icons/flagged.png create mode 100644 skins/default/images/icons/folder-closed.png create mode 100644 skins/default/images/icons/folder-inbox.png create mode 100644 skins/default/images/icons/folder-junk.png create mode 100644 skins/default/images/icons/folder-open.png create mode 100644 skins/default/images/icons/folder-sent.png create mode 100644 skins/default/images/icons/folder-trash.png create mode 100644 skins/default/images/icons/forwarded.png create mode 100755 skins/default/images/icons/plus.gif create mode 100644 skins/default/images/icons/replied.png create mode 100644 skins/default/images/icons/silhouette.png create mode 100644 skins/default/images/icons/unread.png create mode 100644 skins/default/images/listheader_aqua.gif create mode 100644 skins/default/images/listheader_dark.gif create mode 100644 skins/default/images/listheader_light.gif create mode 100644 skins/default/images/mailbox_list.gif create mode 100644 skins/default/images/mailbox_selected.gif create mode 100644 skins/default/images/rcube_watermark.png create mode 100644 skins/default/images/roundcube_logo.gif create mode 100644 skins/default/images/roundcube_logo.png create mode 100644 skins/default/images/roundcube_logo_print.gif create mode 100644 skins/default/images/tab_act.gif create mode 100644 skins/default/images/tab_pas.gif create mode 100644 skins/default/includes/header.html create mode 100644 skins/default/includes/settingscripts.html create mode 100644 skins/default/includes/settingstabs.html create mode 100644 skins/default/includes/taskbar.html create mode 100644 skins/default/mail.css create mode 100644 skins/default/pngbehavior.htc create mode 100644 skins/default/print.css create mode 100644 skins/default/settings.css create mode 100644 skins/default/templates/addcontact.html create mode 100644 skins/default/templates/addidentity.html create mode 100644 skins/default/templates/addressbook.html create mode 100644 skins/default/templates/compose.html create mode 100644 skins/default/templates/editcontact.html create mode 100644 skins/default/templates/editidentity.html create mode 100644 skins/default/templates/error.html create mode 100644 skins/default/templates/identities.html create mode 100644 skins/default/templates/login.html create mode 100644 skins/default/templates/mail.html create mode 100644 skins/default/templates/managefolders.html create mode 100644 skins/default/templates/message.html create mode 100644 skins/default/templates/messagepart.html create mode 100644 skins/default/templates/printmessage.html create mode 100644 skins/default/templates/settings.html create mode 100644 skins/default/templates/showcontact.html create mode 100644 skins/default/watermark.html create mode 100644 temp/.htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 000000000..c0ab7f0ae --- /dev/null +++ b/.htaccess @@ -0,0 +1,12 @@ +php_flag display_errors On +php_value session.gc_maxlifetime 21600 +php_value session.gc_divisor 500 +php_value upload_max_filesize 2m + + + Order allow,deny + Deny from all + + +Order deny,allow +Allow from all diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 000000000..1fa699292 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,26 @@ +CHANGELOG RoundCube Webmail +--------------------------- + +2005/08/11 +---------- +- Write list header to client even if list is empty +- Add functions "select all", "select none" to message list +- Improved filter for HTML messages to remove potentially malicious tags (script, iframe, object) and event handlers. +- Buttons for next/previous message in view mode +- Add new created contact to list and show confirmation status +- Added folder management (subscribe/create/delete) +- Log message sending (SMTP log) +- Grant access for Camino browser +- Added German translation + + +2005/08/20 +---------- +- Improved cacheing of mailbox messagecount +- Fixed javascript bug when creating a new message folder +- Fixed javascript bugs #1260990 and #1260992: folder selection +- Make Trash folder configurable +- Auto create folders Inbox, Sent and Trash (if configured) +- Support for IMAP root folder +- Added support fot text/enriched messages +- Make list of special mailboxes configurable diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..5317b80d5 --- /dev/null +++ b/INSTALL @@ -0,0 +1,32 @@ + +INSTALLATION +============ + +1. Decompress and put this folder somewhere inside your document root +2. Make shure that the following directories are writable by the webserver + - /temp + - /logs +3. Modify the files in /config to suit your local environment +4. Create database tables using the queries in file 'SQL/initial.sql' + Rename tables if you like, but make shure the names are also changed in /config/db.inc +5. Done! + + +REQUIREMENTS +============ + +* The Apache Webserver +* .htaccess support allowing overrides for DirectoryIndex +* PHP Version 4.3.1 or greater +* php.ini options: + - error_reporting E_ALL & ~E_NOTICE (or lower) + - file_uploads on (for attachment upload features) +* The MySQL database engine +* A database with permission to create tables + + +CONFIGURATION +============= + +Change the files in /config/ according your environment and you needs. +Details about the config paramaters can be found in the config files. diff --git a/SQL/initial.sql b/SQL/initial.sql new file mode 100644 index 000000000..64d650867 --- /dev/null +++ b/SQL/initial.sql @@ -0,0 +1,93 @@ +-- RoundCube Webmail initial database structure +-- Version 0.1a +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `cache` +-- + +CREATE TABLE `cache` ( + `cache_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL default '0', + `session_id` varchar(32) default NULL, + `cache_key` varchar(128) NOT NULL default '', + `created` datetime NOT NULL default '0000-00-00 00:00:00', + `data` longtext NOT NULL, + PRIMARY KEY (`cache_id`), + KEY `user_id` (`user_id`), + KEY `cache_key` (`cache_key`), + KEY `session_id` (`session_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `contacts` +-- + +CREATE TABLE `contacts` ( + `contact_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL default '0', + `del` enum('0','1') NOT NULL default '0', + `name` varchar(128) NOT NULL default '', + `email` varchar(128) NOT NULL default '', + `firstname` varchar(128) NOT NULL default '', + `surname` varchar(128) NOT NULL default '', + `vcard` text NOT NULL, + PRIMARY KEY (`contact_id`), + KEY `user_id` (`user_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `identities` +-- + +CREATE TABLE `identities` ( + `identity_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL default '0', + `del` enum('0','1') NOT NULL default '0', + `default` enum('0','1') NOT NULL default '0', + `name` varchar(128) NOT NULL default '', + `organization` varchar(128) NOT NULL default '', + `email` varchar(128) NOT NULL default '', + `reply-to` varchar(128) NOT NULL default '', + `bcc` varchar(128) NOT NULL default '', + `signature` text NOT NULL, + PRIMARY KEY (`identity_id`), + KEY `user_id` (`user_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `session` +-- + +CREATE TABLE `session` ( + `sess_id` varchar(32) NOT NULL default '', + `created` datetime NOT NULL default '0000-00-00 00:00:00', + `changed` datetime NOT NULL default '0000-00-00 00:00:00', + `vars` text NOT NULL, + PRIMARY KEY (`sess_id`) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE `users` ( + `user_id` int(10) unsigned NOT NULL auto_increment, + `username` varchar(128) NOT NULL default '', + `mail_host` varchar(255) NOT NULL default '', + `created` datetime NOT NULL default '0000-00-00 00:00:00', + `last_login` datetime NOT NULL default '0000-00-00 00:00:00', + `language` varchar(5) NOT NULL default 'en', + `preferences` text NOT NULL, + PRIMARY KEY (`user_id`) +) TYPE=MyISAM; diff --git a/UPGRADING b/UPGRADING new file mode 100644 index 000000000..368f0480e --- /dev/null +++ b/UPGRADING @@ -0,0 +1,15 @@ +UPDATE instructions +=================== + +Follow these instructions if upgrading from a previous version +of RoundCube Webmail. + + + +from versions 0.1-alpha and 0.1-20050811 +---------------------------------------- +- replace all files in folder /program/ +- add these line to /config/main.inc.php + $rcmail_config['trash_mbox'] = 'Trash'; + $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); + $rcmail_config['prefer_html'] = TRUE; diff --git a/config/.htaccess b/config/.htaccess new file mode 100644 index 000000000..8e6a345dc --- /dev/null +++ b/config/.htaccess @@ -0,0 +1,2 @@ +Order allow,deny +Deny from all \ No newline at end of file diff --git a/config/db.inc.php b/config/db.inc.php new file mode 100644 index 000000000..fb6d2bb8b --- /dev/null +++ b/config/db.inc.php @@ -0,0 +1,46 @@ + diff --git a/config/main.inc.php b/config/main.inc.php new file mode 100644 index 000000000..0e580318b --- /dev/null +++ b/config/main.inc.php @@ -0,0 +1,96 @@ + diff --git a/index.php b/index.php new file mode 100644 index 000000000..19623aa30 --- /dev/null +++ b/index.php @@ -0,0 +1,273 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +// define global vars +$INSTALL_PATH = './'; +$OUTPUT_TYPE = 'html'; +$JS_OBJECT_NAME = 'rcmail'; + + +// set environment first +ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'program'.PATH_SEPARATOR.'program/lib'); +ini_set('session.name', 'sessid'); +ini_set('session.use_cookies', 1); +//ini_set('session.save_path', $INSTALL_PATH.'session'); + + +// increase maximum execution time for php scripts +set_time_limit('120'); + + +// include base files +require_once('include/rcube_shared.inc'); +require_once('include/rcube_imap.inc'); +require_once('include/rcube_mysql.inc'); +require_once('include/bugs.inc'); +require_once('include/main.inc'); +require_once('include/cache.inc'); + + +// catch some url/post parameters +$_auth = strlen($_POST['_auth']) ? $_POST['_auth'] : $_GET['_auth']; +$_task = strlen($_POST['_task']) ? $_POST['_task'] : ($_GET['_task'] ? $_GET['_task'] : 'mail'); +$_action = strlen($_POST['_action']) ? $_POST['_action'] : $_GET['_action']; +$_framed = ($_GET['_framed'] || $_POST['_framed']); + +// start session with requested task +rcmail_startup($_task); + + +// set session related variables +$COMM_PATH = sprintf('./?_auth=%s&_task=%s', $sess_auth, $_task); +$SESS_HIDDEN_FIELD = sprintf('', $sess_auth); + + +// add framed parameter +if ($_GET['_framed'] || $_POST['_framed']) + { + $COMM_PATH .= '&_framed=1'; + $SESS_HIDDEN_FIELD = "\n".''; + } + + +// init necessary objects for GUI +load_gui(); + + +// error steps +if ($_action=='error' && strlen($_GET['_code'])) + { + raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE); + } + + +// try to log in +if ($_action=='login' && $_task=='mail') + { + $host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host']; + + // check if client supports cookies + if (!$_COOKIE[session_name()]) + { + show_message("cookiesdisabled", 'warning'); + } + else if ($_POST['_user'] && $_POST['_pass'] && rcmail_login($_POST['_user'], $_POST['_pass'], $host)) + { + // send redirect + header("Location: $COMM_PATH"); + exit; + } + else + { + show_message("loginfailed", 'warning'); + $_SESSION['user_id'] = ''; + } + } + +// end session +else if ($_action=='logout' && $_SESSION['user_id']) + { + show_message('loggedout'); + rcmail_kill_session(); + } + +// check session cookie and auth string +else if ($_action!='login' && $_auth && $sess_auth) + { + if ($_auth !== $sess_auth || $_auth != rcmail_auth_hash($_SESSION['client_id'], $_SESSION['auth_time'])) + { + show_message('sessionerror', 'error'); + rcmail_kill_session(); + } + } + + +// log in to imap server +if ($_SESSION['user_id'] && $_task=='mail') + { + $conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password'])); + if (!$conn) + { + show_message('imaperror', 'error'); + $_SESSION['user_id'] = ''; + } + } + + +// not logged in -> set task to 'login +if (!$_SESSION['user_id']) + $_task = 'login'; + + + +// set taask and action to client +$script = sprintf("%s.set_env('task', '%s');", $JS_OBJECT_NAME, $_task); +if (!empty($_action)) + $script .= sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action); + +$OUTPUT->add_script($script); + + + +// not logged in -> show login page +if (!$_SESSION['user_id']) + { + parse_template('login'); + exit; + } + + + +// include task specific files +if ($_task=='mail') + { + include_once('program/steps/mail/func.inc'); + + if ($_action=='show' || $_action=='print') + include('program/steps/mail/show.inc'); + + if ($_action=='get') + include('program/steps/mail/get.inc'); + + if ($_action=='moveto' || $_action=='delete') + include('program/steps/mail/move_del.inc'); + + if ($_action=='mark') + include('program/steps/mail/mark.inc'); + + if ($_action=='viewsource') + include('program/steps/mail/viewsource.inc'); + + if ($_action=='send') + include('program/steps/mail/sendmail.inc'); + + if ($_action=='upload') + include('program/steps/mail/upload.inc'); + + if ($_action=='compose') + include('program/steps/mail/compose.inc'); + + if ($_action=='addcontact') + include('program/steps/mail/addcontact.inc'); + + if ($_action=='list' && $_GET['_remote']) + include('program/steps/mail/list.inc'); + + // kill compose entry from session + if (isset($_SESSION['compose'])) + rcmail_compose_cleanup(); + } + + +// include task specific files +if ($_task=='addressbook') + { + include_once('program/steps/addressbook/func.inc'); + + if ($_action=='save') + include('program/steps/addressbook/save.inc'); + + if ($_action=='edit' || $_action=='add') + include('program/steps/addressbook/edit.inc'); + + if ($_action=='delete') + include('program/steps/addressbook/delete.inc'); + + if ($_action=='show') + include('program/steps/addressbook/show.inc'); + + if ($_action=='list' && $_GET['_remote']) + include('program/steps/addressbook/list.inc'); + } + + +// include task specific files +if ($_task=='settings') + { + include_once('program/steps/settings/func.inc'); + + if ($_action=='save-identity') + include('program/steps/settings/save_identity.inc'); + + if ($_action=='add-identity' || $_action=='edit-identity') + include('program/steps/settings/edit_identity.inc'); + + if ($_action=='delete-identity') + include('program/steps/settings/delete_identity.inc'); + + if ($_action=='identities') + include('program/steps/settings/identities.inc'); + + if ($_action=='save-prefs') + include('program/steps/settings/save_prefs.inc'); + + if ($_action=='folders' || $_action=='subscribe' || $_action=='unsubscribe' || $_action=='create-folder' || $_action=='delete-folder') + include('program/steps/settings/manage_folders.inc'); + + } + + +// parse main template +parse_template($_task); + +?> \ No newline at end of file diff --git a/logs/.htaccess b/logs/.htaccess new file mode 100644 index 000000000..8e6a345dc --- /dev/null +++ b/logs/.htaccess @@ -0,0 +1,2 @@ +Order allow,deny +Deny from all \ No newline at end of file diff --git a/logs/errors b/logs/errors new file mode 100644 index 000000000..e69de29bb diff --git a/logs/sendmail b/logs/sendmail new file mode 100644 index 000000000..e69de29bb diff --git a/program/blank.gif b/program/blank.gif new file mode 100644 index 000000000..ea83374c1 Binary files /dev/null and b/program/blank.gif differ diff --git a/program/include/bugs.inc b/program/include/bugs.inc new file mode 100644 index 000000000..819887cc3 --- /dev/null +++ b/program/include/bugs.inc @@ -0,0 +1,104 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +// throw system error and show error page +function raise_error($arg=array(), $log=FALSE, $terminate=FALSE) + { + global $__page_content, $CONFIG, $OUTPUT, $ERROR_CODE, $ERROR_MESSAGE; + + /* $arg keys: + int code + string type (php, xpath, db, imap, javascript) + string message + sring file + int line + */ + + // report bug (if not incompatible browser) + if ($log && $arg['type'] && $arg['message']) + log_bug($arg); + + // display error page and terminate script + if ($terminate) + { + $ERROR_CODE = $arg['code']; + $ERROR_MESSAGE = $arg['message']; + include("program/steps/error.inc"); + exit; + } + } + + +// report error +function log_bug($arg_arr) + { + global $CONFIG, $INSTALL_PATH; + $program = $arg_arr['type']=='xpath' ? 'XPath' : strtoupper($arg_arr['type']); + + // write error to local log file + if ($CONFIG['debug_level'] & 1) + { + $log_entry = sprintf("[%s] %s Error: %s in %s on line %d\n", + date("d-M-Y H:i:s O", mktime()), + $program, + $arg_arr['message'], + $arg_arr['file'], + $arg_arr['line']); + + if ($fp = fopen($INSTALL_PATH.'logs/errors', 'a')) + { + fwrite($fp, $log_entry); + fclose($fp); + } + } + +/* + // resport the bug to the global bug reporting system + if ($CONFIG['debug_level'] & 2) + { + $delm = '%AC'; + http_request(sprintf('http://roundcube.net/log/bug.php?_type=%s&_domain=%s&_server_ip=%s&_client_ip=%s&_useragent=%s&_url=%s%%3A//%s&_errors=%s%s%s%s%s', + $arg_arr['type'], + $GLOBALS['HTTP_HOST'], + $GLOBALS['SERVER_ADDR'], + $GLOBALS['REMOTE_ADDR'], + rawurlencode($GLOBALS['HTTP_USER_AGENT']), + $GLOBALS['SERVER_PORT']==43 ? 'https' : 'http', + $GLOBALS['HTTP_HOST'].$GLOBALS['REQUEST_URI'], + $arg_arr['file'], $delm, + $arg_arr['line'], $delm, + rawurlencode($arg_arr['message']))); + } +*/ + + // show error if debug_mode is on + if ($CONFIG['debug_level'] & 4) + { + print "$program Error in $arg_arr[file] ($arg_arr[line]): "; + print nl2br($arg_arr['message']); + print '
'; + flush(); + } + } + + +?> \ No newline at end of file diff --git a/program/include/cache.inc b/program/include/cache.inc new file mode 100644 index 000000000..84ed8f07f --- /dev/null +++ b/program/include/cache.inc @@ -0,0 +1,112 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +function rcube_read_cache($key) + { + global $DB, $CACHE_KEYS; + + // query db + $sql_result = $DB->query(sprintf("SELECT cache_id, data + FROM %s + WHERE user_id=%d + AND cache_key='%s'", + get_table_name('cache'), + $_SESSION['user_id'], + $key)); + + // get cached data + if ($sql_arr = $DB->fetch_assoc($sql_result)) + { + $data = $sql_arr['data']; + $CACHE_KEYS[$key] = $sql_arr['cache_id']; + } + else + $data = FALSE; + + return $data; + } + + +function rcube_write_cache($key, $data, $session_cache=FALSE) + { + global $DB, $CACHE_KEYS, $sess_id; + + // check if we already have a cache entry for this key + if (!isset($CACHE_KEYS[$key])) + { + $sql_result = $DB->query(sprintf("SELECT cache_id + FROM %s + WHERE user_id=%d + AND cache_key='%s'", + get_table_name('cache'), + $_SESSION['user_id'], + $key)); + + if ($sql_arr = $DB->fetch_assoc($sql_result)) + $CACHE_KEYS[$key] = $sql_arr['cache_id']; + else + $CACHE_KEYS[$key] = FALSE; + } + + // update existing cache record + if ($CACHE_KEYS[$key]) + { + $DB->query(sprintf("UPDATE %s + SET created=NOW(), + data='%s' + WHERE user_id=%d + AND cache_key='%s'", + get_table_name('cache'), + addslashes($data), + $_SESSION['user_id'], + $key)); + } + // add new cache record + else + { + $DB->query(sprintf("INSERT INTO %s + (created, user_id, session_id, cache_key, data) + VALUES (NOW(), %d, %s, '%s', '%s')", + get_table_name('cache'), + $_SESSION['user_id'], + $session_cache ? "'$sess_id'" : 'NULL', + $key, + addslashes($data))); + } + } + + + +function rcube_clear_cache($key) + { + global $DB; + + $DB->query(sprintf("DELETE FROM %s + WHERE user_id=%d + AND cache_key='%s'", + get_table_name('cache'), + $_SESSION['user_id'], + $key)); + } + + +?> \ No newline at end of file diff --git a/program/include/main.inc b/program/include/main.inc new file mode 100644 index 000000000..8cbc271b1 --- /dev/null +++ b/program/include/main.inc @@ -0,0 +1,1020 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +require_once('lib/des.inc'); + + +// register session and connect to server +function rcmail_startup($task='mail') + { + global $sess_id, $sess_auth, $sess_user_lang; + global $CONFIG, $INSTALL_PATH, $BROWSER, $OUTPUT, $_SESSION, $IMAP, $DB, $JS_OBJECT_NAME; + + // check client + $BROWSER = rcube_browser(); + + // load config file + include_once('config/main.inc.php'); + $CONFIG = is_array($rcmail_config) ? $rcmail_config : array(); + $CONFIG['skin_path'] = $CONFIG['skin_path'] ? preg_replace('/\/$/', '', $CONFIG['skin_path']) : 'skins/default'; + + // load db conf + include_once('config/db.inc.php'); + $CONFIG = array_merge($CONFIG, $rcmail_config); + + + // set PHP error logging according to config + if ($CONFIG['debug_level'] & 1) + { + ini_set('log_errors', 1); + ini_set('error_log', $INSTALL_PATH.'logs/errors'); + } + if ($CONFIG['debug_level'] & 4) + ini_set('display_errors', 1); + else + ini_set('display_errors', 0); + + + // prepare DB connection + if (strtolower($CONFIG['db_type'])=='mysql') + $DB = new rcube_mysql($CONFIG['db_name'], $CONFIG['db_user'], $CONFIG['db_pass'], $CONFIG['db_host']); + + // database not supported + else + { + raise_error(array('code' => 500, + 'type' => 'php', + 'line' => __LINE__, + 'file' => __FILE__, + 'message' => "Database not supported"), TRUE, TRUE); + return; + } + + + // we can use the database for storing session data + if (is_object($DB) && $DB->connect()) + include_once('include/session.inc'); + + + // init session + session_start(); + $sess_id = session_id(); + + // create session and set session vars + if (!$_SESSION['client_id']) + { + $_SESSION['client_id'] = $sess_id; + $_SESSION['user_lang'] = 'en'; + $_SESSION['auth_time'] = mktime(); + $_SESSION['auth'] = rcmail_auth_hash($sess_id, $_SESSION['auth_time']); + unset($GLOBALS['_auth']); + } + + // set session vars global + $sess_auth = $_SESSION['auth']; + $sess_user_lang = $_SESSION['user_lang']; + + + // overwrite config with user preferences + if (is_array($_SESSION['user_prefs'])) + $CONFIG = array_merge($CONFIG, $_SESSION['user_prefs']); + + + // reset some session parameters when changing task + if ($_SESSION['task'] != $task) + unset($_SESSION['page']); + + // set current task to session + $_SESSION['task'] = $task; + + + // create IMAP object + if ($task=='mail') + rcmail_imap_init(); + + + // set localization + if ($CONFIG['locale_string']) + setlocale(LC_ALL, $CONFIG['locale_string']); + else if ($sess_user_lang) + setlocale(LC_ALL, $sess_user_lang); + + + register_shutdown_function('rcmail_shutdown'); + } + + +// create authorization hash +function rcmail_auth_hash($sess_id, $ts) + { + global $CONFIG; + + $auth_string = sprintf('rcmail*sess%sR%s*Chk:%s;%s', + $sess_id, + $ts, + $CONFIG['ip_check'] ? $_SERVER['REMOTE_ADDR'] : '***.***.***.***', + $_SERVER['HTTP_USER_AGENT']); + + if (function_exists('sha1')) + return sha1($auth_string); + else + return md5($auth_string); + } + + + +// create IMAP object and connect to server +function rcmail_imap_init($connect=FALSE) + { + global $CONFIG, $IMAP; + + $IMAP = new rcube_imap(); + + // set root dir from config + if (strlen($CONFIG['imap_root'])) + $IMAP->set_rootdir($CONFIG['imap_root']); + + if (is_array($CONFIG['default_imap_folders'])) + $IMAP->set_default_mailboxes($CONFIG['default_imap_folders']); + + if (strlen($_SESSION['mbox'])) + $IMAP->set_mailbox($_SESSION['mbox']); + + if (isset($_SESSION['page'])) + $IMAP->set_page($_SESSION['page']); + + // set pagesize from config + if (isset($CONFIG['pagesize'])) + $IMAP->set_pagesize($CONFIG['pagesize']); + + + // connect with stored session data + if ($connect) + { + if (!($conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password'])))) + show_message('imaperror', 'error'); + } + } + + +// do these things on script shutdown +function rcmail_shutdown() + { + global $IMAP; + + if (is_object($IMAP)) + { + $IMAP->close(); + $IMAP->write_cache(); + } + } + + +// destroy session data and remove cookie +function rcmail_kill_session() + { +/* $sess_name = session_name(); + if (isset($_COOKIE[$sess_name])) + setcookie($sess_name, '', time()-42000, '/'); +*/ + $_SESSION = array(); + session_destroy(); + } + + +// return correct name for a specific database table +function get_table_name($table) + { + global $CONFIG; + + // return table name if configured + $config_key = 'db_table_'.$table; + + if (strlen($CONFIG[$config_key])) + return $CONFIG[$config_key]; + + return $table; + } + + + +// init output object for GUI and add common scripts +function load_gui() + { + global $CONFIG, $OUTPUT, $COMM_PATH, $IMAP, $JS_OBJECT_NAME; + + // init output page + $OUTPUT = new rcube_html_page(); + + // add common javascripts + $javascript = "var $JS_OBJECT_NAME = new rcube_webmail();\n"; + $javascript .= "$JS_OBJECT_NAME.set_env('comm_path', '$COMM_PATH');\n"; + + if ($_GET['_framed'] || $_POST['_framed']) + $javascript .= "$JS_OBJECT_NAME.set_env('framed', true);\n"; + + $OUTPUT->add_script($javascript); + $OUTPUT->include_script('program/js/common.js'); + $OUTPUT->include_script('program/js/app.js'); + } + + +// perfom login to the IMAP server and to the webmail service +function rcmail_login($user, $pass, $host=NULL) + { + global $CONFIG, $IMAP, $DB, $sess_user_lang; + + if (!$host) + $host = $CONFIG['default_host']; + + // exit if IMAP login failed + if (!($imap_login = $IMAP->connect($host, $user, $pass))) + return FALSE; + + // query if user already registered + $sql_result = $DB->query(sprintf("SELECT user_id, language, preferences + FROM %s + WHERE username='%s' AND mail_host='%s'", + get_table_name('users'), + $user, $host)); + + // user already registered + if ($sql_arr = $DB->fetch_assoc($sql_result)) + { + $user_id = $sql_arr['user_id']; + + // get user prefs + if (strlen($sql_arr['preferences'])) + { + $user_prefs = unserialize($sql_arr['preferences']); + $_SESSION['user_prefs'] = $user_prefs; + array_merge($CONFIG, $user_prefs); + } + + // set user specific language + if (strlen($sql_arr['language'])) + $sess_user_lang = $_SESSION['user_lang'] = $sql_arr['language']; + + // update user's record + $DB->query(sprintf("UPDATE %s + SET last_login=NOW() + WHERE user_id=%d", + get_table_name('users'), + $user_id)); + } + // create new system user + else if ($CONFIG['auto_create_user']) + { + $user_id = rcmail_create_user($user, $host); + } + + if ($user_id) + { + $_SESSION['user_id'] = $user_id; + $_SESSION['imap_host'] = $host; + $_SESSION['username'] = $user; + $_SESSION['password'] = encrypt_passwd($pass); + + // force reloading complete list of subscribed mailboxes + $IMAP->clear_cache('mailboxes'); + + return TRUE; + } + + return FALSE; + } + + +// create new entry in users and identities table +function rcmail_create_user($user, $host) + { + global $DB, $CONFIG, $IMAP; + + $DB->query(sprintf("INSERT INTO %s + (created, last_login, username, mail_host) + VALUES (NOW(), NOW(), '%s', '%s')", + get_table_name('users'), + $user, $host)); + + if ($user_id = $DB->insert_id()) + { + // also create a new identity record + $DB->query(sprintf("INSERT INTO %s + (user_id, `default`, name, email) + VALUES (%d, '1', '%s', '%s@%s')", + get_table_name('identities'), + $user_id, + $user, + $user, + $host)); + + // get existing mailboxes + $a_mailboxes = $IMAP->list_mailboxes(); + + // check if the configured mailbox for sent messages exists + if ($CONFIG['sent_mbox'] && !in_array_nocase($CONFIG['sent_mbox'], $a_mailboxes)) + $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); + + // check if the configured mailbox for sent messages exists + if ($CONFIG['trash_mbox'] && !in_array_nocase($CONFIG['trash_mbox'], $a_mailboxes)) + $IMAP->create_mailbox($CONFIG['trash_mbox'], TRUE); + } + + return $user_id; + } + + +function show_message($message, $type='notice') + { + global $OUTPUT, $JS_OBJECT_NAME, $REMOTE_REQUEST; + + $framed = ($_GET['framed'] || $_POST['_framed']); + $command = sprintf("display_message('%s', '%s');", + addslashes(rep_specialchars_output(rcube_label($message))), + $type); + + if ($REMOTE_REQUEST) + return 'this.'.$command; + + else + $OUTPUT->add_script(sprintf("%s%s.%s", + $framed ? sprintf('if(parent.%s)parent.', $JS_OBJECT_NAME) : '', + $JS_OBJECT_NAME, + $command)); + + // console(rcube_label($message)); + } + + +function console($msg, $type=1) + { + print $msg; + print "\n
\n"; + } + + +function encrypt_passwd($pass) + { + $cypher = des('rcmail?24BitPwDkeyF**ECB', $pass, 1, 0, NULL); + return base64_encode($cypher); + } + + +function decrypt_passwd($cypher) + { + $pass = des('rcmail?24BitPwDkeyF**ECB', base64_decode($cypher), 0, 0, NULL); + return trim($pass); + } + + +// send correct response on a remote request +function rcube_remote_response($js_code) + { + send_nocacheing_headers(); + //header('Content-Type: text/javascript'); + header('Content-Type: application/x-javascript'); + + print '/** remote response ['.date('d/M/Y h:i:s O')."] **/\n"; + print $js_code; + exit; + } + + + + +// ************** template parsing and gui functions ************** + + +// return boolean if a specific template exists +function template_exists($name) + { + global $CONFIG, $OUTPUT; + $skin_path = $CONFIG['skin_path']; + + // check template file + return is_file("$skin_path/templates/$name.html"); + } + + +// get page template an replace variable +// similar function as used in nexImage +function parse_template($name='main', $exit=TRUE) + { + global $CONFIG, $OUTPUT; + $skin_path = $CONFIG['skin_path']; + + // read template file + $templ = ''; + $path = "$skin_path/templates/$name.html"; + + if($fp = @fopen($path, 'r')) + { + $templ = fread($fp, filesize($path)); + fclose($fp); + } + else + { + raise_error(array('code' => 500, + 'type' => 'php', + 'line' => __LINE__, + 'file' => __FILE__, + 'message' => "Error loading template for '$name'"), TRUE, TRUE); + return FALSE; + } + + + // parse for specialtags + $output = parse_rcube_xml($templ); + + $OUTPUT->write(trim(parse_with_globals($output)), $skin_path); + + if ($exit) + exit; + } + + + +// replace all strings ($varname) with the content of the according global variable +function parse_with_globals($input) + { + $output = preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input); + return $output; + } + + + +function parse_rcube_xml($input) + { + $output = preg_replace('/]+)>/Uie', "rcube_xml_command('\\1', '\\2')", $input); + return $output; + } + + +function rcube_xml_command($command, $str_attrib, $a_attrib=NULL) + { + global $IMAP, $CONFIG; + + $attrib = array(); + $command = strtolower($command); + + preg_match_all('/\s*([-_a-z]+)=["]([^"]+)["]?/i', stripslashes($str_attrib), $regs, PREG_SET_ORDER); + + // convert attributes to an associative array (name => value) + if ($regs) + foreach ($regs as $attr) + $attrib[strtolower($attr[1])] = $attr[2]; + else if ($a_attrib) + $attrib = $a_attrib; + + // execute command + switch ($command) + { + // return a button + case 'button': + if ($attrib['command']) + return rcube_button($attrib); + break; + + // show a label + case 'label': + if ($attrib['name'] || $attrib['command']) + return rcube_label($attrib); + break; + + // create a menu item + case 'menu': + if ($attrib['command'] && $attrib['group']) + rcube_menu($attrib); + break; + + // include a file + case 'include': + $path = realpath($CONFIG['skin_path'].$attrib['file']); + + if($fp = @fopen($path, 'r')) + { + $incl = fread($fp, filesize($path)); + fclose($fp); + return parse_rcube_xml($incl); + } + break; + + // return code for a specific application object + case 'object': + $object = strtolower($attrib['name']); + + if ($object=='loginform') + return rcmail_login_form($attrib); + + else if ($object=='message') + return rcmail_message_container($attrib); + + // MAIL + else if ($object=='mailboxlist' && function_exists('rcmail_mailbox_list')) + return rcmail_mailbox_list($attrib); + + else if ($object=='messages' && function_exists('rcmail_message_list')) + return rcmail_message_list($attrib); + + else if ($object=='messagecountdisplay' && function_exists('rcmail_messagecount_display')) + return rcmail_messagecount_display($attrib); + + else if ($object=='messageheaders' && function_exists('rcmail_message_headers')) + return rcmail_message_headers($attrib); + + else if ($object=='messageattachments' && function_exists('rcmail_message_attachments')) + return rcmail_message_attachments($attrib); + + else if ($object=='messagebody' && function_exists('rcmail_message_body')) + return rcmail_message_body($attrib); + + else if ($object=='blockedobjects' && function_exists('rcmail_remote_objects_msg')) + return rcmail_remote_objects_msg($attrib); + + else if ($object=='messagecontentframe' && function_exists('rcmail_messagecontent_frame')) + return rcmail_messagecontent_frame($attrib); + + else if ($object=='messagepartframe' && function_exists('rcmail_message_part_frame')) + return rcmail_message_part_frame($attrib); + + else if ($object=='messagepartcontrols' && function_exists('rcmail_message_part_controls')) + return rcmail_message_part_controls($attrib); + + else if ($object=='composeheaders' && function_exists('rcmail_compose_headers')) + return rcmail_compose_headers($attrib); + + else if ($object=='composesubject' && function_exists('rcmail_compose_subject')) + return rcmail_compose_subject($attrib); + + else if ($object=='composebody' && function_exists('rcmail_compose_body')) + return rcmail_compose_body($attrib); + + else if ($object=='composeattachmentlist' && function_exists('rcmail_compose_attachment_list')) + return rcmail_compose_attachment_list($attrib); + + else if ($object=='composeattachmentform' && function_exists('rcmail_compose_attachment_form')) + return rcmail_compose_attachment_form($attrib); + + else if ($object=='composeattachment' && function_exists('rcmail_compose_attachment_field')) + return rcmail_compose_attachment_field($attrib); + + else if ($object=='priorityselector' && function_exists('rcmail_priority_selector')) + return rcmail_priority_selector($attrib); + + else if ($object=='priorityselector' && function_exists('rcmail_priority_selector')) + return rcmail_priority_selector($attrib); + + + // ADDRESS BOOK + else if ($object=='addresslist' && function_exists('rcmail_contacts_list')) + return rcmail_contacts_list($attrib); + + else if ($object=='addressframe' && function_exists('rcmail_contact_frame')) + return rcmail_contact_frame($attrib); + + else if ($object=='recordscountdisplay' && function_exists('rcmail_rowcount_display')) + return rcmail_rowcount_display($attrib); + + else if ($object=='contactdetails' && function_exists('rcmail_contact_details')) + return rcmail_contact_details($attrib); + + else if ($object=='contacteditform' && function_exists('rcmail_contact_editform')) + return rcmail_contact_editform($attrib); + + + // USER SETTINGS + else if ($object=='userprefs' && function_exists('rcmail_user_prefs_form')) + return rcmail_user_prefs_form($attrib); + + else if ($object=='itentitieslist' && function_exists('rcmail_identities_list')) + return rcmail_identities_list($attrib); + + else if ($object=='identityframe' && function_exists('rcmail_identity_frame')) + return rcmail_identity_frame($attrib); + + else if ($object=='identityform' && function_exists('rcube_identity_form')) + return rcube_identity_form($attrib); + + else if ($object=='foldersubscription' && function_exists('rcube_subscription_form')) + return rcube_subscription_form($attrib); + + else if ($object=='createfolder' && function_exists('rcube_create_folder_form')) + return rcube_create_folder_form($attrib); + + + else if ($object=='pagetitle') + { + $task = $GLOBALS['_task']; + if ($task=='mail' && isset($GLOBALS['MESSAGE']['subject'])) + return rep_specialchars_output("RoundCube|Mail :: ".$GLOBALS['MESSAGE']['subject']); + else if (isset($GLOBALS['PAGE_TITLE'])) + return rep_specialchars_output("RoundCube|Mail :: ".$GLOBALS['PAGE_TITLE']); + else if ($task=='mail' && ($mbox_name = $IMAP->get_mailbox_name())) + return "RoundCube|Mail :: $mbox_name"; + else + return "RoundCube|Mail :: $task"; + } + + else if ($object=='about') + return ''; + + break; + } + + return ''; + } + + +// create and register a button +function rcube_button($attrib) + { + global $CONFIG, $OUTPUT, $JS_OBJECT_NAME; + static $sa_buttons = array(); + static $s_button_count = 100; + + $skin_path = $CONFIG['skin_path']; + + if (!($attrib['command'] || $attrib['name'])) + return ''; + + // try to find out the button type + if ($attrib['type']) + $attrib['type'] = strtolower($attrib['type']); + else + $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $arg['imagect']) ? 'image' : 'link'; + + + $command = $attrib['command']; + + // take the button from the stack + if($attrib['name'] && $sa_buttons[$attrib['name']]) + $attrib = $sa_buttons[$attrib['name']]; + + // add button to button stack + else if($attrib['image'] || $arg['imagect'] || $attrib['imagepas'] || $attrib['class']) + { + if(!$attrib['name']) + $attrib['name'] = $command; + + if (!$attrib['image']) + $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact']; + + $sa_buttons[$attrib['name']] = $attrib; + } + + // get saved button for this command/name + else if ($command && $sa_buttons[$command]) + $attrib = $sa_buttons[$command]; + + //else + // return ''; + + + // set border to 0 because of the link arround the button + if ($attrib['type']=='image' && !isset($attrib['border'])) + $attrib['border'] = 0; + + if (!$attrib['id']) + $attrib['id'] = sprintf('rcmbtn%d', $s_button_count++); + + // get localized text for labels and titles + if ($attrib['title']) + $attrib['title'] = rep_specialchars_output(rcube_label($attrib['title'])); + if ($attrib['label']) + $attrib['label'] = rep_specialchars_output(rcube_label($attrib['label'])); + + if ($attrib['alt']) + $attrib['alt'] = rep_specialchars_output(rcube_label($attrib['alt'])); + + // add empty alt attribute for XHTML compatibility + if (!isset($attrib['alt'])) + $attrib['alt'] = ''; + + + // register button in the system + if ($attrib['command']) + $OUTPUT->add_script(sprintf("%s.register_button('%s', '%s', '%s', '%s', '%s', '%s');", + $JS_OBJECT_NAME, + $command, + $attrib['id'], + $attrib['type'], + $attrib['imageact'] ? $skin_path.$attrib['imageact'] : $attrib['classact'], + $attirb['imagesel'] ? $skin_path.$attirb['imagesel'] : $attrib['classsel'], + $attrib['imageover'] ? $skin_path.$attrib['imageover'] : '')); + + // overwrite attributes + if (!$attrib['href']) + $attrib['href'] = '#'; + + if ($command) + $attrib['onclick'] = sprintf("return %s.command('%s','%s',this)", $JS_OBJECT_NAME, $command, $attrib['prop']); + + if ($command && $attrib['imageover']) + { + $attrib['onmouseover'] = sprintf("return %s.button_over('%s','%s')", $JS_OBJECT_NAME, $command, $attrib['id']); + $attrib['onmouseout'] = sprintf("return %s.button_out('%s','%s')", $JS_OBJECT_NAME, $command, $attrib['id']); + } + + + $out = ''; + + // generate image tag + if ($attrib['type']=='image') + { + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'width', 'height', 'border', 'hspace', 'vspace', 'alt')); + $img_tag = sprintf('', $attrib_str); + $btn_content = sprintf($img_tag, $skin_path.$attrib['image']); + if ($attrib['label']) + $btn_content .= ' '.$attrib['label']; + + $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'title'); + } + else if ($attrib['type']=='link') + { + $btn_content = $attrib['label'] ? $attrib['label'] : $attrib['command']; + $link_attrib = array('href', 'onclick', 'title', 'id', 'class', 'style'); + } + else if ($attrib['type']=='input') + { + $attrib['type'] = 'button'; + + if ($attrib['label']) + $attrib['value'] = $attrib['label']; + + $attrib_str = create_attrib_string($attrib, array('type', 'value', 'onclick', 'id', 'class', 'style')); + $out = sprintf('', $attrib_str); + } + + // generate html code for button + if ($btn_content) + { + $attrib_str = create_attrib_string($attrib, $link_attrib); + $out = sprintf('%s', $attrib_str, $btn_content); + } + + return $out; + } + + +function rcube_menu($attrib) + { + + return ''; + } + + + +function rcube_table_output($attrib, $sql_result, $a_show_cols, $id_col) + { + global $DB; + + // allow the following attributes to be added to the tag + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); + + $table = '\n"; + + // add table title + $table .= "\n"; + + foreach ($a_show_cols as $col) + $table .= '\n"; + + $table .= "\n\n"; + + $c = 0; + while ($sql_result && ($sql_arr = $DB->fetch_assoc($sql_result))) + { + $zebra_class = $c%2 ? 'even' : 'odd'; + + $table .= sprintf(''."\n", $sql_arr[$id_col]); + + // format each col + foreach ($a_show_cols as $col) + { + $cont = rep_specialchars_output($sql_arr[$col]); + $table .= '\n"; + } + + $table .= "\n"; + $c++; + } + + // complete message table + $table .= "
' . rcube_label($col) . "
' . $cont . "
\n"; + + return $table; + } + + + +function rcmail_get_edit_field($col, $value, $attrib, $type='text') + { + $fname = '_'.$col; + $attrib['name'] = $fname; + + if ($type=='checkbox') + { + $attrib['value'] = '1'; + $input = new checkbox($attrib); + } + else if ($type=='textarea') + { + $attrib['cols'] = $attrib['size']; + $input = new textarea($attrib); + } + else + $input = new textfield($attrib); + + // use value from post + if ($_POST[$fname]) + $value = $_POST[$fname]; + + $out = $input->show($value); + + return $out; + } + + +function create_attrib_string($attrib, $allowed_attribs=array('id', 'class', 'style')) + { + // allow the following attributes to be added to the '; + document.body.insertAdjacentHTML('BeforeEnd',html); + } + else // for standards-compilant browsers + { + var frame = document.createElement('IFRAME'); + frame.name = frame_name; + frame.width = 10; + frame.height = 10; + frame.style.visibility = 'hidden'; + document.body.appendChild(frame); + } + + form.target = frame_name; + form.action = this.env.comm_path+'&_action=upload'; + form.setAttribute('enctype', 'multipart/form-data'); + form.submit(); + } + + // set reference to the form object + this.gui_objects.attachmentform = form; + }; + + + // add file name to attachment list + // called from upload page + this.add2attachment_list = function(name) + { + if (!this.gui_objects.attachmentlist) + return false; + + var li = document.createElement('LI'); + li.innerHTML = name; + this.gui_objects.attachmentlist.appendChild(li); + }; + + + // send remote request to add a new contact + this.add_contact = function(value) + { + if (value) + this.http_request('addcontact', '_address='+value); + }; + + + /*********************************************************/ + /********* keyboard live-search methods *********/ + /*********************************************************/ + + + // handler for keyboard events on address-fields + this.ksearch_keypress = function(e, obj) + { + if (typeof(this.env.contacts)!='object' || !this.env.contacts.length) + return true; + + if (this.ksearch_timer) + clearTimeout(this.ksearch_timer); + + if (!e) + e = window.event; + + var highlight; + var key = e.keyCode ? e.keyCode : e.which; + + switch (key) + { + case 38: // key up + case 40: // key down + if (!this.ksearch_pane) + break; + + var dir = key==38 ? 1 : 0; + var next; + + highlight = document.getElementById('rcmksearchSelected'); + if (!highlight) + highlight = this.ksearch_pane.ul.firstChild; + + if (highlight && (next = dir ? highlight.previousSibling : highlight.nextSibling)) + { + highlight.removeAttribute('id'); + //highlight.removeAttribute('class'); + this.set_classname(highlight, 'selected', false); + } + + if (next) + { + next.setAttribute('id', 'rcmksearchSelected'); + this.set_classname(next, 'selected', true); + this.ksearch_selected = next._rcm_id; + } + + if (e.preventDefault) + e.preventDefault(); + return false; + + case 9: // tab + if(e.shiftKey) + break; + + case 13: // enter + if (this.ksearch_selected===null || !this.ksearch_input || !this.ksearch_value) + break; + + // get cursor pos + var inp_value = this.ksearch_input.value.toLowerCase(); + var cpos = this.get_caret_pos(this.ksearch_input); + var p = inp_value.lastIndexOf(this.ksearch_value, cpos); + + // replace search string with full address + var pre = this.ksearch_input.value.substring(0, p); + var end = this.ksearch_input.value.substring(p+this.ksearch_value.length, this.ksearch_input.value.length); + var insert = this.env.contacts[this.ksearch_selected]+', '; + this.ksearch_input.value = pre + insert + end; + + //this.ksearch_input.value = this.ksearch_input.value.substring(0, p)+insert; + + // set caret to insert pos + cpos = p+insert.length; + if (this.ksearch_input.setSelectionRange) + this.ksearch_input.setSelectionRange(cpos, cpos); + + // hide ksearch pane + this.ksearch_hide(); + + if (e.preventDefault) + e.preventDefault(); + return false; + + case 27: // escape + this.ksearch_hide(); + break; + + } + + // start timer + this.ksearch_timer = setTimeout(this.ref+'.ksearch_get_results()', 200); + this.ksearch_input = obj; + + return true; + }; + + + // address search processor + this.ksearch_get_results = function() + { + var inp_value = this.ksearch_input ? this.ksearch_input.value : null; + if (inp_value===null) + return; + + // get string from current cursor pos to last comma + var cpos = this.get_caret_pos(this.ksearch_input); + var p = inp_value.lastIndexOf(',', cpos-1); + var q = inp_value.substring(p+1, cpos); + + // trim query string + q = q.replace(/(^\s+|\s+$)/g, '').toLowerCase(); + + if (!q.length || q==this.ksearch_value) + { + if (!q.length && this.ksearch_pane && this.ksearch_pane.visible) + this.ksearch_pane.show(0); + + return; + } + + this.ksearch_value = q; + + // start searching the contact list + var a_results = new Array(); + var a_result_ids = new Array(); + var c=0; + for (var i=0; i=0) + { + a_results[c] = this.env.contacts[i]; + a_result_ids[c++] = i; + + if (c==15) // limit search results + break; + } + } + + // display search results + if (c && a_results.length) + { + var p, ul, li; + + // create results pane if not present + if (!this.ksearch_pane) + { + ul = document.createElement('UL'); + this.ksearch_pane = new rcube_layer('rcmKSearchpane', {vis:0, zindex:30000}); + this.ksearch_pane.elm.appendChild(ul); + this.ksearch_pane.ul = ul; + } + else + ul = this.ksearch_pane.ul; + + // remove all search results + ul.innerHTML = ''; + + // add each result line to list + for (i=0; i/, '>'); + li._rcm_id = a_result_ids[i]; + ul.appendChild(li); + } + + // check if last selected item is still in result list + if (this.ksearch_selected!==null) + { + p = find_in_array(this.ksearch_selected, a_result_ids); + if (p>=0 && ul.childNodes) + { + ul.childNodes[p].setAttribute('id', 'rcmksearchSelected'); + this.set_classname(ul.childNodes[p], 'selected', true); + } + else + this.ksearch_selected = null; + } + + // if no item selected, select the first one + if (this.ksearch_selected===null) + { + ul.firstChild.setAttribute('id', 'rcmksearchSelected'); + this.set_classname(ul.firstChild, 'selected', true); + this.ksearch_selected = a_result_ids[0]; + } + + // resize the containing layer to fit the list + //this.ksearch_pane.resize(ul.offsetWidth, ul.offsetHeight); + + // move the results pane right under the input box and make it visible + var pos = rcube_get_object_pos(this.ksearch_input); + this.ksearch_pane.move(pos.x, pos.y+this.ksearch_input.offsetHeight); + this.ksearch_pane.show(1); + } + // hide results pane + else + this.ksearch_hide(); + }; + + + this.ksearch_blur = function(e, obj) + { + if (this.ksearch_timer) + clearTimeout(this.ksearch_timer); + + this.ksearch_value = ''; + this.ksearch_input = null; + + this.ksearch_hide(); + }; + + + this.ksearch_hide = function() + { + this.ksearch_selected = null; + + if (this.ksearch_pane) + this.ksearch_pane.show(0); + }; + + + + /*********************************************************/ + /********* address book methods *********/ + /*********************************************************/ + + + this.list_contacts = function(page) + { + var add_url = ''; + var target = window; + + if (page && this.current_page==page) + return false; + + // load contacts remotely + if (this.gui_objects.contactslist) + { + this.list_contacts_remote(page); + return; + } + + if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) + { + target = window.frames[this.env.contentframe]; + add_url = '&_framed=1'; + } + + this.set_busy(true, 'loading'); + location.href = this.env.comm_path+(page ? '&_page='+page : '')+add_url; + }; + + + // send remote request to load contacts list + this.list_contacts_remote = function(page) + { + // clear list + var table = this.gui_objects.contactslist; + var tbody = document.createElement('TBODY'); + table.insertBefore(tbody, table.tBodies[0]); + table.tBodies[1].style.display = 'none'; + + this.contact_rows = new Array(); + this.list_rows = this.contact_rows; + + // send request to server + var url = page ? '&_page='+page : ''; + this.set_busy(true, 'loading'); + this.http_request('list', url); + }; + + + // load contact record + this.load_contact = function(cid, action, framed) + { + var add_url = ''; + var target = window; + if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) + { + add_url = '&_framed=1'; + target = window.frames[this.env.contentframe]; + document.getElementById(this.env.contentframe).style.visibility = 'inherit'; + } + else if (framed) + return false; + + //if (this.env.framed && add_url=='') + // add_url = '&_framed=1'; + + if (action && (cid || action=='add')) + { + this.set_busy(true); + target.location.href = this.env.comm_path+'&_action='+action+'&_cid='+cid+add_url; + } + }; + + + this.delete_contacts = function() + { + // exit if no mailbox specified or if selection is empty + if (!(this.selection.length || this.env.cid)) + return; + + var a_cids = new Array(); + + if (this.env.cid) + a_cids[a_cids.length] = this.env.cid; + else + { + var id; + for (var n=0; n this.env.current_page)); + this.enable_command('previouspage', (this.env.current_page > 1)); + } + + + // set button to a specific state + this.set_button = function(command, state) + { + var a_buttons = this.buttons[command]; + var button, obj; + + if(!a_buttons || !a_buttons.length) + return; + + for(var n=0; n'+cont+''; + + this.gui_objects.message.innerHTML = cont; + this.gui_objects.message.style.display = 'block'; + + if (!hold) + this.message_timer = setTimeout(this.ref+'.hide_message()', this.message_time); + }; + + + // make a message row disapear + this.hide_message = function() + { + if (this.gui_objects.message) + this.gui_objects.message.style.display = 'none'; + }; + + + // mark a mailbox as selected and set environment variable + this.select_mailbox = function(mbox) + { + if (this.gui_objects.mailboxlist) + { + var item, reg, text_obj; + var s_mbox = String(mbox).toLowerCase().replace(this.mbox_expression, ''); + var s_current = this.env.mailbox.toLowerCase().replace(this.mbox_expression, ''); + for (var n=0; n=0) + this.set_classname(item, 'selected', true); + else if (item.className && item.className.indexOf('mailbox '+s_current)>=0) + this.set_classname(item, 'selected', false); + } + } + + this.env.mailbox = mbox; + }; + + + // create a table row in the message list + this.add_message_row = function(uid, cols, flags, attachment) + { + if (!this.gui_objects.messagelist || !this.gui_objects.messagelist.tBodies[0]) + return false; + + var tbody = this.gui_objects.messagelist.tBodies[0]; + var rowcount = tbody.rows.length; + var even = rowcount%2; + + this.env.messages[uid] = {replied:flags.replied?1:0, + unread:flags.unread?1:0}; + + var row = document.createElement('TR'); + row.id = 'rcmrow'+uid; + row.className = 'message '+(even ? 'even' : 'odd')+(flags.unread ? ' unread' : ''); + + if (this.in_selection(uid)) + row.className += ' selected'; + + var icon = flags.unread && this.env.unreadicon ? this.env.unreadicon : + (flags.replied && this.env.repliedicon ? this.env.repliedicon : this.env.messageicon); + + var col = document.createElement('TD'); + col.className = 'icon'; + col.innerHTML = icon ? '' : ''; + row.appendChild(col); + + // add each submitted col + for (var c in cols) + { + col = document.createElement('TD'); + col.className = String(c).toLowerCase(); + col.innerHTML = cols[c]; + row.appendChild(col); + } + + col = document.createElement('TD'); + col.className = 'icon'; + col.innerHTML = attachment && this.env.attachmenticon ? '' : ''; + row.appendChild(col); + + tbody.appendChild(row); + this.init_message_row(row); + }; + + + // replace content of row count display + this.set_rowcount = function(text) + { + if (this.gui_objects.countdisplay) + this.gui_objects.countdisplay.innerHTML = text; + + // update page navigation buttons + this.set_page_buttons(); + }; + + + // update the mailboxlist + this.set_unread_count = function(mbox, count) + { + if (!this.gui_objects.mailboxlist) + return false; + + mbox = String(mbox).toLowerCase().replace(this.mbox_expression, ''); + + var item, reg, text_obj; + for (var n=0; n=0) + { + // set new text + text_obj = item.firstChild; + reg = /\s+\([0-9]+\)$/i; + + if (count && text_obj.innerHTML.match(reg)) + text_obj.innerHTML = text_obj.innerHTML.replace(reg, ' ('+count+')'); + else if (count) + text_obj.innerHTML += ' ('+count+')'; + else + text_obj.innerHTML = text_obj.innerHTML.replace(reg, ''); + + // set the right classes + this.set_classname(item, 'unread', count>0 ? true : false); + break; + } + } + }; + + + // add row to contacts list + this.add_contact_row = function(cid, cols) + { + if (!this.gui_objects.contactslist || !this.gui_objects.contactslist.tBodies[0]) + return false; + + var tbody = this.gui_objects.contactslist.tBodies[0]; + var rowcount = tbody.rows.length; + var even = rowcount%2; + + var row = document.createElement('TR'); + row.id = 'rcmrow'+cid; + row.className = 'contact '+(even ? 'even' : 'odd'); + + if (this.in_selection(cid)) + row.className += ' selected'; + + // add each submitted col + for (var c in cols) + { + col = document.createElement('TD'); + col.className = String(c).toLowerCase(); + col.innerHTML = cols[c]; + row.appendChild(col); + } + + tbody.appendChild(row); + this.init_table_row(row, 'contact_rows'); + }; + + + + /********************************************************/ + /********* drag & drop methods *********/ + /********************************************************/ + + + this.drag_mouse_move = function(e) + { + if (this.drag_start) + { + if (!this.draglayer) + this.draglayer = new rcube_layer('rcmdraglayer', {x:0, y:0, width:300, vis:0, zindex:2000}); + + // get subjects of selectedd messages + var names = ''; + var c, subject, obj; + for(var n=0; n12) // only show 12 lines + { + names += '...'; + break; + } + + if (this.message_rows[this.selection[n]].obj) + { + obj = this.message_rows[this.selection[n]].obj; + subject = ''; + + for(c=0; c 50 ? subject.substring(0, 50)+'...' : subject) + '
'; + } + } + } + + this.draglayer.write(names); + this.draglayer.show(1); + } + + var pos = this.get_mouse_pos(e); + this.draglayer.move(pos.x+20, pos.y-5); + + this.drag_start = false; + this.drag_active = true; + + return false; + }; + + + this.drag_mouse_up = function() + { + document.onmousemove = null; + + if (this.draglayer && this.draglayer.visible) + this.draglayer.show(0); + + this.drag_active = false; + + return false; + }; + + + + /********************************************************/ + /********* remote request methods *********/ + /********************************************************/ + + + // send a http request to the server + this.http_request = function(action, querystring) + { + if (window.XMLHttpRequest) + this.request_obj = new XMLHttpRequest(); + else if (window.ActiveXObject) + this.request_obj = new ActiveXObject("Microsoft.XMLHTTP"); + else + { + + } + + querystring += '&_remote=1'; + + // add timestamp to request url to avoid cacheing problems in Safari + if (bw.safari) + querystring += '&_ts='+(new Date().getTime()); + + // send request + if (this.request_obj) + { + // prompt('request', this.env.comm_path+'&_action='+escape(action)+'&'+querystring); + console('HTTP request: '+this.env.comm_path+'&_action='+escape(action)+'&'+querystring); + this.set_busy(true); + this.request_action = action; + this.request_obj.onreadystatechange = function(){ rcube_webmail_client.http_response(); }; + this.request_obj.open('GET', this.env.comm_path+'&_action='+escape(action)+'&'+querystring); + this.request_obj.send(null); + } + }; + + + // handle http response + this.http_response = function() + { + if (this.request_obj.readyState == 4) // || this.request_obj.readyState == 2) + { + var ctype = this.request_obj.getResponseHeader('Content-Type'); + if (ctype) + ctype = String(ctype).toLowerCase(); + + this.set_busy(false); + + console(this.request_obj.responseText); + + // if we get javascript code from server -> execute it + if (this.request_obj.responseText && (ctype=='text/javascript' || ctype=='application/x-javascript')) + eval(this.request_obj.responseText); + + // process the response data according to the sent action + switch (this.request_action) + { + case 'delete': + case 'moveto': + if (this.env.action=='show') + this.command('list'); + break; + + case 'list': + this.enable_command('select-all', 'select-none', this.env.messagecount ? true : false); + break; + } + } + }; + + + /********************************************************/ + /********* helper methods *********/ + /********************************************************/ + + // check if we're in show mode or if we have a unique selection + // and return the message uid + this.get_single_uid = function() + { + return this.env.uid ? this.env.uid : (this.selection.length==1 ? this.selection[0] : null); + }; + + // same as above but for contacts + this.get_single_cid = function() + { + return this.env.cid ? this.env.cid : (this.selection.length==1 ? this.selection[0] : null); + }; + + + // check if Shift-key is pressed on event + this.check_shiftkey = function(e) + { + if(!e && window.event) + e = window.event; + + if(bw.linux && bw.ns4 && e.modifiers) + return true; + else if((bw.ns4 && e.modifiers & Event.SHIFT_MASK) || (e && e.shiftKey)) + return true; + else + return false; + } + + + this.get_mouse_pos = function(e) + { + if(!e) e = window.event; + var mX = (e.pageX) ? e.pageX : e.clientX; + var mY = (e.pageY) ? e.pageY : e.clientY; + + if(document.body && document.all) + { + mX += document.body.scrollLeft; + mY += document.body.scrollTop; + } + + return { x:mX, y:mY }; + }; + + + this.get_caret_pos = function(obj) + { + if (typeof(obj.selectionEnd)!='undefined') + return obj.selectionEnd; + + else if (document.selection && document.selection.createRange) + { + var range = document.selection.createRange(); + if (range.parentElement()!=obj) + return 0; + + var gm = range.duplicate(); + if (obj.tagName=='TEXTAREA') + gm.moveToElementText(obj); + else + gm.expand('textedit'); + + gm.setEndPoint('EndToStart', range); + var p = gm.text.length; + + return p<=obj.value.length ? p : -1; + } + + else + return obj.value.length; + }; + + + this.set_caret2start = function(obj) + { + if (obj.createTextRange) + { + var range = obj.createTextRange(); + range.collapse(true); + range.select(); + } + else if (obj.setSelectionRange) + obj.setSelectionRange(0,0); + + obj.focus(); + }; + + + // set all fields of a form disabled + this.lock_form = function(form, lock) + { + if (!form || !form.elements) + return; + + var type; + for (var n=0; n | + +-----------------------------------------------------------------------+ +*/ + + +// default browsercheck +function roundcube_browser() + { + this.ver = parseFloat(navigator.appVersion); + this.appver = navigator.appVersion; + this.agent = navigator.userAgent; + this.name = navigator.appName; + this.vendor = navigator.vendor ? navigator.vendor : ''; + this.vendver = navigator.vendorSub ? parseFloat(navigator.vendorSub) : 0; + this.product = navigator.product ? navigator.product : ''; + this.platform = String(navigator.platform).toLowerCase(); + this.lang = (navigator.language) ? navigator.language.substring(0,2) : + (navigator.browserLanguage) ? navigator.browserLanguage.substring(0,2) : + (navigator.systemLanguage) ? navigator.systemLanguage.substring(0,2) : 'en'; + + this.win = (this.platform.indexOf('win')>=0) ? true : false; + this.mac = (this.platform.indexOf('mac')>=0) ? true : false; + this.linux = (this.platform.indexOf('linux')>=0) ? true : false; + this.unix = (this.platform.indexOf('unix')>=0) ? true : false; + + this.dom = document.getElementById ? true : false; + this.dom2 = (document.addEventListener && document.removeEventListener); + + this.ie = (document.all) ? true : false; + this.ie4 = (this.ie && !this.dom); + this.ie5 = (this.dom && this.appver.indexOf('MSIE 5')>0); + this.ie6 = (this.dom && this.appver.indexOf('MSIE 6')>0); + + this.mz = (this.dom && this.ver>=5); // (this.dom && this.product=='Gecko') + this.ns = ((this.ver<5 && this.name=='Netscape') || (this.ver>=5 && this.vendor.indexOf('Netscape')>=0)); + this.ns4 = (this.ns && parseInt(this.ver)==4); + this.ns6 = (this.ns && parseInt(this.vendver)==6); // (this.mz && this.ns) ? true : false; + this.ns7 = (this.ns && parseInt(this.vendver)==7); // this.agent.indexOf('Netscape/7')>0); + this.safari = this.agent.toLowerCase().indexOf('safari')>0; + this.konq = (this.agent.toLowerCase().indexOf('konqueror')>0); + + this.opera = (window.opera) ? true : false; + this.opera5 = (this.opera5 && this.agent.indexOf('Opera 5')>0) ? true : false; + this.opera6 = (this.opera && this.agent.indexOf('Opera 6')>0) ? true : false; + this.opera7 = (this.opera && this.agent.indexOf('Opera 7')>0) ? true : false; + + if(this.opera && window.RegExp) + this.vendver = (/opera(\s|\/)([0-9\.]+)/i.test(navigator.userAgent)) ? parseFloat(RegExp.$2) : -1; + else if(!this.vendver && this.safari) + this.vendver = (/safari\/([0-9]+)/i.test(this.agent)) ? parseInt(RegExp.$1) : 0; + else if((!this.vendver && this.mz) || this.agent.indexOf('Camino')>0) + this.vendver = (/rv:([0-9\.]+)/.test(this.agent)) ? parseFloat(RegExp.$1) : 0; + else if(this.ie && window.RegExp) + this.vendver = (/msie\s+([0-9\.]+)/i.test(this.agent)) ? parseFloat(RegExp.$1) : 0; + + // get real language out of safari's user agent + if(this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/i.test(this.agent))) + this.lang = RegExp.$1; + + this.dhtml = ((this.ie4 && this.win) || this.ie5 || this.ie6 || this.ns4 || this.mz); + this.layers = this.ns4; // (document.layers); + this.div = (this.ie4 || this.dom); + this.vml = (this.win && this.ie && this.dom && !this.opera); + this.linkborder = (this.ie || this.mz); + this.rollover = (this.ver>=4 || (this.ns && this.ver>=3)); // (document.images) ? true : false; + this.pngalpha = (this.mz || (this.opera && this.vendver>=6) || (this.ie && this.mac && this.vendver>=5) || + (this.ie && this.win && this.vendver>=5.5) || this.safari); + this.opacity = (this.mz || (this.ie && this.vendver>=5.5 && !this.opera) || (this.safari && this.vendver>=100)); + this.cookies = navigator.cookieEnabled; + } + + + + +var rcube_layer_objects = new Array(); + +function rcube_layer(id, attributes) + { + this.name = id; + + // create a new layer in the current document + this.create = function(arg) + { + var l = (arg.x) ? arg.x : 0; + var t = (arg.y) ? arg.y : 0; + var w = arg.width; + var h = arg.height; + var z = arg.zindex; + var vis = arg.vis; + var parent = arg.parent; + var obj; + + obj = document.createElement('DIV'); + with(obj) + { + id = this.name; + with(style) + { + position = 'absolute'; + visibility = (vis) ? (vis==2) ? 'inherit' : 'visible' : 'hidden'; + left = l+'px'; + top = t+'px'; + if(w) width = w+'px'; + if(h) height = h+'px'; + if(z) zIndex = z; + } + } + + if(parent) parent.appendChild(obj); + else document.body.appendChild(obj); + + this.elm = obj; + }; + + + // create new layer + if(attributes!=null) + { + this.create(attributes); + this.name = this.elm.id; + } + else // just refer to the object + this.elm = document.getElementById(id); + + + if(!this.elm) + return false; + + + // ********* layer object properties ********* + + this.css = this.elm.style; + this.event = this.elm; + this.width = this.elm.offsetWidth; + this.height = this.elm.offsetHeight; + this.x = parseInt(this.elm.offsetLeft); + this.y = parseInt(this.elm.offsetTop); + this.visible = (this.css.visibility=='visible' || this.css.visibility=='show' || this.css.visibility=='inherit') ? true : false; + + this.id = rcube_layer_objects.length; + this.obj = 'rcube_layer_objects['+this.id+']'; + rcube_layer_objects[this.id] = this; + + + // ********* layer object methods ********* + + + // move the layer to a specific position + this.move = function(x, y) + { + this.x = x; + this.y = y; + this.css.left = Math.round(this.x)+'px'; + this.css.top = Math.round(this.y)+'px'; + } + + + // move the layer for a specific step + this.shift = function(x,y) + { + x = Math.round(x*100)/100; + y = Math.round(y*100)/100; + this.move(this.x+x, this.y+y); + } + + + // change the layers width and height + this.resize = function(w,h) + { + this.css.width = w+'px'; + this.css.height = h+'px'; + this.width = w; + this.height = h; + } + + + // cut the layer (top,width,height,left) + this.clip = function(t,w,h,l) + { + this.css.clip='rect('+t+' '+w+' '+h+' '+l+')'; + this.clip_height = h; + this.clip_width = w; + } + + + // show or hide the layer + this.show = function(a) + { + if(a==1) + { + this.css.visibility = 'visible'; + this.visible = true; + } + else if(a==2) + { + this.css.visibility = 'inherit'; + this.visible = true; + } + else + { + this.css.visibility = 'hidden'; + this.visible = false; + } + } + + + // write new content into a Layer + this.write = function(cont) + { + this.elm.innerHTML = cont; + } + + + // set the given color to the layer background + this.set_bgcolor = function(c) + { + if(!c || c=='#') + c = 'transparent'; + + this.css.backgroundColor = c; + } + + + // set the opacity of a layer to the given ammount (in %) + this.set_opacity = function(v) + { + if(!bw.opacity) + return; + + var op = v<=1 ? Math.round(v*100) : parseInt(v); + + if(bw.ie) + this.css.filter = 'alpha(opacity:'+op+')'; + else if(bw.safari) + { + this.css.opacity = op/100; + this.css.KhtmlOpacity = op/100; + } + else if(bw.mz) + this.css.MozOpacity = op/100; + } + } + + + +// find a value in a specific array and returns the index +function find_in_array() + { + var args = find_in_array.arguments; + if(!args.length) return -1; + + var haystack = typeof(args[0])=='object' ? args[0] : args.length>1 && typeof(args[1])=='object' ? args[1] : new Array(); + var needle = typeof(args[0])!='object' ? args[0] : args.length>1 && typeof(args[1])!='object' ? args[1] : ''; + var nocase = args.length==3 ? args[2] : false; + + if(!haystack.length) return -1; + + for(var i=0; i | +// | Tomas V.V.Cox (port to PEAR) | +// +-----------------------------------------------------------------------+ +// +// $Id$ + +require_once('PEAR.php'); +require_once('Mail/mimePart.php'); + +/** + * Mime mail composer class. Can handle: text and html bodies, embedded html + * images and attachments. + * Documentation and examples of this class are avaible here: + * http://pear.php.net/manual/ + * + * @notes This class is based on HTML Mime Mail class from + * Richard Heyes which was based also + * in the mime_mail.class by Tobias Ratschiller and + * Sascha Schumann + * + * Function _encodeHeaders() changed by Thomas Bruederli + * in order to be read correctly by Google Gmail + * + * @author Richard Heyes + * @author Tomas V.V.Cox + * @package Mail + * @access public + */ +class Mail_mime +{ + /** + * Contains the plain text part of the email + * @var string + */ + var $_txtbody; + /** + * Contains the html part of the email + * @var string + */ + var $_htmlbody; + /** + * contains the mime encoded text + * @var string + */ + var $_mime; + /** + * contains the multipart content + * @var string + */ + var $_multipart; + /** + * list of the attached images + * @var array + */ + var $_html_images = array(); + /** + * list of the attachements + * @var array + */ + var $_parts = array(); + /** + * Build parameters + * @var array + */ + var $_build_params = array(); + /** + * Headers for the mail + * @var array + */ + var $_headers = array(); + /** + * End Of Line sequence (for serialize) + * @var string + */ + var $_eol; + + + /** + * Constructor function + * + * @access public + */ + function Mail_mime($crlf = "\r\n") + { + $this->_setEOL($crlf); + $this->_build_params = array( + 'text_encoding' => '7bit', + 'html_encoding' => 'quoted-printable', + '7bit_wrap' => 998, + 'html_charset' => 'ISO-8859-1', + 'text_charset' => 'ISO-8859-1', + 'head_charset' => 'ISO-8859-1' + ); + } + + /** + * Wakeup (unserialize) - re-sets EOL constant + * + * @access private + */ + function __wakeup() + { + $this->_setEOL($this->_eol); + } + + /** + * Accessor function to set the body text. Body text is used if + * it's not an html mail being sent or else is used to fill the + * text/plain part that emails clients who don't support + * html should show. + * + * @param string $data Either a string or + * the file name with the contents + * @param bool $isfile If true the first param should be treated + * as a file name, else as a string (default) + * @param bool $append If true the text or file is appended to + * the existing body, else the old body is + * overwritten + * @return mixed true on success or PEAR_Error object + * @access public + */ + function setTXTBody($data, $isfile = false, $append = false) + { + if (!$isfile) { + if (!$append) { + $this->_txtbody = $data; + } else { + $this->_txtbody .= $data; + } + } else { + $cont = $this->_file2str($data); + if (PEAR::isError($cont)) { + return $cont; + } + if (!$append) { + $this->_txtbody = $cont; + } else { + $this->_txtbody .= $cont; + } + } + return true; + } + + /** + * Adds a html part to the mail + * + * @param string $data Either a string or the file name with the + * contents + * @param bool $isfile If true the first param should be treated + * as a file name, else as a string (default) + * @return mixed true on success or PEAR_Error object + * @access public + */ + function setHTMLBody($data, $isfile = false) + { + if (!$isfile) { + $this->_htmlbody = $data; + } else { + $cont = $this->_file2str($data); + if (PEAR::isError($cont)) { + return $cont; + } + $this->_htmlbody = $cont; + } + + return true; + } + + /** + * Adds an image to the list of embedded images. + * + * @param string $file The image file name OR image data itself + * @param string $c_type The content type + * @param string $name The filename of the image. + * Only use if $file is the image data + * @param bool $isfilename Whether $file is a filename or not + * Defaults to true + * @return mixed true on success or PEAR_Error object + * @access public + */ + function addHTMLImage($file, $c_type='application/octet-stream', + $name = '', $isfilename = true) + { + $filedata = ($isfilename === true) ? $this->_file2str($file) + : $file; + if ($isfilename === true) { + $filename = ($name == '' ? basename($file) : basename($name)); + } else { + $filename = basename($name); + } + if (PEAR::isError($filedata)) { + return $filedata; + } + $this->_html_images[] = array( + 'body' => $filedata, + 'name' => $filename, + 'c_type' => $c_type, + 'cid' => md5(uniqid(time())) + ); + return true; + } + + /** + * Adds a file to the list of attachments. + * + * @param string $file The file name of the file to attach + * OR the file data itself + * @param string $c_type The content type + * @param string $name The filename of the attachment + * Only use if $file is the file data + * @param bool $isFilename Whether $file is a filename or not + * Defaults to true + * @return mixed true on success or PEAR_Error object + * @access public + */ + function addAttachment($file, $c_type = 'application/octet-stream', + $name = '', $isfilename = true, + $encoding = 'base64') + { + $filedata = ($isfilename === true) ? $this->_file2str($file) + : $file; + if ($isfilename === true) { + // Force the name the user supplied, otherwise use $file + $filename = (!empty($name)) ? $name : $file; + } else { + $filename = $name; + } + if (empty($filename)) { + return PEAR::raiseError( + 'The supplied filename for the attachment can\'t be empty' + ); + } + $filename = basename($filename); + if (PEAR::isError($filedata)) { + return $filedata; + } + + $this->_parts[] = array( + 'body' => $filedata, + 'name' => $filename, + 'c_type' => $c_type, + 'encoding' => $encoding + ); + return true; + } + + /** + * Get the contents of the given file name as string + * + * @param string $file_name path of file to process + * @return string contents of $file_name + * @access private + */ + function &_file2str($file_name) + { + if (!is_readable($file_name)) { + return PEAR::raiseError('File is not readable ' . $file_name); + } + if (!$fd = fopen($file_name, 'rb')) { + return PEAR::raiseError('Could not open ' . $file_name); + } + $cont = fread($fd, filesize($file_name)); + fclose($fd); + return $cont; + } + + /** + * Adds a text subpart to the mimePart object and + * returns it during the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @param string The text to add. + * @return object The text mimePart object + * @access private + */ + function &_addTextPart(&$obj, $text) + { + $params['content_type'] = 'text/plain'; + $params['encoding'] = $this->_build_params['text_encoding']; + $params['charset'] = $this->_build_params['text_charset']; + if (is_object($obj)) { + return $obj->addSubpart($text, $params); + } else { + return new Mail_mimePart($text, $params); + } + } + + /** + * Adds a html subpart to the mimePart object and + * returns it during the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @return object The html mimePart object + * @access private + */ + function &_addHtmlPart(&$obj) + { + $params['content_type'] = 'text/html'; + $params['encoding'] = $this->_build_params['html_encoding']; + $params['charset'] = $this->_build_params['html_charset']; + if (is_object($obj)) { + return $obj->addSubpart($this->_htmlbody, $params); + } else { + return new Mail_mimePart($this->_htmlbody, $params); + } + } + + /** + * Creates a new mimePart object, using multipart/mixed as + * the initial content-type and returns it during the + * build process. + * + * @return object The multipart/mixed mimePart object + * @access private + */ + function &_addMixedPart() + { + $params['content_type'] = 'multipart/mixed'; + return new Mail_mimePart('', $params); + } + + /** + * Adds a multipart/alternative part to a mimePart + * object (or creates one), and returns it during + * the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @return object The multipart/mixed mimePart object + * @access private + */ + function &_addAlternativePart(&$obj) + { + $params['content_type'] = 'multipart/alternative'; + if (is_object($obj)) { + return $obj->addSubpart('', $params); + } else { + return new Mail_mimePart('', $params); + } + } + + /** + * Adds a multipart/related part to a mimePart + * object (or creates one), and returns it during + * the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created + * @return object The multipart/mixed mimePart object + * @access private + */ + function &_addRelatedPart(&$obj) + { + $params['content_type'] = 'multipart/related'; + if (is_object($obj)) { + return $obj->addSubpart('', $params); + } else { + return new Mail_mimePart('', $params); + } + } + + /** + * Adds an html image subpart to a mimePart object + * and returns it during the build process. + * + * @param object The mimePart to add the image to + * @param array The image information + * @return object The image mimePart object + * @access private + */ + function &_addHtmlImagePart(&$obj, $value) + { + $params['content_type'] = $value['c_type']; + $params['encoding'] = 'base64'; + $params['disposition'] = 'inline'; + $params['dfilename'] = $value['name']; + $params['cid'] = $value['cid']; + $obj->addSubpart($value['body'], $params); + } + + /** + * Adds an attachment subpart to a mimePart object + * and returns it during the build process. + * + * @param object The mimePart to add the image to + * @param array The attachment information + * @return object The image mimePart object + * @access private + */ + function &_addAttachmentPart(&$obj, $value) + { + $params['content_type'] = $value['c_type']; + $params['encoding'] = $value['encoding']; + $params['disposition'] = 'attachment'; + $params['dfilename'] = $value['name']; + $obj->addSubpart($value['body'], $params); + } + + /** + * Builds the multipart message from the list ($this->_parts) and + * returns the mime content. + * + * @param array Build parameters that change the way the email + * is built. Should be associative. Can contain: + * text_encoding - What encoding to use for plain text + * Default is 7bit + * html_encoding - What encoding to use for html + * Default is quoted-printable + * 7bit_wrap - Number of characters before text is + * wrapped in 7bit encoding + * Default is 998 + * html_charset - The character set to use for html. + * Default is iso-8859-1 + * text_charset - The character set to use for text. + * Default is iso-8859-1 + * head_charset - The character set to use for headers. + * Default is iso-8859-1 + * @return string The mime content + * @access public + */ + function &get($build_params = null) + { + if (isset($build_params)) { + while (list($key, $value) = each($build_params)) { + $this->_build_params[$key] = $value; + } + } + + if (!empty($this->_html_images) AND isset($this->_htmlbody)) { + foreach ($this->_html_images as $value) { + $regex = '#src\s*=\s*(["\']?)' . preg_quote($value['name']) . + '(["\'])?#'; + $rep = 'src=\1cid:' . $value['cid'] .'\2'; + $this->_htmlbody = preg_replace($regex, $rep, + $this->_htmlbody + ); + } + } + + $null = null; + $attachments = !empty($this->_parts) ? true : false; + $html_images = !empty($this->_html_images) ? true : false; + $html = !empty($this->_htmlbody) ? true : false; + $text = (!$html AND !empty($this->_txtbody)) ? true : false; + + switch (true) { + case $text AND !$attachments: + $message =& $this->_addTextPart($null, $this->_txtbody); + break; + + case !$text AND !$html AND $attachments: + $message =& $this->_addMixedPart(); + for ($i = 0; $i < count($this->_parts); $i++) { + $this->_addAttachmentPart($message, $this->_parts[$i]); + } + break; + + case $text AND $attachments: + $message =& $this->_addMixedPart(); + $this->_addTextPart($message, $this->_txtbody); + for ($i = 0; $i < count($this->_parts); $i++) { + $this->_addAttachmentPart($message, $this->_parts[$i]); + } + break; + + case $html AND !$attachments AND !$html_images: + if (isset($this->_txtbody)) { + $message =& $this->_addAlternativePart($null); + $this->_addTextPart($message, $this->_txtbody); + $this->_addHtmlPart($message); + } else { + $message =& $this->_addHtmlPart($null); + } + break; + + case $html AND !$attachments AND $html_images: + if (isset($this->_txtbody)) { + $message =& $this->_addAlternativePart($null); + $this->_addTextPart($message, $this->_txtbody); + $related =& $this->_addRelatedPart($message); + } else { + $message =& $this->_addRelatedPart($null); + $related =& $message; + } + $this->_addHtmlPart($related); + for ($i = 0; $i < count($this->_html_images); $i++) { + $this->_addHtmlImagePart($related, $this->_html_images[$i]); + } + break; + + case $html AND $attachments AND !$html_images: + $message =& $this->_addMixedPart(); + if (isset($this->_txtbody)) { + $alt =& $this->_addAlternativePart($message); + $this->_addTextPart($alt, $this->_txtbody); + $this->_addHtmlPart($alt); + } else { + $this->_addHtmlPart($message); + } + for ($i = 0; $i < count($this->_parts); $i++) { + $this->_addAttachmentPart($message, $this->_parts[$i]); + } + break; + + case $html AND $attachments AND $html_images: + $message =& $this->_addMixedPart(); + if (isset($this->_txtbody)) { + $alt =& $this->_addAlternativePart($message); + $this->_addTextPart($alt, $this->_txtbody); + $rel =& $this->_addRelatedPart($alt); + } else { + $rel =& $this->_addRelatedPart($message); + } + $this->_addHtmlPart($rel); + for ($i = 0; $i < count($this->_html_images); $i++) { + $this->_addHtmlImagePart($rel, $this->_html_images[$i]); + } + for ($i = 0; $i < count($this->_parts); $i++) { + $this->_addAttachmentPart($message, $this->_parts[$i]); + } + break; + + } + + if (isset($message)) { + $output = $message->encode(); + $this->_headers = array_merge($this->_headers, + $output['headers']); + return $output['body']; + + } else { + return false; + } + } + + /** + * Returns an array with the headers needed to prepend to the email + * (MIME-Version and Content-Type). Format of argument is: + * $array['header-name'] = 'header-value'; + * + * @param array $xtra_headers Assoc array with any extra headers. + * Optional. + * @return array Assoc array with the mime headers + * @access public + */ + function &headers($xtra_headers = null) + { + // Content-Type header should already be present, + // So just add mime version header + $headers['MIME-Version'] = '1.0'; + if (isset($xtra_headers)) { + $headers = array_merge($headers, $xtra_headers); + } + $this->_headers = array_merge($headers, $this->_headers); + + return $this->_encodeHeaders($this->_headers); + } + + /** + * Get the text version of the headers + * (usefull if you want to use the PHP mail() function) + * + * @param array $xtra_headers Assoc array with any extra headers. + * Optional. + * @return string Plain text headers + * @access public + */ + function txtHeaders($xtra_headers = null) + { + $headers = $this->headers($xtra_headers); + $ret = ''; + foreach ($headers as $key => $val) { + $ret .= "$key: $val" . MAIL_MIME_CRLF; + } + return $ret; + } + + /** + * Sets the Subject header + * + * @param string $subject String to set the subject to + * access public + */ + function setSubject($subject) + { + $this->_headers['Subject'] = $subject; + } + + /** + * Set an email to the From (the sender) header + * + * @param string $email The email direction to add + * @access public + */ + function setFrom($email) + { + $this->_headers['From'] = $email; + } + + /** + * Add an email to the Cc (carbon copy) header + * (multiple calls to this method are allowed) + * + * @param string $email The email direction to add + * @access public + */ + function addCc($email) + { + if (isset($this->_headers['Cc'])) { + $this->_headers['Cc'] .= ", $email"; + } else { + $this->_headers['Cc'] = $email; + } + } + + /** + * Add an email to the Bcc (blank carbon copy) header + * (multiple calls to this method are allowed) + * + * @param string $email The email direction to add + * @access public + */ + function addBcc($email) + { + if (isset($this->_headers['Bcc'])) { + $this->_headers['Bcc'] .= ", $email"; + } else { + $this->_headers['Bcc'] = $email; + } + } + + /** + * Encodes a header as per RFC2047 + * + * @param string $input The header data to encode + * @return string Encoded data + * @access private + */ + function _encodeHeaders($input) + { + $enc_prefix = '=?' . $this->_build_params['head_charset'] . '?Q?'; + foreach ($input as $hdr_name => $hdr_value) { + if (preg_match('/(\w*[\x80-\xFF]+\w*)/', $hdr_value)) { + $enc_value = preg_replace('/([\x80-\xFF])/e', '"=".strtoupper(dechex(ord("\1")))', $hdr_value); + // check for in string + if (preg_match('/<[a-z0-9\-\.\+\_]+@[a-z0-9]([a-z0-9\-].?)*[a-z0-9]\\.[a-z]{2,5}>/i', $enc_value) && ($p = strrpos($enc_value, '<'))) { + $hdr_value = $enc_prefix . substr($enc_value, 0, $p-1) . '?= ' . substr($enc_value, $p, strlen($enc_value)-$p); + } else { + $hdr_value = $enc_prefix . $enc_value . '?='; + } + } + $input[$hdr_name] = $hdr_value; + } + + return $input; + } + + /* replaced 2005/07/08 by roundcube@gmail.com + + function _encodeHeaders_old($input) + { + foreach ($input as $hdr_name => $hdr_value) { + preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $hdr_value, $matches); + foreach ($matches[1] as $value) { + $replacement = preg_replace('/([\x80-\xFF])/e', + '"=" . + strtoupper(dechex(ord("\1")))', + $value); + $hdr_value = str_replace($value, '=?' . + $this->_build_params['head_charset'] . + '?Q?' . $replacement . '?=', + $hdr_value); + } + $input[$hdr_name] = $hdr_value; + } + + return $input; + } + */ + + /** + * Set the object's end-of-line and define the constant if applicable + * + * @param string $eol End Of Line sequence + * @access private + */ + function _setEOL($eol) + { + $this->_eol = $eol; + if (!defined('MAIL_MIME_CRLF')) { + define('MAIL_MIME_CRLF', $this->_eol, true); + } + } + + + +} // End of class +?> diff --git a/program/lib/Mail/mimeDecode.php b/program/lib/Mail/mimeDecode.php new file mode 100644 index 000000000..92827b727 --- /dev/null +++ b/program/lib/Mail/mimeDecode.php @@ -0,0 +1,842 @@ + | +// +-----------------------------------------------------------------------+ + +require_once 'PEAR.php'; + +/** +* +----------------------------- IMPORTANT ------------------------------+ +* | Usage of this class compared to native php extensions such as | +* | mailparse or imap, is slow and may be feature deficient. If available| +* | you are STRONGLY recommended to use the php extensions. | +* +----------------------------------------------------------------------+ +* +* Mime Decoding class +* +* This class will parse a raw mime email and return +* the structure. Returned structure is similar to +* that returned by imap_fetchstructure(). +* +* USAGE: (assume $input is your raw email) +* +* $decode = new Mail_mimeDecode($input, "\r\n"); +* $structure = $decode->decode(); +* print_r($structure); +* +* Or statically: +* +* $params['input'] = $input; +* $structure = Mail_mimeDecode::decode($params); +* print_r($structure); +* +* TODO: +* o Implement multipart/appledouble +* o UTF8: ??? + + > 4. We have also found a solution for decoding the UTF-8 + > headers. Therefore I made the following function: + > + > function decode_utf8($txt) { + > $trans=array("Å‘"=>"õ","ű"=>"û","Å"=>"Õ","Å°" + =>"Û"); + > $txt=strtr($txt,$trans); + > return(utf8_decode($txt)); + > } + > + > And I have inserted the following line to the class: + > + > if (strtolower($charset)=="utf-8") $text=decode_utf8($text); + > + > ... before the following one in the "_decodeHeader" function: + > + > $input = str_replace($encoded, $text, $input); + > + > This way from now on it can easily decode the UTF-8 headers too. + +* +* @author Richard Heyes +* @version $Revision$ +* @package Mail +*/ +class Mail_mimeDecode extends PEAR +{ + /** + * The raw email to decode + * @var string + */ + var $_input; + + /** + * The header part of the input + * @var string + */ + var $_header; + + /** + * The body part of the input + * @var string + */ + var $_body; + + /** + * If an error occurs, this is used to store the message + * @var string + */ + var $_error; + + /** + * Flag to determine whether to include bodies in the + * returned object. + * @var boolean + */ + var $_include_bodies; + + /** + * Flag to determine whether to decode bodies + * @var boolean + */ + var $_decode_bodies; + + /** + * Flag to determine whether to decode headers + * @var boolean + */ + var $_decode_headers; + + /** + * Constructor. + * + * Sets up the object, initialise the variables, and splits and + * stores the header and body of the input. + * + * @param string The input to decode + * @access public + */ + function Mail_mimeDecode($input) + { + list($header, $body) = $this->_splitBodyHeader($input); + + $this->_input = $input; + $this->_header = $header; + $this->_body = $body; + $this->_decode_bodies = false; + $this->_include_bodies = true; + } + + /** + * Begins the decoding process. If called statically + * it will create an object and call the decode() method + * of it. + * + * @param array An array of various parameters that determine + * various things: + * include_bodies - Whether to include the body in the returned + * object. + * decode_bodies - Whether to decode the bodies + * of the parts. (Transfer encoding) + * decode_headers - Whether to decode headers + * input - If called statically, this will be treated + * as the input + * @return object Decoded results + * @access public + */ + function decode($params = null) + { + // determine if this method has been called statically + $isStatic = !(isset($this) && get_class($this) == __CLASS__); + + // Have we been called statically? + // If so, create an object and pass details to that. + if ($isStatic AND isset($params['input'])) { + + $obj = new Mail_mimeDecode($params['input']); + $structure = $obj->decode($params); + + // Called statically but no input + } elseif ($isStatic) { + return PEAR::raiseError('Called statically and no input given'); + + // Called via an object + } else { + $this->_include_bodies = isset($params['include_bodies']) ? + $params['include_bodies'] : false; + $this->_decode_bodies = isset($params['decode_bodies']) ? + $params['decode_bodies'] : false; + $this->_decode_headers = isset($params['decode_headers']) ? + $params['decode_headers'] : false; + + $structure = $this->_decode($this->_header, $this->_body); + if ($structure === false) { + $structure = $this->raiseError($this->_error); + } + } + + return $structure; + } + + /** + * Performs the decoding. Decodes the body string passed to it + * If it finds certain content-types it will call itself in a + * recursive fashion + * + * @param string Header section + * @param string Body section + * @return object Results of decoding process + * @access private + */ + function _decode($headers, $body, $default_ctype = 'text/plain') + { + $return = new stdClass; + $return->headers = array(); + $headers = $this->_parseHeaders($headers); + + foreach ($headers as $value) { + if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) { + $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]); + $return->headers[strtolower($value['name'])][] = $value['value']; + + } elseif (isset($return->headers[strtolower($value['name'])])) { + $return->headers[strtolower($value['name'])][] = $value['value']; + + } else { + $return->headers[strtolower($value['name'])] = $value['value']; + } + } + + reset($headers); + while (list($key, $value) = each($headers)) { + $headers[$key]['name'] = strtolower($headers[$key]['name']); + switch ($headers[$key]['name']) { + + case 'content-type': + $content_type = $this->_parseHeaderValue($headers[$key]['value']); + + if (preg_match('/([0-9a-z+.-]+)\/([0-9a-z+.-]+)/i', $content_type['value'], $regs)) { + $return->ctype_primary = $regs[1]; + $return->ctype_secondary = $regs[2]; + } + + if (isset($content_type['other'])) { + while (list($p_name, $p_value) = each($content_type['other'])) { + $return->ctype_parameters[$p_name] = $p_value; + } + } + break; + + case 'content-disposition': + $content_disposition = $this->_parseHeaderValue($headers[$key]['value']); + $return->disposition = $content_disposition['value']; + if (isset($content_disposition['other'])) { + while (list($p_name, $p_value) = each($content_disposition['other'])) { + $return->d_parameters[$p_name] = $p_value; + } + } + break; + + case 'content-transfer-encoding': + $content_transfer_encoding = $this->_parseHeaderValue($headers[$key]['value']); + break; + } + } + + if (isset($content_type)) { + switch (strtolower($content_type['value'])) { + case 'text/plain': + $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; + $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null; + break; + + case 'text/html': + $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; + $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null; + break; + + case 'multipart/parallel': + case 'multipart/report': // RFC1892 + case 'multipart/signed': // PGP + case 'multipart/digest': + case 'multipart/alternative': + case 'multipart/related': + case 'multipart/mixed': + if(!isset($content_type['other']['boundary'])){ + $this->_error = 'No boundary found for ' . $content_type['value'] . ' part'; + return false; + } + + $default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain'; + $parts = $this->_boundarySplit($body, $content_type['other']['boundary']); + for ($i = 0; $i < count($parts); $i++) { + list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]); + $part = $this->_decode($part_header, $part_body, $default_ctype); + if($part === false) + $part = $this->raiseError($this->_error); + $return->parts[] = $part; + } + break; + + case 'message/rfc822': + $obj = &new Mail_mimeDecode($body); + $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies, + 'decode_bodies' => $this->_decode_bodies, + 'decode_headers' => $this->_decode_headers)); + unset($obj); + break; + + default: + if(!isset($content_transfer_encoding['value'])) + $content_transfer_encoding['value'] = '7bit'; + $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $content_transfer_encoding['value']) : $body) : null; + break; + } + + } else { + $ctype = explode('/', $default_ctype); + $return->ctype_primary = $ctype[0]; + $return->ctype_secondary = $ctype[1]; + $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body) : $body) : null; + } + + return $return; + } + + /** + * Given the output of the above function, this will return an + * array of references to the parts, indexed by mime number. + * + * @param object $structure The structure to go through + * @param string $mime_number Internal use only. + * @return array Mime numbers + */ + function &getMimeNumbers(&$structure, $no_refs = false, $mime_number = '', $prepend = '') + { + $return = array(); + if (!empty($structure->parts)) { + if ($mime_number != '') { + $structure->mime_id = $prepend . $mime_number; + $return[$prepend . $mime_number] = &$structure; + } + for ($i = 0; $i < count($structure->parts); $i++) { + + + if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') { + $prepend = $prepend . $mime_number . '.'; + $_mime_number = ''; + } else { + $_mime_number = ($mime_number == '' ? $i + 1 : sprintf('%s.%s', $mime_number, $i + 1)); + } + + $arr = &Mail_mimeDecode::getMimeNumbers($structure->parts[$i], $no_refs, $_mime_number, $prepend); + foreach ($arr as $key => $val) { + $no_refs ? $return[$key] = '' : $return[$key] = &$arr[$key]; + } + } + } else { + if ($mime_number == '') { + $mime_number = '1'; + } + $structure->mime_id = $prepend . $mime_number; + $no_refs ? $return[$prepend . $mime_number] = '' : $return[$prepend . $mime_number] = &$structure; + } + + return $return; + } + + /** + * Given a string containing a header and body + * section, this function will split them (at the first + * blank line) and return them. + * + * @param string Input to split apart + * @return array Contains header and body section + * @access private + */ + function _splitBodyHeader($input) + { + if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) { + return array($match[1], $match[2]); + } + $this->_error = 'Could not split header and body'; + return false; + } + + /** + * Parse headers given in $input and return + * as assoc array. + * + * @param string Headers to parse + * @return array Contains parsed headers + * @access private + */ + function _parseHeaders($input) + { + + if ($input !== '') { + // Unfold the input + $input = preg_replace("/\r?\n/", "\r\n", $input); + $input = preg_replace("/\r\n(\t| )+/", ' ', $input); + $headers = explode("\r\n", trim($input)); + + foreach ($headers as $value) { + $hdr_name = substr($value, 0, $pos = strpos($value, ':')); + $hdr_value = substr($value, $pos+1); + if($hdr_value[0] == ' ') + $hdr_value = substr($hdr_value, 1); + + $return[] = array( + 'name' => $hdr_name, + 'value' => $this->_decode_headers ? $this->_decodeHeader($hdr_value) : $hdr_value + ); + } + } else { + $return = array(); + } + + return $return; + } + + /** + * Function to parse a header value, + * extract first part, and any secondary + * parts (after ;) This function is not as + * robust as it could be. Eg. header comments + * in the wrong place will probably break it. + * + * @param string Header value to parse + * @return array Contains parsed result + * @access private + */ + function _parseHeaderValue($input) + { + + if (($pos = strpos($input, ';')) !== false) { + + $return['value'] = trim(substr($input, 0, $pos)); + $input = trim(substr($input, $pos+1)); + + if (strlen($input) > 0) { + + // This splits on a semi-colon, if there's no preceeding backslash + // Now works with quoted values; had to glue the \; breaks in PHP + // the regex is already bordering on incomprehensible + $splitRegex = '/([^;\'"]*[\'"]([^\'"]*([^\'"]*)*)[\'"][^;\'"]*|([^;]+))(;|$)/'; + preg_match_all($splitRegex, $input, $matches); + $parameters = array(); + for ($i=0; $i_quotedPrintableDecode($input); + break; + + case 'base64': + return base64_decode($input); + break; + + default: + return $input; + } + } + + /** + * Given a quoted-printable string, this + * function will decode and return it. + * + * @param string Input body to decode + * @return string Decoded body + * @access private + */ + function _quotedPrintableDecode($input) + { + // Remove soft line breaks + $input = preg_replace("/=\r?\n/", '', $input); + + // Replace encoded characters + $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input); + + return $input; + } + + /** + * Checks the input for uuencoded files and returns + * an array of them. Can be called statically, eg: + * + * $files =& Mail_mimeDecode::uudecode($some_text); + * + * It will check for the begin 666 ... end syntax + * however and won't just blindly decode whatever you + * pass it. + * + * @param string Input body to look for attahcments in + * @return array Decoded bodies, filenames and permissions + * @access public + * @author Unknown + */ + function &uudecode($input) + { + // Find all uuencoded sections + preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches); + + for ($j = 0; $j < count($matches[3]); $j++) { + + $str = $matches[3][$j]; + $filename = $matches[2][$j]; + $fileperm = $matches[1][$j]; + + $file = ''; + $str = preg_split("/\r?\n/", trim($str)); + $strlen = count($str); + + for ($i = 0; $i < $strlen; $i++) { + $pos = 1; + $d = 0; + $len=(int)(((ord(substr($str[$i],0,1)) -32) - ' ') & 077); + + while (($d + 3 <= $len) AND ($pos + 4 <= strlen($str[$i]))) { + $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); + $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); + $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20); + $c3 = (ord(substr($str[$i],$pos+3,1)) ^ 0x20); + $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); + + $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2)); + + $file .= chr(((($c2 - ' ') & 077) << 6) | (($c3 - ' ') & 077)); + + $pos += 4; + $d += 3; + } + + if (($d + 2 <= $len) && ($pos + 3 <= strlen($str[$i]))) { + $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); + $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); + $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20); + $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); + + $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2)); + + $pos += 3; + $d += 2; + } + + if (($d + 1 <= $len) && ($pos + 2 <= strlen($str[$i]))) { + $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); + $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); + $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); + + } + } + $files[] = array('filename' => $filename, 'fileperm' => $fileperm, 'filedata' => $file); + } + + return $files; + } + + /** + * getSendArray() returns the arguments required for Mail::send() + * used to build the arguments for a mail::send() call + * + * Usage: + * $mailtext = Full email (for example generated by a template) + * $decoder = new Mail_mimeDecode($mailtext); + * $parts = $decoder->getSendArray(); + * if (!PEAR::isError($parts) { + * list($recipents,$headers,$body) = $parts; + * $mail = Mail::factory('smtp'); + * $mail->send($recipents,$headers,$body); + * } else { + * echo $parts->message; + * } + * @return mixed array of recipeint, headers,body or Pear_Error + * @access public + * @author Alan Knowles + */ + function getSendArray() + { + // prevent warning if this is not set + $this->_decode_headers = FALSE; + $headerlist =$this->_parseHeaders($this->_header); + $to = ""; + if (!$headerlist) { + return $this->raiseError("Message did not contain headers"); + } + foreach($headerlist as $item) { + $header[$item['name']] = $item['value']; + switch (strtolower($item['name'])) { + case "to": + case "cc": + case "bcc": + $to = ",".$item['value']; + default: + break; + } + } + if ($to == "") { + return $this->raiseError("Message did not contain any recipents"); + } + $to = substr($to,1); + return array($to,$header,$this->_body); + } + + /** + * Returns a xml copy of the output of + * Mail_mimeDecode::decode. Pass the output in as the + * argument. This function can be called statically. Eg: + * + * $output = $obj->decode(); + * $xml = Mail_mimeDecode::getXML($output); + * + * The DTD used for this should have been in the package. Or + * alternatively you can get it from cvs, or here: + * http://www.phpguru.org/xmail/xmail.dtd. + * + * @param object Input to convert to xml. This should be the + * output of the Mail_mimeDecode::decode function + * @return string XML version of input + * @access public + */ + function getXML($input) + { + $crlf = "\r\n"; + $output = '' . $crlf . + '' . $crlf . + '' . $crlf . + Mail_mimeDecode::_getXML($input) . + ''; + + return $output; + } + + /** + * Function that does the actual conversion to xml. Does a single + * mimepart at a time. + * + * @param object Input to convert to xml. This is a mimepart object. + * It may or may not contain subparts. + * @param integer Number of tabs to indent + * @return string XML version of input + * @access private + */ + function _getXML($input, $indent = 1) + { + $htab = "\t"; + $crlf = "\r\n"; + $output = ''; + $headers = @(array)$input->headers; + + foreach ($headers as $hdr_name => $hdr_value) { + + // Multiple headers with this name + if (is_array($headers[$hdr_name])) { + for ($i = 0; $i < count($hdr_value); $i++) { + $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent); + } + + // Only one header of this sort + } else { + $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value, $indent); + } + } + + if (!empty($input->parts)) { + for ($i = 0; $i < count($input->parts); $i++) { + $output .= $crlf . str_repeat($htab, $indent) . '' . $crlf . + Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) . + str_repeat($htab, $indent) . '' . $crlf; + } + } elseif (isset($input->body)) { + $output .= $crlf . str_repeat($htab, $indent) . 'body . ']]>' . $crlf; + } + + return $output; + } + + /** + * Helper function to _getXML(). Returns xml of a header. + * + * @param string Name of header + * @param string Value of header + * @param integer Number of tabs to indent + * @return string XML version of input + * @access private + */ + function _getXML_helper($hdr_name, $hdr_value, $indent) + { + $htab = "\t"; + $crlf = "\r\n"; + $return = ''; + + $new_hdr_value = ($hdr_name != 'received') ? Mail_mimeDecode::_parseHeaderValue($hdr_value) : array('value' => $hdr_value); + $new_hdr_name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $hdr_name))); + + // Sort out any parameters + if (!empty($new_hdr_value['other'])) { + foreach ($new_hdr_value['other'] as $paramname => $paramvalue) { + $params[] = str_repeat($htab, $indent) . $htab . '' . $crlf . + str_repeat($htab, $indent) . $htab . $htab . '' . htmlspecialchars($paramname) . '' . $crlf . + str_repeat($htab, $indent) . $htab . $htab . '' . htmlspecialchars($paramvalue) . '' . $crlf . + str_repeat($htab, $indent) . $htab . '' . $crlf; + } + + $params = implode('', $params); + } else { + $params = ''; + } + + $return = str_repeat($htab, $indent) . '
' . $crlf . + str_repeat($htab, $indent) . $htab . '' . htmlspecialchars($new_hdr_name) . '' . $crlf . + str_repeat($htab, $indent) . $htab . '' . htmlspecialchars($new_hdr_value['value']) . '' . $crlf . + $params . + str_repeat($htab, $indent) . '
' . $crlf; + + return $return; + } + +} // End of class +?> diff --git a/program/lib/Mail/mimePart.php b/program/lib/Mail/mimePart.php new file mode 100644 index 000000000..b429b905e --- /dev/null +++ b/program/lib/Mail/mimePart.php @@ -0,0 +1,351 @@ + | +// +-----------------------------------------------------------------------+ + +/** +* +* Raw mime encoding class +* +* What is it? +* This class enables you to manipulate and build +* a mime email from the ground up. +* +* Why use this instead of mime.php? +* mime.php is a userfriendly api to this class for +* people who aren't interested in the internals of +* mime mail. This class however allows full control +* over the email. +* +* Eg. +* +* // Since multipart/mixed has no real body, (the body is +* // the subpart), we set the body argument to blank. +* +* $params['content_type'] = 'multipart/mixed'; +* $email = new Mail_mimePart('', $params); +* +* // Here we add a text part to the multipart we have +* // already. Assume $body contains plain text. +* +* $params['content_type'] = 'text/plain'; +* $params['encoding'] = '7bit'; +* $text = $email->addSubPart($body, $params); +* +* // Now add an attachment. Assume $attach is +* the contents of the attachment +* +* $params['content_type'] = 'application/zip'; +* $params['encoding'] = 'base64'; +* $params['disposition'] = 'attachment'; +* $params['dfilename'] = 'example.zip'; +* $attach =& $email->addSubPart($body, $params); +* +* // Now build the email. Note that the encode +* // function returns an associative array containing two +* // elements, body and headers. You will need to add extra +* // headers, (eg. Mime-Version) before sending. +* +* $email = $message->encode(); +* $email['headers'][] = 'Mime-Version: 1.0'; +* +* +* Further examples are available at http://www.phpguru.org +* +* TODO: +* - Set encode() to return the $obj->encoded if encode() +* has already been run. Unless a flag is passed to specifically +* re-build the message. +* +* @author Richard Heyes +* @version $Revision$ +* @package Mail +*/ + +class Mail_mimePart { + + /** + * The encoding type of this part + * @var string + */ + var $_encoding; + + /** + * An array of subparts + * @var array + */ + var $_subparts; + + /** + * The output of this part after being built + * @var string + */ + var $_encoded; + + /** + * Headers for this part + * @var array + */ + var $_headers; + + /** + * The body of this part (not encoded) + * @var string + */ + var $_body; + + /** + * Constructor. + * + * Sets up the object. + * + * @param $body - The body of the mime part if any. + * @param $params - An associative array of parameters: + * content_type - The content type for this part eg multipart/mixed + * encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable + * cid - Content ID to apply + * disposition - Content disposition, inline or attachment + * dfilename - Optional filename parameter for content disposition + * description - Content description + * charset - Character set to use + * @access public + */ + function Mail_mimePart($body = '', $params = array()) + { + if (!defined('MAIL_MIMEPART_CRLF')) { + define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); + } + + foreach ($params as $key => $value) { + switch ($key) { + case 'content_type': + $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); + break; + + case 'encoding': + $this->_encoding = $value; + $headers['Content-Transfer-Encoding'] = $value; + break; + + case 'cid': + $headers['Content-ID'] = '<' . $value . '>'; + break; + + case 'disposition': + $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : ''); + break; + + case 'dfilename': + if (isset($headers['Content-Disposition'])) { + $headers['Content-Disposition'] .= '; filename="' . $value . '"'; + } else { + $dfilename = $value; + } + break; + + case 'description': + $headers['Content-Description'] = $value; + break; + + case 'charset': + if (isset($headers['Content-Type'])) { + $headers['Content-Type'] .= '; charset="' . $value . '"'; + } else { + $charset = $value; + } + break; + } + } + + // Default content-type + if (!isset($headers['Content-Type'])) { + $headers['Content-Type'] = 'text/plain'; + } + + //Default encoding + if (!isset($this->_encoding)) { + $this->_encoding = '7bit'; + } + + // Assign stuff to member variables + $this->_encoded = array(); + $this->_headers = $headers; + $this->_body = $body; + } + + /** + * encode() + * + * Encodes and returns the email. Also stores + * it in the encoded member variable + * + * @return An associative array containing two elements, + * body and headers. The headers element is itself + * an indexed array. + * @access public + */ + function encode() + { + $encoded =& $this->_encoded; + + if (!empty($this->_subparts)) { + srand((double)microtime()*1000000); + $boundary = '=_' . md5(rand() . microtime()); + $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"'; + + // Add body parts to $subparts + for ($i = 0; $i < count($this->_subparts); $i++) { + $headers = array(); + $tmp = $this->_subparts[$i]->encode(); + foreach ($tmp['headers'] as $key => $value) { + $headers[] = $key . ': ' . $value; + } + $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body']; + } + + $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF . + implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) . + '--' . $boundary.'--' . MAIL_MIMEPART_CRLF; + + } else { + $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . MAIL_MIMEPART_CRLF; + } + + // Add headers to $encoded + $encoded['headers'] =& $this->_headers; + + return $encoded; + } + + /** + * &addSubPart() + * + * Adds a subpart to current mime part and returns + * a reference to it + * + * @param $body The body of the subpart, if any. + * @param $params The parameters for the subpart, same + * as the $params argument for constructor. + * @return A reference to the part you just added. It is + * crucial if using multipart/* in your subparts that + * you use =& in your script when calling this function, + * otherwise you will not be able to add further subparts. + * @access public + */ + function &addSubPart($body, $params) + { + $this->_subparts[] = new Mail_mimePart($body, $params); + return $this->_subparts[count($this->_subparts) - 1]; + } + + /** + * _getEncodedData() + * + * Returns encoded data based upon encoding passed to it + * + * @param $data The data to encode. + * @param $encoding The encoding type to use, 7bit, base64, + * or quoted-printable. + * @access private + */ + function _getEncodedData($data, $encoding) + { + switch ($encoding) { + case '8bit': + case '7bit': + return $data; + break; + + case 'quoted-printable': + return $this->_quotedPrintableEncode($data); + break; + + case 'base64': + return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF)); + break; + + default: + return $data; + } + } + + /** + * quoteadPrintableEncode() + * + * Encodes data to quoted-printable standard. + * + * @param $input The data to encode + * @param $line_max Optional max line length. Should + * not be more than 76 chars + * + * @access private + */ + function _quotedPrintableEncode($input , $line_max = 76) + { + $lines = preg_split("/\r?\n/", $input); + $eol = MAIL_MIMEPART_CRLF; + $escape = '='; + $output = ''; + + while(list(, $line) = each($lines)){ + + $linlen = strlen($line); + $newline = ''; + + for ($i = 0; $i < $linlen; $i++) { + $char = substr($line, $i, 1); + $dec = ord($char); + + if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only + $char = '=20'; + + } elseif(($dec == 9) AND ($i == ($linlen - 1))) { // convert tab at eol only + $char = '=09'; + } elseif($dec == 9) { + ; // Do nothing if a tab. + } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) { + $char = $escape . strtoupper(sprintf('%02s', dechex($dec))); + } + + if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted + $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay + $newline = ''; + } + $newline .= $char; + } // end of for + $output .= $newline . $eol; + } + $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf + return $output; + } +} // End of class +?> diff --git a/program/lib/PEAR.php b/program/lib/PEAR.php new file mode 100644 index 000000000..5b76d7540 --- /dev/null +++ b/program/lib/PEAR.php @@ -0,0 +1,927 @@ + | +// | Stig Bakken | +// | Tomas V.V.Cox | +// +----------------------------------------------------------------------+ +// +// $Id$ +// + +define('PEAR_ERROR_RETURN', 1); +define('PEAR_ERROR_PRINT', 2); +define('PEAR_ERROR_TRIGGER', 4); +define('PEAR_ERROR_DIE', 8); +define('PEAR_ERROR_CALLBACK', 16); +define('PEAR_ZE2', (function_exists('version_compare') && + version_compare(zend_version(), "2-dev", "ge"))); + +if (substr(PHP_OS, 0, 3) == 'WIN') { + define('OS_WINDOWS', true); + define('OS_UNIX', false); + define('PEAR_OS', 'Windows'); +} else { + define('OS_WINDOWS', false); + define('OS_UNIX', true); + define('PEAR_OS', 'Unix'); // blatant assumption +} + +$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; +$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; +$GLOBALS['_PEAR_destructor_object_list'] = array(); +$GLOBALS['_PEAR_shutdown_funcs'] = array(); +$GLOBALS['_PEAR_error_handler_stack'] = array(); + +ini_set('track_errors', true); + +/** + * Base class for other PEAR classes. Provides rudimentary + * emulation of destructors. + * + * If you want a destructor in your class, inherit PEAR and make a + * destructor method called _yourclassname (same name as the + * constructor, but with a "_" prefix). Also, in your constructor you + * have to call the PEAR constructor: $this->PEAR();. + * The destructor method will be called without parameters. Note that + * at in some SAPI implementations (such as Apache), any output during + * the request shutdown (in which destructors are called) seems to be + * discarded. If you need to get any debug information from your + * destructor, use error_log(), syslog() or something similar. + * + * IMPORTANT! To use the emulated destructors you need to create the + * objects by reference, ej: $obj =& new PEAR_child; + * + * @since PHP 4.0.2 + * @author Stig Bakken + * @see http://pear.php.net/manual/ + */ +class PEAR +{ + // {{{ properties + + /** + * Whether to enable internal debug messages. + * + * @var bool + * @access private + */ + var $_debug = false; + + /** + * Default error mode for this object. + * + * @var int + * @access private + */ + var $_default_error_mode = null; + + /** + * Default error options used for this object when error mode + * is PEAR_ERROR_TRIGGER. + * + * @var int + * @access private + */ + var $_default_error_options = null; + + /** + * Default error handler (callback) for this object, if error mode is + * PEAR_ERROR_CALLBACK. + * + * @var string + * @access private + */ + var $_default_error_handler = ''; + + /** + * Which class to use for error objects. + * + * @var string + * @access private + */ + var $_error_class = 'PEAR_Error'; + + /** + * An array of expected errors. + * + * @var array + * @access private + */ + var $_expected_errors = array(); + + // }}} + + // {{{ constructor + + /** + * Constructor. Registers this object in + * $_PEAR_destructor_object_list for destructor emulation if a + * destructor object exists. + * + * @param string $error_class (optional) which class to use for + * error objects, defaults to PEAR_Error. + * @access public + * @return void + */ + function PEAR($error_class = null) + { + $classname = get_class($this); + if ($this->_debug) { + print "PEAR constructor called, class=$classname\n"; + } + if ($error_class !== null) { + $this->_error_class = $error_class; + } + while ($classname) { + $destructor = "_$classname"; + if (method_exists($this, $destructor)) { + global $_PEAR_destructor_object_list; + $_PEAR_destructor_object_list[] = &$this; + break; + } else { + $classname = get_parent_class($classname); + } + } + } + + // }}} + // {{{ destructor + + /** + * Destructor (the emulated type of...). Does nothing right now, + * but is included for forward compatibility, so subclass + * destructors should always call it. + * + * See the note in the class desciption about output from + * destructors. + * + * @access public + * @return void + */ + function _PEAR() { + if ($this->_debug) { + printf("PEAR destructor called, class=%s\n", get_class($this)); + } + } + + // }}} + // {{{ getStaticProperty() + + /** + * If you have a class that's mostly/entirely static, and you need static + * properties, you can use this method to simulate them. Eg. in your method(s) + * do this: $myVar = &PEAR::getStaticProperty('myVar'); + * You MUST use a reference, or they will not persist! + * + * @access public + * @param string $class The calling classname, to prevent clashes + * @param string $var The variable to retrieve. + * @return mixed A reference to the variable. If not set it will be + * auto initialised to NULL. + */ + function &getStaticProperty($class, $var) + { + static $properties; + return $properties[$class][$var]; + } + + // }}} + // {{{ registerShutdownFunc() + + /** + * Use this function to register a shutdown method for static + * classes. + * + * @access public + * @param mixed $func The function name (or array of class/method) to call + * @param mixed $args The arguments to pass to the function + * @return void + */ + function registerShutdownFunc($func, $args = array()) + { + $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); + } + + // }}} + // {{{ isError() + + /** + * Tell whether a value is a PEAR error. + * + * @param mixed $data the value to test + * @access public + * @return bool true if parameter is an error + */ + function isError($data) { + return (bool)(is_object($data) && + (get_class($data) == 'pear_error' || + is_subclass_of($data, 'pear_error'))); + } + + // }}} + // {{{ setErrorHandling() + + /** + * Sets how errors generated by this DB object should be handled. + * Can be invoked both in objects and statically. If called + * statically, setErrorHandling sets the default behaviour for all + * PEAR objects. If called in an object, setErrorHandling sets + * the default behaviour for that object. + * + * @param int $mode + * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, + * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or + * PEAR_ERROR_CALLBACK. + * + * @param mixed $options + * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one + * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). + * + * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected + * to be the callback function or method. A callback + * function is a string with the name of the function, a + * callback method is an array of two elements: the element + * at index 0 is the object, and the element at index 1 is + * the name of the method to call in the object. + * + * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is + * a printf format string used when printing the error + * message. + * + * @access public + * @return void + * @see PEAR_ERROR_RETURN + * @see PEAR_ERROR_PRINT + * @see PEAR_ERROR_TRIGGER + * @see PEAR_ERROR_DIE + * @see PEAR_ERROR_CALLBACK + * + * @since PHP 4.0.5 + */ + + function setErrorHandling($mode = null, $options = null) + { + if (isset($this)) { + $setmode = &$this->_default_error_mode; + $setoptions = &$this->_default_error_options; + } else { + $setmode = &$GLOBALS['_PEAR_default_error_mode']; + $setoptions = &$GLOBALS['_PEAR_default_error_options']; + } + + switch ($mode) { + case PEAR_ERROR_RETURN: + case PEAR_ERROR_PRINT: + case PEAR_ERROR_TRIGGER: + case PEAR_ERROR_DIE: + case null: + $setmode = $mode; + $setoptions = $options; + break; + + case PEAR_ERROR_CALLBACK: + $setmode = $mode; + if ((is_string($options) && function_exists($options)) || + (is_array($options) && method_exists(@$options[0], @$options[1]))) + { + $setoptions = $options; + } else { + trigger_error("invalid error callback", E_USER_WARNING); + } + break; + + default: + trigger_error("invalid error mode", E_USER_WARNING); + break; + } + } + + // }}} + // {{{ expectError() + + /** + * This method is used to tell which errors you expect to get. + * Expected errors are always returned with error mode + * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, + * and this method pushes a new element onto it. The list of + * expected errors are in effect until they are popped off the + * stack with the popExpect() method. + * + * Note that this method can not be called statically + * + * @param mixed $code a single error code or an array of error codes to expect + * + * @return int the new depth of the "expected errors" stack + * @access public + */ + function expectError($code = '*') + { + if (is_array($code)) { + array_push($this->_expected_errors, $code); + } else { + array_push($this->_expected_errors, array($code)); + } + return sizeof($this->_expected_errors); + } + + // }}} + // {{{ popExpect() + + /** + * This method pops one element off the expected error codes + * stack. + * + * @return array the list of error codes that were popped + */ + function popExpect() + { + return array_pop($this->_expected_errors); + } + + // }}} + // {{{ _checkDelExpect() + + /** + * This method checks unsets an error code if available + * + * @param mixed error code + * @return bool true if the error code was unset, false otherwise + * @access private + * @since PHP 4.3.0 + */ + function _checkDelExpect($error_code) + { + $deleted = false; + + foreach ($this->_expected_errors AS $key => $error_array) { + if (in_array($error_code, $error_array)) { + unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); + $deleted = true; + } + + // clean up empty arrays + if (0 == count($this->_expected_errors[$key])) { + unset($this->_expected_errors[$key]); + } + } + return $deleted; + } + + // }}} + // {{{ delExpect() + + /** + * This method deletes all occurences of the specified element from + * the expected error codes stack. + * + * @param mixed $error_code error code that should be deleted + * @return mixed list of error codes that were deleted or error + * @access public + * @since PHP 4.3.0 + */ + function delExpect($error_code) + { + $deleted = false; + + if ((is_array($error_code) && (0 != count($error_code)))) { + // $error_code is a non-empty array here; + // we walk through it trying to unset all + // values + foreach($error_code AS $key => $error) { + if ($this->_checkDelExpect($error)) { + $deleted = true; + } else { + $deleted = false; + } + } + return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + } elseif (!empty($error_code)) { + // $error_code comes alone, trying to unset it + if ($this->_checkDelExpect($error_code)) { + return true; + } else { + return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + } + } else { + // $error_code is empty + return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME + } + } + + // }}} + // {{{ raiseError() + + /** + * This method is a wrapper that returns an instance of the + * configured error class with this object's default error + * handling applied. If the $mode and $options parameters are not + * specified, the object's defaults are used. + * + * @param mixed $message a text error message or a PEAR error object + * + * @param int $code a numeric error code (it is up to your class + * to define these if you want to use codes) + * + * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, + * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or + * PEAR_ERROR_CALLBACK. + * + * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter + * specifies the PHP-internal error level (one of + * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). + * If $mode is PEAR_ERROR_CALLBACK, this + * parameter specifies the callback function or + * method. In other error modes this parameter + * is ignored. + * + * @param string $userinfo If you need to pass along for example debug + * information, this parameter is meant for that. + * + * @param string $error_class The returned error object will be + * instantiated from this class, if specified. + * + * @param bool $skipmsg If true, raiseError will only pass error codes, + * the error message parameter will be dropped. + * + * @access public + * @return object a PEAR error object + * @see PEAR::setErrorHandling + * @since PHP 4.0.5 + */ + function &raiseError($message = null, + $code = null, + $mode = null, + $options = null, + $userinfo = null, + $error_class = null, + $skipmsg = false) + { + // The error is yet a PEAR error object + if (is_object($message)) { + $code = $message->getCode(); + $userinfo = $message->getUserInfo(); + $error_class = $message->getType(); + $message = $message->getMessage(); + } + + if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) { + if ($exp[0] == "*" || + (is_int(reset($exp)) && in_array($code, $exp)) || + (is_string(reset($exp)) && in_array($message, $exp))) { + $mode = PEAR_ERROR_RETURN; + } + } + // No mode given, try global ones + if ($mode === null) { + // Class error handler + if (isset($this) && isset($this->_default_error_mode)) { + $mode = $this->_default_error_mode; + $options = $this->_default_error_options; + // Global error handler + } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { + $mode = $GLOBALS['_PEAR_default_error_mode']; + $options = $GLOBALS['_PEAR_default_error_options']; + } + } + + if ($error_class !== null) { + $ec = $error_class; + } elseif (isset($this) && isset($this->_error_class)) { + $ec = $this->_error_class; + } else { + $ec = 'PEAR_Error'; + } + if ($skipmsg) { + return new $ec($code, $mode, $options, $userinfo); + } else { + return new $ec($message, $code, $mode, $options, $userinfo); + } + } + + // }}} + // {{{ throwError() + + /** + * Simpler form of raiseError with fewer options. In most cases + * message, code and userinfo are enough. + * + * @param string $message + * + */ + function &throwError($message = null, + $code = null, + $userinfo = null) + { + if (isset($this)) { + return $this->raiseError($message, $code, null, null, $userinfo); + } else { + return PEAR::raiseError($message, $code, null, null, $userinfo); + } + } + + // }}} + // {{{ pushErrorHandling() + + /** + * Push a new error handler on top of the error handler options stack. With this + * you can easily override the actual error handler for some code and restore + * it later with popErrorHandling. + * + * @param mixed $mode (same as setErrorHandling) + * @param mixed $options (same as setErrorHandling) + * + * @return bool Always true + * + * @see PEAR::setErrorHandling + */ + function pushErrorHandling($mode, $options = null) + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + if (isset($this)) { + $def_mode = &$this->_default_error_mode; + $def_options = &$this->_default_error_options; + } else { + $def_mode = &$GLOBALS['_PEAR_default_error_mode']; + $def_options = &$GLOBALS['_PEAR_default_error_options']; + } + $stack[] = array($def_mode, $def_options); + + if (isset($this)) { + $this->setErrorHandling($mode, $options); + } else { + PEAR::setErrorHandling($mode, $options); + } + $stack[] = array($mode, $options); + return true; + } + + // }}} + // {{{ popErrorHandling() + + /** + * Pop the last error handler used + * + * @return bool Always true + * + * @see PEAR::pushErrorHandling + */ + function popErrorHandling() + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + array_pop($stack); + list($mode, $options) = $stack[sizeof($stack) - 1]; + array_pop($stack); + if (isset($this)) { + $this->setErrorHandling($mode, $options); + } else { + PEAR::setErrorHandling($mode, $options); + } + return true; + } + + // }}} + // {{{ loadExtension() + + /** + * OS independant PHP extension load. Remember to take care + * on the correct extension name for case sensitive OSes. + * + * @param string $ext The extension name + * @return bool Success or not on the dl() call + */ + function loadExtension($ext) + { + if (!extension_loaded($ext)) { + if (OS_WINDOWS) { + $suffix = '.dll'; + } elseif (PHP_OS == 'HP-UX') { + $suffix = '.sl'; + } elseif (PHP_OS == 'AIX') { + $suffix = '.a'; + } elseif (PHP_OS == 'OSX') { + $suffix = '.bundle'; + } else { + $suffix = '.so'; + } + return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); + } + return true; + } + + // }}} +} + +// {{{ _PEAR_call_destructors() + +function _PEAR_call_destructors() +{ + global $_PEAR_destructor_object_list; + if (is_array($_PEAR_destructor_object_list) && + sizeof($_PEAR_destructor_object_list)) + { + reset($_PEAR_destructor_object_list); + while (list($k, $objref) = each($_PEAR_destructor_object_list)) { + $classname = get_class($objref); + while ($classname) { + $destructor = "_$classname"; + if (method_exists($objref, $destructor)) { + $objref->$destructor(); + break; + } else { + $classname = get_parent_class($classname); + } + } + } + // Empty the object list to ensure that destructors are + // not called more than once. + $_PEAR_destructor_object_list = array(); + } + + // Now call the shutdown functions + if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { + foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { + call_user_func_array($value[0], $value[1]); + } + } +} + +// }}} + +class PEAR_Error +{ + // {{{ properties + + var $error_message_prefix = ''; + var $mode = PEAR_ERROR_RETURN; + var $level = E_USER_NOTICE; + var $code = -1; + var $message = ''; + var $userinfo = ''; + + // Wait until we have a stack-groping function in PHP. + //var $file = ''; + //var $line = 0; + + + // }}} + // {{{ constructor + + /** + * PEAR_Error constructor + * + * @param string $message message + * + * @param int $code (optional) error code + * + * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, + * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER or + * PEAR_ERROR_CALLBACK + * + * @param mixed $options (optional) error level, _OR_ in the case of + * PEAR_ERROR_CALLBACK, the callback function or object/method + * tuple. + * + * @param string $userinfo (optional) additional user/debug info + * + * @access public + * + */ + function PEAR_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + if ($mode === null) { + $mode = PEAR_ERROR_RETURN; + } + $this->message = $message; + $this->code = $code; + $this->mode = $mode; + $this->userinfo = $userinfo; + if ($mode & PEAR_ERROR_CALLBACK) { + $this->level = E_USER_NOTICE; + $this->callback = $options; + } else { + if ($options === null) { + $options = E_USER_NOTICE; + } + $this->level = $options; + $this->callback = null; + } + if ($this->mode & PEAR_ERROR_PRINT) { + if (is_null($options) || is_int($options)) { + $format = "%s"; + } else { + $format = $options; + } + printf($format, $this->getMessage()); + } + if ($this->mode & PEAR_ERROR_TRIGGER) { + trigger_error($this->getMessage(), $this->level); + } + if ($this->mode & PEAR_ERROR_DIE) { + $msg = $this->getMessage(); + if (is_null($options) || is_int($options)) { + $format = "%s"; + if (substr($msg, -1) != "\n") { + $msg .= "\n"; + } + } else { + $format = $options; + } + die(sprintf($format, $msg)); + } + if ($this->mode & PEAR_ERROR_CALLBACK) { + if (is_string($this->callback) && strlen($this->callback)) { + call_user_func($this->callback, $this); + } elseif (is_array($this->callback) && + sizeof($this->callback) == 2 && + is_object($this->callback[0]) && + is_string($this->callback[1]) && + strlen($this->callback[1])) { + @call_user_func($this->callback, $this); + } + } + } + + // }}} + // {{{ getMode() + + /** + * Get the error mode from an error object. + * + * @return int error mode + * @access public + */ + function getMode() { + return $this->mode; + } + + // }}} + // {{{ getCallback() + + /** + * Get the callback function/method from an error object. + * + * @return mixed callback function or object/method array + * @access public + */ + function getCallback() { + return $this->callback; + } + + // }}} + // {{{ getMessage() + + + /** + * Get the error message from an error object. + * + * @return string full error message + * @access public + */ + function getMessage() + { + return ($this->error_message_prefix . $this->message); + } + + + // }}} + // {{{ getCode() + + /** + * Get error code from an error object + * + * @return int error code + * @access public + */ + function getCode() + { + return $this->code; + } + + // }}} + // {{{ getType() + + /** + * Get the name of this error/exception. + * + * @return string error/exception name (type) + * @access public + */ + function getType() + { + return get_class($this); + } + + // }}} + // {{{ getUserInfo() + + /** + * Get additional user-supplied information. + * + * @return string user-supplied information + * @access public + */ + function getUserInfo() + { + return $this->userinfo; + } + + // }}} + // {{{ getDebugInfo() + + /** + * Get additional debug information supplied by the application. + * + * @return string debug information + * @access public + */ + function getDebugInfo() + { + return $this->getUserInfo(); + } + + // }}} + // {{{ addUserInfo() + + function addUserInfo($info) + { + if (empty($this->userinfo)) { + $this->userinfo = $info; + } else { + $this->userinfo .= " ** $info"; + } + } + + // }}} + // {{{ toString() + + /** + * Make a string representation of this object. + * + * @return string a string with an object summary + * @access public + */ + function toString() { + $modes = array(); + $levels = array(E_USER_NOTICE => 'notice', + E_USER_WARNING => 'warning', + E_USER_ERROR => 'error'); + if ($this->mode & PEAR_ERROR_CALLBACK) { + if (is_array($this->callback)) { + $callback = get_class($this->callback[0]) . '::' . + $this->callback[1]; + } else { + $callback = $this->callback; + } + return sprintf('[%s: message="%s" code=%d mode=callback '. + 'callback=%s prefix="%s" info="%s"]', + get_class($this), $this->message, $this->code, + $callback, $this->error_message_prefix, + $this->userinfo); + } + if ($this->mode & PEAR_ERROR_PRINT) { + $modes[] = 'print'; + } + if ($this->mode & PEAR_ERROR_TRIGGER) { + $modes[] = 'trigger'; + } + if ($this->mode & PEAR_ERROR_DIE) { + $modes[] = 'die'; + } + if ($this->mode & PEAR_ERROR_RETURN) { + $modes[] = 'return'; + } + return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. + 'prefix="%s" info="%s"]', + get_class($this), $this->message, $this->code, + implode("|", $modes), $levels[$this->level], + $this->error_message_prefix, + $this->userinfo); + } + + // }}} +} + +register_shutdown_function("_PEAR_call_destructors"); + +/* + * Local Variables: + * mode: php + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ +?> diff --git a/program/lib/des.inc b/program/lib/des.inc new file mode 100644 index 000000000..00ecd688f --- /dev/null +++ b/program/lib/des.inc @@ -0,0 +1,218 @@ +> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4); + $temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16); + $temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2); + $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8); + $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1); + + $left = (($left << 1) | ($left >> 31 & $masks[31])); + $right = (($right << 1) | ($right >> 31 & $masks[31])); + + //do this either 1 or 3 times for each chunk of the message + for ($j=0; $j<$iterations; $j+=3) { + $endloop = $looping[$j+1]; + $loopinc = $looping[$j+2]; + //now go through and perform the encryption or decryption + for ($i=$looping[$j]; $i!=$endloop; $i+=$loopinc) { //for efficiency + $right1 = $right ^ $keys[$i]; + $right2 = (($right >> 4 & $masks[4]) | ($right << 28)) ^ $keys[$i+1]; + //the result is attained by passing these bytes through the S selection functions + $temp = $left; + $left = $right; + $right = $temp ^ ($spfunction2[($right1 >> 24 & $masks[24]) & 0x3f] | $spfunction4[($right1 >> 16 & $masks[16]) & 0x3f] + | $spfunction6[($right1 >> 8 & $masks[8]) & 0x3f] | $spfunction8[$right1 & 0x3f] + | $spfunction1[($right2 >> 24 & $masks[24]) & 0x3f] | $spfunction3[($right2 >> 16 & $masks[16]) & 0x3f] + | $spfunction5[($right2 >> 8 & $masks[8]) & 0x3f] | $spfunction7[$right2 & 0x3f]); + } + $temp = $left; $left = $right; $right = $temp; //unreverse left and right + } //for either 1 or 3 iterations + + //move then each one bit to the right + $left = (($left >> 1 & $masks[1]) | ($left << 31)); + $right = (($right >> 1 & $masks[1]) | ($right << 31)); + + //now perform IP-1, which is IP in the opposite direction + $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1); + $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8); + $temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2); + $temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16); + $temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4); + + //for Cipher Block Chaining mode, xor the message with the previous result + if ($mode == 1) {if ($encrypt) {$cbcleft = $left; $cbcright = $right;} else {$left ^= $cbcleft2; $right ^= $cbcright2;}} + $tempresult .= (chr($left>>24 & $masks[24]) . chr(($left>>16 & $masks[16]) & 0xff) . chr(($left>>8 & $masks[8]) & 0xff) . chr($left & 0xff) . chr($right>>24 & $masks[24]) . chr(($right>>16 & $masks[16]) & 0xff) . chr(($right>>8 & $masks[8]) & 0xff) . chr($right & 0xff)); + + $chunk += 8; + if ($chunk == 512) {$result .= $tempresult; $tempresult = ""; $chunk = 0;} + } //for every 8 characters, or 64 bits in the message + + //return the result as an array + return ($result . $tempresult); +} //end of des + +//des_createKeys +//this takes as input a 64 bit key (even though only 56 bits are used) +//as an array of 2 integers, and returns 16 48 bit keys +function des_createKeys ($key) { + //declaring this locally speeds things up a bit + $pc2bytes0 = array (0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204); + $pc2bytes1 = array (0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101); + $pc2bytes2 = array (0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808); + $pc2bytes3 = array (0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000); + $pc2bytes4 = array (0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010); + $pc2bytes5 = array (0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420); + $pc2bytes6 = array (0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002); + $pc2bytes7 = array (0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800); + $pc2bytes8 = array (0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002); + $pc2bytes9 = array (0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408); + $pc2bytes10 = array (0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020); + $pc2bytes11 = array (0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200); + $pc2bytes12 = array (0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010); + $pc2bytes13 = array (0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105); + $masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0); + + //how many iterations (1 for des, 3 for triple des) + $iterations = ((strlen($key) >= 24) ? 3 : 1); + //stores the return keys + $keys = array (); // size = 32 * iterations but you don't specify this in php + //now define the left shifts which need to be done + $shifts = array (0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0); + //other variables + $m=0; + $n=0; + + for ($j=0; $j<$iterations; $j++) { //either 1 or 3 iterations + $left = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++}); + $right = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++}); + + $temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4); + $temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16); + $temp = (($left >> 2 & $masks[2]) ^ $right) & 0x33333333; $right ^= $temp; $left ^= ($temp << 2); + $temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16); + $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1); + $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8); + $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1); + + //the right side needs to be shifted and to get the last four bits of the left side + $temp = ($left << 8) | (($right >> 20 & $masks[20]) & 0x000000f0); + //left needs to be put upside down + $left = ($right << 24) | (($right << 8) & 0xff0000) | (($right >> 8 & $masks[8]) & 0xff00) | (($right >> 24 & $masks[24]) & 0xf0); + $right = $temp; + + //now go through and perform these shifts on the left and right keys + for ($i=0; $i < count($shifts); $i++) { + //shift the keys either one or two bits to the left + if ($shifts[$i] > 0) { + $left = (($left << 2) | ($left >> 26 & $masks[26])); + $right = (($right << 2) | ($right >> 26 & $masks[26])); + } else { + $left = (($left << 1) | ($left >> 27 & $masks[27])); + $right = (($right << 1) | ($right >> 27 & $masks[27])); + } + $left = $left & -0xf; + $right = $right & -0xf; + + //now apply PC-2, in such a way that E is easier when encrypting or decrypting + //this conversion will look like PC-2 except only the last 6 bits of each byte are used + //rather than 48 consecutive bits and the order of lines will be according to + //how the S selection functions will be applied: S2, S4, S6, S8, S1, S3, S5, S7 + $lefttemp = $pc2bytes0[$left >> 28 & $masks[28]] | $pc2bytes1[($left >> 24 & $masks[24]) & 0xf] + | $pc2bytes2[($left >> 20 & $masks[20]) & 0xf] | $pc2bytes3[($left >> 16 & $masks[16]) & 0xf] + | $pc2bytes4[($left >> 12 & $masks[12]) & 0xf] | $pc2bytes5[($left >> 8 & $masks[8]) & 0xf] + | $pc2bytes6[($left >> 4 & $masks[4]) & 0xf]; + $righttemp = $pc2bytes7[$right >> 28 & $masks[28]] | $pc2bytes8[($right >> 24 & $masks[24]) & 0xf] + | $pc2bytes9[($right >> 20 & $masks[20]) & 0xf] | $pc2bytes10[($right >> 16 & $masks[16]) & 0xf] + | $pc2bytes11[($right >> 12 & $masks[12]) & 0xf] | $pc2bytes12[($right >> 8 & $masks[8]) & 0xf] + | $pc2bytes13[($right >> 4 & $masks[4]) & 0xf]; + $temp = (($righttemp >> 16 & $masks[16]) ^ $lefttemp) & 0x0000ffff; + $keys[$n++] = $lefttemp ^ $temp; $keys[$n++] = $righttemp ^ ($temp << 16); + } + } //for each iterations + //return the keys we've created + return $keys; +} //end of des_createKeys + +/* +////////////////////////////// TEST ////////////////////////////// +function stringToHex ($s) { + $r = "0x"; + $hexes = array ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"); + for ($i=0; $i> 4)] . $hexes [(ord($s{$i}) & 0xf)]);} + return $r; +} +echo "
";
+$key = "this is a 24 byte key !!";
+$message = "This is a test message";
+$ciphertext = des ($key, $message, 1, 0, null);
+echo "DES Test Encrypted: " . stringToHex ($ciphertext);
+$recovered_message = des ($key, $ciphertext, 0, 0, null);
+echo "\n";
+echo "DES Test Decrypted: " . $recovered_message;
+*/
+?>
\ No newline at end of file
diff --git a/program/lib/enriched.inc b/program/lib/enriched.inc
new file mode 100644
index 000000000..2435a8233
--- /dev/null
+++ b/program/lib/enriched.inc
@@ -0,0 +1,114 @@
+'=>'',''=>'',''=>'',
+			''=>'',''=>'',''=>'',
+			''=>'',''=>'',
+			''=>'',''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'',
+			''=>'');
+	
+	while(list($find,$replace)=each($a)){
+		$body = eregi_replace($find,$replace,$body);
+	}
+	return $body;
+}
+
+function enriched_font($body){
+	$pattern = '/(.*)\\(.*)\<\/param\>(.*)\<\/fontfamily\>(.*)/ims';
+	while(preg_match($pattern,$body,$a)){
+		//print_r($a);
+		if (count($a)!=5) continue;
+		$body=$a[1].''.$a[3].''.$a[4];
+	}
+
+	return $body;
+}
+
+
+function enriched_color($body){
+	$pattern = '/(.*)\\(.*)\<\/param\>(.*)\<\/color\>(.*)/ims';
+	while(preg_match($pattern,$body,$a)){
+		//print_r($a);
+		if (count($a)!=5) continue;
+
+		//extract color (either by name, or ####,####,####)
+		if (strpos($a[2],',')){
+			$rgb = explode(',',$a[2]);
+			$color ='#';
+			for($i=0;$i<3;$i++) $color.=substr($rgb[$i],0,2); //just take first 2 bytes
+		}else{
+			$color = $a[2];
+		}
+		
+		//put it all together
+		$body = $a[1].''.$a[3].''.$a[4];
+	}
+
+	return $body;
+}
+
+function enriched_excerpt($body){
+
+	$pattern = '/(.*)\(.*)\<\/excerpt\>(.*)/i';
+	while(preg_match($pattern,$body,$a)){
+		//print_r($a);
+		if (count($a)!=4) continue;
+		$quoted = '';
+		$lines = explode('
',$a[2]); + foreach($lines as $n=>$line) $quoted.='>'.$line.'
'; + $body=$a[1].''.$quoted.''.$a[3]; + } + + return $body; +} + +function enriched_to_html($body){ + $body = str_replace('<<','<',$body); + $body = enriched_convert_newlines($body); + $body = str_replace("\n", '
', $body); + $body = enriched_convert_formatting($body); + $body = enriched_color($body); + $body = enriched_font($body); + $body = enriched_excerpt($body); + //$body = nl2br($body); + return $body; +} + +?> \ No newline at end of file diff --git a/program/lib/html2text.inc b/program/lib/html2text.inc new file mode 100644 index 000000000..82a254e56 --- /dev/null +++ b/program/lib/html2text.inc @@ -0,0 +1,440 @@ + * +* All rights reserved. * +* * +* This script is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* The GNU General Public License can be found at * +* http://www.gnu.org/copyleft/gpl.html. * +* * +* This script 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. * +* * +* Author(s): Jon Abernathy * +* * +* Last modified: 04/06/05 * +* Modified: 2004/05/19 (tbr) * +* * +*************************************************************************/ + + +/** +* Takes HTML and converts it to formatted, plain text. +* +* Thanks to Alexander Krug (http://www.krugar.de/) to pointing out and +* correcting an error in the regexp search array. Fixed 7/30/03. +* +* Updated set_html() function's file reading mechanism, 9/25/03. +* +* Thanks to Joss Sanglier (http://www.dancingbear.co.uk/) for adding +* several more HTML entity codes to the $search and $replace arrays. +* Updated 11/7/03. +* +* Thanks to Darius Kasperavicius (http://www.dar.dar.lt/) for +* suggesting the addition of $allowed_tags and its supporting function +* (which I slightly modified). Updated 3/12/04. +* +* Thanks to Justin Dearing for pointing out that a replacement for the +* tag was missing, and suggesting an appropriate fix. +* Updated 8/25/04. +* +* Thanks to Mathieu Collas (http://www.myefarm.com/) for finding a +* display/formatting bug in the _build_link_list() function: email +* readers would show the left bracket and number ("[1") as part of the +* rendered email address. +* Updated 12/16/04. +* +* Thanks to Wojciech Bajon (http://histeria.pl/) for submitting code +* to handle relative links, which I hadn't considered. I modified his +* code a bit to handle normal HTTP links and MAILTO links. Also for +* suggesting three additional HTML entity codes to search for. +* Updated 03/02/05. +* +* Thanks to Jacob Chandler for pointing out another link condition +* for the _build_link_list() function: "https". +* Updated 04/06/05. +* +* @author Jon Abernathy +* @version 0.6.1 +* @since PHP 4.0.2 +*/ +class html2text +{ + + /** + * Contains the HTML content to convert. + * + * @var string $html + * @access public + */ + var $html; + + /** + * Contains the converted, formatted text. + * + * @var string $text + * @access public + */ + var $text; + + /** + * Maximum width of the formatted text, in columns. + * + * @var integer $width + * @access public + */ + var $width = 70; + + /** + * List of preg* regular expression patterns to search for, + * used in conjunction with $replace. + * + * @var array $search + * @access public + * @see $replace + */ + var $search = array( + "/\r/", // Non-legal carriage return + "/[\n\t]+/", // Newlines and tabs + '/]*>.*?<\/script>/i', // ', $pos))) + { + $pos2 += 8; + $body = substr($body, 0, $pos) . substr($body, $pos2, strlen($body)-$pos2); + $body_lc = strtolower($body); + } + + + // resolve + $base_reg = '/()/i'; + if (preg_match($base_reg, $body, $regs)) + { + $base_url = $regs[2]; + $body = preg_replace('/(src|background|href)=(["\']?)([\.\/]+[^"\'\s]+)(\2|\s|>)/Uie', "'\\1=\"'.make_absolute_url('\\3', '$base_url').'\"'", $body); + $body = preg_replace('/(url\s*\()(["\']?)([\.\/]+[^"\'\)\s]+)(\2)\)/Uie', "'\\1\''.make_absolute_url('\\3', '$base_url').'\')'", $body); + $body = preg_replace($base_reg, '', $body); + } + + + // add comments arround html and other tags + $out = preg_replace(array('/(<\/?html[^>]*>)/i', + '/(<\/?head[^>]*>)/i', + '/(]*>.+<\/title>)/ui', + '/(<\/?meta[^>]*>)/i'), + '', + $body); + + $out = preg_replace(array('/(]*>)/i', + '/(<\/body>)/i'), + array('
', + '
'), + $out); + + + return $out; + } + + + +// replace all css definitions with #container [def] +function rcmail_mod_css_styles($source, $container_id) + { + $a_css_values = array(); + $last_pos = 0; + + // cut out all contents between { and } + while (($pos = strpos($source, '{', $last_pos)) && ($pos2 = strpos($source, '}', $pos))) + { + $key = sizeof($a_css_values); + $a_css_values[$key] = substr($source, $pos+1, $pos2-($pos+1)); + $source = substr($source, 0, $pos+1) . "<>" . substr($source, $pos2, strlen($source)-$pos2); + $last_pos = $pos+2; + } + + $styles = preg_replace('/(^\s*|,\s*)([a-z0-9\._][a-z0-9\.\-_]*)/im', "\\1#$container_id \\2", $source); + $styles = preg_replace('/<>/e', "\$a_css_values[\\1]", $styles); + + // replace body definition because we also stripped off the tag + $styles = preg_replace("/$container_id\s+body/i", "$container_id div.rcmBody", $styles); + + return $styles; + } + + + +// return first text part of a message +function rcmail_first_text_part($message_parts) + { + if (!is_array($message_parts)) + return FALSE; + + $html_part = NULL; + + // check all message parts + foreach ($message_parts as $pid => $part) + { + $mimetype = strtolower($part->ctype_primary.'/'.$part->ctype_secondary); + if ($mimetype=='text/plain') + { + $body = rcube_imap::mime_decode($part->body, $part->headers['content-transfer-encoding']); + $body = rcube_imap::charset_decode($body, $part->ctype_parameters); + return $body; + } + else if ($mimetype=='text/html') + { + $html_part = rcube_imap::mime_decode($part->body, $part->headers['content-transfer-encoding']); + $html_part = rcube_imap::charset_decode($html_part, $part->ctype_parameters); + } + } + + + // convert HTML to plain text + if ($html_part) + { + // remove special chars encoding + $trans = array_flip(get_html_translation_table(HTML_ENTITIES)); + $html_part = strtr($html_part, $trans); + + // create instance of html2text class + $txt = new html2text($html_part); + return $txt->get_text(); + } + + return FALSE; + } + + +// get source code of a specific message and cache it +function rcmail_message_source($uid) + { + global $IMAP, $DB; + + // get message ID if uid is given + $headers = $IMAP->get_headers($uid); + $message_id = $headers->messageID; + + // get cached message source + $msg_source = rcube_read_cache($message_id); + + // get message from server and cache it + if (!$msg_source) + { + $msg_source = $IMAP->get_raw_body($uid); + rcube_write_cache($message_id, $msg_source, TRUE); + } + + return $msg_source; + } + + +// decode address string and re-format it as HTML links +function rcmail_address_string($input, $max=NULL, $addicon=NULL) + { + global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $JS_OBJECT_NAME, $EMAIL_ADDRESS_PATTERN; + + $a_parts = $IMAP->decode_address_list($input); + + if (!sizeof($a_parts)) + return $input; + + $c = count($a_parts); + $j = 0; + $out = ''; + + foreach ($a_parts as $part) + { + $j++; + if ($PRINT_MODE) + $out .= sprintf('%s <%s>', htmlentities($part['name']), $part['mailto']); + else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) + { + $out .= sprintf('%s', + $part['mailto'], + $JS_OBJECT_NAME, + $part['mailto'], + $part['mailto'], + htmlentities($part['name'])); + + if ($addicon) + $out .= sprintf(' add', + $JS_OBJECT_NAME, + urlencode($part['string']), + rcube_label('addtoaddressbook'), + $CONFIG['skin_path'], + $addicon); + } + else + { + if ($part['name']) + $out .= htmlentities($part['name']); + if ($part['mailto']) + $out .= (strlen($out) ? ' ' : '') . sprintf('<%s>', $part['mailto']); + } + + if ($c>$j) + $out .= ','.($max ? ' ' : ' '); + + if ($max && $j==$max && $c>$j) + { + $out .= '...'; + break; + } + } + + return $out; + } + + +function rcmail_message_part_controls() + { + global $CONFIG, $IMAP, $MESSAGE; + + if (!is_array($MESSAGE) || !is_array($MESSAGE['parts']) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE['parts'][$_GET['_part']]) + return ''; + + $part = $MESSAGE['parts'][$_GET['_part']]; + + $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'cellspacing', 'cellpadding', 'border', 'summary')); + $out = '\n"; + + $filename = $part->d_parameters['filename'] ? $part->d_parameters['filename'] : $part->ctype_parameters['name']; + $filesize = strlen($IMAP->mime_decode($part->body, $part->headers['content-transfer-encoding'])); + + if ($filename) + { + $out .= sprintf(''."\n", + rcube_label('filename'), + rep_specialchars_output($filename), + str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), + rcube_label('download')); + } + + if ($filesize) + $out .= sprintf(''."\n", + rcube_label('filesize'), + show_bytes($filesize)); + + $out .= "\n
%s%s[%s]
%s%s
"; + + return $out; + } + + + +function rcmail_message_part_frame($attrib) + { + global $MESSAGE; + + $part = $MESSAGE['parts'][$_GET['_part']]; + $ctype_primary = strtolower($part->ctype_primary); + + $attrib['src'] = './?'.str_replace('_frame=', ($ctype_primary=='text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING']); + + $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'src', 'width', 'height')); + $out = ''."\n", + $GET_URL, + $framename, + $attrib_str, + rcube_label('loading')); + + + $OUTPUT->add_script("$JS_OBJECT_NAME.set_env('contentframe', '$framename');"); + + return $out; + } + + +function rcmail_remote_objects_msg($attrib) + { + global $CONFIG, $OUTPUT, $JS_OBJECT_NAME; + + if (!$attrib['id']) + $attrib['id'] = 'rcmremoteobjmsg'; + + // allow the following attributes to be added to the
tag + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); + $out = '"; + + $out .= rep_specialchars_output(sprintf('%s %s', + rcube_label('blockedimages'), + $JS_OBJECT_NAME, + rcube_label('showimages'), + rcube_label('showimages'))); + + $out .= '
'; + + $OUTPUT->add_script(sprintf("%s.gui_object('remoteobjectsmsg', '%s');", $JS_OBJECT_NAME, $attrib['id'])); + return $out; + } + + +if ($_action=='print') + parse_template('printmessage'); +else + parse_template('message'); +?> \ No newline at end of file diff --git a/program/steps/mail/upload.inc b/program/steps/mail/upload.inc new file mode 100644 index 000000000..4f1eb3dab --- /dev/null +++ b/program/steps/mail/upload.inc @@ -0,0 +1,75 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +if (!$_SESSION['compose']) + { + exit; + } + + +if (strlen($CONFIG['temp_dir'])) + $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '').$_SESSION['compose']['id']; + +if (!is_array($_SESSION['compose']['attachments'])) + { + $_SESSION['compose']['attachments'] = array(); + + // create temp-dir for uploaded attachments + if ($CONFIG['temp_dir'] && is_writeable($CONFIG['temp_dir'])) + { + mkdir($temp_dir); + $_SESSION['compose']['temp_dir'] = $temp_dir; + } + } + + +$response = ''; + +foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) + { + $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); + if (copy($filepath, $tmpfname)) + { + $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], + 'mimetype' => $_FILES['_attachments']['type'][$i], + 'path' => $tmpfname); + + $response .= sprintf("parent.%s.add2attachment_list('%s');\n", $JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i]); + } + } + + +// send html page with JS calls as response +print << + + +EOF; +exit; + +?> \ No newline at end of file diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc new file mode 100644 index 000000000..8b8c90cd1 --- /dev/null +++ b/program/steps/mail/viewsource.inc @@ -0,0 +1,39 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +// similar code as in program/steps/mail/get.inc +if ($_GET['_uid']) + { + header('Content-Type: text/plain'); + print rcmail_message_source($_GET['_uid']); + } +else + { + raise_error(array('code' => 500, + 'type' => 'php', + 'message' => 'Message UID '.$_GET['_uid'].' not found'), + TRUE, + TRUE); + } + +exit; +?> \ No newline at end of file diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc new file mode 100644 index 000000000..dacfc0563 --- /dev/null +++ b/program/steps/settings/delete_identity.inc @@ -0,0 +1,55 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$REMOTE_REQUEST = $_GET['_remote'] ? TRUE : FALSE; + +if ($_GET['_iid']) + { + $DB->query(sprintf("UPDATE %s + SET del='1' + WHERE user_id=%d + AND identity_id IN (%s)", + get_table_name('identities'), + $_SESSION['user_id'], + $_GET['_iid'])); + + $count = $DB->affected_rows(); + if ($count) + { + $commands = show_message('deletedsuccessfully', 'confirmation'); + } + + // send response + if ($REMOTE_REQUEST) + rcube_remote_response($commands); + } + + +if ($REMOTE_REQUEST) + exit; + + +// go to identities page +$_action = 'identities'; + +// overwrite action variable +$OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); +?> \ No newline at end of file diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc new file mode 100644 index 000000000..f4134d329 --- /dev/null +++ b/program/steps/settings/edit_identity.inc @@ -0,0 +1,106 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +if (($_GET['_iid'] || $_POST['_iid']) && $_action=='edit-identity') + { + $id = $_POST['_iid'] ? $_POST['_iid'] : $_GET['_iid']; + $DB->query(sprintf("SELECT * FROM %s + WHERE identity_id=%d + AND user_id=%d + AND del!='1'", + get_table_name('identities'), + $id, + $_SESSION['user_id'])); + + $IDENTITY_RECORD = $DB->fetch_assoc(); + + if (is_array($IDENTITY_RECORD)) + $OUTPUT->add_script(sprintf("%s.set_env('iid', '%s');", $JS_OBJECT_NAME, $IDENTITY_RECORD['identity_id'])); + + $PAGE_TITLE = rcube_label('edititem'); + } +else + $PAGE_TITLE = rcube_label('newitem'); + + + +function rcube_identity_form($attrib) + { + global $IDENTITY_RECORD, $JS_OBJECT_NAME; + + if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity') + return rcube_label('notfound'); + + list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id'])); + unset($attrib['form']); + + + // list of available cols + $a_show_cols = array('name' => array('type' => 'text'), + 'email' => array('type' => 'text'), + 'organization' => array('type' => 'text'), + 'reply-to' => array('type' => 'text', 'label' => 'replyto'), + 'bcc' => array('type' => 'text'), + 'default' => array('type' => 'checkbox', 'label' => 'setdefault')); + + + // a specific part is requested + if ($attrib['part']) + { + $colprop = $a_show_cols[$attrib['part']]; + if (is_array($colprop)) + { + $out = $form_start; + $out .= rcmail_get_edit_field($attrib['part'], $IDENTITY_RECORD[$attrib['part']], $attrib, $colprop['type']); + return $out; + } + else + return ''; + } + + + // return the complete edit form as table + $out = "$form_start\n\n"; + + foreach ($a_show_cols as $col => $colprop) + { + $attrib['id'] = 'rcmfd_'.$col; + $label = strlen($colprop['label']) ? $colprop['label'] : $col; + $value = rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $attrib, $colprop['type']); + + $out .= sprintf("\n", + $attrib['id'], + rcube_label($label), + $value); + } + + $out .= "\n
%s
$form_end"; + + return $out; + } + + + +if ($_action=='add-identity' && template_exists('addidentity')) + parse_template('addidentity'); + +parse_template('editidentity'); +?> \ No newline at end of file diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc new file mode 100644 index 000000000..826717fd9 --- /dev/null +++ b/program/steps/settings/func.inc @@ -0,0 +1,194 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + + +// get user record +$sql_result = $DB->query(sprintf("SELECT username, mail_host FROM %s + WHERE user_id=%d", + get_table_name('users'), + $_SESSION['user_id'])); + +if ($USER_DATA = $DB->fetch_assoc($sql_result)) + $PAGE_TITLE = sprintf('%s %s@%s', rcube_label('settingsfor'), $USER_DATA['username'], $USER_DATA['mail_host']); + + + +function rcmail_user_prefs_form($attrib) + { + global $DB, $CONFIG, $sess_user_lang; + + list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs'); + unset($attrib['form']); + + // allow the following attributes to be added to the tag + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); + + // return the complete edit form as table + $out = "$form_start\n\n"; + + $a_show_cols = array('language' => array('type' => 'text'), + 'pagesize' => array('type' => 'text'), + 'timezone' => array('type' => 'text')); + + // show language selection + $field_id = 'rcmfd_lang'; + $select_lang = new select(array('name' => '_language', 'id' => $field_id)); + $select_lang->add('English', 'en'); + $select_lang->add('Deutsch', 'de'); + + $out .= sprintf("\n", + $field_id, + rcube_label('language'), + $select_lang->show($sess_user_lang)); + + + // show page size selection + $field_id = 'rcmfd_timezone'; + $select_timezone = new select(array('name' => '_timezone', 'id' => $field_id)); + $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); + $select_timezone->add('(GMT -10:00) Hawaii', '-10'); + $select_timezone->add('(GMT -9:00) Alaska', '-9'); + $select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); + $select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); + $select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); + $select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); + $select_timezone->add('(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-4'); + $select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); + $select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); + $select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); + $select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); + $select_timezone->add('(GMT +1:00) Central European Time', '1'); + $select_timezone->add('(GMT +2:00) EET: Kaliningrad, South Africa', '2'); + $select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); + $select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); + $select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); + $select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); + $select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); + $select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); + $select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); + $select_timezone->add('(GMT +10:00) EAST/AEST: Guam, Vladivostok', '10'); + $select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); + $select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); + $select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); + $select_timezone->add('(GMT +14:00) Kiribati', '14'); + + + $out .= sprintf("\n", + $field_id, + rcube_label('timezone'), + $select_timezone->show($CONFIG['timezone'])); + + + // show page size selection + $field_id = 'rcmfd_pgsize'; + $input_pagesize = new textfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); + + $out .= sprintf("\n", + $field_id, + rcube_label('pagesize'), + $input_pagesize->show($CONFIG['pagesize'])); + + // show checkbox for HTML/plaintext messages + $field_id = 'rcmfd_htmlmsg'; + $input_pagesize = new checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1)); + + $out .= sprintf("\n", + $field_id, + rcube_label('preferhtml'), + $input_pagesize->show($CONFIG['prefer_html']?1:0)); + + + $out .= "\n
%s
%s
%s
%s
$form_end"; + + return $out; + } + + + + +function rcmail_identities_list($attrib) + { + global $DB, $CONFIG, $OUTPUT, $JS_OBJECT_NAME; + + + // get contacts from DB + $sql_result = $DB->query(sprintf("SELECT * FROM %s + WHERE del!='1' + AND user_id=%d + ORDER BY `default` DESC, name ASC", + get_table_name('identities'), + $_SESSION['user_id'])); + + + // add id to message list table if not specified + if (!strlen($attrib['id'])) + $attrib['id'] = 'rcmIdentitiesList'; + + // define list of cols to be displayed + $a_show_cols = array('name', 'email', 'organization', 'reply-to'); + + // create XHTML table + $out = rcube_table_output($attrib, $sql_result, $a_show_cols, 'identity_id'); + + // set client env + $javascript = sprintf("%s.gui_object('identitieslist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']); + $OUTPUT->add_script($javascript); + + return $out; + } + + + +// similar function as in /steps/addressbook/edit.inc +function get_form_tags($attrib, $action, $add_hidden=array()) + { + global $OUTPUT, $JS_OBJECT_NAME, $EDIT_FORM, $SESS_HIDDEN_FIELD; + + $form_start = ''; + if (!strlen($EDIT_FORM)) + { + $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); + $hiddenfields->add(array('name' => '_action', 'value' => $action)); + + if ($add_hidden) + $hiddenfields->add($add_hidden); + + if ($_GET['_framed'] || $_POST['_framed']) + $hiddenfields->add(array('name' => '_framed', 'value' => 1)); + + $form_start = !strlen($attrib['form']) ? '
' : ''; + $form_start .= "\n$SESS_HIDDEN_FIELD\n"; + $form_start .= $hiddenfields->show(); + } + + $form_end = (!strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '
' : ''; + $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; + + if (!strlen($EDIT_FORM)) + $OUTPUT->add_script("$JS_OBJECT_NAME.gui_object('editform', '$form_name');"); + + $EDIT_FORM = $form_name; + + return array($form_start, $form_end); + } + + +?> \ No newline at end of file diff --git a/program/steps/settings/identities.inc b/program/steps/settings/identities.inc new file mode 100644 index 000000000..b760f09bf --- /dev/null +++ b/program/steps/settings/identities.inc @@ -0,0 +1,48 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +if ($USER_DATA = $DB->fetch_assoc($sql_result)) + $PAGE_TITLE = sprintf('%s (%s@%s)', rcube_label('identities'), $USER_DATA['username'], $USER_DATA['mail_host']); + + + +// similar function as /steps/addressbook/func.inc::rcmail_contact_frame() +function rcmail_identity_frame($attrib) + { + global $OUTPUT, $JS_OBJECT_NAME; + + if (!$attrib['id']) + $attrib['id'] = 'rcmIdentityFrame'; + + $attrib['name'] = $attrib['id']; + + $OUTPUT->add_script(sprintf("%s.set_env('contentframe', '%s');", $JS_OBJECT_NAME, $attrib['name'])); + + $attrib_str = create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder')); + $out = ''; + + return $out; + } + + + +parse_template('identities'); +?> \ No newline at end of file diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc new file mode 100644 index 000000000..38f9e1a0e --- /dev/null +++ b/program/steps/settings/manage_folders.inc @@ -0,0 +1,176 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +// init IAMP connection +rcmail_imap_init(TRUE); + + +// subscribe to one or more mailboxes +if ($_action=='subscribe') + { + if (strlen($_GET['_mboxes'])) + $IMAP->subscribe(explode(',', $_GET['_mboxes'])); + + if ($_GET['_remote']) + rcube_remote_response('// subscribed'); + } + +// unsubscribe one or more mailboxes +else if ($_action=='unsubscribe') + { + if (strlen($_GET['_mboxes'])) + $IMAP->unsubscribe(explode(',', $_GET['_mboxes'])); + + if ($_GET['_remote']) + rcube_remote_response('// unsubscribed'); + } + +// create a new mailbox +else if ($_action=='create-folder') + { + if (strlen($_GET['_name'])) + $create = $IMAP->create_mailbox(trim($_GET['_name']), TRUE); + + if ($create && $_GET['_remote']) + { + $commands = sprintf("this.add_folder_row('%s')", rep_specialchars_output($_GET['_name'], 'js')); + rcube_remote_response($commands); + } + else if (!$create && $_GET['_remote']) + { + $commands = show_message('errorsaving', 'error'); + rcube_remote_response($commands); + } + else if (!$create) + show_message('errorsaving', 'error'); + } + +// delete an existing IMAP mailbox +else if ($_action=='delete-folder') + { + if (strlen($_GET['_mboxes'])) + $IMAP->delete_mailbox(explode(',', $_GET['_mboxes'])); + + if ($_GET['_remote']) + rcube_remote_response('// deleted'); + } + + + +// build table with all folders listed by server +function rcube_subscription_form($attrib) + { + global $IMAP, $CONFIG, $OUTPUT, $JS_OBJECT_NAME; + + list($form_start, $form_end) = get_form_tags($attrib, 'folders'); + unset($attrib['form']); + + + if (!$attrib['id']) + $attrib['id'] = 'rcmSubscriptionlist'; + + // allow the following attributes to be added to the tag + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); + + $out = "$form_start\n\n"; + + + // add table header + $out .= "\n"; + $out .= sprintf('', rcube_label('foldername'), rcube_label('subscribed')); + $out .= "\n\n\n"; + + + // get folders from server + $a_unsubscribed = $IMAP->list_unsubscribed(); + $a_subscribed = $IMAP->list_mailboxes(); + $a_js_folders = array(); + + $checkbox_subscribe = new checkbox(array('name' => '_subscribed[]', 'onclick' => "$JS_OBJECT_NAME.command(this.checked?'subscribe':'unsubscribe',this.value)")); + + if ($attrib['deleteicon']) + $button = sprintf('%s', $CONFIG['skin_path'], $attrib['deleteicon'], rcube_label('delete')); + else + $button = rcube_label('delete'); + + + // create list of available folders + foreach ($a_unsubscribed as $i => $folder) + { + $zebra_class = $i%2 ? 'even' : 'odd'; + $folder_js = rep_specialchars_output($folder, 'js'); + $a_js_folders['rcmrow'.($i+1)] = $folder_js; + + $out .= sprintf('', + $i+1, + $zebra_class, + rep_specialchars_output($folder, 'html'), + $checkbox_subscribe->show(in_array($folder, $a_subscribed)?$folder:'', array('value' => $folder)), + $JS_OBJECT_NAME, + $folder_js, + rcube_label('deletefolder'), + $button); + + $out .= "\n"; + } + + $out .= "\n
%s%s
%s%s%s
"; + $out .= "\n$form_end"; + + + $javascript = sprintf("%s.gui_object('subscriptionlist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']); + $javascript .= sprintf("%s.set_env('subscriptionrows', %s);", $JS_OBJECT_NAME, array2js($a_js_folders)); + $OUTPUT->add_script($javascript); + + return $out; + } + + +function rcube_create_folder_form($attrib) + { + global $JS_OBJECT_NAME; + + list($form_start, $form_end) = get_form_tags($attrib, 'create-folder'); + unset($attrib['form']); + + + // return the complete edit form as table + $out = "$form_start\n"; + + $input = new textfield(array('name' => '_folder_name')); + $out .= $input->show(); + + if (get_boolean($attrib['button'])) + { + $button = new input_field(array('type' => 'button', + 'value' => rcube_label('create'), + 'onclick' => "$JS_OBJECT_NAME.command('create-folder',this.form)")); + $out .= $button->show(); + } + + $out .= "\n$form_end"; + + return $out; + } + + +parse_template('managefolders'); +?> \ No newline at end of file diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc new file mode 100644 index 000000000..b4b1fec27 --- /dev/null +++ b/program/steps/settings/save_identity.inc @@ -0,0 +1,136 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'default'); + + +// update an existing contact +if ($_POST['_iid']) + { + $a_write_sql = array(); + + foreach ($a_save_cols as $col) + { + $fname = '_'.$col; + if (!isset($_POST[$fname])) + continue; + + $a_write_sql[] = sprintf("`%s`='%s'", $col, addslashes($_POST[$fname])); + } + + if (sizeof($a_write_sql)) + { + $DB->query(sprintf("UPDATE %s + SET %s + WHERE identity_id=%d + AND user_id=%d + AND del!='1'", + get_table_name('identities'), + join(', ', $a_write_sql), + $_POST['_iid'], + $_SESSION['user_id'])); + + $updated = $DB->affected_rows(); + } + + if ($updated) + { + show_message('successfullysaved', 'confirmation'); + + // mark all other identities as 'not-default' + $DB->query(sprintf("UPDATE %s + SET `default`='0' + WHERE identity_id!=%d + AND user_id=%d + AND del!='1'", + get_table_name('identities'), + $_POST['_iid'], + $_SESSION['user_id'])); + + if ($_POST['_framed']) + { + // update the changed col in list + // ... + } + } + else + { + // show error message + + } + } + +// insert a new contact +else + { + $a_insert_cols = $a_insert_values = array(); + + foreach ($a_save_cols as $col) + { + $fname = '_'.$col; + if (!isset($_POST[$fname])) + continue; + + $a_insert_cols[] = "`$col`"; + $a_insert_values[] = sprintf("'%s'", addslashes($_POST[$fname])); + } + + if (sizeof($a_insert_cols)) + { + $DB->query(sprintf("INSERT INTO %s + (user_id, %s) + VALUES (%d, %s)", + get_table_name('identities'), + join(', ', $a_insert_cols), + $_SESSION['user_id'], + join(', ', $a_insert_values))); + + $insert_id = $DB->insert_id(); + } + + if ($insert_id) + { + $_GET['_iid'] = $insert_id; + + if ($_POST['_framed']) + { + // add contact row or jump to the page where it should appear + // .... + } + } + else + { + // show error message + } + } + + +// go to next step +if ($_POST['_framed']) + $_action = 'edit-identitiy'; +else + $_action = 'identities'; + + +// overwrite action variable +$OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); + +?> \ No newline at end of file diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc new file mode 100644 index 000000000..1524b9ead --- /dev/null +++ b/program/steps/settings/save_prefs.inc @@ -0,0 +1,59 @@ + | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$a_user_prefs = $_SESSION['user_prefs']; +if (!is_array($a_user_prefs)) + $a_user_prefs = array(); + + +$a_user_prefs['timezone'] = isset($_POST['_timezone']) ? (int)$_POST['_timezone'] : $CONFIG['timezone']; +$a_user_prefs['pagesize'] = is_numeric($_POST['_pagesize']) ? (int)$_POST['_pagesize'] : $CONFIG['pagesize']; +$a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE; + +if (isset($_POST['_language'])) + $sess_user_lang = $_SESSION['user_lang'] = $_POST['_language']; + + +$DB->query(sprintf("UPDATE %s + SET preferences='%s', + language='%s' + WHERE user_id=%d", + get_table_name('users'), + addslashes(serialize($a_user_prefs)), + $sess_user_lang, + $_SESSION['user_id'])); + +if ($DB->affected_rows()) + { + show_message('successfullysaved', 'confirmation'); + + $_SESSION['user_prefs'] = $a_user_prefs; + $CONFIG = array_merge($CONFIG, $a_user_prefs); + } + + +// go to next step +$_action = 'preferences'; + +// overwrite action variable +$OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); + +?> \ No newline at end of file diff --git a/skins/default/addresses.css b/skins/default/addresses.css new file mode 100644 index 000000000..d660c3c8f --- /dev/null +++ b/skins/default/addresses.css @@ -0,0 +1,119 @@ +/***** RoundCube|Mail address book task styles *****/ + + +#abooktoolbar +{ + position: absolute; + top: 32px; + left: 200px; + height: 35px; +} + +#abooktoolbar a +{ + padding-right: 10px; +} + +#abookcountbar +{ + position: absolute; + top: 50px; + left: 490px; + width: 200px; + height: 20px; + text-align: left; +} + +#abookcountbar span +{ + font-size: 11px; + color: #333333; +} + + +#addresslist +{ + position: absolute; + top: 75px; + left: 20px; + width: 450px; + bottom: 60px; + border: 1px solid #999999; + background-color: #F9F9F9; + overflow: auto; + /* css hack for IE */ + height: expression((parseInt(document.documentElement.clientHeight)-135)+'px'); +} + +#contacts-table +{ + width: 100%; + table-layout: fixed; + /* css hack for IE */ + width: expression(document.getElementById('addresslist').clientWidth); +} + + +#contacts-table tbody td +{ + cursor: pointer; +} + + +#contacts-box +{ + position: absolute; + top: 75px; + left: 490px; + right: 40px; + bottom: 60px; + border: 1px solid #999999; + overflow: hidden; + /* css hack for IE */ + width: expression((parseInt(document.documentElement.clientWidth)-530)+'px'); + height: expression((parseInt(document.documentElement.clientHeight)-135)+'px'); +} + +body.iframe, +#contact-frame +{ + background-color: #F9F9F9; +} + +#contact-frame +{ + border: none; +/* visibility: hidden; */ +} + +#contact-title +{ + height: 12px !important; +/* height: 20px; */ + padding: 4px 20px 3px 20px; + border-bottom: 1px solid #999999; + color: #333333; + font-size: 11px; + font-weight: bold; + background-color: #EBEBEB; + background-image: url(images/listheader_aqua.gif); +} + +#contact-details +{ + padding: 15px 20px 10px 20px; +} + +#contact-details table td.title +{ + color: #666666; + font-weight: bold; + text-align: right; + padding-right: 10px; +} + + + + + + diff --git a/skins/default/common.css b/skins/default/common.css new file mode 100755 index 000000000..2ba97d843 --- /dev/null +++ b/skins/default/common.css @@ -0,0 +1,277 @@ +/***** RoundCube|Mail basic styles *****/ + +body +{ + margin: 8px; + background-color: #F2F2F2; /* #EBEBEB; */ + color: #000000; +} + +body.iframe +{ + margin: 0px; +} + +body.extwin +{ + margin: 10px; +} + +body, td, th, span, div, p, h3 +{ + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + color: #000000; +} + +th +{ + font-weight: normal; +} + +h3 +{ + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + font-size: 18px; + color: #000000; +} + +a, a:active, a:visited +{ + color: #000000; +} + +a.button, a.button:visited, a.tab, a.tab:visited, a.axislist +{ + color: #000000; + text-decoration: none; +} + +a.tab +{ + width: 80px; + display: block; + text-align: center; +} + +hr +{ + height: 1px; + background-color: #666666; + border-style: none; +} + +input, textarea +{ + font-size: 9pt; + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + padding: 1px; + padding-left: 3px; + padding-right: 3px; + background-color: #ffffff; + border: 1px solid #666666; +} + +input.button +{ + height: 20px; + color: #333333; + font-size: 12px; + padding-left: 8px; + padding-right: 8px; + background: url(images/buttons/bg.gif) repeat-x #f0f0f0; + border: 1px solid #a4a4a4; +} + +input.button:hover +{ + color: black; +} + +img +{ + behavior: url('skins/default/pngbehavior.htc'); +} + +.alttext +{ + font-size: 11px; +} + + +/** common user interface objects */ + +#header +{ +/* margin: 10px auto; */ + width: 170px; + height: 40px; + margin-top: 0px; + margin-left: 10px; +/* border: 1px solid #cccccc; */ +} + +#footer +{ + position: fixed !important; + left: 0px; + right: 0px; + bottom: 0px !important; + height: 40px; + background-color: #f2f2f2; + + /* css hack for IE */ + position: absolute; + bottom: auto; + top: expression((parseInt(document.documentElement.clientHeight)+parseInt(document.documentElement.scrollTop)-42)+'px'); + width: expression(parseInt(document.documentElement.clientWidth)+'px'); +} + +#taskbar +{ + margin: 0px auto; + width: 400px; + height: 34px; + padding: 3px; + text-align: center; + border: 1px solid #cccccc; +} + +#taskbar a +{ + padding-right: 10px; +} + + +#message +{ + position: absolute; + display: none; + top: 0px; + left: 200px; + right: 200px; + z-index: 5000; +} + +#message div +{ + width: 400px; + margin: 0px auto; + height: 22px; + min-height: 22px; + padding: 8px 10px 8px 46px; +} + +#message div.notice, +#remote-objects-message +{ + background: url(images/display/info.png) 6px 3px no-repeat; + background-color: #F7FDCB; + border: 1px solid #C2D071; +} + +#message div.error, +#message div.warning +{ + background: url(images/display/warning.png) 6px 3px no-repeat; + background-color: #EF9398; + border: 1px solid #DC5757; +} + +#message div.confirmation +{ + background: url(images/display/confirm.png) 6px 3px no-repeat; + background-color: #A6EF7B; + border: 1px solid #76C83F; +} + +#message div.loading +{ + background: url(images/display/loading.gif) 6px 3px no-repeat; + background-color: #EFEFEF; + border: 1px solid #CCCCCC; +} + + +/***** common table settings ******/ + +table.records-table thead tr td +{ + height: 20px; + padding: 0px 4px 0px 4px; + vertical-align: middle; + border-bottom: 1px solid #999999; + color: #333333; + background-color: #EBEBEB; + background-image: url(images/listheader_aqua.gif); + font-size: 11px; + font-weight: bold; +} + +table.records-table tbody tr td +{ + height: 16px; + padding: 2px 4px 2px 4px; + font-size: 11px; + white-space: nowrap; + border-bottom: 1px solid #EBEBEB; + overflow: hidden; + text-align: left; +} + +table.records-table tr +{ + background-color: #FFFFFF; +} + +table.records-table tr.selected td +{ + font-weight: bold; + color: #FFFFFF; + background-color: #CC3333; +} + + + +/***** roundcube webmail pre-defined classes *****/ + +a.rcmContactAddress +{ + text-decoration: none; +} + +a.rcmContactAddress:hover +{ + text-decoration: underline; +} + +#rcmKSearchpane +{ + background-color: #F9F9F9; + border: 1px solid #CCCCCC; +} + +#rcmKSearchpane ul +{ + margin: 0px; + padding: 2px; + list-style-image: none; + list-style-type: none; +} + +#rcmKSearchpane ul li +{ + height: 16px; + font-size: 11px; + padding-left: 8px; + padding-top: 2px; + padding-right: 8px; + white-space: nowrap; +} + +#rcmKSearchpane ul li.selected +{ + color: #ffffff; + background-color: #CC3333; +} + diff --git a/skins/default/images/blank.gif b/skins/default/images/blank.gif new file mode 100644 index 000000000..ea83374c1 Binary files /dev/null and b/skins/default/images/blank.gif differ diff --git a/skins/default/images/buttons/add_act.png b/skins/default/images/buttons/add_act.png new file mode 100644 index 000000000..0454ff856 Binary files /dev/null and b/skins/default/images/buttons/add_act.png differ diff --git a/skins/default/images/buttons/add_contact_act.png b/skins/default/images/buttons/add_contact_act.png new file mode 100644 index 000000000..994242c0a Binary files /dev/null and b/skins/default/images/buttons/add_contact_act.png differ diff --git a/skins/default/images/buttons/add_contact_pas.png b/skins/default/images/buttons/add_contact_pas.png new file mode 100644 index 000000000..91ca0d08a Binary files /dev/null and b/skins/default/images/buttons/add_contact_pas.png differ diff --git a/skins/default/images/buttons/add_pas.png b/skins/default/images/buttons/add_pas.png new file mode 100644 index 000000000..cf4de2e0b Binary files /dev/null and b/skins/default/images/buttons/add_pas.png differ diff --git a/skins/default/images/buttons/addressbook.png b/skins/default/images/buttons/addressbook.png new file mode 100644 index 000000000..359f33e0f Binary files /dev/null and b/skins/default/images/buttons/addressbook.png differ diff --git a/skins/default/images/buttons/attach_act.png b/skins/default/images/buttons/attach_act.png new file mode 100644 index 000000000..612d36d19 Binary files /dev/null and b/skins/default/images/buttons/attach_act.png differ diff --git a/skins/default/images/buttons/attach_pas.png b/skins/default/images/buttons/attach_pas.png new file mode 100644 index 000000000..37c67c9c3 Binary files /dev/null and b/skins/default/images/buttons/attach_pas.png differ diff --git a/skins/default/images/buttons/back_act.png b/skins/default/images/buttons/back_act.png new file mode 100644 index 000000000..d5352b5b3 Binary files /dev/null and b/skins/default/images/buttons/back_act.png differ diff --git a/skins/default/images/buttons/back_pas.png b/skins/default/images/buttons/back_pas.png new file mode 100644 index 000000000..ac15bade5 Binary files /dev/null and b/skins/default/images/buttons/back_pas.png differ diff --git a/skins/default/images/buttons/bg.gif b/skins/default/images/buttons/bg.gif new file mode 100644 index 000000000..e2191c910 Binary files /dev/null and b/skins/default/images/buttons/bg.gif differ diff --git a/skins/default/images/buttons/compose_act.png b/skins/default/images/buttons/compose_act.png new file mode 100644 index 000000000..c7e2d61d5 Binary files /dev/null and b/skins/default/images/buttons/compose_act.png differ diff --git a/skins/default/images/buttons/compose_pas.png b/skins/default/images/buttons/compose_pas.png new file mode 100644 index 000000000..5fd9d7ab2 Binary files /dev/null and b/skins/default/images/buttons/compose_pas.png differ diff --git a/skins/default/images/buttons/contacts_act.png b/skins/default/images/buttons/contacts_act.png new file mode 100644 index 000000000..987612817 Binary files /dev/null and b/skins/default/images/buttons/contacts_act.png differ diff --git a/skins/default/images/buttons/contacts_pas.png b/skins/default/images/buttons/contacts_pas.png new file mode 100644 index 000000000..25dfd8c32 Binary files /dev/null and b/skins/default/images/buttons/contacts_pas.png differ diff --git a/skins/default/images/buttons/delete_act.png b/skins/default/images/buttons/delete_act.png new file mode 100644 index 000000000..b141cd3a6 Binary files /dev/null and b/skins/default/images/buttons/delete_act.png differ diff --git a/skins/default/images/buttons/delete_pas.png b/skins/default/images/buttons/delete_pas.png new file mode 100644 index 000000000..fc1e892a4 Binary files /dev/null and b/skins/default/images/buttons/delete_pas.png differ diff --git a/skins/default/images/buttons/download_act.png b/skins/default/images/buttons/download_act.png new file mode 100644 index 000000000..694527de3 Binary files /dev/null and b/skins/default/images/buttons/download_act.png differ diff --git a/skins/default/images/buttons/download_pas.png b/skins/default/images/buttons/download_pas.png new file mode 100644 index 000000000..fb39db5dd Binary files /dev/null and b/skins/default/images/buttons/download_pas.png differ diff --git a/skins/default/images/buttons/edit_contact_act.png b/skins/default/images/buttons/edit_contact_act.png new file mode 100644 index 000000000..57b278278 Binary files /dev/null and b/skins/default/images/buttons/edit_contact_act.png differ diff --git a/skins/default/images/buttons/edit_contact_pas.png b/skins/default/images/buttons/edit_contact_pas.png new file mode 100644 index 000000000..b999294c8 Binary files /dev/null and b/skins/default/images/buttons/edit_contact_pas.png differ diff --git a/skins/default/images/buttons/forward_act.png b/skins/default/images/buttons/forward_act.png new file mode 100644 index 000000000..2fdbdbad0 Binary files /dev/null and b/skins/default/images/buttons/forward_act.png differ diff --git a/skins/default/images/buttons/forward_pas.png b/skins/default/images/buttons/forward_pas.png new file mode 100644 index 000000000..e671398eb Binary files /dev/null and b/skins/default/images/buttons/forward_pas.png differ diff --git a/skins/default/images/buttons/inbox_act.png b/skins/default/images/buttons/inbox_act.png new file mode 100644 index 000000000..30c1e7635 Binary files /dev/null and b/skins/default/images/buttons/inbox_act.png differ diff --git a/skins/default/images/buttons/inbox_pas.png b/skins/default/images/buttons/inbox_pas.png new file mode 100644 index 000000000..67f4da08d Binary files /dev/null and b/skins/default/images/buttons/inbox_pas.png differ diff --git a/skins/default/images/buttons/logout.gif b/skins/default/images/buttons/logout.gif new file mode 100644 index 000000000..f8000fc5a Binary files /dev/null and b/skins/default/images/buttons/logout.gif differ diff --git a/skins/default/images/buttons/logout.png b/skins/default/images/buttons/logout.png new file mode 100644 index 000000000..2fe632ab3 Binary files /dev/null and b/skins/default/images/buttons/logout.png differ diff --git a/skins/default/images/buttons/mail.png b/skins/default/images/buttons/mail.png new file mode 100644 index 000000000..30c1e7635 Binary files /dev/null and b/skins/default/images/buttons/mail.png differ diff --git a/skins/default/images/buttons/next_act.png b/skins/default/images/buttons/next_act.png new file mode 100644 index 000000000..fed82945c Binary files /dev/null and b/skins/default/images/buttons/next_act.png differ diff --git a/skins/default/images/buttons/next_pas.png b/skins/default/images/buttons/next_pas.png new file mode 100644 index 000000000..df80ad344 Binary files /dev/null and b/skins/default/images/buttons/next_pas.png differ diff --git a/skins/default/images/buttons/previous_act.png b/skins/default/images/buttons/previous_act.png new file mode 100644 index 000000000..457d873c5 Binary files /dev/null and b/skins/default/images/buttons/previous_act.png differ diff --git a/skins/default/images/buttons/previous_pas.png b/skins/default/images/buttons/previous_pas.png new file mode 100644 index 000000000..db7186d56 Binary files /dev/null and b/skins/default/images/buttons/previous_pas.png differ diff --git a/skins/default/images/buttons/print_act.png b/skins/default/images/buttons/print_act.png new file mode 100644 index 000000000..19e1f3341 Binary files /dev/null and b/skins/default/images/buttons/print_act.png differ diff --git a/skins/default/images/buttons/print_pas.png b/skins/default/images/buttons/print_pas.png new file mode 100644 index 000000000..b6c0e7838 Binary files /dev/null and b/skins/default/images/buttons/print_pas.png differ diff --git a/skins/default/images/buttons/reply_act.png b/skins/default/images/buttons/reply_act.png new file mode 100644 index 000000000..89ad7cc9b Binary files /dev/null and b/skins/default/images/buttons/reply_act.png differ diff --git a/skins/default/images/buttons/reply_pas.png b/skins/default/images/buttons/reply_pas.png new file mode 100644 index 000000000..0b389337e Binary files /dev/null and b/skins/default/images/buttons/reply_pas.png differ diff --git a/skins/default/images/buttons/send_act.png b/skins/default/images/buttons/send_act.png new file mode 100644 index 000000000..999d21d5d Binary files /dev/null and b/skins/default/images/buttons/send_act.png differ diff --git a/skins/default/images/buttons/send_pas.png b/skins/default/images/buttons/send_pas.png new file mode 100644 index 000000000..db227c902 Binary files /dev/null and b/skins/default/images/buttons/send_pas.png differ diff --git a/skins/default/images/buttons/settings.png b/skins/default/images/buttons/settings.png new file mode 100644 index 000000000..41395bf7c Binary files /dev/null and b/skins/default/images/buttons/settings.png differ diff --git a/skins/default/images/buttons/source_act.png b/skins/default/images/buttons/source_act.png new file mode 100644 index 000000000..3971b5cee Binary files /dev/null and b/skins/default/images/buttons/source_act.png differ diff --git a/skins/default/images/buttons/source_pas.png b/skins/default/images/buttons/source_pas.png new file mode 100644 index 000000000..aec440a5e Binary files /dev/null and b/skins/default/images/buttons/source_pas.png differ diff --git a/skins/default/images/buttons/spacer.gif b/skins/default/images/buttons/spacer.gif new file mode 100644 index 000000000..5bfd67a2d Binary files /dev/null and b/skins/default/images/buttons/spacer.gif differ diff --git a/skins/default/images/display/confirm.png b/skins/default/images/display/confirm.png new file mode 100644 index 000000000..27265f8a6 Binary files /dev/null and b/skins/default/images/display/confirm.png differ diff --git a/skins/default/images/display/info.png b/skins/default/images/display/info.png new file mode 100644 index 000000000..85462e4b9 Binary files /dev/null and b/skins/default/images/display/info.png differ diff --git a/skins/default/images/display/loading.gif b/skins/default/images/display/loading.gif new file mode 100755 index 000000000..4d994852b Binary files /dev/null and b/skins/default/images/display/loading.gif differ diff --git a/skins/default/images/display/warning.png b/skins/default/images/display/warning.png new file mode 100644 index 000000000..9909617f4 Binary files /dev/null and b/skins/default/images/display/warning.png differ diff --git a/skins/default/images/icons/abcard.png b/skins/default/images/icons/abcard.png new file mode 100644 index 000000000..d0d850044 Binary files /dev/null and b/skins/default/images/icons/abcard.png differ diff --git a/skins/default/images/icons/attachment.png b/skins/default/images/icons/attachment.png new file mode 100644 index 000000000..0fcf46499 Binary files /dev/null and b/skins/default/images/icons/attachment.png differ diff --git a/skins/default/images/icons/dot.png b/skins/default/images/icons/dot.png new file mode 100644 index 000000000..99f736516 Binary files /dev/null and b/skins/default/images/icons/dot.png differ diff --git a/skins/default/images/icons/flagged.png b/skins/default/images/icons/flagged.png new file mode 100644 index 000000000..58e3e1c2d Binary files /dev/null and b/skins/default/images/icons/flagged.png differ diff --git a/skins/default/images/icons/folder-closed.png b/skins/default/images/icons/folder-closed.png new file mode 100644 index 000000000..5cbf72a6a Binary files /dev/null and b/skins/default/images/icons/folder-closed.png differ diff --git a/skins/default/images/icons/folder-inbox.png b/skins/default/images/icons/folder-inbox.png new file mode 100644 index 000000000..995ca8128 Binary files /dev/null and b/skins/default/images/icons/folder-inbox.png differ diff --git a/skins/default/images/icons/folder-junk.png b/skins/default/images/icons/folder-junk.png new file mode 100644 index 000000000..06fbd49d5 Binary files /dev/null and b/skins/default/images/icons/folder-junk.png differ diff --git a/skins/default/images/icons/folder-open.png b/skins/default/images/icons/folder-open.png new file mode 100644 index 000000000..09ba4b323 Binary files /dev/null and b/skins/default/images/icons/folder-open.png differ diff --git a/skins/default/images/icons/folder-sent.png b/skins/default/images/icons/folder-sent.png new file mode 100644 index 000000000..2968ab5e9 Binary files /dev/null and b/skins/default/images/icons/folder-sent.png differ diff --git a/skins/default/images/icons/folder-trash.png b/skins/default/images/icons/folder-trash.png new file mode 100644 index 000000000..0712aaa71 Binary files /dev/null and b/skins/default/images/icons/folder-trash.png differ diff --git a/skins/default/images/icons/forwarded.png b/skins/default/images/icons/forwarded.png new file mode 100644 index 000000000..1ea246f8e Binary files /dev/null and b/skins/default/images/icons/forwarded.png differ diff --git a/skins/default/images/icons/plus.gif b/skins/default/images/icons/plus.gif new file mode 100755 index 000000000..854b5eb34 Binary files /dev/null and b/skins/default/images/icons/plus.gif differ diff --git a/skins/default/images/icons/replied.png b/skins/default/images/icons/replied.png new file mode 100644 index 000000000..4a5213262 Binary files /dev/null and b/skins/default/images/icons/replied.png differ diff --git a/skins/default/images/icons/silhouette.png b/skins/default/images/icons/silhouette.png new file mode 100644 index 000000000..c7d97489b Binary files /dev/null and b/skins/default/images/icons/silhouette.png differ diff --git a/skins/default/images/icons/unread.png b/skins/default/images/icons/unread.png new file mode 100644 index 000000000..31f640632 Binary files /dev/null and b/skins/default/images/icons/unread.png differ diff --git a/skins/default/images/listheader_aqua.gif b/skins/default/images/listheader_aqua.gif new file mode 100644 index 000000000..59f44ea98 Binary files /dev/null and b/skins/default/images/listheader_aqua.gif differ diff --git a/skins/default/images/listheader_dark.gif b/skins/default/images/listheader_dark.gif new file mode 100644 index 000000000..cd35555b5 Binary files /dev/null and b/skins/default/images/listheader_dark.gif differ diff --git a/skins/default/images/listheader_light.gif b/skins/default/images/listheader_light.gif new file mode 100644 index 000000000..8d9e6cac0 Binary files /dev/null and b/skins/default/images/listheader_light.gif differ diff --git a/skins/default/images/mailbox_list.gif b/skins/default/images/mailbox_list.gif new file mode 100644 index 000000000..d53de17f1 Binary files /dev/null and b/skins/default/images/mailbox_list.gif differ diff --git a/skins/default/images/mailbox_selected.gif b/skins/default/images/mailbox_selected.gif new file mode 100644 index 000000000..bbc2265e0 Binary files /dev/null and b/skins/default/images/mailbox_selected.gif differ diff --git a/skins/default/images/rcube_watermark.png b/skins/default/images/rcube_watermark.png new file mode 100644 index 000000000..a9e83e1ad Binary files /dev/null and b/skins/default/images/rcube_watermark.png differ diff --git a/skins/default/images/roundcube_logo.gif b/skins/default/images/roundcube_logo.gif new file mode 100644 index 000000000..b77fd3d0b Binary files /dev/null and b/skins/default/images/roundcube_logo.gif differ diff --git a/skins/default/images/roundcube_logo.png b/skins/default/images/roundcube_logo.png new file mode 100644 index 000000000..847d01122 Binary files /dev/null and b/skins/default/images/roundcube_logo.png differ diff --git a/skins/default/images/roundcube_logo_print.gif b/skins/default/images/roundcube_logo_print.gif new file mode 100644 index 000000000..8fbf6a8eb Binary files /dev/null and b/skins/default/images/roundcube_logo_print.gif differ diff --git a/skins/default/images/tab_act.gif b/skins/default/images/tab_act.gif new file mode 100644 index 000000000..9329db11f Binary files /dev/null and b/skins/default/images/tab_act.gif differ diff --git a/skins/default/images/tab_pas.gif b/skins/default/images/tab_pas.gif new file mode 100644 index 000000000..26adabf00 Binary files /dev/null and b/skins/default/images/tab_pas.gif differ diff --git a/skins/default/includes/header.html b/skins/default/includes/header.html new file mode 100644 index 000000000..b795ad19b --- /dev/null +++ b/skins/default/includes/header.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/skins/default/includes/settingscripts.html b/skins/default/includes/settingscripts.html new file mode 100644 index 000000000..b7699708d --- /dev/null +++ b/skins/default/includes/settingscripts.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/skins/default/includes/settingstabs.html b/skins/default/includes/settingstabs.html new file mode 100644 index 000000000..ef561d9f4 --- /dev/null +++ b/skins/default/includes/settingstabs.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/skins/default/includes/taskbar.html b/skins/default/includes/taskbar.html new file mode 100644 index 000000000..b0ebc552c --- /dev/null +++ b/skins/default/includes/taskbar.html @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/skins/default/mail.css b/skins/default/mail.css new file mode 100644 index 000000000..239024c73 --- /dev/null +++ b/skins/default/mail.css @@ -0,0 +1,647 @@ +/***** RoundCube|Mail mail task styles *****/ + + +#messagetoolbar +{ + position: absolute; + top: 20px; + left: 200px; + right: 250px; + height: 35px; +/* border: 1px solid #cccccc; */ +} + +#messagetoolbar a +{ + padding-right: 10px; +} + +#messagetoolbar select +{ + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #333333; +} + +#messagetoolbar select.mboxlist +{ + position: absolute; + left: 300px; + top: 10px; +} + +#messagetoolbar select.mboxlist option +{ + padding-left: 15px; +} + +#messagetoolbar select.mboxlist option[value="0"] +{ + padding-left: 2px; +} + +#listcontrols +{ + position: absolute; + left: 200px; + bottom: 60px; + height: 16px; + width: 400px; +} + +#listcontrols a, +#listcontrols a:active, +#listcontrols a:visited +{ + color: #999999; + font-size: 11px; + text-decoration: none; +} + +#listcontrols a.active, +#listcontrols a.active:active, +#listcontrols a.active:visited +{ + color: #CC0000; +} + +#listcontrols a.active:hover +{ + text-decoration: underline; +} + +#messagecountbar +{ + position: absolute; + top: 35px; + right: 60px; + width: 250px; + height: 20px; + text-align: right; +} + +#messagecountbar span +{ + font-size: 11px; + color: #333333; +} + +#messagepartcontainer +{ + position: absolute; + top: 80px; + left: 20px; + right: 20px; + bottom: 20px; +} + +#mailcontframe +{ + position: absolute; + top: 60px; + left: 200px; + right: 40px; + bottom: 80px; + border: 1px solid #999999; + background-color: #F9F9F9; + overflow: auto; + /* css hack for IE */ + width: expression((parseInt(document.documentElement.clientWidth)-240)+'px'); + height: expression((parseInt(document.documentElement.clientHeight)-140)+'px'); +} + + +#messagepartframe +{ + border: 1px solid #999999; + background-color: #F9F9F9; +} + + +#partheader +{ + position: absolute; + top: 10px; + left: 220px; + height: 40px; +} + +#partheader table td +{ + padding-left: 2px; + padding-right: 4px; + vertical-align: middle; + font-size: 11px; +} + +#partheader table td.title +{ + color: #666666; + font-weight: bold; +} + +#rcmdraglayer +{ + width: 300px; + border: 1px solid #999999; + background-color: #F9F9F9; + padding-left: 8px; + padding-right: 8px; + padding-top: 3px; + padding-bottom: 3px; + font-size: 11px; + opacity: 0.6; + -moz-opacity: 0.6; +} + + +/** mailbox list styles */ + +#mailboxlist-header +{ + position: absolute; + top: 80px; + left: 20px; + width: 140px !important; +/* width: 162px; */ + height: 13px; + padding: 3px 10px 2px 10px; + background-color: #EBEBEB; + background-image: url(images/listheader_aqua.gif); + border: 1px solid #CCCCCC; + color: #333333; + font-size: 11px; + font-weight: bold; +} + +#mailboxlist +{ + position: absolute; + top: 100px; + left: 20px; + width: 160px; + height: auto; + margin: 0px; + padding: 0px; + border: 1px solid #CCCCCC; + background-color: #F9F9F9; + list-style-image: none; + list-style-type: none; +} + +#mailboxlist li +{ + height: 18px; + font-size: 11px; + background: url(images/icons/folder-closed.png) no-repeat; + background-position: 10px 1px; + border-bottom: 1px solid #EBEBEB; +/* IE 5.5 margin-left: -16px; */ +} + +#mailboxlist li.inbox +{ + background-image: url(images/icons/folder-inbox.png); +} + +#mailboxlist li.sent +{ + background-image: url(images/icons/folder-sent.png); +} + +#mailboxlist li.junk +{ + background-image: url(images/icons/folder-junk.png); +} + +#mailboxlist li.trash +{ + background-image: url(images/icons/folder-trash.png); +} + +#mailboxlist li a +{ + display: block; + padding-left: 32px; + padding-top: 2px; + padding-bottom: 2px; + text-decoration: none; +} + +#mailboxlist li, #mailboxlist li.unread +{ + /* background-image: url(images/mailbox_list.gif); */ +} + +#mailboxlist li.unread +{ + font-weight: bold; +} + +#mailboxlist li.selected +{ + background-color: #929292; + border-bottom: 1px solid #898989; +} + +#mailboxlist li.selected a +{ + color: #FFF; + font-weight: bold; +} + + +/** message list styles */ + +body.messagelist +{ + margin: 0px; + background-color: #F9F9F9; +} + +#messagelist +{ + width: 100%; + table-layout: fixed; + /* css hack for IE */ + width: expression(document.getElementById('mailcontframe').clientWidth); +} + +#messagelist thead tr td +{ + height: 20px; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 2px; + padding-right: 4px; + vertical-align: middle; + border-bottom: 1px solid #999999; + color: #333333; + background-color: #EBEBEB; + background-image: url(images/listheader_aqua.gif); + font-size: 11px; + font-weight: bold; +} + +#messagelist tbody tr td +{ + height: 16px !important; + height: 20px; + padding: 2px; + padding-right: 4px; + font-size: 11px; + white-space: nowrap; + border-bottom: 1px solid #EBEBEB; + cursor: pointer; +} + +#messagelist tr td.icon +{ + width: 16px; +} + +#messagelist tr td.subject +{ + overflow: hidden; + text-align: left; +} + +#messagelist tr td.size +{ + width: 60px; + text-align: right; +} + +#messagelist tr td.from, +#messagelist tr td.to +{ + width: 180px; + overflow: hidden; +} + +#messagelist tr td.date +{ + width: 110px; +} + +#messagelist tr.message +{ + background-color: #FFFFFF; +} + +/* +#messagelist tr.odd +{ + background-color: #F9F9F9; +} +*/ + +#messagelist tr.unread +{ + font-weight: bold; + background-color: #FFFFFF; +} + +#messagelist tr.selected td +{ + font-weight: bold; + color: #FFFFFF; + background-color: #CC3333; +} + +#messagelist tr.selected td a.rcmContactAddress +{ + color: #FFFFFF; +} + + +/** message view styles */ + + +#messageframe +{ + position: absolute; + top: 70px; + left: 200px; + right: 40px; + /* css hack for IE */ + margin-bottom: 50px; + width: expression(document.body.clientWidth-240); +} + +table.headers-table +{ + width: 100%; + background-color: #EBEBEB; + table-layout: fixed; + +} + +table.headers-table tr td +{ + font-size: 11px; + border-bottom:1px solid #FFFFFF; +} + +table.headers-table td.header-title +{ + width: 70px; + color: #666666; + font-weight: bold; + text-align: right; + padding-right: 4px; +} + +table.headers-table tr td.subject +{ + width: 95%; + font-weight: bold; +} + +#attachment-list +{ + margin: 0px; + padding: 0px 0px 0px 68px; + height: 18px; + list-style-image: none; + list-style-type: none; + background-color: #DFDFDF; + background: url(images/icons/attachment.png) no-repeat #DFDFDF; + background-position: 52px 1px; + border-bottom: 1px solid #FFFFFF; +} + +#attachment-list li +{ +/* display: block; */ + float: left; + height: 18px; + font-size: 11px; + padding: 2px 10px 0px 10px; +} + +#attachment-list li a +{ + text-decoration: none; +} + +#attachment-list li a:hover +{ + text-decoration: underline; +} + +#messagebody +{ + min-height: 300px; + margin-top: 10px; + margin-bottom: 50px; + background-color: #FFFFFF; + border: 1px solid #cccccc; + border-top: none; +} + +div.message-part +{ + padding: 8px; + padding-top: 10px; + border-top: 1px solid #cccccc; + overflow: hidden; +} + +div.message-part a +{ + color: #0000CC; +} + +div.message-part pre +{ + margin: 0px; + padding: 0px; +} + + +#remote-objects-message +{ + display: none; + height: 20px; + min-height: 20px; + padding: 10px 10px 6px 46px; + margin-top: 8px; +} + +#remote-objects-message a +{ + color: #666666; + padding-left: 10px; +} + +#remote-objects-message a:hover +{ + color: #333333; +} + + +/** message compose styles */ + +#priority-selector +{ + position: absolute; + left: 200px; + top: 10px; +} + +#compose-container +{ + position: absolute; + top: 70px; + left: 200px; + right: 40px; + bottom: 60px; + padding: 0px; + margin: 0px; + /* css hack for IE */ + width: expression(document.documentElement.clientWidth-240); + /* height: expression((parseInt(document.documentElement.clientHeight)-130)+'px'); */ +} + +/* +#compose-headers +{ + position: absolute; + top: 70px; + left: 200px; + height: 84px; + border-top: 1px solid #cccccc; + overflow: auto; +} + +#compose-headers td +{ + padding-top: 1px; + padding-bottom: 1px; + border-right: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; +} +*/ + +#compose-headers +{ + width: 100%; +} + +/* +#compose-headers td +{ + width: 100%; +} +*/ + +#compose-headers td.top +{ + vertical-align: top; +} + +#compose-headers td.title, +#compose-subject td.title +{ + width: 80px !important; + color: #666666; + font-size: 11px; + font-weight: bold; + padding-right: 10px; + white-space: nowrap; +} + +#compose-headers td.add-button +{ + width: 40px !important; + text-align: right; + vertical-align: bottom; +} + +#compose-headers td.add-button a +{ + color: #666666; + font-size: 11px; + text-decoration: none; +} + +#compose-headers td textarea +{ + width: 100%; + height: 40px; +} + +#compose-headers td input +{ + width: 100%; +} + +#compose-cc, +#compose-bcc, +#compose-replyto +{ + display: none; +} + +#compose-body +{ + margin-top: 10px; + width: 100% !important; + width: 95%; + height: 95%; + min-height: 400px; + font-size: 9pt; + font-family: "Courier New", Courier, monospace; +} + +#compose-attachments +{ + position: absolute; + top: 100px; + left: 20px; + width: 160px; +} + +#compose-attachments ul +{ + margin: 0px; + padding: 0px; + border: 1px solid #CCCCCC; + background-color: #F9F9F9; + list-style-image: none; + list-style-type: none; +} + +#compose-attachments ul li +{ + height: 18px; + font-size: 11px; + padding-left: 26px; + padding-top: 2px; + padding-right: 4px; + background: url(images/icons/attachment.png) no-repeat; + background-position: 4px 1px; + border-bottom: 1px solid #EBEBEB; + white-space: nowrap; + overflow: hidden; +} + +#attachment-form +{ + position: absolute; + top: 150px; + left: 20px; + z-index: 200; + padding: 8px; + visibility: hidden; + border: 1px solid #CCCCCC; + background-color: #F9F9F9; +} + +#attachment-form input.button +{ + margin-top: 8px; +} + + diff --git a/skins/default/pngbehavior.htc b/skins/default/pngbehavior.htc new file mode 100644 index 000000000..553699a2f --- /dev/null +++ b/skins/default/pngbehavior.htc @@ -0,0 +1,52 @@ + + + + \ No newline at end of file diff --git a/skins/default/print.css b/skins/default/print.css new file mode 100644 index 000000000..ac184db9d --- /dev/null +++ b/skins/default/print.css @@ -0,0 +1,111 @@ +/***** RoundCube|Mail message print styles *****/ + +body +{ + background-color: #ffffff; + color: #000000; + margin: 2mm; +} + +body, td, th, span, div, p, h3 +{ + font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + font-size: 9pt; + color: #000000; +} + +h3 +{ + font-size: 18px; + color: #000000; +} + +a, a:active, a:visited +{ + color: #000000; +} + +#header +{ + margin-left: 5mm; + margin-bottom: 3mm; +} + +#messageframe +{ + position: relative; +} + +table.headers-table +{ + table-layout: fixed; +} + +table.headers-table tr td +{ + font-size: 9pt; +} + +table.headers-table td.header-title +{ + color: #666666; + font-weight: bold; + text-align: right; + vertical-align: top; + padding-right: 4mm; + white-space: nowrap; +} + +table.headers-table tr td.subject +{ + width: 90%; + font-weight: bold; +} + +#attachment-list +{ + margin-top: 3mm; + padding-top: 3mm; + border-top: 1pt solid #cccccc; +} + +#attachment-list li +{ + font-size: 9pt; +} + +#attachment-list li a +{ + text-decoration: none; +} + +#attachment-list li a:hover +{ + text-decoration: underline; +} + +#messagebody +{ + margin-top: 5mm; + border-top: none; +} + +div.message-part +{ + padding: 2mm; + margin-top: 5mm; + margin-bottom: 5mm; + border-top: 1pt solid #cccccc; +} + +div.message-part a +{ + color: #0000CC; +} + +div.message-part pre +{ + margin: 0; + padding: 0; + font-size: 9pt; +} diff --git a/skins/default/settings.css b/skins/default/settings.css new file mode 100644 index 000000000..7b4b88beb --- /dev/null +++ b/skins/default/settings.css @@ -0,0 +1,150 @@ +/***** RoundCube|Mail settings task styles *****/ + + +#tabsbar +{ + position: absolute; + top: 42px; + left: 220px; + right: 60px; + height: 22px; + border-bottom: 1px solid #999999; + white-space: nowrap; + /* css hack for IE */ + width: expression((parseInt(document.documentElement.clientWidth)-280)+'px'); +} + +span.tablink, +span.tablink-selected +{ + float: left; + width: 80px; + height: 17px !important; + height: 15px; + padding: 5px 10px 2px 10px; + background: url('images/tab_pas.gif') top left no-repeat; +} + +span.tablink-selected +{ + background: url('images/tab_act.gif') top left no-repeat; +} + +span.tablink a +{ + color: #555555; +} + +span.tablink a, +span.tablink-selected a +{ + text-decoration: none; +} + +#userprefs-box +{ + position: absolute; + top: 90px; + left: 20px; + width: 550px; + border: 1px solid #999999; +} + +#userprefs-box table td.title +{ + color: #666666; + padding-right: 10px; +} + +#identities-list, +#folder-manager +{ + position: absolute; + top: 90px; + left: 20px; +} + +#identities-table +{ + width: 500px; + border: 1px solid #999999; + background-color: #F9F9F9; +} + +#identities-table tbody td +{ + cursor: pointer; +} + +#identity-frame +{ + position: relative; + margin-top: 20px; + border: 1px solid #999999; +} + +#identity-details +{ + margin-top: 30px; + width: 500px; + border: 1px solid #999999; +} + +#identity-details table td.title +{ + color: #666666; + font-weight: bold; + text-align: right; + padding-right: 10px; +} + +#userprefs-title, +#identity-title, +div.boxtitle, +#subscription-table thead td +{ + height: 12px !important; + padding: 4px 20px 3px 6px; + border-bottom: 1px solid #999999; + color: #333333; + font-size: 11px; + font-weight: bold; + background-color: #EBEBEB; + background-image: url(images/listheader_aqua.gif); +} + +div.settingsbox +{ + width: 500px; + margin-top: 20px; + border: 1px solid #999999; +} + +div.settingspart +{ + display: block; + padding: 10px; +} + +#subscription-table +{ + width: 500px; + border: 1px solid #999999; +} + +#subscription-table tbody td +{ + padding-left: 6px; + padding-right: 20px; + white-space: nowrap; + border-bottom: 1px solid #EBEBEB; + background-color: #F9F9F9; +} + +/* +#subscription-table tbody td select +{ + width: 150px; +} +*/ + diff --git a/skins/default/templates/addcontact.html b/skins/default/templates/addcontact.html new file mode 100644 index 000000000..773e6085f --- /dev/null +++ b/skins/default/templates/addcontact.html @@ -0,0 +1,24 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + +
+ +
+ + +


+" class="button" onclick="history.back()" />  + +

+ +
+ + + + diff --git a/skins/default/templates/addidentity.html b/skins/default/templates/addidentity.html new file mode 100644 index 000000000..0875a99a8 --- /dev/null +++ b/skins/default/templates/addidentity.html @@ -0,0 +1,35 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + + +
+ + +

+ +
+
+ +
+ + +


+ +

+
+
+
+ + + + + diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html new file mode 100644 index 000000000..99c2c8efb --- /dev/null +++ b/skins/default/templates/addressbook.html @@ -0,0 +1,37 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + +
+ + + + + +
+ +
+  + +
+ +
+ +
+ +
+ +
+ + + + + diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html new file mode 100644 index 000000000..7ff5f3006 --- /dev/null +++ b/skins/default/templates/compose.html @@ -0,0 +1,118 @@ + + + +RoundCube|Mail :: <roundcube:label name="compose" /> + + + + + + + + +
+ +
+ + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[Cc]
+[Bcc]
+ +
+ +
+ +
+ +
+
Attachments
+ +

+

+ +
+ + + + + + + + + diff --git a/skins/default/templates/editcontact.html b/skins/default/templates/editcontact.html new file mode 100644 index 000000000..b71836d5b --- /dev/null +++ b/skins/default/templates/editcontact.html @@ -0,0 +1,24 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + +
+ +
+ + +


+  + +

+ +
+ + + + diff --git a/skins/default/templates/editidentity.html b/skins/default/templates/editidentity.html new file mode 100644 index 000000000..07283f5be --- /dev/null +++ b/skins/default/templates/editidentity.html @@ -0,0 +1,37 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + + +
+ + +

+ +
+
+ +
+ + +


+  + +

+
+
+
+ + + + + + diff --git a/skins/default/templates/error.html b/skins/default/templates/error.html new file mode 100644 index 000000000..0b2d9b8b9 --- /dev/null +++ b/skins/default/templates/error.html @@ -0,0 +1,16 @@ + + + +RoundCube|Mail :: ERROR + + + + + + +
+$__page_content +
+ + + diff --git a/skins/default/templates/identities.html b/skins/default/templates/identities.html new file mode 100644 index 000000000..7ae2bf007 --- /dev/null +++ b/skins/default/templates/identities.html @@ -0,0 +1,23 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + +
+ + +

+
+ + + + + + diff --git a/skins/default/templates/login.html b/skins/default/templates/login.html new file mode 100644 index 000000000..7f44f5790 --- /dev/null +++ b/skins/default/templates/login.html @@ -0,0 +1,30 @@ + + + +Welcome to RoundCube|Mail + + + + + + + +
+
+ + +

"> + +

+
+ + + diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html new file mode 100644 index 000000000..2c47cb67f --- /dev/null +++ b/skins/default/templates/mail.html @@ -0,0 +1,50 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + +
+ + + + + +
+ +
+  + +
+ +
+ + +
+ +
+ +
+:  +  +  + +
+ + + + + diff --git a/skins/default/templates/managefolders.html b/skins/default/templates/managefolders.html new file mode 100644 index 000000000..99afd5c81 --- /dev/null +++ b/skins/default/templates/managefolders.html @@ -0,0 +1,38 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + +
+ +
+ + + +
+
+ +
+:  + + +
+
+
+ +
+ + + + + + diff --git a/skins/default/templates/message.html b/skins/default/templates/message.html new file mode 100644 index 000000000..aba6412db --- /dev/null +++ b/skins/default/templates/message.html @@ -0,0 +1,41 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + +
+ + + + + + + +
+ +
+  + +
+ +
+ + +
+ + + + +
+ + + + + diff --git a/skins/default/templates/messagepart.html b/skins/default/templates/messagepart.html new file mode 100644 index 000000000..924342f3f --- /dev/null +++ b/skins/default/templates/messagepart.html @@ -0,0 +1,22 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + +
+ +
+ + +
+ +
+ + + diff --git a/skins/default/templates/printmessage.html b/skins/default/templates/printmessage.html new file mode 100644 index 000000000..223c98b4d --- /dev/null +++ b/skins/default/templates/printmessage.html @@ -0,0 +1,18 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + +
+ + + +
+ + + diff --git a/skins/default/templates/settings.html b/skins/default/templates/settings.html new file mode 100644 index 000000000..b29734d5e --- /dev/null +++ b/skins/default/templates/settings.html @@ -0,0 +1,28 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + +
+
+ +
+ + +


+
+
+ + + + + + + diff --git a/skins/default/templates/showcontact.html b/skins/default/templates/showcontact.html new file mode 100644 index 000000000..1e24688dc --- /dev/null +++ b/skins/default/templates/showcontact.html @@ -0,0 +1,19 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + +
+ +
+ + +


+
+ + + diff --git a/skins/default/watermark.html b/skins/default/watermark.html new file mode 100644 index 000000000..85e53652a --- /dev/null +++ b/skins/default/watermark.html @@ -0,0 +1,12 @@ + + + + + + +
+ +
+ + + \ No newline at end of file diff --git a/temp/.htaccess b/temp/.htaccess new file mode 100644 index 000000000..8e6a345dc --- /dev/null +++ b/temp/.htaccess @@ -0,0 +1,2 @@ +Order allow,deny +Deny from all \ No newline at end of file -- cgit v1.2.3