From d326b0c67bb536d2296004c927e89ab8c4a548b5 Mon Sep 17 00:00:00 2001
From: =?utf8?q?J=C3=A9r=C3=A9my=20Bobbio?=
Date: Sat, 18 Jun 2011 17:00:48 +0200
Subject: [PATCH] Imported Upstream version 0.1
---
.htaccess | 8 +
CHANGELOG | 41 +-
INSTALL | 57 +-
README | 9 +-
SQL/mysql.update-0.1a.sql | 51 +
SQL/postgres.update.sql | 5 +-
UPGRADING | 11 +
bin/msgimport | 123 +
bin/quotaimg.php | 162 +-
config/db.inc.php.dist | 6 +-
config/main.inc.php.dist | 30 +-
index.php | 30 +-
installer/check.php | 156 +
installer/client.js | 36 +
installer/config.php | 517 +
installer/images/add.png | Bin 0 -> 733 bytes
installer/images/banner_bg.gif | Bin 0 -> 587 bytes
installer/images/banner_logo.gif | Bin 0 -> 4345 bytes
installer/images/banner_right.gif | Bin 0 -> 433 bytes
installer/images/delete.png | Bin 0 -> 715 bytes
installer/index.php | 73 +
installer/rcube_install.php | 374 +
installer/styles.css | 231 +
installer/test.php | 324 +
installer/welcome.html | 35 +
program/include/main.inc | 466 +-
program/include/rcmail_template.inc | 43 +-
program/include/rcube_contacts.inc | 13 +
program/include/rcube_db.inc | 23 +-
program/include/rcube_html.inc | 16 +-
program/include/rcube_imap.inc | 134 +-
program/include/rcube_ldap.inc | 8 +-
program/include/rcube_mdb2.inc | 12 +-
program/include/rcube_shared.inc | 49 +-
program/include/rcube_smtp.inc | 10 +-
program/include/rcube_user.inc | 482 +
program/include/session.inc | 11 +-
program/js/app.js | 152 +-
program/js/common.js | 100 +-
program/js/editor.js | 13 +-
program/js/editor_images.js | 20 +
program/js/list.js | 48 +-
program/js/tiny_mce/license.txt | 1008 +-
.../js/tiny_mce/plugins/media/css/content.css | 52 +-
.../js/tiny_mce/plugins/media/css/media.css | 136 +-
.../tiny_mce/plugins/media/editor_plugin.js | 2 +-
.../plugins/media/editor_plugin_src.js | 867 +-
.../tiny_mce/plugins/media/jscripts/embed.js | 146 +-
.../tiny_mce/plugins/media/jscripts/media.js | 1184 +-
program/js/tiny_mce/plugins/media/langs/en.js | 186 +-
program/js/tiny_mce/plugins/media/media.htm | 2 +-
program/js/tiny_mce/plugins/readme.txt | 2 +-
.../js/tiny_mce/plugins/table/css/cell.css | 32 +-
program/js/tiny_mce/plugins/table/css/row.css | 50 +-
.../js/tiny_mce/plugins/table/css/table.css | 26 +-
program/js/tiny_mce/plugins/table/table.htm | 2 +-
.../themes/advanced/css}/editor_popup.css | 0
.../themes/advanced/editor_template.js | 2 +-
.../themes/advanced/editor_template_src.js | 3032 +--
program/js/tiny_mce/themes/advanced/image.htm | 200 +-
program/js/tiny_mce/tiny_mce.js | 2 +-
program/js/tiny_mce/tiny_mce_popup.js | 588 +-
program/js/tiny_mce/tiny_mce_src.js | 15178 ++++++++--------
program/js/tiny_mce/utils/editable_selects.js | 122 +-
program/js/tiny_mce/utils/form_utils.js | 420 +-
program/js/tiny_mce/utils/mclayer.js | 420 +-
program/js/tiny_mce/utils/mctabs.js | 148 +-
program/js/tiny_mce/utils/validate.js | 438 +-
program/lib/imap.inc | 2569 +--
program/lib/magic | 10810 +++++++++++
program/lib/rc_mail_mime.inc | 28 +-
program/localization/am/labels.inc | 18 +-
program/localization/am/messages.inc | 9 +-
program/localization/ar/labels.inc | 18 +-
program/localization/ar/messages.inc | 9 +-
program/localization/bg/labels.inc | 370 +-
program/localization/bg/messages.inc | 157 +-
program/localization/bs_BA/labels.inc | 234 +
program/localization/bs_BA/messages.inc | 70 +
program/localization/ca/labels.inc | 12 +-
program/localization/ca/messages.inc | 8 +-
program/localization/cz/labels.inc | 15 +-
program/localization/cz/messages.inc | 11 +-
program/localization/da/labels.inc | 22 +-
program/localization/da/messages.inc | 30 +-
program/localization/de_CH/labels.inc | 13 +-
program/localization/de_CH/messages.inc | 11 +-
program/localization/de_DE/labels.inc | 20 +-
program/localization/de_DE/messages.inc | 16 +-
program/localization/el/labels.inc | 22 +-
program/localization/el/messages.inc | 11 +-
program/localization/en_GB/labels.inc | 263 +-
program/localization/en_GB/messages.inc | 22 +-
program/localization/en_US/labels.inc | 13 +-
program/localization/en_US/messages.inc | 8 +-
program/localization/eo/labels.inc | 281 +-
program/localization/eo/messages.inc | 82 +-
program/localization/es/labels.inc | 18 +-
program/localization/es/messages.inc | 10 +-
program/localization/et_EE/labels.inc | 12 +-
program/localization/et_EE/messages.inc | 9 +-
program/localization/eu/labels.inc | 4 +-
program/localization/eu/messages.inc | 4 +-
program/localization/fa/labels.inc | 375 +-
program/localization/fa/messages.inc | 15 +-
program/localization/fi/labels.inc | 20 +-
program/localization/fi/messages.inc | 11 +-
program/localization/fr/labels.inc | 20 +-
program/localization/fr/messages.inc | 7 +-
program/localization/ga_IE/labels.inc | 4 +-
program/localization/ga_IE/messages.inc | 4 +-
program/localization/ge/labels.inc | 237 +
program/localization/ge/messages.inc | 78 +
program/localization/gl/labels.inc | 12 +-
program/localization/gl/messages.inc | 26 +-
program/localization/he/labels.inc | 188 +
program/localization/he/messages.inc | 79 +
program/localization/hi/labels.inc | 239 +
program/localization/hi/messages.inc | 72 +
program/localization/hr/labels.inc | 34 +-
program/localization/hr/messages.inc | 27 +-
program/localization/hu/labels.inc | 18 +-
program/localization/hu/messages.inc | 119 +-
program/localization/id_ID/labels.inc | 192 +
program/localization/id_ID/messages.inc | 82 +
program/localization/index.inc | 143 +-
program/localization/is/labels.inc | 220 +
program/localization/is/messages.inc | 64 +
program/localization/it/labels.inc | 12 +-
program/localization/it/messages.inc | 8 +-
program/localization/ja/labels.inc | 22 +-
program/localization/ja/messages.inc | 18 +-
program/localization/kr/labels.inc | 192 +
program/localization/kr/messages.inc | 82 +
program/localization/lt/labels.inc | 14 +-
program/localization/lt/messages.inc | 12 +-
program/localization/lv/labels.inc | 22 +-
program/localization/lv/messages.inc | 11 +-
program/localization/mk/labels.inc | 366 +-
program/localization/mk/messages.inc | 153 +-
program/localization/ms_MY/labels.inc | 2 +-
program/localization/ms_MY/messages.inc | 4 +-
program/localization/nb_NO/labels.inc | 53 +-
program/localization/nb_NO/messages.inc | 22 +-
program/localization/ne/labels.inc | 178 +
program/localization/ne/messages.inc | 75 +
program/localization/nl_BE/labels.inc | 192 +
program/localization/nl_BE/messages.inc | 82 +
program/localization/nl_NL/labels.inc | 20 +-
program/localization/nl_NL/messages.inc | 11 +-
program/localization/nn_NO/labels.inc | 174 +
program/localization/nn_NO/messages.inc | 41 +
program/localization/pl/labels.inc | 36 +-
program/localization/pl/messages.inc | 16 +-
program/localization/pt_BR/labels.inc | 263 +-
program/localization/pt_BR/messages.inc | 28 +-
program/localization/pt_PT/labels.inc | 12 +-
program/localization/pt_PT/messages.inc | 8 +-
program/localization/ro/labels.inc | 22 +-
program/localization/ro/messages.inc | 17 +-
program/localization/ru/labels.inc | 19 +-
program/localization/ru/messages.inc | 10 +-
program/localization/se/labels.inc | 45 +-
program/localization/se/messages.inc | 34 +-
program/localization/si/labels.inc | 366 +-
program/localization/si/messages.inc | 152 +-
program/localization/sk/labels.inc | 26 +-
program/localization/sk/messages.inc | 15 +-
program/localization/sl/labels.inc | 56 +-
program/localization/sl/messages.inc | 33 +-
program/localization/sq_AL/labels.inc | 192 +
program/localization/sq_AL/messages.inc | 82 +
program/localization/sr_cyrillic/labels.inc | 192 +
program/localization/sr_cyrillic/messages.inc | 82 +
program/localization/sr_latin/labels.inc | 217 +
program/localization/sr_latin/messages.inc | 66 +
program/localization/th_TH/labels.inc | 174 +
program/localization/th_TH/messages.inc | 79 +
program/localization/tr/labels.inc | 4 +-
program/localization/tr/messages.inc | 4 +-
program/localization/uk/labels.inc | 35 +-
program/localization/uk/messages.inc | 5 +-
program/localization/vn/labels.inc | 217 +
program/localization/vn/messages.inc | 66 +
program/localization/zh_CN/labels.inc | 9 +-
program/localization/zh_CN/messages.inc | 9 +-
program/localization/zh_TW/labels.inc | 28 +-
program/localization/zh_TW/messages.inc | 11 +-
program/steps/addressbook/func.inc | 7 +-
program/steps/mail/check_recent.inc | 16 +-
program/steps/mail/compose.inc | 310 +-
program/steps/mail/folders.inc | 26 +-
program/steps/mail/func.inc | 308 +-
program/steps/mail/get.inc | 12 +-
program/steps/mail/getunread.inc | 4 +-
program/steps/mail/list.inc | 11 +-
program/steps/mail/mark.inc | 4 +-
program/steps/mail/move_del.inc | 6 +-
program/steps/mail/rss.inc | 4 +-
program/steps/mail/search.inc | 6 +-
program/steps/mail/sendmail.inc | 174 +-
program/steps/mail/sendmdn.inc | 40 +
program/steps/mail/show.inc | 43 +-
program/steps/mail/upload.inc | 70 +-
program/steps/settings/delete_identity.inc | 20 +-
program/steps/settings/edit_identity.inc | 12 +-
program/steps/settings/func.inc | 36 +-
program/steps/settings/manage_folders.inc | 43 +-
program/steps/settings/save_identity.inc | 109 +-
program/steps/settings/save_prefs.inc | 9 +-
skins/default/common.css | 6 +
skins/default/editor_content.css | 7 +-
skins/default/images/buttons/markread_act.png | Bin 0 -> 1772 bytes
skins/default/images/icons/edit.png | Bin 717 -> 0 bytes
skins/default/images/icons/rename.png | Bin 0 -> 747 bytes
skins/default/mail.css | 104 +-
skins/default/settings.css | 44 +-
skins/default/splitter.js | 4 +-
skins/default/templates/addidentity.html | 2 +-
skins/default/templates/compose.html | 6 +-
skins/default/templates/editidentity.html | 2 +-
skins/default/templates/identities.html | 2 +-
skins/default/templates/login.html | 2 +-
skins/default/templates/mail.html | 97 +-
skins/default/templates/managefolders.html | 5 +-
skins/default/templates/messagepart.html | 2 +-
226 files changed, 35233 insertions(+), 16335 deletions(-)
create mode 100644 SQL/mysql.update-0.1a.sql
create mode 100755 bin/msgimport
create mode 100644 installer/check.php
create mode 100644 installer/client.js
create mode 100644 installer/config.php
create mode 100755 installer/images/add.png
create mode 100644 installer/images/banner_bg.gif
create mode 100644 installer/images/banner_logo.gif
create mode 100644 installer/images/banner_right.gif
create mode 100755 installer/images/delete.png
create mode 100644 installer/index.php
create mode 100644 installer/rcube_install.php
create mode 100644 installer/styles.css
create mode 100644 installer/test.php
create mode 100644 installer/welcome.html
create mode 100644 program/include/rcube_user.inc
create mode 100644 program/js/editor_images.js
rename {skins/default => program/js/tiny_mce/themes/advanced/css}/editor_popup.css (100%)
create mode 100644 program/lib/magic
create mode 100644 program/localization/bs_BA/labels.inc
create mode 100644 program/localization/bs_BA/messages.inc
create mode 100755 program/localization/ge/labels.inc
create mode 100755 program/localization/ge/messages.inc
create mode 100644 program/localization/he/labels.inc
create mode 100644 program/localization/he/messages.inc
create mode 100644 program/localization/hi/labels.inc
create mode 100644 program/localization/hi/messages.inc
create mode 100644 program/localization/id_ID/labels.inc
create mode 100644 program/localization/id_ID/messages.inc
create mode 100644 program/localization/is/labels.inc
create mode 100644 program/localization/is/messages.inc
create mode 100644 program/localization/kr/labels.inc
create mode 100644 program/localization/kr/messages.inc
create mode 100644 program/localization/ne/labels.inc
create mode 100644 program/localization/ne/messages.inc
create mode 100644 program/localization/nl_BE/labels.inc
create mode 100644 program/localization/nl_BE/messages.inc
create mode 100644 program/localization/nn_NO/labels.inc
create mode 100644 program/localization/nn_NO/messages.inc
create mode 100644 program/localization/sq_AL/labels.inc
create mode 100644 program/localization/sq_AL/messages.inc
create mode 100644 program/localization/sr_cyrillic/labels.inc
create mode 100644 program/localization/sr_cyrillic/messages.inc
create mode 100644 program/localization/sr_latin/labels.inc
create mode 100644 program/localization/sr_latin/messages.inc
create mode 100644 program/localization/th_TH/labels.inc
create mode 100644 program/localization/th_TH/messages.inc
create mode 100644 program/localization/vn/labels.inc
create mode 100644 program/localization/vn/messages.inc
create mode 100644 program/steps/mail/sendmdn.inc
create mode 100644 skins/default/images/buttons/markread_act.png
delete mode 100644 skins/default/images/icons/edit.png
create mode 100644 skins/default/images/icons/rename.png
diff --git a/.htaccess b/.htaccess
index b40b7ea..ae20a9a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -7,6 +7,10 @@ AddType text/x-component .htc
php_value error_log logs/errors
php_value upload_max_filesize 5M
php_value post_max_size 6M
+ php_value memory_limit 64M
+ php_value session.auto_start 0
+ php_value zlib.output_compression 0
+ php_value magic_quotes_gpc 0
@@ -15,6 +19,10 @@ AddType text/x-component .htc
php_value error_log logs/errors
php_value upload_max_filesize 5M
php_value post_max_size 6M
+ php_value memory_limit 64M
+ php_value session.auto_start 0
+ php_value zlib.output_compression 0
+ php_value magic_quotes_gpc 0
diff --git a/CHANGELOG b/CHANGELOG
index 96c8b26..dbf986d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,44 @@
CHANGELOG RoundCube Webmail
---------------------------
+- Added interactive installer script
+- Fix folder adding/renaming inspired by #1484800
+- Localize folder name in page title (#1484785)
+- Fix code using wrong variable name (#1484018)
+- Allow to send mail with BCC recipients only
+- condense TinyMCE toolbar down to one line, removing table buttons (#1484747)
+- Add function to mark the selected messages as read/unread (#1457360)
+- Also do charset decoding as suggested in RFC 2231 (fix #1484321)
+- Show message count in folder list and hint when creating a subfolder
+- Distinguish ssl and tls for imap connections (#1484667)
+- Added some charset aliases to fix typical mis-labelling (#1484565)
+- Remember decision to display images for a certain message during session (#1484754)
+- Truncate attachment filenames to 55 characters due to an IE bug (#1484757)
+- Make sending of read receipts configurable
+- Respect config when localize folder names (#1484707)
+- Also respect receipt and priority settings when re-opening a draft message
+- Remember search results (closes #1483883), patch by the_glu
+- Add Received header on outgoing mail
+- Upgrade to TinyMCE 2.1.3
+- Allow inserting image attachments into HTML messages while composing (#1484557)
+- Implement Message-Disposition-Notification (Receipts)
+- Fix overriding of session vars when register_globals is on (#1484670)
+- Fix bug with case-sensitive folder names (#1484245)
+- Don't create default folders by default
+- Fixed some potential security risks (audited by Andris)
+- Only show new messages if they match the current search (#1484176)
+- Switch to/from when searcing in Sent folder (#1484555)
+- Correctly read the References header (#1484646)
+- Unset old cookie before sending a new value (#1484639)
+- Correctly decode attachments when downloading them (#1484645 and #1484642)
+- Suppress IE errors when clearing attachments form (#1484356)
+- Log error when login fails due to auto_create_user turned off
+- Filter linked/imported CSS files (closes #1484056)
+- Improve message compose screen (closes #1484383)
+- Select next row after removing one from list (#1484387)
+
+RELEASE 0.1-RC2
+
- Enable drag-&-dropping of folders to a new parent and allow to create subfolders (#1457344)
- Suppress IE errors when clearing attachments form (#1484356)
- Set preferences field in user table to NULL (#1484386)
@@ -50,7 +88,7 @@ CHANGELOG RoundCube Webmail
- Prevent default events on subject links (#1484399)
- Use HTTP-POST requests for actions that change state
-RELEASE 0.1.-RC1
+RELEASE 0.1-RC1
- Use global filters and bind username/ for Ldap searches (#1484159)
- Hide quota display if imap server does not support it
@@ -153,4 +191,3 @@ RELEASE 0.1.-RC1
- Fixed some XSS and SQL injection issues
- Fixed charset problems with folder renaming
-
diff --git a/INSTALL b/INSTALL
index 5032e4a..ada9daa 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,26 +1,35 @@
+INTRODUCTION
+============
+
+This file describes the basic steps to install RoundCube Webmail on your
+web server. For additional information, please also consult the project's
+wiki page at http://trac.roundcube.net/wiki
+
REQUIREMENTS
============
-* The Apache Webserver
+* The Apache or Lighttpd Webserver
* .htaccess support allowing overrides for DirectoryIndex
* PHP Version 4.3.1 or greater including
- PCRE (perl compatible regular expression)
- - Mcrypt (supporting Triple DES)
- - libiconv
+ - Libiconv
- Multibyte String (mbstring)
- - Database driver for either MySQL, Postgres or SQLite
+ - Mcrypt (supporting Triple DES)
+ - Database driver for either MySQL, Postgres or SQLite
* php.ini options:
- error_reporting E_ALL & ~E_NOTICE (or lower)
- file_uploads on (for attachment upload features)
- memory_limit (increase as suitable to support large attachments)
+ - session.auto_start needs to be off/0
* The PEAR framework with the following packages installed
- - DB (1.7.11)
+ - MDB2
- Mail_Mime (1.3.1)
- Net_SMTP (1.2.10)
* PHP compiled with Open SSL to connect to IMAPS and to use the spell checker
* A MySQL or PostgreSQL database engine or the SQLite extension for PHP
-* A database with permission to create tables
+* One of the above databases with permission to create tables
+* An SMTP server or PHP configured for mail delivery
INSTALLATION
@@ -32,10 +41,9 @@ INSTALLATION
- /temp
- /logs
3. Create a new database and a database user for RoundCube (see DATABASE SETUP)
-4. Create database tables using the queries in file 'SQL/*.initial.sql'
- (* stands for your database type)
-5. Rename the files config/*.inc.php.dist to config/*.inc.php
-6. Modify the files in config/* to suit your local environment
+4. Point your browser to http:///url-to-roundcube/installer/
+5. Follow the instructions of the install script (or see MANUAL CONFINGURATION)
+6. After creating and testing the configuration, remove the installer directory
7. Done!
@@ -84,40 +92,39 @@ an example how you can setup the sqlite.db for roundcube:
# sqlite -init SQL/sqlite.initial.sql sqlite.db
Make sure your configuration points to the sqlite.db file and that the
-webserver can write to the file.
+webserver can write to the file and the directory containing the file.
* PostgreSQL
------------
-To use RoundCube with PostgreSQL support you have to follow the next
-simple steps, which have to be done with the postgres system user (or
+To use RoundCube with PostgreSQL support you have to follow these
+simple steps, which have to be done as the postgres system user (or
which ever is the database superuser):
-$ createuser roundcubemail
-$ createdb -O roundcubemail roundcubemail
+$ createuser roundcube
+$ createdb -O roundcube roundcubemail
$ psql roundcubemail
roundcubemail =# ALTER USER roundcube WITH PASSWORD 'the_new_password';
-roundcubemail =# \c - roundcubemail
+roundcubemail =# \c - roundcube
roundcubemail => \i SQL/postgres.initial.sql
-All this has been tested with PostgreSQL 8.0.x and 7.4.x. Older
+All this has been tested with PostgreSQL 8.x and 7.4.x. Older
versions don't have a -O option for the createdb, so if you are
using that version you'll have to change ownership of the DB later.
-CONFIGURATION
-=============
+MANUAL CONFIGURATION
+====================
-Change the files in config/* according your to environment and your needs.
-Details about the config paramaters can be found in the config files.
+First of all, rename the files config/*.inc.php.dist to config/*.inc.php.
+You can then change these files according to your environment and your needs.
+Details about the config parameters can be found in the config files.
+See http://trac.roundcube.net/wiki/Howto_Install for even more guidance.
You can also modify the default .htaccess file. This is necessary to
increase the allowed size of file attachments, for example:
- php_value upload_max_filesize 2M
-
-To enable the experimental HTML editor you need to set the config
-parameter 'enable_htmleditor' to true.
+ php_value upload_max_filesize 2M
UPGRADING
diff --git a/README b/README
index da1bd2e..e06318c 100644
--- a/README
+++ b/README
@@ -1,5 +1,6 @@
RoundCube Webmail (http://roundcube.net)
+
Introduction:
-------------
RoundCube Webmail is a browser-based multilingual IMAP client with an
@@ -23,10 +24,10 @@ Installation:
-------------
For detailed instructions on how to install RoundCube webmail on your server,
please refer to the INSTALL document in the same directory as this document.
-Please carefully read the REQUIREMENTS section of the INSTALL instructions.
+Please carefully read the REQUIREMENTS section of the INSTALL instructions.
-Licensing:
+Licensing:
----------
This product is distributed under the GPL. Please read through the file
LICENSE for more information about our license.
@@ -64,8 +65,8 @@ program/include/rcube_shared.inc
Contact:
--------
For any bug reports or feature requests please refer to the tracking system
-at trac.roundcube.net (http://trac.roundcube.net/trac.cgi/report) or
-subscribe to our mailing list. See http://www.roundcube.net/?p=mailinglists
+at trac.roundcube.net (http://trac.roundcube.net/wiki/Howto_ReportIssues) or
+subscribe to our mailing list. See http://roundcube.net/support
for details.
You're always welcome to send a message to the project admin:
diff --git a/SQL/mysql.update-0.1a.sql b/SQL/mysql.update-0.1a.sql
new file mode 100644
index 0000000..60f22b3
--- /dev/null
+++ b/SQL/mysql.update-0.1a.sql
@@ -0,0 +1,51 @@
+-- RoundCube Webmail update script for MySQL databases
+-- Updates from version 0.1-20051007
+
+
+ALTER TABLE `session` ADD `ip` VARCHAR(40) NOT NULL AFTER changed;
+ALTER TABLE `users` ADD `alias` VARCHAR(128) NOT NULL AFTER mail_host;
+
+
+
+-- RoundCube Webmail update script for MySQL databases
+-- Updates from version 0.1-20051021
+
+ALTER TABLE `session` CHANGE `sess_id` `sess_id` VARCHAR(40) NOT NULL;
+
+ALTER TABLE `contacts` CHANGE `del` `del` TINYINT(1) NOT NULL;
+ALTER TABLE `contacts` ADD `changed` DATETIME NOT NULL AFTER `user_id`;
+
+UPDATE `contacts` SET `del`=0 WHERE `del`=1;
+UPDATE `contacts` SET `del`=1 WHERE `del`=2;
+
+ALTER TABLE `identities` CHANGE `default` `standard` TINYINT(1) NOT NULL;
+ALTER TABLE `identities` CHANGE `del` `del` TINYINT(1) NOT NULL;
+
+UPDATE `identities` SET `del`=0 WHERE `del`=1;
+UPDATE `identities` SET `del`=1 WHERE `del`=2;
+UPDATE `identities` SET `standard`=0 WHERE `standard`=1;
+UPDATE `identities` SET `standard`=1 WHERE `standard`=2;
+
+CREATE TABLE `messages` (
+ `message_id` int(11) unsigned NOT NULL auto_increment,
+ `user_id` int(11) unsigned NOT NULL default '0',
+ `del` tinyint(1) NOT NULL default '0',
+ `cache_key` varchar(128) NOT NULL default '',
+ `created` datetime NOT NULL default '0000-00-00 00:00:00',
+ `idx` int(11) unsigned NOT NULL default '0',
+ `uid` int(11) unsigned NOT NULL default '0',
+ `subject` varchar(255) NOT NULL default '',
+ `from` varchar(255) NOT NULL default '',
+ `to` varchar(255) NOT NULL default '',
+ `cc` varchar(255) NOT NULL default '',
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `size` int(11) unsigned NOT NULL default '0',
+ `headers` text NOT NULL,
+ `structure` text,
+ PRIMARY KEY (`message_id`),
+ KEY `user_id` (`user_id`),
+ KEY `idx` (`idx`),
+ KEY `uid` (`uid`),
+ UNIQUE `uniqueness` (`cache_key`, `uid`)
+) TYPE=MyISAM;
+
diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index 8f70548..0d63cf9 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -5,5 +5,8 @@ ALTER TABLE "messages" DROP body;
ALTER TABLE "messages" ADD structure TEXT;
ALTER TABLE "messages" ADD UNIQUE (user_id, cache_key, uid);
-ALTER TABLE "identities" ADD html_signature integer DEFAULT 0 NOT NULL;
+ALTER TABLE "identities" ADD html_signature INTEGER;
+ALTER TABLE "identities" ALTER html_signature SET DEFAULT 0;
+UPDATE identities SET html_signature = 0;
+ALTER TABLE "identities" ALTER html_signature SET NOT NULL;
diff --git a/UPGRADING b/UPGRADING
index a88f92d..9d87a1e 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -4,9 +4,18 @@ UPDATE instructions
Follow these instructions if upgrading from a previous version
of RoundCube Webmail.
+from version 0.1-rc2
+----------------------------------------
+* replace index.php
+* replace all files in folder /bin/
+* replace all files in folder /program/
+* replace all files in folder /skins/default/
+
+
from version 0.1-rc1
----------------------------------------
* replace index.php
+* replace all files in folder /bin/
* replace all files in folder /program/
* replace all files in folder /skins/default/
* If you have LDAP servers configured you should re-configure
@@ -16,6 +25,7 @@ from version 0.1-rc1
from version 0.1-beta2
----------------------------------------
* replace index.php
+* replace all files in folder /bin/
* replace all files in folder /program/
* replace all files in folder /skins/default/
* run all commands in SQL/[yourdbtype].update.sql or
@@ -30,6 +40,7 @@ from version 0.1-beta2
form version 0.1-beta
----------------------------------------
* replace index.php
+* replace all files in folder /bin/
* replace all files in folder /program/
* replace all files in folder /skins/default/
* run all commands in SQL/[yourdbtype].update.sql or
diff --git a/bin/msgimport b/bin/msgimport
new file mode 100755
index 0000000..0ed268f
--- /dev/null
+++ b/bin/msgimport
@@ -0,0 +1,123 @@
+#!/usr/bin/php -qC
+ 'host', 'u' => 'user', 'p' => 'pass', 'f' => 'file')) + array('host' => 'localhost');
+
+if ($_SERVER['argv'][1] == 'help')
+{
+ print_usage();
+ exit;
+}
+else if (!($args['host'] && $args['file']))
+{
+ print "Missing required parameters.\n";
+ print_usage();
+ exit;
+}
+else if (!is_file($args['file']))
+{
+ print "Cannot read message file\n";
+ exit;
+}
+
+// prompt for username if not set
+if (empty($args['user']))
+{
+ //fwrite(STDOUT, "Please enter your name\n");
+ echo "IMAP user: ";
+ $args['user'] = trim(fgets(STDIN));
+}
+
+// prompt for password
+echo "Password: ";
+$args['pass'] = trim(fgets(STDIN));
+
+// clear password input
+echo chr(8)."\rPassword: ".str_repeat("*", strlen($args['pass']))."\n";
+
+// parse $host URL
+$a_host = parse_url($args['host']);
+if ($a_host['host'])
+{
+ $host = $a_host['host'];
+ $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
+ $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
+}
+else
+{
+ $host = $args['host'];
+ $imap_port = 143;
+}
+
+// instantiate IMAP class
+$IMAP = new rcube_imap(null);
+
+// try to connect to IMAP server
+if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
+{
+ print "IMAP login successful.\n";
+ print "Uploading message...\n";
+
+ // upload message from file
+ if ($IMAP->save_message('INBOX', file_get_contents($args['file'])))
+ print "Message successfully added to INBOX.\n";
+ else
+ print "Adding message failed!\n";
+}
+else
+{
+ print "IMAP login failed.\n";
+}
+
+?>
\ No newline at end of file
diff --git a/bin/quotaimg.php b/bin/quotaimg.php
index 5896eac..354f4eb 100644
--- a/bin/quotaimg.php
+++ b/bin/quotaimg.php
@@ -1,5 +1,4 @@
|
+-----------------------------------------------------------------------+
- $Id: $
+ $Id: $
*/
-$used = ((isset($_GET['u']) && !empty($_GET['u'])) || $_GET['u']=='0')?(int)$_GET['u']:'??';
-$quota = ((isset($_GET['q']) && !empty($_GET['q'])) || $_GET['q']=='0')?(int)$_GET['q']:'??';
-$width = empty($_GET['w']) ? 100 : (int)$_GET['w'];
+$used = ((isset($_GET['u']) && !empty($_GET['u'])) || $_GET['u']=='0')?(int)$_GET['u']:'??';
+$quota = ((isset($_GET['q']) && !empty($_GET['q'])) || $_GET['q']=='0')?(int)$_GET['q']:'??';
+$width = empty($_GET['w']) ? 100 : (int)$_GET['w'];
$height = empty($_GET['h']) ? 14 : (int)$_GET['h'];
+/**
+ * Quota display
+ *
+ * Modify the following few elements to change the display of the image.
+ * Modifiable attributes are:
+ * bool border :: Defines whether you want to show a border around it?
+ * bool unknown :: Leave default; Defines whether quota is "unknown"
+ *
+ * int height :: Defines height of the image
+ * int width :: Defines width of the image
+ * int font :: Changes the font size & font used in the GD library.
+ * Available values are from 1 to 5.
+ * int padding :: Changes the offset (in pixels) from the top of the image
+ * to where the top of the text will be aligned. User
+ * greater than 0 to ensure text is off the border.
+ * array limit :: Holds the integer values of in an associative array as
+ * to what defines the upper and lower levels for quota
+ * display.
+ * High - Quota is nearing capacity.
+ * Mid - Quota is around the middle
+ * Low - Currently not used.
+ * array color :: An associative array of strings of comma separated
+ * values (R,G,B) for use in color creation. Define the
+ * RGB values you'd like to use. A list of colors (and
+ * their RGB values) can be found here:
+ * http://www.december.com/html/spec/colorcodes.html
+ *
+ * @return void
+ *
+ * @param mixed $used The amount used, or ?? if unknown.
+ * @param mixed $total The total available, or ?? if unknown.
+ * @param int $width Width of the image.
+ * @param int $height Height of the image.
+ *
+ * @see rcube_imap::get_quota()
+ * @see iil_C_GetQuota()
+ *
+ * @todo Make colors a config option.
+ */
function genQuota($used, $total, $width, $height)
{
- /**
- * Quota Display
- *
- * Modify the following few elements to change the display of the image.
- * Modifiable attributes are:
- * bool border :: Defines whether you want to show a border around it or not.
- * bool unknown :: Leave default; Defines whether quota is "unknown"
- *
- * int height :: Defines height of the image
- * int width :: Defines width of the image
- * int font :: Changes the font size & font used in the GD library.
- * Available values are from 1 to 5.
- * int padding :: Changes the offset (in pixels) from the top of the image to
- * where the top of the text will be aligned. User greater than
- * 0 to ensure text is off the border.
- * array limit :: Holds the integer values of in an associative array as to what
- * defines the upper and lower levels for quota display.
- * High - Quota is nearing capacity.
- * Mid - Quota is around the middle
- * Low - Currently not used.
- * array color :: An associative array of strings of comma separated values (R,G,B)
- * for use in color creation. Define the RGB values you'd like to
- * use. A list of colors (and their RGB values) can be found here:
- * http://www.december.com/html/spec/colorcodes.html
- **/
-
$unknown = false;
- $border = 0;
+ $border = 0;
- $font = 2;
+ $font = 2;
$padding = 0;
$limit['high'] = 70;
- $limit['mid'] = 45;
- $limit['low'] = 0;
+ $limit['mid'] = 45;
+ $limit['low'] = 0;
// Fill Colors
- $color['fill']['high'] = '215, 13, 13'; // Near quota fill color
- $color['fill']['mid'] = '126, 192, 238';// Mid-area of quota fill color
- $color['fill']['low'] = '147, 225, 100'; // Far from quota fill color
+ $color['fill']['high'] = '215, 13, 13'; // Near quota fill color
+ $color['fill']['mid'] = '126, 192, 238'; // Mid-area of quota fill color
+ $color['fill']['low'] = '147, 225, 100'; // Far from quota fill color
// Background colors
- $color['bg']['OL'] = '215, 13, 13'; // Over limit bbackground
- $color['bg']['Unknown'] = '238, 99, 99';// Unknown background
- $color['bg']['quota'] = '255, 255, 255';// Normal quota background
+ $color['bg']['OL'] = '215, 13, 13'; // Over limit bbackground
+ $color['bg']['Unknown'] = '238, 99, 99'; // Unknown background
+ $color['bg']['quota'] = '255, 255, 255'; // Normal quota background
// Misc. Colors
$color['border'] = '0, 0, 0';
- $color['text'] = '102, 102, 102';
+ $color['text'] = '102, 102, 102';
- /****************************
+ /************************************
***** DO NOT EDIT BELOW HERE *****
- ****************************/
+ ***********************************/
- if (ereg("^[^0-9?]*$", $used) || ereg("^[^0-9?]*$", $total))
+ // @todo: Set to "??" instead?
+ if (ereg("^[^0-9?]*$", $used) || ereg("^[^0-9?]*$", $total)) {
return false;
+ }
- if (strpos($used, '?')!==false || strpos($total, '?')!==false && $used != 0)
+ if (strpos($used, '?') !== false || strpos($total, '?') !== false
+ && $used != 0) {
$unknown = true;
+ }
$im = imagecreate($width, $height);
- if ($border)
- {
+ if ($border) {
list($r, $g, $b) = explode(',', $color['border']);
+
$borderc = imagecolorallocate($im, $r, $g, $b);
+
imageline($im, 0, 0, $width, 0, $borderc);
imageline($im, 0, $height-$border, 0, 0, $borderc);
imageline($im, $width-1, 0, $width-$border, $height, $borderc);
@@ -102,46 +119,41 @@ function genQuota($used, $total, $width, $height)
list($r, $g, $b) = explode(',', $color['text']);
$text = imagecolorallocate($im, $r, $g, $b);
- if ($unknown)
- {
+ if ($unknown) {
list($r, $g, $b) = explode(',', $color['bg']['Unknown']);
$background = imagecolorallocate($im, $r, $g, $b);
imagefilledrectangle($im, 0, 0, $width, $height, $background);
$string = 'Unknown';
- $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
+ $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
imagestring($im, $font, $mid, $padding, $string, $text);
- }
- else if ($used > $total)
- {
+ } else if ($used > $total) {
list($r, $g, $b) = explode(',', $color['bg']['OL']);
+
$background = imagecolorallocate($im, $r, $g, $b);
+
imagefilledrectangle($im, 0, 0, $width, $height, $background);
$string = 'Over Limit';
- $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
+ $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
imagestring($im, $font, $mid, $padding, $string, $text);
- }
- else
- {
+ } else {
list($r, $g, $b) = explode(',', $color['bg']['quota']);
+
$background = imagecolorallocate($im, $r, $b, $g);
+
imagefilledrectangle($im, 0, 0, $width, $height, $background);
$quota = ($used==0)?0:(round($used/$total, 2)*100);
- if ($quota >= $limit['high'])
- {
+ if ($quota >= $limit['high']) {
list($r, $g, $b) = explode(',', $color['fill']['high']);
$fill = imagecolorallocate($im, $r, $g, $b);
- }
- elseif($quota >= $limit['mid'])
- {
+ } elseif($quota >= $limit['mid']) {
list($r, $g, $b) = explode(',', $color['fill']['mid']);
$fill = imagecolorallocate($im, $r, $g, $b);
- }
- else // if($quota >= $limit['low'])
- {
+ } else {
+ // if($quota >= $limit['low'])
list($r, $g, $b) = explode(',', $color['fill']['low']);
$fill = imagecolorallocate($im, $r, $g, $b);
}
@@ -149,21 +161,23 @@ function genQuota($used, $total, $width, $height)
$quota_width = $quota / 100 * $width;
imagefilledrectangle($im, $border, 0, $quota, $height-2*$border, $fill);
- $string = $quota.'%';
- $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
- imagestring($im, $font, $mid, $padding, $string, $text); // Print percent in black
+ $string = $quota . '%';
+ $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
+ // Print percent in black
+ imagestring($im, $font, $mid, $padding, $string, $text);
}
header('Content-Type: image/gif');
- header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+86400)." GMT");
- header("Cache-Control: ");
- header("Pragma: ");
+
+ // @todo is harcoding GMT necessary?
+ header('Expires: ' . gmdate('D, d M Y H:i:s', mktime()+86400) . ' GMT');
+ header('Cache-Control: ');
+ header('Pragma: ');
imagegif($im);
imagedestroy($im);
}
-
genQuota($used, $quota, $width, $height);
exit;
-?>
+?>
\ No newline at end of file
diff --git a/config/db.inc.php.dist b/config/db.inc.php.dist
index e142dd7..442ef6e 100644
--- a/config/db.inc.php.dist
+++ b/config/db.inc.php.dist
@@ -5,7 +5,7 @@
| Configuration file for database access |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
@@ -16,7 +16,7 @@ $rcmail_config = array();
// PEAR database DSN for read/write operations
// format is db_provider://user:password@host/databse
-// currently supported db_providers: mysql, sqlite
+// currently supported db_providers: mysql, mysqli, pgsql, sqlite, mssql
$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
// postgres example: 'pgsql://roundcube:pass@localhost/roundcubemail';
@@ -27,7 +27,7 @@ $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
$rcmail_config['db_dsnr'] = '';
// database backend to use (only db or mdb2 are supported)
-$rcmail_config['db_backend'] = 'db';
+$rcmail_config['db_backend'] = 'mdb2';
// maximum length of a query in bytes
$rcmail_config['db_max_length'] = 512000; // 500K
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 926b4e0..8475c81 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -5,7 +5,7 @@
| Main configuration file |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
@@ -130,7 +130,7 @@ $rcmail_config['date_long'] = 'd.m.Y H:i';
$rcmail_config['date_today'] = 'H:i';
// add this user-agent to message headers when sending
-$rcmail_config['useragent'] = 'RoundCube Webmail/0.1-rc2';
+$rcmail_config['useragent'] = 'RoundCube Webmail/0.1';
// use this name to compose page titles
$rcmail_config['product_name'] = 'RoundCube Webmail';
@@ -154,9 +154,12 @@ $rcmail_config['sent_mbox'] = 'Sent';
$rcmail_config['trash_mbox'] = 'Trash';
// display these folders separately in the mailbox list.
-// these folders will automatically be created if they do not exist
+// these folders will also be displayed with localized names
$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
+// automatically create the above listed default folders on login
+$rcmail_config['create_default_folders'] = FALSE;
+
// protect the default folders from renames, deletes, and subscription changes
$rcmail_config['protect_default_folders'] = TRUE;
@@ -173,6 +176,10 @@ $rcmail_config['read_when_deleted'] = TRUE;
// false causes deleted messages to be permanantly removed if there is no Trash folder
$rcmail_config['flag_for_deletion'] = TRUE;
+// Behavior if a received message requests a message delivery notification (read receipt)
+// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
+$rcmail_config['mdn_requests'] = 0;
+
// Make use of the built-in spell checker. It is based on GoogieSpell.
// Since Google only accepts connections over https your PHP installatation
// requires to be compiled with Open SSL support
@@ -197,6 +204,9 @@ $rcmail_config['generic_message_footer'] = '';
// leave empty for auto-detection
$rcmail_config['mail_header_delimiter'] = NULL;
+// session domain: .example.org
+$rcmail_config['session_domain'] = '';
+
// in order to enable public ldap search, create a config array
// like the Verisign example below. if you would like to test,
// simply uncomment the Verisign example.
@@ -217,13 +227,10 @@ $rcmail_config['mail_header_delimiter'] = NULL;
* 'surname_field' => 'sn', // this field represents the contact's last name
* 'firstname_field' => 'gn', // this field represents the contact's first name
* 'scope' => 'sub', // search mode: sub|base|list
- * 'filter' => '', // used for basic listing (if not empty) and will be &'d with search queries. ex: (status=act)
+ * 'filter' => '', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
* 'fuzzy_search' => true); // server allows wildcard search
*/
-// enable composing html formatted messages (experimental)
-$rcmail_config['enable_htmleditor'] = FALSE;
-
// don't allow these settings to be overriden by the user
$rcmail_config['dont_override'] = array();
@@ -248,6 +255,9 @@ $rcmail_config['dst_active'] = (bool)date('I');
// prefer displaying HTML messages
$rcmail_config['prefer_html'] = TRUE;
+// compose html formatted messages by default
+$rcmail_config['htmleditor'] = FALSE;
+
// show pretty dates as standard
$rcmail_config['prettydate'] = TRUE;
@@ -260,8 +270,14 @@ $rcmail_config['message_sort_order'] = 'DESC';
// save compose message every 300 seconds (5min)
$rcmail_config['draft_autosave'] = 300;
+// default setting if preview pane is enabled
+$rcmail_config['preview_pane'] = FALSE;
+
// don't let users set pagesize to more than this value if set
$rcmail_config['max_pagesize'] = 200;
+// mime magic database
+$rcmail_config['mime_magic'] = '/usr/share/misc/magic';
+
// end of config file
?>
diff --git a/index.php b/index.php
index fd12c11..b83ef45 100644
--- a/index.php
+++ b/index.php
@@ -2,7 +2,7 @@
/*
+-----------------------------------------------------------------------+
| RoundCube Webmail IMAP Client |
- | Version 0.1-rc2-dependent |
+ | Version 0.1-20080302 |
| |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
@@ -36,12 +36,12 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: index.php 903 2007-10-22 06:52:13Z thomasb $
+ $Id: index.php 1162 2008-03-02 13:20:21Z thomasb $
*/
// application constants
-define('RCMAIL_VERSION', '0.1-rc2');
+define('RCMAIL_VERSION', '0.1-trunk');
define('RCMAIL_CHARSET', 'UTF-8');
define('JS_OBJECT_NAME', 'rcmail');
@@ -103,7 +103,7 @@ if (empty($_task) || !in_array($_task, $MAIN_TASKS))
if ($_action != 'get' && $_action != 'viewsource')
{
// use gzip compression if supported
- if (function_exists('ob_gzhandler') && ini_get('zlib.output_compression'))
+ if (function_exists('ob_gzhandler') && !ini_get('zlib.output_compression'))
ob_start('ob_gzhandler');
else
ob_start();
@@ -196,7 +196,7 @@ else if ($_action != 'login' && $_SESSION['user_id'] && $_action != 'send')
// log in to imap server
-if (!empty($_SESSION['user_id']) && $_task=='mail')
+if (!empty($USER->ID) && $_task=='mail')
{
$conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']);
if (!$conn)
@@ -210,7 +210,7 @@ if (!empty($_SESSION['user_id']) && $_task=='mail')
// not logged in -> set task to 'login
-if (empty($_SESSION['user_id']))
+if (empty($USER->ID))
{
if ($OUTPUT->ajax_call)
$OUTPUT->remote_response("setTimeout(\"location.href='\"+this.env.comm_path+\"'\", 2000);");
@@ -238,8 +238,19 @@ if (!empty($_action))
// not logged in -> show login page
-if (!$_SESSION['user_id'])
+if (empty($USER->ID))
{
+ // check if installer is still active
+ if (is_file('./installer/index.php'))
+ $OUTPUT->add_footer('
+
+
Installer script is still accessible
+
The install script of your RoundCube installation is still stored in its default location!
+
Please remove the whole installer folder from the RoundCube directory because
+ these files may expose sensitive configuration data like server passwords and encryption keys
+ to the public. Make sure you cannot access the installer script from your browser.
+
');
+
$OUTPUT->task = 'login';
$OUTPUT->send('login');
exit;
@@ -274,13 +285,16 @@ if ($_task=='mail')
if ($_action=='viewsource')
include('program/steps/mail/viewsource.inc');
+ if ($_action=='sendmdn')
+ include('program/steps/mail/sendmdn.inc');
+
if ($_action=='send')
include('program/steps/mail/sendmail.inc');
if ($_action=='upload')
include('program/steps/mail/upload.inc');
- if ($_action=='compose' || $_action=='remove-attachment')
+ if ($_action=='compose' || $_action=='remove-attachment' || $_action=='display-attachment')
include('program/steps/mail/compose.inc');
if ($_action=='addcontact')
diff --git a/installer/check.php b/installer/check.php
new file mode 100644
index 0000000..8352364
--- /dev/null
+++ b/installer/check.php
@@ -0,0 +1,156 @@
+
diff --git a/installer/client.js b/installer/client.js
new file mode 100644
index 0000000..3121b26
--- /dev/null
+++ b/installer/client.js
@@ -0,0 +1,36 @@
+
+function toggleblock(id, link)
+{
+ var block = document.getElementById(id);
+
+ return false;
+}
+
+
+function addhostfield()
+{
+ var container = document.getElementById('defaulthostlist');
+ var row = document.createElement('div');
+ var input = document.createElement('input');
+ var link = document.createElement('a');
+
+ input.name = '_default_host[]';
+ input.size = '30';
+ link.href = '#';
+ link.onclick = function() { removehostfield(this.parentNode); return false };
+ link.className = 'removelink';
+ link.innerHTML = 'remove';
+
+ row.appendChild(input);
+ row.appendChild(link);
+ container.appendChild(row);
+}
+
+
+function removehostfield(row)
+{
+ var container = document.getElementById('defaulthostlist');
+ container.removeChild(row);
+}
+
+
diff --git a/installer/config.php b/installer/config.php
new file mode 100644
index 0000000..5b365a5
--- /dev/null
+++ b/installer/config.php
@@ -0,0 +1,517 @@
+
';
+
+?>
+
diff --git a/installer/images/add.png b/installer/images/add.png
new file mode 100755
index 0000000000000000000000000000000000000000..6332fefea4be19eeadf211b0b202b272e8564898
GIT binary patch
literal 733
zcmV<30wVp1P)9VHk(~TedF+gQSL8D5xnVSSWAVY>J9b+m>@{iq7_KE}go~11+5s4;8hc+i0Xa
zI1j@EX5!S+Me6HNqKzU5YQwL;-W5$p%ZMKMeR<%zp69-~?<4?8|C8S?bklXr4v&Ov
zb&06v2|-x?qB`90yn>Qi%Sh2^G4n)$ZdyvTPf9}1)_buUT7>`e2G&2VU@~Bb(o+Mz
zi4)>IxlSY${Dj4k={-9RzU^W5g9|2V5RZ2ZulL9s2xQbZ@r6eP9Ra5u(s|C0Nj#&4>wTSkb?%#=9?@
z^oxDy-O@tyN{L@by(WWvQ3%CyEu8x{+#Jb4-h&K9Owi)2pgg+heWDyked|3R$$kL@A
z#sp1v-r+=G4B8D6DqsDH0@7OztA7aT9qc1Py{()w`m``?Y0&gi2=ROcc-9+nU^I6<
zT=e_Y=vSnG@?3Ue{BW5ONFttcE!R-R_W4O01|0-|K-YNXLo2`4Qv
z`r1LxR6#yf3FB%T95gJnaKKivA~Z}S9A(ZxEDK}O3T04USJ
P00000NkvXXu0mjf^IS-S
literal 0
HcmV?d00001
diff --git a/installer/images/banner_bg.gif b/installer/images/banner_bg.gif
new file mode 100644
index 0000000000000000000000000000000000000000..9cef8a7c52912b495c9908d9367b3e4ed74ab120
GIT binary patch
literal 587
zcmZ?wbhEHblw+`9xXQp_Zf6`Yik=A7#JKJoSK>%9UWa-T3TLS-q6tC
z=H?a|8Ch9bnUs`dWo6~)=vYutP+VMGS67#lljGy#)6~?|-rj!k;>E12tk%|6PfySE
z^z@pVnz*<)XJ_Y*jt)ORzm}Gk?(S}5W8?q-|1(ezDE?#t8>RyyL4IOj`|mKhz(Yr>
z|HP7_lQ~xNFRUo>S{t?g#+tIzXDaqT*ii9Cb>{gOTdL0H?Y{qEM~&a~_IE$_)Scg-
z{I8+0skxbtGlONxqrgMNt37ai%*|1bJpxR)4As_Sh#5MlKCRbSFBvMdd+gV
z^&2*B+Pq~w-}W6lckSM@oooMrgNF_u+0S|W#K}{q&m0#%f8pY#%U8||UB7Yj*6lmj
zMejd&_~`MI`%=$eynOZg&2!oJA3lEi{N+9S_a8rh{r>Zv|33pWmyE}U`|Zsf!dfvW
zJ}5M`3n+Wd@%Wh7+$~|8b?3y#MGgH5&RsH|pB6Vx)(Bn|bMjM4<8*`MQ*%5&FYTCZ
zQT*!8${uPKIqUAJuUReY6ApLD
zdVkAq*qm{BRqW|+I*r>49-o@){av?Zcg5#dcTa!UYuMkw%q{2h<9);74q@%MGd~JC
Vk55qcp6BzkaOvq8imZ$b)&Mnv1#AES
literal 0
HcmV?d00001
diff --git a/installer/images/banner_logo.gif b/installer/images/banner_logo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..a7dd1142621ad02bdb995206f48b2fc58935b512
GIT binary patch
literal 4345
zcmWlYdpwhi1Bc(en_XS@8#zc(IwhA{rDBTN$R(9Z9npn2r9w-EgkHByhNZcLYVLC%
zO&Dn|xyQm`NvtSK5el=g-#O18-#?$v=lSDnYk$bp%%dGJ1(pCHHzlQ`qa!9JCYeZl
z`sB&f=g)meWLQ|(rAwC{KYo1k=FPly>qLWt&5ezp3km`Q15>@cSXiv9t1G{@wxXh<
zKQJgJFp#CG**D-H%5
zPEL8<)Wl#gzIS#sHZ+_#aiXiUGbt&l=+vnKTieMmUw+Ncmz9>@xpU`DclV(~hZ-6h
z5)%^_78Zm(JroMX&(H5`U7d@IOQ(hgjYdl*5M;~C2?+^Dj~VCge`b2R8iQ$Zc9yTL
z@hU3YT3Q?(9cxup$z*Z|g%TVboRX3vaC1u{5c)8fnins`qod1F78QJXaJ~cI!tgc>CT)Z|jBb}RD
z`zW;X_|v-??+=92^{~y}X*0ltP1otgWr{^YZetvS#MzGcz)V
zhld;M>ayYRm-Tg3&!3Y>r2YH%@7=rC($W%wAUd5M9UcAl?c4L`&tJTFF(M-3_U+rZ
zZrzHFjlFQ;f~TivczAeZWaNVf4~B+@Mg|9kLSeG1YG!8U)a2yc!a`?z`4TfwvuDr7-j6&Vf5ep_Xz+k2jm!SJ1)C160K@*
zww;^R9D~<$$h51-ejTT==jup%g{PG^k@=21-lnq6QcX)_zO_B4E0ySZ(TkF!s9>VT
z^RC^l*OGbXrvCRw_B_t<#}VQyxP0R`oPsNT-l|sE_>Go7Esh9o@`{Jb@t*aDdmL;c
zRe!wjxf7Tj{^0n%BL9r$IA8-e=;x=ZK3%03fg3@tsco7bC$}s0lK)JZY^(t_v-3q2AVm|?EMxYw^B;F
zZb+Xzz~p+-Hj9s>exDTnamgdEsk!!cs|FX=xH@`ppN|GYzH_z9)c@cU0*_00`SSNY
zVqXw@lj7Lo7W?kBcLkOh`fSs|J&YT}-i=CojM=;1-BmojwT-Bhsiz3nortkUb{WCp
zid|liHQ}SCYLD4Q6QYBrH*LPdgl!_pKJO@+?IKB?gFfzlspesWI-m}tA`>BjfY9O_
z{sw{E?WwGQYmnqpFN>QxS$QT
z`Uoo$psf#dsU~kik`Vg0oc%vPgOCOic9i;6Nfw>pAl$Y2*SI8yc}S}e?_uY0%+$>h
z-5c%IijUGp{C&et(J#W=@u2~+^$7TE0#5<=+sO^SmGB0yek-l{QuM8?TA6pOq~0Q!
z3WkY~ckFD1+>!TfT7)P{C^H>)K#HbbypSug0`@Gib{*S5VM7$|M9Q_9T1lq?UXhY{
zw|SeI7*N4UebTLVZpeJ7Ksn>%c?5am#GK=u9FaY+O*2Flgn96UO-iGTjF}d-zcObm
zBSQSk_8WJ5M(R3FK*tDws55^wpcbwv{i$gBsr8B|_xOFqXN)AJeT`C+W1v#ZwYgq0
z>fkra
zFZ8KCH)k2l*}ODzYv@R|(W>qfNNsnGd=pdGB~o``*H`Dz+k;#DeZ@K(fbqk-{d
zqygs*CVoh}T(uzXm3~+2hTkSHUcI=K{pHS81
z7BwG(wMWdU=sczC-NF11*krR|l{2&QQ)s($_1C~(*H;$`<I~
z>T94q!`*I+epfhEaThs>*_p_B6uI76*x#iIc39Q#c^F4Vl--Co8~CU`c9;$R(Jnxe
zX2bCeHsa-yN~p_hghn^p;`F9C512TltqyK#Dnzp|hz)Ft9qGl}@bkZ#u)DnbEM<6v
zMh$QWv4ySEq>EFM&Bl-wv+?p6yOzybb9Bv>Hp7(mmaU|@b+Q_p4WIDzaRn}@&1u@W
zF-bvnYc7xmQ0B{E2(TyX)-lH%t)ceTef+t28Y4&hi8Rq!G?x(6?P=iiHW9%Xhd-!k
zT4!x#cihnmvsG-hrA9+#vq=&4BcQy7*3X)Sfa*B3m&}-`2kKMEX37
zkae?FOeKw#)3h*Js?05v9nW;+n=h)&XWAzERjkn*i9*2)iw)_PjUqYY?)
zwlW7I@WVTB6CRH;w&bY!u@hZ_e`bgk3rySWd;HUXW^z|zkb@mP0sNEjDhX<5Yhz;Y
z@FSgC69EeNDvwlZ*VDX842K5^=xX{@&F$iFxHkJf)>*9V;sW1WeC5b)fB#1(@J)uJ
zwTTJAyc{E4vN_c$HZg!l*nIA??U?5M>OPH@-@8IxlBmO{3l6;FB4Z19|%w
zyfuA1`q_Ne6M0(riPX-4{2nn-DUDK@u|IY9lm9ap1+T4qasoMMFaCoBsi~kZ*go+Q
z^sf41Q(+H?O%bS)?3_((
z-%C19BVGHJY9A*@_%+sj=w5@XOOBKW58-gclFf?iiGcT{+dm;w1nf&|-)nD!kBBb*
zR4oz$cg^|dl_nN9aA%t>4mFDx7*YrydVls;fC)@xG)B?H$piBv@+C%SY((jf
zKo$fxO-;{w8v6_&xEWL6RHI70_B-$H&Cv{x3`tvp}SbRSa6N(V@KliJ8B7b}T
z{BPNizz<$@ojYlkCkp(fvensI-y#3?3&XzLZx+z1$~MvOQE5-LY5*IyN$s~N^yogK?2)32YgTOK{p-gpEq1Vg$g>vdk+R4sX2zdvaXs}a|zMm)foK(H~4T>R_EkI*^B
z_4@HGwvnLw#-R{79A?^E+Y^`o?K{BMd8$xT@#qOEBJrcdF2;AG^BlBqcIB&6B7dOZ
z=t7a(>Xgga@|*IRC{+7q31#xP#6K
z0ui&(TvP~*POKB7ga~i*a756t`cHrKN?Xm>=9r1~6F=4xPrIzmr}c&yo~?*N=4{5Px)`L$}73FO}_f!(HJ4Pt;IOe
z@`65d^jDOnKp8I%oodV0c`3It3O?qHG41yF{Rd824;XH{`+|vHuD;iB8Ha7ZYs^Ix
z1dw1Gq@oHb_p4yNF-!X)OD?1?y;q-#)}q1J*@Y{6;wC2V%88(nC}M{+LQe=U<)Uq!
zl&^{5PJ*ygpTjx>Zw<^M3-P$45JZ$l6te*%ecY%nOizrc6hs+Azzz;jMFibxfRW^$
ziz!GDE1eQWm~*kCLaebyw4M{rP8#8C3ZjKz8TY=g1WVvzQDUr-1W^nijp_IGxc7}E
z*ikm%CBm8uBEnpv=#mII7i5U&334gj&sOfx=9_khmA?)#Ac!u>TdZw3%WJq4y%BG6e2h+rK@n^AOuyj0Ti2I&P1bw;>wxm
zqfBO_6hJeX)kJW=5X+DPAQ#@R5obt)$8y1WRIEACO@)?(HgiM7GT)0HGSZUFi4XDe
zTF~7+!QdTJp)f&CL{Q9F)@NAOR}c?1A_+olEE${+y1Xbt92bMv1hEG$0ng|G?n2~q
zGV{=KGSv*M#N#NMxJn{O{i^hw%<^T!s6?<>h@^6{Xd*(3okC?|{mpQdc)wyUNQF`*
zmsq|XDO$R)N~csqCRRlkMzP0PnIae(sZ^&lYHXS>l;We$O2MQ&-OiE=6td0IbI+vb
zcPLO}SFdQ>PQAc!&kX4RB+cIOX
zk(DjTNEb7O8364o#6}A<6l7VtTG^XP*;`z*w+3hHlh|@6xY2O-4p}x)D`%Gsfi7Yj
zvRSjDn}J(1b~q_Vkso;9!R#jGTD#^R3eL4l&voGE+R0Q%v$;-Mc_&DD&aQdK_?Qeq
zw#kEZd(99Y8RQXh2i*}AKIU|AzIS^5RerwDaK4``|2UscBNd!X&)YkTz)WTBB^QJY
z7lg?QpdvUc8XM)xxgX4-r*j_gInjet3MZ!&7+Qr%q(YW!VM=ge+SNii8AcNpK9v=+
zwTiMyMY*m;`N2h;^r9kuQOR&o8L3E)N9Z|Wd9KATf{Sa?i~0QG`r+aRS+PK?q={70
z;#yK`fWHNx^0_75!zDek5}{UUAE|V}wRAAJRFqyi%r700mB2s3I5g}hQrU!S*_Yrl
zNqX57zwG;P*^I1gR;zrTRQ}lkuSo;enB_8l`O0wlnyegH&jro72sbYBE*G7_#nzQ0
c8xeoAQFdw-1oH|tw+i*U6&ly9U@*Y^|1FC+o&W#<
literal 0
HcmV?d00001
diff --git a/installer/images/banner_right.gif b/installer/images/banner_right.gif
new file mode 100644
index 0000000000000000000000000000000000000000..3248668ac0f8ede8adbc5631eec5dc68270a9c5e
GIT binary patch
literal 433
zcmV;i0Z#r$Nk%w1VF~~^0M!5hR#sM1Q&V?$cYJ(&aBy&dfPiIXWj{YZSy@?vf`Uv;
zOi@u$TU%RaXJ>3|Y-(z1etv#+b#+NeNn&DRPEJmFd3kelb4Er+US3{9Lqmv&h=+%V
zg@uJZJv~7|K{`4*H#avmH8nFcGttq}tE;Q#=H~bJ_kDeRkdTnx-rk0WhPAb|)z#Jf
z{QNvTJn!%C@$vD}($eDM;*ye*o12^0*VnhVw~vpHMMXuiv9ZR+#`^mDgoK2Pi;MsN
z{{R30A^8LV00000EC2ui015y&000KgK%a0(EEC#q0b334wxx1%-x(5Q&P51C5T46_JvY0+p7R
z5t*8s7M-4-1fim%4yC5252>oF4Xv)P2C=fU6ScOt7`eK;486X;2*JX`0L8|~0m;hC
z3(d~Y6w%Vt3f0!v64~0@7v0|98R6pMI3DKb=K%-n?Cb&^@bU3EANBV206QT2{2(qY
bK0*i_ctD2`5eN~UkTIkW2^%nq1OWg$I9Jky
literal 0
HcmV?d00001
diff --git a/installer/images/delete.png b/installer/images/delete.png
new file mode 100755
index 0000000000000000000000000000000000000000..08f249365afd29594b51210c6e21ba253897505d
GIT binary patch
literal 715
zcmV;+0yO=JP)C4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR
z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y
zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51
zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7
zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp
zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y
z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l
z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc
literal 0
HcmV?d00001
diff --git a/installer/index.php b/installer/index.php
new file mode 100644
index 0000000..264cefc
--- /dev/null
+++ b/installer/index.php
@@ -0,0 +1,73 @@
+
+
+
+RoundCube Webmail Installer
+
+
+
+
+
+
+
+
+
+
+
+
RoundCube Webmail Installer
+
+load_config();
+
+?>
+
+
+ $item) {
+ $j = $i + 1;
+ $link = ($RCI->step >= $j || $RCI->configured) ? '' . Q($item) . ' ' : Q($item);
+ printf('%s ', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
+ }
+?>
+
+
+step]) {
+ include $include_steps[$RCI->step];
+}
+else {
+ header("HTTP/1.0 404 Not Found");
+ echo '
Invalid step ';
+}
+
+?>
+
+
+
+
+
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
new file mode 100644
index 0000000..8caa79d
--- /dev/null
+++ b/installer/rcube_install.php
@@ -0,0 +1,374 @@
+step = intval($_REQUEST['_step']);
+ $this->is_post = $_SERVER['REQUEST_METHOD'] == 'POST';
+ }
+
+ /**
+ * Singleton getter
+ */
+ function get_instance()
+ {
+ static $inst;
+
+ if (!$inst)
+ $inst = new rcube_install();
+
+ return $inst;
+ }
+
+ /**
+ * Read the default config files and store properties
+ */
+ function load_defaults()
+ {
+ $this->_load_config('.php.dist');
+ }
+
+
+ /**
+ * Read the local config files and store properties
+ */
+ function load_config()
+ {
+ $this->config = array();
+ $this->_load_config('.php');
+ $this->configured = !empty($this->config);
+ }
+
+ /**
+ * Read the default config file and store properties
+ * @access private
+ */
+ function _load_config($suffix)
+ {
+ @include '../config/main.inc' . $suffix;
+ if (is_array($rcmail_config)) {
+ $this->config += $rcmail_config;
+ }
+
+ @include '../config/db.inc'. $suffix;
+ if (is_array($rcmail_config)) {
+ $this->config += $rcmail_config;
+ }
+ }
+
+
+ /**
+ * Getter for a certain config property
+ *
+ * @param string Property name
+ * @param string Default value
+ * @return string The property value
+ */
+ function getprop($name, $default = '')
+ {
+ $value = $this->is_post && (isset($_POST["_$name"]) || $this->config_props[$name]) ? $_POST["_$name"] : $this->config[$name];
+
+ if ($name == 'des_key' && !isset($_REQUEST["_$name"]))
+ $value = rcube_install::random_key(24);
+
+ return $value !== null && $value !== '' ? $value : $default;
+ }
+
+
+ /**
+ * Take the default config file and replace the parameters
+ * with the submitted form data
+ *
+ * @param string Which config file (either 'main' or 'db')
+ * @return string The complete config file content
+ */
+ function create_config($which)
+ {
+ $out = file_get_contents("../config/{$which}.inc.php.dist");
+
+ if (!$out)
+ return '[Warning: could not read the template file]';
+
+ foreach ($this->config as $prop => $default) {
+ $value = (isset($_POST["_$prop"]) || $this->config_props[$prop]) ? $_POST["_$prop"] : $default;
+
+ // convert some form data
+ if ($prop == 'debug_level' && is_array($value)) {
+ $val = 0;
+ foreach ($value as $i => $dbgval)
+ $val += intval($dbgval);
+ $value = $val;
+ }
+ else if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
+ if ($_POST['_dbtype'] == 'sqlite')
+ $value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'], $_POST['_dbname']{0} == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']);
+ else
+ $value = sprintf('%s://%s:%s@%s/%s', $_POST['_dbtype'], $_POST['_dbuser'], $_POST['_dbpass'], $_POST['_dbhost'], $_POST['_dbname']);
+ }
+ else if ($prop == 'smtp_auth_type' && $value == '0') {
+ $value = '';
+ }
+ else if ($prop == 'default_host' && is_array($value)) {
+ $value = rcube_install::_clean_array($value);
+ if (count($value) <= 1)
+ $value = $value[0];
+ }
+ else if ($prop == 'smtp_user' && !empty($_POST['_smtp_user_u'])) {
+ $value = '%u';
+ }
+ else if ($prop == 'smtp_pass' && !empty($_POST['_smtp_user_u'])) {
+ $value = '%p';
+ }
+ else if (is_bool($default)) {
+ $value = (bool)$value;
+ }
+ else if (is_numeric($value)) {
+ $value = intval($value);
+ }
+
+ // skip this property
+ if ($value == $default)
+ continue;
+
+ // replace the matching line in config file
+ $out = preg_replace(
+ '/(\$rcmail_config\[\''.preg_quote($prop).'\'\])\s+=\s+(.+);/Uie',
+ "'\\1 = ' . var_export(\$value, true) . ';'",
+ $out);
+ }
+
+ return $out;
+ }
+
+
+ /**
+ * Getter for the last error message
+ *
+ * @return string Error message or null if none exists
+ */
+ function get_error()
+ {
+ return $this->last_error['message'];
+ }
+
+
+ /**
+ * Return a list with all imap hosts configured
+ *
+ * @return array Clean list with imap hosts
+ */
+ function get_hostlist()
+ {
+ $default_hosts = (array)$this->getprop('default_host');
+ $out = array();
+
+ foreach ($default_hosts as $key => $name) {
+ if (!empty($name))
+ $out[] = is_numeric($key) ? $name : $key;
+ }
+
+ return $out;
+ }
+
+
+ /**
+ * Display OK status
+ *
+ * @param string Test name
+ * @param string Confirm message
+ */
+ function pass($name, $message = '')
+ {
+ echo Q($name) . ': OK ';
+ $this->_showhint($message);
+ }
+
+
+ /**
+ * Display an error status and increase failure count
+ *
+ * @param string Test name
+ * @param string Error message
+ * @param string URL for details
+ */
+ function fail($name, $message = '', $url = '')
+ {
+ $this->failures++;
+
+ echo Q($name) . ': NOT OK ';
+ $this->_showhint($message, $url);
+ }
+
+
+ /**
+ * Display warning status
+ *
+ * @param string Test name
+ * @param string Warning message
+ * @param string URL for details
+ */
+ function na($name, $message = '', $url = '')
+ {
+ echo Q($name) . ': NOT AVAILABLE ';
+ $this->_showhint($message, $url);
+ }
+
+
+ function _showhint($message, $url = '')
+ {
+ $hint = Q($message);
+
+ if ($url)
+ $hint .= ($hint ? '; ' : '') . 'See ' . Q($url) . ' ';
+
+ if ($hint)
+ echo '(' . $hint . ') ';
+ }
+
+
+ function _clean_array($arr)
+ {
+ $out = array();
+
+ foreach (array_unique($arr) as $i => $val)
+ if (!empty($val))
+ $out[] = $val;
+
+ return $out;
+ }
+
+
+ /**
+ * Initialize the database with the according schema
+ *
+ * @param object rcube_db Database connection
+ * @return boolen True on success, False on error
+ */
+ function init_db($DB)
+ {
+ $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql');
+ $engine = isset($db_map[$DB->db_provider]) ? $db_map[$DB->db_provider] : $DB->db_provider;
+
+ // find out db version
+ if ($engine == 'mysql') {
+ $DB->query('SELECT VERSION() AS version');
+ $sql_arr = $DB->fetch_assoc();
+ $version = floatval($sql_arr['version']);
+
+ if ($version >= 4.1)
+ $engine = 'mysql5';
+ }
+
+ // read schema file from /SQL/*
+ $fname = "../SQL/$engine.initial.sql";
+ if ($lines = @file($fname, FILE_SKIP_EMPTY_LINES)) {
+ $buff = '';
+ foreach ($lines as $i => $line) {
+ if (eregi('^--', $line))
+ continue;
+
+ $buff .= $line . "\n";
+ if (eregi(';$', trim($line))) {
+ $DB->query($buff);
+ $buff = '';
+ }
+ }
+ }
+ else {
+ $this->fail('DB Schema', "Cannot read the schema file: $fname");
+ return false;
+ }
+
+ if ($err = $this->get_error()) {
+ $this->fail('DB Schema', "Error creating database schema: $err");
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Handler for RoundCube errors
+ */
+ function raise_error($p)
+ {
+ $this->last_error = $p;
+ }
+
+
+ /**
+ * Generarte a ramdom string to be used as encryption key
+ *
+ * @param int Key length
+ * @return string The generated random string
+ * @static
+ */
+ function random_key($length)
+ {
+ $alpha = 'ABCDEFGHIJKLMNOPQERSTUVXYZabcdefghijklmnopqrtsuvwxyz0123456789+*%&?!$-_=';
+ $out = '';
+
+ for ($i=0; $i < $length; $i++)
+ $out .= $alpha{rand(0, strlen($alpha)-1)};
+
+ return $out;
+ }
+
+}
+
+
+/**
+ * Shortcut function for htmlentities()
+ *
+ * @param string String to quote
+ * @return string The html-encoded string
+ */
+function Q($string)
+{
+ return htmlentities($string);
+}
+
+
+/**
+ * Fake rinternal error handler to catch errors
+ */
+function raise_error($p)
+{
+ $rci = rcube_install::get_instance();
+ $rci->raise_error($p);
+}
+
diff --git a/installer/styles.css b/installer/styles.css
new file mode 100644
index 0000000..ed64ff0
--- /dev/null
+++ b/installer/styles.css
@@ -0,0 +1,231 @@
+
+body {
+ margin: 1em 2em 2em 2em;
+ background-color: #fff;
+}
+
+body, td, th, div, p {
+ font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ color: #000;
+}
+
+#banner {
+ position: relative;
+}
+
+#header {
+ position: relative;
+ height: 56px;
+ background: url('images/banner_bg.gif') top left repeat-x #fff;
+}
+
+#header div.banner-logo {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 200px;
+ height: 56px;
+}
+
+#header div.banner-right {
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ width: 10px;
+ height: 56px;
+}
+
+#topnav {
+ position: absolute;
+ right: 20px;
+ bottom: 8px;
+ text-align: right;
+ color: #ebebeb;
+ font-size: smaller;
+}
+
+#topnav a {
+ color: #ebebeb;
+ font-size: 11px;
+ text-decoration: none;
+}
+
+#topnav a:hover {
+ text-decoration: underline;
+}
+
+#content {
+ margin: 8px 20px;
+}
+
+#footer {
+ margin: 2em 20px 1em 20px;
+ padding-top: 0.6em;
+ font-size: smaller;
+ text-align: center;
+ border-top: 1px dotted #999;
+}
+
+#progress {
+ margin-bottom: 2em;
+ border: 1px solid #aaa;
+ background-color: #f9f9f9;
+}
+
+#progress:after {
+ content: ".";
+ display: block;
+ height: 0;
+ font-size: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+#progress li {
+ float: left;
+ color: #999;
+ padding: 1em 5em 1em 0.2em;
+}
+
+#progress li a {
+ color: #999;
+ text-decoration: none;
+}
+
+#progress li a:hover {
+ text-decoration: underline;
+}
+
+#progress li.current {
+ color: #000;
+ font-weight: bold;
+}
+
+#progress li.passed,
+#progress li.passed a,
+#progress li.current a {
+ color: #333;
+}
+
+fieldset {
+ margin-bottom: 1.5em;
+ border: 1px solid #aaa;
+ background-color: #f9f9f9;
+}
+
+fieldset p.hint {
+ margin-top: 0.5em;
+}
+
+legend {
+ font-size: 1.1em;
+ font-weight: bold;
+}
+
+textarea.configfile {
+ background-color: #f9f9f9;
+ font-family: monospace;
+ font-size: 9pt;
+ width: 100%;
+ height: 30em;
+}
+
+dt.propname {
+ font-family: monospace;
+ font-size: 9pt;
+ margin-top: 1em;
+ margin-bottom: 0.6em;
+}
+
+dd div {
+ margin-top: 0.3em;
+}
+
+dd label {
+ padding-left: 0.5em;
+}
+
+th {
+ text-align: left;
+}
+
+ul li {
+ margin: 0.3em 0 0.4em -1em;
+}
+
+ul li ul li {
+ margin-bottom: 0.2em;
+}
+
+h3 {
+ font-size: 1.1em;
+ margin-top: 1.5em;
+ margin-bottom: 0.6em;
+}
+
+h4 {
+ margin-bottom: 0.2em;
+}
+
+a.blocktoggle {
+ color: #666;
+ text-decoration: none;
+}
+
+a.addlink {
+ color: #999;
+ font-size: 0.9em;
+ padding: 1px 0 1px 20px;
+ background: url('images/add.png') top left no-repeat;
+ text-decoration: none;
+}
+
+a.removelink {
+ color: #999;
+ font-size: 0.9em;
+ padding: 1px 0 1px 24px;
+ background: url('images/delete.png') 4px 0 no-repeat;
+ text-decoration: none;
+}
+
+.hint {
+ color: #666;
+ font-size: 0.95em;
+}
+
+.success {
+ color: #006400;
+ font-weight: bold !important;
+}
+
+.fail {
+ color: #ff0000 !important;
+ font-weight: bold !important;
+}
+
+.na {
+ color: #f60;
+ font-weight: bold;
+}
+
+.indent {
+ padding-left: 0.8em;
+}
+
+.notice {
+ padding: 1em;
+ background-color: #f7fdcb;
+ border: 2px solid #c2d071;
+}
+
+.warning {
+ padding: 1em;
+ background-color: #ef9398;
+ border: 2px solid #dc5757;
+}
+
+.userconf {
+ color: #00c;
+ font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
+}
diff --git a/installer/test.php b/installer/test.php
new file mode 100644
index 0000000..7e99039
--- /dev/null
+++ b/installer/test.php
@@ -0,0 +1,324 @@
+
+
+
+
+
+
+After completing the installation and the final tests please remove the whole
+installer folder from the document root of the webserver.
+
+
+These files may expose sensitive configuration data like server passwords and encryption keys
+to the public. Make sure you cannot access this installer from your browser.
+
+
diff --git a/installer/welcome.html b/installer/welcome.html
new file mode 100644
index 0000000..a0c88e5
--- /dev/null
+++ b/installer/welcome.html
@@ -0,0 +1,35 @@
+
diff --git a/program/include/main.inc b/program/include/main.inc
index 55135eb..5af2379 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -5,7 +5,7 @@
| program/include/main.inc |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2007, RoundCube Dev, - Switzerland |
+ | Copyright (C) 2005-2008, RoundCube Dev, - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: main.inc 903 2007-10-22 06:52:13Z thomasb $
+ $Id: main.inc 1145 2008-02-27 13:39:22Z thomasb $
*/
@@ -27,10 +27,10 @@
*/
require_once('lib/utf7.inc');
+require_once('include/rcube_user.inc');
require_once('include/rcube_shared.inc');
require_once('include/rcmail_template.inc');
-
// define constannts for input reading
define('RCUBE_INPUT_GET', 0x0101);
define('RCUBE_INPUT_POST', 0x0102);
@@ -46,7 +46,7 @@ define('RCUBE_INPUT_GPC', 0x0103);
function rcmail_startup($task='mail')
{
global $sess_id, $sess_user_lang;
- global $CONFIG, $INSTALL_PATH, $BROWSER, $OUTPUT, $_SESSION, $IMAP, $DB;
+ global $CONFIG, $INSTALL_PATH, $BROWSER, $OUTPUT, $_SESSION, $IMAP, $DB, $USER;
// check client
$BROWSER = rcube_browser();
@@ -54,6 +54,11 @@ function rcmail_startup($task='mail')
// load configuration
$CONFIG = rcmail_load_config();
+ // set session domain
+ if (isset($CONFIG['session_domain']) && !empty($CONFIG['session_domain'])) {
+ ini_set('session.cookie_domain', $CONFIG['session_domain']);
+ }
+
// set session garbage collecting time according to session_lifetime
if (!empty($CONFIG['session_lifetime']))
ini_set('session.gc_maxlifetime', ($CONFIG['session_lifetime']) * 120);
@@ -85,10 +90,11 @@ function rcmail_startup($task='mail')
// set session vars global
$sess_user_lang = rcube_language_prop($_SESSION['user_lang']);
+ // create user object
+ $USER = new rcube_user($_SESSION['user_id']);
// overwrite config with user preferences
- if (is_array($_SESSION['user_prefs']))
- $CONFIG = array_merge($CONFIG, $_SESSION['user_prefs']);
+ $CONFIG = array_merge($CONFIG, (array)$USER->get_prefs());
// reset some session parameters when changing task
@@ -231,7 +237,8 @@ function rcmail_authenticate_session()
$valid = $CONFIG['ip_check'] ? $_SERVER['REMOTE_ADDR'] == $SESS_CLIENT_IP : true;
// check session filetime
- if (!empty($CONFIG['session_lifetime']) && isset($SESS_CHANGED) && $SESS_CHANGED + $CONFIG['session_lifetime']*60 < time())
+ if (!empty($CONFIG['session_lifetime']) && isset($SESS_CHANGED)
+ && $SESS_CHANGED + $CONFIG['session_lifetime']*60 < time())
$valid = false;
return $valid;
@@ -319,21 +326,18 @@ function rcmail_shutdown()
*/
function rcmail_kill_session()
{
- // save user preferences
- $a_user_prefs = $_SESSION['user_prefs'];
- if (!is_array($a_user_prefs))
- $a_user_prefs = array();
-
+ global $USER;
+
if ((isset($_SESSION['sort_col']) && $_SESSION['sort_col']!=$a_user_prefs['message_sort_col']) ||
(isset($_SESSION['sort_order']) && $_SESSION['sort_order']!=$a_user_prefs['message_sort_order']))
{
- $a_user_prefs['message_sort_col'] = $_SESSION['sort_col'];
- $a_user_prefs['message_sort_order'] = $_SESSION['sort_order'];
- rcmail_save_user_prefs($a_user_prefs);
+ $a_user_prefs = array('message_sort_col' => $_SESSION['sort_col'], 'message_sort_order' => $_SESSION['sort_order']);
+ $USER->save_prefs($a_user_prefs);
}
$_SESSION = array('user_lang' => $GLOBALS['sess_user_lang'], 'auth_time' => time(), 'temp' => true);
setcookie('sessauth', '-del-', time()-60);
+ $USER->reset();
}
@@ -374,7 +378,7 @@ function get_sequence_name($sequence)
if (strlen($CONFIG[$config_key]))
return $CONFIG[$config_key];
- return $table;
+ return $sequence;
}
@@ -529,7 +533,7 @@ function rcmail_autoselect_host()
*/
function rcmail_login($user, $pass, $host=NULL)
{
- global $CONFIG, $IMAP, $DB, $sess_user_lang;
+ global $CONFIG, $IMAP, $DB, $USER, $sess_user_lang;
$user_id = NULL;
if (!$host)
@@ -560,7 +564,7 @@ function rcmail_login($user, $pass, $host=NULL)
if ($a_host['host'])
{
$host = $a_host['host'];
- $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
+ $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
$imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : $CONFIG['default_port']);
}
else
@@ -581,58 +585,50 @@ function rcmail_login($user, $pass, $host=NULL)
// try to resolve email address from virtuser table
if (!empty($CONFIG['virtuser_file']) && strpos($user, '@'))
- $user = rcmail_email2user($user);
+ $user = rcube_user::email2user($user);
// lowercase username if it's an e-mail address (#1484473)
if (strpos($user, '@'))
$user = strtolower($user);
// query if user already registered
- $sql_result = $DB->query(
- "SELECT user_id, username, language, preferences
- FROM ".get_table_name('users')."
- WHERE mail_host=? AND (username=? OR alias=?)",
- $host,
- $user,
- $user);
+ if ($existing = rcube_user::query($user, $host))
+ $USER = $existing;
// user already registered -> overwrite username
- if ($sql_arr = $DB->fetch_assoc($sql_result))
+ if ($USER->ID)
{
- $user_id = $sql_arr['user_id'];
- $user = $sql_arr['username'];
+ $user_id = $USER->ID;
+ $user = $USER->data['username'];
}
// exit if IMAP login failed
if (!($imap_login = $IMAP->connect($host, $user, $pass, $imap_port, $imap_ssl)))
- return FALSE;
+ return false;
// user already registered
- if ($user_id && !empty($sql_arr))
+ if ($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);
- }
-
+ $CONFIG = array_merge($CONFIG, (array)$USER->get_prefs());
// set user specific language
- if (strlen($sql_arr['language']))
- $sess_user_lang = $_SESSION['user_lang'] = $sql_arr['language'];
+ if (!empty($USER->data['language']))
+ $sess_user_lang = $_SESSION['user_lang'] = $USER->data['language'];
// update user's record
- $DB->query("UPDATE ".get_table_name('users')."
- SET last_login=".$DB->now()."
- WHERE user_id=?",
- $user_id);
+ $USER->touch();
}
// create new system user
else if ($CONFIG['auto_create_user'])
{
- $user_id = rcmail_create_user($user, $host);
+ if ($created = rcube_user::create($user, $host))
+ {
+ $USER = $created;
+
+ // get existing mailboxes
+ $a_mailboxes = $IMAP->list_mailboxes();
+ }
}
else
{
@@ -644,13 +640,13 @@ function rcmail_login($user, $pass, $host=NULL)
), true, false);
}
- if ($user_id)
+ if ($USER->ID)
{
- $_SESSION['user_id'] = $user_id;
+ $_SESSION['user_id'] = $USER->ID;
+ $_SESSION['username'] = $USER->data['username'];
$_SESSION['imap_host'] = $host;
$_SESSION['imap_port'] = $imap_port;
$_SESSION['imap_ssl'] = $imap_ssl;
- $_SESSION['username'] = $user;
$_SESSION['user_lang'] = $sess_user_lang;
$_SESSION['password'] = encrypt_passwd($pass);
$_SESSION['login_time'] = mktime();
@@ -658,7 +654,9 @@ function rcmail_login($user, $pass, $host=NULL)
// force reloading complete list of subscribed mailboxes
rcmail_set_imap_prop();
$IMAP->clear_cache('mailboxes');
- $IMAP->create_default_folders();
+
+ if ($CONFIG['create_default_folders'])
+ $IMAP->create_default_folders();
return TRUE;
}
@@ -667,83 +665,6 @@ function rcmail_login($user, $pass, $host=NULL)
}
-/**
- * Create new entry in users and identities table
- *
- * @param string User name
- * @param string IMAP host
- * @return mixed New user ID or False on failure
- */
-function rcmail_create_user($user, $host)
-{
- global $DB, $CONFIG, $IMAP;
-
- $user_email = '';
-
- // try to resolve user in virtusertable
- if (!empty($CONFIG['virtuser_file']) && !strpos($user, '@'))
- $user_email = rcmail_user2email($user);
-
- $DB->query("INSERT INTO ".get_table_name('users')."
- (created, last_login, username, mail_host, alias, language)
- VALUES (".$DB->now().", ".$DB->now().", ?, ?, ?, ?)",
- strip_newlines($user),
- strip_newlines($host),
- strip_newlines($user_email),
- $_SESSION['user_lang']);
-
- if ($user_id = $DB->insert_id(get_sequence_name('users')))
- {
- $mail_domain = rcmail_mail_domain($host);
-
- if ($user_email=='')
- $user_email = strpos($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
-
- $user_name = $user!=$user_email ? $user : '';
-
- // try to resolve the e-mail address from the virtuser table
- if (!empty($CONFIG['virtuser_query']) &&
- ($sql_result = $DB->query(preg_replace('/%u/', $DB->quote($user), $CONFIG['virtuser_query']))) &&
- ($DB->num_rows()>0))
- {
- while ($sql_arr = $DB->fetch_array($sql_result))
- {
- $DB->query("INSERT INTO ".get_table_name('identities')."
- (user_id, del, standard, name, email)
- VALUES (?, 0, 1, ?, ?)",
- $user_id,
- strip_newlines($user_name),
- preg_replace('/^@/', $user . '@', $sql_arr[0]));
- }
- }
- else
- {
- // also create new identity records
- $DB->query("INSERT INTO ".get_table_name('identities')."
- (user_id, del, standard, name, email)
- VALUES (?, 0, 1, ?, ?)",
- $user_id,
- strip_newlines($user_name),
- strip_newlines($user_email));
- }
-
- // get existing mailboxes
- $a_mailboxes = $IMAP->list_mailboxes();
- }
- else
- {
- raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'line' => __LINE__,
- 'file' => __FILE__,
- 'message' => "Failed to create new user"), TRUE, FALSE);
- }
-
- return $user_id;
-}
-
-
/**
* Load virtuser table in array
*
@@ -789,90 +710,6 @@ function rcmail_findinvirtual($pattern)
}
-/**
- * Resolve username using a virtuser table
- *
- * @param string E-mail address to resolve
- * @return string Resolved IMAP username
- */
-function rcmail_email2user($email)
- {
- $user = $email;
- $r = rcmail_findinvirtual("^$email");
-
- for ($i=0; $i0)
- {
- $user = trim($arr[count($arr)-1]);
- break;
- }
- }
-
- return $user;
- }
-
-
-/**
- * Resolve e-mail address from virtuser table
- *
- * @param string User name
- * @return string Resolved e-mail address
- */
-function rcmail_user2email($user)
- {
- $email = "";
- $r = rcmail_findinvirtual("$user$");
-
- for ($i=0; $i0)
- {
- $email = trim($arr[0]);
- break;
- }
- }
-
- return $email;
- }
-
-
-/**
- * Write the given user prefs to the user's record
- *
- * @param mixed User prefs to save
- * @return boolean True on success, False on failure
- */
-function rcmail_save_user_prefs($a_user_prefs)
- {
- global $DB, $CONFIG, $sess_user_lang;
-
- // merge (partial) prefs array with existing settings
- $a_user_prefs += (array)$_SESSION['user_prefs'];
-
- $DB->query("UPDATE ".get_table_name('users')."
- SET preferences=?,
- language=?
- WHERE user_id=?",
- serialize($a_user_prefs),
- $sess_user_lang,
- $_SESSION['user_id']);
-
- if ($DB->affected_rows())
- {
- $_SESSION['user_prefs'] = $a_user_prefs;
- $CONFIG = array_merge($CONFIG, $a_user_prefs);
- return TRUE;
- }
-
- return FALSE;
- }
-
-
/**
* Overwrite action variable
*
@@ -926,15 +763,30 @@ function show_message($message, $type='notice', $vars=NULL)
* @return string Encryprted string
*/
function encrypt_passwd($pass)
- {
- $td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
- $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
- mcrypt_generic_init($td, get_des_key(), $iv);
- $cypher = mcrypt_generic($td, $pass);
- mcrypt_generic_deinit($td);
- mcrypt_module_close($td);
- return base64_encode($cypher);
+{
+ if (function_exists('mcrypt_module_open') && ($td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""))) {
+ $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
+ mcrypt_generic_init($td, get_des_key(), $iv);
+ $cypher = mcrypt_generic($td, $pass);
+ mcrypt_generic_deinit($td);
+ mcrypt_module_close($td);
+ }
+ else if (function_exists('des')) {
+ $cypher = des(get_des_key(), $pass, 1, 0, NULL);
}
+ else {
+ $cypher = $pass;
+
+ raise_error(array(
+ 'code' => 500,
+ 'type' => 'php',
+ 'file' => __FILE__,
+ 'message' => "Could not convert encrypt password. Make sure Mcrypt is installed or lib/des.inc is available"
+ ), true, false);
+ }
+
+ return base64_encode($cypher);
+}
/**
@@ -944,13 +796,21 @@ function encrypt_passwd($pass)
* @return string Plain password
*/
function decrypt_passwd($cypher)
- {
- $td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
- $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
- mcrypt_generic_init($td, get_des_key(), $iv);
- $pass = mdecrypt_generic($td, base64_decode($cypher));
- mcrypt_generic_deinit($td);
- mcrypt_module_close($td);
+{
+ if (function_exists('mcrypt_module_open') && ($td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""))) {
+ $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
+ mcrypt_generic_init($td, get_des_key(), $iv);
+ $pass = mdecrypt_generic($td, base64_decode($cypher));
+ mcrypt_generic_deinit($td);
+ mcrypt_module_close($td);
+ }
+ else if (function_exists('des')) {
+ $pass = des(get_des_key(), base64_decode($cypher), 0, 0, NULL);
+ }
+ else {
+ $pass = base64_decode($cypher);
+ }
+
return preg_replace('/\x00/', '', $pass);
}
@@ -1076,42 +936,83 @@ function rcmail_message_cache_gc()
function rcube_charset_convert($str, $from, $to=NULL)
{
global $MBSTRING;
+ static $convert_warning = false;
$from = strtoupper($from);
$to = $to==NULL ? strtoupper(RCMAIL_CHARSET) : strtoupper($to);
+ $error = false; $conv = null;
if ($from==$to || $str=='' || empty($from))
return $str;
+
+ $aliases = array(
+ 'UNKNOWN-8BIT' => 'ISO-8859-15',
+ 'X-UNKNOWN' => 'ISO-8859-15',
+ 'X-USER-DEFINED' => 'ISO-8859-15',
+ 'ISO-8859-8-I' => 'ISO-8859-8',
+ 'KS_C_5601-1987' => 'EUC-KR',
+ 'GB2312' => 'GB18030'
+ );
// convert charset using iconv module
if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7')
{
- $iconv_map = array('KS_C_5601-1987' => 'EUC-KR');
- return iconv(($iconv_map[$from] ? $iconv_map[$from] : $from), ($iconv_map[$to] ? $iconv_map[$to] : $to) . "//IGNORE", $str);
+ return iconv(($aliases[$from] ? $aliases[$from] : $from), ($aliases[$to] ? $aliases[$to] : $to) . "//IGNORE", $str);
}
// convert charset using mbstring module
if ($MBSTRING)
{
- $mb_map = array('UTF-7' => 'UTF7-IMAP', 'KS_C_5601-1987' => 'EUC-KR');
+ $mb_map = $aliases + array('UTF-7' => 'UTF7-IMAP');
// return if convert succeeded
if (($out = mb_convert_encoding($str, ($mb_map[$to] ? $mb_map[$to] : $to), ($mb_map[$from] ? $mb_map[$from] : $from))) != '')
return $out;
}
+
+
+ if (class_exists('utf8'))
+ $conv = new utf8();
// convert string to UTF-8
- if ($from=='UTF-7')
+ if ($from == 'UTF-7')
$str = utf7_to_utf8($str);
- else if (($from=='ISO-8859-1') && function_exists('utf8_encode'))
+ else if (($from == 'ISO-8859-1') && function_exists('utf8_encode'))
$str = utf8_encode($str);
+ else if ($from != 'UTF-8' && $conv)
+ {
+ $conv->loadCharset($from);
+ $str = $conv->strToUtf8($str);
+ }
+ else if ($from != 'UTF-8')
+ $error = true;
// encode string for output
- if ($to=='UTF-7')
+ if ($to == 'UTF-7')
return utf8_to_utf7($str);
- else if ($to=='ISO-8859-1' && function_exists('utf8_decode'))
+ else if ($to == 'ISO-8859-1' && function_exists('utf8_decode'))
return utf8_decode($str);
+ else if ($to != 'UTF-8' && $conv)
+ {
+ $conv->loadCharset($to);
+ return $conv->utf8ToStr($str);
+ }
+ else if ($to != 'UTF-8')
+ $error = true;
+ // report error
+ if ($error && !$convert_warning)
+ {
+ raise_error(array(
+ 'code' => 500,
+ 'type' => 'php',
+ 'file' => __FILE__,
+ 'message' => "Could not convert string charset. Make sure iconv is installed or lib/utf8.class is available"
+ ), true, false);
+
+ $convert_warning = true;
+ }
+
// return UTF-8 string
return $str;
}
@@ -1273,6 +1174,14 @@ function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL)
return $value;
}
+/**
+ * Remove all non-ascii and non-word chars
+ * except . and -
+ */
+function asciiwords($str)
+{
+ return preg_replace('/[^a-z0-9.-_]/i', '', $str);
+}
/**
* Remove single and double quotes from given string
@@ -1426,7 +1335,7 @@ function rcmail_get_edit_field($col, $value, $attrib, $type='text')
// use value from post
if (!empty($_POST[$fname]))
- $value = $_POST[$fname];
+ $value = get_input_value($fname, RCUBE_INPUT_POST);
$out = $input->show($value);
@@ -1500,6 +1409,26 @@ function rcmail_mod_css_styles($source, $container_id, $base_url = '')
return $styles;
}
+/**
+ * Try to autodetect operating system and find the correct line endings
+ *
+ * @return string The appropriate mail header delimiter
+ */
+function rcmail_header_delm()
+{
+ global $CONFIG;
+
+ // use the configured delimiter for headers
+ if (!empty($CONFIG['mail_header_delimiter']))
+ return $CONFIG['mail_header_delimiter'];
+ else if (strtolower(substr(PHP_OS, 0, 3)=='win'))
+ return "\r\n";
+ else if (strtolower(substr(PHP_OS, 0, 3)=='mac'))
+ return "\r\n";
+ else
+ return "\n";
+}
+
/**
* Compose a valid attribute string for HTML tags
@@ -1758,10 +1687,6 @@ function rcmail_mailbox_list($attrib)
// get mailbox list
$mbox_name = $IMAP->get_mailbox_name();
- // for these mailboxes we have localized labels
- $special_mailboxes = array('inbox', 'sent', 'drafts', 'trash', 'junk');
-
-
// build the folders tree
if (empty($a_mailboxes))
{
@@ -1779,9 +1704,9 @@ function rcmail_mailbox_list($attrib)
// var_dump($a_mailboxes);
if ($type=='select')
- $out .= rcmail_render_folder_tree_select($a_mailboxes, $special_mailboxes, $mbox_name, $attrib['maxlength']);
+ $out .= rcmail_render_folder_tree_select($a_mailboxes, $mbox_name, $attrib['maxlength']);
else
- $out .= rcmail_render_folder_tree_html($a_mailboxes, $special_mailboxes, $mbox_name, $attrib['maxlength']);
+ $out .= rcmail_render_folder_tree_html($a_mailboxes, $mbox_name, $attrib['maxlength']);
// rcube_print_time($mboxlist_start, 'render_folder_tree()');
@@ -1831,7 +1756,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
* Return html for a structured list <ul> for the mailbox tree
* @access private
*/
-function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $maxlength, $nestLevel=0)
+function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $nestLevel=0)
{
global $COMM_PATH, $IMAP, $CONFIG, $OUTPUT;
@@ -1842,9 +1767,8 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
$zebra_class = ($nestLevel*$idx)%2 ? 'even' : 'odd';
$title = '';
- $folder_lc = strtolower($folder['id']);
- if (in_array($folder_lc, $special))
- $foldername = rcube_label($folder_lc);
+ if ($folder_class = rcmail_folder_classname($folder['id']))
+ $foldername = rcube_label($folder_class);
else
{
$foldername = $folder['name'];
@@ -1852,7 +1776,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
// shorten the folder name to a given length
if ($maxlength && $maxlength>1)
{
- $fname = abbrevate_string($foldername, $maxlength);
+ $fname = abbreviate_string($foldername, $maxlength);
if ($fname != $foldername)
$title = ' title="'.Q($foldername).'"';
$foldername = $fname;
@@ -1865,7 +1789,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
// make folder name safe for ids and class names
$folder_id = preg_replace('/[^A-Za-z0-9\-_]/', '', $folder['id']);
- $class_name = preg_replace('/[^a-z0-9\-_]/', '', $folder_lc);
+ $class_name = preg_replace('/[^a-z0-9\-_]/', '', $folder_class ? $folder_class : strtolower($folder['id']));
// set special class for Sent, Drafts, Trash and Junk
if ($folder['id']==$CONFIG['sent_mbox'])
@@ -1901,7 +1825,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
Q($foldername));
if (!empty($folder['folders']))
- $out .= "\n\n" . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox_name, $maxlength, $nestLevel+1) . " \n";
+ $out .= "\n\n" . rcmail_render_folder_tree_html($folder['folders'], $mbox_name, $maxlength, $nestLevel+1) . " \n";
$out .= "\n";
$idx++;
@@ -1915,7 +1839,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m
* Return html for a flat list for the mailbox tree
* @access private
*/
-function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name, $maxlength, $nestLevel=0)
+function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, $nestLevel=0)
{
global $IMAP, $OUTPUT;
@@ -1923,16 +1847,15 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name,
$out = '';
foreach ($arrFolders as $key=>$folder)
{
- $folder_lc = strtolower($folder['id']);
- if (in_array($folder_lc, $special))
- $foldername = rcube_label($folder_lc);
+ if ($folder_class = rcmail_folder_classname($folder['id']))
+ $foldername = rcube_label($folder_class);
else
{
$foldername = $folder['name'];
// shorten the folder name to a given length
if ($maxlength && $maxlength>1)
- $foldername = abbrevate_string($foldername, $maxlength);
+ $foldername = abbreviate_string($foldername, $maxlength);
}
$out .= sprintf('%s%s '."\n",
@@ -1941,7 +1864,7 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name,
Q($foldername));
if (!empty($folder['folders']))
- $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox_name, $maxlength, $nestLevel+1);
+ $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, $nestLevel+1);
$idx++;
}
@@ -1949,4 +1872,43 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name,
return $out;
}
+
+/**
+ * Return internal name for the given folder if it matches the configured special folders
+ * @access private
+ */
+function rcmail_folder_classname($folder_id)
+{
+ global $CONFIG;
+
+ $cname = null;
+ $folder_lc = strtolower($folder_id);
+
+ // for these mailboxes we have localized labels and css classes
+ foreach (array('inbox', 'sent', 'drafts', 'trash', 'junk') as $smbx)
+ {
+ if ($folder_lc == $smbx || $folder_id == $CONFIG[$smbx.'_mbox'])
+ $cname = $smbx;
+ }
+
+ return $cname;
+}
+
+
+/**
+ * Try to localize the given IMAP folder name.
+ * UTF-7 decode it in case no localized text was found
+ *
+ * @param string Folder name
+ * @return string Localized folder name in UTF-8 encoding
+ */
+function rcmail_localize_foldername($name)
+{
+ if ($folder_class = rcmail_folder_classname($name))
+ return rcube_label($folder_class);
+ else
+ return rcube_charset_convert($name, 'UTF-7');
+}
+
+
?>
diff --git a/program/include/rcmail_template.inc b/program/include/rcmail_template.inc
index 15752f8..301b3f2 100644
--- a/program/include/rcmail_template.inc
+++ b/program/include/rcmail_template.inc
@@ -312,6 +312,13 @@ class rcmail_template extends rcube_html_page
if (!$this->framed && !empty($this->js_env))
$out .= ($this->ajax_call ? 'this' : JS_OBJECT_NAME) . '.set_env('.json_serialize($this->js_env).");\n";
+ // add command to set page title
+ if ($this->ajax_call && !empty($this->pagetitle))
+ $out .= sprintf(
+ "this.set_pagetitle('%s');\n",
+ JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle)
+ );
+
foreach ($this->js_commands as $i => $args)
{
$method = array_shift($args);
@@ -326,12 +333,7 @@ class rcmail_template extends rcube_html_page
join(',', $args));
}
- // add command to set page title
- if ($this->ajax_call && !empty($this->pagetitle))
- $out .= sprintf(
- "this.set_pagetitle('%s');\n",
- JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle)
- );
+
return $out;
}
@@ -356,7 +358,7 @@ class rcmail_template extends rcube_html_page
*/
function parse_with_globals($input)
{
- $GLOBALS['__comm_path'] = urlencode($GLOBALS['COMM_PATH']);
+ $GLOBALS['__comm_path'] = Q($GLOBALS['COMM_PATH']);
return preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input);
}
@@ -451,8 +453,7 @@ class rcmail_template extends rcube_html_page
{
// return a button
case 'button':
- if ($attrib['command'])
- return $this->button($attrib);
+ return $this->button($attrib);
break;
// show a label
@@ -580,7 +581,7 @@ class rcmail_template extends rcube_html_page
$skin_path = $this->config['skin_path'];
- if (!($attrib['command'] || $attrib['name']))
+ if (!($attrib['command'] || $attrib['name'] || $attrib['onclick']))
return '';
// try to find out the button type
@@ -761,27 +762,15 @@ function rcmail_message_container($attrib)
*/
function rcmail_current_username($attrib)
{
- global $DB;
+ global $USER;
static $s_username;
// alread fetched
if (!empty($s_username))
return $s_username;
- // get e-mail address form default identity
- $sql_result = $DB->query(
- "SELECT email AS mailto
- FROM ".get_table_name('identities')."
- WHERE user_id=?
- AND standard=1
- AND del<>1",
- $_SESSION['user_id']);
-
- if ($DB->num_rows($sql_result))
- {
- $sql_arr = $DB->fetch_assoc($sql_result);
- $s_username = $sql_arr['mailto'];
- }
+ if ($sql_arr = $USER->get_identity())
+ $s_username = $sql_arr['email'];
else if (strstr($_SESSION['username'], '@'))
$s_username = $_SESSION['username'];
else
@@ -831,12 +820,12 @@ function rcmail_login_form($attrib)
}
}
- $fields['host'] = isset($select_host) ? $select_host->show($_POST['_host']) : null;
+ $fields['host'] = isset($select_host) ? $select_host->show(get_input_value('_host', RCUBE_INPUT_POST)) : null;
}
else if (!strlen($CONFIG['default_host']))
{
$input_host = new textfield(array('name' => '_host', 'id' => 'rcmloginhost', 'size' => 30));
- $fields['host'] = $input_host->show($_POST['_host']);
+ $fields['host'] = $input_host->show(get_input_value('_host', RCUBE_INPUT_POST));
}
$form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
diff --git a/program/include/rcube_contacts.inc b/program/include/rcube_contacts.inc
index f01d222..6a48656 100644
--- a/program/include/rcube_contacts.inc
+++ b/program/include/rcube_contacts.inc
@@ -386,6 +386,19 @@ class rcube_contacts
return $this->db->affected_rows();
}
+
+
+ /**
+ * Remove all records from the database
+ */
+ function delete_all()
+ {
+ if (is_array($ids))
+ $ids = join(',', $ids);
+
+ $this->db->query("DELETE FROM {$this->db_name} WHERE user_id=?", $this->user_id);
+ return $this->db->affected_rows();
+ }
}
diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc
index 9c3eaa8..3878816 100644
--- a/program/include/rcube_db.inc
+++ b/program/include/rcube_db.inc
@@ -17,7 +17,7 @@
| Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: rcube_db.inc 666 2007-08-07 21:02:12Z thomasb $
+ $Id: rcube_db.inc 1089 2008-02-15 13:20:07Z till $
*/
@@ -25,8 +25,7 @@
/**
* Obtain the PEAR::DB class that is used for abstraction
*/
-require_once('DB.php');
-
+require_once 'DB.php';
/**
* Database independent query interface
@@ -426,6 +425,22 @@ class rcube_db
}
+ /**
+ * Escapes a string
+ *
+ * @param string The string to be escaped
+ * @return string The escaped string
+ * @access public
+ */
+ function escapeSimple($str)
+ {
+ if (!$this->db_handle)
+ $this->db_connect('r');
+
+ return $this->db_handle->escapeSimple($str);
+ }
+
+
/*
* Return SQL function for current time and date
*
@@ -580,4 +595,4 @@ class rcube_db
} // end class rcube_db
-?>
\ No newline at end of file
+?>
diff --git a/program/include/rcube_html.inc b/program/include/rcube_html.inc
index a31594a..d23760a 100644
--- a/program/include/rcube_html.inc
+++ b/program/include/rcube_html.inc
@@ -292,10 +292,6 @@ class rcube_form_element
if ((strpos($key,'on')===0 && $value==''))
continue;
- // encode textarea content
- if ($key=='value')
- $value = Q($value, 'strict', FALSE);
-
// attributes with no value
if (in_array($key, array('checked', 'multiple', 'disabled', 'selected', 'nowrap')))
{
@@ -304,11 +300,11 @@ class rcube_form_element
}
// don't convert size of value attribute
else if ($key=='value')
- $attrib_arr[] = sprintf('%s="%s"', $this->_conv_case($key, 'attrib'), $value);
+ $attrib_arr[] = sprintf('%s="%s"', $this->_conv_case($key, 'attrib'), Q($value, 'strict', false));
// regular tag attributes
else
- $attrib_arr[] = sprintf('%s="%s"', $this->_conv_case($key, 'attrib'), $this->_conv_case($value, 'value'));
+ $attrib_arr[] = sprintf('%s="%s"', $this->_conv_case($key, 'attrib'), $this->_conv_case(Q($value), 'value'));
}
return sizeof($attrib_arr) ? ' '.implode(' ', $attrib_arr) : '';
@@ -620,10 +616,10 @@ class select extends rcube_form_element
if (is_array($names))
{
foreach ($names as $i => $text)
- $this->options[] = array('text' => $text, 'value' => (string)$values[$i]);
+ $this->options[] = array('text' => $text, 'value' => $values[$i]);
}
else
- $this->options[] = array('text' => $names, 'value' => (string)$values);
+ $this->options[] = array('text' => $names, 'value' => $values);
}
@@ -640,7 +636,7 @@ class select extends rcube_form_element
$value_str = $this->_conv_case(' value="%s"', 'attrib');
if (!is_array($select))
- $select = array((string)$select);
+ $select = array($select);
foreach ($this->options as $option)
{
@@ -651,7 +647,7 @@ class select extends rcube_form_element
$options_str .= sprintf("<%s%s%s>%s%s>\n",
$this->_conv_case('option', 'tag'),
- !empty($option['value']) ? sprintf($value_str, Q($option['value'])) : '',
+ isset($option['value']) ? sprintf($value_str, Q($option['value'])) : '',
$selected,
Q($option['text'], 'strict', FALSE),
$this->_conv_case('option', 'tag'));
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 7c6caf3..a41f231 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -5,7 +5,7 @@
| program/include/rcube_imap.inc |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2006, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -16,7 +16,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: rcube_imap.inc 883 2007-10-17 21:27:20Z thomasb $
+ $Id: rcube_imap.inc 1050 2008-02-12 14:06:26Z thomasb $
*/
@@ -35,7 +35,7 @@ require_once('lib/mime.inc');
*
* @package Mail
* @author Thomas Bruederli
- * @version 1.39
+ * @version 1.40
* @link http://ilohamail.org
*/
class rcube_imap
@@ -97,17 +97,17 @@ class rcube_imap
* @param string Username for IMAP account
* @param string Password for IMAP account
* @param number Port to connect to
- * @param boolean Use SSL connection
+ * @param string SSL schema (either ssl or tls) or null if plain connection
* @return boolean TRUE on success, FALSE on failure
* @access public
*/
- function connect($host, $user, $pass, $port=143, $use_ssl=FALSE)
+ function connect($host, $user, $pass, $port=143, $use_ssl=null)
{
global $ICL_SSL, $ICL_PORT, $IMAP_USE_INTERNAL_DATE;
// check for Open-SSL support in PHP build
if ($use_ssl && in_array('openssl', get_loaded_extensions()))
- $ICL_SSL = TRUE;
+ $ICL_SSL = $use_ssl == 'imaps' ? 'ssl' : $use_ssl;
else if ($use_ssl)
{
raise_error(array('code' => 403, 'type' => 'imap', 'file' => __FILE__,
@@ -441,7 +441,7 @@ class rcube_imap
$mailbox = $this->mailbox;
// count search set
- if ($this->search_string && $mailbox == $this->mailbox && $mode == 'ALL')
+ if ($this->search_string && $mailbox == $this->mailbox && $mode == 'ALL' && !$force)
return count((array)$this->search_set);
$a_mailbox_cache = $this->get_cache('messagecount');
@@ -527,10 +527,7 @@ class rcube_imap
if ($this->search_string && $mailbox == $this->mailbox)
return $this->_list_header_set($mailbox, $this->search_set, $page, $sort_field, $sort_order);
- if ($sort_field!=NULL)
- $this->sort_field = $sort_field;
- if ($sort_order!=NULL)
- $this->sort_order = strtoupper($sort_order);
+ $this->_set_sort_order($sort_field, $sort_order);
$max = $this->_messagecount($mailbox);
$start_msg = ($this->list_page-1) * $this->page_size;
@@ -647,10 +644,7 @@ class rcube_imap
if (!strlen($mailbox) || empty($msgs))
return array();
- if ($sort_field!=NULL)
- $this->sort_field = $sort_field;
- if ($sort_order!=NULL)
- $this->sort_order = strtoupper($sort_order);
+ $this->_set_sort_order($sort_field, $sort_order);
$max = count($msgs);
$start_msg = ($this->list_page-1) * $this->page_size;
@@ -764,13 +758,20 @@ class rcube_imap
*/
function message_index($mbox_name='', $sort_field=NULL, $sort_order=NULL)
{
- if ($sort_field!=NULL)
- $this->sort_field = $sort_field;
- if ($sort_order!=NULL)
- $this->sort_order = strtoupper($sort_order);
+ $this->_set_sort_order($sort_field, $sort_order);
$mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
- $key = "$mbox:".$this->sort_field.":".$this->sort_order.".msgi";
+ $key = "{$mailbox}:{$this->sort_field}:{$this->sort_order}:{$this->search_string}.msgi";
+
+ // we have a saved search result. get index from there
+ if (!isset($this->cache[$key]) && $this->search_string && $mailbox == $this->mailbox)
+ {
+ $this->cache[$key] = $a_msg_headers = array();
+ $this->_fetch_headers($mailbox, join(',', $this->search_set), $a_msg_headers, NULL);
+
+ foreach (iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order) as $i => $msg)
+ $this->cache[$key][] = $msg->uid;
+ }
// have stored it in RAM
if (isset($this->cache[$key]))
@@ -943,6 +944,20 @@ class rcube_imap
return $this->get_search_set();
}
+
+
+ /**
+ * Check if the given message ID is part of the current search set
+ *
+ * @return boolean True on match or if no search request is stored
+ */
+ function in_searchset($msgid)
+ {
+ if (!empty($this->search_string))
+ return in_array("$msgid", (array)$this->search_set, true);
+ else
+ return true;
+ }
/**
@@ -967,8 +982,8 @@ class rcube_imap
// write headers cache
if ($headers)
{
- if ($is_uid)
- $this->uid_id_map[$mbox_name][$uid] = $headers->id;
+ if ($headers->uid && $headers->id)
+ $this->uid_id_map[$mailbox][$headers->uid] = $headers->id;
$this->add_message_cache($mailbox.'.msg', $headers->id, $headers);
}
@@ -1005,7 +1020,7 @@ class rcube_imap
if (!empty($structure))
{
$this->_msg_id = $msg_id;
- $headers = $this->get_headers($msg_id, NULL, FALSE);
+ $headers = $this->get_headers($uid);
$struct = &$this->_structure_part($structure);
$struct->headers = get_object_vars($headers);
@@ -1130,10 +1145,14 @@ class rcube_imap
}
// normalize filename property
- if (!empty($struct->d_parameters['filename']))
- $struct->filename = $this->decode_mime_string($struct->d_parameters['filename']);
- else if (!empty($struct->ctype_parameters['name']))
- $struct->filename = $this->decode_mime_string($struct->ctype_parameters['name']);
+ if ($filename_mime = $struct->d_parameters['filename'] ? $struct->d_parameters['filename'] : $struct->ctype_parameters['name'])
+ $struct->filename = $this->decode_mime_string($filename_mime);
+ else if ($filename_encoded = $struct->d_parameters['filename*'] ? $struct->d_parameters['filename*'] : $struct->ctype_parameters['name*'])
+ {
+ // decode filename according to RFC 2231, Section 4
+ list($filename_charset,, $filename_urlencoded) = split('\'', $filename_encoded);
+ $struct->filename = rcube_charset_convert(urldecode($filename_urlencoded), $filename_charset);
+ }
else if (!empty($struct->headers['content-description']))
$struct->filename = $this->decode_mime_string($struct->headers['content-description']);
@@ -1201,15 +1220,22 @@ class rcube_imap
if ($print)
{
- iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, ($o_part->encoding=='base64'?3:2));
- $body = TRUE;
+ $mode = $o_part->encoding == 'base64' ? 3 : ($o_part->encoding == 'quoted-printable' ? 1 : 2);
+ $body = iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, $mode);
+
+ // we have to decode the part manually before printing
+ if ($mode == 1)
+ {
+ echo $this->mime_decode($body, $o_part->encoding);
+ $body = true;
+ }
}
else
{
$body = iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, 1);
// decode part body
- if ($o_part->encoding=='base64' || $o_part->encoding=='quoted-printable')
+ if ($o_part->encoding)
$body = $this->mime_decode($body, $o_part->encoding);
// convert charset (if text or message part)
@@ -1278,7 +1304,7 @@ class rcube_imap
* Set message flag to one or several messages
*
* @param mixed Message UIDs as array or as comma-separated string
- * @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT
+ * @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT
* @return boolean True on success, False on failure
*/
function set_flag($uids, $flag)
@@ -1759,13 +1785,17 @@ class rcube_imap
$deleted = TRUE;
foreach ($all_mboxes as $c_mbox)
- if (preg_match('/^'.preg_quote($mailbox.$this->delimiter).'/', $c_mbox))
+ {
+ $regex = preg_quote($mailbox . $this->delimiter, '/');
+ $regex = '/^' . $regex . '/';
+ if (preg_match($regex, $c_mbox))
{
iil_C_UnSubscribe($this->conn, $c_mbox);
$result = iil_C_DeleteFolder($this->conn, $c_mbox);
if ($result>=0)
$deleted = TRUE;
}
+ }
}
// clear mailboxlist cache
@@ -2059,10 +2089,8 @@ class rcube_imap
*/
function &get_cached_message($key, $uid, $struct=false)
{
- if (!$this->caching_enabled)
- return FALSE;
-
$internal_key = '__single_msg';
+
if ($this->caching_enabled && (!isset($this->cache[$internal_key][$uid]) ||
($struct && empty($this->cache[$internal_key][$uid]->structure))))
{
@@ -2123,9 +2151,17 @@ class rcube_imap
*/
function add_message_cache($key, $index, $headers, $struct=null)
{
- if (!$this->caching_enabled || empty($key) || !is_object($headers) || empty($headers->uid))
+ if (empty($key) || !is_object($headers) || empty($headers->uid))
+ return;
+
+ // add to internal (fast) cache
+ $this->cache['__single_msg'][$headers->uid] = $headers;
+ $this->cache['__single_msg'][$headers->uid]->structure = $struct;
+
+ // no further caching
+ if (!$this->caching_enabled)
return;
-
+
// check for an existing record (probly headers are cached but structure not)
$sql_result = $this->db->query(
"SELECT message_id
@@ -2432,6 +2468,17 @@ class rcube_imap
return $mbox_name;
}
+ /**
+ * Validate the given input and save to local properties
+ * @access private
+ */
+ function _set_sort_order($sort_field, $sort_order)
+ {
+ if ($sort_field != null)
+ $this->sort_field = asciiwords($sort_field);
+ if ($sort_order != null)
+ $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC';
+ }
/**
* Sort mailboxes first by default folders and then in alphabethical order
@@ -2447,7 +2494,7 @@ class rcube_imap
if ($folder{0}=='.')
continue;
- if (($p = array_search(strtolower($folder), $this->default_folders_lc))!==FALSE)
+ if (($p = array_search(strtolower($folder), $this->default_folders_lc)) !== false && !$a_defaults[$p])
$a_defaults[$p] = $folder;
else
$a_out[] = $folder;
@@ -2481,7 +2528,16 @@ class rcube_imap
if (!$mbox_name)
$mbox_name = $this->mailbox;
- return iil_C_ID2UID($this->conn, $mbox_name, $id);
+ $index = array_flip((array)$this->uid_id_map[$mbox_name]);
+ if (isset($index[$id]))
+ $uid = $index[$id];
+ else
+ {
+ $uid = iil_C_ID2UID($this->conn, $mbox_name, $id);
+ $this->uid_id_map[$mbox_name][$uid] = $id;
+ }
+
+ return $uid;
}
diff --git a/program/include/rcube_ldap.inc b/program/include/rcube_ldap.inc
index f3828eb..f1b2108 100644
--- a/program/include/rcube_ldap.inc
+++ b/program/include/rcube_ldap.inc
@@ -1,5 +1,4 @@
|
+-----------------------------------------------------------------------+
- $Id: rcube_ldap.inc 787 2007-09-09 17:58:13Z thomasb $
+ $Id: rcube_ldap.inc 1152 2008-02-28 20:01:57Z thomasb $
*/
@@ -286,9 +285,12 @@ class rcube_ldap
}
$filter .= ')';
+ // avoid double-wildcard if $value is empty
+ $filter = preg_replace('/\*+/', '*', $filter);
+
// add general filter to query
if (!empty($this->prop['filter']))
- $filter = '(&'.$this->prop['filter'] . $filter . ')';
+ $filter = '(&(' . preg_replace('/^\(|\)$/', '', $this->prop['filter']) . ')' . $filter . ')';
// set filter string and execute search
$this->set_search_set($filter);
diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc
index 02206c6..0b2feff 100644
--- a/program/include/rcube_mdb2.inc
+++ b/program/include/rcube_mdb2.inc
@@ -16,7 +16,7 @@
| Author: Lukas Kahwe Smith |
+-----------------------------------------------------------------------+
- $Id: rcube_mdb2.inc 850 2007-10-03 00:13:32Z ihug $
+ $Id: rcube_mdb2.inc 1084 2008-02-14 23:12:23Z till $
*/
@@ -94,15 +94,17 @@ class rcube_mdb2
function dsn_connect($dsn)
{
// Use persistent connections if available
- $dbh = MDB2::connect($dsn, array('persistent' => $this->db_pconn, 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL));
+ $dbh = MDB2::connect($dsn,
+ array('persistent' => $this->db_pconn,
+ 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL));
- if (PEAR::isError($dbh))
+ if (MDB2::isError($dbh))
{
$this->db_error = TRUE;
$this->db_error_msg = $dbh->getMessage();
- raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
- 'message' => $dbh->getMessage()), TRUE, FALSE);
+ raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__,
+ 'file' => __FILE__, 'message' => $dbh->getUserInfo()), TRUE, FALSE);
}
else if ($this->db_provider=='sqlite')
{
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index fa87176..adef24c 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: rcube_shared.inc 839 2007-09-29 18:15:05Z thomasb $
+ $Id: rcube_shared.inc 1078 2008-02-14 01:33:02Z till $
*/
@@ -246,8 +246,8 @@ function send_modified_header($mdate, $etag=null)
$iscached = true;
$etag = $etag ? "\"$etag\"" : null;
- if ($etag && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
- $iscached = true;
+ if ($etag)
+ $iscached = ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag);
if ($iscached)
header("HTTP/1.x 304 Not Modified");
@@ -557,9 +557,9 @@ function rc_request_header($name)
* @param string Input string
* @param int Max. length
* @param string Replace removed chars with this
- * @return string Abbrevated string
+ * @return string Abbreviated string
*/
-function abbrevate_string($str, $maxlength, $place_holder='...')
+function abbreviate_string($str, $maxlength, $place_holder='...')
{
$length = rc_strlen($str);
$first_part_length = floor($maxlength/2) - rc_strlen($place_holder);
@@ -674,5 +674,42 @@ function strrstr($haystack, $needle)
}
}
+/**
+ * A method to guess the mime_type of an attachment.
+ *
+ * @param string $path Path to the file.
+ * @param string $failover Mime type supplied for failover.
+ *
+ * @return string
+ * @author Till Klampaeckel
+ * @see http://de2.php.net/manual/en/ref.fileinfo.php
+ * @see http://de2.php.net/mime_content_type
+ */
+function rc_mime_content_type($path, $failover = 'unknown/unknown')
+{
+ global $CONFIG;
+
+ $mime_magic = $CONFIG['mime_magic'];
+
+ if (function_exists('mime_content_type')) {
+ return mime_content_type($path);
+ }
+ if (!extension_loaded('fileinfo')) {
+ if (!dl('fileinfo.' . PHP_SHLIB_SUFFIX)) {
+ return $failover;
+ }
+ }
+ $finfo = finfo_open(FILEINFO_MIME, $mime_magic);
+ if (!$finfo) {
+ return $failover;
+ }
+ $mime_type = finfo_file($finfo,$path);
+ if (!$mime_type) {
+ return $failover;
+ }
+ finfo_close($finfo);
+
+ return $mime_type;
+}
-?>
+?>
\ No newline at end of file
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index 55ac8f5..bbc8869 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: rcube_smtp.inc 805 2007-09-20 13:36:57Z robin $
+ $Id: rcube_smtp.inc 1136 2008-02-25 10:17:35Z till $
*/
@@ -62,19 +62,19 @@ function smtp_mail($from, $recipients, &$headers, &$body, &$response)
$smtp_host_url = parse_url($CONFIG['smtp_server']);
// overwrite port
- if ($smtp_host_url['host'] && $smtp_host_url['port'])
+ if (isset($smtp_host_url['host']) && isset($smtp_host_url['port']))
{
$smtp_host = $smtp_host_url['host'];
$smtp_port = $smtp_host_url['port'];
}
// re-write smtp host
- if ($smtp_host_url['host'] && $smtp_host_url['scheme'])
+ if (isset($smtp_host_url['host']) && isset($smtp_host_url['scheme']))
$smtp_host = sprintf('%s://%s', $smtp_host_url['scheme'], $smtp_host_url['host']);
// create Net_SMTP object and connect to server
- if (!is_object($smtp_conn))
+ if (!is_object($SMTP_CONN))
{
$helo_host = empty($CONFIG['smtp_helo_host']) ? (empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']) : $CONFIG['smtp_helo_host'];
$SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
@@ -112,7 +112,7 @@ function smtp_mail($from, $recipients, &$headers, &$body, &$response)
if (PEAR::isError($result))
{
smtp_reset();
- $response[] .= "Authentication failure: ".$result->getMessage();
+ $response[] .= 'Authentication failure: ' . $result->getMessage() . ' (Code: ' . $result->getCode() . ')';
return FALSE;
}
}
diff --git a/program/include/rcube_user.inc b/program/include/rcube_user.inc
new file mode 100644
index 0000000..41b424f
--- /dev/null
+++ b/program/include/rcube_user.inc
@@ -0,0 +1,482 @@
+ |
+ +-----------------------------------------------------------------------+
+
+ $Id: rcube_user.inc 933 2007-11-29 14:17:32Z thomasb $
+
+*/
+
+
+/**
+ * Class representing a system user
+ *
+ * @package core
+ * @author Thomas Bruederli
+ */
+class rcube_user
+{
+ var $ID = null;
+ var $data = null;
+
+
+ /**
+ * Object constructor
+ *
+ * @param object DB Database connection
+ */
+ function __construct($id = null, $sql_arr = null)
+ {
+ global $DB;
+
+ if ($id && !$sql_arr)
+ {
+ $sql_result = $DB->query("SELECT * FROM ".get_table_name('users')." WHERE user_id=?", $id);
+ $sql_arr = $DB->fetch_assoc($sql_result);
+ }
+
+ if (!empty($sql_arr))
+ {
+ $this->ID = $sql_arr['user_id'];
+ $this->data = $sql_arr;
+ }
+ }
+
+ /**
+ * PHP 4 object constructor
+ *
+ * @see rcube_user::__construct
+ */
+ function rcube_user($id = null, $sql_arr = null)
+ {
+ $this->__construct($id, $sql_arr);
+ }
+
+
+ /**
+ * Build a user name string (as e-mail address)
+ *
+ * @return string Full user name
+ */
+ function get_username()
+ {
+ return $this->data['username'] ? $this->data['username'] . (!strpos($this->data['username'], '@') ? '@'.$this->data['mail_host'] : '') : false;
+ }
+
+
+ /**
+ * Get the preferences saved for this user
+ *
+ * @return array Hash array with prefs
+ */
+ function get_prefs()
+ {
+ if ($this->ID && $this->data['preferences'])
+ return unserialize($this->data['preferences']);
+ else
+ return array();
+ }
+
+
+ /**
+ * Write the given user prefs to the user's record
+ *
+ * @param mixed User prefs to save
+ * @return boolean True on success, False on failure
+ */
+ function save_prefs($a_user_prefs)
+ {
+ global $DB, $CONFIG, $sess_user_lang;
+
+ if (!$this->ID)
+ return false;
+
+ // merge (partial) prefs array with existing settings
+ $a_user_prefs += (array)$this->get_prefs();
+
+ $DB->query(
+ "UPDATE ".get_table_name('users')."
+ SET preferences=?,
+ language=?
+ WHERE user_id=?",
+ serialize($a_user_prefs),
+ $sess_user_lang,
+ $this->ID);
+
+ if ($DB->affected_rows())
+ {
+ $CONFIG = array_merge($CONFIG, $a_user_prefs);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Get default identity of this user
+ *
+ * @param int Identity ID. If empty, the default identity is returned
+ * @return array Hash array with all cols of the
+ */
+ function get_identity($id = null)
+ {
+ global $DB;
+
+ $sql_result = $this->list_identities($id ? sprintf('AND identity_id=%d', $id) : '');
+ return $DB->fetch_assoc($sql_result);
+ }
+
+
+ /**
+ * Return a list of all identities linked with this user
+ *
+ * @return array List of identities
+ */
+ function list_identities($sql_add = '')
+ {
+ global $DB;
+
+ // get contacts from DB
+ $sql_result = $DB->query(
+ "SELECT * FROM ".get_table_name('identities')."
+ WHERE del<>1
+ AND user_id=?
+ $sql_add
+ ORDER BY ".$DB->quoteIdentifier('standard')." DESC, name ASC",
+ $this->ID);
+
+ return $sql_result;
+ }
+
+
+ /**
+ * Update a specific identity record
+ *
+ * @param int Identity ID
+ * @param array Hash array with col->value pairs to save
+ * @return boolean True if saved successfully, false if nothing changed
+ */
+ function update_identity($iid, $data)
+ {
+ global $DB;
+
+ if (!$this->ID)
+ return false;
+
+ $write_sql = array();
+
+ foreach ((array)$data as $col => $value)
+ {
+ $write_sql[] = sprintf("%s=%s",
+ $DB->quoteIdentifier($col),
+ $DB->quote($value));
+ }
+
+ $DB->query(
+ "UPDATE ".get_table_name('identities')."
+ SET ".join(', ', $write_sql)."
+ WHERE identity_id=?
+ AND user_id=?
+ AND del<>1",
+ $iid,
+ $this->ID);
+
+ return $DB->affected_rows();
+ }
+
+
+ /**
+ * Create a new identity record linked with this user
+ *
+ * @param array Hash array with col->value pairs to save
+ * @return int The inserted identity ID or false on error
+ */
+ function insert_identity($data)
+ {
+ global $DB;
+
+ if (!$this->ID)
+ return false;
+
+ $insert_cols = $insert_values = array();
+ foreach ((array)$data as $col => $value)
+ {
+ $insert_cols[] = $DB->quoteIdentifier($col);
+ $insert_values[] = $DB->quote($value);
+ }
+
+ $DB->query(
+ "INSERT INTO ".get_table_name('identities')."
+ (user_id, ".join(', ', $insert_cols).")
+ VALUES (?, ".join(', ', $insert_values).")",
+ $this->ID);
+
+ return $DB->insert_id(get_sequence_name('identities'));
+ }
+
+
+ /**
+ * Mark the given identity as deleted
+ *
+ * @param int Identity ID
+ * @return boolean True if deleted successfully, false if nothing changed
+ */
+ function delete_identity($iid)
+ {
+ global $DB;
+
+ if (!$this->ID)
+ return false;
+
+ if (!$this->ID || $this->ID == '')
+ return false;
+
+ $sql_result = $DB->query("SELECT count(*) AS ident_count FROM " .
+ get_table_name('identities') .
+ " WHERE user_id = ? AND del <> 1",
+ $this->ID);
+
+ $sql_arr = $DB->fetch_assoc($sql_result);
+ if ($sql_arr['ident_count'] <= 1)
+ return false;
+
+ $DB->query(
+ "UPDATE ".get_table_name('identities')."
+ SET del=1
+ WHERE user_id=?
+ AND identity_id=?",
+ $this->ID,
+ $iid);
+
+ return $DB->affected_rows();
+ }
+
+
+ /**
+ * Make this identity the default one for this user
+ *
+ * @param int The identity ID
+ */
+ function set_default($iid)
+ {
+ global $DB;
+
+ if ($this->ID && $iid)
+ {
+ $DB->query(
+ "UPDATE ".get_table_name('identities')."
+ SET ".$DB->quoteIdentifier('standard')."='0'
+ WHERE user_id=?
+ AND identity_id<>?
+ AND del<>1",
+ $this->ID,
+ $iid);
+ }
+ }
+
+
+ /**
+ * Update user's last_login timestamp
+ */
+ function touch()
+ {
+ global $DB;
+
+ if ($this->ID)
+ {
+ $DB->query(
+ "UPDATE ".get_table_name('users')."
+ SET last_login=".$DB->now()."
+ WHERE user_id=?",
+ $this->ID);
+ }
+ }
+
+
+ /**
+ * Clear the saved object state
+ */
+ function reset()
+ {
+ $this->ID = null;
+ $this->data = null;
+ }
+
+
+ /**
+ * Find a user record matching the given name and host
+ *
+ * @param string IMAP user name
+ * @param string IMAP host name
+ * @return object rcube_user New user instance
+ * @static
+ */
+ function query($user, $host)
+ {
+ global $DB;
+
+ // query if user already registered
+ $sql_result = $DB->query(
+ "SELECT * FROM ".get_table_name('users')."
+ WHERE mail_host=? AND (username=? OR alias=?)",
+ $host,
+ $user,
+ $user);
+
+ // user already registered -> overwrite username
+ if ($sql_arr = $DB->fetch_assoc($sql_result))
+ return new rcube_user($sql_arr['user_id'], $sql_arr);
+ else
+ return false;
+ }
+
+
+ /**
+ * Create a new user record and return a rcube_user instance
+ *
+ * @param string IMAP user name
+ * @param string IMAP host
+ * @return object rcube_user New user instance
+ * @static
+ */
+ function create($user, $host)
+ {
+ global $DB, $CONFIG;
+
+ $user_email = '';
+
+ // try to resolve user in virtusertable
+ if (!empty($CONFIG['virtuser_file']) && !strpos($user, '@'))
+ $user_email = self::user2email($user);
+
+ $DB->query(
+ "INSERT INTO ".get_table_name('users')."
+ (created, last_login, username, mail_host, alias, language)
+ VALUES (".$DB->now().", ".$DB->now().", ?, ?, ?, ?)",
+ strip_newlines($user),
+ strip_newlines($host),
+ strip_newlines($user_email),
+ $_SESSION['user_lang']);
+
+ if ($user_id = $DB->insert_id(get_sequence_name('users')))
+ {
+ $mail_domain = rcmail_mail_domain($host);
+
+ if ($user_email=='')
+ $user_email = strpos($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
+
+ $user_name = $user != $user_email ? $user : '';
+
+ // try to resolve the e-mail address from the virtuser table
+ if (!empty($CONFIG['virtuser_query']) &&
+ ($sql_result = $DB->query(preg_replace('/%u/', $DB->escapeSimple($user), $CONFIG['virtuser_query']))) &&
+ ($DB->num_rows()>0))
+ {
+ while ($sql_arr = $DB->fetch_array($sql_result))
+ {
+ $DB->query(
+ "INSERT INTO ".get_table_name('identities')."
+ (user_id, del, standard, name, email)
+ VALUES (?, 0, 1, ?, ?)",
+ $user_id,
+ strip_newlines($user_name),
+ preg_replace('/^@/', $user . '@', $sql_arr[0]));
+ }
+ }
+ else
+ {
+ // also create new identity records
+ $DB->query(
+ "INSERT INTO ".get_table_name('identities')."
+ (user_id, del, standard, name, email)
+ VALUES (?, 0, 1, ?, ?)",
+ $user_id,
+ strip_newlines($user_name),
+ strip_newlines($user_email));
+ }
+ }
+ else
+ {
+ raise_error(array(
+ 'code' => 500,
+ 'type' => 'php',
+ 'line' => __LINE__,
+ 'file' => __FILE__,
+ 'message' => "Failed to create new user"), true, false);
+ }
+
+ return $user_id ? new rcube_user($user_id) : false;
+ }
+
+
+ /**
+ * Resolve username using a virtuser table
+ *
+ * @param string E-mail address to resolve
+ * @return string Resolved IMAP username
+ * @static
+ */
+ function email2user($email)
+ {
+ $user = $email;
+ $r = rcmail_findinvirtual("^$email");
+
+ for ($i=0; $i 0)
+ {
+ $user = trim($arr[count($arr)-1]);
+ break;
+ }
+ }
+
+ return $user;
+ }
+
+
+ /**
+ * Resolve e-mail address from virtuser table
+ *
+ * @param string User name
+ * @return string Resolved e-mail address
+ * @static
+ */
+ function user2email($user)
+ {
+ $email = "";
+ $r = rcmail_findinvirtual("$user$");
+
+ for ($i=0; $i 0)
+ {
+ $email = trim($arr[0]);
+ break;
+ }
+ }
+
+ return $email;
+ }
+
+}
+
+
+?>
diff --git a/program/include/session.inc b/program/include/session.inc
index e76da0c..6b0eeab 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: session.inc 850 2007-10-03 00:13:32Z ihug $
+ $Id: session.inc 1063 2008-02-13 05:26:47Z till $
*/
@@ -172,8 +172,13 @@ function sess_regenerate_id()
sess_destroy(session_id());
session_id($random);
- $cookie = session_get_cookie_params();
- setcookie(session_name(), $random, $cookie['lifetime'], $cookie['path']);
+
+ $cookie = session_get_cookie_params();
+ $_lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0;
+
+ setcookie(session_name(), '', time() - 3600);
+ setcookie(session_name(), $random, $_lifetime, $cookie['path'],
+ $cookie['domain']);
return true;
}
diff --git a/program/js/app.js b/program/js/app.js
index fba54e5..19dbc35 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3,7 +3,7 @@
| RoundCube Webmail Client Script |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2007, RoundCube Dev, - Switzerland |
+ | Copyright (C) 2005-2008, RoundCube Dev, - Switzerland |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
@@ -13,7 +13,7 @@
| Requires: common.js, list.js |
+-----------------------------------------------------------------------+
- $Id: app.js 888 2007-10-19 14:04:43Z robin $
+ $Id: app.js 1170 2008-03-03 09:06:53Z thomasb $
*/
@@ -146,13 +146,19 @@ function rcube_webmail()
else
this.message_list.focus();
}
+
+ if (this.env.coltypes)
+ this.set_message_coltypes(this.env.coltypes);
// enable mail commands
this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', true);
+
+ if (this.env.search_text != null && document.getElementById('quicksearchbox') != null)
+ document.getElementById('quicksearchbox').value = this.env.search_text;
if (this.env.action=='show' || this.env.action=='preview')
{
- this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'viewsource', 'print', 'load-attachment', true);
+ this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', 'print', 'load-attachment', true);
if (this.env.next_uid)
{
this.enable_command('nextmessage', true);
@@ -223,6 +229,16 @@ function rcube_webmail()
this.gui_objects.folderlist = this.gui_objects.mailboxlist;
this.http_request('getunread', '');
}
+
+ // ask user to send MDN
+ if (this.env.mdn_request && this.env.uid)
+ {
+ var mdnurl = '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox);
+ if (confirm(this.get_label('mdnrequest')))
+ this.http_post('sendmdn', mdnurl);
+ else
+ this.http_post('mark', mdnurl+'&_flag=mdnsent');
+ }
break;
@@ -295,8 +311,8 @@ function rcube_webmail()
break;
case 'login':
- var input_user = rcube_find_object('_user');
- var input_pass = rcube_find_object('_pass');
+ var input_user = rcube_find_object('rcmloginuser');
+ var input_pass = rcube_find_object('rcmloginpwd');
if (input_user)
input_user.onkeypress = function(e){ return rcmail.login_user_keypress(e); };
if (input_user && input_user.value=='')
@@ -487,7 +503,7 @@ function rcube_webmail()
case 'list':
if (this.task=='mail')
{
- if (this.env.search_request<0 || (this.env.search_request && props != this.env.mailbox))
+ if (this.env.search_request<0 || (props != '' && (this.env.search_request && props != this.env.mailbox)))
this.reset_qsearch();
this.list_mailbox(props);
@@ -663,7 +679,12 @@ function rcube_webmail()
else if (this.task == 'addressbook' && this.drag_active)
this.copy_contact(null, props);
break;
-
+
+ case 'mark':
+ if (props)
+ this.mark_message(props);
+ break;
+
case 'toggle_status':
if (props && !props._row)
break;
@@ -674,7 +695,7 @@ function rcube_webmail()
if (props._row.uid)
{
uid = props._row.uid;
- this.message_list.dont_select = true;
+
// toggle read/unread
if (this.message_list.rows[uid].deleted) {
flag = 'undelete';
@@ -820,7 +841,7 @@ function rcube_webmail()
if (!this.check_compose_input())
break;
-
+
// Reset the auto-save timer
self.clearTimeout(this.save_timer);
@@ -865,11 +886,15 @@ function rcube_webmail()
case 'print':
var uid;
if (uid = this.get_single_uid())
- {
+ {
ref.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : ''));
if (this.printwin)
+ {
setTimeout(function(){ ref.printwin.focus(); }, 20);
+ if (this.env.action != 'show')
+ this.toggle_read_status('read', [uid]);
}
+ }
break;
case 'viewsource':
@@ -1075,10 +1100,6 @@ function rcube_webmail()
this.unfocus_folder(id);
this.command('moveto', id);
}
-
- // Hide message command buttons until a message is selected
- this.enable_command('reply', 'reply-all', 'forward', 'delete', 'print', false);
- return false;
};
this.click_on_list = function(e)
@@ -1108,12 +1129,12 @@ function rcube_webmail()
{
this.enable_command('reply', 'reply-all', 'forward', false);
this.enable_command('show', selected);
- this.enable_command('delete', 'moveto', (list.selection.length > 0 ? true : false));
+ this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
}
else
{
this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
- this.enable_command('delete', 'moveto', (list.selection.length > 0 ? true : false));
+ this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
}
// start timer for message preview (wait for double click)
@@ -1143,6 +1164,8 @@ function rcube_webmail()
this.command('show');
else if (list.key_pressed == list.DELETE_KEY)
this.command('delete');
+ else
+ list.shiftkey = false;
};
@@ -1187,6 +1210,10 @@ function rcube_webmail()
if (safe)
add_url = '&_safe=1';
+ // also send search request to get the right messages
+ if (this.env.search_request)
+ add_url += '&_search='+this.env.search_request;
+
if (id)
{
var url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url;
@@ -1356,11 +1383,8 @@ function rcube_webmail()
this.move_messages = function(mbox)
{
// exit if current or no mailbox specified or if selection is empty
- if (!mbox || !this.env.uid || mbox==this.env.mailbox)
- {
- if (!this.message_list || !this.message_list.get_selection().length)
- return;
- }
+ if (!mbox || mbox == this.env.mailbox || (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length)))
+ return;
var lock = false;
var add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : '');
@@ -1374,6 +1398,9 @@ function rcube_webmail()
else
this.show_contentframe(false);
+ // Hide message command buttons until a message is selected
+ this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', false);
+
this._with_selected_messages('moveto', lock, add_url);
};
@@ -1668,11 +1695,14 @@ function rcube_webmail()
{
// check input fields
var input_to = rcube_find_object('_to');
+ var input_cc = rcube_find_object('_cc');
+ var input_bcc = rcube_find_object('_bcc');
var input_subject = rcube_find_object('_subject');
var input_message = rcube_find_object('_message');
// check for empty recipient
- if (input_to && !rcube_check_email(input_to.value, true))
+ var recipients = input_to.value ? input_to.value : (input_cc.value ? input_cc.value : input_bcc.value);
+ if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true))
{
alert(this.get_label('norecipientwarning'));
input_to.focus();
@@ -1805,6 +1835,10 @@ function rcube_webmail()
var eid = tinyMCE.getEditorId('_message');
// editor is a TinyMCE_Control object
var editor = tinyMCE.getInstanceById(eid);
+ // if this is null, we should exit
+ if (editor == null) {
+ return false;
+ }
var msgDoc = editor.getDoc();
var msgBody = msgDoc.body;
@@ -1872,7 +1906,6 @@ function rcube_webmail()
// upload attachment file
this.upload_file = function(form)
{
-
if (!form)
return false;
@@ -2360,6 +2393,7 @@ function rcube_webmail()
return;
var a_cids = new Array();
+ var qs = '';
if (this.env.cid)
a_cids[a_cids.length] = this.env.cid;
@@ -2378,8 +2412,12 @@ function rcube_webmail()
this.show_contentframe(false);
}
+ // also send search request to get the right records from the next page
+ if (this.env.search_request)
+ qs += '&_search='+this.env.search_request;
+
// send request to server
- this.http_post('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : ''));
+ this.http_post('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : '')+qs);
return true;
};
@@ -2416,9 +2454,9 @@ function rcube_webmail()
{
var anchors = row.obj.getElementsByTagName('A');
if (anchors[0])
- anchors[0].onclick = function() { p.rename_folder(row.id); };
+ anchors[0].onclick = function() { p.rename_folder(row.id); return false; };
if (anchors[1])
- anchors[1].onclick = function() { p.delete_folder(row.id); };
+ anchors[1].onclick = function() { p.delete_folder(row.id); return false; };
row.obj.onmouseover = function() { p.focus_subscription(row.id); };
row.obj.onmouseout = function() { p.unfocus_subscription(row.id); };
}
@@ -2519,6 +2557,9 @@ function rcube_webmail()
this.set_env('folder', folder);
else
this.set_env('folder', null);
+
+ if (this.gui_objects.createfolderhint)
+ this.gui_objects.createfolderhint.innerHTML = this.env.folder ? this.get_label('addsubfolderhint') : '';
};
@@ -2541,13 +2582,13 @@ function rcube_webmail()
// tell server to create and subscribe a new mailbox
this.create_folder = function(name)
{
- if (this.edit_folder)
- this.reset_folder_rename();
+ if (this.edit_folder)
+ this.reset_folder_rename();
var form;
if ((form = this.gui_objects.editform) && form.elements['_folder_name'])
name = form.elements['_folder_name'].value;
- if (this.env.folder)
+ if (this.env.folder && name != '')
name = this.env.folder+this.env.delimiter+name;
if (name)
@@ -2562,7 +2603,6 @@ function rcube_webmail()
this.rename_folder = function(id)
{
var temp, row, form;
- var folder = this.env.subscriptionrows[id][0];
// reset current renaming
if (temp = this.edit_folder)
@@ -2572,14 +2612,15 @@ function rcube_webmail()
return;
}
- if (id && (row = document.getElementById(id)))
+ if (id && this.env.subscriptionrows[id] && (row = document.getElementById(id)))
{
var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']');
this.name_input = document.createElement('INPUT');
- this.name_input.value = folder.replace(reg, '');
+ this.name_input.value = this.env.subscriptionrows[id][1].replace(reg, '');
this.name_input.style.width = '100%';
+
reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$');
- this.name_input.setAttribute('parent', folder.replace(reg, ''));
+ this.name_input.__parent = this.env.subscriptionrows[id][0].replace(reg, '');
this.name_input.onkeypress = function(e){ rcmail.name_input_keypress(e); };
row.cells[0].replaceChild(this.name_input, row.cells[0].firstChild);
@@ -2617,9 +2658,9 @@ function rcube_webmail()
var newname = this.name_input ? this.name_input.value : null;
if (this.edit_folder && newname)
{
- if (this.name_input.getAttribute('parent') && this.name_input.getAttribute('parent')!='')
- newname = this.name_input.getAttribute('parent')+this.env.delimiter+newname;
- this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname));
+ if (this.name_input.__parent)
+ newname = this.name_input.__parent + this.env.delimiter + newname;
+ this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname));
}
}
// escape
@@ -2657,8 +2698,14 @@ function rcube_webmail()
var refrow, form;
var tbody = this.gui_objects.subscriptionlist.tBodies[0];
- var id = replace && replace.id ? replace.id : 'rcmrow'+(tbody.childNodes.length+1);
+ var id = 'rcmrow'+(tbody.childNodes.length+1);
var selection = this.subscription_list.get_single_selection();
+
+ if (replace && replace.id)
+ {
+ id = replace.id;
+ refid = replace.id;
+ }
if (!id || !(refrow = document.getElementById(refid)))
{
@@ -2675,18 +2722,23 @@ function rcube_webmail()
else
tbody.appendChild(row);
}
-
+
// add to folder/row-ID map
this.env.subscriptionrows[row.id] = [name, display_name];
// set folder name
row.cells[0].innerHTML = display_name;
- if (row.cells[1] && row.cells[1].firstChild.tagName=='INPUT')
+
+ // set messages count to zero
+ if (!replace)
+ row.cells[1].innerHTML = '*';
+
+ if (!replace && row.cells[2] && row.cells[2].firstChild.tagName=='INPUT')
{
- row.cells[1].firstChild.value = name;
- row.cells[1].firstChild.checked = true;
+ row.cells[2].firstChild.value = name;
+ row.cells[2].firstChild.checked = true;
}
-
+
// add new folder to rename-folder list and clear input field
if (!replace && (form = this.gui_objects.editform))
{
@@ -3148,8 +3200,10 @@ function rcube_webmail()
cell.id = 'rcmHead'+col;
}
+
+ if (col == 'subject' && this.message_list)
+ this.message_list.subject_col = n+1;
}
-
};
// create a table row in the message list
@@ -3229,11 +3283,8 @@ function rcube_webmail()
if (!this.gui_objects.mailboxlist)
return false;
- var reg, text_obj;
- var item = this.get_folder_li(mbox);
- mbox = String(mbox).toLowerCase().replace(this.identifier_expr, '');
-
- if (item && item.className && item.className.indexOf('mailbox '+mbox)>=0)
+ var reg, text_obj, item;
+ if (item = this.get_folder_li(mbox))
{
// set new text
text_obj = item.firstChild;
@@ -3477,13 +3528,10 @@ function rcube_webmail()
this.check_for_recent = function()
{
if (this.busy)
- {
- this.send_keep_alive();
return;
- }
this.set_busy(true, 'checkingmail');
- this.http_request('check-recent', '_t='+(new Date().getTime()), true);
+ this.http_request('check-recent', (this.env.search_request ? '_search='+this.env.search_request+'&' : '') + '_t='+(new Date().getTime()), true);
};
diff --git a/program/js/common.js b/program/js/common.js
index f6ddadb..0cb6614 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -3,14 +3,14 @@
| RoundCube common js library |
| |
| This file is part of the RoundCube web development suite |
- | Copyright (C) 2005-2006, RoundCube Dev, - Switzerland |
+ | Copyright (C) 2005-2007, RoundCube Dev, - Switzerland |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: common.js 811 2007-09-25 07:33:37Z robin $
+ $Id: common.js 1064 2008-02-13 05:33:41Z till $
*/
// Constants
@@ -52,16 +52,12 @@ function roundcube_browser()
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.agent.toLowerCase().indexOf('applewebkit')>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;
@@ -80,11 +76,7 @@ function roundcube_browser()
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));
@@ -103,14 +95,23 @@ function roundcube_browser()
// static functions for event handling
var rcube_event = {
- /**
- * returns the event key code
- */
- get_keycode: function(e)
- {
- e = e || window.event;
- return e && e.keyCode ? e.keyCode : (e && e.which ? e.which : 0);
- },
+/**
+ * returns the event target element
+ */
+get_target: function(e)
+{
+ e = e || window.event;
+ return e && e.target ? e.target : e.srcElement;
+},
+
+/**
+ * returns the event key code
+ */
+get_keycode: function(e)
+{
+ e = e || window.event;
+ return e && e.keyCode ? e.keyCode : (e && e.which ? e.which : 0);
+},
/**
* returns modifier key (constants defined at top of file)
@@ -170,7 +171,12 @@ add_listener: function(p)
if (p.element.addEventListener)
p.element.addEventListener(p.event, p.object._rc_events[key], false);
else if (p.element.attachEvent)
+ {
+ // IE allows multiple events with the same function to be applied to the same object
+ // forcibly detach the event, then attach
+ p.element.detachEvent('on'+p.event, p.object._rc_events[key]);
p.element.attachEvent('on'+p.event, p.object._rc_events[key]);
+ }
else
p.element['on'+p.event] = p.object._rc_events[key];
},
@@ -396,51 +402,19 @@ function rcube_check_email(input, inline)
{
if (input && window.RegExp)
{
- var no_ws_ctl = "[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]";
- var alpha = "[\\x41-\\x5a\\x61-\\x7a]";
- var digit = "[\\x30-\\x39]";
- var cr = "\\x0d";
- var lf = "\\x0a";
- var crlf = "(" + cr + lf + ")";
-
- var obs_char = "[\\x00-\\x09\\x0b\\x0c\\x0e-\\x7f]";
- var obs_text = "("+lf+"*"+cr+"*("+obs_char+lf+"*"+cr+"*)*)";
- var text = "([\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]|"+obs_text+")";
- var obs_qp = "(\\x5c[\\x00-\\x7f])";
- var quoted_pair = "(\\x5c"+text+"|"+obs_qp+")";
-
- var wsp = "[\\x20\\x09]";
- var obs_fws = "("+wsp+"+("+crlf+wsp+"+)*)";
- var fws = "((("+wsp+"*"+crlf+")?"+wsp+"+)|"+obs_fws+")";
- var ctext = "("+no_ws_ctl+"|[\\x21-\\x27\\x2A-\\x5b\\x5d-\\x7e])";
- var ccontent = "("+ctext+"|"+quoted_pair+")";
- var comment = "(\\x28("+fws+"?"+ccontent+")*"+fws+"?\\x29)";
- var cfws = "(("+fws+"?"+comment+")*("+fws+"?"+comment+"|"+fws+"))";
- var cfws = fws+"*";
-
- var atext = "("+alpha+"|"+digit+"|[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2e\\x3d\\x3f\\x5e\\x5f\\x60\\x7b-\\x7e])";
- var atom = "("+cfws+"?"+atext+"+"+cfws+"?)";
-
- var qtext = "("+no_ws_ctl+"|[\\x21\\x23-\\x5b\\x5d-\\x7e])";
- var qcontent = "("+qtext+"|"+quoted_pair+")";
- var quoted_string = "("+cfws+"?\\x22("+fws+"?"+qcontent+")*"+fws+"?\\x22"+cfws+"?)";
- var word = "("+atom+"|"+quoted_string+")";
-
- var obs_local_part = "("+word+"(\\x2e"+word+")*)";
- var obs_domain = "("+atom+"(\\x2e"+atom+")*)";
-
- var dot_atom_text = "("+atext+"+(\\x2e"+atext+"+)*)";
- var dot_atom = "("+cfws+"?"+dot_atom_text+cfws+"?)";
-
- var dtext = "("+no_ws_ctl+"|[\\x21-\\x5a\\x5e-\\x7e])";
- var dcontent = "("+dtext+"|"+quoted_pair+")";
- var domain_literal = "("+cfws+"?\\x5b("+fws+"?"+dcontent+")*"+fws+"?\\x5d"+cfws+"?)";
-
- var local_part = "("+dot_atom+"|"+quoted_string+"|"+obs_local_part+")";
- var domain = "("+dot_atom+"|"+domain_literal+"|"+obs_domain+")";
- var addr_spec = "("+local_part+"\\x40"+domain+")";
-
- var reg1 = inline ? new RegExp(addr_spec, 'i') : new RegExp('^'+addr_spec+'$', 'i');
+ var qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
+ var dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
+ var atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
+ var quoted_pair = '\\x5c[\\x00-\\x7f]';
+ var domain_literal = '\\x5b('+dtext+'|'+quoted_pair+')*\\x5d';
+ var quoted_string = '\\x22('+qtext+'|'+quoted_pair+')*\\x22';
+ var sub_domain = '('+atom+'|'+domain_literal+')';
+ var word = '('+atom+'|'+quoted_string+')';
+ var domain = sub_domain+'(\\x2e'+sub_domain+')*';
+ var local_part = word+'(\\x2e'+word+')*';
+ var addr_spec = local_part+'\\x40'+domain;
+ var delim = '[,;\s\n]';
+ var reg1 = inline ? new RegExp('(^|<|'+delim+')'+addr_spec+'($|>|'+delim+')', 'i') : new RegExp('^'+addr_spec+'$', 'i');
return reg1.test(input) ? true : false;
}
return false;
diff --git a/program/js/editor.js b/program/js/editor.js
index df68cdd..98dde2e 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -22,15 +22,15 @@ function rcmail_editor_init(skin_path)
apply_source_formatting : true,
theme : 'advanced',
plugins : 'emotions,media,nonbreaking,table,searchreplace,spellchecker,visualchars',
- theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,link,unlink,emotions,forecolor,backcolor,formatselect,fontselect,fontsizeselect',
- theme_advanced_buttons2 : 'undo,redo,image,media,hr,charmap,code,nonbreaking,visualchars,separator,search,replace,spellchecker,separator,tablecontrols',
+ theme_advanced_buttons1 : 'bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,emotions,charmap,code,forecolor,backcolor,fontselect,fontsizeselect, separator,undo,redo,image,media',
+ theme_advanced_buttons2 : '',
theme_advanced_buttons3 : '',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]',
content_css : skin_path + '/editor_content.css',
- popups_css : skin_path + '/editor_popup.css',
- editor_css : skin_path + '/editor_ui.css'
+ editor_css : skin_path + '/editor_ui.css',
+ external_image_list_url : 'program/js/editor_images.js'
});
}
@@ -63,9 +63,10 @@ function rcmail_toggle_editor(toggler)
// determine the currently displayed editor
var htmlFlag = document.getElementsByName('_is_html')[0];
- var currentEditor = htmlFlag.value;
+ var isHtml = htmlFlag.value;
- if (selectedEditor == currentEditor)
+ if (((selectedEditor == 'plain') && (isHtml == "0")) ||
+ ((selectedEditor == 'html') && (isHtml == "1")))
{
return;
}
diff --git a/program/js/editor_images.js b/program/js/editor_images.js
new file mode 100644
index 0000000..ddac044
--- /dev/null
+++ b/program/js/editor_images.js
@@ -0,0 +1,20 @@
+
+var rc_client = tinyMCEPopup.windowOpener.rcube_webmail_client;
+if (rc_client.gui_objects.attachmentlist)
+{
+ var tinyMCEImageList = new Array();
+ var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li");
+ for (i = 0; i < attachElems.length; i++)
+ {
+ var liElem = attachElems[i];
+ var fname = attachElems[i].id;
+ for (j = 0; j < liElem.childNodes.length; j++)
+ {
+ if (liElem.childNodes[j].nodeName == "#text")
+ {
+ fname = liElem.childNodes[j].nodeValue;
+ }
+ }
+ tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]);
+ }
+};
diff --git a/program/js/list.js b/program/js/list.js
index de4d7c8..e42d3f6 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -3,7 +3,7 @@
| RoundCube List Widget |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2006, RoundCube Dev, - Switzerland |
+ | Copyright (C) 2006-2008, RoundCube Dev, - Switzerland |
| Licensed under the GNU GPL |
| |
+-----------------------------------------------------------------------+
@@ -32,8 +32,8 @@ function rcube_list_widget(list, p)
this.rows = [];
this.selection = [];
+ this.subject_col = -1;
this.shiftkey = false;
-
this.multiselect = false;
this.draggable = false;
this.keyboard = false;
@@ -207,12 +207,13 @@ blur: function()
*/
drag_row: function(e, id)
{
- this.in_selection_before = this.in_selection(id) ? id : false;
-
// don't do anything (another action processed before)
- if (this.dont_select)
+ var evtarget = rcube_event.get_target(e);
+ if (this.dont_select || (evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG')))
return false;
+ this.in_selection_before = this.in_selection(id) ? id : false;
+
// selects currently unselected row
if (!this.in_selection_before)
{
@@ -239,7 +240,11 @@ click_row: function(e, id)
{
var now = new Date().getTime();
var mod_key = rcube_event.get_modifier(e);
-
+ var evtarget = rcube_event.get_target(e);
+
+ if ((evtarget && (evtarget.tagName == 'INPUT' || evtarget.tagName == 'IMG')))
+ return false;
+
// don't do anything (another action processed before)
if (this.dont_select)
{
@@ -503,9 +508,12 @@ highlight_row: function(id, multiple)
{
if (this.rows[id] && !multiple)
{
- this.clear_selection();
- this.selection[0] = id;
- this.set_classname(this.rows[id].obj, 'selected', true)
+ if (!this.in_selection(id))
+ {
+ this.clear_selection();
+ this.selection[0] = id;
+ this.set_classname(this.rows[id].obj, 'selected', true);
+ }
}
else if (this.rows[id])
{
@@ -535,8 +543,6 @@ key_press: function(e)
if (this.focused != true)
return true;
- this.shiftkey = e.shiftKey;
-
var keyCode = document.layers ? e.which : document.all ? event.keyCode : document.getElementById ? e.keyCode : 0;
var mod_key = rcube_event.get_modifier(e);
switch (keyCode)
@@ -547,6 +553,7 @@ key_press: function(e)
break;
default:
+ this.shiftkey = e.shiftKey;
this.key_pressed = keyCode;
this.trigger_event('keypress');
}
@@ -611,7 +618,7 @@ drag_mouse_move: function(e)
// get subjects of selectedd messages
var names = '';
- var c, node, subject, obj;
+ var c, i, node, subject, obj;
for(var n=0; n12) // only show 12 lines
@@ -625,13 +632,20 @@ drag_mouse_move: function(e)
obj = this.rows[this.selection[n]].obj;
subject = '';
- for(c=0; c 50 ? subject.substring(0, 50)+'...' : subject) + ' ';
- break;
+ if (((node = obj.childNodes[i].firstChild) && (node.nodeType==3 || node.nodeName=='A')) &&
+ (this.subject_col < 0 || (this.subject_col >= 0 && this.subject_col == c)))
+ {
+ subject = node.nodeType==3 ? node.data : node.innerHTML;
+ names += (subject.length > 50 ? subject.substring(0, 50)+'...' : subject) + ' ';
+ break;
+ }
+ c++;
}
+ }
}
}
diff --git a/program/js/tiny_mce/license.txt b/program/js/tiny_mce/license.txt
index 60d6d4c..1837b0a 100644
--- a/program/js/tiny_mce/license.txt
+++ b/program/js/tiny_mce/license.txt
@@ -1,504 +1,504 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- , 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/program/js/tiny_mce/plugins/media/css/content.css b/program/js/tiny_mce/plugins/media/css/content.css
index 1f667e6..7873235 100644
--- a/program/js/tiny_mce/plugins/media/css/content.css
+++ b/program/js/tiny_mce/plugins/media/css/content.css
@@ -1,26 +1,26 @@
-.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
- border: 1px dotted #cc0000;
- background-position: center;
- background-repeat: no-repeat;
- background-color: #ffffcc;
-}
-
-.mceItemShockWave {
- background-image: url('../images/shockwave.gif');
-}
-
-.mceItemFlash {
- background-image: url('../images/flash.gif');
-}
-
-.mceItemQuickTime {
- background-image: url('../images/quicktime.gif');
-}
-
-.mceItemWindowsMedia {
- background-image: url('../images/windowsmedia.gif');
-}
-
-.mceItemRealMedia {
- background-image: url('../images/realmedia.gif');
-}
+.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
+ border: 1px dotted #cc0000;
+ background-position: center;
+ background-repeat: no-repeat;
+ background-color: #ffffcc;
+}
+
+.mceItemShockWave {
+ background-image: url('../images/shockwave.gif');
+}
+
+.mceItemFlash {
+ background-image: url('../images/flash.gif');
+}
+
+.mceItemQuickTime {
+ background-image: url('../images/quicktime.gif');
+}
+
+.mceItemWindowsMedia {
+ background-image: url('../images/windowsmedia.gif');
+}
+
+.mceItemRealMedia {
+ background-image: url('../images/realmedia.gif');
+}
diff --git a/program/js/tiny_mce/plugins/media/css/media.css b/program/js/tiny_mce/plugins/media/css/media.css
index 89c6bd5..62d666a 100644
--- a/program/js/tiny_mce/plugins/media/css/media.css
+++ b/program/js/tiny_mce/plugins/media/css/media.css
@@ -1,68 +1,68 @@
-#id, #name, #hspace, #vspace, #class_name, #align {
- width: 100px;
-}
-
-#hspace, #vspace {
- width: 50px;
-}
-
-#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
- width: 100px;
-}
-
-#flash_base, #flash_flashvars {
- width: 240px;
-}
-
-#width, #height {
- width: 40px;
-}
-
-#src, #media_type {
- width: 250px;
-}
-
-#class {
- width: 120px;
-}
-
-#prev {
- margin: 0;
- border: 1px solid black;
- width: 99%;
- height: 230px;
- overflow: auto;
-}
-
-.panel_wrapper div.current {
- height: 390px;
- overflow: auto;
-}
-
-#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
- display: none;
-}
-
-.mceAddSelectValue {
- background-color: #DDDDDD;
-}
-
-#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
- width: 70px;
-}
-
-#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
- width: 70px;
-}
-
-#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
- width: 70px;
-}
-
-#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
- width: 90px;
-}
-
-#qt_qtsrc {
- width: 200px;
-}
+#id, #name, #hspace, #vspace, #class_name, #align {
+ width: 100px;
+}
+
+#hspace, #vspace {
+ width: 50px;
+}
+
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
+ width: 100px;
+}
+
+#flash_base, #flash_flashvars {
+ width: 240px;
+}
+
+#width, #height {
+ width: 40px;
+}
+
+#src, #media_type {
+ width: 250px;
+}
+
+#class {
+ width: 120px;
+}
+
+#prev {
+ margin: 0;
+ border: 1px solid black;
+ width: 99%;
+ height: 230px;
+ overflow: auto;
+}
+
+.panel_wrapper div.current {
+ height: 390px;
+ overflow: auto;
+}
+
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
+ display: none;
+}
+
+.mceAddSelectValue {
+ background-color: #DDDDDD;
+}
+
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
+ width: 70px;
+}
+
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
+ width: 70px;
+}
+
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
+ width: 70px;
+}
+
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
+ width: 90px;
+}
+
+#qt_qtsrc {
+ width: 200px;
+}
diff --git a/program/js/tiny_mce/plugins/media/editor_plugin.js b/program/js/tiny_mce/plugins/media/editor_plugin.js
index d431986..f0cbaee 100644
--- a/program/js/tiny_mce/plugins/media/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/media/editor_plugin.js
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('media');var TinyMCE_MediaPlugin={getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(inst.hasPlugin('flash')&&!tinyMCE.flashWarn){alert('Flash plugin is deprecated and should not be used together with the media plugin.');tinyMCE.flashWarn=true}if(!tinyMCE.settings['media_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/media/css/content.css")},getControlHTML:function(cn){switch(cn){case"media":return tinyMCE.getButtonHTML(cn,'lang_media_desc','{$pluginurl}/images/media.gif','mceMedia')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceMedia":tinyMCE.openWindow({file:'../../plugins/media/media.htm',width:430+tinyMCE.getLang('lang_media_delta_width',0),height:470+tinyMCE.getLang('lang_media_delta_height',0)},{editor_id:editor_id,inline:"yes"});return true}return false},cleanup:function(type,content,inst){var nl,img,i,ne,d,s,ci;switch(type){case"insert_to_editor":img=tinyMCE.getParam("theme_href")+'/images/spacer.gif';content=content.replace(/'}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='';for(n in p){if(typeof(p[n])!="undefined"&&typeof(p[n])!="function"){h+=' ';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+=' '}}h+=' ';return h},_parseAttributes:function(attribute_string){var attributeName="",endChr='"';var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,' ');content=content.replace(/]*)>/gi,'');content=content.replace(/
]*)>/gi,'');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'
');content=content.replace(/ ]*)>/gi,'
');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam"> ');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i',startPos);attribs=TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos+4,endPos));if(!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))continue;endPos+=2;at=attribs['title'];if(at){at=at.replace(/&(#39|apos);/g,"'");at=at.replace(/quot;/g,'"');try{pl=eval('x={'+at+'};')}catch(ex){pl={}}}if(!tinyMCE.getParam('media_use_script',false)){switch(attribs['class']){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166B1BCA-3F9C-11CF-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=tinyMCE.getParam('media_wmp6_compatible')?'05589FA1-C356-11CE-BF01-00AA0055595A':'6BF52A52-394A-11D3-B153-00C04F79FAA6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break}pl.src=tinyMCE.convertURL(pl.src,null,true);embedHTML=TinyMCE_MediaPlugin._getEmbed(ci,cb,mt,pl,attribs)}else{switch(attribs['class']){case'mceItemFlash':s='writeFlash';break;case'mceItemShockWave':s='writeShockWave';break;case'mceItemWindowsMedia':s='writeWindowsMedia';break;case'mceItemQuickTime':s='writeQuickTime';break;case'mceItemRealMedia':s='writeRealMedia';break}if(attribs.width)at=at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g,"width:'"+attribs.width+"'");if(attribs.height)at=at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g,"height:'"+attribs.height+"'");pl.src=tinyMCE.convertURL(pl.src,null,true);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'");embedHTML=''}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='';for(n in p){if(typeof(p[n])!="undefined"&&typeof(p[n])!="function"){h+=' ';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+=' '}}h+=' ';return h},_parseAttributes:function(attribute_string){var attributeName="",endChr='"';var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, ' ');
- content = content.replace(/]*)>/gi, '');
- content = content.replace(/
]*)>/gi, '');
- content = content.replace(/<\/(object|embed)([^>]*)>/gi, '
');
- content = content.replace(/ ]*)>/gi, '
');
- content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"> ');
- break;
-
- case "insert_to_editor_dom":
- d = inst.getDoc();
- nl = content.getElementsByTagName("img");
- for (i=0; i', startPos);
- attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
-
- // Is not flash, skip it
- if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
- continue;
-
- endPos += 2;
-
- // Parse attributes
- at = attribs['title'];
- if (at) {
- at = at.replace(/&(#39|apos);/g, "'");
- at = at.replace(/quot;/g, '"');
-
- try {
- pl = eval('x={' + at + '};');
- } catch (ex) {
- pl = {};
- }
- }
-
- // Use object/embed
- if (!tinyMCE.getParam('media_use_script', false)) {
- switch (attribs['class']) {
- case 'mceItemFlash':
- ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
- cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
- mt = 'application/x-shockwave-flash';
- break;
-
- case 'mceItemShockWave':
- ci = '166B1BCA-3F9C-11CF-8075-444553540000';
- cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
- mt = 'application/x-director';
- break;
-
- case 'mceItemWindowsMedia':
- ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
- cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
- mt = 'application/x-mplayer2';
- break;
-
- case 'mceItemQuickTime':
- ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
- cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
- mt = 'video/quicktime';
- break;
-
- case 'mceItemRealMedia':
- ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
- cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
- mt = 'audio/x-pn-realaudio-plugin';
- break;
- }
-
- // Force absolute URL
- if (!tinyMCE.getParam("relative_urls"))
- pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
-
- embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
- } else {
- // Use script version
- switch (attribs['class']) {
- case 'mceItemFlash':
- s = 'writeFlash';
- break;
-
- case 'mceItemShockWave':
- s = 'writeShockWave';
- break;
-
- case 'mceItemWindowsMedia':
- s = 'writeWindowsMedia';
- break;
-
- case 'mceItemQuickTime':
- s = 'writeQuickTime';
- break;
-
- case 'mceItemRealMedia':
- s = 'writeRealMedia';
- break;
- }
-
- if (attribs.width)
- at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
-
- if (attribs.height)
- at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
-
- // Force absolute URL
- if (!tinyMCE.getParam("relative_urls")) {
- pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
- at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
- }
-
- embedHTML = '';
- }
-
- // Insert embed/object chunk
- chunkBefore = content.substring(0, startPos);
- chunkAfter = content.substring(endPos);
- content = chunkBefore + embedHTML + chunkAfter;
- }
- break;
- }
-
- return content;
- },
-
- handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
- if (node == null)
- return;
-
- do {
- if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
- tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
- return true;
- }
- } while ((node = node.parentNode));
-
- tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
-
- return true;
- },
-
- _createImgFromEmbed : function(n, d, cl) {
- var ne, at, i, ti = '', an;
-
- ne = d.createElement('img');
- ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
- ne.width = tinyMCE.getAttrib(n, 'width');
- ne.height = tinyMCE.getAttrib(n, 'height');
- ne.className = cl;
-
- at = n.attributes;
- for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
- ne.title = ti;
-
- n.parentNode.replaceChild(ne, n);
- },
-
- _createImg : function(cl, d, n) {
- var i, nl, ti = "", an, av, al = new Array();
-
- ne = d.createElement('img');
- ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
- ne.width = tinyMCE.getAttrib(n, 'width');
- ne.height = tinyMCE.getAttrib(n, 'height');
- ne.className = cl;
-
- al.id = tinyMCE.getAttrib(n, 'id');
- al.name = tinyMCE.getAttrib(n, 'name');
- al.width = tinyMCE.getAttrib(n, 'width');
- al.height = tinyMCE.getAttrib(n, 'height');
- al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
- al.align = tinyMCE.getAttrib(n, 'align');
- al.class_name = tinyMCE.getAttrib(n, 'mce_class');
-
- nl = n.getElementsByTagName('div');
- for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
- ne.title = ti;
-
- return ne;
- },
-
- _getEmbed : function(cls, cb, mt, p, at) {
- var h = '', n;
-
- p.width = at.width ? at.width : p.width;
- p.height = at.height ? at.height : p.height;
-
- h += '';
-
- for (n in p) {
- if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
- h += ' ';
-
- // Add extra url parameter if it's an absolute URL on WMP
- if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
- h += ' ';
- }
- }
-
- h += ' ';
-
- return h;
- },
-
- _parseAttributes : function(attribute_string) {
- var attributeName = "", endChr = '"';
- var attributeValue = "";
- var withInName;
- var withInValue;
- var attributes = new Array();
- var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
-
- if (attribute_string == null || attribute_string.length < 2)
- return null;
-
- withInName = withInValue = false;
-
- for (var i=0; i]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, ' ');
+ content = content.replace(/]*)>/gi, '');
+ content = content.replace(/
]*)>/gi, '');
+ content = content.replace(/<\/(object|embed)([^>]*)>/gi, '
');
+ content = content.replace(/ ]*)>/gi, '
');
+ content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"> ');
+ break;
+
+ case "insert_to_editor_dom":
+ d = inst.getDoc();
+ nl = content.getElementsByTagName("img");
+ for (i=0; i', startPos);
+ attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
+
+ // Is not flash, skip it
+ if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
+ continue;
+
+ endPos += 2;
+
+ // Parse attributes
+ at = attribs['title'];
+ if (at) {
+ at = at.replace(/&(#39|apos);/g, "'");
+ at = at.replace(/quot;/g, '"');
+
+ try {
+ pl = eval('x={' + at + '};');
+ } catch (ex) {
+ pl = {};
+ }
+ }
+
+ // Use object/embed
+ if (!tinyMCE.getParam('media_use_script', false)) {
+ switch (attribs['class']) {
+ case 'mceItemFlash':
+ ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
+ cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+ mt = 'application/x-shockwave-flash';
+ break;
+
+ case 'mceItemShockWave':
+ ci = '166B1BCA-3F9C-11CF-8075-444553540000';
+ cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+ mt = 'application/x-director';
+ break;
+
+ case 'mceItemWindowsMedia':
+ ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
+ cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+ mt = 'application/x-mplayer2';
+ break;
+
+ case 'mceItemQuickTime':
+ ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+ cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+ mt = 'video/quicktime';
+ break;
+
+ case 'mceItemRealMedia':
+ ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+ cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+ mt = 'audio/x-pn-realaudio-plugin';
+ break;
+ }
+
+ // Convert the URL
+ pl.src = tinyMCE.convertURL(pl.src, null, true);
+
+ embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
+ } else {
+ // Use script version
+ switch (attribs['class']) {
+ case 'mceItemFlash':
+ s = 'writeFlash';
+ break;
+
+ case 'mceItemShockWave':
+ s = 'writeShockWave';
+ break;
+
+ case 'mceItemWindowsMedia':
+ s = 'writeWindowsMedia';
+ break;
+
+ case 'mceItemQuickTime':
+ s = 'writeQuickTime';
+ break;
+
+ case 'mceItemRealMedia':
+ s = 'writeRealMedia';
+ break;
+ }
+
+ if (attribs.width)
+ at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
+
+ if (attribs.height)
+ at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
+
+ // Force absolute URL
+ pl.src = tinyMCE.convertURL(pl.src, null, true);
+ at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
+
+ embedHTML = '';
+ }
+
+ // Insert embed/object chunk
+ chunkBefore = content.substring(0, startPos);
+ chunkAfter = content.substring(endPos);
+ content = chunkBefore + embedHTML + chunkAfter;
+ }
+ break;
+ }
+
+ return content;
+ },
+
+ handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+ if (node == null)
+ return;
+
+ do {
+ if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
+ tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
+ return true;
+ }
+ } while ((node = node.parentNode));
+
+ tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
+
+ return true;
+ },
+
+ _createImgFromEmbed : function(n, d, cl) {
+ var ne, at, i, ti = '', an;
+
+ ne = d.createElement('img');
+ ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
+ ne.width = tinyMCE.getAttrib(n, 'width');
+ ne.height = tinyMCE.getAttrib(n, 'height');
+ ne.className = cl;
+
+ at = n.attributes;
+ for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
+ ne.title = ti;
+
+ n.parentNode.replaceChild(ne, n);
+ },
+
+ _createImg : function(cl, d, n) {
+ var i, nl, ti = "", an, av, al = new Array();
+
+ ne = d.createElement('img');
+ ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
+ ne.width = tinyMCE.getAttrib(n, 'width');
+ ne.height = tinyMCE.getAttrib(n, 'height');
+ ne.className = cl;
+
+ al.id = tinyMCE.getAttrib(n, 'id');
+ al.name = tinyMCE.getAttrib(n, 'name');
+ al.width = tinyMCE.getAttrib(n, 'width');
+ al.height = tinyMCE.getAttrib(n, 'height');
+ al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
+ al.align = tinyMCE.getAttrib(n, 'align');
+ al.class_name = tinyMCE.getAttrib(n, 'mce_class');
+
+ nl = n.getElementsByTagName('div');
+ for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
+ ne.title = ti;
+
+ return ne;
+ },
+
+ _getEmbed : function(cls, cb, mt, p, at) {
+ var h = '', n;
+
+ p.width = at.width ? at.width : p.width;
+ p.height = at.height ? at.height : p.height;
+
+ h += '';
+
+ for (n in p) {
+ if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
+ h += ' ';
+
+ // Add extra url parameter if it's an absolute URL on WMP
+ if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
+ h += ' ';
+ }
+ }
+
+ h += ' ';
+
+ return h;
+ },
+
+ _parseAttributes : function(attribute_string) {
+ var attributeName = "", endChr = '"';
+ var attributeValue = "";
+ var withInName;
+ var withInValue;
+ var attributes = new Array();
+ var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
+
+ if (attribute_string == null || attribute_string.length < 2)
+ return null;
+
+ withInName = withInValue = false;
+
+ for (var i=0; i';
-
- for (n in p)
- h += ' ';
-
- h += ' ';
-
- document.write(h);
-}
+/**
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
+ */
+
+function writeFlash(p) {
+ writeEmbed(
+ 'D27CDB6E-AE6D-11cf-96B8-444553540000',
+ 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+ 'application/x-shockwave-flash',
+ p
+ );
+}
+
+function writeShockWave(p) {
+ writeEmbed(
+ '166B1BCA-3F9C-11CF-8075-444553540000',
+ 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
+ 'application/x-director',
+ p
+ );
+}
+
+function writeQuickTime(p) {
+ writeEmbed(
+ '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
+ 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
+ 'video/quicktime',
+ p
+ );
+}
+
+function writeRealMedia(p) {
+ writeEmbed(
+ 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
+ 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+ 'audio/x-pn-realaudio-plugin',
+ p
+ );
+}
+
+function writeWindowsMedia(p) {
+ p.url = p.src;
+ writeEmbed(
+ '6BF52A52-394A-11D3-B153-00C04F79FAA6',
+ 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
+ 'application/x-mplayer2',
+ p
+ );
+}
+
+function writeEmbed(cls, cb, mt, p) {
+ var h = '', n;
+
+ h += '';
+
+ for (n in p)
+ h += ' ';
+
+ h += ' ';
+
+ document.write(h);
+}
diff --git a/program/js/tiny_mce/plugins/media/jscripts/media.js b/program/js/tiny_mce/plugins/media/jscripts/media.js
index 691a8bd..2b9a4f0 100644
--- a/program/js/tiny_mce/plugins/media/jscripts/media.js
+++ b/program/js/tiny_mce/plugins/media/jscripts/media.js
@@ -1,590 +1,594 @@
-var oldWidth, oldHeight;
-var url = tinyMCE.getParam("media_external_list_url");
-if (url != null) {
- // Fix relative
- if (url.charAt(0) != '/' && url.indexOf('://') == -1)
- url = tinyMCE.documentBasePath + "/" + url;
-
- document.write(' ');
-}
-
-function init() {
- var pl = "", f, val;
- var type = "flash", fe, i;
-
- tinyMCEPopup.resizeToInnerSize();
- f = document.forms[0]
-
- fe = tinyMCE.selectedInstance.getFocusElement();
- if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
- pl = "x={" + fe.title + "};";
-
- switch (tinyMCE.getAttrib(fe, 'class')) {
- case 'mceItemFlash':
- type = 'flash';
- break;
-
- case 'mceItemShockWave':
- type = 'shockwave';
- break;
-
- case 'mceItemWindowsMedia':
- type = 'wmp';
- break;
-
- case 'mceItemQuickTime':
- type = 'qt';
- break;
-
- case 'mceItemRealMedia':
- type = 'rmp';
- break;
- }
-
- document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true);
- }
-
- document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
- document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
- document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
-
- var html = getMediaListHTML('filebrowser','src','media','media');
- if (html == "")
- document.getElementById("linklistrow").style.display = 'none';
- else
- document.getElementById("linklistcontainer").innerHTML = html;
-
- // Resize some elements
- if (isVisible('filebrowsercontainer'))
- document.getElementById('src').style.width = '230px';
-
- // Setup form
- if (pl != "") {
- pl = eval(pl);
-
- switch (type) {
- case "flash":
- setBool(pl, 'flash', 'play');
- setBool(pl, 'flash', 'loop');
- setBool(pl, 'flash', 'menu');
- setBool(pl, 'flash', 'swliveconnect');
- setStr(pl, 'flash', 'quality');
- setStr(pl, 'flash', 'scale');
- setStr(pl, 'flash', 'salign');
- setStr(pl, 'flash', 'wmode');
- setStr(pl, 'flash', 'base');
- setStr(pl, 'flash', 'flashvars');
- break;
-
- case "qt":
- setBool(pl, 'qt', 'loop');
- setBool(pl, 'qt', 'autoplay');
- setBool(pl, 'qt', 'cache');
- setBool(pl, 'qt', 'controller');
- setBool(pl, 'qt', 'correction');
- setBool(pl, 'qt', 'enablejavascript');
- setBool(pl, 'qt', 'kioskmode');
- setBool(pl, 'qt', 'autohref');
- setBool(pl, 'qt', 'playeveryframe');
- setBool(pl, 'qt', 'tarsetcache');
- setStr(pl, 'qt', 'scale');
- setStr(pl, 'qt', 'starttime');
- setStr(pl, 'qt', 'endtime');
- setStr(pl, 'qt', 'tarset');
- setStr(pl, 'qt', 'qtsrcchokespeed');
- setStr(pl, 'qt', 'volume');
- setStr(pl, 'qt', 'qtsrc');
- break;
-
- case "shockwave":
- setBool(pl, 'shockwave', 'sound');
- setBool(pl, 'shockwave', 'progress');
- setBool(pl, 'shockwave', 'autostart');
- setBool(pl, 'shockwave', 'swliveconnect');
- setStr(pl, 'shockwave', 'swvolume');
- setStr(pl, 'shockwave', 'swstretchstyle');
- setStr(pl, 'shockwave', 'swstretchhalign');
- setStr(pl, 'shockwave', 'swstretchvalign');
- break;
-
- case "wmp":
- setBool(pl, 'wmp', 'autostart');
- setBool(pl, 'wmp', 'enabled');
- setBool(pl, 'wmp', 'enablecontextmenu');
- setBool(pl, 'wmp', 'fullscreen');
- setBool(pl, 'wmp', 'invokeurls');
- setBool(pl, 'wmp', 'mute');
- setBool(pl, 'wmp', 'stretchtofit');
- setBool(pl, 'wmp', 'windowlessvideo');
- setStr(pl, 'wmp', 'balance');
- setStr(pl, 'wmp', 'baseurl');
- setStr(pl, 'wmp', 'captioningid');
- setStr(pl, 'wmp', 'currentmarker');
- setStr(pl, 'wmp', 'currentposition');
- setStr(pl, 'wmp', 'defaultframe');
- setStr(pl, 'wmp', 'playcount');
- setStr(pl, 'wmp', 'rate');
- setStr(pl, 'wmp', 'uimode');
- setStr(pl, 'wmp', 'volume');
- break;
-
- case "rmp":
- setBool(pl, 'rmp', 'autostart');
- setBool(pl, 'rmp', 'loop');
- setBool(pl, 'rmp', 'autogotourl');
- setBool(pl, 'rmp', 'center');
- setBool(pl, 'rmp', 'imagestatus');
- setBool(pl, 'rmp', 'maintainaspect');
- setBool(pl, 'rmp', 'nojava');
- setBool(pl, 'rmp', 'prefetch');
- setBool(pl, 'rmp', 'shuffle');
- setStr(pl, 'rmp', 'console');
- setStr(pl, 'rmp', 'controls');
- setStr(pl, 'rmp', 'numloop');
- setStr(pl, 'rmp', 'scriptcallbacks');
- break;
- }
-
- setStr(pl, null, 'src');
- setStr(pl, null, 'id');
- setStr(pl, null, 'name');
- setStr(pl, null, 'vspace');
- setStr(pl, null, 'hspace');
- setStr(pl, null, 'bgcolor');
- setStr(pl, null, 'align');
- setStr(pl, null, 'width');
- setStr(pl, null, 'height');
-
- if ((val = tinyMCE.getAttrib(fe, "width")) != "")
- pl.width = f.width.value = val;
-
- if ((val = tinyMCE.getAttrib(fe, "height")) != "")
- pl.height = f.height.value = val;
-
- oldWidth = pl.width ? parseInt(pl.width) : 0;
- oldHeight = pl.height ? parseInt(pl.height) : 0;
- } else
- oldWidth = oldHeight = 0;
-
- selectByValue(f, 'media_type', type);
- changedType(type);
- updateColor('bgcolor_pick', 'bgcolor');
-
- TinyMCE_EditableSelects.init();
- generatePreview();
-}
-
-function insertMedia() {
- var fe, f = document.forms[0], h;
-
- if (!AutoValidator.validate(f)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
- return false;
- }
-
- f.width.value = f.width.value == "" ? 100 : f.width.value;
- f.height.value = f.height.value == "" ? 100 : f.height.value;
-
- fe = tinyMCE.selectedInstance.getFocusElement();
- if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
- switch (f.media_type.options[f.media_type.selectedIndex].value) {
- case "flash":
- fe.className = "mceItemFlash";
- break;
-
- case "shockwave":
- fe.className = "mceItemShockWave";
- break;
-
- case "qt":
- fe.className = "mceItemQuickTime";
- break;
-
- case "wmp":
- fe.className = "mceItemWindowsMedia";
- break;
-
- case "rmp":
- fe.className = "mceItemRealMedia";
- break;
- }
-
- if (fe.width != f.width.value || fe.height != f.height.height)
- tinyMCE.selectedInstance.repaint();
-
- fe.title = serializeParameters();
- fe.width = f.width.value;
- fe.height = f.height.value;
- fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
- fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
- fe.align = f.align.options[f.align.selectedIndex].value;
- } else {
- h = ' ';
-
- tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h);
- }
-
- tinyMCEPopup.close();
-}
-
-function getMediaListHTML() {
- if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
- var html = "";
-
- html += '';
- html += '--- ';
-
- for (var i=0; i' + tinyMCEMediaList[i][0] + '';
-
- html += ' ';
-
- return html;
- }
-
- return "";
-}
-
-function getType(v) {
- var fo, i, c, el, x, f = document.forms[0];
-
- fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
-
- // YouTube
- if (v.indexOf('http://www.youtube.com/watch?v=') == 0) {
- f.width.value = '425';
- f.height.value = '350';
- f.src.value = 'http://www.youtube.com/v/' + v.substring('http://www.youtube.com/watch?v='.length);
- return 'flash';
- }
-
- // Google video
- if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
- f.width.value = '425';
- f.height.value = '326';
- f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
- return 'flash';
- }
-
- for (i=0; i 0 ? s.substring(0, s.length - 1) : s;
-
- return s;
-}
-
-function setBool(pl, p, n) {
- if (typeof(pl[n]) == "undefined")
- return;
-
- document.forms[0].elements[p + "_" + n].checked = pl[n];
-}
-
-function setStr(pl, p, n) {
- var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
-
- if (typeof(pl[n]) == "undefined")
- return;
-
- if (e.type == "text")
- e.value = pl[n];
- else
- selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
-}
-
-function getBool(p, n, d, tv, fv) {
- var v = document.forms[0].elements[p + "_" + n].checked;
-
- tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
- fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
-
- return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
-}
-
-function getStr(p, n, d) {
- var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
- var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
-
- return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
-}
-
-function getInt(p, n, d) {
- var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
- var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
-
- return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
-}
-
-function jsEncode(s) {
- s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
- s = s.replace(new RegExp('"', 'g'), '\\"');
- s = s.replace(new RegExp("'", 'g'), "\\'");
-
- return s;
-}
-
-function generatePreview(c) {
- var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
-
- p.innerHTML = '';
-
- nw = parseInt(f.width.value);
- nh = parseInt(f.height.value);
-
- if (f.width.value != "" && f.height.value != "") {
- if (f.constrain.checked) {
- if (c == 'width' && oldWidth != 0) {
- wp = nw / oldWidth;
- nh = Math.round(wp * nh);
- f.height.value = nh;
- } else if (c == 'height' && oldHeight != 0) {
- hp = nh / oldHeight;
- nw = Math.round(hp * nw);
- f.width.value = nw;
- }
- }
- }
-
- if (f.width.value != "")
- oldWidth = nw;
-
- if (f.height.value != "")
- oldHeight = nh;
-
- // After constrain
- pl = serializeParameters();
-
- switch (f.media_type.options[f.media_type.selectedIndex].value) {
- case "flash":
- cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
- codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
- type = 'application/x-shockwave-flash';
- break;
-
- case "shockwave":
- cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
- codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
- type = 'application/x-director';
- break;
-
- case "qt":
- cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
- codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
- type = 'video/quicktime';
- break;
-
- case "wmp":
- cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
- codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
- type = 'application/x-mplayer2';
- break;
-
- case "rmp":
- cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
- codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
- type = 'audio/x-pn-realaudio-plugin';
- break;
- }
-
- if (pl == '') {
- p.innerHTML = '';
- return;
- }
-
- pl = eval('x={' + pl + '};');
-
- if (!pl.src) {
- p.innerHTML = '';
- return;
- }
-
- pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
- pl.width = !pl.width ? 100 : pl.width;
- pl.height = !pl.height ? 100 : pl.height;
- pl.id = !pl.id ? 'obj' : pl.id;
- pl.name = !pl.name ? 'eobj' : pl.name;
- pl.align = !pl.align ? '' : pl.align;
-
- h += '';
-
- for (n in pl) {
- h += ' ';
-
- // Add extra url parameter if it's an absolute URL
- if (n == 'src' && pl[n].indexOf('://') != -1)
- h += ' ';
- }
-
- h += ' ';
-
- p.innerHTML = "" + h;
-}
+var oldWidth, oldHeight;
+var url = tinyMCE.getParam("media_external_list_url");
+if (url != null) {
+ // Fix relative
+ if (url.charAt(0) != '/' && url.indexOf('://') == -1)
+ url = tinyMCE.documentBasePath + "/" + url;
+
+ document.write(' ');
+}
+
+function init() {
+ var pl = "", f, val;
+ var type = "flash", fe, i;
+
+ tinyMCEPopup.resizeToInnerSize();
+ f = document.forms[0]
+
+ fe = tinyMCE.selectedInstance.getFocusElement();
+ if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
+ pl = "x={" + fe.title + "};";
+
+ switch (tinyMCE.getAttrib(fe, 'class')) {
+ case 'mceItemFlash':
+ type = 'flash';
+ break;
+
+ case 'mceItemShockWave':
+ type = 'shockwave';
+ break;
+
+ case 'mceItemWindowsMedia':
+ type = 'wmp';
+ break;
+
+ case 'mceItemQuickTime':
+ type = 'qt';
+ break;
+
+ case 'mceItemRealMedia':
+ type = 'rmp';
+ break;
+ }
+
+ document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true);
+ }
+
+ document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+ document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+ var html = getMediaListHTML('filebrowser','src','media','media');
+ if (html == "")
+ document.getElementById("linklistrow").style.display = 'none';
+ else
+ document.getElementById("linklistcontainer").innerHTML = html;
+
+ // Resize some elements
+ if (isVisible('filebrowsercontainer'))
+ document.getElementById('src').style.width = '230px';
+
+ // Setup form
+ if (pl != "") {
+ pl = eval(pl);
+
+ switch (type) {
+ case "flash":
+ setBool(pl, 'flash', 'play');
+ setBool(pl, 'flash', 'loop');
+ setBool(pl, 'flash', 'menu');
+ setBool(pl, 'flash', 'swliveconnect');
+ setStr(pl, 'flash', 'quality');
+ setStr(pl, 'flash', 'scale');
+ setStr(pl, 'flash', 'salign');
+ setStr(pl, 'flash', 'wmode');
+ setStr(pl, 'flash', 'base');
+ setStr(pl, 'flash', 'flashvars');
+ break;
+
+ case "qt":
+ setBool(pl, 'qt', 'loop');
+ setBool(pl, 'qt', 'autoplay');
+ setBool(pl, 'qt', 'cache');
+ setBool(pl, 'qt', 'controller');
+ setBool(pl, 'qt', 'correction');
+ setBool(pl, 'qt', 'enablejavascript');
+ setBool(pl, 'qt', 'kioskmode');
+ setBool(pl, 'qt', 'autohref');
+ setBool(pl, 'qt', 'playeveryframe');
+ setBool(pl, 'qt', 'tarsetcache');
+ setStr(pl, 'qt', 'scale');
+ setStr(pl, 'qt', 'starttime');
+ setStr(pl, 'qt', 'endtime');
+ setStr(pl, 'qt', 'tarset');
+ setStr(pl, 'qt', 'qtsrcchokespeed');
+ setStr(pl, 'qt', 'volume');
+ setStr(pl, 'qt', 'qtsrc');
+ break;
+
+ case "shockwave":
+ setBool(pl, 'shockwave', 'sound');
+ setBool(pl, 'shockwave', 'progress');
+ setBool(pl, 'shockwave', 'autostart');
+ setBool(pl, 'shockwave', 'swliveconnect');
+ setStr(pl, 'shockwave', 'swvolume');
+ setStr(pl, 'shockwave', 'swstretchstyle');
+ setStr(pl, 'shockwave', 'swstretchhalign');
+ setStr(pl, 'shockwave', 'swstretchvalign');
+ break;
+
+ case "wmp":
+ setBool(pl, 'wmp', 'autostart');
+ setBool(pl, 'wmp', 'enabled');
+ setBool(pl, 'wmp', 'enablecontextmenu');
+ setBool(pl, 'wmp', 'fullscreen');
+ setBool(pl, 'wmp', 'invokeurls');
+ setBool(pl, 'wmp', 'mute');
+ setBool(pl, 'wmp', 'stretchtofit');
+ setBool(pl, 'wmp', 'windowlessvideo');
+ setStr(pl, 'wmp', 'balance');
+ setStr(pl, 'wmp', 'baseurl');
+ setStr(pl, 'wmp', 'captioningid');
+ setStr(pl, 'wmp', 'currentmarker');
+ setStr(pl, 'wmp', 'currentposition');
+ setStr(pl, 'wmp', 'defaultframe');
+ setStr(pl, 'wmp', 'playcount');
+ setStr(pl, 'wmp', 'rate');
+ setStr(pl, 'wmp', 'uimode');
+ setStr(pl, 'wmp', 'volume');
+ break;
+
+ case "rmp":
+ setBool(pl, 'rmp', 'autostart');
+ setBool(pl, 'rmp', 'loop');
+ setBool(pl, 'rmp', 'autogotourl');
+ setBool(pl, 'rmp', 'center');
+ setBool(pl, 'rmp', 'imagestatus');
+ setBool(pl, 'rmp', 'maintainaspect');
+ setBool(pl, 'rmp', 'nojava');
+ setBool(pl, 'rmp', 'prefetch');
+ setBool(pl, 'rmp', 'shuffle');
+ setStr(pl, 'rmp', 'console');
+ setStr(pl, 'rmp', 'controls');
+ setStr(pl, 'rmp', 'numloop');
+ setStr(pl, 'rmp', 'scriptcallbacks');
+ break;
+ }
+
+ setStr(pl, null, 'src');
+ setStr(pl, null, 'id');
+ setStr(pl, null, 'name');
+ setStr(pl, null, 'vspace');
+ setStr(pl, null, 'hspace');
+ setStr(pl, null, 'bgcolor');
+ setStr(pl, null, 'align');
+ setStr(pl, null, 'width');
+ setStr(pl, null, 'height');
+
+ if ((val = tinyMCE.getAttrib(fe, "width")) != "")
+ pl.width = f.width.value = val;
+
+ if ((val = tinyMCE.getAttrib(fe, "height")) != "")
+ pl.height = f.height.value = val;
+
+ oldWidth = pl.width ? parseInt(pl.width) : 0;
+ oldHeight = pl.height ? parseInt(pl.height) : 0;
+ } else
+ oldWidth = oldHeight = 0;
+
+ selectByValue(f, 'media_type', type);
+ changedType(type);
+ updateColor('bgcolor_pick', 'bgcolor');
+
+ TinyMCE_EditableSelects.init();
+ generatePreview();
+}
+
+function insertMedia() {
+ var fe, f = document.forms[0], h;
+
+ if (!AutoValidator.validate(f)) {
+ alert(tinyMCE.getLang('lang_invalid_data'));
+ return false;
+ }
+
+ f.width.value = f.width.value == "" ? 100 : f.width.value;
+ f.height.value = f.height.value == "" ? 100 : f.height.value;
+
+ fe = tinyMCE.selectedInstance.getFocusElement();
+ if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ fe.className = "mceItemFlash";
+ break;
+
+ case "shockwave":
+ fe.className = "mceItemShockWave";
+ break;
+
+ case "qt":
+ fe.className = "mceItemQuickTime";
+ break;
+
+ case "wmp":
+ fe.className = "mceItemWindowsMedia";
+ break;
+
+ case "rmp":
+ fe.className = "mceItemRealMedia";
+ break;
+ }
+
+ if (fe.width != f.width.value || fe.height != f.height.height)
+ tinyMCE.selectedInstance.repaint();
+
+ fe.title = serializeParameters();
+ fe.width = f.width.value;
+ fe.height = f.height.value;
+ fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
+ fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
+ fe.align = f.align.options[f.align.selectedIndex].value;
+ } else {
+ h = ' ';
+
+ tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h);
+ }
+
+ tinyMCEPopup.close();
+}
+
+function getMediaListHTML() {
+ if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
+ var html = "";
+
+ html += '';
+ html += '--- ';
+
+ for (var i=0; i' + tinyMCEMediaList[i][0] + '';
+
+ html += ' ';
+
+ return html;
+ }
+
+ return "";
+}
+
+function getType(v) {
+ var fo, i, c, el, x, f = document.forms[0];
+
+ fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
+
+ // YouTube
+ if (v.indexOf('http://www.youtube.com/watch?v=') == 0 || v.indexOf('http://youtube.com/watch?v=') == 0) {
+ f.width.value = '425';
+ f.height.value = '350';
+
+ v = v.replace('http://youtube.com/watch?v=', '');
+ v = v.replace('http://www.youtube.com/watch?v=', '');
+
+ f.src.value = 'http://www.youtube.com/v/' + v;
+ return 'flash';
+ }
+
+ // Google video
+ if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
+ f.width.value = '425';
+ f.height.value = '326';
+ f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
+ return 'flash';
+ }
+
+ for (i=0; i 0 ? s.substring(0, s.length - 1) : s;
+
+ return s;
+}
+
+function setBool(pl, p, n) {
+ if (typeof(pl[n]) == "undefined")
+ return;
+
+ document.forms[0].elements[p + "_" + n].checked = pl[n];
+}
+
+function setStr(pl, p, n) {
+ var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
+
+ if (typeof(pl[n]) == "undefined")
+ return;
+
+ if (e.type == "text")
+ e.value = pl[n];
+ else
+ selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
+}
+
+function getBool(p, n, d, tv, fv) {
+ var v = document.forms[0].elements[p + "_" + n].checked;
+
+ tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
+ fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
+
+ return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
+}
+
+function getStr(p, n, d) {
+ var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+ var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+ return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
+}
+
+function getInt(p, n, d) {
+ var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+ var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+ return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
+}
+
+function jsEncode(s) {
+ s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
+ s = s.replace(new RegExp('"', 'g'), '\\"');
+ s = s.replace(new RegExp("'", 'g'), "\\'");
+
+ return s;
+}
+
+function generatePreview(c) {
+ var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
+
+ p.innerHTML = '';
+
+ nw = parseInt(f.width.value);
+ nh = parseInt(f.height.value);
+
+ if (f.width.value != "" && f.height.value != "") {
+ if (f.constrain.checked) {
+ if (c == 'width' && oldWidth != 0) {
+ wp = nw / oldWidth;
+ nh = Math.round(wp * nh);
+ f.height.value = nh;
+ } else if (c == 'height' && oldHeight != 0) {
+ hp = nh / oldHeight;
+ nw = Math.round(hp * nw);
+ f.width.value = nw;
+ }
+ }
+ }
+
+ if (f.width.value != "")
+ oldWidth = nw;
+
+ if (f.height.value != "")
+ oldHeight = nh;
+
+ // After constrain
+ pl = serializeParameters();
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
+ codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+ type = 'application/x-shockwave-flash';
+ break;
+
+ case "shockwave":
+ cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
+ codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+ type = 'application/x-director';
+ break;
+
+ case "qt":
+ cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+ codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+ type = 'video/quicktime';
+ break;
+
+ case "wmp":
+ cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
+ codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+ type = 'application/x-mplayer2';
+ break;
+
+ case "rmp":
+ cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+ codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+ type = 'audio/x-pn-realaudio-plugin';
+ break;
+ }
+
+ if (pl == '') {
+ p.innerHTML = '';
+ return;
+ }
+
+ pl = eval('x={' + pl + '};');
+
+ if (!pl.src) {
+ p.innerHTML = '';
+ return;
+ }
+
+ pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
+ pl.width = !pl.width ? 100 : pl.width;
+ pl.height = !pl.height ? 100 : pl.height;
+ pl.id = !pl.id ? 'obj' : pl.id;
+ pl.name = !pl.name ? 'eobj' : pl.name;
+ pl.align = !pl.align ? '' : pl.align;
+
+ h += '';
+
+ for (n in pl) {
+ h += ' ';
+
+ // Add extra url parameter if it's an absolute URL
+ if (n == 'src' && pl[n].indexOf('://') != -1)
+ h += ' ';
+ }
+
+ h += ' ';
+
+ p.innerHTML = "" + h;
+}
diff --git a/program/js/tiny_mce/plugins/media/langs/en.js b/program/js/tiny_mce/plugins/media/langs/en.js
index ced1967..177438d 100644
--- a/program/js/tiny_mce/plugins/media/langs/en.js
+++ b/program/js/tiny_mce/plugins/media/langs/en.js
@@ -1,94 +1,94 @@
-// UK lang variables
-
-tinyMCE.addToLang('media',{
-title : 'Insert / edit embedded media',
-desc : 'Insert / edit embedded media',
-general : 'General',
-advanced : 'Advanced',
-file : 'File/URL',
-list : 'List',
-size : 'Dimensions',
-preview : 'Preview',
-constrain_proportions : 'Constrain proportions',
-type : 'Type',
-id : 'Id',
-name : 'Name',
-class_name : 'Class',
-vspace : 'V-Space',
-hspace : 'H-Space',
-play : 'Auto play',
-loop : 'Loop',
-menu : 'Show menu',
-quality : 'Quality',
-scale : 'Scale',
-align : 'Align',
-salign : 'SAlign',
-wmode : 'WMode',
-bgcolor : 'Background',
-base : 'Base',
-flashvars : 'Flashvars',
-liveconnect : 'SWLiveConnect',
-autohref : 'AutoHREF',
-cache : 'Cache',
-hidden : 'Hidden',
-controller : 'Controller',
-kioskmode : 'Kiosk mode',
-playeveryframe : 'Play every frame',
-targetcache : 'Target cache',
-correction : 'No correction',
-enablejavascript : 'Enable JavaScript',
-starttime : 'Start time',
-endtime : 'End time',
-href : 'Href',
-qtsrcchokespeed : 'Choke speed',
-target : 'Target',
-volume : 'Volume',
-autostart : 'Auto start',
-enabled : 'Enabled',
-fullscreen : 'Fullscreen',
-invokeurls : 'Invoke URLs',
-mute : 'Mute',
-stretchtofit : 'Stretch to fit',
-windowlessvideo : 'Windowless video',
-balance : 'Balance',
-baseurl : 'Base URL',
-captioningid : 'Captioning id',
-currentmarker : 'Current marker',
-currentposition : 'Current position',
-defaultframe : 'Default frame',
-playcount : 'Play count',
-rate : 'Rate',
-uimode : 'UI Mode',
-flash_options : 'Flash options',
-qt_options : 'Quicktime options',
-wmp_options : 'Windows media player options',
-rmp_options : 'Real media player options',
-shockwave_options : 'Shockwave options',
-autogotourl : 'Auto goto URL',
-center : 'Center',
-imagestatus : 'Image status',
-maintainaspect : 'Maintain aspect',
-nojava : 'No java',
-prefetch : 'Prefetch',
-shuffle : 'Shuffle',
-console : 'Console',
-numloop : 'Num loops',
-controls : 'Controls',
-scriptcallbacks : 'Script callbacks',
-swstretchstyle : 'Stretch style',
-swstretchhalign : 'Stretch H-Align',
-swstretchvalign : 'Stretch V-Align',
-sound : 'Sound',
-progress : 'Progress',
-qtsrc : 'QT Src',
-qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
-align_top : 'Top',
-align_right : 'Right',
-align_bottom : 'Bottom',
-align_left : 'Left',
-align_center : 'Center',
-align_top_left : 'Top left',
-align_top_right : 'Top right',
-align_bottom_left : 'Bottom left',
-align_bottom_right : 'Bottom right'
+// UK lang variables
+
+tinyMCE.addToLang('media',{
+title : 'Insert / edit embedded media',
+desc : 'Insert / edit embedded media',
+general : 'General',
+advanced : 'Advanced',
+file : 'File/URL',
+list : 'List',
+size : 'Dimensions',
+preview : 'Preview',
+constrain_proportions : 'Constrain proportions',
+type : 'Type',
+id : 'Id',
+name : 'Name',
+class_name : 'Class',
+vspace : 'V-Space',
+hspace : 'H-Space',
+play : 'Auto play',
+loop : 'Loop',
+menu : 'Show menu',
+quality : 'Quality',
+scale : 'Scale',
+align : 'Align',
+salign : 'SAlign',
+wmode : 'WMode',
+bgcolor : 'Background',
+base : 'Base',
+flashvars : 'Flashvars',
+liveconnect : 'SWLiveConnect',
+autohref : 'AutoHREF',
+cache : 'Cache',
+hidden : 'Hidden',
+controller : 'Controller',
+kioskmode : 'Kiosk mode',
+playeveryframe : 'Play every frame',
+targetcache : 'Target cache',
+correction : 'No correction',
+enablejavascript : 'Enable JavaScript',
+starttime : 'Start time',
+endtime : 'End time',
+href : 'Href',
+qtsrcchokespeed : 'Choke speed',
+target : 'Target',
+volume : 'Volume',
+autostart : 'Auto start',
+enabled : 'Enabled',
+fullscreen : 'Fullscreen',
+invokeurls : 'Invoke URLs',
+mute : 'Mute',
+stretchtofit : 'Stretch to fit',
+windowlessvideo : 'Windowless video',
+balance : 'Balance',
+baseurl : 'Base URL',
+captioningid : 'Captioning id',
+currentmarker : 'Current marker',
+currentposition : 'Current position',
+defaultframe : 'Default frame',
+playcount : 'Play count',
+rate : 'Rate',
+uimode : 'UI Mode',
+flash_options : 'Flash options',
+qt_options : 'Quicktime options',
+wmp_options : 'Windows media player options',
+rmp_options : 'Real media player options',
+shockwave_options : 'Shockwave options',
+autogotourl : 'Auto goto URL',
+center : 'Center',
+imagestatus : 'Image status',
+maintainaspect : 'Maintain aspect',
+nojava : 'No java',
+prefetch : 'Prefetch',
+shuffle : 'Shuffle',
+console : 'Console',
+numloop : 'Num loops',
+controls : 'Controls',
+scriptcallbacks : 'Script callbacks',
+swstretchstyle : 'Stretch style',
+swstretchhalign : 'Stretch H-Align',
+swstretchvalign : 'Stretch V-Align',
+sound : 'Sound',
+progress : 'Progress',
+qtsrc : 'QT Src',
+qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
+align_top : 'Top',
+align_right : 'Right',
+align_bottom : 'Bottom',
+align_left : 'Left',
+align_center : 'Center',
+align_top_left : 'Top left',
+align_top_right : 'Top right',
+align_bottom_left : 'Bottom left',
+align_bottom_right : 'Bottom right'
});
\ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/media/media.htm b/program/js/tiny_mce/plugins/media/media.htm
index 97b7cdc..2b1ef80 100644
--- a/program/js/tiny_mce/plugins/media/media.htm
+++ b/program/js/tiny_mce/plugins/media/media.htm
@@ -31,7 +31,7 @@
Flash
Quicktime
- Shockware
+ Shockwave
Windows Media
Real Media
diff --git a/program/js/tiny_mce/plugins/readme.txt b/program/js/tiny_mce/plugins/readme.txt
index b694fdb..9192b26 100644
--- a/program/js/tiny_mce/plugins/readme.txt
+++ b/program/js/tiny_mce/plugins/readme.txt
@@ -1 +1 @@
-This is the location you place TinyMCE plugins.
+This is the location you place TinyMCE plugins.
diff --git a/program/js/tiny_mce/plugins/table/css/cell.css b/program/js/tiny_mce/plugins/table/css/cell.css
index a067ecd..a47cc1a 100644
--- a/program/js/tiny_mce/plugins/table/css/cell.css
+++ b/program/js/tiny_mce/plugins/table/css/cell.css
@@ -1,17 +1,17 @@
-/* CSS file for cell dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 200px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#action {
- margin-bottom: 3px;
-}
-
-#class {
- width: 150px;
+/* CSS file for cell dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#class {
+ width: 150px;
}
\ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/css/row.css b/program/js/tiny_mce/plugins/table/css/row.css
index 1f7755d..0e397db 100644
--- a/program/js/tiny_mce/plugins/table/css/row.css
+++ b/program/js/tiny_mce/plugins/table/css/row.css
@@ -1,25 +1,25 @@
-/* CSS file for row dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 200px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#action {
- margin-bottom: 3px;
-}
-
-#rowtype,#align,#valign,#class,#height {
- width: 150px;
-}
-
-#height {
- width: 50px;
-}
-
-.col2 {
- padding-left: 20px;
-}
+/* CSS file for row dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#rowtype,#align,#valign,#class,#height {
+ width: 150px;
+}
+
+#height {
+ width: 50px;
+}
+
+.col2 {
+ padding-left: 20px;
+}
diff --git a/program/js/tiny_mce/plugins/table/css/table.css b/program/js/tiny_mce/plugins/table/css/table.css
index 804f766..82bb548 100644
--- a/program/js/tiny_mce/plugins/table/css/table.css
+++ b/program/js/tiny_mce/plugins/table/css/table.css
@@ -1,13 +1,13 @@
-/* CSS file for table dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 220px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#class {
- width: 150px;
-}
+/* CSS file for table dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 220px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#class {
+ width: 150px;
+}
diff --git a/program/js/tiny_mce/plugins/table/table.htm b/program/js/tiny_mce/plugins/table/table.htm
index 6c722db..f484187 100644
--- a/program/js/tiny_mce/plugins/table/table.htm
+++ b/program/js/tiny_mce/plugins/table/table.htm
@@ -62,7 +62,7 @@
{$lang_table_caption}
-
+
diff --git a/skins/default/editor_popup.css b/program/js/tiny_mce/themes/advanced/css/editor_popup.css
similarity index 100%
rename from skins/default/editor_popup.css
rename to program/js/tiny_mce/themes/advanced/css/editor_popup.css
diff --git a/program/js/tiny_mce/themes/advanced/editor_template.js b/program/js/tiny_mce/themes/advanced/editor_template.js
index 6e781d7..7697f19 100644
--- a/program/js/tiny_mce/themes/advanced/editor_template.js
+++ b/program/js/tiny_mce/themes/advanced/editor_template.js
@@ -1 +1 @@
-tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','bullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lang_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['forecolorpicker','forecolor.gif','lang_theme_forecolor_desc','forecolorpicker',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['backcolorpicker','backcolor.gif','lang_theme_backcolor_desc','backcolorpicker',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='{$lang_theme_block} ';for(var i=0;i'+lookup[x][1]+''}}html+=' ';return html;case"styleselect":return'{$style_select_options} ';case"fontselect":var fontHTML='{$lang_theme_fontdefault} ';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i'+parts[0]+''}}fontHTML+=' ';return fontHTML;case"fontsizeselect":return''+'{$lang_theme_font_size} '+'1 (8 pt) '+'2 (10 pt) '+'3 (12 pt) '+'4 (14 pt) '+'5 (18 pt) '+'6 (24 pt) '+'7 (36 pt) '+' ';case"|":case"separator":return' ';case"spacer":return' ';case"rowseparator":return' '}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorpicker":this._pickColor(editor_id,'forecolor');return true;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"backcolorpicker":this._pickColor(editor_id,'HiliteColor');return true;case"mceColorPicker":if(user_interface){var template=[];if(!value['callback']&&!value['color'])value['color']=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=380;template['height']=250;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:value['color']})}else{var savedVal=tinyMCE.lastColorPickerValue,elm;if(savedVal['callback']){savedVal['callback'](value);return true}elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;for(var i=0;i
';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='{$lang_theme_style_select} ';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i'+key+''}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+=' ';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b0){toolbarHTML+=" ";deltaHeight-=23}}toolbarHTML+=' ';template['html']='';if(toolbarLocation=="top")template['html']+=''+toolbarHTML+' ';if(statusbarLocation=="top"){template['html']+=''+statusbarHTML+' ';deltaHeight-=23}template['html']+=' ';if(toolbarLocation=="bottom")template['html']+=''+toolbarHTML+' ';if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+=''+statusbarHTML+' ';deltaHeight-=23}template['html']+='
';break;case"RowLayout":template['html']='';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i ';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+=''+statusbarHTML+' ';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j0){curContainerHTML+=" ";deltaHeight-=23}template['html']+=''+curContainerHTML+' '}}template['html']+='
';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+=' ';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);if(!template['delta_width'])template['delta_width']=0;if(!template['delta_height'])template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},removeInstance:function(inst){new TinyMCE_Layer(inst.editorId+'_fcMenu').remove();new TinyMCE_Layer(inst.editorId+'_bcMenu').remove()},hideInstance:function(inst){TinyMCE_AdvancedTheme._hideMenus(inst.editorId)},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+tinyMCE.xmlEncode(st)+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+tinyMCE.xmlEncode(face)+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+tinyMCE.xmlEncode(size)+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+tinyMCE.xmlEncode(color)+" "}if(tinyMCE.getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(tinyMCE.getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+tinyMCE.xmlEncode(src)+" "}if(path[i].nodeName=='A'&&tinyMCE.getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+tinyMCE.xmlEncode(href)+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+tinyMCE.xmlEncode(anchor);nodeData=""}if(tinyMCE.getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+=''+nodeName+' ';if(i>0){html+=" » "}}pathElm.innerHTML=' '+tinyMCE.getLang('lang_theme_path')+": "+html+' '}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth